CH Remaining HITs Replicator

Replicates the 'HITs Available' number underneath the HIT work area for ease of reference.

目前为 2014-09-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name CH Remaining HITs Replicator
  3. // @author clickhappier
  4. // @namespace clickhappier
  5. // @description Replicates the 'HITs Available' number underneath the HIT work area for ease of reference.
  6. // @include https://www.mturk.com/mturk/*
  7. // @require http://code.jquery.com/jquery-latest.min.js
  8. // @version 1.0c
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12.  
  13. if ( $(document.body).find('td:contains("Finished with this HIT?")').text() !== "" ) // check for being on a HIT-in-progress page
  14. {
  15.  
  16. // get the HITs Available number from HIT header info
  17. var hitsRem = $(document.body).find('td[class="capsule_field_title"]:contains("HITs Available:")').next().text().trim();
  18.  
  19. // console.log( "hitsRem=" + hitsRem );
  20.  
  21. // get second (bottom) buttons area div on a HIT-in-progress page: parent0=tr, parent1=tbody, parent2=table, parent3=div
  22. var bottomButtons = $(document.body).find('td:contains("Finished with this HIT?")').eq(2).parents().eq(3);
  23.  
  24. // console.log( "bottomButtons=" + $(bottomButtons)[0].outerHTML );
  25.  
  26. // insert the replicated HITs number html above the bottom buttons area (at the top of the div containing the table containing the buttons)
  27. $(bottomButtons).prepend( "<span align=center>Remaining HITs Available: <b>" + hitsRem + "</b></span>" );
  28.  
  29.  
  30. }