KAT - Sort Translators

Automatically sorts translators alphabetically (by language)

2014-11-17 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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>');
}