/** \file html\javascript\mouse.js * \brief ZKL webinterface mouse javascript functionality. * \author Rob Schalken, Core|Vision * \version 1.0 * \date 17-10-2008 * * This file contains the mouse/contextmenu functionality */ // Global variables var MouseX; var MouseY; var isPopup = false; var overPopupMenu = false; // Catch alle mouse move/down and window resize events document.onmousemove = GetCoordinates; document.onmousedown = HidePopup; document.onkeydown = KeyboardHidePopup; window.onresize = HidePopup; // Get mouse coordinates function GetCoordinates(e) { if (window.event) { MouseX = window.event.clientX; MouseY = window.event.clientY; } else { MouseX = e.clientX; MouseY = e.clientY; } } // Hide popup menu function KeyboardHidePopup(e) { if (window.event) { if (window.event.keyCode == 27) { HidePopup('', true); } } else { if (e.keyCode == 27) { HidePopup('', true); } } } // Hide popup menu function HidePopup(e, force) { // Hide popup forced? if ((typeof(force) != 'undefined') && (force == true)) { isPopup = false; overPopupMenu = false; getElement('popupdiv').style.display = "none"; return true; } // Popup visible? else if (isPopup) { if (overPopupMenu == false) { isPopup = false; overPopupMenu = false; getElement('popupdiv').style.display = "none"; return true; } return true; } return true; } // Show popup menu function ShowPopup(obj) { // Not applicable for extend info and extended menu if ((!getURLParam('extended_info').length) && (!getURLParam('extended_menu').length)) { // Set flag isPopup = true; // Display menu getElement('popupdiv').style.display = ""; // Move menu to current position getElement('popupdiv').style.top = MouseY + getScrollY() + 5 + 'px'; getElement('popupdiv').style.left = MouseX + getScrollX() + 10 + 'px'; // Screen check (height) if ((parseInt(getElement('popupdiv').style.top) + getElement('popupdiv').offsetHeight) >= (ActiveWindowHeight() + getScrollY())) { getElement('popupdiv').style.top = parseInt(getElement('popupdiv').style.top) - getElement('popupdiv').offsetHeight - 20 + 'px'; } // Screen check (width) if ((parseInt(getElement('popupdiv').style.left) + getElement('popupdiv').offsetWidth - getScrollX()) >= (ActiveWindowWidth())) { getElement('popupdiv').style.left = parseInt(getElement('popupdiv').style.left) - getElement('popupdiv').offsetWidth - 10 + 'px'; } // Get link var link = obj.href; // check for mtinfo and for beta/ip1 dualinventive server if ((link.search('mtinfo') != -1) || (link.search('dualinventive') != -1)) { link += '&renew=1'; } // Find javascript:location.hef if (link.search('javascript:location.href=\'') != -1) { // Link to current host? if (link.search(window.location.host) != -1) { // Replace javascript:location.href by https://host/ link = link.replace('javascript:location.href=\'', window.location.protocol + '//' + window.location.host + '/'); // Remove '; chars at the end link = link.substr(0, link.length-2); } } // Set link getElement('link1').onclick = function () { HidePopup('', '1'); window.open(link, '_BLANK', 'height=' + screen.height + ', width=' + screen.width + ',menubar=yes,status=yes,toolbar=yes,location=yes,directories=yes,scrollbars=yes'); } try { getElement('link2').onclick = function () { HidePopup('', '1'); window.open(link); } } catch(e) { /* Silent exception */ } // Clear selection getElement('item1').style.backgroundColor='#FFFFFF'; try { getElement('item2').style.backgroundColor='#FFFFFF'; } catch(e) { /* Silent exception */ } } return true; }