aboutsummaryrefslogtreecommitdiff
path: root/ext/js/script
diff options
context:
space:
mode:
authorDarius Jahandarie <djahandarie@gmail.com>2023-11-12 11:19:43 +0900
committerGitHub <noreply@github.com>2023-11-12 11:19:43 +0900
commit47b4d79e646a990699a1a4ca1da559a4aeec1c91 (patch)
treec33f61ba85354f18c68d4a054baa30ff0c41c153 /ext/js/script
parent9162d950eb2b3aa0339d95a98a60be89b8315f26 (diff)
parentd06029ea8c4244f40f9ddfeec5154f9ef2a4c053 (diff)
Merge branch 'master' into offscreen-db
Diffstat (limited to 'ext/js/script')
-rw-r--r--ext/js/script/dynamic-loader-sentinel.js5
-rw-r--r--ext/js/script/dynamic-loader.js14
2 files changed, 10 insertions, 9 deletions
diff --git a/ext/js/script/dynamic-loader-sentinel.js b/ext/js/script/dynamic-loader-sentinel.js
index d549808e..3c06fc02 100644
--- a/ext/js/script/dynamic-loader-sentinel.js
+++ b/ext/js/script/dynamic-loader-sentinel.js
@@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
-yomichan.trigger('dynamicLoaderSentinel', {script: import.meta.url});
+
+yomitan.trigger('dynamicLoaderSentinel', {script: import.meta.url});
diff --git a/ext/js/script/dynamic-loader.js b/ext/js/script/dynamic-loader.js
index ffce04c1..2abc9e04 100644
--- a/ext/js/script/dynamic-loader.js
+++ b/ext/js/script/dynamic-loader.js
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import {yomichan} from '../yomichan.js';
+import {yomitan} from '../yomitan.js';
export const dynamicLoader = (() => {
const injectedStylesheets = new Map();
@@ -44,7 +44,7 @@ export const dynamicLoader = (() => {
}
async function loadStyle(id, type, value, useWebExtensionApi=false, parentNode=null) {
- if (useWebExtensionApi && yomichan.isExtensionUrl(window.location.href)) {
+ if (useWebExtensionApi && yomitan.isExtensionUrl(window.location.href)) {
// Permissions error will occur if trying to use the WebExtension API to inject into an extension page
useWebExtensionApi = false;
}
@@ -60,7 +60,7 @@ export const dynamicLoader = (() => {
}
if (type === 'file-content') {
- value = await yomichan.api.getStylesheetContent(value);
+ value = await yomitan.api.getStylesheetContent(value);
type = 'code';
useWebExtensionApi = false;
}
@@ -72,7 +72,7 @@ export const dynamicLoader = (() => {
}
setInjectedStylesheet(id, parentNode, null);
- await yomichan.api.injectStylesheet(type, value);
+ await yomitan.api.injectStylesheet(type, value);
return null;
}
@@ -142,11 +142,11 @@ export const dynamicLoader = (() => {
const sentinelEventName = 'dynamicLoaderSentinel';
const sentinelEventCallback = (e) => {
if (e.script !== script.src) { return; }
- yomichan.off(sentinelEventName, sentinelEventCallback);
+ yomitan.off(sentinelEventName, sentinelEventCallback);
parent.removeChild(script);
resolve();
};
- yomichan.on(sentinelEventName, sentinelEventCallback);
+ yomitan.on(sentinelEventName, sentinelEventCallback);
try {
script.type = 'module';
@@ -154,7 +154,7 @@ export const dynamicLoader = (() => {
script.src = '/js/script/dynamic-loader-sentinel.js';
parent.appendChild(script);
} catch (e) {
- yomichan.off(sentinelEventName, sentinelEventCallback);
+ yomitan.off(sentinelEventName, sentinelEventCallback);
reject(e);
}
}