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