KAT - Sort Translators

Automatically sorts translators alphabetically (by language)

Versione datata 17/11/2014. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name       KAT - Sort Translators
// @namespace  SortTranslators
// @version    1.02
// @description  Automatically sorts translators alphabetically (by language)
// @match       http://kickass.so/people/translators/
// @match       https://kickass.so/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>');
}