torec subfilter

Add a text box above the subtitle list which allow one to filter the list.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @id             torec-subfilter
// @name           torec subfilter
// @version        0.2
// @author         Rabin
// @description    Add a text box above the subtitle list which allow one to filter the list.
// @include        http://www.torec.net/sub.asp*
// @require        //code.jquery.com/jquery-1.10.2.js
// @run-at         document-end
// @namespace https://greasyfork.org/users/706
// ==/UserScript==

if(typeof $ == 'undefined'){ var $ = unsafeWindow.jQuery; }

$( "div[class='sub_dl']" ).prepend('<input id="subfilter" type="text"/>');

// new :<function> to for case insensitive filtering.
$.expr[':'].Contains = function(a,i,m){ return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0; };

$(document).ready(function() {  

    $("#subfilter").change( function () {
        var filter = $(this).val() ; 
        if (filter !== '') {
            $("#download_version").children().show();
            $("#download_version").find("option:not(:Contains("+filter+"))").hide();
        }
        else {
            $("#download_version").children().show();
        }
    }).keyup( function () {
    // fire the above change event after every letter
    $(this).change();
    });

});