Use chrome.runtime.getURL instead of chrome.extension.getURL
This commit is contained in:
parent
d32fd1381b
commit
7a3315d75d
@ -153,7 +153,7 @@ async function apiCommandExec(command, params) {
|
|||||||
}
|
}
|
||||||
apiCommandExec.handlers = {
|
apiCommandExec.handlers = {
|
||||||
search: async (params) => {
|
search: async (params) => {
|
||||||
const url = chrome.extension.getURL('/bg/search.html');
|
const url = chrome.runtime.getURL('/bg/search.html');
|
||||||
if (!(params && params.newTab)) {
|
if (!(params && params.newTab)) {
|
||||||
try {
|
try {
|
||||||
const tab = await apiFindTab(1000, (url2) => (
|
const tab = await apiFindTab(1000, (url2) => (
|
||||||
@ -181,7 +181,7 @@ apiCommandExec.handlers = {
|
|||||||
chrome.runtime.openOptionsPage();
|
chrome.runtime.openOptionsPage();
|
||||||
} else {
|
} else {
|
||||||
const manifest = chrome.runtime.getManifest();
|
const manifest = chrome.runtime.getManifest();
|
||||||
const url = chrome.extension.getURL(manifest.options_ui.page);
|
const url = chrome.runtime.getURL(manifest.options_ui.page);
|
||||||
chrome.tabs.create({url});
|
chrome.tabs.create({url});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -45,7 +45,7 @@ class Backend {
|
|||||||
|
|
||||||
const options = this.getOptionsSync(this.optionsContext);
|
const options = this.getOptionsSync(this.optionsContext);
|
||||||
if (options.general.showGuide) {
|
if (options.general.showGuide) {
|
||||||
chrome.tabs.create({url: chrome.extension.getURL('/bg/guide.html')});
|
chrome.tabs.create({url: chrome.runtime.getURL('/bg/guide.html')});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isPreparedResolve();
|
this.isPreparedResolve();
|
||||||
|
@ -55,8 +55,8 @@ $(document).ready(utilAsync(() => {
|
|||||||
|
|
||||||
const manifest = chrome.runtime.getManifest();
|
const manifest = chrome.runtime.getManifest();
|
||||||
|
|
||||||
setupButtonEvents('.action-open-search', 'search', chrome.extension.getURL('/bg/search.html'));
|
setupButtonEvents('.action-open-search', 'search', chrome.runtime.getURL('/bg/search.html'));
|
||||||
setupButtonEvents('.action-open-options', 'options', chrome.extension.getURL(manifest.options_ui.page));
|
setupButtonEvents('.action-open-options', 'options', chrome.runtime.getURL(manifest.options_ui.page));
|
||||||
setupButtonEvents('.action-open-help', 'help');
|
setupButtonEvents('.action-open-help', 'help');
|
||||||
|
|
||||||
const optionsContext = {
|
const optionsContext = {
|
||||||
|
@ -31,7 +31,7 @@ class Translator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.deinflector) {
|
if (!this.deinflector) {
|
||||||
const url = chrome.extension.getURL('/bg/lang/deinflect.json');
|
const url = chrome.runtime.getURL('/bg/lang/deinflect.json');
|
||||||
const reasons = await requestJson(url, 'GET');
|
const reasons = await requestJson(url, 'GET');
|
||||||
this.deinflector = new Deinflector(reasons);
|
this.deinflector = new Deinflector(reasons);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ class Popup {
|
|||||||
this.container.className = 'yomichan-float';
|
this.container.className = 'yomichan-float';
|
||||||
this.container.addEventListener('mousedown', e => e.stopPropagation());
|
this.container.addEventListener('mousedown', e => e.stopPropagation());
|
||||||
this.container.addEventListener('scroll', e => e.stopPropagation());
|
this.container.addEventListener('scroll', e => e.stopPropagation());
|
||||||
this.container.setAttribute('src', chrome.extension.getURL('/fg/float.html'));
|
this.container.setAttribute('src', chrome.runtime.getURL('/fg/float.html'));
|
||||||
this.container.style.width = '0px';
|
this.container.style.width = '0px';
|
||||||
this.container.style.height = '0px';
|
this.container.style.height = '0px';
|
||||||
this.injectPromise = null;
|
this.injectPromise = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user