ProductRnR

Marks a default radio button depending on the HIT.

Stan na 18-10-2015. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         ProductRnR
// @namespace    https://greasyfork.org/users/11580
// @version      1.5.1
// @description  Marks a default radio button depending on the HIT.
// @author       Kadauchi
// @include      https://www.mturkcontent.com/dynamic/*
// @grant        GM_log
// @require      http://code.jquery.com/jquery-2.1.4.min.js
// ==/UserScript==

// Marks radio buttons.
$(".label.nal").click();
$("input[value='notadult']").click(); // Marks Non-Adult.

// Checks to see if we are on Label images based on their relevance for the query.
if ($("b:contains(Unrelated/Only Indirectly Related)").length){
	ProductRnR_Relevance_Query();
}

function ProductRnR_Relevance_Query(){
	$(":radio").on('change',function(){
		$(this).next(":contains(Related)").parent().parent().css("opacity", "1").css({ backgroundColor: "lightgreen", opacity: "1"});
		$(this).next(":contains(Unrelated/Indirectly Related)").parent().parent().css("opacity", "1").css({ backgroundColor: "red", opacity: "1"});
		$(this).next(":contains(Image didn't load)").parent().parent().css({ backgroundColor: "", opacity: "0.1"});
	});
	$("input[value='QueryImage_Unrelated']").prop("checked", true).change();
	$("img").click(function(e){e.preventDefault();});
	$(".documentbox").click(function(e){
		if($(this).find("input:radio:checked").next(":contains(Related):not(:contains('Unrelated'))").length > 0){
			$(this).find("input[value='QueryImage_Unrelated']").prop("checked", true).change();return false;
		}
		if($(this).find("input:radio:checked").next(":contains(Image didn't load)").length > 0){
			$(this).find("input[value='QueryImage_Related']").prop("checked", true).change();return false;
		}
		if($(this).find("input:radio:checked").next(":contains(Unrelated/Indirectly Related)").length > 0){
			$(this).find("input[value='NoLoad']").prop("checked", true).change();return false;
		}
	});
	$("img").error(function(){
		$(this).parents(".documentbox").find("input[value='NoLoad']").prop("checked", true).change();
	});
}

// Enter will sunmit the HIT.
window.onkeydown = function(event) {
	if (event.keyCode === 13) {
		$("button[name='SubmitButton']").click();
	}
};