CH Status Detail Numbering

Displays numbering next to the up-to-25 HITs on each page of MTurk's daily status detail reports. Also shows HIT assignment ID in mouseover text.

目前为 2015-05-09 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name CH Status Detail Numbering
  3. // @author clickhappier
  4. // @namespace clickhappier
  5. // @description Displays numbering next to the up-to-25 HITs on each page of MTurk's daily status detail reports. Also shows HIT assignment ID in mouseover text.
  6. // @version 1.0c
  7. // @include https://www.mturk.com/mturk/statusdetail*
  8. // @require http://code.jquery.com/jquery-latest.min.js
  9. // @grant GM_log
  10. // ==/UserScript==
  11.  
  12.  
  13. // get URL variable - from http://css-tricks.com/snippets/javascript/get-url-variables/
  14. function getQueryVariable(variable)
  15. {
  16. var query = window.location.search.substring(1);
  17. var vars = query.split("&");
  18. for ( var i=0; i<vars.length; i++ )
  19. {
  20. var pair = vars[i].split("=");
  21. if ( pair[0] == variable )
  22. { return pair[1]; }
  23. }
  24. return(false);
  25. }
  26.  
  27.  
  28. // determine current page number
  29. var pageNum = "";
  30. if ( document.location.href.indexOf('pageNumber') > -1 )
  31. {
  32. pageNum = getQueryVariable("pageNumber");
  33.  
  34. if ( pageNum=='' || isNaN(pageNum) ) // just in case
  35. { pageNum = 1; }
  36. }
  37. else // if pageNumber not present in URL, must be first page
  38. {
  39. pageNum = 1;
  40. }
  41.  
  42.  
  43. // add cell to header row for new column
  44. $('th.statusdetailRequesterColumnHeader').before('<th class="statusdetailNumberColumnHeader">#</th>');
  45.  
  46.  
  47. // add numbering cells to lefthand side of each data row
  48. // script concept and basic part of this function were from Kerek: http://www.mturkgrind.com/posts/562667/
  49. $('td.statusdetailRequesterColumnValue').each(function(hitNum){ // uses hitNum+1 inside this function because it starts counting at 0
  50.  
  51. // get HIT ID
  52. var contactLinkSplit = $(this).find('a[title="Contact this Requester"]').attr('href').split('&');
  53. var hitID = contactLinkSplit[0].replace('/mturk/contact?subject=Regarding+Amazon+Mechanical+Turk+HIT+', '');
  54.  
  55. // calculate multi-page multiplied HIT number
  56. var multiHitNum = ((pageNum-1)*25) + (hitNum+1);
  57.  
  58. // display results
  59. $(this).before('<td class="statusdetailNumberColumnValue" title="' + hitID + '">' + pageNum + '.' + (hitNum+1) + ' (' + multiHitNum + ')' + '</td>');
  60. });