Fix evaluation order

This commit is contained in:
shinigami-eyes 2018-10-27 11:42:49 +02:00
parent 1239333604
commit ee9d451f4f

View File

@ -44,21 +44,22 @@ browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
var response = {}; var response = {};
var transphobic = message.myself && bloomFilters.filter(x => x.name == 'transphobic')[0].test(message.myself); var transphobic = message.myself && bloomFilters.filter(x => x.name == 'transphobic')[0].test(message.myself);
for (var id of message.ids) { for (var id of message.ids) {
if(transphobic){ if (overrides[id] !== undefined) {
if(id == message.myself) continue; response[id] = overrides[id];
continue;
}
if (transphobic) {
if (id == message.myself) continue;
var sum = 0; var sum = 0;
for(var i = 0; i < id.length; i++){ for(var i = 0; i < id.length; i++){
sum += id.charCodeAt(i); sum += id.charCodeAt(i);
} }
if(sum % 8 != 0) continue; if(sum % 8 != 0) continue;
} }
if (overrides[id] !== undefined) response[id] = overrides[id]
else {
for (var bloomFilter of bloomFilters) { for (var bloomFilter of bloomFilters) {
if (bloomFilter.test(id)) response[id] = bloomFilter.name; if (bloomFilter.test(id)) response[id] = bloomFilter.name;
} }
} }
}
sendResponse(response); sendResponse(response);
}); });