diff --git a/website/include/floatingdialog.js b/website/include/floatingdialog.js index bd08bae..570d990 100644 --- a/website/include/floatingdialog.js +++ b/website/include/floatingdialog.js @@ -1,6 +1,7 @@ FloatingDialog = function () { this.dialogDiv = null; + this.contentDiv = null; }; FloatingDialog.prototype.Open = function (parameters) @@ -17,9 +18,9 @@ FloatingDialog.prototype.Open = function (parameters) this.Close (); } - this.dialogDiv = $('
').addClass ('dialog'); + this.dialogDiv = $('
').addClass ('dialog').appendTo ($('body')); $('
').addClass ('dialogtitle').html (parameters.title).appendTo (this.dialogDiv); - $('
').addClass ('dialogcontent').html (parameters.text).appendTo (this.dialogDiv); + this.contentDiv = $('
').addClass ('dialogcontent').html (parameters.text).appendTo (this.dialogDiv); var buttonsDiv = $('
').addClass ('dialogbuttons').appendTo (this.dialogDiv); var i, button; @@ -27,15 +28,16 @@ FloatingDialog.prototype.Open = function (parameters) button = parameters.buttons[i]; AddButton (this, buttonsDiv, button); } - this.dialogDiv.appendTo ($('body')); - var myThis = this; - $('body').click (function (event) { - myThis.MouseClick (event); - }); + document.addEventListener ('click', this.MouseClick.bind (this), true); this.Resize (); }; +FloatingDialog.prototype.SetText = function (text) +{ + this.contentDiv.html (text); +}; + FloatingDialog.prototype.Close = function () { if (this.dialogDiv === null) { diff --git a/website/include/importermenu.js b/website/include/importermenu.js index 972ada5..96df09c 100644 --- a/website/include/importermenu.js +++ b/website/include/importermenu.js @@ -51,7 +51,8 @@ ImporterMenu.prototype.AddSubItem = function (parent, name, parameters) } var menuItem = $('
').addClass ('menuitem').appendTo (parent); - + var menuItemClickHandler = null; + var menuContent = null; if (parameters !== undefined && parameters !== null) { if (parameters.openCloseButton !== undefined && parameters.openCloseButton !== null) { @@ -63,7 +64,7 @@ ImporterMenu.prototype.AddSubItem = function (parent, name, parameters) var openCloseImage = $('').addClass ('menubutton').attr ('title', parameters.openCloseButton.title).appendTo (menuItem); openCloseImage.attr ('src', isOpen ? parameters.openCloseButton.open : parameters.openCloseButton.close); - openCloseImage.click (function () { + menuItemClickHandler = function () { isOpen = !isOpen; if (isOpen) { if (parameters.openCloseButton.onOpen !== undefined && parameters.openCloseButton.onOpen !== null) { @@ -76,7 +77,8 @@ ImporterMenu.prototype.AddSubItem = function (parent, name, parameters) } menuContent.toggle (); openCloseImage.attr ('src', isOpen ? parameters.openCloseButton.open : parameters.openCloseButton.close); - }); + }; + openCloseImage.click (menuItemClickHandler); } if (parameters.userButton !== undefined && parameters.userButton !== null) { @@ -92,7 +94,11 @@ ImporterMenu.prototype.AddSubItem = function (parent, name, parameters) } } - $('
').addClass ('menuitem').html (GetTruncatedName (name)).attr ('title', name).appendTo (menuItem); + var menuItemText = $('
').addClass ('menuitem').html (GetTruncatedName (name)).attr ('title', name).appendTo (menuItem); + if (menuItemClickHandler != null) { + menuItemText.css ('cursor', 'pointer'); + menuItemText.click (menuItemClickHandler); + } return menuContent; };