Warning: fopen(/www/sites/update.greasyfork.icu/index/store/temp/e635e209e80126edc8c05391b9e7b8f1.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript== // @name JR Mturk Panda Crazy Queue Helper // @version 0.3.10 // @namespace https://greasyfork.org/users/6406 // @description A script add on for Panda Crazy for displaying queue and sorting queue after submitting hits. // @author (JohnnyRS on mturkcrowd.com and mturkgrind.com) johnnyrs@allbyjohn.com // @include http*://worker.mturk.com/* // @require http://code.jquery.com/jquery-2.1.4.min.js // @grant GM_xmlhttpRequest // @grant GM_getValue // @grant GM_setValue // @downloadURL https://update.greasyfork.icu/scripts/23239/JR%20Mturk%20Panda%20Crazy%20Queue%20Helper.user.js // @updateURL https://update.greasyfork.icu/scripts/23239/JR%20Mturk%20Panda%20Crazy%20Queue%20Helper.meta.js // ==/UserScript== var gScriptVersion="0.3.10", gQueueHelperFormat2 = true, gFromQueue = false; var gScriptName="pandacrazy", gScriptID="PQ35"; var gLocation=window.location.href, gPrevHit="", gPrevTitle=""; var gPandaCrazyLives=false, gHitExternalNextLink="", gHitExternalNextAcceptLink="", gTitle="", gNewSite=true; var gPandaCrazyVersion=-1, gHitReturnLink="", gThisJob=null, gNoHits=false, gButtonSet=false, gRequesterName=""; var gQueueData=[], gPE=0, gTabTextMode=0, gTabTextTimer=0, gOriginalTitle=document.title, gCurrentPostion = 0, gQueueNextHit=null; var gSubmitHitID="", gReturnedHitID="", gGroupId=""; // previous hitID submitted or returned just to be sure it doesn't get redone. var gCorrectVersion=false, gFirstChange=false, gQueueSessOptions=null, gSubmitButton=null, gHitId="", gIdNum=-1, gTabHitIds={}, gAssignmentId = ""; var gThisTarget=""; // target ID from the time to distinguish different scripts and tabs. var gTabTarget={"tabId":Math.floor(new Date().getTime() / 100), "scriptID":gScriptID}; // target ID from the time to distinguish different scripts and tabs. var gThisId=-1; // ID number to represent the id in the Panda Crazy external data number ID just for separating messages. var gQueueSessOptionsDef={"nextPosition":"--","nextIsLast":false,"nextIsSame":false,"tabNum":-1,"nextMonitor":false}; var gQueueLocalOptionsDef={"displayTabTitleQ":true,"displayTabTitleTime":true,"displayTabTitleName":true,"displayTabTitleToggle":false,"toggleTime":4000}; var gJobDataDefault = {"requesterName":"","requesterId":"","groupId":"","pay":"","title":"","duration":"0","hitsAvailable":0,"timeLeft":"","totalSeconds":0,"hitId":"", "qual":"","continueURL":"","returnURL":"","durationParsed":{},"jobNumber":"-1","friendlyRName":"","friendlyTitle":"","assignedOn":"","description":"", "keywords":"","timeData":{},"assignmentID":"","hitSetID":"","secondsOff":-1,"goHam":false}; function speakThisNow(thisText) { if('speechSynthesis' in window){ var speech = new SpeechSynthesisUtterance(thisText); speech.lang = 'en-US'; window.speechSynthesis.speak(speech); } } function formatAMPM(theFormat,theDate,theTimeZone) { var d = (theDate) ? theDate : new Date(); if (theTimeZone == "mturk") { var mturkTZOffset = -8, today = new Date(); if (today.dst()) mturkTZOffset++; var utc = d.getTime() + (d.getTimezoneOffset() * 60000), MturkTime = utc + (3600000 * mturkTZOffset); d = new Date(MturkTime); } var minutes = d.getMinutes().toString().length == 1 ? '0'+d.getMinutes() : d.getMinutes(), hours = d.getHours(), ampm = hours >= 12 ? 'pm' : 'am', months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'], days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; hours = (hours>= 12) ? (hours-12) : hours; hours = (hours.toString().length == 1) ? '0'+hours : hours; if (theFormat=="short") return ('0' + (d.getMonth()+1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + '-' + d.getFullYear() + '(' + hours + ':' + minutes + ampm + ')'; else if (theFormat=="dayandtime") return days[d.getDay()] + ' ' + hours + ':' + minutes + ampm; else if (theFormat=="onlydate") return ('0' + (d.getMonth()+1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + '-' + d.getFullYear(); else return days[d.getDay()]+' '+months[d.getMonth()]+' '+d.getDate()+' '+d.getFullYear()+' '+hours+':'+minutes+ampm; } function formatTimeZone(theFormat,theDate,theTimeZone) { return formatAMPM(theFormat,theDate,theTimeZone); } function getTimeLeft(theTime) { if (theTime!==null && theTime!=="") { var tempArray = (theTime.indexOf("second") != -1) ? theTime.split("second")[0].trim().split(" ") : null; var seconds = (tempArray) ? parseInt(tempArray[tempArray.length-1]) : 0; tempArray = (theTime.indexOf("minute") != -1) ? theTime.split("minute")[0].trim().split(" ") : null; var minutes = (tempArray) ? parseInt(tempArray[tempArray.length-1]) : 0; tempArray = (theTime.indexOf("hour") != -1) ? theTime.split("hour")[0].trim().split(" ") : null; var hours = (tempArray) ? parseInt(tempArray[tempArray.length-1]) : 0; tempArray = (theTime.indexOf("day") != -1) ? theTime.split("day")[0].trim().split(" ") : null; var days = (tempArray) ? parseInt(tempArray[tempArray.length-1]) : 0; tempArray = (theTime.indexOf("week") != -1) ? theTime.split("week")[0].trim().split(" ") : null; var weeks = (tempArray) ? parseInt(tempArray[tempArray.length-1]) : 0; return( {"weeks":weeks,"days":days,"hours":hours,"minutes":minutes,"seconds":seconds} ); } else return null; } function formatTimeLeft(resetNow,thisDigit,timeString,lastDigit) { formatTimeLeft.timeFill = formatTimeLeft.timeFill || 0; if (resetNow) formatTimeLeft.timeFill = 0; var missingDigit = (lastDigit!="0" && thisDigit=="0") ? true : false; if (( thisDigit!="0" || missingDigit) && formatTimeLeft.timeFill<2) { formatTimeLeft.timeFill++; if (missingDigit) { return "00 " + timeString + "s"; } else { var addZero = (thisDigit<10) ? ((formatTimeLeft.timeFill==1) ? false : true) : false, plural = (thisDigit==1) ? false : true; return ((addZero) ? "0" : "") + thisDigit + " " + ((plural) ? (timeString+"s") : timeString) + " "; } } else return ""; } function convertToTimeString(timeData) { var returnString = ""; returnString += formatTimeLeft(true,timeData.weeks,"week","0"); returnString += formatTimeLeft(false,timeData.days,"day",timeData.weeks); returnString += formatTimeLeft(false,timeData.hours,"hour",timeData.days); returnString += formatTimeLeft(false,timeData.minutes,"minute",timeData.hours); returnString += formatTimeLeft(false,timeData.seconds,"second",timeData.minutes); return returnString.trim(); } function convertTimeToSeconds(timeData) { var totalSeconds = timeData.seconds + ((timeData.minutes) ? (timeData.minutes*60) : 0) + ((timeData.hours) ? (timeData.hours*3600) : 0) + ((timeData.days) ? (timeData.days*86400) : 0) + ((timeData.weeks) ? (timeData.weeks*604800) : 0); return totalSeconds; } function convertSecondsToTimeData(seconds) { var timeData = {}; timeData.weeks = Math.floor(seconds/604800); seconds = seconds - (timeData.weeks*604800); timeData.days = Math.floor(seconds/86400); seconds = seconds - (timeData.days*86400); timeData.hours = Math.floor(seconds/3600); seconds = seconds - (timeData.hours*3600); timeData.minutes = Math.floor(seconds/60); seconds = seconds - (timeData.minutes*60); timeData.seconds = seconds; return timeData; } function continueLink(theHitId) { return "https://www.mturk.com/mturk/continue?hitId=" + theHitId; } function returnLink(theHitId) { return "https://www.mturk.com/mturk/return?hitId=" + theHitId + "&inPipeline=false"; } function convertToSeconds(milliseconds,fixed) { fixed = fixed || 2; var seconds = parseFloat((milliseconds/1000.0 * 100) / 100).toFixed(fixed) + ""; return seconds.replace(/\.0*$/,""); } function convertToMilliseconds(seconds) { if (seconds) return seconds*1000 + ""; else return "0"; } function createDiv(theHtml) { var inner = (theHtml) ? theHtml : ""; return $('
').html(inner); } function createSpan(theHtml) { var inner = (theHtml) ? theHtml : ""; return $('').html(inner); } function createButton(theText) { var inner = (theText) ? theText : ""; return $('