1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 20:46:39 +02:00

Big linting

This commit is contained in:
kkapsner 2019-11-28 01:26:35 +01:00
parent b5e6d049ce
commit aef6bd3d59
58 changed files with 2074 additions and 1856 deletions

View file

@ -1,11 +1,10 @@
/* eslint no-console: off */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
(function(){
"use strict";
var scope;
let scope;
if ((typeof exports) !== "undefined"){
scope = exports;
}
@ -17,21 +16,21 @@
scope.setSettings = function(realSettings){
if (!settings){
settings = realSettings;
settings.loaded.then(scope.clearQueue);
return settings.loaded.then(scope.clearQueue);
}
else {
warning("logging: Settings can only be set once.");
}
};
var prefix = "";
let prefix = "";
function leftPad(str, char, pad){
str = "" + str;
return char.repeat(pad - str.length) + str;
}
var colors = {
const colors = {
1: "color: red",
25: "color: orange",
50: "",
@ -40,7 +39,7 @@
999: "background-color: lightgray"
};
var queue = [];
let queue = [];
function performLog(level, args, date){
if (!date){
date = new Date();
@ -50,7 +49,7 @@
}
else {
if (settings.logLevel >= level){
var pre = "%c[CanvasBlocker] ";
let pre = "%c[CanvasBlocker] ";
if (prefix){
pre += prefix + ": ";
}
@ -71,6 +70,7 @@
args.unshift(colors[level] || "");
args.unshift(pre);
}
// eslint-disable-next-line no-console
console.log.apply(console, args);
}
}
@ -94,7 +94,7 @@
scope.clearQueue = function(){
if (queue.length){
metaLog("clear logging queue");
var tmp = queue;
const tmp = queue;
queue = [];
tmp.forEach(function(item){
performLog(item.level, item.args, item.date);