-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
29 lines (24 loc) · 947 Bytes
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const getTabId = async () => {
let queryOptions = { active: true, lastFocusedWindow: true };
let [tab] = await chrome.tabs.query(queryOptions);
return tab.id;
}
const _blockProsellers = () => {
images = document.querySelector("iframe#cafe_main").contentWindow.document.querySelectorAll("table img")
for (let image of images) {
if (image.getAttribute("src") !== "https://cafe.pstatic.net/levelicon/1/1_150.gif")
continue;
const row = image.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
row.remove();
}
}
const blockProsellers = async () => {
const tabId = await getTabId();
chrome.scripting.executeScript(
{
target: {tabId: tabId},
func: _blockProsellers,
},
() => { console.log("done") });
}
chrome.action.onClicked.addListener(tab => { blockProsellers() });