Allow global and per service default state. Open the alert only on 'wait' state. Fixes AmauriC/tarteaucitron.js#858.
This commit is contained in:
parent
4b8f3fb9e5
commit
5fbf77581d
|
|
@ -221,7 +221,8 @@ var tarteaucitron = {
|
||||||
"useExternalJs": false,
|
"useExternalJs": false,
|
||||||
"mandatory": true,
|
"mandatory": true,
|
||||||
"closePopup": false,
|
"closePopup": false,
|
||||||
"groupServices": false
|
"groupServices": false,
|
||||||
|
"serviceDefaultState": 'wait',
|
||||||
},
|
},
|
||||||
params = tarteaucitron.parameters;
|
params = tarteaucitron.parameters;
|
||||||
|
|
||||||
|
|
@ -865,13 +866,16 @@ var tarteaucitron = {
|
||||||
tarteaucitron.state[service.key] = false;
|
tarteaucitron.state[service.key] = false;
|
||||||
tarteaucitron.userInterface.color(service.key, false);
|
tarteaucitron.userInterface.color(service.key, false);
|
||||||
} else if (!isResponded) {
|
} else if (!isResponded) {
|
||||||
tarteaucitron.cookie.create(service.key, 'wait');
|
tarteaucitron.cookie.create(service.key, service.defaultState || tarteaucitron.parameters.serviceDefaultState);
|
||||||
if (typeof service.fallback === 'function') {
|
if (typeof service.fallback === 'function') {
|
||||||
if (typeof tarteaucitronMagic === 'undefined' || tarteaucitronMagic.indexOf("_" + service.key + "_") < 0) { service.fallback(); }
|
if (typeof tarteaucitronMagic === 'undefined' || tarteaucitronMagic.indexOf("_" + service.key + "_") < 0) { service.fallback(); }
|
||||||
}
|
}
|
||||||
tarteaucitron.userInterface.color(service.key, 'wait');
|
tarteaucitron.userInterface.color(service.key, service.defaultState || tarteaucitron.parameters.serviceDefaultState);
|
||||||
|
|
||||||
|
if( 'wait' === (service.defaultState || tarteaucitron.parameters.serviceDefaultState) ) {
|
||||||
tarteaucitron.userInterface.openAlert();
|
tarteaucitron.userInterface.openAlert();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tarteaucitron.cookie.checkCount(service.key);
|
tarteaucitron.cookie.checkCount(service.key);
|
||||||
tarteaucitron.sendEvent(service.key + '_added')
|
tarteaucitron.sendEvent(service.key + '_added')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue