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 or drag and drop. 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.1
  5. // @namespace http://www.mturkforum.com
  6. // @homepage http://mturkforum.com/showthread.php?4443-Worker-ID-Copy-Paste&p=57029
  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 or drag and drop. Does not show on mturk pages. Edited by Swole_hamster to add more domains.
  8. // @grant GM_setValue
  9. // @grant GM_getValue
  10. // @grant GM_registerMenuCommand
  11. // @include https://www.mturk.com/mturk/dashboard
  12. // @include http://*.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. // ==/UserScript==
  26.  
  27. if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
  28. this.GM_getValue=function (key,def) {
  29. return localStorage[key] || def;
  30. };
  31. this.GM_setValue=function (key,value) {
  32. return localStorage[key]=value;
  33. };
  34. }
  35.  
  36. workerID = GM_getValue("workerID");
  37. if(!workerID || workerID == "") {
  38. if (window.location.href == "https://www.mturk.com/mturk/dashboard") {
  39. workerIDNode = document.evaluate("//span[@class='orange_text_right']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
  40. for (i=0; i<workerIDNode.snapshotLength; i++) {
  41. nd = workerIDNode.snapshotItem(i);
  42. idstring = nd.innerHTML;
  43. workerID = idstring.split(': ')[1];
  44. GM_setValue("workerID",workerID);
  45. }
  46. } else {
  47. workerID="";
  48. GM_setValue("workerID","");
  49. }
  50. } else {
  51. if (!/https?:\/\/www.mturk.com\/mturk\/*/.test(window.location.href)) {
  52. idDiv = document.createElement('div');
  53. idDiv.id = "workerIDDiv";
  54. 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/>";
  55. idDiv.innerHTML = idInner;
  56. document.body.insertBefore(idDiv,document.body.firstChild);
  57. }
  58. }