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. // @icon http://icons.iconarchive.com/icons/flameia/rabbit-xp/32/documents-icon.png
  5. // @version 1.13
  6. // @namespace http://www.mturkforum.com
  7. // @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.
  8. // @include https://www.mturk.com/mturk/dashboard
  9. // @include http://*.qualtrics.com/*
  10. // @include https://*.qualtrics.com/*
  11. // @include https://*.*.qualtrics.com/*
  12. // @include http://*.surveygizmo.com/*
  13. // @include https://*.surveygizmo.com/*
  14. // @include https://docs.google.com/forms/*
  15. // @include https://*.surveymonkey.com/*
  16. // @include https://*.soscisurvey.de/*
  17. // @include http://*.dartmouth.edu/*
  18. // @include https://*.dartmouth.edu/*
  19. // @include https://*.vennliapp.com/*
  20. // @include http://*.ualberta.ca/*
  21. // @include https://*.unipark.de/*
  22. // @include http://*.unipark.de/*
  23. // @include http://*.*.brown.edu/*
  24. // @include http://*.*.columbia.edu/*
  25. // ==/UserScript==
  26.  
  27.  
  28. if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
  29. this.GM_getValue=function (key,def) {
  30. return localStorage[key] || def;
  31. };
  32. this.GM_setValue=function (key,value) {
  33. return localStorage[key]=value;
  34. };
  35. }
  36.  
  37. workerID = GM_getValue("workerID");
  38. if(!workerID || workerID == "") {
  39. if (window.location.href == "https://www.mturk.com/mturk/dashboard") {
  40. workerIDNode = document.evaluate("//span[@class='orange_text_right']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
  41. for (i=0; i<workerIDNode.snapshotLength; i++) {
  42. nd = workerIDNode.snapshotItem(i);
  43. idstring = nd.innerHTML;
  44. workerID = idstring.split(': ')[1];
  45. GM_setValue("workerID",workerID);
  46. }
  47. } else {
  48. workerID="";
  49. GM_setValue("workerID","");
  50. }
  51. } else {
  52. if (!/https?:\/\/www.mturk.com\/mturk\/*/.test(window.location.href)) {
  53. idDiv = document.createElement('div');
  54. idDiv.id = "workerIDDiv";
  55. 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/>";
  56. idDiv.innerHTML = idInner;
  57. document.body.insertBefore(idDiv,document.body.firstChild);
  58. }
  59. }