[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 04/04: Task #1091 - ajout de postes comptabl
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 04/04: Task #1091 - ajout de postes comptable #1091 : mécanisme d'apparition d'un bouton "up" dans toutes les pages |
Date: |
Tue, 26 May 2015 18:40:57 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 65417b47869e0b50e53c8fb0278301ad832652e0
Author: Dany De Bontridder <address@hidden>
Date: Tue May 26 20:37:04 2015 +0200
Task #1091 - ajout de postes comptable
#1091 : mécanisme d'apparition d'un bouton "up" dans toutes les pages
---
html/js/scripts.js | 51 ++++++++++++++++++++++++++++++++++++++++++++
html/js/sorttable.js | 3 +-
include/param_pcmn.inc.php | 5 ++++
3 files changed, 58 insertions(+), 1 deletions(-)
diff --git a/html/js/scripts.js b/html/js/scripts.js
index ac19a93..f4b2e5f 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='<a id="up_top"></a>';
+
+ 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=' <a class="button" href="#up_top" >⬆</a>';
+ 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 c9f384c..cfe0ae4 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 742c0a7..cc69345 100644
--- a/include/param_pcmn.inc.php
+++ b/include/param_pcmn.inc.php
@@ -129,6 +129,11 @@ for ($i=0; $i <$MaxRow; $i++):
endfor;
?>
</TABLE>
+ <?php
+ /* it will override the classic onscroll (see scripts.js)
+ * @see scripts.js
+ */
+ ?>
<div id="go_up" class="inner_box"
style="padding:0px;left:auto;width:250px;height:
100px;display:none;position:fixed;top:5px;right:20px">
<?php echo HtmlInput::title_box(_('Navigation'), 'go_up', "hide");?>
<div style="margin:3%;padding:3%">