CH Turkopticon Blocklist Indicator

If you paste in your HIT Scraper blocklist and includelist inside this script's code, you can see on the TO site if an MTurk requester's name is already on your blocklist or includelist.

目前为 2015-10-02 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name CH Turkopticon Blocklist Indicator
  3. // @author clickhappier
  4. // @namespace clickhappier
  5. // @description If you paste in your HIT Scraper blocklist and includelist inside this script's code, you can see on the TO site if an MTurk requester's name is already on your blocklist or includelist.
  6. // @version 1.0c
  7. // @include http://turkopticon.ucsd.edu/*
  8. // @include https://turkopticon.ucsd.edu/*
  9. // @require http://code.jquery.com/jquery-latest.min.js
  10. // @grant GM_log
  11. // ==/UserScript==
  12.  
  13.  
  14. // Paste the contents of your HIT Scraper blocklist onto the line below, between the quotes ("). You must manually re-paste it when you want to update this script's awareness of it. A script running on a different domain like this can't access where the original HIT Scraper data is saved.
  15. var yourBlocklistHere = "";
  16.  
  17. // Likewise, paste the contents of your HIT Scraper includelist onto the line below, between the quotes (").
  18. var yourIncludelistHere = "";
  19.  
  20. // State the date you last pasted in your updated HIT Scraper blocklist and includelist here, for reference in the indicators' text:
  21. var lastUpdated = "";
  22.  
  23.  
  24. var ignore_list = yourBlocklistHere.split('^');
  25. var include_list = yourIncludelistHere.split('^');
  26.  
  27. // check ignore list for requester name and HIT title (wildcard support from feihtality)
  28. function ignore_check(r,t){
  29. var tempList = ignore_list.map(function(item) { return item.toLowerCase().replace(/\s+/g," "); });
  30. var foundR = -1;
  31. var foundT = -1;
  32. var blockWilds = [], blockExact = [];
  33. blockExact = tempList.filter(function(item) { // separate glob patterns from literal strings
  34. if (item.search(".*?[*].*")) return true; else if (item.length > 1) {blockWilds.push(item); return false;}
  35. });
  36. // run default matching first
  37. foundR = blockExact.indexOf(r.toLowerCase().replace(/\s+/g," "));
  38. foundT = blockExact.indexOf(t.toLowerCase().replace(/\s+/g," "));
  39. // if no match, try globs
  40. if (foundR == -1 && foundT == -1) {
  41. for (var i=0; i<blockWilds.length; i++) {
  42. blockWilds[i] = blockWilds[i].replace(/([+${}[\](\)^|?.\\])/g, "\\$1"); // escape special characters
  43. blockWilds[i] = "^".concat(blockWilds[i].replace(/([^*]|^)[*](?!\*)/g, "$1.*").replace(/\*{2,}/g, function(s) { return s.replace(/\*/g, "\\*"); })).concat("$"); //set up wildcards and escape consecutive asterisks
  44. foundR = r.toLowerCase().replace(/\s+/g," ").search(blockWilds[i]);
  45. foundT = t.toLowerCase().replace(/\s+/g," ").search(blockWilds[i]);
  46. if (foundR != -1 || foundT != -1)
  47. break;
  48. }
  49. }
  50. var found = foundR == -1 && foundT == -1;
  51. return found; // returns false (making !(ignore_check(x,y)) true) if HIT should be blocked, returns true if it shouldn't be blocked
  52. }
  53.  
  54. // check include list for requester name and HIT title
  55. function include_check(r,t)
  56. {
  57. var tempList = include_list.map(function(item) { return item.toLowerCase().replace(/\s+/g," "); });
  58. var foundR = -1;
  59. var foundT = -1;
  60. foundR = tempList.indexOf(r.toLowerCase().replace(/\s+/g," "));
  61. foundT = tempList.indexOf(t.toLowerCase().replace(/\s+/g," "));
  62. var found = foundR == -1 && foundT == -1;
  63. return found; // returns false (making !(include_check(x,y)) true) if HIT should be highlighted, returns true if it shouldn't be highlighted
  64. }
  65.  
  66.  
  67. // display indicators for blocklisted and includelisted requesters
  68. $('div.strong a[href^="/reports?id="]').each(function()
  69. {
  70. var requesterBlocklistedNote_title = "Be aware that in some cases depending on how a review was submitted, the earliest name used by a requester may be displayed on the review instead of their most recent name, so make sure you have the older versions on your blocklist too; and in some cases a requester name that contains ampersands (&), apostrophes (\'), or accented characters will be misinterpreted by TO and thus not be able to match your blocklist unless you add the messed-up version to it too.";
  71. var requesterBlocklistedNote_text = "This requester name is on your blocklist";
  72. var requesterIncludelistedNote_title = "Be aware that in some cases depending on how a review was submitted, the earliest name used by a requester may be displayed on the review instead of their most recent name, so make sure you have the older versions on your includelist too; and in some cases a requester name that contains ampersands (&), apostrophes (\'), or accented characters will be misinterpreted by TO and thus not be able to match your includelist unless you add the messed-up version to it too.";
  73. var requesterIncludelistedNote_text = "This requester name is on your includelist";
  74. if (lastUpdated != "")
  75. {
  76. requesterBlocklistedNote_text += " as of " + lastUpdated;
  77. requesterIncludelistedNote_text += " as of " + lastUpdated;
  78. }
  79. var requester_name = $(this).text();
  80. if (!ignore_check(requester_name,"zyxabcdplaceholder"))
  81. {
  82. $(this).parent().parent().append('<br><br><span class="requesterBlocklistedNote" title="' + requesterBlocklistedNote_title + '"><b>' + requesterBlocklistedNote_text + '</b></span>');
  83. }
  84. else if (!include_check(requester_name,"zyxabcdplaceholder"))
  85. {
  86. $(this).parent().parent().append('<br><br><span class="requesterIncludelistedNote" title="' + requesterIncludelistedNote_title + '"><i>' + requesterIncludelistedNote_text + '</i></span>');
  87. }
  88. });