mirror of
https://github.com/Mibew/mibew.git
synced 2025-05-12 06:43:08 +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}
|
* @type {Boolean}
|
||||||
*/
|
*/
|
||||||
this.modSecurity = options.modSecurity || false;
|
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.
|
// Call parent constructor.
|
||||||
BasePopup.call(this, options);
|
BasePopup.call(this, options);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Popup iframe DOM Element.
|
||||||
|
* @type {Node}
|
||||||
|
*/
|
||||||
this.iframe = null;
|
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
|
// Load default styles. These styles hide the popup while real styles
|
||||||
// are loading.
|
// are loading.
|
||||||
this.attachDefaultStyles();
|
this.attachDefaultStyles();
|
||||||
@ -422,11 +426,6 @@ var Mibew = Mibew || {};
|
|||||||
* value is omitted, the chat initialization URL will be loaded.
|
* value is omitted, the chat initialization URL will be loaded.
|
||||||
*/
|
*/
|
||||||
Mibew.ChatPopup.Window.prototype.open = function(url) {
|
Mibew.ChatPopup.Window.prototype.open = function(url) {
|
||||||
if (this.isOpened) {
|
|
||||||
// Do not open the popup twice.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.window = window.open(
|
this.window = window.open(
|
||||||
url || this.buildChatUrl(),
|
url || this.buildChatUrl(),
|
||||||
'mibewChat' + this.id,
|
'mibewChat' + this.id,
|
||||||
@ -434,22 +433,19 @@ var Mibew = Mibew || {};
|
|||||||
);
|
);
|
||||||
this.window.focus();
|
this.window.focus();
|
||||||
this.window.opener = window;
|
this.window.opener = window;
|
||||||
|
|
||||||
this.isOpened = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the popup.
|
* Closes the popup.
|
||||||
*/
|
*/
|
||||||
Mibew.ChatPopup.Window.prototype.close = function() {
|
Mibew.ChatPopup.Window.prototype.close = function() {
|
||||||
if (!this.isOpened) {
|
if (!this.window) {
|
||||||
// The window was not opened thus it should not be closed.
|
// There is nothing to close.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.window.close();
|
this.window.close();
|
||||||
this.window = null;
|
this.window = null;
|
||||||
this.isOpened = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user