/** * Package main JavaScript * * @package myEASYdb * @author Ugo Grandolini * @version 0.0.1 */ /** * Globals */ var mouseAbsX = 0, mouseAbsY = 0; //alert(window.location.protocol + '//' + window.location.hostname + '/'); var ajaxURL = window.location.protocol + '//' + window.location.hostname + '//wp-content/plugins/myeasydb/ajax_ro.php'; var imgURL = window.location.protocol + '//' + window.location.hostname + '//wp-content/plugins/myeasydb/img/'; //alert(ajaxURL); //alert(imgURL); //alert('js'); /** * Return an array with the page dimensions [width, height] */ function getPageDimensions() { var body = document.getElementsByTagName('body')[0]; var bodyOffsetWidth = 0, bodyOffsetHeight = 0, bodyScrollWidth = 0, bodyScrollHeight = 0, this_pagedim = [0,0]; if(typeof document.documentElement!='undefined' && typeof document.documentElement.scrollWidth!='undefined') { this_pagedim[0] = document.documentElement.scrollWidth; this_pagedim[1] = document.documentElement.scrollHeight; } bodyOffsetWidth = body.offsetWidth; bodyOffsetHeight = body.offsetHeight; bodyScrollWidth = body.scrollWidth; bodyScrollHeight = body.scrollHeight; if(bodyOffsetWidth>this_pagedim[0]) { this_pagedim[0] = bodyOffsetWidth; } if(bodyOffsetHeight>this_pagedim[1]) { this_pagedim[1] = bodyOffsetHeight; } if(bodyScrollWidth>this_pagedim[0]) { this_pagedim[0] = bodyScrollWidth; } if(bodyScrollHeight>this_pagedim[1]) { this_pagedim[1] = bodyScrollHeight; } return this_pagedim; } /** * Initialize the function to display the popup tag */ function pop(msg, link, secs) { if(!msg) { msg = 'pop(missing msg!)'; } if(msg=='*closePop') { var popWin = document.getElementById('myeasydb_popWin'); if(popWin) { document.body.style.cursor = 'default'; popWin.style.display = 'none'; } return; } setTimeout('pop_show(\'' + msg + '\',\'' + link + '\',\'' + secs + '\')', 10); } /** * Display the popup tag */ function pop_show(msg, link, secs) { if(!secs) { secs = getCookie('pop_time'); } if(!secs || isNaN(secs)) { secs = 1; } //alert('msg:'+msg+' link:'+link+' sec:'+secs); document.body.style.cursor = 'wait'; var popWin = document.getElementById('myeasydb_popWin'); if(popWin) { var this_pagedim = getPageDimensions(); popWin.innerHTML = '
' + msg + '
'; popWin.style.top = '0px'; popWin.style.left = '0px'; popWin.style.width = this_pagedim[0] + 'px'; popWin.style.height = this_pagedim[1] + 'px'; popWin.style.display= 'block'; } // // redirect // if(link) { setTimeout("window.location='" + link + "';", secs * 1000); } else { setTimeout("pop('*closePop')", secs * 1000); } } /** * Toggle the display status of a functionality element * taking care of its related cookie to represent the same * status when reloading the page */ function el_display_toggler(elID, togIMG) { //alert(togIMG.length); //alert(location.href); //alert(el.src); if(togIMG.length>0) { var el = document.getElementById(togIMG); if(el.src==imgURL + 'screen-options-right-up.gif') { document.getElementById(elID).style.display='none'; el.src = imgURL + 'screen-options-right.gif'; setCookie('myeasydb'+elID, 0); } else { document.getElementById(elID).style.display='block'; el.src = imgURL + 'screen-options-right-up.gif'; setCookie('myeasydb'+elID, 1); } } } /** * Sets the background for a number of elements */ function resetSelectedTdTables(t, prefix) { var el = ''; for(i=0;i0) { position=[document.documentElement.scrollLeft,document.documentElement.scrollTop]; } else if(typeof document.body.scrollTop!='undefined') { position=[document.body.scrollLeft,document.body.scrollTop]; } //document.title=position; return position; } //~~~~~~~~~~~~~~~~~~~~~~~~ function mouseMove(e) { //~~~~~~~~~~~~~~~~~~~~~~~~ if(!e) { var e = window.event; } var scroll = Array(); scroll = getScrollingPosition(); // get mouse coords // if(document.all) { // browser is IE // mouseAbsX = event.clientX; mouseAbsY = event.clientY; } else { // browser is NOT IE // mouseAbsX = e.pageX; mouseAbsY = e.pageY; } mouseAbsX = mouseAbsX + scroll[0]; mouseAbsY = mouseAbsY - scroll[1]; //window.status='mouseAbsX:'+mouseAbsX+' mouseAbsY:'+mouseAbsY+' scroll[0]:'+scroll[0]+' scroll[1]:'+scroll[1]; } document.onmousemove = mouseMove;