Advertisement
thenadz

StackExchange Review Refresher

Feb 6th, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name       StackExchange Review Refresher
  3. // @namespace  http://danrossiter.org/
  4. // @version    1.0
  5. // @description  Auto-refreshes StackExchange review pages at set intervals. If reviews are open, opens each open section in new tab.
  6. // @match      http://stackoverflow.com/review
  7. // @match      http://superuser.com/review
  8. // @match      http://*.stackexchange.com/review
  9. // @copyright  2014+, Dan Rossiter
  10. //
  11. // @require //ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
  12. // ==/UserScript==
  13.  
  14. var refreshRate = 5 /* min */ * 60 /* s */ * 1000 /* ms */;
  15.  
  16. // all categories that user can review
  17. $('.dashboard-count:not(.dashboard-faded)').each(
  18.     function() {
  19.         // number of items to be reviewed
  20.         var num = $(this).children('.dashboard-num').attr('title');
  21.        
  22.         if ('0' != num) {
  23.             // get anchor tag from dash title
  24.             var dash_title_a = $(this).siblings('.dashboard-summary')
  25.                 .children('.dashboard-title').children('a');
  26.            
  27.             // get window name and URL
  28.             var url = dash_title_a.attr('href');
  29.             var name = dash_title_a.text();
  30.            
  31.             // open review window
  32.             window.open(url, name, "height=700,width=1200");
  33.         }
  34.     }
  35. );
  36.  
  37. // reload every 5 minutes
  38. setTimeout(function () { location.reload(); }, refreshRate);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement