Instructions Hider Jason Daly

Toggles instructions for Jason Daly hits

  1. // ==UserScript==
  2. // @name Instructions Hider Jason Daly
  3. // @version 0.1
  4. // @description Toggles instructions for Jason Daly hits
  5. // @match https://www.mturkcontent.com/dynamic/hit*
  6. // @copyright 2014+, Tjololo
  7. // @namespace https://greasyfork.org/users/710
  8. // ==/UserScript==
  9.  
  10. if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
  11. this.GM_getValue=function (key,def) {
  12. return localStorage[key] || def;
  13. };
  14. this.GM_setValue=function (key,value) {
  15. return localStorage[key]=value;
  16. };
  17. this.GM_deleteValue = function(key) {
  18. return localStorage.removeItem(key);
  19. };
  20. }
  21.  
  22. if (document.getElementsByClassName("panel panel-primary")[0]){
  23. container = document.createElement("div");
  24. link = document.createElement("a");
  25. link.innerHTML = " Click to hide instructions";
  26. link.style.color="white";
  27. link.addEventListener("click", function(){
  28. toggle();
  29. }, false);
  30. link.setAttribute("id","displayText");
  31. document.getElementsByClassName("panel-heading")[0].appendChild(link);
  32. div = document.getElementsByClassName("panel-body")[0];
  33. div.setAttribute("id","instructions");
  34. if (GM_getValue("IsVisible")){
  35. document.getElementsByClassName("panel-body")[0].style.display='none';
  36. }
  37. }
  38.  
  39. function toggle() {
  40. var ele = document.getElementById("instructions");
  41. var text = document.getElementById("displayText");
  42. if(ele.style.display != "none") {
  43. ele.style.display = "none";
  44. text.innerHTML = " Click to show instructions";
  45. GM_setValue("IsVisible",1);
  46. }
  47. else {
  48. GM_deleteValue("IsVisible");
  49. ele.style.display = "block";
  50. text.innerHTML = " Click to hide instructions";
  51. }
  52. }