Greasy Fork 还支持 简体中文。

Coalgirls Seeder Ratio

Adds a column with the seeder / leecher ratio on the torrent-listing page

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Coalgirls Seeder Ratio
// @namespace    coalgirls_seeder_ratio
// @description  Adds a column with the seeder / leecher ratio on the torrent-listing page
// @version      1.0
// @date         2016-11-09
// @include      /^https?:\/\/coalgirls.wakku.to\/torrent-listing\/?$/
// @require      https://code.jquery.com/jquery-3.1.1.min.js
// @grant        none
// ==/UserScript==

function color( percent ) {

	if ( percent === 0 || percent >= 1.5 )
		return { background: "transparent", text: "inherit" };

	if ( percent === -1 )
		return { background: "rgb( 170,20,20 )", text: "#fff" };

	if ( percent < 0.9 )
		return { background: "rgb( 252,181,181 )", text: "#000" };

	if ( percent < 1.5 )
		return { background: "rgb( 231,231,126 )", text: "#000" };

}

$( ".trackerlisting .headentry" ).each(function(){
	var el = $(this);
	$( el.find( "th" ).get( 6 ) ).after( "<th>Ratio</th>" );
});

$( ".newentry" ).each(function(){

	var el = $(this);

	var seeders_el = $( el.find( "td" ).get( 5 ) );
	var leechers_el = $( el.find( "td" ).get( 6 ) );

	var seeders = parseInt( seeders_el.text() );
	var leechers = parseInt( leechers_el.text() );

	var percent = ( seeders === 0 && leechers !== 0 || seeders === 0 && leechers === 0 ) ? -1 : ( leechers === 0 ) ? 0 : ( seeders / leechers );
	var percent_text = ( percent === 0 ) ? "---" : ( percent === -1 ) ? "!!!" : Math.round( percent * 100 ) + "%";
	var percent_align = ( percent === -1 || percent === 0 ) ? "center" : "left";

	leechers_el.after( '<td style="color:'+ color( percent ).text +';text-align:'+ percent_align +';background:'+ color( percent ).background +'">'+ percent_text +'</td>' );

});