Last active
August 29, 2015 14:15
-
-
Save dorukcan/ae729c863a89dd6a5643 to your computer and use it in GitHub Desktop.
sort buddies on ekşi sözlük
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//run at console of https://eksisozluk.com/badi-engellenmis | |
$('head').append('<script type="text/javascript" src="https://mottie.github.io/tablesorter/js/jquery.tablesorter.js"></script>'); | |
$('head').append('<link rel="stylesheet" type="text/css" href="https://mottie.github.io/tablesorter/css/theme.default.css">'); | |
var badilist = []; | |
$('.relation-list').eq(0).find('a[href*=biri]').each(function(){ | |
badilist.push($(this).attr('href')); | |
}); | |
var result = []; | |
$.each(badilist, function(i, badi){ | |
$.get('https://eksisozluk.com' + badi, function(data){ | |
stats = [ $(data).find('#user-profile-title').attr('data-nick') ]; | |
$(data).find('#user-entry-stats>li').each(function(){ | |
stats.push($(this).text().trim()); | |
}); | |
badgetext = ""; | |
$(data).find('#user-badges a').each(function(){ | |
badgetext += $(this).text() + "-"; | |
}); | |
badgetext = badgetext.substring(0, badgetext.length-1); | |
stats.push(badgetext); | |
result.push(stats); | |
}); | |
}); | |
$(document).ajaxStop(function(){ | |
$('#content-body').append('<table id="badi-list" class="tablesorter">' + | |
'<thead>' + | |
'<tr>' + | |
'<th>nick</th>' + | |
'<th>tüm</th>' + | |
'<th>son 1 ay</th>' + | |
'<th>son 1 hafta</th>' + | |
'<th>son 24 saat</th>' + | |
'<th>en son</th>' + | |
'<th>etiket</th>' + | |
'</tr>' + | |
'</thead>' + | |
'<tbody></tbody>' + | |
'</table>'); | |
$.each(result, function(i, row){ | |
var html = '<tr>'; | |
$.each(row, function(j, r){ | |
if(j == 0) | |
html += '<td><a target="_blank" href="https://eksisozluk.com/biri/' + r + '">' + r + '</a></td>'; | |
else | |
html += '<td>' + r + '</td>'; | |
}); | |
html += '</tr>'; | |
$('#badi-list tbody').append(html); | |
}); | |
$('body').append('<script>$("#badi-list").tablesorter({sortList: [[4,0]]}); </script>'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment