mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-26 00:04:33 +03:00
parent
b6bfc39cbf
commit
525b7de7e2
@ -203,7 +203,6 @@ var Mibew = Mibew || {};
|
|||||||
Mibew.ChatPopup.init = function(options) {
|
Mibew.ChatPopup.init = function(options) {
|
||||||
var canUseIFrame = (window.postMessage && options.preferIFrame),
|
var canUseIFrame = (window.postMessage && options.preferIFrame),
|
||||||
Popup = canUseIFrame ? Mibew.ChatPopup.IFrame : Mibew.ChatPopup.Window;
|
Popup = canUseIFrame ? Mibew.ChatPopup.IFrame : Mibew.ChatPopup.Window;
|
||||||
|
|
||||||
Mibew.Objects.ChatPopups[options.id] = new Popup(options);
|
Mibew.Objects.ChatPopups[options.id] = new Popup(options);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -260,6 +259,13 @@ var Mibew = Mibew || {};
|
|||||||
* @type {Boolean}
|
* @type {Boolean}
|
||||||
*/
|
*/
|
||||||
this.modSecurity = options.modSecurity || false;
|
this.modSecurity = options.modSecurity || false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chat style
|
||||||
|
* @type {String}
|
||||||
|
*/
|
||||||
|
this.styleName = options.style;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -424,6 +430,9 @@ var Mibew = Mibew || {};
|
|||||||
this.iframe.src = url || this.buildChatUrl();
|
this.iframe.src = url || this.buildChatUrl();
|
||||||
this.isOpened = true;
|
this.isOpened = true;
|
||||||
|
|
||||||
|
// Store style name in case we need it during iframe reopening
|
||||||
|
Mibew.Utils.createCookie('mibew-chat-frame-style-' + this.id, this.styleName);
|
||||||
|
|
||||||
// Check minification status of the popup and toggle it if needed.
|
// Check minification status of the popup and toggle it if needed.
|
||||||
var minifiedPopup = Mibew.Utils.readCookie('mibew-chat-frame-minified-' + this.id);
|
var minifiedPopup = Mibew.Utils.readCookie('mibew-chat-frame-minified-' + this.id);
|
||||||
if (minifiedPopup === 'true') {
|
if (minifiedPopup === 'true') {
|
||||||
@ -441,8 +450,9 @@ var Mibew = Mibew || {};
|
|||||||
var check = Mibew.Utils.loadScript(url + '/check', 'mibew-check-iframe-' + this.id);
|
var check = Mibew.Utils.loadScript(url + '/check', 'mibew-check-iframe-' + this.id);
|
||||||
check.popup = this;
|
check.popup = this;
|
||||||
check.url = url;
|
check.url = url;
|
||||||
|
var style = Mibew.Utils.readCookie('mibew-chat-frame-style-' + this.id);
|
||||||
check.onload = function() {
|
check.onload = function() {
|
||||||
this.popup.open(this.url);
|
this.popup.open(this.url + '?style=' + style);
|
||||||
};
|
};
|
||||||
check.onerror = function() {
|
check.onerror = function() {
|
||||||
this.popup.close();
|
this.popup.close();
|
||||||
@ -548,7 +558,6 @@ var Mibew = Mibew || {};
|
|||||||
// which is opened in iframe popup.
|
// which is opened in iframe popup.
|
||||||
Mibew.Utils.addEventListener(window, 'message', function(event) {
|
Mibew.Utils.addEventListener(window, 'message', function(event) {
|
||||||
var matches = /^mibew-chat-started\:mibewChat([0-9A-Za-z]+)\:(.*)$/.exec(event.data);
|
var matches = /^mibew-chat-started\:mibewChat([0-9A-Za-z]+)\:(.*)$/.exec(event.data);
|
||||||
|
|
||||||
if (matches) {
|
if (matches) {
|
||||||
Mibew.Utils.createCookie('mibew-chat-frame-' + matches[1], matches[2]);
|
Mibew.Utils.createCookie('mibew-chat-frame-' + matches[1], matches[2]);
|
||||||
}
|
}
|
||||||
|
@ -220,6 +220,7 @@ abstract class AbstractGenerator implements GeneratorInterface
|
|||||||
'preferIFrame' => $this->getOption('prefer_iframe'),
|
'preferIFrame' => $this->getOption('prefer_iframe'),
|
||||||
'modSecurity' => $this->getOption('mod_security'),
|
'modSecurity' => $this->getOption('mod_security'),
|
||||||
'forceSecure' => $this->getOption('force_secure'),
|
'forceSecure' => $this->getOption('force_secure'),
|
||||||
|
'style' => $this->getOption('chat_style'),
|
||||||
) + $this->getPopupStyle();
|
) + $this->getPopupStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user