Task #1091 - ajout de postes comptable

#1091 : mécanisme d'apparition d'un bouton "up" dans toutes les pages
This commit is contained in:
Dany De Bontridder 2015-05-26 20:37:04 +02:00
parent bcb02ddf12
commit 65417b4786
3 changed files with 58 additions and 1 deletions

View file

@ -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" >&#11014;</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
}

View file

@ -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

View file

@ -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%">