Module: nagvis Branch: master Commit: 6911215a40e1fa40e5e765a041f455c7df864689 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=6911215a40e1fa40e5e765a041f455c7df864689
Author: Lars Michelsen <[email protected]> Date: Sun Jul 25 14:41:07 2010 +0200 Only allowing one popupWindow at the same time. Closing the exsiting one when opening a new one --- share/frontend/nagvis-js/js/popupWindow.js | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/share/frontend/nagvis-js/js/popupWindow.js b/share/frontend/nagvis-js/js/popupWindow.js index c9f5b7d..0362851 100644 --- a/share/frontend/nagvis-js/js/popupWindow.js +++ b/share/frontend/nagvis-js/js/popupWindow.js @@ -84,7 +84,12 @@ function selectmouse(e) { * @author Lars Michelsen <[email protected]> */ function popupWindowClose() { - document.body.removeChild(document.getElementById('popupWindow')); + var w = document.getElementById('popupWindow'); + + if(w) { + document.body.removeChild(w); + w = null; + } } function popupWindowRefresh() { @@ -138,17 +143,17 @@ function popupWindowPutContent(oContent) { * @author Lars Michelsen <[email protected]> */ function popupWindow(title, oContent, openOnMousePosition, sWidth) { - if(oContent === null || oContent.code === null) { + if(oContent === null || oContent.code === null) return false; - } - if(typeof openOnMousePosition === 'undefined') { + if(typeof openOnMousePosition === 'undefined') openOnMousePosition = true; - } - if(typeof sWidth === 'undefined' || sWidth === null) { + if(typeof sWidth === 'undefined' || sWidth === null) sWidth = ''; - } + + // Maybe some other window is still open. Close it now + popupWindowClose(); // Default window position var posX = 100; ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
