Greasy Fork is available in English.
1/26/24 Adds a button to remove seeding torrents from Search views (Handy to zip the rest for download)
当前为
// ==UserScript==
// @name Remove Seeding
// @namespace yyyzzz999
// @author yyyzzz999
// @description 1/26/24 Adds a button to remove seeding torrents from Search views (Handy to zip the rest for download)
// @match https://www.myanonamouse.net/tor/browse.php*
// @version 0.5
// @icon https://www.myanonamouse.net/pic/smilies/yesmaster.gif
// @homepage http://greasyfork.icu/en/users/705546-yyyzzz999
// @supportURL http://greasyfork.icu/en/scripts/485525-remove-seeding/feedback
// @license MIT
// @grant none
// ==/UserScript==
/*jshint esversion: 11 */
/*eslint no-multi-spaces:0 */
(function() {
'use strict';
const DEBUG =1; // Debugging mode on (1) or off (0)
if (DEBUG > 0) console.log('Starting Remove Seeding script');
var count =0;
var newtotal;
var startrows;
// debugger
// Create the button
const button = document.createElement("button");
button.textContent = "Remove Seeding Rows";
button.style.fontSize = "20px";
button.style.backgroundColor = "LightBlue";
let el = document.querySelector("div.blockFoot");
var span = document.createElement('span');
el.appendChild(button);
span.textContent = "" ;
span.style.fontSize = "18px";
el.appendChild(span);
// Add a click event listener to the button
button.addEventListener("click", function() {
// Get all table rows
const rows = document.getElementsByTagName("tr");
startrows=rows.length;
if (DEBUG > 0) console.log(`rows.length: ${rows.length}`);
// Loop through all rows
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.
const row = rows[i];
const cells = row.getElementsByTagName("td");
let removeRow = false;
if (DEBUG > 0) console.log(`i: ${i}`);
// Loop through all cells in the row
for (let j = 0; j < cells.length; j++) { //shorten this later...
const cell = cells[j];
// Check if the cell contains PF
if (cell.innerHTML.includes('<div class="browseAct">Recently Seeding in your Client</div>')) {
removeRow = true;
break;
}
}
// Hide the row if it doesn't contain the target element
if (removeRow) {
// row.style.display = "none";
row.remove();
if (DEBUG > 0) console.log(`i: ${i} Removed`);
count+=1;
}
}
if (count > 0) {
newtotal=startrows-2-count; // title row doesn't count, and length first item is number zero
span.textContent = ` ${count} Seeding torrents removed, ${newtotal} left.` ; //rows.length isn't updating correctly after remove.
count =0; // show no change if button pressed twice
} else {
span.textContent = ` ${newtotal} Torrents listed.` ;
}
}); // End hide function
// var headDiv = document.querySelector('div.blockHeadCon');
// headDiv.appendChild(button); //Doesn't work, moves the first button instead of duplicates it.
if (DEBUG > 0) console.log('Remove Seeding script done.');
})();