reading_comprehension.tpl 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <div id="question-{{ id }}" class="question-reading-comprehension-container">
  2. <div class="question-reading-comprehension-overlay"></div>
  3. <div id="question-{{ id }}-text" class="center-block question-reading-comprehension-text" onselectstart="return false">
  4. {{ text }}
  5. </div>
  6. </div>
  7. <style>
  8. .question-reading-comprehension-container {
  9. position: relative;
  10. }
  11. .question-reading-comprehension-container .question-reading-comprehension-overlay {
  12. bottom: 0;
  13. left: 0;
  14. position: absolute;
  15. right: 0;
  16. top: 0;
  17. }
  18. .question-reading-comprehension-text {
  19. text-align: justify;
  20. -webkit-touch-callout: none;
  21. -webkit-user-select: none;
  22. -khtml-user-select: none;
  23. -moz-user-select: none;
  24. -ms-user-select: none;
  25. user-select: none;
  26. }
  27. .question-reading-comprehension-text .text-highlight {
  28. color: transparent;
  29. -webkit-text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  30. -khtml-text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  31. -moz-text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  32. -ms-text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  33. text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  34. }
  35. .question-reading-comprehension-text .text-highlight.active {
  36. color: #000;
  37. -webkit-text-shadow: none;
  38. -khtml-text-shadow: none;
  39. -moz-text-shadow: none;
  40. -ms-text-shadow: none;
  41. text-shadow: none;
  42. }
  43. .question-reading-comprehension-text .text-highlight.border {
  44. color: #bbb;
  45. -webkit-text-shadow: none;
  46. -khtml-text-shadow: none;
  47. -moz-text-shadow: none;
  48. -ms-text-shadow: none;
  49. text-shadow: none;
  50. }
  51. .question-reading-comprehension-text br {
  52. margin-bottom: 1em;
  53. }
  54. .radio.hide-reading-answers, .question_title.hide-reading-answers {
  55. display: none;
  56. }
  57. </style>
  58. <script>
  59. $(document).on('ready', function () {
  60. var index = 0,
  61. $questionTexts = $('#question-{{ id }}-text .text-highlight'),
  62. total = $questionTexts.length;
  63. function updateView()
  64. {
  65. $questionTexts.removeClass('active border');
  66. if (index == total - 1) {
  67. $('#question_div_{{ id }} .radio, #question_div_{{ id }} .question_title').removeClass('hide-reading-answers');
  68. }
  69. if (index >= total) {
  70. window.clearInterval(timeOuId);
  71. return;
  72. }
  73. var prev = index > 0 ? $('#question-{{ id }}-text .text-highlight').get(index - 1) : null,
  74. current = $questionTexts.get(index),
  75. next = index < total ? $('#question-{{ id }}-text .text-highlight').get(index + 1) : null;
  76. $(current).addClass('active');
  77. if (prev) {
  78. $(prev).addClass('border');
  79. }
  80. if (next) {
  81. $(next).addClass('border');
  82. }
  83. index++;
  84. }
  85. updateView();
  86. var timeOuId = window.setInterval(updateView, {{ refresh_time }} * 1000);
  87. });
  88. </script>