Filelist filter

Custom Filelist filter for TV series and number of downloads

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name Filelist filter
// @description Custom Filelist filter for TV series and number of downloads
// @include https://filelist.io/*
// @version 0.0.1.20230807194255
// @namespace https://greasyfork.org/users/162242
// ==/UserScript==

var wordListing = [
"Fear.the.Walking.Dead.S",
"Foundation",
"Halo",
"House of the Dragon",
"I.Am.Groot",
"Invasion",
"Loki",
"Raised.by.Wolves",
"Severance",
"South.Park",
"The.Boys",
"The.Last.of.Us",
"The.Lord.of.the.Rings.The.Rings.of.Power",
"The.Sandman",
"The.Terminal.List",
"The.Walking.Dead",
"The.Witcher.S"
];


var selection1 = 500;
var selection2 = 999;
var selection3 = 1999;
var selectionColor1 = "#003366";
var selectionColor2 = "#002900";
var selectionColor3 = "#6B0000";

var ul = document.getElementById("nav").children[0];
var li = document.createElement('li');
li.className = "fleft";
ul.appendChild(li);
var a = document.createElement('a');
var linkText = document.createTextNode("Activate");
a.appendChild(linkText);
a.title = "Activate the filter";
a.href = "javascript:void(0)";
a.setAttribute("id", "CustomButton");
a.addEventListener("click", myScript);
li.appendChild(a);

function myScript() {
	var torrentrow = document.getElementsByClassName("torrentrow");
	
	if(document.getElementById("CustomButton").innerHTML == "Activate") {
		document.getElementById("CustomButton").innerHTML = "Deactivate";

		for (i = 0; i < torrentrow.length; i++) {
			if(typeof torrentrow[i].children !== 'undefined'){
				var title = torrentrow[i].children[1].children[0].children[0].innerText;
				var snatched = torrentrow[i].children[7].children[0].children[0].textContent;
				snatched = snatched.replace(",", "");
				snatched = snatched.replace("times", "");
				snatched = parseInt(snatched);
				for (k = 0; k < wordListing.length; k++) {
					if (title.match(wordListing[k])) {
						torrentrow[i].children[1].children[0].children[0].style.textDecoration = "underline overline";
						torrentrow[i].children[1].children[0].children[0].style.color = "#33CCFF";
					}
				}
				if (snatched > selection3) {
					torrentrow[i].style.backgroundColor = selectionColor3;
				} else if (snatched > selection2) {
					torrentrow[i].style.backgroundColor = selectionColor2;
				} else if (snatched > selection1) {
					torrentrow[i].style.backgroundColor = selectionColor1;
				}
			}
		}
	
	} else {
		document.getElementById("CustomButton").innerHTML = "Activate";
		
		for (j = 0; j < torrentrow.length; j++) {
			torrentrow[j].children[1].children[0].children[0].style.textDecoration = "none";
			torrentrow[j].removeAttribute("style");
			torrentrow[j].children[1].children[0].children[0].removeAttribute("style");
		}
	}
}
document.addEventListener('DOMContentLoaded',myScript());