mirror of
https://gitee.com/bitdance-team/chrome-extension
synced 2025-10-08 00:45:13 +08:00
使用了一个不太优雅的方式完成directurl功能合并(张松的代码)
This commit is contained in:
@@ -61,4 +61,21 @@ $(function() {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
// Direct Url
|
||||
const btnDirectUrl = document.querySelector("#btnDirectUrl");
|
||||
chrome.storage.sync.get("linkOpen", ({ linkOpen }) => {
|
||||
btnDirectUrl.checked = !linkOpen;
|
||||
});
|
||||
|
||||
btnDirectUrl.addEventListener("change", () => {
|
||||
chrome.storage.sync.set({ linkOpen: !btnDirectUrl.checked });
|
||||
// 获取当前tab窗口
|
||||
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
|
||||
chrome.scripting.executeScript({
|
||||
target: { tabId: tabs[0].id },
|
||||
func: () => { window.location.reload() },
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
|
Reference in New Issue
Block a user