Compare commits

..

4 commits

Author SHA1 Message Date
d9bf5dd780
update version 2022-08-01 23:36:49 +01:00
92290ff70c
readd item 2022-08-01 23:36:28 +01:00
35964539b0
start on readd 2022-08-01 23:24:47 +01:00
8a04b7ebe6
add FUNDING 2022-07-21 00:36:48 +01:00
3 changed files with 43 additions and 2 deletions

1
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
liberapay: dovicowan

View file

@ -20,6 +20,8 @@ chrome.action.onClicked.addListener(async tab => {
addButton(); addButton();
readdItem();
// try { // try {
// await chrome.scripting.insertCSS({ // await chrome.scripting.insertCSS({
// target: { // target: {
@ -79,7 +81,7 @@ async function removeItems() {
if(hiddenItemsList.includes(parseInt(itemID))) { if(hiddenItemsList.includes(parseInt(itemID))) {
console.log("Item " + itemID + " is in removelist!"); console.log("Item " + itemID + " is in removelist!");
console.log(element.closest('.s-item')); console.log(element.closest('.s-item'));
element.closest('.s-item').innerHTML = 'REMOVED BY EBAY ITEM REMOVER'; element.closest('.s-item').innerHTML = "REMOVED BY EBAY ITEM REMOVER <a href='#' class='ebayitemremover-extension_readditem' ebayitemremover-extension_itemid='" + itemID + "'>Readd</a>";
} else { } else {
let parent = element.closest('.s-item'); let parent = element.closest('.s-item');
@ -141,4 +143,42 @@ async function addButton() {
} catch (error) { } catch (error) {
console.log("Error adding removal button! " + error); console.log("Error adding removal button! " + error);
} }
}
async function readdItem() {
let queryOptions = { active: true, lastFocusedWindow: true };
let [tab] = await chrome.tabs.query(queryOptions);
let hiddenItemsList = await getHiddenItemsList();
try {
await chrome.scripting.executeScript({
target: {
tabId: tab.id,
},
args: [ hiddenItemsList ],
func: (hiddenItemsList) => {
Array.from(document.getElementsByClassName('ebayitemremover-extension_readditem')).forEach(element => {
element.addEventListener('click', (event) => {
let itemID = parseInt(event.currentTarget.getAttribute('ebayitemremover-extension_itemid'));
const index = hiddenItemsList.indexOf(itemID);
try {
hiddenItemsList.splice(index, 1);
} catch (error) {
alert("failed removing " + itemID);
}
chrome.storage.sync.set( {'hiddenItemsList': JSON.stringify(hiddenItemsList)}, function() {
alert("Done\nYou need to reload the page for this to take effect");
});
event.preventDefault();
event.preventDefault();
})
});
}
})
} catch (error) {
console.log("Error adding readd! " + error);
}
} }

View file

@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "eBay Item Remove - DEVELOPMENT BUILD", "name": "eBay Item Remove - DEVELOPMENT BUILD",
"version": "0.0.5", "version": "0.0.6",
"description": "Remove items you don't want to see from eBay", "description": "Remove items you don't want to see from eBay",