From 7ba7feebd2c26e3f310cc690e112d72c26114cb7 Mon Sep 17 00:00:00 2001 From: Tomas Cimermonas Date: Tue, 8 Oct 2019 18:41:09 +0300 Subject: [PATCH 1/2] Remove medium footer --- contentScript.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/contentScript.js b/contentScript.js index 154c703..fa57321 100644 --- a/contentScript.js +++ b/contentScript.js @@ -89,3 +89,25 @@ if (window.location.href.indexOf("bizjournals.com") !== -1) { }, 300); // Delay (in milliseconds) } } + +if (window.location.href.indexOf("medium.com") !== -1) { + const bottomMessageText = 'Get one more story in your member preview when you sign up. It’s free.'; + const DOMElementsToTextDiv = contains('div', bottomMessageText); + + + if(DOMElementsToTextDiv[2]) removeDOMElement(DOMElementsToTextDiv[2]); +} + +function removeDOMElement(...elements) { + for (let element of elements) { + if (element) element.remove(); + } +} + +function contains(selector, text) { + let elements = document.querySelectorAll(selector); + + return Array.prototype.filter.call(elements, function(element){ + return RegExp(text).test(element.textContent); + }); +} \ No newline at end of file From 41018773c6a602b95830ddb4f6fd06cebb9c5cc1 Mon Sep 17 00:00:00 2001 From: Adam <36013816+iamadamdev@users.noreply.github.com> Date: Sun, 10 Nov 2019 11:39:03 -0800 Subject: [PATCH 2/2] Add space between if ( --- contentScript.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contentScript.js b/contentScript.js index 502439b..a43b997 100644 --- a/contentScript.js +++ b/contentScript.js @@ -103,7 +103,7 @@ if (window.location.href.indexOf("medium.com") !== -1) { const bottomMessageText = 'Get one more story in your member preview when you sign up. It’s free.'; const DOMElementsToTextDiv = pageContains('div', bottomMessageText); - if(DOMElementsToTextDiv[2]) removeDOMElement(DOMElementsToTextDiv[2]); + if (DOMElementsToTextDiv[2]) removeDOMElement(DOMElementsToTextDiv[2]); } if (window.location.href.indexOf("bloombergquint.com") !== -1) {