/* Copyright © 2008 by Paul Schubert (www.schubert-rostock.com) */ var http_request = false; var ziel_url=""; var current_url=""; var url_change_test_active; var current_kind; var auto="0"; var old_dyn_load=new Array(); document.getElementById("ajax_iframe").innerHTML='<iframe id="testframe" src="history.php" name="historyframe" style="display:none;"></iframe>'; if (document.location.href.indexOf("#")!=-1) { dyn_load(document.location.href.split("#")[1],"cont_simple_hnav",0);/*Schwachstelle! --> "cont_simple_hnav" bzw. kind wird nicht gespeichert (bookmark)*/ } function dyn_load(url,kind,auto_f) { if (!((old_dyn_load['ziel_url']==url) && (old_dyn_load['current_kind']==kind) && (old_dyn_load['auto']==auto_f))){ old_dyn_load['ziel_url']=url; old_dyn_load['current_kind']=kind; old_dyn_load['auto']=auto_f; ziel_url=url; current_kind=kind; if (!auto_f) auto_f="0"; auto=auto_f; url="live_load_content.php?id="+url; macheRequest(url,kind); } } function macheRequest(url,kind) { http_request = false; if (window.XMLHttpRequest) { /* Mozilla, Safari,...*/ http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); /* zu dieser Zeile siehe weiter unten*/ } } else if (window.ActiveXObject) { /* IE*/ try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen'); return false; } http_request.onreadystatechange = alertInhalt; http_request.open('GET', url, true); http_request.send(null); } function alertInhalt() { if (http_request.readyState == 4) { if (http_request.status == 200) { var myH1 = document.createElement("div"); myH1.innerHTML=http_request.responseText; /*myH1.innerHTML='HALLO <script type="text/javascript" defer="defer">alert("Ä");<\/script>';*/ var ausgabebereich = document.getElementById("actual_content"); while (ausgabebereich.hasChildNodes()) ausgabebereich.removeChild(ausgabebereich.firstChild); ausgabebereich.appendChild(myH1); script_search_eval(http_request.responseText); if (auto=="0") document.getElementById("testframe").src="history.php?old="+ziel_url+"&amp;kind="+current_kind+"&amp;parent_titel="+document.title; else current_url=document.location.href; /*return false;*/ } else { /*return true;*/ alert('Bei dem Request ist ein Problem aufgetreten.'); } if (ziel_url!="") url_change_test_active=window.setInterval("url_change_test()",500); } } function script_search_eval(content){ try { if (content != '') { var script = ""; content = content.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){if (content !== null) script += arguments[1] + '\n';return '';}); if (script) (window.execScript) ? window.execScript(script) : window.setTimeout(script, 0); } return false; } catch(e) {} } function url_change_test() { var new_url_slpit=document.location.href; if (new_url_slpit.indexOf("#")==-1) new_url_slpit=new_url_slpit+"#"; new_url_slpit=new_url_slpit.split("#"); if (current_url.indexOf("#")==-1) current_url=current_url+"#"; var current_url_slpit=current_url.split("#"); if ((new_url_slpit[0]==current_url_slpit[0])&&(new_url_slpit[1]!=current_url_slpit[1])) { /*document.title=current_url+" || "+document.location.href;*/ /*alert(new_url_slpit[1]+" || "+current_url_slpit[1]);*/ if (new_url_slpit[1]=="") { var s=document.location.href.split("/"); new_url_slpit[1]=s[s.length-1].split(".")[0]; } window.clearInterval(url_change_test_active); dyn_load(new_url_slpit[1],current_kind,1); } }