Warning: fopen(/www/sites/update.greasyfork.icu/index/store/temp/618dfc2e20f8360bac9617a7846bf694.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript==
// @name Amazon's Mechanical Turk: Always Show All Details
// @author David Shumway
// @description Always "Show all details" on Amazon Mechanical Turk search pages.
// @include https://www.mturk.com/mturk/*
// @version 1
// @namespace https://greasyfork.org/users/5267
// @downloadURL https://update.greasyfork.icu/scripts/5017/Amazon%27s%20Mechanical%20Turk%3A%20Always%20Show%20All%20Details.user.js
// @updateURL https://update.greasyfork.icu/scripts/5017/Amazon%27s%20Mechanical%20Turk%3A%20Always%20Show%20All%20Details.meta.js
// ==/UserScript==
// Copyright 2013 David Shumway.
/**
*
* This is the relevant part of the search pages, regarding the Show all details button.
* The Javascript handler for expand/collapse is at https://www.mturk.com/js/expandcollapse.js.
*
*
*/
var term;
var interval;
var interval_amount;
var maxTimeToWaitFor_ShowAllDetails;
var date_start;
var date_now;
var link_expandall;
interval_amount = 400; // in milliseconds
maxTimeToWaitFor_ShowAllDetails = 6; // in seconds
date_start = new Date(); // start date of this script
date_start = date_start.getTime() / 1000; // in seconds
// The text in the page that is present when "Show all details" is present.
// The text that seems to only be on search pages (is 100% true?).
term = //;
// Wait for the document
if (document.readyState == "complete" || document.readyState == "interactive") {
load();
}
else {
document.onreadystatechange = function () {
if (document.readyState == "complete" || document.readyState == "interactive") {
load();
}
}
}
// load
function load() {
// Is this a search page (i.e. a page that has )?
// Otherwise we are done here.
// I.e., does not waste any more resources at this point.
if (term.exec(document.body.innerHTML)) {
// Wait for just a moment if expandall link is being created.
// But only just a moment. After that just give up.
var interval = window.setInterval(function() {
// Link expandall
link_expandall = document.getElementById('expandall');
// If link exists
if (link_expandall) {
// Clear the watch interval
clearInterval(interval);
// Click expand all link
link_expandall.click();
} else { // give up?
date_now = new Date();
date_now = date_now/1000; // in seconds
// Has max time to wait elapsed?
// Not very likely that this will ever occur!
if (date_now - date_start > maxTimeToWaitFor_ShowAllDetails) {
// Exit
clearInterval(interval);
}
}
}, interval_amount);
}
}