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. Edited by Tjololo12: Hover highlight for easy copy-paste. Does not show on mturk pages. Edited by Swole_hamster to add more domains.

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

  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.16
  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. Edited by Tjololo12: Hover highlight for easy copy-paste. Does not show on mturk pages. Edited by Swole_hamster to add more domains.
  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. // ==/UserScript==
  29.  
  30.  
  31. if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
  32. this.GM_getValue=function (key,def) {
  33. return localStorage[key] || def;
  34. };
  35. this.GM_setValue=function (key,value) {
  36. return localStorage[key]=value;
  37. };
  38. }
  39.  
  40. workerID = GM_getValue("workerID");
  41. if(!workerID || workerID == "") {
  42. if (window.location.href == "https://www.mturk.com/mturk/dashboard") {
  43. workerIDNode = document.evaluate("//span[@class='orange_text_right']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
  44. for (i=0; i<workerIDNode.snapshotLength; i++) {
  45. nd = workerIDNode.snapshotItem(i);
  46. idstring = nd.innerHTML;
  47. workerID = idstring.split(': ')[1];
  48. GM_setValue("workerID",workerID);
  49. }
  50. } else {
  51. workerID="";
  52. GM_setValue("workerID","");
  53. }
  54. } else {
  55. if (!/https?:\/\/www.mturk.com\/mturk\/*/.test(window.location.href)) {
  56. idDiv = document.createElement('div');
  57. idDiv.id = "workerIDDiv";
  58. 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/>";
  59. idDiv.innerHTML = idInner;
  60. document.body.insertBefore(idDiv,document.body.firstChild);
  61. }
  62. }