Qualtrics:Show All Questions

Show All Questions on Qualtrics (use in edit mode of survey)

  1. // ==UserScript==
  2. // @name Qualtrics:Show All Questions
  3. // @description Show All Questions on Qualtrics (use in edit mode of survey)
  4. // @include https://*.qualtrics.com/*Edit*
  5. // @grant none
  6. // @version 0.0.2.20170713
  7. // @namespace https://gf.qytechs.cn/users/4252
  8. // ==/UserScript==
  9. //Note: Only been tested in firefox
  10. jQuery(document).ready(function(){
  11. if (jQuery(".EditSection").length){ //if in edit mode
  12. var div = jQuery("<div></div>").attr("href","#").addClass('btn btn-primary').click(OutputQuestions).appendTo("#ToolbarContainer div.right");
  13. jQuery("<span></span>").addClass('icon toolbar-icon-open').appendTo(div);
  14. jQuery("<span></span>").text("Output Questions").appendTo(div);
  15. }
  16. });
  17.  
  18. function OutputQuestions() {
  19.  
  20. var Questions = jQuery(".QuestionText").not("#TrashArea .QuestionText");
  21.  
  22. var output = jQuery("<div></div>");
  23. jQuery("<button></button>").attr("id","button").attr("type","button").attr("onclick","ShowHideNAN()").text("Show/Hide Questions without numbers").appendTo(output);
  24. var table = jQuery("<table></table>").appendTo(output);
  25. jQuery.each(Questions, function(index, Question) {
  26. var cell = jQuery("<td></td>").html(Question.innerHTML);
  27. var row = jQuery("<tr></tr>").append(cell).appendTo(table);
  28. if (isNaN(Question.textContent.trim().substr(0, 1))) { //if it doesn't start with a number then hide it
  29. row.addClass("hidden");
  30. }
  31. });
  32.  
  33. var myWindow = window.open("", "_blank", "scrollbars=yes, menubar=yes");
  34.  
  35. var newStyle = jQuery("<style></style>").html(".hidden{ display:none;} table, td{border:1px solid black;display:block;}");
  36. myWindow.document.head.appendChild(newStyle[0]);
  37.  
  38. var newScript = jQuery("<script></script>").html('function ShowHideNAN() { rule = document.styleSheets[0].cssRules[0]; if (rule.style.display == "none") rule.style.display = "block"; else rule.style.display = "none"; }');
  39. myWindow.document.head.appendChild(newScript[0]);
  40.  
  41. myWindow.document.body.appendChild(output[0]);
  42. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址