From 770319ed5367410d56fa4476e0b7f3675363c8a2 Mon Sep 17 00:00:00 2001 From: asyncnomi Date: Wed, 21 Dec 2022 22:57:49 +0100 Subject: [PATCH 1/2] fix midlle section and history push --- static/css/main.css | 9 +++++++-- static/js/main.js | 10 ++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/static/css/main.css b/static/css/main.css index 3eed9d0..ae60f53 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -97,8 +97,9 @@ a:hover { } .row-section { - display: flex; - flex-direction: row; + display: grid; + grid-auto-flow: column; + grid-auto-columns: 1fr 0fr 1fr; } .column-section { @@ -193,7 +194,11 @@ button[type="submit"]:hover { #logo > img { width: 150px; } + #spacer { + display: none; + } .row-section { + display: flex; flex-direction: column; width: 100%; align-items: center; diff --git a/static/js/main.js b/static/js/main.js index 77d249f..ce51694 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1,11 +1,18 @@ const base_url = "https://oss110metz.rezo-rm.fr/" +var historyHandler = []; +window.onpopstate = history.onpushstate = function(e) { + show_page(e.state); +}; +history.pushState("#main-page", "", "") + function show_page(id) { $('#main-page').hide(); $('#admin-page').hide(); $('#login-page').hide(); $('#demande-page').hide(); $(id).show(); + history.pushState(id, "", "") } $("#login-button").click(function (e) { @@ -27,7 +34,7 @@ $("#login-button").click(function (e) { localStorage.setItem("user", data.user); show_page('#demande-page'); } else { - + } } @@ -76,4 +83,3 @@ $(window).on("load", function() { })); }, 1000); }); - From e1cad5a33cea950e324713e26f9295185ef6b93d Mon Sep 17 00:00:00 2001 From: johan Date: Wed, 21 Dec 2022 22:58:48 +0100 Subject: [PATCH 2/2] crotte --- static/js/main.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/static/js/main.js b/static/js/main.js index 77d249f..c5e4e79 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1,10 +1,11 @@ const base_url = "https://oss110metz.rezo-rm.fr/" +var page = ['#main-page', '#admin-page', '#login-page', '#demande-page']; + function show_page(id) { - $('#main-page').hide(); - $('#admin-page').hide(); - $('#login-page').hide(); - $('#demande-page').hide(); + for(i in page) { + $(page[i]).hide(); + } $(id).show(); } @@ -51,6 +52,10 @@ $(window).on("load", function() { navigator.serviceWorker.register('./js/sw.js'); } + for(i in page) { + $(page[i]).css('z-index', i); + } + /* load timer */ window.setInterval(function() { var time = $("#timer").text();