Bugmenot Sort Accounts by Date

Default sorts user/pass by newest to oldest, which is the most probable order in which they still work.

目前为 2015-11-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Bugmenot Sort Accounts by Date
  3. // @namespace https://greasyfork.org/en/users/10118-drhouse
  4. // @version 1.0
  5. // @description Default sorts user/pass by newest to oldest, which is the most probable order in which they still work.
  6. // @run-at document-start
  7. // @include http://bugmenot.com/*
  8. // @include https://bugmenot.com/*
  9. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  10. // @require https://cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js
  11. // @require https://cdnjs.cloudflare.com/ajax/libs/tinysort/2.2.2/tinysort.min.js
  12. // @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js
  13. // @author drhouse
  14. // @icon http://bugmenot.com/favicon.ico
  15. // ==/UserScript==
  16.  
  17. $(document).ready(function () {
  18.  
  19. function formatDate(d) {
  20. var dd = d.getDate();
  21. var mm = d.getMonth()+1;
  22. var yy = d.getFullYear() % 100;
  23. yy = 2000 + yy;
  24.  
  25. return yy+'-'+mm+'-'+dd;
  26. }
  27.  
  28. $("#content > article > dl > dd.stats > ul > li:nth-child(3)").text(function(index, text) {
  29. var x = text.replace('old', 'ago');
  30. x = x.replace(x, Date.parse(x));
  31. x = x.replace('(Eastern Daylight Time)', '');
  32. x = x.replace('(Eastern Standard Time)', '');
  33. var d = new Date(x);
  34. return x.replace(x,formatDate(d));
  35. });
  36.  
  37. a = $('#share-it').detach();
  38. b = $('#content > h2').detach();
  39. c = $('#content > ul').detach();
  40. d = $('#page > footer').detach();
  41.  
  42. tinysort.defaults.order = 'desc';
  43. tinysort('#content > article ',{selector:'#content > article > dl > dd.stats > ul > li:nth-child(3)'});
  44.  
  45. a.appendTo("#content");
  46. b.appendTo("#content");
  47. c.appendTo("#content");
  48. d.appendTo("#content");
  49.  
  50. $("#content > article > dl > dd.stats > ul > li:nth-child(3)").text(function(index, text) {
  51. var day = new Date(text);
  52. var dayWrapper = moment(day).fromNow();
  53. return text.replace(text, dayWrapper) + ' | ' + text;
  54. });
  55.  
  56. });