mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
Cleanup require system
This commit is contained in:
parent
11b8ddfcc8
commit
574efa23e7
@ -8,8 +8,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.askForPermission = {};
|
scope = require.register("./askForPermission", {});
|
||||||
scope = window.scope.askForPermission;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const {parseErrorStack} = require("./callingStack");
|
const {parseErrorStack} = require("./callingStack");
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.callingStack = {};
|
scope = require.register("./callingStack", {});
|
||||||
scope = window.scope.callingStack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const settings = require("./settings");
|
const settings = require("./settings");
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.check = {};
|
scope = require.register("./check", {});
|
||||||
scope = window.scope.check;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const settings = require("./settings");
|
const settings = require("./settings");
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.colorStatistics = {};
|
scope = require.register("./colorStatistics", {});
|
||||||
scope = window.scope.colorStatistics;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Statistic{
|
class Statistic{
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.dataUrls = {};
|
scope = require.register("./dataUrls", {});
|
||||||
scope = window.scope.dataUrls;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const logging = require("./logging");
|
const logging = require("./logging");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* 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
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
(function(){
|
(function(require){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const settings = require("./settings");
|
const settings = require("./settings");
|
||||||
@ -171,4 +171,4 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
interceptWindow(window);
|
interceptWindow(window);
|
||||||
}());
|
}(require));
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.hash = {};
|
scope = require.register("./hash", {});
|
||||||
scope = window.scope.hash;
|
|
||||||
}
|
}
|
||||||
scope.byteArrayToString = function byteArrayToString(byteArray){
|
scope.byteArrayToString = function byteArrayToString(byteArray){
|
||||||
return String.fromCharCode.apply(String, new Uint16Array(byteArray.buffer));
|
return String.fromCharCode.apply(String, new Uint16Array(byteArray.buffer));
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.intercept = {};
|
scope = require.register("./intercept", {});
|
||||||
scope = window.scope.intercept;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const {changedFunctions, changedGetters, setRandomSupply} = require("./modifiedAPI");
|
const {changedFunctions, changedGetters, setRandomSupply} = require("./modifiedAPI");
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.lists = {};
|
scope = require.register("./lists", {});
|
||||||
scope = window.scope.lists;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings = require("./settings");
|
var settings = require("./settings");
|
||||||
|
@ -10,10 +10,12 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!window.scope.logging){
|
if (require.exists("./logging")){
|
||||||
window.scope.logging = {};
|
scope = require("./logging");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
scope = require.register("./logging", {});
|
||||||
}
|
}
|
||||||
scope = window.scope.logging;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let settings = false;
|
let settings = false;
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.modifiedAPI = {};
|
scope = require.register("./modifiedAPI", {});
|
||||||
scope = window.scope.modifiedAPI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const colorStatistics = require("./colorStatistics");
|
const colorStatistics = require("./colorStatistics");
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.modifiedAPIFunctions = {};
|
scope = require.register("./modifiedAPIFunctions", {});
|
||||||
scope = window.scope.modifiedAPIFunctions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.checkerWrapper = function checkerWrapper(checker, object, args, callback){
|
scope.checkerWrapper = function checkerWrapper(checker, object, args, callback){
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.modifiedAudioAPI = {};
|
scope = require.register("./modifiedAudioAPI", {});
|
||||||
scope = window.scope.modifiedAudioAPI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const logging = require("./logging");
|
const logging = require("./logging");
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.modifiedDOMRectAPI = {};
|
scope = require.register("./modifiedDOMRectAPI", {});
|
||||||
scope = window.scope.modifiedDOMRectAPI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const {checkerWrapper, setProperties: setProperties} = require("./modifiedAPIFunctions");
|
const {checkerWrapper, setProperties: setProperties} = require("./modifiedAPIFunctions");
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.modifiedHistoryAPI = {};
|
scope = require.register("./modifiedHistoryAPI", {});
|
||||||
scope = window.scope.modifiedHistoryAPI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const {checkerWrapper} = require("./modifiedAPIFunctions");
|
const {checkerWrapper} = require("./modifiedAPIFunctions");
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.modifiedWindowAPI = {};
|
scope = require.register("./modifiedWindowAPI", {});
|
||||||
scope = window.scope.modifiedWindowAPI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const {checkerWrapper} = require("./modifiedAPIFunctions");
|
const {checkerWrapper} = require("./modifiedAPIFunctions");
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope = {};
|
scope = require.register("./notification", {});
|
||||||
window.scope.notification = scope;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const settings = require("./settings");
|
const settings = require("./settings");
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope = {};
|
scope = require.register("./persistentRndStorage", {});
|
||||||
window.scope.persistentRndStorage = scope;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.randomSupplies = {};
|
scope = require.register("./randomSupplies", {});
|
||||||
scope = window.scope.randomSupplies;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const rngTemplate = {
|
const rngTemplate = {
|
||||||
|
@ -39,13 +39,14 @@ const require = function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
require.register = function(moduleName, module = {}){
|
require.register = function(moduleName, module = {}){
|
||||||
|
const scopeName = getScopeName(moduleName);
|
||||||
if (!require.exists(moduleName)){
|
if (!require.exists(moduleName)){
|
||||||
const scopeName = getScopeName(moduleName);
|
|
||||||
scope[scopeName] = module;
|
scope[scopeName] = module;
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
require("./logging").error("Module", moduleName, "already registered.");
|
require("./logging").error("Module", moduleName, "already registered.");
|
||||||
|
return scope[scopeName];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.search = {};
|
scope = require.register("./search", {});
|
||||||
scope = window.scope.search;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const texts = [];
|
const texts = [];
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope = {};
|
scope = require.register("./settingContainers", {});
|
||||||
window.scope.settingContainers = scope;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const logging = require("./logging");
|
const logging = require("./logging");
|
||||||
|
@ -346,6 +346,6 @@
|
|||||||
module.exports = settingDefinitions;
|
module.exports = settingDefinitions;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.settingDefinitions = settingDefinitions;
|
require.register("./settingDefinitions", settingDefinitions);
|
||||||
}
|
}
|
||||||
}());
|
}());
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope = {};
|
scope = require.register("./settingStrings", {});
|
||||||
window.scope.settingStrings = scope;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.getMessages = function(settingDefinition){
|
scope.getMessages = function(settingDefinition){
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* 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
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
(function(){
|
(function(require){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var scope;
|
var scope;
|
||||||
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope = {};
|
scope = require.register("./settings", {});
|
||||||
window.scope.settings = scope;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const logging = require("./logging");
|
const logging = require("./logging");
|
||||||
@ -428,8 +427,8 @@
|
|||||||
initEvents.forEach(function(callback){callback();});
|
initEvents.forEach(function(callback){callback();});
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
if (window.scope.settingsData){
|
if (require.exists("./settingsData")){
|
||||||
scope.init(window.scope.settingsData);
|
scope.init(require("./settingsData"));
|
||||||
scope.loaded = Promise.resolve(false);
|
scope.loaded = Promise.resolve(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -468,4 +467,4 @@
|
|||||||
Object.seal(scope);
|
Object.seal(scope);
|
||||||
|
|
||||||
require.emit("./settings");
|
require.emit("./settings");
|
||||||
}());
|
}(require));
|
@ -10,8 +10,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.settingsMigration = {};
|
scope = require.register("./settingsMigration", {});
|
||||||
scope = window.scope.settingsMigration;
|
|
||||||
}
|
}
|
||||||
scope.validVersions = [undefined, 0.1, 0.2, 0.3, 0.4, 0.5];
|
scope.validVersions = [undefined, 0.1, 0.2, 0.3, 0.4, 0.5];
|
||||||
scope.transitions = {
|
scope.transitions = {
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.webgl = {};
|
scope = require.register("./webgl", {});
|
||||||
scope = window.scope.webgl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.copyCanvasToWebgl = function copyCanvasToWebgl(window, canvas, webGLVersion = "webgl"){
|
scope.copyCanvasToWebgl = function copyCanvasToWebgl(window, canvas, webGLVersion = "webgl"){
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope = {};
|
scope = require.register("./optionsGui", {});
|
||||||
window.scope.optionsGui = scope;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const logging = require("./logging");
|
const logging = require("./logging");
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
scope = exports;
|
scope = exports;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scope = {};
|
scope = require.register("./sanitationRules", {});
|
||||||
window.scope.sanitationRules = scope;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const settings = require("./settings");
|
const settings = require("./settings");
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const settings = require("./settings");
|
const settings = require("./settings");
|
||||||
|
const sanitationRules = require("./sanitationRules");
|
||||||
|
|
||||||
var title = document.createElement("h1");
|
var title = document.createElement("h1");
|
||||||
title.className = "title";
|
title.className = "title";
|
||||||
@ -18,7 +19,6 @@
|
|||||||
|
|
||||||
settings.onloaded(function(){
|
settings.onloaded(function(){
|
||||||
const list = document.createElement("ul");
|
const list = document.createElement("ul");
|
||||||
const sanitationRules = require("./sanitationRules");
|
|
||||||
sanitationRules.ruleset.forEach(function(ruleset){
|
sanitationRules.ruleset.forEach(function(ruleset){
|
||||||
const rulesetContainer = document.createElement("li");
|
const rulesetContainer = document.createElement("li");
|
||||||
rulesetContainer.textContent = browser.i18n.getMessage("sanitation_ruleset." + ruleset.name);
|
rulesetContainer.textContent = browser.i18n.getMessage("sanitation_ruleset." + ruleset.name);
|
||||||
|
@ -545,6 +545,6 @@
|
|||||||
module.exports = settingsDisplay;
|
module.exports = settingsDisplay;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.scope.settingsDisplay = settingsDisplay;
|
require.register("./settingsDisplay", settingsDisplay);
|
||||||
}
|
}
|
||||||
}());
|
}());
|
@ -179,5 +179,5 @@
|
|||||||
return domainNotification;
|
return domainNotification;
|
||||||
};
|
};
|
||||||
domainNotification.addAction = addAction;
|
domainNotification.addAction = addAction;
|
||||||
window.scope.domainNotification = domainNotification;
|
require.register("./domainNotification", domainNotification);
|
||||||
}());
|
}());
|
@ -5,7 +5,7 @@
|
|||||||
(function(){
|
(function(){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const scope = window.scope.gui = {};
|
const scope = require.register("./gui", {});
|
||||||
|
|
||||||
const {error, warning, message, notice, verbose, setPrefix: setLogPrefix} = require("./logging");
|
const {error, warning, message, notice, verbose, setPrefix: setLogPrefix} = require("./logging");
|
||||||
|
|
||||||
|
@ -72,5 +72,5 @@
|
|||||||
update(){}
|
update(){}
|
||||||
}
|
}
|
||||||
Notification.addAction = addAction;
|
Notification.addAction = addAction;
|
||||||
window.scope.Notification = Notification;
|
require.register("./Notification", Notification);
|
||||||
}());
|
}());
|
@ -1,6 +1,6 @@
|
|||||||
Version 0.5.9:
|
Version 0.5.9:
|
||||||
changes:
|
changes:
|
||||||
-
|
- code cleanup
|
||||||
|
|
||||||
new features:
|
new features:
|
||||||
- added protection for navigator properties
|
- added protection for navigator properties
|
||||||
|
Loading…
x
Reference in New Issue
Block a user