mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 21:00:23 +01:00
Linted all files.
This commit is contained in:
parent
6c46d28593
commit
0904d8e2a6
Binary file not shown.
12
lib/lists.js
12
lib/lists.js
@ -56,9 +56,13 @@ var lists = {
|
||||
};
|
||||
|
||||
function updateList(type){
|
||||
"use strict";
|
||||
|
||||
lists[type] = getDomainRegExpList(prefs[type + "List"]);
|
||||
}
|
||||
Object.keys(lists).forEach(function(type){
|
||||
"use strict";
|
||||
|
||||
preferences.on(type + "List", function(){
|
||||
updateList(type);
|
||||
});
|
||||
@ -66,11 +70,15 @@ Object.keys(lists).forEach(function(type){
|
||||
});
|
||||
|
||||
exports.get = function getList(type){
|
||||
"use strict";
|
||||
|
||||
return lists[type];
|
||||
}
|
||||
};
|
||||
exports.appendTo = function appendToList(type, entry){
|
||||
"use strict";
|
||||
|
||||
prefs[type + "List"] += (prefs[type + "List"]? ",": "") + entry;
|
||||
prefService.set("extensions.CanvasBlocker@kkapsner.de.whiteList", prefs[type + "List"]);
|
||||
updateList(type);
|
||||
}
|
||||
};
|
||||
exports.update = updateList;
|
@ -1,3 +1,4 @@
|
||||
/* jslint moz: true, bitwise: true */
|
||||
/* 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/. */
|
||||
@ -32,7 +33,7 @@
|
||||
data[i] = value;
|
||||
}
|
||||
var canvas = original.cloneNode(true);
|
||||
var context = window.HTMLCanvasElement.prototype.getContext.call(canvas, "2d");
|
||||
context = window.HTMLCanvasElement.prototype.getContext.call(canvas, "2d");
|
||||
context.putImageData(imageData, 0, 0);
|
||||
return canvas;
|
||||
}
|
||||
|
@ -7,11 +7,12 @@ var preferences = require("sdk/simple-prefs");
|
||||
var prefService = require("sdk/preferences/service");
|
||||
var prefs = preferences.prefs;
|
||||
var tabUtils = require("sdk/tabs/utils");
|
||||
var windowUtils = require("sdk/window/utils");
|
||||
var lists = require("./lists");
|
||||
var URL = require("sdk/url").URL;
|
||||
|
||||
exports.notify = function(window, callingStackMsg){
|
||||
"use strict";
|
||||
|
||||
var contentURL = new URL(window.location);
|
||||
if (prefs.showNotifications && !lists.get("ignore").match(contentURL)){
|
||||
var url = contentURL.href;
|
||||
@ -94,5 +95,4 @@ exports.notify = function(window, callingStackMsg){
|
||||
notification.callingStackMsg = callingStackMsg;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
@ -1,4 +1,5 @@
|
||||
/* global console,exports */
|
||||
/* jslint moz: true */
|
||||
/* 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/. */
|
||||
@ -10,6 +11,8 @@ const prefs = preferences.prefs;
|
||||
// Translation
|
||||
var translate = require("sdk/l10n").get;
|
||||
var _ = function(name, replace){
|
||||
"use strict";
|
||||
|
||||
var str = translate(name) || name;
|
||||
if (replace){
|
||||
// replace generic content in the transation by given parameter
|
||||
@ -23,7 +26,8 @@ var _ = function(name, replace){
|
||||
|
||||
function checkURL(url, blockMode){
|
||||
"use strict";
|
||||
if (url.protocol === "about:" || url.protocol == "chrome:") {
|
||||
|
||||
if (url.protocol === "about:" || url.protocol === "chrome:") {
|
||||
return "allow";
|
||||
}
|
||||
|
||||
@ -35,6 +39,9 @@ function checkURL(url, blockMode){
|
||||
case "block":
|
||||
case "blockContext":
|
||||
case "blockReadout":
|
||||
case "ask":
|
||||
case "askContext":
|
||||
case "askReadout":
|
||||
case "fake":
|
||||
case "fakeContext":
|
||||
case "fakeReadout":
|
||||
@ -63,6 +70,8 @@ function checkURL(url, blockMode){
|
||||
|
||||
// Stack parsing
|
||||
function parseStackEntry(entry){
|
||||
"use strict";
|
||||
|
||||
var m = /@(.*):(\d*):(\d*)$/.exec(entry) || ["", entry, "--", "--"];
|
||||
return {
|
||||
url: m[1],
|
||||
@ -74,6 +83,8 @@ function parseStackEntry(entry){
|
||||
|
||||
// parse calling stack
|
||||
function errorToCallingStackMsg(error){
|
||||
"use strict";
|
||||
|
||||
var msg = "";
|
||||
var callers = error.stack.trim().split("\n");
|
||||
//console.log(callers);
|
||||
|
@ -1,16 +1,17 @@
|
||||
/* jslint moz: true */
|
||||
/* 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";
|
||||
const { Cu } = require('chrome');
|
||||
const { on } = require('sdk/system/events');
|
||||
const self = require('sdk/self');
|
||||
const { Cu } = require("chrome");
|
||||
const { on } = require("sdk/system/events");
|
||||
const self = require("sdk/self");
|
||||
const { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm");
|
||||
const { setTimeout } = require("sdk/timers");
|
||||
const { loadSheet } = require("sdk/stylesheet/utils");
|
||||
AddonManager.getAddonByID(self.id, function(addon){
|
||||
on('addon-options-displayed', onAddonOptionsDisplayed, true);
|
||||
on("addon-options-displayed", onAddonOptionsDisplayed, true);
|
||||
});
|
||||
|
||||
function onAddonOptionsDisplayed({ subject: doc, data }) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user