From 65417b47869e0b50e53c8fb0278301ad832652e0 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 26 May 2015 20:37:04 +0200 Subject: [PATCH] =?UTF-8?q?Task=20#1091=20-=20ajout=20de=20postes=20compta?= =?UTF-8?q?ble=20#1091=20:=20m=C3=A9canisme=20d'apparition=20d'un=20bouton?= =?UTF-8?q?=20"up"=20dans=20toutes=20les=20pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/js/scripts.js | 51 ++++++++++++++++++++++++++++++++++++++ html/js/sorttable.js | 3 ++- include/param_pcmn.inc.php | 5 ++++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/html/js/scripts.js b/html/js/scripts.js index ac19a939d..f4b2e5f8d 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -2687,4 +2687,55 @@ function logout() var tmp_last = tmp_b.length - 1 var place_logout = tmp_place.replace(tmp_b[tmp_last], 'logout.php'); window.location.href = place_logout; +} +/** + * Create a div which can be used in a anchor + * @returns {undefined} + */ +function create_anchor_up() +{ + if ( $('up_top')) return; + + var newElt = new Element('div'); + newElt.setAttribute('id', 'up_top'); + newElt.innerHTML=''; + + var parent = $('info_div').parentNode; + parent.insertBefore(newElt, $('info_div')); + +} +/** + * Initialize the window to show the button "UP" if the window is scrolled + * vertically + * @returns {undefined} + */ +function init_scroll() +{ + var up=new Element('div',{"class":"inner_box", + "style":"padding:10px;left:auto;width:30px;height: auto;display:none;position:fixed;top:25px;right:20px;text-align:center", + id:"go_up" + }); + up.innerHTML=' '; + document.body.appendChild(up); + window.onscroll=function () { + if ( document.viewport.getScrollOffsets().top> 0) { + if ($('go_up').visible() == false) { + $('go_up').setOpacity(0.85); + $('go_up').show(); + } + } else { + $('go_up').hide(); + } + } +} +/** + * All the onload must be here otherwise the other will overwritten + * @returns {undefined} + */ +window.onload=function () +{ + console.log('loading'); + create_anchor_up(); + init_scroll(); + sorttable.init } \ No newline at end of file diff --git a/html/js/sorttable.js b/html/js/sorttable.js index c9f384c1f..cfe0ae4fd 100644 --- a/html/js/sorttable.js +++ b/html/js/sorttable.js @@ -386,7 +386,8 @@ if (/WebKit/i.test(navigator.userAgent)) { // sniff } /* for other browsers */ -window.onload = sorttable.init; +// Moved into scripts.js +//window.onload = sorttable.init; // written by Dean Edwards, 2005 // with input from Tino Zijdel, Matthias Miller, Diego Perini diff --git a/include/param_pcmn.inc.php b/include/param_pcmn.inc.php index 742c0a72e..cc6934521 100644 --- a/include/param_pcmn.inc.php +++ b/include/param_pcmn.inc.php @@ -129,6 +129,11 @@ for ($i=0; $i <$MaxRow; $i++): endfor; ?> +