🏠 返回首頁 

Greasy Fork is available in English.

Hide non-PF

1/23/24 Adds a button to hide all non PF torrents from Snatched views (like Not Seeding - Satisfied)


安装此脚本?
  1. // ==UserScript==
  2. // @name Hide non-PF
  3. // @namespace yyyzzz999
  4. // @author yyyzzz999
  5. // @description 1/23/24 Adds a button to hide all non PF torrents from Snatched views (like Not Seeding - Satisfied)
  6. // @match https://www.myanonamouse.net/snatch_summary.php*
  7. // @version 0.4
  8. // @icon https://www.myanonamouse.net/pic/smilies/karma.gif
  9. // @homepage https://greasyfork.org/en/users/705546-yyyzzz999
  10. // @supportURL https://greasyfork.org/en/scripts/484027-hide-non-pf/feedback
  11. // @license MIT
  12. // @grant none
  13. // ==/UserScript==
  14. /*jshint esversion: 11 */
  15. /*eslint no-multi-spaces:0 */
  16. (function() {
  17. 'use strict';
  18. var DEBUG =1; // Debugging mode on (1) or off (0)
  19. if (DEBUG > 0) console.log('Starting Hide non-PF');
  20. // debugger
  21. // Create the button
  22. const button = document.createElement("button");
  23. button.textContent = "Hide Rows Except PF";
  24. let el = document.querySelectorAll("div.blockHeadCon")[3].firstChild;
  25. var span = document.createElement('span');
  26. span.textContent = " - " ;
  27. el.appendChild(span);
  28. el.appendChild(button);
  29. // Add a click event listener to the button
  30. button.addEventListener("click", function() {
  31. var count =0;
  32. // Get all table rows
  33. const rows = document.getElementsByTagName("tr");
  34. // Loop through all rows
  35. for (let i = rows.length - 1; i > 0; i--) { //We have to start at the last row, otherwise removing a row skips checking the next row.
  36. const row = rows[i];
  37. const cells = row.getElementsByTagName("td");
  38. let hideRow = true;
  39. // Loop through all cells in the row
  40. for (let j = 0; j < cells.length; j++) { //shorten this later...
  41. const cell = cells[j];
  42. // Check if the cell contains PF
  43. if (cell.innerHTML.includes('<span title="personal freeleech">PF</span>')) {
  44. hideRow = false;
  45. count+=1;
  46. break;
  47. }
  48. }
  49. // Hide the row if it doesn't contain the target element
  50. if (hideRow) {
  51. // row.style.display = "none"; // Hidden rows still seen by DownThemAll, zippers, etc.
  52. row.remove();
  53. }
  54. }
  55. if (count > 0) span.textContent = ` - ${count} PF torrents found. - ` ;
  56. }); // End hide function
  57. // var headDiv = document.querySelector('div.blockHeadCon');
  58. // headDiv.appendChild(button); //Doesn't work, moves the first button instead of duplicates it.
  59. if (DEBUG > 0) console.log('Hide non-PF done.');
  60. })();