Automatically sorts translators alphabetically (by language)
当前为
// ==UserScript==
// @name KAT - Sort Translators
// @namespace SortTranslators
// @version 1.01
// @description Automatically sorts translators alphabetically (by language)
// @require http://code.jquery.com/jquery-latest.js
// @match http://kickass.to/people/translators/
// @match https://kickass.to/people/translators/
// ==/UserScript==
var info = [];
$('.firstColl:first > ul > li').each(function()
{
var all = $(this).html();
var span = $(this).children("span");
$(span).remove();
var language = $(this).html();
info.push({"html":all, "lang":language});
$(this).remove();
});
var columnLimit = info.length;
var current = 0;
$('.secondColl:first > ul > li').each(function()
{
var all = $(this).html();
var span = $(this).children("span");
$(span).remove();
var language = $(this).html();
info.push({"html":all, "lang":language});
$(this).remove();
});
info.sort(function(a, b) {
return a.lang.localeCompare(b.lang);;
});
for (i = 0; i < info.length; i++)
{
if (current < columnLimit) { $('.firstColl:first > ul').append('<li>' + info[i].html + '</li>'); }
else { $('.secondColl:first > ul').append('<li>' + info[i].html + '</li>'); }
current++;
}
info = [];
$('.thirdColl:first > ul > li').each(function()
{
var all = $(this).html();
var span = $(this).children("span");
$(span).remove();
var language = $(this).html();
info.push({"html":all, "lang":language});
$(this).remove();
});
info.sort(function(a, b) {
return a.lang.localeCompare(b.lang);;
});
for (i = 0; i < info.length; i++)
{
$('.thirdColl:first > ul').append('<li>' + info[i].html + '</li>');
}