new listenerOptions, now config is set in mailgo not in init
This commit is contained in:
@@ -288,12 +288,10 @@ var gmail, outlook, mailgo_open, telegram, wa, skype, call, copyMail, copyTel;
|
||||
* the function that creates the mailgo elements in DOM
|
||||
*/
|
||||
|
||||
var mailgo_mailgoInit = function mailgoInit(mailgoConfig) {
|
||||
var mailgo_mailgoInit = function mailgoInit() {
|
||||
var _config, _config2;
|
||||
|
||||
// set the global config
|
||||
config = mailgoConfig; // translations
|
||||
|
||||
// translations
|
||||
var _ref = i18n_namespaceObject,
|
||||
translations = _ref.translations; // if a default language is defined use it
|
||||
|
||||
@@ -1053,18 +1051,32 @@ var mailgoStyle = function mailgoStyle() {
|
||||
}; // mailgo
|
||||
|
||||
|
||||
function mailgo(config) {
|
||||
// if the window is defined...
|
||||
function mailgo(mailgoConfig) {
|
||||
// set the global config
|
||||
config = mailgoConfig; // if the window is defined...
|
||||
|
||||
if (window && typeof window !== "undefined") {
|
||||
var _config8;
|
||||
|
||||
// add the style for mailgo
|
||||
mailgoStyle(); // if is set an initEvent add the listener
|
||||
|
||||
if (config === null || config === void 0 ? void 0 : config.initEvent) {
|
||||
document.addEventListener(config.initEvent, function () {
|
||||
mailgo_mailgoInit(config);
|
||||
});
|
||||
if ((_config8 = config) === null || _config8 === void 0 ? void 0 : _config8.initEvent) {
|
||||
var _config9;
|
||||
|
||||
if ((_config9 = config) === null || _config9 === void 0 ? void 0 : _config9.listenerOptions) {
|
||||
// listener options specified
|
||||
document.addEventListener(config.initEvent, function () {
|
||||
mailgo_mailgoInit();
|
||||
}, config.listenerOptions);
|
||||
} else {
|
||||
// no listener options
|
||||
document.addEventListener(config.initEvent, function () {
|
||||
mailgo_mailgoInit();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
mailgo_mailgoInit(config);
|
||||
mailgo_mailgoInit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user