Advertisement
Guest User

Leagues wiki filter

a guest
Nov 26th, 2023
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. After the page loads and 1s after the table is loaded this will remove all:- 10 Point tasks- Tasks with unmet requirements
  2.  
  3. You can just run it yourself in the browser with:
  4.  
  5.  
  6.  
  7. var tableRows = document.querySelectorAll('table tr');
  8.  
  9. // Iterate through each row
  10. tableRows.forEach(function(row) {
  11.   // Check if the row contains <td data-sort-value="10"> or has an image with class="qc-not-started"
  12.   var tdWithValueTen = row.querySelector('td[data-sort-value="10"]');
  13.   var notStartedImage = row.querySelector('img.qc-not-started');
  14.  
  15.   // If either condition is met, remove the row
  16.   if (tdWithValueTen || notStartedImage) {
  17.     row.remove();
  18.   }
  19. });
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. Or add it to Tampermonkey (https://www.tampermonkey.net/) using:
  28.  
  29.   // ==UserScript==
  30.   // @name         Hide 10 point or uncompletable tasks
  31.   // @namespace    http://tampermonkey.net/
  32.   // @version      0.1
  33.   // @description  Filter out those nasty leagues tasks you can't or won't do.
  34.   // @author       zuccc
  35.   // @match        https://oldschool.runescape.wiki/w/Trailblazer_Reloaded_League/Tasks
  36.   // @icon         https://www.google.com/s2/favicons?sz=64&domain=runescape.wiki
  37.   // @grant        none
  38.   // ==/UserScript==
  39.  
  40.  
  41.   function removeRowsWithValueTenOrNotStarted() {
  42.     // Get all table rows
  43.     var tableRows = document.querySelectorAll('table tr');
  44.  
  45.     // Iterate through each row
  46.     tableRows.forEach(function(row) {
  47.       // Check if the row contains <td data-sort-value="10"> or has an image with class="qc-not-started"
  48.       var tdWithValueTen = row.querySelector('td[data-sort-value="10"]');
  49.       var notStartedImage = row.querySelector('img.qc-not-started');
  50.  
  51.       // If either condition is met, remove the row
  52.       if (tdWithValueTen || notStartedImage) {
  53.         row.remove();
  54.       }
  55.     });
  56.   }
  57.  
  58.  
  59.   (function() {
  60.       'use strict';
  61.  
  62.       // Use MutationObserver to observe changes in the DOM
  63.       var observer = new MutationObserver(function(mutations) {
  64.           // Function to be called after 2 seconds of no changes
  65.           function delayedFunction() {
  66.               removeRowsWithValueTenOrNotStarted();
  67.           }
  68.  
  69.           // Clear previous timeout
  70.           if (observer.timeout) {
  71.               clearTimeout(observer.timeout);
  72.           }
  73.  
  74.           // Set a timeout to call the function after 2 seconds of no changes
  75.           observer.timeout = setTimeout(delayedFunction, 1000);
  76.       });
  77.  
  78.       // Start observing changes in the specified target (e.g., #mw-content-text)
  79.       observer.observe(document.getElementById('mw-content-text'), { subtree: true, childList: true });
  80.   })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement