Warning: fopen(/www/sites/update.greasyfork.icu/index/store/temp/03e5c25e0bdb1c580d3c4c50c414925d.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript==
// @id Hit_Availability
// @name Discover Fake Availabilities
// @version 1.0
// @namespace
// @author TachisAlopex
// @include https://www.mturk.com/mturk/*
// @run-at document-end
// @description Often times you open a hit to find there is no more hits available, even though MTurk reports that there is some left. This script discovers and lets you know
// @downloadURL https://update.greasyfork.icu/scripts/6157/Discover%20Fake%20Availabilities.user.js
// @updateURL https://update.greasyfork.icu/scripts/6157/Discover%20Fake%20Availabilities.meta.js
// ==/UserScript==
/// Built using Turkopticon X's code, striping it and moding it
var TURKOPTICON = "http://turkopticon.differenceengines.com/";
function insertAttrsHTML(n, result) {
var parent = n.parentNode;
if (result > 0) {
if (result == 1) {
stuff = "☑ ";
} else {
stuff = "☒ ";
n.style.color = "red";
}
} else {
stuff += "E";
}
var pie = parent.getElementsByTagName("img")[0];
pie.parentNode.removeChild(pie);
n.innerHTML = stuff + n.innerHTML;
}
//moded
function getHitName(n) {
var href = n.getAttribute('href');
if (href==null) return "";
var splitArr = href.split("groupId=");
if (splitArr.length == 1) {
return '';
} else {
return splitArr[1].split("&")[0];
}
}
//left alone
function insertPie(n) {
var parent = n.parentNode;
var pie = "
";
parent.innerHTML = pie + parent.innerHTML;
}
//greatly moded
function parseAndInsert(n) {
GM_xmlhttpRequest(
{method: 'GET',
url: n.href,
onload: function(results, numReports, numUsers) {
result = 0; // result
r = results.responseText;
if (r != "null") {
var splitArr = r.split('alertboxHeader">');
if(splitArr.length == 2) {
result = 2; //hits all out
} else {
result = 1; //all fine
}
} else {
result = -1; //error
}
insertAttrsHTML(n, result);
}
});
}
//moded (names only)
function getHitAnchors() {
var anchors = document.getElementsByTagName("a");
var hitAnchors = new Array;
for (var i = 0; i < anchors.length; i++) {
if (getHitName(anchors[i]) != "") {
hitAnchors.push(anchors[i]);
}
}
return hitAnchors;
}
//============================== Modded (name only (and removed some checks))
var hitAnchors = getHitAnchors();
for (var i = 0; i < hitAnchors.length; i++) {
insertPie(hitAnchors[i]);
}
var hitAnchors = getHitAnchors();
for (var k = 0; k < hitAnchors.length; k++) {
setTimeout(
(function(k) {
return function()
{
parseAndInsert(hitAnchors[k]);
};
}
)
(k), 500*k); //need to add a delay so people won't get a maximum refresh rate message
}