Mturk Group IDs

Adds group ID to mturk hit frames

目前为 2018-08-17 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Mturk Group IDs
  3. // @description Adds group ID to mturk hit frames
  4. // @author DCI
  5. // @namespace https://www.redpandanetwork.org
  6. // @version 1.3
  7. // @include *
  8. // @exclude https://worker.mturk.com/mturk/externalSubmit*
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. if (~window.location.toString().indexOf("worker.mturk.com/projects/")){
  13. window.addEventListener("message", function(e){
  14. if (e.data == "I'm here!"){
  15. let iframe = document.getElementsByTagName("iframe")[0];
  16. let groupId = location.toString().split("projects/")[1].split("/")[0];
  17. iframe.src = iframe.src + "&groupId=" + groupId;
  18. }
  19. });
  20. }
  21. if ((window.location != window.parent.location) && (!~window.location.toString().indexOf("externalSubmit"))){
  22. if (!~window.location.toString().indexOf("&groupId=")){
  23. window.parent.postMessage("I'm here!", '*');
  24. }
  25. }