mirror of
https://github.com/Mibew/mibew.git
synced 2025-01-31 05:20:30 +03:00
Fix bug with single popup window openning
This commit is contained in:
parent
21ae86958d
commit
edcd348bca
@ -260,12 +260,6 @@ var Mibew = Mibew || {};
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.modSecurity = options.modSecurity || false;
|
||||
|
||||
/**
|
||||
* Indicates if the popup is opened.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.isOpened = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -298,8 +292,18 @@ var Mibew = Mibew || {};
|
||||
// Call parent constructor.
|
||||
BasePopup.call(this, options);
|
||||
|
||||
/**
|
||||
* Popup iframe DOM Element.
|
||||
* @type {Node}
|
||||
*/
|
||||
this.iframe = null;
|
||||
|
||||
/**
|
||||
* Indicates if the popup is opened.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.isOpened = false;
|
||||
|
||||
// Load default styles. These styles hide the popup while real styles
|
||||
// are loading.
|
||||
this.attachDefaultStyles();
|
||||
@ -422,11 +426,6 @@ var Mibew = Mibew || {};
|
||||
* value is omitted, the chat initialization URL will be loaded.
|
||||
*/
|
||||
Mibew.ChatPopup.Window.prototype.open = function(url) {
|
||||
if (this.isOpened) {
|
||||
// Do not open the popup twice.
|
||||
return;
|
||||
}
|
||||
|
||||
this.window = window.open(
|
||||
url || this.buildChatUrl(),
|
||||
'mibewChat' + this.id,
|
||||
@ -434,22 +433,19 @@ var Mibew = Mibew || {};
|
||||
);
|
||||
this.window.focus();
|
||||
this.window.opener = window;
|
||||
|
||||
this.isOpened = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the popup.
|
||||
*/
|
||||
Mibew.ChatPopup.Window.prototype.close = function() {
|
||||
if (!this.isOpened) {
|
||||
// The window was not opened thus it should not be closed.
|
||||
if (!this.window) {
|
||||
// There is nothing to close.
|
||||
return;
|
||||
}
|
||||
|
||||
this.window.close();
|
||||
this.window = null;
|
||||
this.isOpened = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user