Warning: fopen(/www/sites/update.greasyfork.icu/index/store/temp/3b1e09a262fe11b4ad0e76d58e831f2c.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript==
// @name General: Requester ID
// @description Displays the Requester ID in the dashboard and HIT search.
// @include https://www.mturk.com/mturk/statusdetail*
// @include http://*.mturk.com/*
// @include https://*.mturk.com/*
// @version 1
// @namespace https://greasyfork.org/users/6438
// @downloadURL https://update.greasyfork.icu/scripts/6145/General%3A%20Requester%20ID.user.js
// @updateURL https://update.greasyfork.icu/scripts/6145/General%3A%20Requester%20ID.meta.js
// ==/UserScript==
function getFirstRequesterAnchor(str) {
var ra = getRequesterAnchors();
for (var i = 0; i < ra.length; i++) {
if (ra[i].href.match(str)) {
return ra[i];
}
}
return null;
}
function insertAttrsHTML(n,requesterID) {
var parent = n.parentNode;
if (parent!=null) {
var stuff = "
";
stuff += requesterID;
parent.innerHTML = parent.innerHTML + stuff;
}
}
function parseAndInsert(n,k) {
var requesterID = requesterIds[k];
insertAttrsHTML(n, requesterID);
}
function getRequesterAnchors() {
var anchors = document.getElementsByTagName("a");
var requesterAnchors = new Array;
for (var i = 0; i < anchors.length; i++) {
var href = anchors[i].getAttribute('href');
if (href!=null) {
if ((href.match("requesterId")) && !(anchors[i].innerHTML.match("Contact the Requester of this HIT")) && !(href.match("signature")) || ((href.match("requesterId") && (window.location.toString().match("statusdetail"))))) {
requesterAnchors.push(anchors[i]);
}
}
}
return requesterAnchors;
}
function getRequesterList() {
var anchors = document.getElementsByTagName("a");
for (var i = 0; i < anchors.length; i++) {
var href = anchors[i].getAttribute('href');
if (anchors[i].innerHTML.match("Contact the Requester of this HIT")) {
// just in case Amazon switches page, want to die nicely.
try {
requesterIds.push(href.split("requesterId=")[1].split("&")[0]);
} catch(err) {
}
}
var title= anchors[i].getAttribute('title');
if (title==null) title="";
if ((window.location.toString().match("statusdetail")) && (title=="Contact this Requester")) {
// just in case Amazon switches page, want to die nicely.
try {
requesterIds.push(href.split("requesterId=")[1].split("&")[0]);
} catch(err) {
}
}
}
}
function getCurrentHIT() {
var curRequesterId=getRequesterId();
if (curRequesterId!=null) {
requesterIds.push(curRequesterId);
}
}
function getLocationData(str) {
var location = window.location.toString();
var splitArr = location.split(str+"=");
if (splitArr.length == 1) return "";
return splitArr[1].split("&")[0];
}
function getRequesterId() {
var requesterId=getLocationData('requesterId');
if (requesterId!=null && requesterId!="") return requesterId;
var forms = document.getElementsByTagName("FORM");
for (var i=0; i