Prevent multi init()
This commit is contained in:
parent
c186089797
commit
57cc4c87f4
|
|
@ -3,7 +3,8 @@
|
||||||
// define correct path for files inclusion
|
// define correct path for files inclusion
|
||||||
var scripts = document.getElementsByTagName('script'),
|
var scripts = document.getElementsByTagName('script'),
|
||||||
path = scripts[scripts.length - 1].src.split('?')[0],
|
path = scripts[scripts.length - 1].src.split('?')[0],
|
||||||
cdn = path.split('/').slice(0, -1).join('/') + '/';
|
cdn = path.split('/').slice(0, -1).join('/') + '/',
|
||||||
|
alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch;
|
||||||
|
|
||||||
var tarteaucitron = {
|
var tarteaucitron = {
|
||||||
"cdn": cdn,
|
"cdn": cdn,
|
||||||
|
|
@ -14,10 +15,13 @@ var tarteaucitron = {
|
||||||
"launch": [],
|
"launch": [],
|
||||||
"init": function (params) {
|
"init": function (params) {
|
||||||
"use strict";
|
"use strict";
|
||||||
if (window.addEventListener) {
|
if (alreadyLaunch === 0) {
|
||||||
window.addEventListener("load", tarteaucitron.load(params), false);
|
alreadyLaunch = 1;
|
||||||
} else {
|
if (window.addEventListener) {
|
||||||
window.attachEvent('onload', tarteaucitron.load(params));
|
window.addEventListener("load", tarteaucitron.load(params), false);
|
||||||
|
} else {
|
||||||
|
window.attachEvent('onload', tarteaucitron.load(params));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"load": function (params) {
|
"load": function (params) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue