Warning: fopen(/www/sites/update.greasyfork.icu/index/store/temp/e79fe6ab2651c92b4ba64c213d04963f.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 Helper // @version 0.3.15 // @namespace https://greasyfork.org/users/6406 // @description A script add on for Panda Crazy sending commands to main script. // @author (JohnnyRS on mturkcrowd.com and mturkgrind.com) johnnyrs@allbyjohn.com // @include http*://worker.mturk.com/* // @include http*://*mturkcrowd.com/threads/* // @include http*://*turkerview.com/threads/* // @include http*://*mturkforum.com/showthread* // @include http*://*mturkforum.com/*threads/* // @include http*://*hitnotifier.com/* // @include http*://www.reddit.com/r/HITsWorthTurkingFor* // @exclude http*://*mturk.com/mturk/findhits?*hit_scraper* // @require http://code.jquery.com/jquery-2.1.4.min.js // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue // @downloadURL https://update.greasyfork.icu/scripts/20380/JR%20Mturk%20Panda%20Crazy%20Helper.user.js // @updateURL https://update.greasyfork.icu/scripts/20380/JR%20Mturk%20Panda%20Crazy%20Helper.meta.js // ==/UserScript== var gScriptVersion = "0.3.15"; var gScriptName = "pandacrazy"; var gLocation = window.location.href, gNewSite=false, gHitNotifier; var gConstantSearch = null; 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 createMessageData(command,data) { return {"time":(new Date().getTime()),"command":command,"data":data}; } function sendCommandMessage(data) { localStorage.setItem("JR_message_" + gScriptName, JSON.stringify(data)); } function createQueueData(length) { return {"queueLength":length}; } function createProjectedData(earnings) { return {"projectedEarnings":earnings}; } function createJobData(jobData) { return {"groupId":jobData.groupId,"title":jobData.title,"requesterName":jobData.requesterName,"requesterId":jobData.requesterId, "pay":jobData.pay,"duration":jobData.duration,"hitsAvailable":jobData.hitsAvailable}; } function setAttributes(el, attrs) { for (var key in attrs) { el.setAttribute(key, attrs[key]); } } function elementInit(theElement,theClass,theText,theStyle) { if (theClass) theElement.className = theClass; if (theText) theElement.textContent = theText; if (theStyle) theElement.style = theStyle; return theElement; } function createSpan(theClass,theText,theStyle) { var span = document.createElement("span"); return elementInit(span,theClass,theText,theStyle); } function createSpanButton(toDo,theClass,theText,theBackgroundColor,theColor,theFontSize,addStyle) { var backgroundColor = (typeof theBackgroundColor != 'undefined') ? theBackgroundColor : "initial"; var textColor = (typeof theColor != 'undefined') ? theColor : "initial", fontSize = (typeof theFontSize != 'undefined') ? theFontSize : "9px"; var theButton = createSpan("nonselectable " + theClass,theText,"font-size:" + fontSize + "; padding:0px 2px; background-color:" + backgroundColor + "; color:" + textColor + "; border:2px groove darkgrey; cursor:default; margin:0px 1px;" + addStyle); if (toDo) theButton.addEventListener("click", function (e) { toDo(e); }); return theButton; } function speakThisNow(thisText) { if('speechSynthesis' in window){ var speech = new SpeechSynthesisUtterance(thisText); speech.lang = 'en-US'; window.speechSynthesis.speak(speech); } } function locationForums() { if (gLocation.match(/.*(mturkcrowd|turkerview|mturkforum|reddit)\.com.*/)!==null) return true; else return false; } 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",false); 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 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 sendMessageData(command,theData) { var messageData = createMessageData(command,theData); sendCommandMessage(messageData); } function sendQueueData(queueLength) { sendMessageData("queueData",createQueueData(queueLength)); } function sendProjectedData(projectedEarnings) { sendMessageData("projectedEarnings",createProjectedData(projectedEarnings)); } function sendJobData(jobData) { sendMessageData("addJob",createJobData(jobData)); } function sendJobOnceData(jobData) { sendMessageData("addOnceJob",createJobData(jobData)); } function sendJobSearchData(jobData) { sendMessageData("addSearchJob",createJobData(jobData)); } function sendPingMessage() { localStorage.setItem("JR_message_ping_" + gScriptName, JSON.stringify({"command":"areYouThere","time":(new Date().getTime())})); } function appendPandaButtons(element,jobData) { $(element).append($("").css({"font-size":"9px"}).html("Add: ") .append($("