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

@ -5,7 +5,7 @@
"use strict";
var scope;
let scope;
if ((typeof exports) !== "undefined"){
scope = exports;
}
@ -23,8 +23,8 @@
this.minBoundary.nextColor = this.maxBoundary;
}
addColor(r, g, b, a){
var index = String.fromCharCode(r, g, b, a);
var color = this.colors[index];
const index = String.fromCharCode(r, g, b, a);
let color = this.colors[index];
if (!color){
color = {
index,
@ -42,10 +42,10 @@
if (color.count > color.nextColor.count){
// swap colors to remain in right order
// a_ -> b_ -> c -> d becomes a_ -> c -> b_ -> d
var a_ = color.previousColor;
var b_ = color;
var c = color.nextColor;
var d = color.nextColor.nextColor;
const a_ = color.previousColor;
const b_ = color;
const c = color.nextColor;
const d = color.nextColor.nextColor;
a_.nextColor = c;
c.previousColor = a_;
@ -59,8 +59,8 @@
}
getMaxColors(n){
n = Math.min(n, this.numberOfColors);
var colors = Object.create(null);
var current = this.maxBoundary;
const colors = Object.create(null);
let current = this.maxBoundary;
for (;n && current;n -= 1){
current = current.previousColor;
colors[current.index] = current;
@ -70,8 +70,8 @@
}
scope.compute = function computeColorStatistics(rawData){
var statistic = new Statistic();
for (var i = 0, l = rawData.length; i < l; i += 4){
const statistic = new Statistic();
for (let i = 0, l = rawData.length; i < l; i += 4){
statistic.addColor(
rawData[i + 0],
rawData[i + 1],
@ -86,10 +86,10 @@
return statistic.numberOfColors > threshold;
}
else {
var colors = Object.create(null);
var count = 0;
for (var i = 0, l = rawData.length; i < l; i += 4){
var index = String.fromCharCode(
const colors = Object.create(null);
let count = 0;
for (let i = 0, l = rawData.length; i < l; i += 4){
const index = String.fromCharCode(
rawData[i + 0],
rawData[i + 1],
rawData[i + 2],