Created
September 26, 2019 22:15
-
-
Save Efreak/c47e9da578f4fb8a274eb0e8a38b19cb to your computer and use it in GitHub Desktop.
Tapas comic filters: Click on a genre in a tapas page listing to hide all results of that genre. Click on a comic name to hide just that comic.
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 Tapas comic filters | |
// @namespace https://github.com/efreak | |
// @version 1 | |
// @description Click on a genre in a tapas page listing to hide all results of that genre. Click on a comic name to hide just that comic. | |
// @author Efreak | |
// @match https://tapas.io/comics* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.querySelectorAll('li.content-item > a:nth-child(4)').forEach(el=>{ | |
el.removeAttribute('href'); | |
el.title="Hide "+el.innerText+" comics from this page"; | |
el.addEventListener('click',e=>{ | |
document.querySelectorAll('li.content-item > a:nth-child(4)').forEach(ele=>{ | |
if(ele.innerText===el.innerText) { | |
ele.parentNode.parentNode.removeChild(ele.parentNode); | |
} | |
}); | |
}); | |
}); | |
document.querySelectorAll('li.content-item > a:nth-child(2)').forEach(el=>{ | |
el.removeAttribute('href'); | |
el.title="Hide this comic ("+el.innerText+")\n(Click the image instead to open the comic)"; | |
el.addEventListener('click',e=>{ | |
el.parentNode.parentNode.removeChild(el.parentNode); | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is now available at https://github.com/Efreak/UserScripts/Tapas-Filters