Last active
February 4, 2019 15:42
-
-
Save jonasjancarik/6f620d2166215f4dfadacedd5b303bae to your computer and use it in GitHub Desktop.
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 Medium - Hide Featured | |
// @namespace http://tampermonkey.net/ | |
// @version 0.3 | |
// @description try to take over the world! | |
// @author You | |
// @match https://medium.com/* | |
// @grant none | |
// ==/UserScript== | |
// a function that loads jQuery and calls a callback function when jQuery has finished loading | |
function addJQuery(callback) { | |
var script = document.createElement("script"); | |
script.setAttribute("src", "https://code.jquery.com/jquery-3.3.1.min.js"); | |
script.addEventListener('load', function () { | |
var script = document.createElement("script"); | |
script.textContent = "(" + callback.toString() + ")();"; | |
document.body.appendChild(script); | |
}, false); | |
document.body.appendChild(script); | |
} | |
// the guts of this userscript | |
function main() { | |
setInterval(function () { | |
$('#branch-banner-iframe').contents().find('.branch-banner-close').click() // hide 'download Medium app' banner | |
$('.homeContainer .extremeHero-container').hide(); | |
$('.homeContainer .extremeHero-featuredLink').hide(); | |
$('.homeContainer .svgIcon--star').closest("article").remove() | |
// $('.svgIcon--star').closest("div:has(*[data-post-id])").parent().remove() | |
$('.homeContainer .svgIcon--star').closest(".js-sectionItem").remove() | |
$('.homeContainer .svgIcon--star').closest("li").remove() | |
// hide links to featured | |
// $('a[href*="medium.com/s/"]').hide() | |
$('a[href*="medium.com/s/"]').closest("li").remove() | |
}, 10); | |
} | |
// load jQuery and execute the main function | |
addJQuery(main); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment