Mturk ID Copy/Paste

For Amazon Mechanical Turk (Mturk). Places an unobtrusive button on survey pages which provides quick access to copy your mTurk worker ID by copy and paste or drag and drop. This is the UPDATED version of Tjololo's earlier work.

  1. // ==UserScript==
  2. // @name Mturk ID Copy/Paste
  3. // @author Swole_hamster
  4. // @license Simplified BSD license
  5. // @icon http://icons.iconarchive.com/icons/flameia/rabbit-xp/32/documents-icon.png
  6. // @version 2.94
  7. // @namespace http://www.mturkforum.com
  8. // @description For Amazon Mechanical Turk (Mturk). Places an unobtrusive button on survey pages which provides quick access to copy your mTurk worker ID by copy and paste or drag and drop. This is the UPDATED version of Tjololo's earlier work.
  9. // @include https://www.mturk.com/mturk/dashboard
  10. // @include http://*.qualtrics.com/*
  11. // @include https://*.qualtrics.com/*
  12. // @include https://*.*.qualtrics.com/*
  13. // @include http://*.*.qualtrics.com/*
  14. // @include http://*.surveygizmo.com/*
  15. // @include https://*.surveygizmo.com/*
  16. // @include https://docs.google.com/forms/*
  17. // @include https://*.surveymonkey.com/*
  18. // @include https://*.vennliapp.com/*
  19. // @include https://*.*.*.de/*
  20. // @include http://*.*.*.de/*
  21. // @include https://*.*.de/*
  22. // @include http://*.*.de/*
  23. // @include https://*.de/*
  24. // @include http://*.de/*
  25. // @include http://*.*.*.edu/*
  26. // @include https://*.*.*.edu/*
  27. // @include http://*.*.edu/*
  28. // @include https://*.*.edu/*
  29. // @include http://*.*.*.ca/*
  30. // @include https://*.*.*.ca/*
  31. // @include http://*.*.ca/*
  32. // @include https://*.*.ca/*
  33. // @include http://www.marshlabduke.com/*
  34. // @include https://*.typeform.com/*
  35. // @include http://surveys*.surveyanalytics.com/*
  36. // @include http://*.cspurdue.com/*
  37. // @include http://questionpro.com/*
  38. // @include https://questionpro.com/*
  39. // @include https://*.kwiksurveys.com/*
  40. // @include https://*.wonderliconline.com/*
  41. // @include http://*.lab42.com/*
  42. // @include http://turkitron.com/*
  43. // @include http://sgiz.mobi/*
  44. // @include http://www.consumerbehaviorlab.com/*
  45. // @include https://www.psychdata.com/*
  46. // @include https://*.*.*.ac.uk/*
  47. // @include https://*.*.ac.uk/*
  48. // @include http://*.*.*.ac.uk/*
  49. // @include http://*.*.ac.uk/*
  50. // @include http://survey.psy.unipd.it/*
  51. // @include https://www.predikkta.com/*
  52. // @include https://*.userzoom.com/*
  53. // @include https://www.vopspsy.ugent.be/*
  54. // @include http://crsi.byethost33.com/*
  55. // @include https://www.psychdata.com/*
  56. // @include http://hospitalityexperiments.net/*
  57. // @include http://www.dise-online.net/*
  58. // @include https://www.descil.ethz.ch/apps/mturk/*
  59. // @include https://www.tfaforms.com/*
  60. // @include https://*.shinyapps.io/*
  61. // @include https://mutual-science.org/*
  62. // @include http://*/TurkGate/*
  63. // @include http://jbfreeman.net/webmt/*
  64. // @include http://*.fluidsurveys.com/*
  65. // @include https://gate.aon.com/*
  66. // @include https://www.cvent.com/Surveys/*
  67. // @include http://*/limesurvey/*
  68. // @include http://www.ets-research.org/*
  69. // @include https://www.psychsurveys.org/*
  70. // @include https://*.herokuapp.com/*
  71. // @include https://*.wufoo.com/*
  72. // @grant GM_setValue
  73. // @grant GM_getValue
  74. // @grant GM_registerMenuCommand
  75. // ==/UserScript==
  76.  
  77. $ = unsafeWindow.$;
  78.  
  79.  
  80. workerID = GM_getValue("workerID");
  81. if(!workerID || workerID === "") {
  82. if (window.location.href == "https://www.mturk.com/mturk/dashboard") {
  83. workerIDNode = document.evaluate("//span[@class='orange_text_right']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
  84. for (i=0; i<workerIDNode.snapshotLength; i++) {
  85. nd = workerIDNode.snapshotItem(i);
  86. idstring = nd.innerHTML;
  87. workerID = idstring.split(': ')[1];
  88. GM_setValue("workerID",workerID);
  89. }
  90. } else {
  91. workerID="";
  92. GM_setValue("workerID","");
  93. }
  94. } else {
  95. if (!/https?:\/\/www.mturk.com\/mturk\/*/.test(window.location.href)) {
  96. idDiv = document.createElement('div');
  97. idDiv.id = "workerIDDiv";
  98. idInner = "<input type='text' onmouseover='javascript:this.focus();this.select() ;' onmouseout='javascript:this.blur();' value='" + workerID + "' style='position:fixed;border:thick solid #010101;top:20px;z-index:10000;right:1px;padding:5px 3px;background:#560E49;font-size:13px;color:white;' readonly/>";
  99. idDiv.innerHTML = idInner;
  100. document.body.insertBefore(idDiv,document.body.firstChild);
  101. }
  102. }