Skip to content

Commit

Permalink
Update version
Browse files Browse the repository at this point in the history
  • Loading branch information
wardbeyens committed Jan 20, 2023
1 parent 27ae5ea commit fdb6b21
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 21 deletions.
57 changes: 37 additions & 20 deletions contentScript.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
const rem = () => {
const unwantedElements = document.querySelectorAll(
"[data-temptation-position]"
);
unwantedElements.forEach((elm) => {
console.log("Removed: ", elm);
elm.remove();
});
};
const method = 2;

const unhideAllElements = () => {
const hiddenItems = document.querySelectorAll("[style]");
Array.prototype.forEach.call(hiddenItems, (elm) => {
elm.style.cssText = elm.style.cssText.replace(/display: none;/g, "");
});
};
if (method === 1) {
const rem = () => {
const unwantedElements = document.querySelectorAll(
"[data-temptation-position]"
);
unwantedElements.forEach((elm) => {
console.debug("Removed: ", elm);
elm.remove();
});
};

const run = () => {
chrome.action.setIcon({ path: "icon.png" })
rem();
unhideAllElements();
const unhideAllElements = () => {
const hiddenItems = document.querySelectorAll("[style]");
Array.prototype.forEach.call(hiddenItems, (elm) => {
elm.style.cssText = elm.style.cssText.replace(/display: none;/g, "");
});
};

const run = () => {
chrome.action.setIcon({ path: "icon.png" });
rem();
unhideAllElements();
};

while (true) {
setTimeout(() => {
run();
}, 1000);
}
}

run()
if (method === 2) {
var s = document.createElement("script");
s.src = chrome.runtime.getURL("script.js");
s.onload = function () {
this.remove();
};
(document.head || document.documentElement).appendChild(s);
}
8 changes: 7 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "DPG extra",
"version": "1.0.2",
"version": "1.0.5",
"description": "This extension shows the entire DPG media articles.",
"icons": {
"16": "grey-icon.png",
Expand All @@ -13,5 +13,11 @@
"matches": ["https://*.humo.be/*", "https://*.demorgen.be/*"],
"js": ["contentScript.js"]
}
],
"web_accessible_resources": [
{
"resources": ["script.js"],
"matches": ["<all_urls>"]
}
]
}
30 changes: 30 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const rem = () => {
const unwantedElements = document.querySelectorAll(
"[data-temptation-position]"
);
unwantedElements.forEach((elm) => {
console.debug("Removed: ", elm);
elm.remove();
});
};

const unhideAllElements = () => {
const hiddenItems = document.querySelectorAll("[style]");
Array.prototype.forEach.call(hiddenItems, (elm) => {
elm.style.cssText = elm.style.cssText.replace(/display: none;/g, "");
});
};

const run = () => {
rem();
unhideAllElements();
};

run();

function sendIt() {
run();
setTimeout(sendIt, 1000);
}

setTimeout(sendIt, 1000);

0 comments on commit fdb6b21

Please sign in to comment.