aboutsummaryrefslogtreecommitdiff
path: root/ext/js/script
diff options
context:
space:
mode:
authorDarius Jahandarie <djahandarie@gmail.com>2023-11-12 02:16:11 +0000
committerGitHub <noreply@github.com>2023-11-12 02:16:11 +0000
commitd06029ea8c4244f40f9ddfeec5154f9ef2a4c053 (patch)
tree93f3e15603ec38faef01070475904c08d2e9280b /ext/js/script
parentf263e994c6eca2438eaff79cb22f1b48fe14b7b2 (diff)
parent784dcd93b02443bc253e3af43ad0586a1add39c5 (diff)
Merge pull request #314 from starxeras/replace-yomichan
Replace all instances of yomichan
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);
}
}