From 1ec7ab7d655fcab21349c7a4b075d31a671bbf0d Mon Sep 17 00:00:00 2001 From: halliday2023 Date: Fri, 25 Apr 2025 21:39:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/background.js | 60 +++++++++++++++++++++---------------------- src/content/record.js | 4 +-- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/background.js b/src/background.js index 9bdb894..655117f 100644 --- a/src/background.js +++ b/src/background.js @@ -12,36 +12,36 @@ const manifest = browser.runtime.getManifest(); // Open new tab on uninstall extension to get survey browser.runtime.setUninstallURL(uninstallURL, () => { }) -// Open new tab on installation to show demo about Ruto -const installedListener = (details) => { - if (details.reason == 'install') { - installNotification(); - browser.tabs.create({ - url: installURL - }) - } else if (details.reason == 'update') { - updateNotification(); - browser.notifications.onClicked.addListener(onClickNoti); - } -} -function onClickNoti() { browser.tabs.create({ url: updateURL }) } -const updateNotification = () => { - browser.notifications.create({ - title: `Ruto`, - message: `Click here to see the changelog of version ${manifest.version}`, - type: 'basic', - iconUrl: 'logo/128.png' - }); -} -const installNotification = () => { - browser.notifications.create('onInstalled', { - title: `Ruto`, - message: `Please restart your browser to use Ruto`, - type: 'basic', - iconUrl: 'logo/128.png' - }); -} -browser.runtime.onInstalled.addListener(installedListener); +// // Open new tab on installation to show demo about Ruto +// const installedListener = (details) => { +// if (details.reason == 'install') { +// installNotification(); +// browser.tabs.create({ +// url: installURL +// }) +// } else if (details.reason == 'update') { +// updateNotification(); +// browser.notifications.onClicked.addListener(onClickNoti); +// } +// } +// function onClickNoti() { browser.tabs.create({ url: updateURL }) } +// const updateNotification = () => { +// browser.notifications.create({ +// title: `Ruto`, +// message: `Click here to see the changelog of version ${manifest.version}`, +// type: 'basic', +// iconUrl: 'logo/128.png' +// }); +// } +// const installNotification = () => { +// browser.notifications.create('onInstalled', { +// title: `Ruto`, +// message: `Please restart your browser to use Ruto`, +// type: 'basic', +// iconUrl: 'logo/128.png' +// }); +// } +// browser.runtime.onInstalled.addListener(installedListener); //- Required // To toggle SRC and TGT context menu option diff --git a/src/content/record.js b/src/content/record.js index fb637a6..8b2d0bd 100644 --- a/src/content/record.js +++ b/src/content/record.js @@ -3,12 +3,12 @@ function stopRecord() { document.removeEventListener("mouseover", mouseOver, true); document.removeEventListener("mouseout", mouseOut, true); let values = { - xpath: recordArray, + xpath: recordArray || [], xpathPOM: recordArrayPOM, title: document.title, URL: document.URL } - if (recordArray.length > 0) + if (values.xpath && values.xpath.length > 0) browser.storage.local.set({ 'downloadData': values }); // browser.runtime.sendMessage({ from: 'download', values }); }