mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 04:40:20 +01:00
Fixed relative require paths
This commit is contained in:
parent
9f3da67cf2
commit
12137402de
@ -4,8 +4,8 @@
|
|||||||
(function(){
|
(function(){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const logging = require("./logging");
|
const logging = require("../lib/logging");
|
||||||
const settings = require("./settings");
|
const settings = require("../lib/settings");
|
||||||
logging.message("Opened browser action");
|
logging.message("Opened browser action");
|
||||||
|
|
||||||
settings.onloaded(function(){
|
settings.onloaded(function(){
|
||||||
|
@ -10,12 +10,13 @@ const require = function(){
|
|||||||
const scope = window.scope;
|
const scope = window.scope;
|
||||||
|
|
||||||
function getScopeName(module){
|
function getScopeName(module){
|
||||||
var scopeName = module.substr(2).replace(/\..+/, "");
|
var scopeName = module.replace(/^\..*\//, "").replace(/\..+/, "");
|
||||||
|
// console.log(scopeName);
|
||||||
return scopeName;
|
return scopeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
function require(module){
|
function require(module){
|
||||||
if (module.startsWith("./")){
|
if (module.startsWith(".")){
|
||||||
var scopeName = getScopeName(module);
|
var scopeName = getScopeName(module);
|
||||||
return scope[scopeName];
|
return scope[scopeName];
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
(function(){
|
(function(){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const settings = require("./settings");
|
const settings = require("../lib/settings");
|
||||||
const logging = require("./logging");
|
const logging = require("../lib/logging");
|
||||||
const settingsMigration = require("./settingsMigration");
|
const settingsMigration = require("../lib/settingsMigration");
|
||||||
const input = document.getElementById("settings");
|
const input = document.getElementById("settings");
|
||||||
settings.onloaded(function(){
|
settings.onloaded(function(){
|
||||||
var data = {};
|
var data = {};
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
(function(){
|
(function(){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const settings = require("./settings");
|
const settings = require("../lib/settings");
|
||||||
const navigator = require("./navigator");
|
const navigator = require("../lib/navigator");
|
||||||
|
|
||||||
const title = document.createElement("h1");
|
const title = document.createElement("h1");
|
||||||
title.className = "title";
|
title.className = "title";
|
||||||
|
@ -4,16 +4,16 @@
|
|||||||
(function(){
|
(function(){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const logging = require("./logging");
|
const logging = require("../lib/logging");
|
||||||
logging.setPrefix("options page");
|
logging.setPrefix("options page");
|
||||||
|
|
||||||
const optionsGui = require("./optionsGui");
|
const optionsGui = require("./optionsGui");
|
||||||
const settings = require("./settings");
|
const settings = require("../lib/settings");
|
||||||
const settingsDisplay = require("./settingsDisplay");
|
const settingsDisplay = require("../lib/settingsDisplay");
|
||||||
const search = require("./search");
|
const search = require("../lib/search");
|
||||||
const settingStrings = require("./settingStrings");
|
const settingStrings = require("../lib/settingStrings");
|
||||||
const searchParameters = new URLSearchParams(window.location.search);
|
const searchParameters = new URLSearchParams(window.location.search);
|
||||||
const settingsMigration = require("./settingsMigration");
|
const settingsMigration = require("../lib/settingsMigration");
|
||||||
|
|
||||||
var callbacks = {
|
var callbacks = {
|
||||||
openNavigatorSettings: function(){
|
openNavigatorSettings: function(){
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
scope = require.register("./optionsGui", {});
|
scope = require.register("./optionsGui", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
const logging = require("./logging");
|
const logging = require("../lib/logging");
|
||||||
|
|
||||||
function createDescription(setting){
|
function createDescription(setting){
|
||||||
var c = document.createElement("div");
|
var c = document.createElement("div");
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
scope = require.register("./sanitationRules", {});
|
scope = require.register("./sanitationRules", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
const settings = require("./settings");
|
const settings = require("../lib/settings");
|
||||||
|
|
||||||
scope.ruleset = [
|
scope.ruleset = [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
(function(){
|
(function(){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const settings = require("./settings");
|
const settings = require("../lib/settings");
|
||||||
const sanitationRules = require("./sanitationRules");
|
const sanitationRules = require("./sanitationRules");
|
||||||
|
|
||||||
var title = document.createElement("h1");
|
var title = document.createElement("h1");
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const {createCollapser, createActionButtons} = require("./gui");
|
const {createCollapser, createActionButtons} = require("./gui");
|
||||||
|
const extension = require("../lib/extension");
|
||||||
|
|
||||||
const actions = [];
|
const actions = [];
|
||||||
const addAction = function addAction(action){
|
const addAction = function addAction(action){
|
||||||
@ -13,7 +14,7 @@
|
|||||||
|
|
||||||
const addToContainer = function(){
|
const addToContainer = function(){
|
||||||
const container = document.getElementById("prints");
|
const container = document.getElementById("prints");
|
||||||
container.querySelector("li").textContent = browser.i18n.getMessage("pleaseWait");
|
container.querySelector("li").textContent = extension.getTranslation("pleaseWait");
|
||||||
var first = true;
|
var first = true;
|
||||||
|
|
||||||
return function addToContainer(domainNotification){
|
return function addToContainer(domainNotification){
|
||||||
@ -103,7 +104,7 @@
|
|||||||
this.textNode = function(){
|
this.textNode = function(){
|
||||||
return node;
|
return node;
|
||||||
};
|
};
|
||||||
var messageParts = browser.i18n.getMessage(this.messageId).split(/\{url\}/g);
|
var messageParts = extension.getTranslation(this.messageId).split(/\{url\}/g);
|
||||||
node.appendChild(document.createTextNode(messageParts.shift()));
|
node.appendChild(document.createTextNode(messageParts.shift()));
|
||||||
while (messageParts.length){
|
while (messageParts.length){
|
||||||
var urlSpan = document.createElement("span");
|
var urlSpan = document.createElement("span");
|
||||||
@ -179,5 +180,10 @@
|
|||||||
return domainNotification;
|
return domainNotification;
|
||||||
};
|
};
|
||||||
domainNotification.addAction = addAction;
|
domainNotification.addAction = addAction;
|
||||||
require.register("./domainNotification", domainNotification);
|
if ((typeof module) !== "undefined"){
|
||||||
|
module.exports = domainNotification;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
require.register("./domainNotification", domainNotification);
|
||||||
|
}
|
||||||
}());
|
}());
|
@ -5,14 +5,21 @@
|
|||||||
(function(){
|
(function(){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const scope = require.register("./gui", {});
|
let scope;
|
||||||
|
if ((typeof exports) !== "undefined"){
|
||||||
|
scope = exports;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
scope = require.register("./gui", {});
|
||||||
|
}
|
||||||
|
|
||||||
const {error, warning, message, notice, verbose, setPrefix: setLogPrefix} = require("./logging");
|
const {error, warning, message, notice, verbose, setPrefix: setLogPrefix} = require("../lib/logging");
|
||||||
|
const extension = require("../lib/extension");
|
||||||
|
|
||||||
scope.createCollapser = function(){
|
scope.createCollapser = function(){
|
||||||
const messages = {
|
const messages = {
|
||||||
more: browser.i18n.getMessage("more"),
|
more: extension.getTranslation("more"),
|
||||||
less: browser.i18n.getMessage("less")
|
less: extension.getTranslation("less")
|
||||||
};
|
};
|
||||||
|
|
||||||
return function createCollapser(container){
|
return function createCollapser(container){
|
||||||
|
@ -72,5 +72,11 @@
|
|||||||
update(){}
|
update(){}
|
||||||
}
|
}
|
||||||
Notification.addAction = addAction;
|
Notification.addAction = addAction;
|
||||||
require.register("./Notification", Notification);
|
|
||||||
|
if ((typeof module) !== "undefined"){
|
||||||
|
module.exports = Notification;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
require.register("./Notification", Notification);
|
||||||
|
}
|
||||||
}());
|
}());
|
@ -11,6 +11,7 @@
|
|||||||
<li>...</li>
|
<li>...</li>
|
||||||
</ul>
|
</ul>
|
||||||
<script src="../lib/require.js"></script>
|
<script src="../lib/require.js"></script>
|
||||||
|
<script src="../lib/extension.js"></script>
|
||||||
<script src="../lib/logging.js"></script>
|
<script src="../lib/logging.js"></script>
|
||||||
<script src="../lib/settingDefinitions.js"></script>
|
<script src="../lib/settingDefinitions.js"></script>
|
||||||
<script src="../lib/settingContainers.js"></script>
|
<script src="../lib/settingContainers.js"></script>
|
||||||
|
@ -4,15 +4,15 @@
|
|||||||
(function(){
|
(function(){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const settings = require("./settings");
|
const settings = require("../lib/settings");
|
||||||
const {parseErrorStack} = require("./callingStack");
|
const {parseErrorStack} = require("../lib/callingStack");
|
||||||
const {error, warning, message, notice, verbose, setPrefix: setLogPrefix} = require("./logging");
|
const {error, warning, message, notice, verbose, setPrefix: setLogPrefix} = require("../lib/logging");
|
||||||
setLogPrefix("page action script");
|
setLogPrefix("page action script");
|
||||||
|
|
||||||
const domainNotification = require("./domainNotification");
|
const domainNotification = require("./domainNotification");
|
||||||
const Notification = require("./Notification");
|
const Notification = require("./Notification");
|
||||||
const {createActionButtons, modalPrompt, modalChoice} = require("./gui");
|
const {createActionButtons, modalPrompt, modalChoice} = require("./gui");
|
||||||
const lists = require("./lists");
|
const lists = require("../lib/lists");
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
browser.tabs.query({active: true, currentWindow: true}),
|
browser.tabs.query({active: true, currentWindow: true}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user