commit 2698965b689f57929be0ed5da62e91d7b168fd1c Author: Dovi Cowan Date: Wed Jul 20 00:46:09 2022 +0100 inital commit diff --git a/background-script.js b/background-script.js new file mode 100644 index 0000000..35fbd37 --- /dev/null +++ b/background-script.js @@ -0,0 +1,50 @@ +/* chrome.browserAction.onClicked.addListener(function () { + console.log("Test"); + + // let title = browser.i18n.getMessage("notificationTitle"); + // let content = browser.i18n.getMessage("notificationContent", message.url); +}) */ + +chrome.action.onClicked.addListener(async tab => { + try { + await chrome.scripting.insertCSS({ + target: { + tabId: tab.id, + }, + css: `.s-item a.s-item__link { border-style: solid; }` + }); + } catch (error) { + console.error('CSS insert failed! ' + error); + } + + try { + await chrome.scripting.executeScript({ + target: { + tabId: tab.id, + }, + func: () => { + document.querySelectorAll('.s-item a.s-item__link').forEach(element => { + let href = element.getAttribute('href'); + href = href.split('/'); + let itemID = href[href.length-1].split('?')[0]; + console.log(itemID); + }); + } + }); + } catch (error) { + console.error('Get HREFs failed! ' + error); + } +}); + +chrome.webNavigation.onCompleted.addListener(function() { + chrome.notifications.create({ + "type": "basic", + "iconUrl": "icons/ebay-48.png", + "title": 'My Notification', + "message": 'Hi, this is eBay!' + }); +}, { + url: [{ + urlMatches : 'https://www.ebay.co.uk/' + }] +}); \ No newline at end of file diff --git a/icons/128.png b/icons/128.png new file mode 100644 index 0000000..699ff63 Binary files /dev/null and b/icons/128.png differ diff --git a/icons/ebay-48.png b/icons/ebay-48.png new file mode 100644 index 0000000..5c198d3 Binary files /dev/null and b/icons/ebay-48.png differ diff --git a/icons/ebay-original.png b/icons/ebay-original.png new file mode 100644 index 0000000..eeac4ef Binary files /dev/null and b/icons/ebay-original.png differ diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..be4bfaa --- /dev/null +++ b/manifest.json @@ -0,0 +1,26 @@ +{ + "manifest_version": 3, + "name": "eBay Item Remove - DEVELOPMENT BUILD", + "version": "0.0.1", + + "description": "Remove items you don't want to see from eBay", + + "icons": { + "48": "icons/ebay-48.png" + }, + + "action": { + "default_icon": { + "48": "icons/ebay-48.png" + }, + "default_title": "eBay Item Remove" + }, + + "background": { + "service_worker": "background-script.js" + }, + + "permissions": [ "notifications", "webNavigation", "scripting" ], + + "host_permissions": [ "*://*.ebay.co.uk/*" ] +} \ No newline at end of file diff --git a/screenshots/fullpage.png b/screenshots/fullpage.png new file mode 100644 index 0000000..1edb241 Binary files /dev/null and b/screenshots/fullpage.png differ diff --git a/screenshots/notification.png b/screenshots/notification.png new file mode 100644 index 0000000..6222d19 Binary files /dev/null and b/screenshots/notification.png differ