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.25
  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. // @grant GM_xmlhttpRequest
  10. // @include https://www.mturk.com/mturk/dashboard/
  11. // @include http://*.qualtrics.com/*
  12. // @include https://*.qualtrics.com/*
  13. // @include https://*.*.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://*.soscisurvey.de/*
  19. // @include http://*.dartmouth.edu/*
  20. // @include https://*.dartmouth.edu/*
  21. // @include https://*.vennliapp.com/*
  22. // @include http://*.ualberta.ca/*
  23. // @include https://*.unipark.de/*
  24. // @include http://*.unipark.de/*
  25. // @include http://*.*.brown.edu/*
  26. // @include http://*.*.columbia.edu/*
  27. // @include https://*.*.columbia.edu/*
  28. // @include http://www.marshlabduke.com/*
  29. // @include https://*.typeform.com/*
  30. // @include https://*.*.yahoo.com/*
  31. // @include http://*.cspurdue.com/*
  32. // @include http://*.questionpro.com/*
  33. // @include https://*.kwiksurveys.com/*
  34. // @include https://*.wonderliconline.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. }