1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 04:26:35 +02:00

Fixed relative require paths

This commit is contained in:
kkapsner 2019-04-08 00:02:29 +02:00
parent 9f3da67cf2
commit 12137402de
13 changed files with 51 additions and 30 deletions

View file

@ -5,6 +5,7 @@
"use strict";
const {createCollapser, createActionButtons} = require("./gui");
const extension = require("../lib/extension");
const actions = [];
const addAction = function addAction(action){
@ -13,7 +14,7 @@
const addToContainer = function(){
const container = document.getElementById("prints");
container.querySelector("li").textContent = browser.i18n.getMessage("pleaseWait");
container.querySelector("li").textContent = extension.getTranslation("pleaseWait");
var first = true;
return function addToContainer(domainNotification){
@ -103,7 +104,7 @@
this.textNode = function(){
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()));
while (messageParts.length){
var urlSpan = document.createElement("span");
@ -179,5 +180,10 @@
return domainNotification;
};
domainNotification.addAction = addAction;
require.register("./domainNotification", domainNotification);
if ((typeof module) !== "undefined"){
module.exports = domainNotification;
}
else {
require.register("./domainNotification", domainNotification);
}
}());

View file

@ -5,14 +5,21 @@
(function(){
"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(){
const messages = {
more: browser.i18n.getMessage("more"),
less: browser.i18n.getMessage("less")
more: extension.getTranslation("more"),
less: extension.getTranslation("less")
};
return function createCollapser(container){

View file

@ -72,5 +72,11 @@
update(){}
}
Notification.addAction = addAction;
require.register("./Notification", Notification);
if ((typeof module) !== "undefined"){
module.exports = Notification;
}
else {
require.register("./Notification", Notification);
}
}());

View file

@ -11,6 +11,7 @@
<li>...</li>
</ul>
<script src="../lib/require.js"></script>
<script src="../lib/extension.js"></script>
<script src="../lib/logging.js"></script>
<script src="../lib/settingDefinitions.js"></script>
<script src="../lib/settingContainers.js"></script>

View file

@ -4,15 +4,15 @@
(function(){
"use strict";
const settings = require("./settings");
const {parseErrorStack} = require("./callingStack");
const {error, warning, message, notice, verbose, setPrefix: setLogPrefix} = require("./logging");
const settings = require("../lib/settings");
const {parseErrorStack} = require("../lib/callingStack");
const {error, warning, message, notice, verbose, setPrefix: setLogPrefix} = require("../lib/logging");
setLogPrefix("page action script");
const domainNotification = require("./domainNotification");
const Notification = require("./Notification");
const {createActionButtons, modalPrompt, modalChoice} = require("./gui");
const lists = require("./lists");
const lists = require("../lib/lists");
Promise.all([
browser.tabs.query({active: true, currentWindow: true}),