mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Big linting
This commit is contained in:
parent
b5e6d049ce
commit
aef6bd3d59
58 changed files with 2074 additions and 1856 deletions
|
@ -4,7 +4,7 @@
|
|||
(function(){
|
||||
"use strict";
|
||||
|
||||
var scope;
|
||||
let scope;
|
||||
if ((typeof exports) !== "undefined"){
|
||||
scope = exports;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
|||
|
||||
scope.persistentRnd = Object.create(null);
|
||||
scope.persistentIncognitoRnd = Object.create(null);
|
||||
let clearTimeout;
|
||||
scope.init = function init(){
|
||||
logging.message("initializing persistent rng storage");
|
||||
|
||||
|
@ -26,8 +27,8 @@
|
|||
if (settings.storePersistentRnd){
|
||||
try {
|
||||
let storedData = JSON.parse(settings.persistentRndStorage);
|
||||
for (var domain in storedData){
|
||||
var value = storedData[domain];
|
||||
for (let domain in storedData){
|
||||
const value = storedData[domain];
|
||||
if (
|
||||
Array.isArray(value) &&
|
||||
value.length === 128 &&
|
||||
|
@ -39,7 +40,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
catch (error){
|
||||
// JSON is not valid -> ignore it
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +75,7 @@
|
|||
};
|
||||
|
||||
const getInterval = function(){
|
||||
var units = {
|
||||
const units = {
|
||||
seconds: 1000,
|
||||
minutes: 60 * 1000,
|
||||
hours: 60 * 60 * 1000,
|
||||
|
@ -95,18 +96,20 @@
|
|||
})){
|
||||
clearIncognito();
|
||||
}
|
||||
return;
|
||||
}).catch(function(error){
|
||||
logging.warning("Unable to get browser windows:", error);
|
||||
});
|
||||
});
|
||||
|
||||
let clearTimeout;
|
||||
|
||||
function registerTimeout(){
|
||||
var interval = getInterval();
|
||||
const interval = getInterval();
|
||||
if (interval > 0){
|
||||
var timeout = settings.lastPersistentRndClearing + interval - Date.now();
|
||||
const timeout = settings.lastPersistentRndClearing + interval - Date.now();
|
||||
logging.message("registering persistent rng data clearing timeout. Clearing in ", timeout, "ms");
|
||||
if (timeout > 1073741824){
|
||||
// window.setTimeout can only handle delays up to 32 bit.
|
||||
// Therefore we repeat the registering afert 2^30 = 1073741824 seconds
|
||||
// Therefore we repeat the registering after 2^30 = 1073741824 seconds
|
||||
clearTimeout = window.setTimeout(registerTimeout, 1073741824);
|
||||
}
|
||||
else {
|
||||
|
@ -119,6 +122,9 @@
|
|||
tabs.forEach(function(tab){
|
||||
browser.tabs.sendMessage(tab.id, data);
|
||||
});
|
||||
return;
|
||||
}).catch(function(error){
|
||||
logging.warning("Unable to get browser tabs:", error);
|
||||
});
|
||||
}
|
||||
function clearIncognito(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue