Skip to content

Instantly share code, notes, and snippets.

@Efreak
Created September 26, 2019 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Efreak/c47e9da578f4fb8a274eb0e8a38b19cb to your computer and use it in GitHub Desktop.
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.
// ==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);
});
});
})();
@Efreak
Copy link
Author

Efreak commented Apr 2, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment