Instructions Hider Jason Daly

Toggles instructions for Jason Daly hits

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name       Instructions Hider Jason Daly
// @version    0.1
// @description  Toggles instructions for Jason Daly hits
// @match      https://www.mturkcontent.com/dynamic/hit*
// @copyright  2014+, Tjololo
// @namespace https://greasyfork.org/users/710
// ==/UserScript==

if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
    this.GM_getValue=function (key,def) {
        return localStorage[key] || def;
        };
    this.GM_setValue=function (key,value) {
        return localStorage[key]=value;
        };
    this.GM_deleteValue = function(key) {
        return localStorage.removeItem(key);
    };
}

if (document.getElementsByClassName("panel panel-primary")[0]){
    container = document.createElement("div");
    link = document.createElement("a");
    link.innerHTML = " Click to hide instructions";
    link.style.color="white";
    link.addEventListener("click", function(){
        toggle();
    }, false);
    link.setAttribute("id","displayText");
    document.getElementsByClassName("panel-heading")[0].appendChild(link);
    
    div = document.getElementsByClassName("panel-body")[0];
    div.setAttribute("id","instructions");
    
    if (GM_getValue("IsVisible")){
        document.getElementsByClassName("panel-body")[0].style.display='none';
    }
}

function toggle() {
	var ele = document.getElementById("instructions");
	var text = document.getElementById("displayText");
	if(ele.style.display != "none") {
    	ele.style.display = "none";
		text.innerHTML = " Click to show instructions";
        GM_setValue("IsVisible",1);
  	}
	else {
        GM_deleteValue("IsVisible");
		ele.style.display = "block";
		text.innerHTML = " Click to hide instructions";
	}
}