HIT Area Expander (with compact interface mod)

Adds a button to change the height of the working area for the hit.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name          HIT Area Expander (with compact interface mod)
// @author        unknown + clickhappier
// @namespace     clickhappier
// @version       0.1c
// @description   Adds a button to change the height of the working area for the hit.
// @include       https://www.mturk.com/mturk/preview*
// @include       https://www.mturk.com/mturk/continue*
// @include       https://www.mturk.com/mturk/accept*
// @include       https://www.mturk.com/mturk/submit
// @include       https://www.mturk.com/mturk/return*
// ==/UserScript==

// modified by clickhappier to remove line break between input field and button,
// set input field size, and change button text from "Expand" to ">";
// all to make it fit on 1 line within the width of the 'Requester' cell

var Page_Status = document.forms[1].action;

insertButton();
changeHeight();

function insertAfter(referenceNode, newNode) {
    referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}

function changeHeight() {
	var iframes = document.getElementsByTagName('iframe');
	var height = document.getElementById("new_size").value;
	for(var i = 0; i < iframes.length; i++) {
		iframes[i].height = height;
	}
}

function insertButton() {
	var firstElement = document.getElementById("requester.tooltip").parentNode;

	var button = document.createElement("div");
	button.innerHTML = 'New Height: <input type="number" name="new_size" id="new_size" value="1200" size="4"><button id="sizeChange" type="Button">&gt;</button>';
	button.setAttribute('id','buttonContainer');

	firstElement.appendChild(button);

	document.getElementById('sizeChange').addEventListener("click",changeHeight);
}