提交修改

This commit is contained in:
halliday2023 2025-04-25 21:39:44 +08:00
parent d160e6d94d
commit 1ec7ab7d65
2 changed files with 32 additions and 32 deletions

View File

@ -12,36 +12,36 @@ const manifest = browser.runtime.getManifest();
// Open new tab on uninstall extension to get survey // Open new tab on uninstall extension to get survey
browser.runtime.setUninstallURL(uninstallURL, () => { }) browser.runtime.setUninstallURL(uninstallURL, () => { })
// Open new tab on installation to show demo about Ruto // // Open new tab on installation to show demo about Ruto
const installedListener = (details) => { // const installedListener = (details) => {
if (details.reason == 'install') { // if (details.reason == 'install') {
installNotification(); // installNotification();
browser.tabs.create({ // browser.tabs.create({
url: installURL // url: installURL
}) // })
} else if (details.reason == 'update') { // } else if (details.reason == 'update') {
updateNotification(); // updateNotification();
browser.notifications.onClicked.addListener(onClickNoti); // browser.notifications.onClicked.addListener(onClickNoti);
} // }
} // }
function onClickNoti() { browser.tabs.create({ url: updateURL }) } // function onClickNoti() { browser.tabs.create({ url: updateURL }) }
const updateNotification = () => { // const updateNotification = () => {
browser.notifications.create({ // browser.notifications.create({
title: `Ruto`, // title: `Ruto`,
message: `Click here to see the changelog of version ${manifest.version}`, // message: `Click here to see the changelog of version ${manifest.version}`,
type: 'basic', // type: 'basic',
iconUrl: 'logo/128.png' // iconUrl: 'logo/128.png'
}); // });
} // }
const installNotification = () => { // const installNotification = () => {
browser.notifications.create('onInstalled', { // browser.notifications.create('onInstalled', {
title: `Ruto`, // title: `Ruto`,
message: `Please restart your browser to use Ruto`, // message: `Please restart your browser to use Ruto`,
type: 'basic', // type: 'basic',
iconUrl: 'logo/128.png' // iconUrl: 'logo/128.png'
}); // });
} // }
browser.runtime.onInstalled.addListener(installedListener); // browser.runtime.onInstalled.addListener(installedListener);
//- Required //- Required
// To toggle SRC and TGT context menu option // To toggle SRC and TGT context menu option

View File

@ -3,12 +3,12 @@ function stopRecord() {
document.removeEventListener("mouseover", mouseOver, true); document.removeEventListener("mouseover", mouseOver, true);
document.removeEventListener("mouseout", mouseOut, true); document.removeEventListener("mouseout", mouseOut, true);
let values = { let values = {
xpath: recordArray, xpath: recordArray || [],
xpathPOM: recordArrayPOM, xpathPOM: recordArrayPOM,
title: document.title, title: document.title,
URL: document.URL URL: document.URL
} }
if (recordArray.length > 0) if (values.xpath && values.xpath.length > 0)
browser.storage.local.set({ 'downloadData': values }); browser.storage.local.set({ 'downloadData': values });
// browser.runtime.sendMessage({ from: 'download', values }); // browser.runtime.sendMessage({ from: 'download', values });
} }