1234567891011121314151617 |
- document.addEventListener("DOMContentLoaded", function () {
- // 处理关闭按钮点击事件
- document
- .getElementById("close-sidebar")
- .addEventListener("click", function () {
- // 通知content script关闭侧边栏
- window.parent.postMessage({ action: "closeSidebar" }, "*");
- });
- });
- window.addEventListener("unload", async () => {
- try {
- await Utils.setStorageData(SidebarManager.CONFIG.STORAGE_KEY, false);
- } catch (error) {
- console.warn("Failed to update sidebar state:", error);
- }
- });
|