您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Always "Show all details" on Amazon Mechanical Turk search pages.
// ==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 // ==/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. * <script type="text/javascript" > document.write('<div style="text-align: center;" valign="bottom" nowrap><a id="expandall" class="footer_links" href="#">Show all details</a>' + ' <font color="#9ab8ef">|</font> ' + '<a id="collapseall" class="footer_links" href="#">Hide all details</a></div>'); </script> * */ 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 = /<span class="capsulelink">/; // 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 <span class="capsulelink">)? // 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); } }