Created
November 15, 2017 03:02
-
-
Save bdforbes/468f66e1e09f8326fd24a9e62cda2a2d to your computer and use it in GitHub Desktop.
Add a button to the feedly All list that removes sponsored ads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name New Userscript | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://feedly.com/i/latest | |
// @grant none | |
// ==/UserScript== | |
var removeAds = function() { | |
var entries = document.getElementsByClassName("entry"); | |
for (var i = 0; i < entries.length; ++i) { | |
var entry = entries[i]; | |
var children = entry.children; | |
for (var j=0; j<children.length; ++j) { | |
var child = children[j]; | |
if (child.nodeName=='SPAN' && child.innerText=='Sponsored') { | |
console.log('Removing entry with inner text:\n\n'+entry.innerText); | |
entry.parentElement.removeChild(entry); | |
return; | |
} | |
} | |
} | |
}; | |
var foo = function() { | |
var element = document.createElement('input'); | |
element.type = 'button'; | |
element.id = 'btnRemove'; | |
element.value = 'Remove ads'; | |
element.onclick = removeAds; | |
var cont = document.getElementsByClassName('list-entries')[0].parentElement; | |
cont.insertBefore(element, cont.children[1]); | |
}; | |
(function() { | |
'use strict'; | |
setTimeout(foo, 3000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment