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