Merge pull request #1108 from Mintoo200/patch-1

Fix event sent before state update
This commit is contained in:
Amauri CHAMPEAUX 2023-05-31 18:44:00 +02:00 committed by GitHub
commit d3ce8dec41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 14 deletions

View File

@ -1023,16 +1023,16 @@ var tarteaucitron = {
tarteaucitron.sendEvent(key + '_loaded'); tarteaucitron.sendEvent(key + '_loaded');
} }
var itemStatusElem = document.getElementById('tacCurrentStatus'+key); var itemStatusElem = document.getElementById('tacCurrentStatus'+key);
if(status == true){
itemStatusElem.innerHTML = tarteaucitron.lang.allowed;
tarteaucitron.sendEvent(key + '_allowed');
}else{
itemStatusElem.innerHTML = tarteaucitron.lang.disallowed;
tarteaucitron.sendEvent(key + '_disallowed');
}
tarteaucitron.state[key] = status; tarteaucitron.state[key] = status;
tarteaucitron.cookie.create(key, status); tarteaucitron.cookie.create(key, status);
tarteaucitron.userInterface.color(key, status); tarteaucitron.userInterface.color(key, status);
if (status == true) {
itemStatusElem.innerHTML = tarteaucitron.lang.allowed;
tarteaucitron.sendEvent(key + '_allowed');
} else {
itemStatusElem.innerHTML = tarteaucitron.lang.disallowed;
tarteaucitron.sendEvent(key + '_disallowed');
}
} }
} }
}, },
@ -1071,16 +1071,16 @@ var tarteaucitron = {
} }
} }
var itemStatusElem = document.getElementById('tacCurrentStatus'+key); var itemStatusElem = document.getElementById('tacCurrentStatus'+key);
if(status == true){
itemStatusElem.innerHTML = tarteaucitron.lang.allowed;
tarteaucitron.sendEvent(key + '_allowed');
}else{
itemStatusElem.innerHTML = tarteaucitron.lang.disallowed;
tarteaucitron.sendEvent(key + '_disallowed');
}
tarteaucitron.state[key] = status; tarteaucitron.state[key] = status;
tarteaucitron.cookie.create(key, status); tarteaucitron.cookie.create(key, status);
tarteaucitron.userInterface.color(key, status); tarteaucitron.userInterface.color(key, status);
if (status == true) {
itemStatusElem.innerHTML = tarteaucitron.lang.allowed;
tarteaucitron.sendEvent(key + '_allowed');
} else {
itemStatusElem.innerHTML = tarteaucitron.lang.disallowed;
tarteaucitron.sendEvent(key + '_disallowed');
}
}, },
"color": function (key, status) { "color": function (key, status) {
"use strict"; "use strict";