Fix floating dialog open.
This commit is contained in:
parent
4a66d9993b
commit
6042928cc5
@ -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 = $('<div>').addClass ('dialog');
|
||||
this.dialogDiv = $('<div>').addClass ('dialog').appendTo ($('body'));
|
||||
$('<div>').addClass ('dialogtitle').html (parameters.title).appendTo (this.dialogDiv);
|
||||
$('<div>').addClass ('dialogcontent').html (parameters.text).appendTo (this.dialogDiv);
|
||||
this.contentDiv = $('<div>').addClass ('dialogcontent').html (parameters.text).appendTo (this.dialogDiv);
|
||||
var buttonsDiv = $('<div>').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) {
|
||||
|
||||
@ -51,7 +51,8 @@ ImporterMenu.prototype.AddSubItem = function (parent, name, parameters)
|
||||
}
|
||||
|
||||
var menuItem = $('<div>').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 = $('<img>').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)
|
||||
}
|
||||
}
|
||||
|
||||
$('<div>').addClass ('menuitem').html (GetTruncatedName (name)).attr ('title', name).appendTo (menuItem);
|
||||
var menuItemText = $('<div>').addClass ('menuitem').html (GetTruncatedName (name)).attr ('title', name).appendTo (menuItem);
|
||||
if (menuItemClickHandler != null) {
|
||||
menuItemText.css ('cursor', 'pointer');
|
||||
menuItemText.click (menuItemClickHandler);
|
||||
}
|
||||
return menuContent;
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user