Skip to content

Instantly share code, notes, and snippets.

@codenamezjames
Created April 21, 2016 16:09
Show Gist options
  • Save codenamezjames/8744257f8e558f2b68f97e95c4834632 to your computer and use it in GitHub Desktop.
Save codenamezjames/8744257f8e558f2b68f97e95c4834632 to your computer and use it in GitHub Desktop.
arr = [];
$('.forum_header_noborder tr').each(function(){
var title = $(this).find('.epinfo').text();
var link = $(this).find('.magnet').attr('href')
arr.push({title:title,link:link})
})
arr.forEach(function(ar){
var match = ar.title.match(/S0\dE\d\d/)
ar.title = match ? match[0] : ar.title
})
arr = arr.reduce(function(o, n, og){
o[n.title] = n;
return o
},{})
Object.keys(arr).sort().forEach(function(key) {
var value = arr[key];
delete arr[key];
arr[key] = value;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment