Browse Source

Edit history

master
asyncnomi 3 years ago
parent
commit
4d28d4fec1
  1. 12
      static/js/main.js

12
static/js/main.js

@ -2,17 +2,23 @@ const base_url = "https://oss110metz.rezo-rm.fr/"
var historyHandler = []; var historyHandler = [];
window.onpopstate = history.onpushstate = function(e) { window.onpopstate = history.onpushstate = function(e) {
show_page(e.state); if (e.state) {
show_page(e.state, true);
} else {
history.back();
}
}; };
history.pushState("#main-page", "", "") history.pushState("#main-page", "", "")
function show_page(id) { function show_page(id, historyPush) {
$('#main-page').hide(); $('#main-page').hide();
$('#admin-page').hide(); $('#admin-page').hide();
$('#login-page').hide(); $('#login-page').hide();
$('#demande-page').hide(); $('#demande-page').hide();
$(id).show(); $(id).show();
history.pushState(id, "", "") if (!historyPush) {
history.pushState(id, "", "")
}
} }
$("#login-button").click(function (e) { $("#login-button").click(function (e) {

Loading…
Cancel
Save