Advertisement
Guest User

User Script para Artículos.

a guest
Dec 8th, 2021
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Aligerar portada de Artículos
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       You
  7. // @match        https://www.meneame.net/articles
  8. // @icon         https://www.google.com/s2/favicons?domain=meneame.net
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. // ------------------------------------------------------
  13. // --- Añada subs que no le interesen a esta lista    ---
  14. // ---    Por ejemplo: [ 'gatos', 'perros', 'sapos' ] ---
  15. // ------------------------------------------------------
  16. let ignored_subs = [ 'libértame' ];
  17.  
  18. (function() {
  19.     'use strict';
  20.     let news_divs = document.getElementsByClassName("news-summary");
  21.     for (let k in news_divs){
  22.         if(news_divs[k].tagName != "DIV"){
  23.             continue;
  24.         }
  25.         let this_entry = news_divs[k];
  26.         let sub_tags = this_entry.getElementsByClassName("subname");
  27.         //If text content of subname tag is on ignored subs, hide the entry
  28.         try
  29.         {
  30.             let subname = sub_tags[0].innerText;
  31.             if ( ignored_subs.includes(subname) ){
  32.                 this_entry.hidden = true;
  33.             }
  34.             else{
  35.             }
  36.         }
  37.         catch
  38.         {
  39.             //Ignore errors
  40.         }
  41.     }
  42. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement