Mturk Expired-Queue-HIT-Death-Loop Rescuer

Redirects to queue view on expired queue HIT and continues on HITs with more time remaining

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Mturk Expired-Queue-HIT-Death-Loop Rescuer
// @description Redirects to queue view on expired queue HIT and continues on HITs with more time remaining
// @author      DCI
// @version     1.0
// @namespace   www.redpandanetwork.org
// @include     https://www.mturk.com/mturk/myhits?ExpiredRedirect
// @include     https://www.mturk.com/mturk/preview?isPreviousHitExpired*
// @exclude     https://www.mturk.com/mturk/*&groupId*
// ==/UserScript==

// This script will redirect you to your queue view page when a queued HIT you are working on expires.
// You will then be redirected to the first HIT in your queue that meets the minimum time remaining requirement.
// MinimumTime is in seconds but can be set to a number greater than 60.
var MinimumTime = 30;


if (window.location.toString().indexOf('preview?isPreviousHitExpired') !== -1){
	window.location.replace("https://www.mturk.com/mturk/myhits?ExpiredRedirect");
}

if (window.location.toString() === "https://www.mturk.com/mturk/myhits?ExpiredRedirect"){
	var hit_capsules = document.getElementsByTagName('tbody')[6].children;
	for (f = 0; f < hit_capsules.length; f++){	
		var timer = hit_capsules[f].getElementsByClassName('capsule_field_text')[2].innerHTML;
		var hastime = hit_capsules[f].getElementsByTagName('a')[2].href;		
		if (hit_capsules[f].innerHTML.indexOf('minute') !== -1){
			var minutes = parseInt(timer.split('minutes')[0].trim());
			var seconds = parseInt(timer.split('minutes')[1].split('seconds')[0].trim());
			var remaining = (minutes * 60) + seconds;
			if (remaining >= MinimumTime){
				window.location.replace(hastime);
			}
		}
		else {
			if (hit_capsules[f].innerHTML.indexOf('seconds') !== -1){
				var seconds = parseInt(timer.split('seconds')[0].trim()); 
				if (seconds >= MinimumTime){
					window.location.replace(hastime);
				}
			}				
		}	
	}	
}