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.

当前为 2015-05-22 提交的版本,查看 最新版本

  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 1.26
  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.
  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://*.surveygizmo.com/*
  14. // @include https://*.surveygizmo.com/*
  15. // @include https://docs.google.com/forms/*
  16. // @include https://*.surveymonkey.com/*
  17. // @include https://*.soscisurvey.de/*
  18. // @include http://*.dartmouth.edu/*
  19. // @include https://*.dartmouth.edu/*
  20. // @include https://*.vennliapp.com/*
  21. // @include http://*.ualberta.ca/*
  22. // @include https://*.unipark.de/*
  23. // @include http://*.unipark.de/*
  24. // @include http://*.*.brown.edu/*
  25. // @include http://*.*.columbia.edu/*
  26. // @include https://*.*.columbia.edu/*
  27. // @include http://www.marshlabduke.com/*
  28. // @include https://*.typeform.com/*
  29. // @include https://*.*.yahoo.com/*
  30. // @include http://*.cspurdue.com/*
  31. // @include http://*.questionpro.com/*
  32. // @include https://*.kwiksurveys.com/*
  33. // @include https://*.wonderliconline.com/*
  34. // @include http://*.lab42.com/*
  35. // @grant GM_setValue
  36. // @grant GM_getValue
  37. // @grant GM_registerMenuCommand
  38. // ==/UserScript==
  39.  
  40. $ = unsafeWindow.$;
  41. if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
  42. this.GM_getValue=function (key,def) {
  43. return localStorage[key] || def;
  44. };
  45. this.GM_setValue=function (key,value) {
  46. return localStorage[key]=value;
  47. };
  48. }
  49.  
  50. workerID = GM_getValue("workerID");
  51. if(!workerID || workerID == "") {
  52. if (window.location.href == "https://www.mturk.com/mturk/dashboard") {
  53. workerIDNode = document.evaluate("//span[@class='orange_text_right']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
  54. for (i=0; i<workerIDNode.snapshotLength; i++) {
  55. nd = workerIDNode.snapshotItem(i);
  56. idstring = nd.innerHTML;
  57. workerID = idstring.split(': ')[1];
  58. GM_setValue("workerID",workerID);
  59. }
  60. } else {
  61. workerID="";
  62. GM_setValue("workerID","");
  63. }
  64. } else {
  65. if (!/https?:\/\/www.mturk.com\/mturk\/*/.test(window.location.href)) {
  66. idDiv = document.createElement('div');
  67. idDiv.id = "workerIDDiv";
  68. idInner = "<input type='text' onmouseover='javascript:this.focus();this.select() ;' onmouseout='javascript:this.blur();' value='" + workerID + "' style='position:fixed;border:none;top:25px;z-index:10000;right:5px;padding:1px 3px;background:#33CC00;font-size:10px;color:white;' readonly/>";
  69. idDiv.innerHTML = idInner;
  70. document.body.insertBefore(idDiv,document.body.firstChild);
  71. }
  72. }