22 lines
702 B
JavaScript
22 lines
702 B
JavaScript
// 兼容Firefox
|
|
if (typeof (browser) == "object") {
|
|
function importScripts() {
|
|
for (let script of arguments) {
|
|
const js = document.createElement('script');
|
|
js.src = script;
|
|
document.head.appendChild(js);
|
|
}
|
|
}
|
|
|
|
// browser.windows.onFocusChanged.addListener 少一个参数
|
|
const _onFocusChanged = chrome.windows.onFocusChanged.addListener;
|
|
chrome.windows.onFocusChanged.addListener = function (listener, option) {
|
|
_onFocusChanged(listener);
|
|
};
|
|
|
|
browser.runtime.onInstalled.addListener(({ reason }) => {
|
|
if (reason == "install") {
|
|
browser.tabs.create({ url: "install.html" });
|
|
}
|
|
});
|
|
} |