Advertisement
AlkanFan

mturk queue count

May 8th, 2014
588
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. // ==UserScript==
  2. // @name MTurk Queue Count
  3. // @author Chet Manley
  4. // @version 0.1
  5. // @description Displays the current queue count above the HIT area.
  6. // @include https://www.mturk.com/mturk/*
  7. // @require http://code.jquery.com/jquery-latest.min.js
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11.  
  12. // Displays the current queue count above the HIT area.
  13.  
  14. $(document).ready(function () {
  15. console.log('AMT Tools Queue Count loaded');
  16.  
  17. var myHITsURL = 'https://www.mturk.com/mturk/myhits';
  18. var queueCount = '';
  19. var HITsRemainingStr = ' HITs remaining';
  20.  
  21. $.ajax({
  22. async: false,
  23. type: 'GET',
  24. url: myHITsURL,
  25. success: function (data) {
  26. queueCount = $('.title_orange_text', $(data)).text().trim();
  27. }
  28. });
  29.  
  30. if (queueCount.length) {
  31. queueCount = queueCount.split(' of ')[1];
  32. queueCount = queueCount.split(' ')[0];
  33.  
  34. if (parseInt(queueCount) == 1) {
  35. HITsRemainingStr = ' HIT remaining';
  36. }
  37. } else {
  38. HITsRemainingStr = 'Your queue is empty';
  39. }
  40.  
  41. var queueCountStr = queueCount + HITsRemainingStr;
  42.  
  43. $('#theTime').parent().parent().parent().append('< tr><td align="left" valign="top" class="title_orange_text" nowrap="" style="padding-top: 3px; padding-left: 5px;"><b>Queue:</b> <span>' + queueCountStr + '</span></td></tr>');
  44. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement