Warning: fopen(/www/sites/update.greasyfork.icu/index/store/temp/fa173efd74c2b83abadd675f87733b7a.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript== // @name mTurk HITs Accepted on Dashboard // @namespace http://ericfraze.com // @version 0.2 // @description This script is for mTurk. Shows the number of hits you have accepted and lists the first page of them on your dashboard. // @author Eric Fraze // @match https://www.mturk.com/mturk/* // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js // @downloadURL https://update.greasyfork.icu/scripts/5911/mTurk%20HITs%20Accepted%20on%20Dashboard.user.js // @updateURL https://update.greasyfork.icu/scripts/5911/mTurk%20HITs%20Accepted%20on%20Dashboard.meta.js // ==/UserScript== var hitsAssigned = "N/A (there was an error or something, contact Magnilucent if it happens a lot)"; var hitString = ""; var title = []; var requester = []; var pay = []; var timeLeft = []; var returnURL = []; var continueURL = []; // Make sure we are on the dashboard of mTurk.com if ( url.indexOf("dashboard") !== -1 ) { // Send an AJAX request to the HITs accepted list $.ajax({ url: "https://www.mturk.com/mturk/myhits", dataType: "html", success: function(data) { // Check to see if any HITs are assigned if ( $("td:contains('There are currently no HITs assigned to you.')", data).length ) { hitsAssigned = 0; }else{ // Get the text that holds the HITs assigned number var text = $("td.title_orange_text[style='white-space: nowrap; padding-top: 1ex;']", data).text(); // Regex to select the number in the string var regstring = /(\d{1,2})(\sResults)/; var reg = new RegExp(regstring); var groups = reg.exec(text); // Get the number hitsAssigned = groups[1]; // Begining of the table used to display the HITs hitString = '' + '' + '' + '' + '' + '' + '' + ''; // Loop through each HIT on this page $('table[width="100%"][height="100%"]', data).each( function(i) { title[i] = $(this).find("a.capsulelink[href='#']").text().trim(); requester[i] = $(this).find(".requesterIdentity").text() pay[i] = $(this).find(".reward").text() timeLeft[i] = $(this).find("td[width='25%'] td.capsule_field_text").text().trim(); // sign is used to alterate the row backgrounds var sign = "odd" if ( ((i + 1)/2) == Math.round((i + 1)/2) ) sign = 'even'; // Shorten the time left string timeLeft[i] = timeLeft[i].replace(" minutes", "m").replace(" seconds", "s");; // Construct the return link for this HIT returnURL[i] = $(this).find("a[href^='/mturk/return']").attr("href"); // Construct the continue link for this HT continueURL[i] = $(this).find("a[href^='/mturk/continue']").attr("href"); // Add the HIT to the table hitString += '' + '' + '' + '' + '' + '' + ''; }); // End loop // Close the table hitString += '
' + 'Title' + '' + 'Requester' + '' + 'Reward' + '' + 'Time Left' + '' + 'Return' + '
' + (title[i].length > 60 ? title[i].substring(0, 60 - 3) + '...' : title[i]) + '' + (requester[i].length > 15 ? requester[i].substring(0, 15 - 3) + '...' : requester[i]) + '' + pay[i] + '' + timeLeft[i] + 'Return
'; } // Add the number and table to the page addHitNumber(); } }); } $(document).ready(function() { if ( $("td:contains('Your HIT Status')").length ) { // Add the number and table to the page addHitNumber(); } }); function addHitNumber() { // If the table hasn't been added if ( !$("#HITNumber").length ){ // Add the table and add content $("td:contains('Your HIT Status')").parents("table").before('
HITs Assigned to You (' + hitsAssigned + ')
'); $("#HITInfo").append(hitString); }else{ // Update table content $("#HITNumber").text(hitsAssigned); $("#HITInfo").empty(); $("#HITInfo").append(hitString); } }