diff --git a/index.php b/index.php index f4f55cb..97b4d34 100644 --- a/index.php +++ b/index.php @@ -14,10 +14,10 @@ require_once("creds.php"); - + diff --git a/js/crep.js b/js/crep.js index 5241a0f..64eedc6 100644 --- a/js/crep.js +++ b/js/crep.js @@ -1,20 +1,30 @@ -function file(fichier) -{ - if(window.XMLHttpRequest) - xhr_object = new XMLHttpRequest(); - else if(window.ActiveXObject) - xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); - else - return(false); - xhr_object.open("GET", fichier, false); - xhr_object.send(null); - if(xhr_object.readyState == 4) - return(xhr_object.responseText); +function file(fichier) { + if (window.XMLHttpRequest) + xhr_object = new XMLHttpRequest(); + else if (window.ActiveXObject) + xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); else - return(false); + return (false); + xhr_object.open("GET", fichier, false); + xhr_object.send(null); + if (xhr_object.readyState == 4) + return (xhr_object.responseText); + else + return (false); } -function loadNewDoc(doc) -{ - $("#mainContainer").html(file(doc)); +function loadNewDoc(doc) { + $("#mainContainer").html(file(doc)); + return false } + +$().ready(function() { + // Navigue vers la page indiquée dans l'URL en cas de refresh + if (window.location.hash) { + $('ul.nav a').each(function() { + if ($(this).attr('href') == window.location.hash) { + loadNewDoc($(this).attr('onclick').replace(/loadNewDoc\(\'(.+)\'\);?/, '$1')) + } + }) + } +}) diff --git a/menu.php b/menu.php index 4b05129..8d54a51 100644 --- a/menu.php +++ b/menu.php @@ -1,20 +1,20 @@