Warning: fopen(/www/sites/update.greasyfork.icu/index/store/temp/9632d85e6bb900894d2dcf1771b66c67.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript== // @name mmmturkeybacon Last HITs Previewed // @version 1.11 // @description Shows a log of the last 50 HITs that were previewed. This can aid you in saving a HIT to look at later, examining a HIT's contents after it has been submitted, contacting a requester, looking at turkopticon ratings, or sharing a HIT. MTurk Great HIT Export and mmmturkeybacon Color Coded Search with Checkpoints should execute after this script so they operate correctly on the page it generates. To see the last 50 HITs previewed visit: https://www.mturk.com/mturk/viewhits?last_hits_previewed // @author mmmturkeybacon // @namespace http://userscripts.org/users/523367 // @match https://*.mturk.com/mturk/preview?groupId=* // @match https://*.mturk.com/mturk/viewhits?last_hits_previewed* // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js // @grant GM_log // @downloadURL https://update.greasyfork.icu/scripts/8032/mmmturkeybacon%20Last%20HITs%20Previewed.user.js // @updateURL https://update.greasyfork.icu/scripts/8032/mmmturkeybacon%20Last%20HITs%20Previewed.meta.js // ==/UserScript== var HIT_LOG_SIZE = 50; if (document.location.href.indexOf('preview?groupId=') > -1) { var groupId = $('form[name="hitForm"][method="POST"][action="/mturk/hitReview"] input[name="groupId"]').val(); if (groupId) { var hitId = $('form[name="hitForm"][method="POST"][action="/mturk/hitReview"] input[name="hitId"]').val(); var requesterId = $('input[type="hidden"][name="requesterId"]').val(); var title = $('td[class="capsulelink_bold"][nowrap=""][valign="middle"][width="100%"][align="left"] > div').text().trim(); var requester = $('td[class="capsule_field_title"]').has('a[id="requester.tooltip"]').next('td[class="capsule_field_text"]').text().trim().split(/\u00a0/)[0]; // split at   to remove requesterId added by mmmturkeybacon Enhanced HIT Information Capsule var reward = $('td[class="capsule_field_title"]').has('a[id="reward.tooltip"]').next('td[class="capsule_field_text"]').text().trim().split(' per')[0]; // remove 'per HIT' from reward var number_of_hits = $('td[class="capsule_field_title"]').has('a[id="number_of_hits.tooltip"]').next('td[class="capsule_field_text"]').text().trim(); var time_left = $('td[class="capsule_field_title"]').has('a[id="time_left.tooltip"]').next('td[class="capsule_field_text"]').text().trim(); var qualifications = $('td[class="capsule_field_title"]').has('a[id="qualifications.tooltip"]').next('td[class="capsule_field_text"]').text().trim(); var date_viewed = (new Date()).toLocaleString(); var iframe_src = $('iframe').attr('src'); iframe_src = iframe_src ? iframe_src : '#'; var hitAutoAppDelayInSeconds = $('input[type="hidden"][name="hitAutoAppDelayInSeconds"]').val(); // time formatting code modified from http://userscripts.org/scripts/show/169154 var days = Math.floor((hitAutoAppDelayInSeconds/(60*60*24))); var hours = Math.floor((hitAutoAppDelayInSeconds/(60*60)) % 24); var mins = Math.floor((hitAutoAppDelayInSeconds/60) % 60); var secs = hitAutoAppDelayInSeconds % 60; var aa_time = (days == 0 ? '' : days + (days > 1 ? ' days ' : ' day ')) + (hours == 0 ? '' : hours + (hours > 1 ? ' hours ' : ' hour ')) + (mins == 0 ? '' : mins + (mins > 1 ? ' minutes ' : ' minute ')) + (secs == 0 ? '' : secs + (secs > 1 ? ' seconds ' : ' second ')); if (hitAutoAppDelayInSeconds == 0) { aa_time = "0 seconds "; } aa_time = aa_time.slice(0,-1); var previewed_HITs_data_array = JSON.parse(localStorage.getItem('mtb_previewed_HITs_data_array')); if (previewed_HITs_data_array == null || previewed_HITs_data_array.length != HIT_LOG_SIZE) { previewed_HITs_data_array = new Array(HIT_LOG_SIZE); } var i; for (i = 0; i < previewed_HITs_data_array.length; i++) { if (previewed_HITs_data_array[i] && previewed_HITs_data_array[i].groupId == groupId) { break; } } if (i == previewed_HITs_data_array.length) { i = 0; } previewed_HITs_data_array.splice(i, 1); previewed_HITs_data_array.push({hitId:hitId, groupId:groupId, requesterId:requesterId, title:title, requester:requester, reward:reward, number_of_hits:number_of_hits, time_left:time_left, qualifications:qualifications, date_viewed:date_viewed, aa_time:aa_time, iframe_src:iframe_src}); localStorage.setItem('mtb_previewed_HITs_data_array', JSON.stringify(previewed_HITs_data_array)); } } else if (document.location.href.indexOf('viewhits?last_hits_previewed') > -1) { document.title = 'Last HITs Previewed'; document.body.innerHTML = '

Last HITs Previewed

'; var previewed_HITs_data_array = JSON.parse(localStorage.getItem('mtb_previewed_HITs_data_array')); var innerHTML = '
\
\ '; for (var i = previewed_HITs_data_array.length-1; i > -1; i--) { j = (previewed_HITs_data_array.length-1)-i; var phda = previewed_HITs_data_array[i]; if (phda == null) { continue; } innerHTML += ' \ \ \ \ '; } document.body.innerHTML += innerHTML + '
'+(j+1)+'\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \
\ \ '+phda.title+'\ \ \ \ \ \ \ \ \ \ \ \ \ \ View a HIT in this group\ \ \ \ \
\
\ \ \ \ \ \ \
\ \ \ \ \ \
\ \ Requester:  \ \ \ \ \ '+phda.requester+'\
\
\ \ \ \ \ \ \ \ \ \ \
\ \ Date Viewed:  \ \ '+phda.date_viewed+' \ \ \ \
\ \ Time Allotted:  \ \ '+phda.time_left+'
\
\ \ \ \ \ \ \ \ \ \
\ \ Reward:  \ \ '+phda.reward+'
\ \ HITs Available:  \ \ '+phda.number_of_hits+'
\
\ \
\ \ \ \ \ \
\ \ Description:\ \ No description available. Automatically approves after '+phda.aa_time+'.
\ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ Qualifications Required:\ \
\
\
\ '+phda.qualifications+'\ \ \
\
\
\ \ \ \
\ \ \ \ \ \ Contact the Requester of this HIT\ \ \
\
\
\ \ \ \
'+(j+1)+'
'; }