Skip to content

Instantly share code, notes, and snippets.

@Seldaek
Last active August 29, 2015 14:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Seldaek/bc0ae0e2bf1617d71ed7 to your computer and use it in GitHub Desktop.
Save Seldaek/bc0ae0e2bf1617d71ed7 to your computer and use it in GitHub Desktop.
PHP Wiki Vote Chrono-sort
// Run this in web console
var rows = $('table tr').get();
rows.sort(function(a, b) {
var keyA = $(a).find('img[src="/lib/images/success.png"]').attr('title') || '0';
var keyB = $(b).find('img[src="/lib/images/success.png"]').attr('title') || '0';
if (keyA < keyB) return -1; if (keyA > keyB) return 1; return 0;
});
$.each(rows, function(index, row) {$('table tbody').append(row);});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment