HIT Scraper WITH EXPORT [dev]

Snag HITs.

当前为 2015-12-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name HIT Scraper WITH EXPORT [dev]
  3. // @author feihtality
  4. // @description Snag HITs.
  5. // @namespace https://greasyfork.org/en/users/12709
  6. // @match https://www.mturk.com/mturk/findhits?*hit_scraper-dev
  7. // @match https://www.mturk.com/mturk/findhits?*hit_scraper
  8. // @version 4.0.020
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. // v4.0: massive API overhaul reducing size by nearly 3000 lines
  13. // silent notifications, appearance approvements, additional customization
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. const URL_SELF = '';
  19. const DOC_TITLE = 'HITScraper [dev]';
  20. const TO_BASE = 'https://turkopticon.ucsd.edu/';
  21. const TO_REPORTS = TO_BASE+'reports?id=';
  22. const TO_API = TO_BASE+'api/multi-attrs.php?ids=';
  23.  
  24. var ico = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wsTDwctGwJAtQAAAYRJREFUOMudkz1rWmEUx3/6gFeC1A5p6RJByGTGTpEM3iHfwMmxfggH1yyB69BFyFAy5FIQ6wdw9CVxUOhQXFykYFcTLvEaiuafQU0wXoPkwIHnOS8/znPOeWAh18AU0I7qA61lLjfbAl3X1Ww2k+u620AtgP9BTsdx1O/3lUqlNBgM5DhOEGAaWh7eLeEgYywWo1QqMRwO8X2fdrtNsVjcCtkorVKpSJKy2awsy1Imk1Gv19vWh02j53mSpHQ6vctENo2dTkcrGY/HqlarSiaTuwMSiYRqtZomk8kzqNvt7g5YqTFGtm1LkjzPC4wJnEKz2cS2bSKRCMYYAOr1+htTCFtr1EKhoEajId/3NRqNVC6XFY/HF/69LyKfE9bivlikfA72D+H8DHh8e3PyOfAMfJjDj58YoMjvP4bQPVz9g4MU7Ifh7y2EDJgoHB/B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yrKua6bpuqKr2q6purLtyq5tu7Ks+6br6rbqyrquyrLu27au+7KtC7vourauyq6uq7Ks67It67Zs20LJ81TVM03X9UzTdVXXtW3VdW1bM03XNV1XlkXVdWXVlXVddWVb90zTdU1XlWXTVWVZlWXddmVXl0XXtW1Vln1ddWVfl23d92VZ133TdXVblWXbV2VZ92Vd94VZt33dU1VbN11X103X1X1b131htm3fF11X11XZ1oVVlnXf1n1lmHWdMLqurqu27OuqLOu+ruvGMOu6MKy6bfyurQvDq+vGseu+rty+j2rbvvDqtjG8um4cu7Abv+37xrGpqm2brqvrpivrumzrvm/runGMrqvrqiz7uurKvm/ruvDrvi8Mo+vquirLurDasq/Lui4Mu64bw2rbwu7aunDMsi4Mt+8rx68LQ9W2heHVdaOr28ZvC8PSN3a+AACAAQcAgAATykChISsCgDgBAAYhCBVjECrGIIQQUgohpFQxBiFjDkrGHJQQSkkhlNIqxiBkjknIHJMQSmiplNBKKKWlUEpLoZTWUmotptRaDKG0FEpprZTSWmopttRSbBVjEDLnpGSOSSiltFZKaSlzTErGoKQOQiqlpNJKSa1lzknJoKPSOUippNJSSam1UEproZTWSkqxpdJKba3FGkppLaTSWkmptdRSba21WiPGIGSMQcmck1JKSamU0lrmnJQOOiqZg5JKKamVklKsmJPSQSglg4xKSaW1kkoroZTWSkqxhVJaa63VmFJLNZSSWkmpxVBKa621GlMrNYVQUgultBZKaa21VmtqLbZQQmuhpBZLKjG1FmNtrcUYSmmtpBJbKanFFluNrbVYU0s1lpJibK3V2EotOdZaa0ot1tJSjK21mFtMucVYaw0ltBZKaa2U0lpKrcXWWq2hlNZKKrGVklpsrdXYWow1lNJiKSm1kEpsrbVYW2w1ppZibLHVWFKLMcZYc0u11ZRai621WEsrNcYYa2415VIAAMCAAwBAgAlloNCQlQBAFAAAYAxjjEFoFHLMOSmNUs45JyVzDkIIKWXOQQghpc45CKW01DkHoZSUQikppRRbKCWl1losAACgwAEAIMAGTYnFAQoNWQkARAEAIMYoxRiExiClGIPQGKMUYxAqpRhzDkKlFGPOQcgYc85BKRljzkEnJYQQQimlhBBCKKWUAgAAChwAAAJs0JRYHKDQkBUBQBQAAGAMYgwxhiB0UjopEYRMSielkRJaCylllkqKJcbMWomtxNhICa2F1jJrJcbSYkatxFhiKgAA7MABAOzAQig0ZCUAkAcAQBijFGPOOWcQYsw5CCE0CDHmHIQQKsaccw5CCBVjzjkHIYTOOecghBBC55xzEEIIoYMQQgillNJBCCGEUkrpIIQQQimldBBCCKGUUgoAACpwAAAIsFFkc4KRoEJDVgIAeQAAgDFKOSclpUYpxiCkFFujFGMQUmqtYgxCSq3FWDEGIaXWYuwgpNRajLV2EFJqLcZaQ0qtxVhrziGl1mKsNdfUWoy15tx7ai3GWnPOuQAA3AUHALADG0U2JxgJKjRkJQCQBwBAIKQUY4w5h5RijDHnnENKMcaYc84pxhhzzjnnFGOMOeecc4wx55xzzjnGmHPOOeecc84556CDkDnnnHPQQeicc845CCF0zjnnHIQQCgAAKnAAAAiwUWRzgpGgQkNWAgDhAACAMZRSSimllFJKqKOUUkoppZRSAiGllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimVUkoppZRSSimllFJKKaUAIN8KBwD/BxtnWEk6KxwNLjRkJQAQDgAAGMMYhIw5JyWlhjEIpXROSkklNYxBKKVzElJKKYPQWmqlpNJSShmElGILIZWUWgqltFZrKam1lFIoKcUaS0qppdYy5ySkklpLrbaYOQelpNZaaq3FEEJKsbXWUmuxdVJSSa211lptLaSUWmstxtZibCWlllprqcXWWkyptRZbSy3G1mJLrcXYYosxxhoLAOBucACASLBxhpWks8LR4EJDVgIAIQEABDJKOeecgxBCCCFSijHnoIMQQgghREox5pyDEEIIIYSMMecghBBCCKGUkDHmHIQQQgghhFI65yCEUEoJpZRSSucchBBCCKWUUkoJIYQQQiillFJKKSGEEEoppZRSSikl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VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=',
  27.  
  28. scraperHistory = new Archive(),
  29. defaults = { //{{{
  30. themes: {//{{{
  31. whisper: {
  32. highlight :'#1F3847', background :'#232A2F', accent :'#00ffff', bodytable :'#AFCCDE', cpBackground :'#394752',
  33. toHigh :'#009DFF', toGood :'#40B6FF', toAverage :'#7ACCFF', toLow :'#B5E3FF', toPoor :'#DEF1FC',
  34. hitDB :'#CADA95', nohitDB :'#DA95A8', unqualified :'#808080', reqmaster :'#C1E1F6', nomaster :'#D6C1F6',
  35. defaultText :'#AFCCDE', inputText :'#98D6D6', secondText :'#808080', link :'#003759', vlink :'#40F0F0',
  36. toNone :'#AFCCDE', export :'#86939C', hover :'#1E303B' },
  37. solDark: {
  38. highlight :'#657b83', background :'#002b36', accent :'#b58900', bodytable :'#839496', cpBackground :'#073642',
  39. toHigh :'#859900', toGood :'#A2BA00', toAverage :'#b58900', toLow :'#cb4b16', toPoor :'#dc322f',
  40. hitDB :'#82D336', nohitDB :'#D33682', unqualified :'#9F9F9F', reqmaster :'#B58900', nomaster :'#839496',
  41. defaultText :'#839496', inputText :'#eee8d5', secondText :'#93a1a1', link :'#000000', vlink :'#6c71c4',
  42. toNone :'#839496', export :'#CCC6B4', hover :'#122A30' },
  43. solLight: {
  44. highlight :'#657b83', background :'#fdf6e3', accent :'#b58900', bodytable :'#657b83', cpBackground :'#eee8d5',
  45. toHigh :'#859900', toGood :'#A2BA00', toAverage :'#b58900', toLow :'#cb4b16', toPoor :'#dc322f',
  46. hitDB :'#82D336', nohitDB :'#36D0D3', unqualified :'#9F9F9F', reqmaster :'#B58900', nomaster :'#6C71C4',
  47. defaultText :'#657b83', inputText :'#6FA3A3', secondText :'#A6BABA', link :'#000000', vlink :'#6c71c4',
  48. toNone :'#657b83', export :'#000000', hover :'#C7D2D6' },
  49. classic: {
  50. highlight :'#30302F', background :'#131313', accent :'#94704D', bodytable :'#000000', cpBackground :'#131313',
  51. toHigh :'#66CC66', toGood :'#ADFF2F', toAverage :'#FFD700', toLow :'#FF9900', toPoor :'#FF3030',
  52. hitDB :'#66CC66', nohitDB :'#FF3030', unqualified :'#9F9F9F', reqmaster :'#551A8B', nomaster :'#0066CC',
  53. defaultText :'#94704D', inputText :'#000000', secondText :'#997553', link :'#0000FF', vlink :'#800080',
  54. toNone :'#d3d3d3', export :'#000000', hover :'#21211F' },
  55. deluge: {
  56. highlight :'#1F3847', background :'#434e56', accent :'#fbde2d', bodytable :'#f8f8f8', cpBackground :'#384147',
  57. toHigh :'#6FFA3C', toGood :'#D9FC35', toAverage :'#fbde2d', toLow :'#FAB050', toPoor :'#FA6F50',
  58. hitDB :'#d8fa3c', nohitDB :'#DA95A8', unqualified :'#ADC6EE', reqmaster :'#BFADEE', nomaster :'#ADEEDF',
  59. defaultText :'#f8f8f8', inputText :'#D8FA3C', secondText :'#ADC6EE', link :'#99004F', vlink :'#DCEEAD',
  60. toNone :'#97A167', export :'#ADC6EE', hover :'#426075' }
  61. },//}}}
  62. vbTemplate: '[table][tr][td][b]Title:[/b] [URL=${previewLink}][COLOR=blue]${title}[/COLOR][/URL]\n' +
  63. '[b]Requester:[/b] [URL=${requesterLink}][COLOR=blue]${requesterName}[/COLOR][/URL] [${requesterId}] ' +
  64. '([URL='+TO_REPORTS+'${requesterId}][COLOR=blue]TO[/COLOR][/URL])\n' +
  65. '[b]TO Ratings:[/b]\n${toImg}\n${toText}\n${toFoot}\n' +
  66. '[b]Description:[/b] ${description}\n[b]Time:[/b] ${time}\n[b]HITs Available:[/b] ${numHits}\n' +
  67. '[b]Reward:[/b] [COLOR=green][b]${reward}[/b][/COLOR]\n' +
  68. '[b]Qualifications:[/b] ${quals}[/td][/tr][/table]',
  69. },//}}}
  70.  
  71. Settings = {//{{{
  72. defaults: defaults,
  73. user: JSON.parse(localStorage.getItem('scraper_settings')) || {//{{{
  74. themes: { name: 'classic', colors: JSON.parse(JSON.stringify(defaults.themes)) }, // JSON because Object.assign is not recursive :(
  75. colorType: 'sim', sortType: 'adj',
  76. toWeights: { comm: '1', pay: '3', fair: '3', fast: '1' },
  77. exportVb: true, exportIrc: true, exportHwtf: true,
  78. notifySound: [false, 'ding'], notifyBlink: false, notifyTaskbar: false,
  79. wildblocks: false, showCheckboxes: true, hitColor: 'link',
  80.  
  81. refresh: '0', pages: '3', skips: false, resultsPerPage: '10', batch: '', pay: '', qual: true, monly: false, mhide: false,
  82. searchBy: 0, invert: false, shine: '300', minTOPay: '', hideNoTO: false,
  83. disableTO: false, sortPay: false, sortAll: false, search: '', hideBlock: true,
  84. onlyIncludes: false, shineInc: true, sortAsc: false, sortDsc: true, gbatch: false,
  85.  
  86. vbTemplate: defaults.vbTemplate, vbSym: '\u2605', // star
  87. },//}}}
  88. save: function() { localStorage.setItem('scraper_settings', JSON.stringify(this.user)); },
  89. draw: function() {//{{{
  90. var
  91. _ccs = 'https://greasyfork.org/en/scripts/3118-mmmturkeybacon-color-coded-search-with-checkpoints',
  92. _hwtf = 'https://www.reddit.com/r/HITsWorthTurkingFor',
  93. _general = //{{{
  94. `<div>
  95. <div style="float:left; margin-left:15px">
  96. <span style="position:relative; left:-8px"><b>Export Buttons</b></span>
  97. <p><label for="exportVb" style="float:left; width:51px">vBulletin</label>
  98. <input id="exportVb" name="export" value="vb" type="checkbox" ${this.user.exportVb ? 'checked' : ''}/></p>
  99. <p><label for="exportIrc" style="float:left; width:51px">IRC</label>
  100. <input id="exportIrc" name="export" value="irc" type="checkbox" ${this.user.exportIrc ? 'checked' : ''}/></p>
  101. <p><label for="exportHwtf" style="float:left; width:51px">Reddit</label>
  102. <input id="exportHwtf" name="export" value="hwtf" type="checkbox" ${this.user.exportHwtf ? 'checked' : ''}/></p>
  103. </div>
  104. <section style="margin-left:110px">
  105. <span style="position:relative; left:10px"><i>vBulletin</i></span><br>
  106. Show a button in the results to export the specified HIT with vBulletin formatted text to share on forums.
  107. </section><section style="margin-left:110px">
  108. <span style="position:relative; left:10px"><i>IRC</i></span><br>
  109. Show a button in the results to export the specified HIT streamlined for sharing on IRC.
  110. </section><section style="margin-left:110px">
  111. <span style="position:relative; left:10px"><i>Reddit</i></span><br>
  112. Show a button in the results to export the specified HIT for sharing on Reddit, formatted to
  113. <a style="color:black" href="${_hwtf}" target="_blank">r/HITsWorthTurkingFor</a> standards.
  114. </section>
  115. </div><div>
  116. <div style="float:left; margin-left:15px">
  117. <span style="position:relative; left:-8px"><b>Color Type</b></span>
  118. <p><label for="ctSim" style="float:left; width:51px">Simple</label>
  119. <input id="ctSim" type="radio" name="colorType" value="sim" ${this.user.colorType === 'sim' ? 'checked' : ''}/></p>
  120. <p><label for="ctAdj" style="float:left; width:51px">Adjusted</label>
  121. <input id="ctAdj" type="radio" name="colorType" value="adj" ${this.user.colorType === 'adj' ? 'checked' : ''}/></p>
  122. </div>
  123. <section style="margin-left:100px">
  124. <span style="position:relative; left:10px"><i>simple</i></span><br>HIT Scraper will use a simple weighted average to
  125. determine the overall TO rating and colorize results using that value. Use this setting to make coloring consistent between
  126. HIT Scraper and <a style="color:black" href="${_ccs}" target="_blank">Color Coded Search</a>.
  127. </section><section style="margin-left:100px">
  128. <span style="position:relative; left:10px;"><i>adjusted</i></span><br>HIT Scraper will calculate a Bayesian adjusted average
  129. based on confidence of the TO rating to colorize results. Confidence is proportional to the number of reviews.
  130. </section>
  131. </div><div>
  132. <div style="float:left; margin-left:15px">
  133. <span style="position:relative; left:-8px"><b>Sort Type</b></span>
  134. <p><label for="stSim" style="float:left; width:51px">Simple</label>
  135. <input id="stSim" type="radio" name="sortType" value="sim" ${this.user.sortType === 'sim' ? 'checked' : ''}/></p>
  136. <p><label for="stAdj" style="float:left; width:51px">Adjusted</label>
  137. <input id="stAdj" type="radio" name="sortType" value="adj" ${this.user.sortType === 'adj' ? 'checked' : ''}/></p>
  138. </div>
  139. <section style="margin-left:100px">
  140. <span style="position:relative; left:10px"><i>simple</i></span><br>
  141. HIT Scraper will sort results based simply on value regardless of the number of reviews.
  142. </section><section style="margin-left:100px">
  143. <span style="position:relative; left:10px;"><i>adjusted</i></span><br>HIT Scraper will use a Bayesian adjusted rating
  144. based on reliability (i.e. confidence) of the data. It factors in the number of reviews such that, for example,
  145. a requester with 100 reviews rated at 4.6 will rightfully be ranked higher than a requester with 3 reviews rated at 5.
  146. This gives a more accurate representation of the data.
  147. </section>
  148. </div><div>
  149. <div style="float:left; margin-left:15px">
  150. <span style="position:relative; left:-8px"><b>TO Weighting</b></span>
  151. <p><label for="comm" style="float:left; width:45px">comm</label>
  152. <input id="comm" type="number" min="1" max="5" step="0.5" value=${this.user.toWeights.comm} style="width:40px"/></p>
  153. <p><label for="pay" style="float:left; width:45px">pay</label>
  154. <input id="pay" type="number" min="1" max="5" step="0.5" value=${this.user.toWeights.pay} style="width:40px"/></p>
  155. <p><label for="fair" style="float:left; width:45px">fair</label>
  156. <input id="fair" type="number" min="1" max="5" step="0.5" value=${this.user.toWeights.fair} style="width:40px"/></p>
  157. <p><label for="fast" style="float:left; width:45px">fast</label>
  158. <input id="fast" type="number" min="1" max="5" step="0.5" value=${this.user.toWeights.fast} style="width:40px"/></p>
  159. </div>
  160. <section style="margin-left:110px; padding:10px">
  161. Specify weights for TO attributes to place greater importance on certain attributes over others.
  162. <p>The default values, [1, 3, 3, 1], ensure consistency between HIT Scraper and
  163. <a style="color:black" href="${_ccs}" target="_blank">Color Coded Search</a>;
  164. recommended values for adjusted coloring are [1, 6, 3.5, 1].</p>
  165. </section>
  166. </div>`,//}}}
  167. _appearance =//{{{
  168. `<div>
  169. <div style="float:left; margin-left:15px">
  170. <span style="position:relative;left:-8px"><b>Display Checkboxes</b></span>
  171. <p><label for="checkshow" style="float:left;width:51px">Show</label>
  172. <input id="checkshow" type="radio" name="checkbox" value="true" ${this.user.showCheckboxes ? 'checked' : ''} /></p>
  173. <p><label for="checkhide" style="float:left;width:51px">Hide</label>
  174. <input id="checkhide" type="radio" name="checkbox" value="false" ${this.user.showCheckboxes ? '' : 'checked'} /></p>
  175. </div>
  176. <section style="margin-left:133px">
  177. <span style="position:relative;left:10px"><i>show</i></span><br>
  178. Shows all checkboxes and radio inputs on the control panel for sake of clarity.
  179. </section><section style="margin-left:133px">
  180. <span style="position:relative;left:10px"><i>hide</i></span><br>
  181. Hides checkboxes and radio inputs for a cleaner, neater appearance. Their visibility is not required for proper
  182. operation; all options can still be toggled while hidden.
  183. </section>
  184. </div><div>
  185. <div style="float:left;margin-left:15px">
  186. <span style="position:relative;left:-8px"><b>Themes</b></span>
  187. <p><select>
  188. <option value="classic" ${this.user.themes.name === 'classic' ? 'selected' : ''}>Classic</option>
  189. <option value="deluge" ${this.user.themes.name === 'deluge' ? 'selected' : ''}>Deluge</option>
  190. <option value="solDark" ${this.user.themes.name === 'solDark' ? 'selected' : ''}>Solarium:Dark</option>
  191. <option value="solLight" ${this.user.themes.name === 'solLight' ? 'selected' : ''}>Solarium:Light</option>
  192. <option value="whisper" ${this.user.themes.name === 'whisper' ? 'selected' : ''}>Whisper</option>` +
  193. //<option value="random" ${this.user.themes.name === 'random' ? 'selected' : ''}>I'm Feelin' Lucky!</option>
  194. `</select> <button id="thedit" style="cursor:pointer">Edit Current Theme</button></p>
  195. </div>
  196. </div><div>
  197. <div style="float:left;margin-left:15px">
  198. <span style="position:relative;left:-8px"><b>HIT Coloring</b></span>
  199. <p><label for="link" style="float:left;width:51px">Link</label>
  200. <input id="link" type="radio" name="hitColor" value="link" ${this.user.hitColor === 'link' ? 'checked' : ''} /></p>
  201. <p><label for="cell" style="float:left;width:51px">Cell</label>
  202. <input id="cell" type="radio" name="hitColor" value="cell" ${this.user.hitColor === 'cell' ? 'checked' : ''} /></p>
  203. </div>
  204. <section style="margin-left:100px;padding-top:10px">
  205. <span style="position:relative;left:10px"><i>link</i></span><br>
  206. Apply coloring based on Turkopticon reviews to all applicable links in the results table.
  207. </section><section style="margin-left:100px">
  208. <span style="position:relative;left:10px"><i>cell</i></span><br>
  209. Apply coloring based on Turkopticon reviews to the background of all applicable cells in the results table.
  210. </section>
  211. <p style="clear:both"><b>Note:</b> The Classic theme is exempt from these settings and will always colorize cells.</p>
  212. </div>`,//}}}
  213. _blocks = //{{{
  214. `<div>
  215. <div style="float:left; margin-left:15px">
  216. <span style="position:relative; left:-8px"><b>Advanced Matching</b></span>
  217. <p><label for="wildblocks" style="float:left; width:95px">Allow Wildcards</label>
  218. <input id="wildblocks" type="checkbox" ${this.user.wildblocks ? 'checked' : ''}/></p>
  219. </div>
  220. <section style="margin-left:150px">
  221. Allows for the use of asterisks <code>(*)</code> as wildcards in the blocklist for simple glob matching. Any blocklist entry
  222. without an asterisk is treated the same as the default behavior--the entry must exactly match a HIT title or requester to
  223. trigger a block.
  224. <p><em>Wildcards have the potential to block more HITs than intended if using a pattern that's too generic.</em></p>
  225. <p>Matching is not case sensitive regardless of the wildcard setting. Entries without an opening asterisk are
  226. expected to match the beginning of a line, likewise, entries without a closing asterisk are expected to match
  227. the end of a line. Example usage below.</p>
  228. <table class="ble" style="left:-100px;position:relative;width:110%;">
  229. <tr>
  230. <th class="blec ble"></th>
  231. <th class="blec ble">Matches</th>
  232. <th class="blec ble" style="width:86px">Does not match</th>
  233. <th class="blec ble">Notes</th>
  234. </tr><tr>
  235. <td rowspan="2" class="blec ble"><code>foo*baz</code></td>
  236. <td class="blec ble">foo bar bat baz</td>
  237. <td class="blec ble">bar foo bat baz</td>
  238. <td rowspan="2" class="blec ble">no leading or closing asterisks; <code>foo</code> must be at the start of a line,
  239. and <code>baz</code> must be at the end of a line for a positive match</td>
  240. </tr><tr><td class="blec ble">foobarbatbaz</td><td class="blec ble">foo bar bat</td>
  241. </tr><tr>
  242. <td class="blec ble"><code>*foo</code></td>
  243. <td class="ble blec">bar baz foo</td>
  244. <td class="blec ble">foo baz</td>
  245. <td class="ble blec">matches and blocks any line ending in <code>foo</code></td>
  246. </tr><tr>
  247. <td class="blec ble"><code>foo*</code></td>
  248. <td class="ble blec">foo bat bar</td>
  249. <td class="ble blec">bat foo baz</td>
  250. <td class="ble blec">matches and blocks any line beginning with <code>foo</code></td>
  251. </tr><tr>
  252. <td class="ble blec" rowspan="4"><code>*bar*</code></td>
  253. <td class="ble blec">foo bar bat baz</td>
  254. <td class="ble blec" rowspan="4">foo bat baz</td>
  255. <td class="ble blec" rowspan="4">matches and blocks any line containing <code>bar</code></td>
  256. </tr><tr><td class="ble blec">bar bat baz</td>
  257. </tr><tr><td class="ble blec">foo bar</td>
  258. </tr><tr><td class="ble blec">foobatbarbaz</td>
  259. </tr><tr>
  260. <td class="ble blec"><code>** foo</code></td>
  261. <td class="ble blec">** foo</td>
  262. <td class="ble blec">** foo bar baz</td>
  263. <td class="ble blec">Multiple consecutive asterisks will be treated as a string rather than a wildcard. This makes it
  264. compatible with HITs using multiple asterisks in their titles, <i>e.g.</i>, <code>*** contains peanuts ***</code>.</td>
  265. </tr><tr>
  266. <td class="ble blec"><code>** *bar* ***</td>
  267. <td class="ble blec">** foo bar baz bat ***</td>
  268. <td class="ble blec">foo bar baz</td>
  269. <td class="ble blec">Consecutive asterisks used in conjunction with single asterisks.</td>
  270. </tr><tr>
  271. <td class="ble blec"><code>*</code></td>
  272. <td class="ble blec"><i>nothing</i></td>
  273. <td class="ble blec"><i>all</i></td>
  274. <td class="ble blec">A single asterisk would usually match anything and everything,
  275. but here, it matches nothing. This prevents accidentally blocking everything from the results table.</td>
  276. </tr>
  277. </table>
  278. </section>
  279. </div>`,//}}}
  280. _notify = //{{{
  281. `<div>
  282. <div style="float:left; margin-left:15px">
  283. <span style="position:relative; left:-8px"><b>Additional Notifications</b></span><br>
  284. <p><label for="notifyBlink" style="float:left; width:51px">Blink</label>
  285. <input id="notifyBlink" type="checkbox" name="notify" ${this.user.notifyBlink ? 'checked' : ''}/></p>
  286. <p><label for="notifyTaskbar" style="float:left; width:51px">Taskbar</label>
  287. <input id="notifyTaskbar" type="checkbox" name="notify" ${this.user.notifyTaskbar ? 'checked' : ''}/></p>
  288. </div>
  289. <section style="margin-left:160px">
  290. <span style="position:relative; left:10px"><i>blink</i></span></br>
  291. Blink the tab when there are new HITs.
  292. </section>
  293. <section style="margin-left:160px">
  294. <span style="position:relative; left:10px"><i>taskbar</i></span></br>
  295. Create an HTML5 browser notification when there are new HITs, which appears over the taskbar for 10 seconds.
  296. </section>
  297. <p style="clear:both"><b>Note:</b> These notification options will only apply when the page does not have active focus.</p>
  298. </div>`,//}}}
  299. _main = //{{{
  300. `<div style="top:0;left:0;margin:0;text-align:right;padding:0px;border:none;width:100%">
  301. <label id="settingsClose" class="close" title="Close">&#160;&#10008;&#160;</label>
  302. </div><div id="settingsSidebar">
  303. <span class="settingsSelected">General</span>
  304. <span>Appearance</span>
  305. <span>Blocklist</span>
  306. <span>Notifications</span>
  307. </div><div id="panelContainer" style="margin-left:10px;border:none;overflow:auto;width:auto;height:92%">
  308. <div id="General" class="settingsPanel">${_general}</div>
  309. <div id="Appearance" class="settingsPanel">${_appearance}</div>
  310. <div id="Blocklist" class="settingsPanel">${_blocks}</div>
  311. <div id="Notifications" class="settingsPanel">${_notify}</div>
  312. </div>`;//}}}
  313.  
  314. this.main = document.body.appendChild(document.createElement('DIV'));
  315. this.main.id = 'settingsMain';
  316. this.main.innerHTML = _main;
  317. return this;
  318. },//}}} Settings::draw
  319. init: function() {//{{{
  320. var get = (q,all) => this.main['querySelector' + (all ? 'All': '')](q),
  321. sidebarFn = function(e) {
  322. if (e.target.classList.contains('settingsSelected')) return;
  323. get('#'+get('.settingsSelected').textContent).style.display = 'none';
  324. get('.settingsSelected').classList.toggle('settingsSelected');
  325. e.target.classList.toggle('settingsSelected');
  326. get('#'+e.target.textContent).style.display = 'block';
  327. }.bind(this),
  328. optChangeFn = function(e) {//{{{
  329. var tag = e.target.tagName, type = e.target.type, id = e.target.id,
  330. isChecked = e.target.checked, name = e.target.name, value = e.target.value;
  331.  
  332. switch(tag) {
  333. case 'SELECT':
  334. get('#thedit').textContent = value === 'random' ? 'Re-roll!' : 'Edit Current Theme';
  335. this.user.themes.name = value;
  336. Themes.apply(value, this.user.hitColor);
  337. break;
  338. case 'INPUT':
  339. switch(type) {
  340. case 'radio':
  341. if (name === 'checkbox') {
  342. this.user.showCheckboxes = (value === 'true');
  343. Array.from(document.querySelectorAll('#controlpanel input[type=checkbox],#controlpanel input[type=radio]'))
  344. .forEach(v => v.classList.toggle('hidden'));
  345. }
  346. else this.user[name] = value;
  347. if (name === 'hitColor') Themes.apply(this.user.themes.name, value);
  348. break;
  349. case 'checkbox':
  350. this.user[id] = isChecked;
  351. if (name === 'export')
  352. Array.from(document.querySelectorAll(`button.${value}`))
  353. .forEach(v => v.style.display = isChecked ? '' : 'none');
  354. if (id === 'notifyTaskbar' && isChecked && Notification.permission === 'default')
  355. Notification.requestPermission();
  356. break;
  357. case 'number':
  358. this.user.toWeights[id] = value; break;
  359. } break;
  360. }
  361. Settings.save();
  362. }.bind(this);//}}}
  363.  
  364. get('#settingsClose').onclick = this.die.bind(this);
  365. get('#General').style.display = 'block';
  366. Array.from(get('#settingsSidebar span', true)).forEach(v => v.onclick = sidebarFn);
  367. Array.from(get('input,select',true)).forEach(v => v.onchange = optChangeFn);
  368. get('#thedit').onclick = () => { this.die.call(this); new Editor('theme'); };
  369. },//}}} Settings::init
  370. die: function() { Interface.toggleOverflow('off'); this.main.remove(); }
  371. },//}}} Settings
  372.  
  373. Themes = {//{{{
  374. default: defaults.themes,
  375. generateCSS: function(theme, mode) {//{{{
  376. var ref = theme === 'random' ? this.randomize() : Settings.user.themes.colors[theme],
  377. _ms = mode === 'cell' || theme === 'classic',
  378. cellFix = {
  379. row: k => `.${k} ` + (_ms ? '{background:' : 'a {color:') + ref[k] + '}',
  380. text: k => `.${k} {color:` + (_ms ? this.tune(ref.bodytable,ref[k]) : ref.bodytable) + '}',
  381. export: k => `.${k} button {color:` + (_ms ? this.tune(ref.export,ref[k]) : ref.export) + '}',
  382. vlink: k => `.${k} a:not(.static):visited {color:` + (_ms ? this.tune(ref.vlink,ref[k]) : ref.vlink) + '}'
  383. },
  384. css = `body {color:${ref.defaultText}; background-color:${ref.background}}
  385. /*#status {color:${ref.secondText}}*/
  386. #sortdirs {color:${ref.inputText}}
  387. #curtain {background:${ref.background}; opacity:0.5}
  388. .controlpanel i:after {color:${ref.accent}}
  389. #controlpanel {background:${ref.cpBackground}}
  390. #controlpanel input${theme === 'classic' ? '' : ', #controlpanel select'}
  391. {color:${ref.inputText}; border:1px solid; background:${theme === 'classic' ? '#fff' : ref.cpBackground}}
  392. #controlpanel label {color:${ref.defaultText}; background:${ref.cpBackground}}
  393. #controlpanel label:hover {background:${ref.hover}}
  394. #controlpanel label.checked {color:${ref.secondText}; background:${ref.highlight}}
  395. /*#resultsTable tbody a:not(.static):visited {color:${ref.vlink}}*/
  396. /*#resultsTable button {color:${ref.export}}*/
  397. thead, caption, a {color:${ref.defaultText}}
  398. tbody a {color:${ref.link}}
  399. .nohitDB {color:#000; background:${ref.nohitDB}}
  400. .hitDB {color:#000; background:${ref.hitDB}}
  401. .reqmaster {color:#000; background:${ref.reqmaster}}
  402. .nomaster {color:#000; background:${ref.nomaster}}
  403. .tooweak {background:${ref.unqualified}}
  404. ${cellFix.row('toNone')} ${cellFix.text('toNone')} ${cellFix.export('toNone')} ${cellFix.vlink('toNone')}
  405. ${cellFix.row('toHigh')} ${cellFix.text('toHigh')} ${cellFix.export('toHigh')} ${cellFix.vlink('toHigh')}
  406. ${cellFix.row('toGood')} ${cellFix.text('toGood')} ${cellFix.export('toGood')} ${cellFix.vlink('toGood')}
  407. ${cellFix.row('toAverage')} ${cellFix.text('toAverage')} ${cellFix.export('toAverage')} ${cellFix.vlink('toAverage')}
  408. ${cellFix.row('toLow')} ${cellFix.text('toLow')} ${cellFix.export('toLow')} ${cellFix.vlink('toLow')}
  409. ${cellFix.row('toPoor')} ${cellFix.text('toPoor')} ${cellFix.export('toPoor')} ${cellFix.vlink('toPoor')}`;
  410. if (theme !== 'classic') css += `\n.controlpanel button {color:${ref.accent}; background:transparent;}`;
  411. return css;
  412. },//}}} Themes::generateCSS
  413. tune: function(fg,bg) {//{{{
  414. var cbg = this.getBrightness(bg),
  415. lighten = c => { c.s = Math.max(0, c.s-5); c.v = Math.min(100, c.v+5); return c; },
  416. darken = c => { c.s = Math.min(100, c.s+5); c.v = Math.max(0, c.v-5); return c; },
  417. tune = (function() { if (cbg >= 128) return darken; else return lighten; })(),
  418. hex2hsv = function(c) {//{{{
  419. var r = parseInt(c.slice(1,3),16), g = parseInt(c.slice(3,5),16), b = parseInt(c.slice(5,7),16),
  420. min = Math.min(r,g,b), max = Math.max(r,g,b), delta = max-min, _hue;
  421. switch(max) {
  422. case r: _hue = Math.round(60 * (g - b)/delta); break;
  423. case g: _hue = Math.round(120 + 60 * (b - r)/delta); break;
  424. case b: _hue = Math.round(240 + 60 * (r - g)/delta); break;
  425. }
  426. return { h:_hue < 0 ? _hue + 360 : _hue, s:max === 0 ? 0 : Math.round(100 * delta/max), v:Math.round(max * 100/255) };
  427. }, //}}}
  428. hsv2hex = function(c) {//{{{
  429. var r, g, b, pad = s => ('00'+s.toString(16)).slice(-2);
  430. if (c.s === 0) r = g = b = Math.round(c.v * 2.55).toString(16);
  431. else {
  432. c = { h: c.h/60, s: c.s/100, v: c.v/100 }; // convert to prime to calc chroma
  433. var _t1 = Math.round((c.v * (1 - c.s)) * 255),
  434. _t2 = Math.round((c.v * (1 - c.s * (c.h - Math.floor(c.h)))) * 255),
  435. _t3 = Math.round((c.v * (1 - c.s * (1 - (c.h - Math.floor(c.h))))) * 255);
  436. switch (Math.floor(c.h)) {
  437. case 1: r = _t2; g = Math.round(c.v * 255); b = _t1; break;
  438. case 2: r = _t1; g = Math.round(c.v * 255); b = _t3; break;
  439. case 3: r = _t1; g = _t2; b = Math.round(c.v * 255); break;
  440. case 4: r = _t3; g = _t1; b = Math.round(c.v * 255); break;
  441. case 0: r = Math.round(c.v * 255); g = _t3; b = _t1; break;
  442. default: r = Math.round(c.v * 255); g = _t1; b = _t2; break;
  443. }
  444. } return '#' + pad(r) + pad(g) + pad(b);
  445. };//}}}
  446. while (Math.abs(this.getBrightness(fg)-cbg) < 90) fg = hsv2hex(tune(hex2hsv(fg)));
  447. return fg;
  448. },//}}}
  449. getBrightness: function(hex) {//{{{
  450. // TODO: put in Colors object
  451. var r = parseInt(hex.slice(1,3),16), g = parseInt(hex.slice(3,5),16), b = parseInt(hex.slice(5,7),16);
  452. return ((r*299) + (g*587) + (b*114))/1000;
  453. },//}}} Themes::getBrightness
  454. apply: function(theme, mode) {//{{{
  455. var cssNew = URL.createObjectURL(new Blob([this.generateCSS(theme, mode)], {type:'text/css'})),
  456. rel = document.head.querySelector('link[rel=stylesheet]'), cssOld = rel.href;
  457. rel.href = cssNew;
  458. URL.revokeObjectURL(cssOld);
  459. },//}}} Themes::apply
  460. },//}}} Themes
  461.  
  462. Interface = {//{{{
  463. user: Settings.user, time: Date.now(), focused: true, blackhole: {},
  464. isLoggedout: document.querySelector('#lnkWorkerSignin') ? true : false,
  465. resetTitle: function() {//{{{
  466. if (this.blackhole.blink) clearInterval(this.blackhole.blink);
  467. document.title = DOC_TITLE;
  468. },//}}}
  469. toggleOverflow: function(state) {//{{{
  470. document.body.querySelector('#curtain').style.display = state === 'on' ? 'block' : 'none';
  471. document.body.style.overflow = state === 'on' ? 'hidden' : 'auto';
  472. },//}}} Interface::curtains
  473. draw: function() {//{{{
  474. var user = this.user, _cb = user.showCheckboxes ? '' : 'hidden',
  475. _u0 = new Uint8Array(Array.prototype.map.call(window.atob(audio0), v => v.charCodeAt(0))),
  476. _u1 = new Uint8Array(Array.prototype.map.call(window.atob(audio1), v => v.charCodeAt(0))),
  477. _audio0 = URL.createObjectURL(new Blob([_u0], {type:'audio/ogg'})),
  478. _audio1 = URL.createObjectURL(new Blob([_u1], {type:'audio/mp3'})),
  479. titles = {//{{{
  480. refresh: "Enter search refresh delay in seconds.\nEnter 0 for no auto-refresh.\nDefault is 0 (no auto-refresh).",
  481. pages: "Enter number of pages to scrape. Default is 3.\nHas no effect in a batch search (Most Available sort).",
  482. skips: "Searches additional pages to get a more consistent number of results. Helpful if you're blocking a lot of items.",
  483. resultsPerPage: "Number of results to return per page (maximum is 100, default is 10)",
  484. batch: "Enter minimum HITs for batch search (must be searching by Most Available).",
  485. pay: "Enter the minimum desired pay per HIT (e.g. 0.10).",
  486. qual: "Only show HITs you're currently qualified for (must be logged in).",
  487. monly: "Only show HITs that require Masters qualifications.",
  488. mhide: "Remove masters hits from the results if selected, otherwise display both masters and non-masters HITS.\n" +
  489. "The 'qualified' setting superceedes this option.",
  490. searchBy: "Get search results by...\n Latest = HIT Creation Date (newest first),\n " +
  491. "Most Available = HITs Available (most first),\n Reward = Reward Amount (most first),\n Title = Title (A-Z)",
  492. invert: "Reverse the order of the Search By choice, so...\n Latest = HIT Creation Date (oldest first),\n " +
  493. "Most Available = HITs Available (least first),\n Reward = Reward Amount (least first),\n Title = Title (Z-A)",
  494. shine: "Enter time (in seconds) to keep new HITs highlighted.\nDefault is 300 (5 minutes).",
  495. sound: "Play a sound when new results are found.",
  496. soundSelect: "Select which sound will be played.",
  497. minTOPay: "After getting search results, hide any results below this average Turkopticon pay rating.\n" +
  498. "Minimum is 1, maximum is 5, decimals up to 2 places, such as 3.25",
  499. hideNoTO: "After getting search results, hide any results that have no, or too few, Turkopticon pay ratings.",
  500. disableTO: "Disable attempts to download ratings data from Turkopticon for the results table.",
  501. sortPay: "After getting search results, re-sort the results based on their average Turkopticon pay ratings.",
  502. sortAll: "After getting search results, re-sort the results by their overall Turkopticon rating.",
  503. sortAsc: "Sort results in ascending (low to high) order.",
  504. sortDsc: "Sort results in descending (high to low) order.",
  505. search: "Enter keywords to search for; default is blank (no search terms).",
  506. hideBlock: "When enabled, hide HITs that match your blocklist.\n"+
  507. "When disabled, HITs that match your blocklist will be displayed with a red border.",
  508. onlyIncludes: "Show only HITs that match your includelist.\nBe sure to edit your includelist first or no results will be displayed.",
  509. shineInc: "Outline HITs that match your includelist with a dashed green border.",
  510. mainlink: "Read the documentation for HIT Scraper With Export on its Greasyfork page.",
  511. gbatch: "Apply the 'Minimum batch size' filter to all search options.",
  512. },//}}}
  513. css = [//{{{
  514. 'body {font-family:Verdana, Arial; font-size:14px}',
  515. 'p {margin:8px auto}',
  516. '.cpdefault {width:900px; height:155px; visibility:visible; overflow:hidden; padding:8px 5px 1px 5px; transition:all 0.3s;}',
  517. '#controlpanel i:after, #status i:after {content:" | "}',
  518. 'input[type="checkbox"], input[type="radio"] {vertical-align:middle}',
  519. 'input[type="number"] {width:50px; text-align:center}',
  520. 'label {padding:2px}',
  521. '.hiddenpanel {width:0px; height:0px; visibility:hidden}',
  522. '.hidden {display:none}',
  523. 'button {border:1px solid}',
  524. 'textarea {font-family:inherit; font-size:11px; margin:auto; padding:2px}',
  525. '.pop {position:fixed; top:15%; left:50%; margin:auto; transform:translateX(-50%); padding:5px;' + // for editors/exporters
  526. 'background:black; color:white; z-index:20; font-size:12px; box-shadow:0px 0px 6px 1px #fff}',
  527. 'dt {text-transform:uppercase; clear:both; margin:3px}',
  528. '.icbutt {float:left;border:1px solid #fff;cursor:pointer} .icbutt > input {opacity:0;display:block;width:25px;height:25px;border:none}',
  529. // settings
  530. '#settingsMain {z-index:20; position:fixed; background:#fff; color:#000; box-shadow:-3px 3px 2px 2px #7B8C89; line-height:initial;' +
  531. 'top:50%; left:50%; width:85%; height:85%; margin-right:-50%; transform:translate(-50%, -50%)}',
  532. '#settingsMain > div {margin:5px; padding:3px; position:relative; border:1px solid grey; line-height:initial}',
  533. '.close {position:relative; font-weight:bold; font-size:1em; color:white; background:black; cursor:pointer}',
  534. '#settingsSidebar {width:100px; min-width:90px; height:92%; float:left}',
  535. '#settingsSidebar > span {display:block; margin-bottom:5px; width:100px; font-size:1em; cursor:pointer}',
  536. '.settingsPanel {position:absolute; top:0;left:0; display:none; width:100%; height:100%; font-size:11px}',
  537. '.settingsPanel > div {margin:15px 5px; position:relative; background:#CCFFFA; overflow:auto; padding:6px 10px}',
  538. '.settingsSelected {background:aquamarine}',
  539. '.ble {border:1px solid black; border-collapse:collapse;} .blec {padding:5px; text-align:left;}',
  540.  
  541. '.toLink {position:relative;}',
  542. '.toLink:before {content:""; display:none; z-index:5; position:absolute; top:0; left:-6px; width:0; height:0;' +
  543. 'border-top:6px solid transparent; border-bottom:6px solid transparent; border-left:6px solid black}',
  544. '.toLink:hover:before {display:block;}',
  545. '.tooltip {position:absolute;top:0;right:calc(100% + 6px);text-align:left;transform:translateY(-20%);padding:5px;font-weight:normal;' +
  546. 'font-size:11px; line-height:1; display:none; background:black; color:white; box-shadow:0px 0px 6px 1px #fff}',
  547. 'meter {width:100%; position:relative; height:15px;}',
  548. 'meter:before {font-size:10px; font-weight:bold; color:black; content:attr(data-attr); position:absolute; top:1px}',
  549. 'meter:after {font-size:10px; font-weight:bold; color:black; content:attr(value); position:absolute; top:1px; right:0}',
  550. '#resultsTable button {height:14px; font-size:8px; border:1px solid; padding:0; background:transparent}',
  551. '#resultsTable tbody td > div {display:table-cell}',
  552. '#resultsTable tbody td > div:first-child {padding-right:2px; vertical-align:middle; white-space:nowrap}',
  553. 'button.disabled {position:relative}',
  554. 'button.disabled:before {content:""; display:none; z-index:5; position:absolute; top:-7px; left:50%; width:0; height:0;' +
  555. 'border-left:6px solid transparent; border-right:6px solid transparent; border-top:6px solid black; transform:translateX(-50%)}',
  556. 'button.disabled:after {content:"Exports are disabled while logged out."; display:none; z-index:5; position:absolute;' +
  557. 'top:-7px; left:50%; color:white; background:black; width:230px; padding:2px; transform:translate(-50%,-100%);' +
  558. 'box-shadow:0px 0px 6px 1px #fff}',
  559. 'button.disabled:focus:before {display:block} button.disabled:focus:after {display:block}',
  560. '.spinner {display: inline-block; animation: kfspin 0.7s infinite linear; font-weight:bold;}',
  561. '@keyframes kfspin { 0% { transform: rotate(0deg) } 100% { transform: rotate(359deg) } }',
  562. '.spinner:before{content:"*"}',
  563. '.exhwtf {width:70px; background:black; color:white; vertical-align:top; border-radius:5px}',
  564. '.shine td {border:1px dotted #fff; font-weight:bold}',
  565. '.ignored td {border:2px solid #00E5FF}',
  566. '.includelisted td {border:3px dashed #008800}',
  567. '.blocklisted td {border:3px solid #cc0000}',
  568. ],//}}}
  569. //{{{ body
  570. body = `
  571. <audio src=${_audio0} id="ding" volume="1"></audio><audio src=${_audio1} id="squee" volume="1"></audio>
  572. <div id="curtain" style="position:fixed;width:100%;height:100%;display:none;z-index:10"></div>
  573. <div id="controlpanel" class="controlpanel cpdefault">
  574. <p>
  575. Auto-refresh delay: <input id="refresh" type="number" title="${titles.refresh}" min="0" value=${user.refresh} /><i></i>
  576. Pages to scrape: <input id="pages" type="number" title="${titles.pages}" min="1" max="100" value=${user.pages} /><i></i>
  577. <label class="${user.skips ? 'checked' : ''}" title="${titles.skips}" for="skips">Correct for skips</label>
  578. <input id="skips" class="${_cb}" type="checkbox" title="${titles.skips}" ${user.skips ? 'checked' : ''} /><i></i>
  579. Results per page: <input id="resultsPerPage" type="number" title="${titles.resultsPerPage}"
  580. min="1" max="100" value=${user.resultsPerPage || 10} />
  581. </p></p>
  582. Minimum reward: <input id="pay" type="number" title="${titles.pay}" min="0" step="0.05" value=${user.pay} /><i></i>
  583. <label class="${user.qual ? 'checked' : ''}" title="${titles.qual}" for="qual">Qualified</label>
  584. <input id="qual" class="${_cb}" type="checkbox" title="${titles.qual}" ${user.qual ? 'checked' : ''} /><i></i>
  585. <label class="${user.monly ? 'checked' : ''}" title="${titles.monly}" for="monly">Masters Only</label>
  586. <input id="monly" class="${_cb}" type="checkbox" title="${titles.monly}" ${user.monly ? 'checked' : ''} /><i></i>
  587. <label class="${user.mhide ? 'checked' : ''}" title="${titles.mhide}" for="mhide">Hide Masters</label>
  588. <input id="mhide" class="${_cb}" type="checkbox" title="${titles.mhide}" ${user.mhide ? 'checked' : ''} /><i></i>
  589. Minimum batch size: <input id="batch" type="number" title="${titles.batch}" min="1" value=${user.batch} /> -
  590. <label class="${user.gbatch ? 'checked' : ''}" title="${titles.gbatch}" for="gbatch">Global</label>
  591. <input id="gbatch" class="${_cb}" type="checkbox" title="${titles.gbatch}" ${user.gbatch ? 'checked' : ''} />
  592. </p><p>
  593. New HIT highlighting: <input id="shine" type="number" title="${titles.shine}" min="0" max="3600" value=${user.shine} /><i></i>
  594. <label class="${user.notifySound[0] ? 'checked' : ''}" title="${titles.sound}" for="sound">Sound on new HIT</label>
  595. <input id="sound" class="${_cb}" type="checkbox" title="${titles.sound}" ${user.notifySound[0] ? 'checked' : ''} />
  596. <select id="soundSelect" title="${titles.soundSelect}" style="display:${user.notifySound[0] ? 'inline' : 'none'}">
  597. <option value="ding" ${user.notifySound[1] === 'ding' ? 'selected' : ''}>Ding</option>
  598. <option value="squee" ${user.notifySound[1] === 'squee' ? 'selected' : ''}>Squee</option>
  599. </select><i></i>
  600. <label class="${user.disableTO ? 'checked' : ''}" title="${titles.disableTO}" for="disableTO">Disable TO</label>
  601. <input id="disableTO" class="${_cb}" type="checkbox" title="${titles.disableTO}" ${user.disableTO ? 'checked' : ''} /><i></i>
  602. Search by: <select id="searchBy" title="${titles.searchBy}">
  603. <option value="late" ${user.searchBy === 0 ? 'selected' : ''}>Latest</option>
  604. <option value="most" ${user.searchBy === 1 ? 'selected' : ''}>Most Available</option>
  605. <option value="amount" ${user.searchBy === 2 ? 'selected' : ''}>Reward</option>
  606. <option value="alpha" ${user.searchBy === 3 ? 'selected' : ''}>Title</option>
  607. </select> -
  608. <label class="${user.invert ? 'checked' : ''}" title="${titles.invert}" for="invert">Invert</label>
  609. <input id="invert" class="${_cb}" type="checkbox" title="${titles.invert}" ${user.invert ? 'checked' : ''} />
  610. </p><p>
  611. Min pay TO: <input id="minTOPay" type="number" title="${titles.minTOPay}" min="1" max="5" step="0.25" value=${user.minTOPay} /><i></i>
  612. <label class="${user.hideNoTO ? 'checked' : ''}" title="${titles.hideNoTO}" for="hideNoTO">Hide no TO</label>
  613. <input id="hideNoTO" class="${_cb}" type="checkbox" title="${titles.hideNoTO}" ${user.hideNoTO ? 'checked' : ''} /><i></i>
  614. <label class="${user.sortPay ? 'checked' : ''}" title="${titles.sortPay}" for="sortPay">Sort by TO pay</label>
  615. <input id="sortPay" class="${_cb}" type="checkbox" title="${titles.sortPay}" name="sort" ${user.sortPay ? 'checked' : ''} /><i></i>
  616. <label class="${user.sortAll ? 'checked' : ''}" title="${titles.sortAll}" for="sortAll">Sort by overall TO</label>
  617. <input id="sortAll" class="${_cb}" type="checkbox" title="${titles.sortAll}" name="sort" ${user.sortAll ? 'checked' : ''} />
  618. <div id="sortdirs" style="font-size:15px;display:${user.sortPay || user.sortAll ? 'inline' : 'none'}">
  619. <label class="${user.sortAsc ? 'checked' : ''}" for="sortAsc" title="${titles.sortAsc}">&nbsp;&#9650;&nbsp;</label>
  620. <input id="sortAsc" class="${_cb}" type="radio" title="${titles.sortAsc}" name="sortDir" ${user.sortAsc ? 'checked' : ''} />
  621. <label class="${user.sortDsc ? 'checked' : ''}" for="sortDsc" title="${titles.sortDsc}">&nbsp;&#9660;&nbsp;</label>
  622. <input id="sortDsc" class="${_cb}" type="radio" title="${titles.sortDsc}" name="sortDir" ${user.sortDsc ? 'checked' : ''} />
  623. </div>
  624. </p><p>
  625. Search Terms: <input id="search" title="${titles.search}" placeholder="Enter search terms here" value="${user.search}" /><i></i>
  626. <label class="${user.hideBlock ? 'checked' : ''}" title="${titles.hideBlock}" for="hideBlock">Hide blocklisted</label>
  627. <input id="hideBlock" class="${_cb}" type="checkbox" title="${titles.hideBlock}" ${user.hideBlock ? 'checked' : ''} /><i></i>
  628. <label class="${user.onlyIncludes ? 'checked' : ''}" title="${titles.onlyIncludes}" for="onlyIncludes">Restrict to includelist</label>
  629. <input id="onlyIncludes" class="${_cb}" type="checkbox" title="${titles.onlyIncludes}" ${user.onlyIncludes ? 'checked' : ''} /><i></i>
  630. <label class="${user.shineInc ? 'checked' : ''}" title="${titles.shineInc}" for="shineInc">Highlight Includelisted</label>
  631. <input id="shineInc" class="${_cb}" type="checkbox" title="${titles.shineInc}" ${user.shineInc ? 'checked' : ''} />
  632. </p>
  633. </div><div id="controlbuttons" class="controlpanel" style="margin-top:5px">
  634. <button id="btnMain">Start</button> <button id="btnHide">Hide Panel</button> <button id="btnBlocks">Edit Blocklist</button>
  635. <button id="btnIncs">Edit Includelist</button> <button id="btnIgnores">Toggle Ignored HITs</button> &nbsp;
  636. <button id="btnSettings">Settings</button>
  637. </div><div id="status"><p>Stopped</p></div><div id="results">
  638. <table id="resultsTable" style="width:100%">
  639. <caption style="font-weight:800;line-height:1.25em;font-size:1.5em;">
  640. <a class="mainlink" target="_blank" href="${URL_SELF}" title="${titles.mainlink}">HIT Scraper</a> Results
  641. </caption>
  642. <thead><tr style="font-weight:800;font-size:0.87em;text-align:center">
  643. <td>Requester</td><td>Title</td><td>Reward</td><td style="width:35px"># Avail</td><td style="width:30px">TO Pay</td>
  644. <td style="width:45px">Accept HIT</td><td style="width:15px">M</td>
  645. <td style="width:15px"></td><td style="width:15px"></td>
  646. </tr></thead>
  647. <tbody style="font-size:11px"></tbody>
  648. </table>
  649. </div>`,//}}}
  650. head = `<title>${DOC_TITLE}</title><style type="text/css">${css.join('')}</style>` +
  651. `<link rel="icon" type="image/png" href="${ico}" /><link rel="stylesheet" type="text/css" />`;
  652.  
  653. document.head.innerHTML = head;
  654. document.body.innerHTML = body;
  655. this.elkeys = Object.keys(titles);
  656. return this;
  657. },//}}} Interface::draw
  658. init: function() {//{{{
  659. this.panel = {}; this.buttons = {};
  660. var get = (q,all) => document['querySelector' + (all ? 'All': '')](q),
  661. sortdirs = get('#sortdirs'),
  662. moveSortdirs = function(node) {
  663. if (!node.checked) { sortdirs.style.display = 'none'; return; }
  664. sortdirs.style.display = 'inline';
  665. sortdirs.remove();
  666. node.parentNode.insertBefore(sortdirs, node.nextSibling);
  667. },
  668. kdFn = e => { if (e.keyCode === 13) setTimeout(() => this.buttons.main.click(), 30); },
  669. optChangeFn = function(e) {//{{{
  670. var tag = e.target.tagName, type = e.target.type, id = e.target.id,
  671. isChecked = e.target.checked, name = e.target.name, value = e.target.value;
  672.  
  673. switch(tag) {
  674. case 'SELECT':
  675. if (id === 'soundSelect')
  676. this.user.notifySound[1] = e.target.value;
  677. else
  678. this.user[id] = e.target.selectedIndex;
  679. break;
  680. case 'INPUT':
  681. switch(type) {
  682. case 'number':
  683. case 'text':
  684. this.user[id] = value; break;
  685. case 'radio':
  686. Array.from(get(`input[name=${name}]`,true))
  687. .forEach(v => { this.user[v.id] = v.checked; get(`label[for=${v.id}]`).classList.toggle('checked'); });
  688. break;
  689. case 'checkbox':
  690. if (name === 'sort') {
  691. Array.from(get(`input[name=${name}]`,true)).forEach(v => {
  692. if (e.target !== v) v.checked = false;
  693. get(`label[for=${v.id}]`).className = v.checked ? 'checked' : '';
  694. this.user[v.id] = v.checked;
  695. });
  696. moveSortdirs(e.target);
  697. break;
  698. } else if (id === 'sound') {
  699. this.user.notifySound[0] = isChecked;
  700. e.target.nextElementSibling.style.display = isChecked ? 'inline' : 'none';
  701. }
  702. this.user[id] = isChecked;
  703. get(`label[for=${id}]`).classList.toggle('checked');
  704. break;
  705. } break;
  706. }
  707. Settings.save();
  708. }.bind(this);//}}}
  709.  
  710. Themes.apply(this.user.themes.name);
  711. // get references to control panel elements and set up click events
  712. this.Status = {
  713. node: get('#status').firstChild,
  714. push: function(t) { this.node.innerHTML = t; },
  715. append: function(t) { this.node.innerHTML += t; },
  716. cd: function() { this.node.innerHTML = this.node.innerHTML.replace(/\d+(?= seconds)/, m => +m-1); }
  717. };
  718. for (var k of this.elkeys) {
  719. if (k === 'mainlink') continue;
  720. this.panel[k] = document.getElementById(k);
  721. this.panel[k].onchange = optChangeFn;
  722. if (k === 'pay' || k === 'search') this.panel[k].onkeydown = kdFn;
  723. if ((k === 'sortPay' || k === 'sortAll') && this.panel[k].checked) moveSortdirs(this.panel[k]);
  724. }
  725. // get references to buttons
  726. Array.from(get('button',true)).forEach(v => this.buttons[v.id.slice(3).toLowerCase()] = v);
  727. // set up button click events
  728. this.buttons.main.onclick = function(e) {
  729. e.target.textContent = e.target.textContent === 'Start' ? 'Stop' : 'Start';
  730. Core.run();
  731. };
  732. this.buttons.hide.onclick = function(e) {
  733. get('#controlpanel').classList.toggle('hiddenpanel');
  734. e.target.textContent = e.target.textContent === 'Hide Panel' ? 'Show Panel' : 'Hide Panel';
  735. };
  736. this.buttons.blocks.onclick = () => { this.toggleOverflow('on'); new Editor('ignore'); };
  737. this.buttons.incs.onclick = () => { this.toggleOverflow('on'); new Editor('include'); };
  738. this.buttons.ignores.onclick = () => Array.from(get('.ignored:not(.blocklisted)',true)).forEach(v => v.classList.toggle('hidden'));
  739. this.buttons.settings.onclick = () => { this.toggleOverflow('on'); Settings.draw().init(); };
  740. get('#hideBlock').addEventListener('change', () => Array.from(get('.blocklisted',true)).forEach(v => v.classList.toggle('hidden')));
  741. window.onblur = document.body.onblur = () => this.focused = false;
  742. window.onfocus = document.body.onfocus = () => { this.focused = true; this.resetTitle(); };
  743. }//}}} Interface::init
  744. },//}}} Interface
  745. Editor = function(type) {//{{{
  746. Interface.toggleOverflow('on');
  747. this.node = document.body.appendChild(document.createElement('DIV'));
  748. this.node.classList.add('pop');
  749. this.die = () => {Interface.toggleOverflow('off'); this.node.remove();};
  750. this.type = type;
  751. this.caller = arguments[1] || null;
  752.  
  753. switch(type) {
  754. case 'include':
  755. case 'ignore':
  756. if (type === 'ignore' && !localStorage.getItem('scraper_ignore_list')) // set default blocklist
  757. localStorage.setItem('scraper_ignore_list',
  758. 'oscar smith^diamond tip research llc^jonathan weber^jerry torres^' +
  759. 'crowdsource^we-pay-you-fast^turk experiment^jon brelig^p9r');
  760. var titleText = type === 'ignore' ?
  761. '<b>BLOCKLIST</b> - Edit the blocklist with what you want to ignore/hide. Separate requester names and HIT titles with the ' +
  762. '<code>^</code> character. After clicking "Save", you\'ll need to scrape again to apply the changes.'
  763. : '<b>INCLUDELIST</b> - Focus the results on your favorite requesters. Separate requester names and HIT titles with the ' +
  764. '<code>^</code> character. When the "Restrict to includelist" option is selected, ' +
  765. 'HIT Scraper only shows results matching the includelist.';
  766. this.node.innerHTML = '<div style="width:500px">' + titleText + '</div>' +
  767. '<textarea style="display:block;height:200px;width:500px;font:12px monospace" placeholder="nothing here yet">' +
  768. (localStorage.getItem(`scraper_${type}_list`) || '') + '</textarea>' +
  769. '<button id="edSave" style="margin:5px auto;width:50%;color:white;background:black">Save</button>'+
  770. '<button id="edCancel" style="margin:5px auto;width:50%;color:white;background:black">Cancel</button>';
  771. this.node.querySelector('#edSave').onclick = () => {
  772. localStorage.setItem(`scraper_${type}_list`, this.node.querySelector('textarea').value.trim()); this.die();
  773. }; break;
  774. case 'theme':
  775. var dlbody = [], _th = Settings.user.themes, split = obj => {
  776. var a = []; for (var k in obj) if (obj.hasOwnProperty(k)) a.push({k:k, v:obj[k]});
  777. return a.sort((a,b) => a.k < b.k ? -1 : 1);
  778. }, _colors = split(_th.colors[_th.name]),
  779. define = k => '<div style="margin-left:37px">' + _dd[k] + '</div>',
  780. _dd = {//{{{
  781. highlight:'Distinguishes between active and inactive states in the control panel',
  782. background:'Background color',
  783. accent:'Color of spacer text (and control panel buttons on themes other than \'classic\')',
  784. bodytable:'Default color of text elements in the results table (this is ignored if HIT coloring is set to \'cell\')',
  785. cpBackground:'Background color of the control panel',
  786. toHigh:'Color for results with high TO',
  787. toGood:'Color for results with good TO',
  788. toAverage:'Color for results with average TO',
  789. toLow:'Color for results with low TO',
  790. toPoor:'Color for results with poor TO',
  791. toNone:'Color for results with no TO',
  792. hitDB:'Designates that a match was found in your HITdb',
  793. nohitDB:'Designates that a match was not found in your HITdb',
  794. unqualified:'Designates that you do not have the qualifications necessary to work on the HIT',
  795. reqmaster:'Designates HITs that require Masters',
  796. nomaster:'Designates HITs that do not require Masters',
  797. defaultText:'Default text color',
  798. inputText:'Color of input boxes in the control panel',
  799. secondText:'Color for text used on selected control panel items',
  800. link:'Default color of unvisited links',
  801. vlink:'Default color of visited links',
  802. export:'Color of buttons in the results table--export and block buttons',
  803. hover:'Color of control panel options on mouseover',
  804. };//}}}
  805. for (var r of _colors)
  806. dlbody.push(`<dt>${r.k}</dt><dd><div class="icbutt"><input data-key="${r.k}" type="color" value="${r.v}" /></div>${define(r.k)}</dd>`);
  807. this.node.innerHTML = '<b>THEME EDITOR</b><p></p><div style="height:87%;overflow:auto"><dl>' + dlbody.join('') + '</dl></div>' +
  808. '<button id="edSave" style="margin:5px auto;width:33%;color:white;background:black">Save</button>' +
  809. '<button id="edDefault" style="margin:5px auto;width:33%;color:white;background:black">Restore Default</button>' +
  810. '<button id="edCancel" style="margin:5px auto;width:33%;color:white;background:black">Cancel</button>';
  811. this.node.style.height = '57%';
  812. Array.from(this.node.querySelectorAll('.icbutt')).forEach(v => {
  813. v.style.background = v.firstChild.value;
  814. v.firstChild.onchange = e => {
  815. var k = e.target.dataset.key;
  816. v.style.background = e.target.value;
  817. _th.colors[_th.name][k] = e.target.value;
  818. Themes.apply(_th.name, Settings.user.hitColor);
  819. };
  820. });
  821. this.node.querySelector('#edDefault').onclick = () => {
  822. _th.colors[_th.name] = Themes.default[_th.name];
  823. Themes.apply(_th.name, Settings.user.hitColor);
  824. this.die(); new Editor('theme');
  825. };
  826. this.node.querySelector('#edSave').onclick = () => { Settings.save(); this.die(); };
  827. break;
  828. case 'vbTemplate':
  829. this.node.innerHTML = '<b>VBULLETIN TEMPLATE</b><div style="float:right;margin-bottom:5px">Ratings Symbol: ' +
  830. `<input style="text-align:center" type="text" size="1" maxlength="1" value="${Settings.user.vbSym}" /></div>` +
  831. '<textarea style="display:block;height:200px;width:500px;font:12px monospace">' +
  832. Settings.user.vbTemplate + '</textarea>' +
  833. '<button id="edSave" style="margin:5px auto;width:33%;color:white;background:black">Save</button>' +
  834. '<button id="edDefault" style="margin:5px auto;width:33%;color:white;background:black">Restore Default</button>' +
  835. '<button id="edCancel" style="margin:5px auto;width:33%;color:white;background:black">Cancel</button>';
  836. this.node.querySelector('#edDefault').onclick = () => {
  837. this.node.querySelector('textarea').value = Settings.defaults.vbTemplate;
  838. this.node.querySelector('#edSave').click();
  839. };
  840. this.node.querySelector('#edSave').onclick = () => {
  841. Settings.user.vbTemplate = this.node.querySelector('textarea').value.trim();
  842. Settings.user.vbSym = this.node.querySelector('input').value;
  843. Settings.save();
  844. this.die(); new Exporter({ target: this.caller });
  845. }; break;
  846. }
  847. this.node.querySelector('#edCancel').onclick = () => this.die();
  848. },//}}}
  849.  
  850. Core = {//{{{
  851. active: false, timer: null, cooldown: null,
  852. getPayload: function() {//{{{
  853. var user = Settings.user,
  854. payload = {
  855. searchWords: user.search,
  856. minReward: user.pay,
  857. qualifiedFor: Interface.isLoggedout ? 'off' : (user.qual ? 'on' : 'off'),
  858. requiresMasterQual: user.monly ? 'on' : 'off',
  859. sortType: '',
  860. pageNumber: 1,
  861. pageSize: user.resultsPerPage || 10
  862. };
  863. switch (user.searchBy) {
  864. case 0:
  865. payload.sortType = window.encodeURIComponent(`LastUpdatedTime:${+!user.invert}`); break;
  866. case 1:
  867. payload.sortType = window.encodeURIComponent(`NumHITs:${+!user.invert}`); break;
  868. case 2:
  869. payload.sortType = window.encodeURIComponent(`Reward:${+!user.invert}`); break;
  870. case 3:
  871. payload.sortType = window.encodeURIComponent(`Title:${+user.invert}`); break;
  872. }
  873. return payload;
  874. //return this;
  875. },//}}} Core::init
  876. run: function(skiptoggle) {//{{{
  877. if (!skiptoggle) this.active = !this.active;
  878. this.cooldown = +Settings.user.refresh;
  879. clearTimeout(this.timer);
  880. Interface.resetTitle();
  881. if (this.active) {
  882. Interface.Status.push('&nbsp;<b class="spinner"></b> Processing page: 1');
  883. this.fetch('/mturk/searchbar', this.getPayload());
  884. }
  885. },//}}} Core::run
  886. cruise: function() {//{{{
  887. if (!this.active) return;
  888. if (--this.cooldown === 0) this.run(true);
  889. else {
  890. Interface.Status.cd();
  891. this.timer = setTimeout(this.cruise.bind(this), 1000);
  892. }
  893. },//}}}
  894. dispatch: function(type, src) {//{{{
  895. switch(type) {
  896. case 'json':
  897. this.meld(src); break;
  898. case 'document':
  899. var error = src.querySelector('td[class="error_title"]');
  900. if (error && /page request/.test(error.textContent))
  901. setTimeout(this.fetch.bind(this), 3000, src.documentURI);
  902. else
  903. this.scrape(src);
  904. break;
  905. case 'control':
  906. var blocked = scraperHistory.filter(v => v.current && v.blocked).length,
  907. _rpp = +Settings.user.resultsPerPage,
  908. pagelimit = Settings.user.skips ?
  909. ((+Settings.user.pages + Math.floor(blocked/_rpp) + (blocked%_rpp > 0.66*_rpp ? 1 : 0)) || 3) : (+Settings.user.pages || 3);
  910. if (!this.active || !src.nextPageURL || src.page >= pagelimit || (Interface.isLoggedout && src.page === 20)) {
  911. if (Settings.user.disableTO)
  912. this.meld();
  913. else {
  914. var ids = scraperHistory.filter(v => v.current && v.TO === null && v.requester.id, true).join();
  915. if (!ids.length) return this.meld();
  916. Interface.Status.push('&nbsp;<b class="spinner"></b> Retrieving TO data');
  917. this.fetch(TO_API + ids, null, 'json');
  918. }
  919. } else {
  920. Interface.Status.push(`&nbsp;<b class="spinner"></b> Processing page: ${+src.page + 1}`);
  921. if (+src.page + 1 > +Settings.user.pages) Interface.Status.append('; Correcting for skips');
  922. setTimeout(this.fetch.bind(this), 250, src.nextPageURL);
  923. }
  924. break;
  925. }
  926. },//}}} Core::dispatch
  927. scrape: function(src) {//{{{
  928. var page = +src.documentURI.match(/pageNumber=(\d+)/)[1],
  929. nextPageURL = src.querySelector('img[src="/media/right_arrow.gif"]'),
  930. titles = Array.from(src.querySelectorAll('a.capsulelink')),
  931. getCapsule = n => { for (var i=0;i<7;i++) n=n.parentNode; return n; };
  932. nextPageURL = nextPageURL ? nextPageURL.parentNode.href : null;
  933.  
  934. titles.forEach(function(v,i) {
  935. var capsule = getCapsule(v),
  936. get = q => capsule.querySelector(q),
  937. pad = n => ('00'+n).slice(-2),
  938. qualrows = Array.from(get('a[id^="qualifications"]').parentNode.parentNode.parentNode.rows),
  939. capData = {
  940. discovery: Date.now(),
  941. title: v.textContent.trim(),
  942. index: page+pad(i),
  943. requester: { name: get('.requesterIdentity').textContent, id: null, link: null, linkTemplate: null },
  944. pay: get('span.reward').textContent,
  945. time: get('a[id^="duration"]').parentNode.nextElementSibling.textContent,
  946. desc: get('a[id^="description"]').parentNode.nextElementSibling.textContent,
  947. quals: [],
  948. hit: { preview: null, previewTemplate: null, panda: null, pandaTemplate: null },
  949. groupId: null, TO: null, masters: null, numHits: null, blocked: false, included: false,
  950. qualified: !Boolean(get('a[href*="notqualified?"],a[id^="private_hit"]'))
  951. },
  952. listsxr = this.crossRef(capData.requester.name, capData.title); //check block/include lists
  953. capData.blocked = listsxr[0]; capData.included = listsxr[1];
  954. if (qualrows.length === 1) capData.quals.push('None');
  955. else for (var q of qualrows.slice(1)) capData.quals.push(q.cells[0].textContent.trim().replace(/\s+/g,' '));
  956. capData.masters = /Masters/.test(capData.quals.join());
  957.  
  958. if (Interface.isLoggedout) {
  959. capData.TO = 'n/a';
  960. capData.qualified = false;
  961. capData.numHits = 'n/a';
  962. } else
  963. capData.numHits = get('a[id^="number_of_hits"]').parentNode.nextElementSibling.textContent.trim();
  964.  
  965. try { // groupid
  966. capData.groupId = get('a[href*="roupId="]').href.match(/[^=]+$/)[0];
  967. } catch(e) {
  968. void(e); capData.groupId = this.getHash(capData.requester.name + capData.title + capData.pay);
  969. } try { // requesterid, requester search link, groupid
  970. var _r = get('a[href*="requesterId"]');
  971. capData.requester.link = _r.href;
  972. capData.requester.id = _r.href.match(/[^=]+$/)[0];
  973. } catch(e) {
  974. void(e); capData.requester.link = '/mturk/searchbar?searchWords=' + window.encodeURIComponent(capData.requester.name);
  975. } try { // preview/panda links
  976. var _l = get('a[href*="preview?"]');
  977. capData.hit.preview = _l.href;
  978. capData.hit.panda = _l.href.replace(/(\?)/,'andaccept$1');
  979. } catch(e) {
  980. void(e); capData.hit.preview = '/mturk/searchbar?searchWords=' + window.encodeURIComponent(capData.title);
  981. }
  982. if (Settings.user.searchBy === 1 && +Settings.user.batch > 1 && +capData.numHits < +Settings.user.batch) return;
  983. else if (Settings.user.gbatch && +Settings.user.batch > 1 && +capData.numHits < +Settings.user.batch) return;
  984. scraperHistory.add(capData.groupId, capData);
  985. }, this);
  986.  
  987. this.dispatch('control', {page: page, nextPageURL: nextPageURL});
  988. },//}}} Core::scrape
  989. meld: function() {//{{{
  990. var reviews = arguments.length ? arguments[0] : null,
  991. table = document.querySelector('#resultsTable').tBodies[0], html = [], results = [], field, /*_gp, _gq,*/
  992. getClassFromValue = (val,type) => type === 'sim' ? (val > 4 ? 'toHigh' : (val > 3 ? 'toGood' : (val > 2 ? 'toAverage' : 'toPoor')))
  993. : (val > 4.05 ? 'toHigh' : (val > 3.06 ? 'toGood' : (val > 2.4 ? 'toAverage' : (val > 1.7 ? 'toLow' : 'toPoor')))),
  994. createTooltip = (type,obj) => {//{{{
  995. if (!obj) {
  996. var reason = Settings.user.disableTO ? ': TO disabled in user settings'
  997. : (obj === '' ? ': Requester has not been reviewed yet' : ': Invalid response from server');
  998. return `<div class="tooltip" style="width:260px;"><p style="padding-left:5px">Turkopticon data unavailable${reason}</p></div>`;
  999. } else if (type === 'to')
  1000. return `<div class="tooltip" style="width:260px">
  1001. <p style="padding-left:5px"><b>${r.requester.name}</b><br />Reviews: ${obj.reviews} | TOS Flags: ${obj.tos_flags}</p>
  1002. <meter min="0.8" low="2.5" high="3.4" optimum="5" max="5" value=${obj.attrs.comm} data-attr="communicativity"></meter>
  1003. <meter min="0.8" low="2.5" high="3.4" optimum="5" max="5" value=${obj.attrs.pay} data-attr="generosity"></meter>
  1004. <meter min="0.8" low="2.5" high="3.4" optimum="5" max="5" value=${obj.attrs.fair} data-attr="fairness"></meter>
  1005. <meter min="0.8" low="2.5" high="3.4" optimum="5" max="5" value=${obj.attrs.fast} data-attr="promptness"></meter></div>`;
  1006. /*<table style="margin-top:6px;width:100%;font-size:10px"><tr><td>Adjusted Pay</td><td>${obj.attrs.adjPay}</td>
  1007. <td>${getClassFromValue(obj.attrs.adjPay, 'adj').slice(2)}</td></tr><tr><td>Weighted Score</td><td>${obj.attrs.qual}</td>
  1008. <td>${getClassFromValue(obj.attrs.qual, 'sim').slice(2)}</td></tr><tr><td>Adjusted Score</td><td>${obj.attrs.adjQual}</td>
  1009. <td>${getClassFromValue(obj.attrs.adjQual, 'adj').slice(2)}</td></tr></table></div>;*/
  1010. else
  1011. return `<div class="tooltip" style="width:300px"><dl><dt>description</dt><dd>${obj.desc}</dd>
  1012. <dt>qualifications</dt><dd>${obj.quals}</dd></dl>`;
  1013. },//}}}
  1014. addRowHTML = r => {//{{{
  1015. var _st = Interface.isLoggedout ? 'disabled' : '',
  1016. _sh = ex => Settings.user['export'+ex] ? '' : 'hidden',
  1017. _rt = r.blocked ? '' :
  1018. `<div><button name="block" value="${r.requester.name}" style="width:15px">R</button>` +
  1019. `<button name="block" value="${r.title}" style="width:15px">T</button></div>`;
  1020. return `<tr class="${r.blocked ? 'blocklisted' : ''} ${shouldHide ? 'ignored hidden' : ''}` +
  1021. `${r.included ? 'includelisted' : ''} ${r.rowColor} ${r.shine ? 'shine' : ''}">` +
  1022. `<td>${_rt}<div><a class="static" target="_blank" href="${r.requester.link}">${r.requester.name}</a><div></td>` +
  1023. `<td><div><button class="ex vb ${_st} ${_sh('Vb')}" style="width:30px" data-gid="${r.groupId}">vB</button>
  1024. <button class="ex irc ${_st} ${_sh('Irc')}" style="width:30px" data-gid="${r.groupId}">IRC</button>
  1025. <button class="ex hwtf ${_st} ${_sh('Hwtf')}" style="width:33px" data-gid="${r.groupId}">HWTF</button></div><div>
  1026. <a title="Description: ${r.desc}\n\nQualifications: ${r.quals.join('; ')}" target="_blank" href="${r.hit.preview}">${r.title}</a>
  1027. </div></td>` +
  1028. `<td style="text-align:center">${r.pay}</td>` +
  1029. `<td style="text-align:center" >${r.numHits}</td>` +
  1030. `<td style="text-align:center"><a class="static toLink" target="_blank" data-rid="${r.requester.id ? r.requester.id : 'null'}" ` +
  1031. `${r.requester.id ? 'href="'+TO_REPORTS+r.requester.id+'"' : ''}>${r.TO ? r.TO.attrs.pay : 'n/a'}${createTooltip('to',r.TO)}</a></td>` +
  1032. `<td style="text-align:center"><a target="_blank" ${r.hit.panda ? 'href="'+r.hit.panda+'"' : ''}>${r.hit.panda ? 'Accept' : 'n/a'}</td>` +
  1033. `<td class="${r.masters ? 'reqmaster' : 'nomaster'}" style="text-align:center">${r.masters ? 'Y' : 'N'}</td>` +
  1034. `<td class="db nohitDB" data-index="requesterName" data-value="${r.requester.name}" data-cmp-value="${r.title}"
  1035. data-cmp-index="title" style="text-align:center;cursor:default">R</td>` +
  1036. `<td class="db nohitDB" data-index="title" data-value="${r.title}" data-cmp-value="${r.requester.name}"
  1037. data-cmp-index="requesterName" style="text-align:center;cursor:default">T</td>` +
  1038. `${r.qualified ? '' : '<td class="tooweak" title="Not qualified to work on this HIT">NQ</td>'}` +
  1039. '</tr>';},//}}}
  1040. setRowColor = r => {
  1041. var _t = Settings.user.colorType;
  1042. if (!r.TO || r.TO.reviews < 5) { r.rowColor = 'toNone'; return; }
  1043. r.rowColor = getClassFromValue(_t === 'sim' ? r.TO.attrs.qual : r.TO.attrs.adjQual, _t);
  1044. };
  1045. scraperHistory.addReviews(reviews);
  1046. results = scraperHistory.filter(v => { if (v.current) {v.current = false; return true;}});
  1047.  
  1048. // sorting
  1049. if (!Settings.user.disableTO) {
  1050. if (Settings.user.sortPay)
  1051. field = Settings.user.sortType === 'sim' ? 'pay' : 'adjPay';
  1052. else if (Settings.user.sortAll)
  1053. field = Settings.user.sortType === 'sim' ? 'qual' : 'adjQual';
  1054.  
  1055. results.sort((a,b) => {a = a.TO ? +a.TO.attrs[field] : 0; b = b.TO ? +b.TO.attrs[field] : 0; return b-a;});
  1056. if (Settings.user.sortAsc) results.reverse();
  1057. } else
  1058. results.sort((a,b) => a.index - b.index);
  1059.  
  1060. // populating
  1061. var counts = { total:results.length, new:0, newVis:0, ignored:0, blocked:0 };
  1062. for (var r of results) {
  1063. var shouldHide = Boolean((Settings.user.hideBlock && r.blocked) || (Settings.user.hideNoTO && !r.TO) ||
  1064. (Settings.user.minTOPay && r.TO && +r.TO.attrs.pay < +Settings.user.minTOPay));
  1065. counts.new += r.isNew ? 1 : 0;
  1066. counts.newVis += r.isNew && !shouldHide ? 1 : 0;
  1067. counts.ignored += shouldHide ? 1 : 0;
  1068. counts.blocked += r.blocked ? 1 : 0;
  1069. setRowColor(r); html.push(addRowHTML(r));
  1070. }
  1071. table.innerHTML = html.join('');
  1072. this.notify(counts);
  1073.  
  1074. // click events
  1075. var _fnin = function(e) {
  1076. e.target.children[0].style.display = 'block';
  1077. var tt = e.target.children[0], rect = tt.getBoundingClientRect();
  1078. if (rect.height > (window.innerHeight - e.clientY)) tt.style.transform = 'translateY(calc(-100% + 22px))';
  1079. },
  1080. _fnout = function(e) {
  1081. var tt = e.target.querySelector('.tooltip');
  1082. if (!tt) return;
  1083. tt.style.transform = '';
  1084. tt.style.display = 'none';
  1085. };
  1086. Array.from(table.querySelectorAll('.toLink')).forEach(v => { v.onmouseover = _fnin; v.onmouseout = _fnout; });
  1087. Array.from(table.querySelectorAll('.ex')).forEach(v => v.onclick = e => new Exporter(e));
  1088. Array.from(table.querySelectorAll('button[name=block]')).forEach(v => v.onclick = e => new Dialogue(e.target));
  1089. Array.from(table.querySelectorAll('.db')).forEach(v => { HITStorage.test(v); v.onclick = e => new DBQuery(e.target); });
  1090. if (this.active) {
  1091. if (this.cooldown === 0) Interface.buttons.main.click();
  1092. else {
  1093. this.timer = setTimeout(this.cruise.bind(this), 1000);
  1094. Interface.Status.append(`<br />Scraping again in ${this.cooldown} seconds`);
  1095. }
  1096. }
  1097. if ((Date.now() - Interface.time)/1000 > 3600) scraperHistory.prune();
  1098. },//}}}
  1099. getHash: function(str) {//{{{
  1100. var hash = 0, ch;
  1101. for (var i = 0; i < str.length; i++) {
  1102. ch = str.charCodeAt(i);
  1103. hash = ch + (hash << 6) + (hash << 16) - hash;
  1104. }
  1105. return hash;
  1106. },//}}} Core::getHash
  1107. fetch: function(url, payload, responseType, inline) {//{{{
  1108. responseType = responseType || 'document';
  1109. inline = inline === undefined ? true : inline;
  1110. if (payload) {
  1111. var args = 0;
  1112. url += '?';
  1113. for (var k in payload) { if (payload.hasOwnProperty(k)) {
  1114. if (args++) url += "&";
  1115. url += `${k}=${payload[k]}`;
  1116. }}
  1117. }
  1118. var _p = new Promise( function(accept, rej) {
  1119. var xhr = new XMLHttpRequest();
  1120. xhr.open('GET', url, true);
  1121. xhr.responseType = responseType;
  1122. xhr.send();
  1123. xhr.onload = function() {
  1124. if (this.status === 200) accept(this.response);
  1125. else rej(new Error(this.status + " - " + this.statusText));
  1126. };
  1127. xhr.onerror = function() { rej(new Error(this.status + " - " + this.statusText)); };
  1128. xhr.ontimeout = function() { rej(new Error(this.status + " - " + this.statusText)); };
  1129. });
  1130. if (inline) _p.then( this.dispatch.bind(this, responseType), err => { console.warn(err); this.meld.apply(this); } );
  1131. else return _p;
  1132. },//}}} Core::fetch
  1133. crossRef: function(...needles) {//{{{
  1134. var found = [false, false], s;
  1135. if (Settings.user.onlyIncludes) { // everything not in includelist gets blocked, unless includelist is empty or doesn't exist
  1136. var list = (localStorage.getItem('scraper_include_list') || "").toLowerCase().split('^');
  1137. if (list.length === 1 && !list[0].length) return found; // includelist is empty
  1138. for (s of needles) {
  1139. found[1] = Boolean(~list.indexOf(s.toLowerCase().replace(/\s+/g,' ')));
  1140. if (found[1]) {
  1141. found[0] = false; break;
  1142. } else
  1143. found[0] = true;
  1144. }
  1145. return found;
  1146. } else {
  1147. var blist = (localStorage.getItem('scraper_ignore_list') || "").toLowerCase().split('^'),
  1148. ilist = (localStorage.getItem('scraper_include_list') || "").toLowerCase().split('^'),
  1149. blist_wild = Settings.user.wildblocks ? blist.filter(v => /.*?[*].*/.test(v)) : null;
  1150. if (blist_wild) blist_wild.forEach((v,i,a) =>
  1151. a[i] = new RegExp('^' + (v.replace(/([+${}[\](\)^|?.\\])/g, "\\$1") // escape non wildcard special chars
  1152. .replace(/([^*]|^)[*](?!\*)/g, "$1.*") // turn glob into regex
  1153. .replace(/\*{2,}/g, s => s.replace(/\*/g,'\\$&'))) + '$'), 'i'); // escape consecutive asterisks
  1154. for (s of needles) {
  1155. found[0] = Boolean(~blist.indexOf(s.toLowerCase().replace(/\s+/g,' ')));
  1156. found[1] = Boolean(~ilist.indexOf(s.toLowerCase().replace(/\s+/g,' ')));
  1157. if (blist_wild && blist_wild.length && !found[0])
  1158. for (var i=0; !found[0] && i<blist_wild.length; i++) found[0] = blist_wild[i].test(s.toLowerCase().replace(/\s+/g,' '));
  1159. if (found[0] || found[1]) break;
  1160. }
  1161. return found; // [ blocklist,includelist ]
  1162. }
  1163. },//}}} Core::crossRef
  1164. notify: function(c) {//{{{
  1165. var s = ['Scrape Complete: '];
  1166. s.push(c.total > 0 ? `${c.total} HIT${c.total > 1 ? 's' : ''}` : '<b>No HITs found.</b>');
  1167. if (c.new) s.push(`<i></i>${c.new} new`);
  1168. if (c.newVis !== c.new) s.push(` (${c.newVis} shown)`);
  1169. if (c.ignored) s.push(`<i></i>${c.ignored} hidden`);
  1170. if (c.blocked) s.push(`<i></i>${c.blocked} from blocklist`);
  1171. if (c.ignored - c.blocked > 0) s.push(`<i></i>${c.ignored - c.blocked} below TO threshold`);
  1172. Interface.Status.push(s.join(''));
  1173. if (c.newVis && Settings.user.notifySound[0]) document.getElementById(Settings.user.notifySound[1]).play();
  1174. if (!c.newVis || Interface.focused) return;
  1175. document.title = DOC_TITLE + `[${c.newVis} new]`;
  1176. console.log('title should have changed');
  1177. if (Settings.user.notifyBlink) Interface.blackhole.blink =
  1178. setInterval(() => document.title = /scraper/i.test(document.title) ? `${c.newVis} new HITs` : DOC_TITLE, 1000);
  1179. if (Settings.user.notifyTaskbar && Notification.permission === 'granted') {
  1180. var n = new Notification('HITScraper found ' + c.newVis + ' new HITs');
  1181. n.onclick = n.close;
  1182. setTimeout(n.close.bind(n), 10000);
  1183. }
  1184. },//}}} Core::notify
  1185. },//}}} Core
  1186.  
  1187. Exporter = function(e){//{{{
  1188. Interface.toggleOverflow('on');
  1189. this.caller = e.target;
  1190. this.node = document.body.appendChild(document.createElement('DIV'));
  1191. this.node.classList.add('pop');
  1192. this.die = () => {Interface.toggleOverflow('off'); this.node.remove();};
  1193. this.record = scraperHistory.hitGroups[this.caller.dataset.gid];
  1194.  
  1195. if (Interface.isLoggedout) return this.die();
  1196.  
  1197. var _vb = () => {//{{{
  1198. var
  1199. templateVars = {//{{{
  1200. title: this.record.title,
  1201. requesterName: this.record.requester.name,
  1202. requesterLink: this.record.requester.link,
  1203. requesterId: this.record.requester.id,
  1204. description: this.record.desc,
  1205. reward: this.record.pay,
  1206. quals: this.record.quals.join(';').replace(/(;|^)(.+Masters.+?)(;|$)/g, '$1[COLOR=red][b]$2[/b][/COLOR]$3'),
  1207. previewLink: this.record.hit.preview,
  1208. pandaLink: this.record.hit.panda,
  1209. time: this.record.time,
  1210. numHits: this.record.numHits,
  1211. toImg: (function(){//{{{
  1212. var _to = this.record.TO, _attrs = '',
  1213. api = 'https://data.istrack.in/to/';
  1214. if (!_to) return '';
  1215. for (var a of ['comm','pay','fair','fast']) _attrs += (_attrs ? ',' : '') + _to.attrs[a];
  1216. return `[img]${api+_attrs+'.png'}[/img]`;
  1217. }).apply(this),//}}} toImg
  1218. toText: (function(){//{{{
  1219. var _to = this.record.TO, txt = '', color, _attr, sym = Settings.user.vbSym,
  1220. _long = { comm: 'Communicativity', pay: 'Generosity', fair: 'Fairness', fast: 'Promptness' };
  1221. if (!_to) return 'TO Unavailable';
  1222. for (var a of ['comm','pay','fair','fast']) {
  1223. _attr = Math.floor(_to.attrs[a]);
  1224. switch(_attr) {
  1225. case 5:
  1226. case 4: color = 'green'; break;
  1227. case 3: color = 'yellow'; break;
  1228. case 2: color = 'orange'; break;
  1229. case 1: color = 'red'; break;
  1230. default: color = 'white'; break;
  1231. }
  1232. txt += (_attr > 0 ?
  1233. (`[COLOR=${color}]${sym.repeat(_attr)}[/COLOR]` + (_attr < 5 ? `[COLOR=white]${sym.repeat(5-_attr)}[/COLOR]` : ''))
  1234. : '[COLOR=white]'+sym.repeat(5)+'[/COLOR]') + ` ${_to.attrs[a]} ${_long[a]}\n`;
  1235. }
  1236. return txt;
  1237. }).apply(this),//}}} toText
  1238. toFoot: (function(){//{{{
  1239. var _to = this.record.TO,
  1240. payload = `requester[amzn_id]=${this.record.requester.id}&requester[amzn_name]=${this.record.requester.name}`,
  1241. newReview = `[URL=${TO_BASE+'report?'+payload}]Submit a new TO review[/URL]`;
  1242. if (!_to) return newReview;
  1243. return `Number of Reviews: ${_to.reviews}\nTOS Flags: ${_to.tos_flags}\n` + newReview;
  1244. }).apply(this),//}}} toFoot
  1245. },//}}} templateVars obj
  1246. createTemplate = function(str) {
  1247. /*jshint -W054*/ // ignore evil due to required eval (function constructor)
  1248. // TODO: find a concise way to dynamically generate a template without using eval
  1249. var _str = str.replace(/\$\{ *([-\w\d.]+) *\}/g, (_,p1) => `\$\{vars.${p1}\}`);
  1250. return new Function('vars', `try {return \`${_str}\`} catch(e) {return "Error in template: "+e.message}`);
  1251. };
  1252. this.node.innerHTML = '<p>vB Export</p>' +
  1253. '<textarea style="display:block;padding:2px;margin:auto;height:250px;width:500px" tabindex="1">' +
  1254. createTemplate(Settings.user.vbTemplate)(templateVars) + '</textarea>' +
  1255. '<button id="exTemplate" style="margin-top:5px;width:50%;color:white;background:black">Edit Template</button>' +
  1256. '<button id="exClose" style="margin-top:5px;width:50%;color:white;background:black">Close</button>';
  1257. this.node.querySelector('#exTemplate').onclick = () => { this.die(); new Editor('vbTemplate', this.caller); };
  1258. this.node.querySelector('#exClose').onclick = this.die;
  1259. this.node.querySelector('textarea').select();
  1260. },//}}}
  1261. _irc = () => {//{{{
  1262. // custom MTurk/TO url shortener courtesy of Tjololo
  1263. var api = 'https://ns4t.net/yourls-api.php?action=bulkshortener&title=MTurk&signature=39f6cf4959',
  1264. urlArr = [], payload, sym = '\u2022', // sym = bullet
  1265. getTO = () => {
  1266. var _to = this.record.TO;
  1267. if (!_to) return 'Unavailable';
  1268. else return `Pay=${_to.attrs.pay} Fair=${_to.attrs.fair} Comm=${_to.attrs.comm}`;
  1269. };
  1270.  
  1271. urlArr.push(window.encodeURIComponent(this.record.requester.link));
  1272. urlArr.push(window.encodeURIComponent(this.record.hit.preview));
  1273. urlArr.push(window.encodeURIComponent(TO_REPORTS+this.record.requester.id));
  1274. urlArr.push(window.encodeURIComponent(this.record.hit.panda));
  1275. payload = '&urls[]='+urlArr.join('&urls[]=');
  1276.  
  1277. this.node.innerHTML = '<span style="font-size:16px">Shortening URLs... <i class="spinner"></i></span>';
  1278. Core.fetch(api+payload, null, 'text', false).then( r => {
  1279. urlArr = r.split(';').slice(0,4);
  1280. this.node.innerHTML = '<p>IRC Export</p>' +
  1281. '<textarea style="display:block;padding:2px;margin:auto;height:130px;width:500px" tabindex="1">' +
  1282. (/masters/i.test(this.record.quals.join()) ? `MASTERS ${sym} ` : '') +
  1283. `Requester: ${this.record.requester.name} ${urlArr[0]} ${sym} HIT: ${this.record.title} ` +
  1284. `${urlArr[1]} ${sym} Pay: ${this.record.pay} ${sym} Aval: ${this.record.numHits} ${sym} ` +
  1285. `Limit: ${this.record.time} ${sym} TO: ${getTO()} ${urlArr[2]} ${sym} PandA: ${urlArr[3]}</textarea>` +
  1286. '<button id="exClose" style="width:100%;padding:5px;margin-top:5px;background:black;color:white">Close</button>';
  1287. this.node.querySelector('textarea').select();
  1288. this.node.querySelector('#exClose').onclick = this.die;
  1289. }, err => { console.error(err); this.die(); } );
  1290. },//}}}
  1291. _hwtf = () => {//{{{
  1292. var _location = 'ICA', _quals, _masters = '', _title, _r = this.record, tIndex;
  1293. // format qualifications string
  1294. _quals = _r.quals.map(v => {
  1295. if (/(is US|: US$)/.test(v))
  1296. _location = 'US';
  1297. else if (/Masters/.test(v))
  1298. _masters = `[${v.match(/.*Masters/)[0].toUpperCase()}]`;
  1299. else if (/approv[aled]+ (rate|HITs)/.test(v))
  1300. return v.replace(/.+ is (.+) than (\d+)/, (_,p1,p2) => {
  1301. if (/^(not g|less)/.test(p1)) return '<' + p2 + (/%/.test(_) ? '%' : '');
  1302. else if (/^(not l|greater)/.test(p1)) return '>' + p2 + (/%/.test(_) ? '%' : '');
  1303. else console.error('match error', [_, p1, p2]);
  1304. return _;
  1305. });
  1306. else
  1307. return v;
  1308. }).filter(v => v).sort(a => /[><]/.test(a) ? -1 : 1);
  1309. _title = `${_location} - ${_r.title} - ${_r.requester.name} - ${_r.pay}/COMTIME - (${_quals.join(', ')||'None'}) ${_masters}`;
  1310. tIndex = _title.search(/COMTIME/);
  1311. this.node.style.whiteSpace = 'nowrap';
  1312. this.node.innerHTML = '<p style="width:500px">/r/HitsWorthTurkingFor Export: Use the buttons on the left for single-click copying</p>' +
  1313. '<button class="exhwtf" style="height:65px">Title</button>' +
  1314. '<textarea style="padding:2px;margin:auto;height:60px;width:430px;resize:none" tabindex="1" autofocus>' +
  1315. _title + '</textarea><br />' + '<button class="exhwtf" style="height:35px">Preview</button>' +
  1316. '<textarea style="padding:2px;margin:auto;height:30px;width:430px;resize:none" tabindex="2">' +
  1317. 'Preview: ' + _r.hit.preview + '</textarea><br />' + '<button class="exhwtf" style="height:35px;">Req</button>' +
  1318. '<textarea style="padding:2px;margin:auto;height:30px;width:430px;resize:none" tabindex="3">' +
  1319. 'Req: ' + _r.requester.link + '</textarea><br />' + '<button class="exhwtf" style="height:35px;">PandA</button>' +
  1320. '<textarea style="padding:2px;margin:auto;height:30px;width:430px;resize:none" tabindex="4">' +
  1321. 'PandA: ' + _r.hit.panda + '</textarea><br />' + '<button class="exhwtf" style="height:35px;">TO</button>' +
  1322. '<textarea style="padding:2px;margin:auto;height:30px;width:430px;resize:none" tabindex="5">' +
  1323. 'TO: ' + TO_REPORTS + _r.requester.id + '</textarea><br />' +
  1324. '<button id="exClose" style="width:100%;padding:5px;margin-top:5px;background:black;color:white">Close</button>';
  1325.  
  1326. var copyfn = function(e) { e.target.nextSibling.select(); document.execCommand('copy'); };
  1327. Array.from(this.node.querySelectorAll('.exhwtf')).forEach(v => v.onclick = copyfn);
  1328. this.node.querySelector('#exClose').onclick = this.die;
  1329. this.node.querySelector('textarea').setSelectionRange(tIndex, tIndex+7);
  1330. };//}}}
  1331.  
  1332. switch(this.caller.textContent.toLowerCase()){
  1333. case 'vb':
  1334. _vb();break;
  1335. case 'irc':
  1336. _irc();break;
  1337. case 'hwtf':
  1338. _hwtf();break;
  1339. }
  1340. },//}}} Exporter
  1341.  
  1342. HITStorage = {//{{{
  1343. db: null,
  1344. attach: function(name) {//{{{
  1345. var dbh = window.indexedDB.open(name);
  1346. dbh.onversionchange = e => { e.target.result.close(); console.info('DB connection closed by external source'); };
  1347. dbh.onsuccess = e => this.db = e.target.result;
  1348. },//}}} HITStorage::attach
  1349. test: function(node) {//{{{
  1350. if (!this.db || !this.db.objectStoreNames.contains('HIT')) return;
  1351. this.db.transaction('HIT','readonly').objectStore('HIT').index(node.dataset.index).get(node.dataset.value)
  1352. .onsuccess = e => { if (e.target.result) node.className = node.className.replace(/no/,''); };
  1353. },//}}} HITStorage::test
  1354. query: function(node) {//{{{
  1355. var range = window.IDBKeyRange.only(node.dataset.value), results = [];
  1356. return new Promise((a,r) => {
  1357. if (!this.db || !this.db.objectStoreNames.contains('HIT')) r(0);
  1358. this.db.transaction('HIT','readonly').objectStore('HIT').index(node.dataset.index).openCursor(range)
  1359. .onsuccess = e => {
  1360. if (e.target.result) {
  1361. results.push(e.target.result.value);
  1362. e.target.result.continue();
  1363. } else
  1364. a(results.sort((a,b) => a.date > b.date ? 1 : -1));
  1365. };
  1366. });
  1367. }//}}} HITStorage::query
  1368. };//}}} HITStorage
  1369.  
  1370. console.log('hook');
  1371. if (document.getElementById('control_panel')) {
  1372. if (confirm('Another version of HITScraper was detected and has already claimed this page. Open HITScraper [dev] in a new tab?'))
  1373. window.open('https://www.mturk.com/mturk/findhits?match=true?hit_scraper-dev');
  1374. } else {
  1375. Interface.draw().init();
  1376. HITStorage.attach('HITDB');
  1377. }
  1378. function Archive() {//{{{
  1379. this.hitGroups = {};
  1380. this.ratings = { global: { comm: 0, pay: 0, fair: 0, fast: 0, reviews: 0 } };
  1381. this.prune = function() {
  1382. var keepAlive = 3600; //60 mins
  1383. for (var k in this.hitGroups) { if (this.hitGroups.hasOwnProperty(k)) {
  1384. var age = Math.floor((Date.now() - this.hitGroups[k].discovery)/1000);
  1385. if (age > keepAlive) delete this.hitGroups[k];
  1386. }}
  1387. };
  1388. this.add = function(key, value) {
  1389. var anchor = document.querySelector('#resultsTable tbody').rows.length;
  1390. if (!(key in this.hitGroups)) { // new entry
  1391. if (value.requester.id && value.requester.id in this.ratings)
  1392. value.TO = this.ratings[value.requester.id];
  1393. this.hitGroups[key] = value;
  1394. this.hitGroups[key].isNew = anchor ? true : false;
  1395. this.hitGroups[key].shine = anchor ? true : false;
  1396. }
  1397. else { // existing entry
  1398. this.hitGroups[key].isNew = false;
  1399. var age = Math.floor((Date.now() - this.hitGroups[key].discovery)/1000);
  1400. this.hitGroups[key].shine = this.hitGroups[key].shine && age < +Settings.user.shine && anchor ? true : false;
  1401. this.hitGroups[key].blocked = value.blocked;
  1402. this.hitGroups[key].included = value.included;
  1403. }
  1404. this.hitGroups[key].current = true;
  1405. };
  1406. this.filter = function(callback, ridsOnly) {
  1407. ridsOnly = ridsOnly || false;
  1408. var _results = [];
  1409. for (var k in this.hitGroups) { if (this.hitGroups.hasOwnProperty(k)) {
  1410. if (callback(this.hitGroups[k], k, this.hitGroups))
  1411. _results.push( ridsOnly ? this.hitGroups[k].requester.id : this.hitGroups[k] );
  1412. }}
  1413. return _results;
  1414. };
  1415. this.addReviews = function(obj) {
  1416. if (!obj) return;
  1417. var groups = this.filter(v => v.current && v.TO === null),
  1418. rids = Object.keys(obj),
  1419. adj = (x,n) => ((x*n+15)/(n+5)) - 1.645*Math.sqrt((Math.pow(1.0693*x,2) - Math.pow(x,2))/(n+5));
  1420. for (var k of rids) {
  1421. if (typeof obj[k] === 'string') continue; // no reviews yet
  1422.  
  1423. // adjust ratings
  1424. var _n=0, _d=0, attr;
  1425. for (attr of Object.keys(obj[k].attrs)) {
  1426. _n += obj[k].attrs[attr]*Settings.user.toWeights[attr];
  1427. _d += +Settings.user.toWeights[attr];
  1428. }
  1429. obj[k].attrs.qual = (_n/_d).toPrecision(4);
  1430. obj[k].attrs.adjQual = adj(_n/_d, +obj[k].reviews).toPrecision(4);
  1431. obj[k].attrs.adjPay = adj(+obj[k].attrs.pay, +obj[k].reviews).toPrecision(4);
  1432.  
  1433. // aggregate globals
  1434. if (k in this.ratings) continue; // prevent aggregating known values
  1435. this.ratings[k] = obj[k];
  1436. this.ratings.global.reviews += obj[k].reviews;
  1437. for (attr of Object.keys(obj[k].attrs)) this.ratings.global[attr] += obj[k].attrs[attr] * obj[k].reviews;
  1438. }
  1439. for (var g of groups) this.hitGroups[g.groupId].TO = obj[g.requester.id]; // empty string if no TO
  1440. };
  1441. Object.defineProperties(this, {
  1442. length: { get: () => Object.keys(this.hitGroups).length },
  1443. keys: { get: () => Object.keys(this.hitGroups) },
  1444. globalPay: { get: () => this.ratings.global.reviews ? (this.ratings.global.pay/this.ratings.global.reviews).toPrecision(4) : 0},
  1445. globalQuality: { get: () => {
  1446. if (!this.ratings.global.reviews) return 0;
  1447. var attrs = ['comm','pay','fast','fair'], _result = 0, _d = 0;
  1448. for (var a of attrs) {
  1449. _result += this.ratings.global[a]*Settings.user.toWeights[a]/this.ratings.global.reviews;
  1450. _d += +Settings.user.toWeights[a];
  1451. }
  1452. return (_result/_d).toPrecision(4);
  1453. }}
  1454. });
  1455. }//}}}
  1456.  
  1457. function Dialogue(caller) {//{{{
  1458. Interface.toggleOverflow('on');
  1459. this.node = document.body.appendChild(document.createElement('DIV'));
  1460. this.die = () => { Interface.toggleOverflow('off'); this.node.remove(); };
  1461. this.node.style.cssText = 'position:fixed;z-index:20;top:15%;left:50%;width:320px;padding:20px;transform:translate(-50%);' +
  1462. 'background:#000;color:#fff;box-shadow:0px 0px 6px 1px #fff';
  1463. var target = caller.textContent === 'R' ? 'requester' : 'title';
  1464. this.node.innerHTML = `<p><b>Add this ${target} to the blocklist?</b></p><p>"${caller.value}"</p>
  1465. <div style="text-align:right;margin-right:30px;margin-top:10px;padding-top:10px">
  1466. <button id="confirm" style="font-weight:bold;padding:7px;width:65px">OK</button>
  1467. <button id="cancel" style="padding:7px;width:65px;">Cancel</button></div>`;
  1468. this.node.querySelector('#confirm').onclick = () => {
  1469. var bl = localStorage.getItem('scraper_ignore_list');
  1470. if (!bl) bl = caller.value.toLowerCase();
  1471. else if (bl.slice(-1) === '^') bl += caller.value.toLowerCase();
  1472. else bl += '^'+caller.value.toLowerCase();
  1473. localStorage.setItem('scraper_ignore_list', bl);
  1474.  
  1475. Array.from(document.getElementById('resultsTable').tBodies[0].rows).forEach(v => {
  1476. if (v.cells[0].firstChild.textContent === caller.value || v.cells[1].firstChild.textContent === caller.value) {
  1477. if (Settings.user.hideBlock) v.classList.add('hidden');
  1478. v.classList.add('blocklisted');
  1479. }
  1480. });
  1481. this.die();
  1482. };
  1483. this.node.querySelector('#cancel').onclick = this.die;
  1484. }//}}}
  1485.  
  1486. function DBQuery(node) {//{{{
  1487. Interface.toggleOverflow('on');
  1488. this.node = document.body.appendChild(document.createElement('DIV'));
  1489. this.die = () => { this.node.remove(); Interface.toggleOverflow('off'); };
  1490. this.node.style.cssText = 'position:fixed;z-index:20;top:50%;left:50%;padding:8px;' +
  1491. 'background:#fff;color:#000;box-shadow:0px 0px 6px 1px #bfbfbf;transform:translate(-50%,-50%);';
  1492. this.node.innerHTML = '<div style="text-align:center;font-size:16px;"><p><b>Querying database... <i class="spinner"></i></b></p></div>';
  1493. HITStorage.query(node).then(r => {
  1494. var _tbody = [], _tfoot, t = { hits:0, app:0, rej:0, pen:0 },
  1495. _thead = '<tr style="background:lightgrey;color:black"><th style="width:90px;padding:5px">Date</th>' +
  1496. '<th style="width:120px">Requester</th><th>Title</th><th>Pay</th><th>Bonus</th><th>Status</th><th>Feedback</th></tr>',
  1497. html = '<div style="position:absolute;top:0;left:0;margin:0;text-align:right;padding:0px;border:none;width:100%">' +
  1498. '<label id="close" class="close" title="Close">&#160;&#10008;&#160;</label></div>';
  1499. if (!r.length)
  1500. html += `<h2>Nothing found matching "${node.dataset.value}"</h2>`;
  1501. else {
  1502. r.forEach((v,i) => {
  1503. var _pay, _bonus, _sc, _bg;
  1504. if (typeof v.reward === 'object') {
  1505. _pay = '$'+v.reward.pay.toFixed(2);
  1506. _bonus = v.reward.bonus > 0 ? '$'+v.reward.bonus.toFixed(2) : '';
  1507. } else { _pay = '$'+v.reward.toFixed(2); _bonus = ''; }
  1508.  
  1509. _sc = /(paid|approved)/i.test(v.status) ? 'green' : (/approval/i.test(v.status) ? 'orange' : 'red');
  1510. _bg = v[node.dataset.cmpIndex] === node.dataset.cmpValue ? 'lightgreen' : (i%2 ? '#F1F3EB' : '#fff');
  1511. _tbody.push(`<tr style="background:${_bg}">
  1512. <td>${v.date}</td><td>${v.requesterName}</td><td>${v.title}</td><td>${_pay}</td><td>${_bonus}</td>
  1513. <td style="color:${_sc}">${v.status}</td><td>${v.feedback}</td></tr>`);
  1514. t.hits++; t.app += /(paid|approved)/i.test(v.status) ? +_pay.slice(1) : 0;
  1515. t.rej += /rejected/i.test(v.status) ? +_pay.slice(1) : 0; t.pen += /approval/i.test(v.status) ? +_pay.slice(1) : 0;
  1516. });
  1517. _tfoot = `<tr style="background:lightgrey;text-align:center"><td colspan="7">${t.hits} HITs: $${t.app.toFixed(2)} approved,
  1518. $${t.pen.toFixed(2)} pending, $${t.rej.toFixed(2)} rejected</td>`;
  1519. html += `<div style="margin-top:20px;width:100%;height:calc(100% - 20px);overflow:auto">
  1520. <table style="border:1px solid black;border-collapse:collapse;width:100%">
  1521. <thead>${_thead}</thead><tbody>${_tbody.join('')}</tbody><tfoot>${_tfoot}</tfoot></table></div>`;
  1522. }
  1523. this.node.style.cssText += `width:85%;${r.length ? 'height:85%;' : 'max-height:85%;'}`;
  1524. this.node.innerHTML = html;
  1525. this.node.querySelector('#close').onclick = this.die;
  1526. }, () => this.die());
  1527. }//}}}
  1528.  
  1529. })();
  1530.  
  1531. // vim: ts=2:sw=2:et:fdm=marker:noai