Guest User

Untitled

a guest
Jul 14th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.60 KB | None | 0 0
  1. <style>
  2. .card-selection-area input[type="radio"] {
  3. display: none;
  4. }
  5. .card-selection-area input[type="radio"]:checked + label {
  6. background-color: #312f59;
  7. border-color: #312f59;
  8. color: #fff;
  9. }
  10. .card-selection-area table {
  11. margin: 0 85px;
  12. }
  13. .card-selection-area td {
  14. padding: 2px 10px;
  15. text-align: center;
  16. }
  17. .card-selection-area label {
  18. display: inline-block;
  19. background-color: #fff;
  20. font-family: Arial;
  21. font-size: 16px;
  22. width: 30px;
  23. height: 30px;
  24. line-height: 30px;
  25. border: 1px solid #a69981;
  26. border-radius: 15px;
  27. text-align: center;
  28. cursor: pointer;
  29. }
  30. .img-inline {
  31. display: inline-block;
  32. margin: 0 5px;
  33. max-width: 100%;
  34. }
  35. .img-inline, .img-block {
  36. vertical-align: middle;
  37. }
  38. .img-block {
  39. display: block;
  40. margin: 5px auto;
  41. max-width: 100%;
  42. }
  43. #exam-form, #exam-form *:not(.label) {
  44. font-size: 16px !important;
  45. line-height: 150% !important;
  46. }
  47. </style>
  48. <form id="exam-form">
  49. <div class="row">
  50. <div class="col-xs-6 ref-wrapper">
  51. <div class="q2_box q2_box_w">At once community college, the cost per credit hour for in-state students has been decrease by $2 a year. In another community college, it has been decreasing by 4% per year. This year, the cost is $70 at both colleges. To the nearest dollar, what was the positive difference in costs 3 years ago?</div> </div>
  52. <div class="col-xs-6">
  53. <h3><span class="q2_box"></span></h3><h4><span class="q2_box"></span><span class="q2_box">Please click on the answer sheet below.</span></h4> <div class="card-selection-area">
  54. <div id="review-feedback" style="display: none;"></div>
  55. <table>
  56. <tr>
  57. <td><input type="text" size="1"></td>
  58. <td><input type="text" size="1"></td>
  59. <td><input type="text" size="1"></td>
  60. <td><input type="text" size="1"></td>
  61. </tr>
  62. <tr>
  63. <td></td>
  64. <td><input type="radio" name="decimal" id="fractionLine1" data-digit="2" value="/"><label for="fractionLine1">/</label></td>
  65. <td><input type="radio" name="decimal" id="fractionLine2" data-digit="3" value="/"><label for="fractionLine2">/</label></td>
  66. <td></td>
  67. </tr>
  68. <tr>
  69. <td><input type="radio" name="decimal" id="decimalPoint1" data-digit="1" value="."><label for="decimalPoint1">.</label></td>
  70. <td><input type="radio" name="decimal" id="decimalPoint2" data-digit="2" value="."><label for="decimalPoint2">.</label></td>
  71. <td><input type="radio" name="decimal" id="decimalPoint3" data-digit="3" value="."><label for="decimalPoint3">.</label></td>
  72. <td><input type="radio" name="decimal" id="decimalPoint4" data-digit="4" value="."><label for="decimalPoint4">.</label></td>
  73. </tr>
  74. <tr>
  75. <td></td>
  76. <td><input type="radio" name="digit2" id="digit2-0" value="0" data-digit="2"><label for="digit2-0">0</label></td>
  77. <td><input type="radio" name="digit3" id="digit3-0" value="0" data-digit="3"><label for="digit3-0">0</label></td>
  78. <td><input type="radio" name="digit4" id="digit4-0" value="0" data-digit="4"><label for="digit4-0">0</label></td>
  79. </tr>
  80. <tr>
  81. <td><input type="radio" name="digit1" id="digit1-1" value="1" data-digit="1"><label for="digit1-1">1</label></td>
  82. <td><input type="radio" name="digit2" id="digit2-1" value="1" data-digit="2"><label for="digit2-1">1</label></td>
  83. <td><input type="radio" name="digit3" id="digit3-1" value="1" data-digit="3"><label for="digit3-1">1</label></td>
  84. <td><input type="radio" name="digit4" id="digit4-1" value="1" data-digit="4"><label for="digit4-1">1</label></td>
  85. </tr>
  86. <tr>
  87. <td><input type="radio" name="digit1" id="digit1-2" value="2" data-digit="1"><label for="digit1-2">2</label></td>
  88. <td><input type="radio" name="digit2" id="digit2-2" value="2" data-digit="2"><label for="digit2-2">2</label></td>
  89. <td><input type="radio" name="digit3" id="digit3-2" value="2" data-digit="3"><label for="digit3-2">2</label></td>
  90. <td><input type="radio" name="digit4" id="digit4-2" value="2" data-digit="4"><label for="digit4-2">2</label></td>
  91. </tr>
  92. <tr>
  93. <td><input type="radio" name="digit1" id="digit1-3" value="3" data-digit="1"><label for="digit1-3">3</label></td>
  94. <td><input type="radio" name="digit2" id="digit2-3" value="3" data-digit="2"><label for="digit2-3">3</label></td>
  95. <td><input type="radio" name="digit3" id="digit3-3" value="3" data-digit="3"><label for="digit3-3">3</label></td>
  96. <td><input type="radio" name="digit4" id="digit4-3" value="3" data-digit="4"><label for="digit4-3">3</label></td>
  97. </tr>
  98. <tr>
  99. <td><input type="radio" name="digit1" id="digit1-4" value="4" data-digit="1"><label for="digit1-4">4</label></td>
  100. <td><input type="radio" name="digit2" id="digit2-4" value="4" data-digit="2"><label for="digit2-4">4</label></td>
  101. <td><input type="radio" name="digit3" id="digit3-4" value="4" data-digit="3"><label for="digit3-4">4</label></td>
  102. <td><input type="radio" name="digit4" id="digit4-4" value="4" data-digit="4"><label for="digit4-4">4</label></td>
  103. </tr>
  104. <tr>
  105. <td><input type="radio" name="digit1" id="digit1-5" value="5" data-digit="1"><label for="digit1-5">5</label></td>
  106. <td><input type="radio" name="digit2" id="digit2-5" value="5" data-digit="2"><label for="digit2-5">5</label></td>
  107. <td><input type="radio" name="digit3" id="digit3-5" value="5" data-digit="3"><label for="digit3-5">5</label></td>
  108. <td><input type="radio" name="digit4" id="digit4-5" value="5" data-digit="4"><label for="digit4-5">5</label></td>
  109. </tr>
  110. <tr>
  111. <td><input type="radio" name="digit1" id="digit1-6" value="6" data-digit="1"><label for="digit1-6">6</label></td>
  112. <td><input type="radio" name="digit2" id="digit2-6" value="6" data-digit="2"><label for="digit2-6">6</label></td>
  113. <td><input type="radio" name="digit3" id="digit3-6" value="6" data-digit="3"><label for="digit3-6">6</label></td>
  114. <td><input type="radio" name="digit4" id="digit4-6" value="6" data-digit="4"><label for="digit4-6">6</label></td>
  115. </tr>
  116. <tr>
  117. <td><input type="radio" name="digit1" id="digit1-7" value="7" data-digit="1"><label for="digit1-7">7</label></td>
  118. <td><input type="radio" name="digit2" id="digit2-7" value="7" data-digit="2"><label for="digit2-7">7</label></td>
  119. <td><input type="radio" name="digit3" id="digit3-7" value="7" data-digit="3"><label for="digit3-7">7</label></td>
  120. <td><input type="radio" name="digit4" id="digit4-7" value="7" data-digit="4"><label for="digit4-7">7</label></td>
  121. </tr>
  122. <tr>
  123. <td><input type="radio" name="digit1" id="digit1-8" value="8" data-digit="1"><label for="digit1-8">8</label></td>
  124. <td><input type="radio" name="digit2" id="digit2-8" value="8" data-digit="2"><label for="digit2-8">8</label></td>
  125. <td><input type="radio" name="digit3" id="digit3-8" value="8" data-digit="3"><label for="digit3-8">8</label></td>
  126. <td><input type="radio" name="digit4" id="digit4-8" value="8" data-digit="4"><label for="digit4-8">8</label></td>
  127. </tr>
  128. <tr>
  129. <td><input type="radio" name="digit1" id="digit1-9" value="9" data-digit="1"><label for="digit1-9">9</label></td>
  130. <td><input type="radio" name="digit2" id="digit2-9" value="9" data-digit="2"><label for="digit2-9">9</label></td>
  131. <td><input type="radio" name="digit3" id="digit3-9" value="9" data-digit="3"><label for="digit3-9">9</label></td>
  132. <td><input type="radio" name="digit4" id="digit4-9" value="9" data-digit="4"><label for="digit4-9">9</label></td>
  133. </tr>
  134. </table>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="row text-center">
  139. <button id="exam-submit" type="button" class="btn btn-lg btn-primary">Next</button>
  140. </div>
  141. <input type="hidden" id="q_option" name="q_option" value="">
  142. <input type="hidden" id="answer_type" name="answer_type" value="0">
  143. <input type="hidden" id="correct_ans" name="correct_ans" value="3">
  144. </form>
  145. <div id="solving" style="display: none;">
  146. <hr>
  147. </div>
  148. <script>
  149. var studentAns = {
  150. 'text': '',
  151. 'value': 0
  152. };
  153. $(document).off('click change');
  154. $(document).on('click', '.card-selection-area label', function(e) {
  155. e.preventDefault();
  156. var target = $('.card-selection-area input[type=radio][id="' + $(this).attr('for') + '"]');
  157. target.prop('checked', !target.prop('checked'));
  158. target.trigger('change');
  159. }).on('change', '.card-selection-area input[type=radio]', function() {
  160. var result = 0;
  161. if ($(this).prop('checked') == true) {
  162. if ($(this).attr('name') == 'decimal') {
  163. $('[name=digit' + $(this).attr('data-digit') + ']:checked').prop('checked', false);
  164. } else {
  165. $('[name=decimal][data-digit=' + $(this).attr('data-digit') + ']:checked').prop('checked', false);
  166. }
  167. }
  168. var inputStr = (
  169. (typeof $('[data-digit=1]:checked').val() != 'undefined' ? $('[data-digit=1]:checked').val().toString() : '')
  170. + (typeof $('[data-digit=2]:checked').val() != 'undefined' ? $('[data-digit=2]:checked').val().toString() : '')
  171. + (typeof $('[data-digit=3]:checked').val() != 'undefined' ? $('[data-digit=3]:checked').val().toString() : '')
  172. + (typeof $('[data-digit=4]:checked').val() != 'undefined' ? $('[data-digit=4]:checked').val().toString() : '')
  173. );
  174. //console.log(inputStr);
  175. var regExp = /^(\d{1,2})\/(\d{1,2})$/g;
  176. var matches = regExp.exec(inputStr);
  177. if (inputStr.substr(0, 1) == '.') {
  178. inputStr = '0' + inputStr;
  179. }
  180. if (matches !== null) {
  181. //console.log(matches);
  182. var denominator = parseInt(matches[2]),
  183. numerator = parseInt(matches[1]);
  184. result = (numerator / denominator);
  185. if (result > 10) {
  186. result = result.toFixed(1);
  187. } else {
  188. result = result.toFixed(2);
  189. }
  190. } else if (inputStr.match(/^\d{1,3}\.{0,1}\d{0,3}$/)) {
  191. result = parseFloat(inputStr).toFixed(4);
  192. }
  193. result = parseFloat(result);
  194.  
  195. for (var t = 0; t <= 3; t++) {
  196. $('.card-selection-area input[type=text]').eq(t).val((typeof $('[data-digit=' + (t + 1).toString() + ']:checked').val() != 'undefined' ? $('[data-digit=' + (t + 1).toString() + ']:checked').val().toString() : ''));
  197. }
  198. /* Save student answer in global varible */
  199. window.studentAns.text = inputStr;
  200. window.studentAns.value = result;
  201. console.log(window.studentAns);
  202. $('#q_option').val(window.studentAns.text + '|' + window.studentAns.value);
  203. })
  204. $('#exam-submit').click(function() {
  205. var btn = this;
  206. btn.disabled = true;
  207. if (check_submit() === true) {
  208. exam_submit();
  209. } else {
  210. submit_error();
  211. }
  212. });
  213. function submit_error() {
  214. BootstrapDialog.show({
  215. title: 'Error',
  216. message: 'Error! Please answer the question before you submit.',
  217. type: BootstrapDialog.TYPE_DANGER,
  218. buttons: [{
  219. cssClass: 'btn-danger',
  220. label: 'Confirm',
  221. action: function(dialog) {
  222. dialog.close();
  223. }
  224. }],
  225. onhide: function() {
  226. $('#exam-submit').prop('disabled', false);
  227. }
  228. });
  229. }
  230. function check_submit() {
  231. var checked = $('input[type=hidden][name=q_option]').first().val().trim().length > 0;
  232. /*if ($('input[type=radio][name=q_option]:checked').length == 0) {
  233. if ($('input[type=checkbox][name="q_option[]"]:checked').length == 0) {
  234. if ($('input[type=hidden][name=q_option]').length == 0) {
  235. checked = ($('input[type=checkbox], input[type=radio], input[type=text], textarea').length == 0);
  236. } else {
  237. checked = ($('input[type=hidden][name=q_option]').val().trim().length > 0);
  238. }
  239. }
  240. }*/
  241. return checked;
  242. }
  243. function review_submit() {
  244. if (check_submit() === true) {
  245. show_solving();
  246. } else {
  247. submit_error();
  248. }
  249. }
  250. function show_solving() {
  251. var feedback = (window.studentAns.value == $('#correct_ans').val() ? '<h3 class="text-success">Correct!</h3>' : '<h3 class="text-danger">Incorrect! Correct answer is ' + $('#correct_ans').val() + '.</h3>');
  252. $('#exam-question').trigger('detach.ScrollToFixed');
  253. $('#review-feedback').html(feedback).slideDown();
  254. $('#solving').slideDown();
  255. }
  256. </script><script type="text/javascript">
  257. var auto_submit_timer;
  258. if(auto_submit_timer)
  259. {
  260. console.log('clean auto submit');
  261. clearInterval(auto_submit_timer);
  262. auto_submit_timer = 0;
  263. }
  264. </script>
  265. <script type="text/javascript">
  266. //判斷是否正在計時的flag
  267. var examtime = true;
  268. //正數計時器(紀錄作答時間)
  269. var timer1 = new timer('timer_1');
  270. //不要自動更新顯示時間(原本是正數,我要改成倒數)
  271. timer1.auto_change_display = false;
  272. //N分鐘後鎖定螢幕
  273. var lock_time = 540
  274. //cookie時間,題型有設定exam才會開啟 Daky、Lewis 1040624
  275. if(typeof($.cookie("time")) != 'undefined' && $.cookie("self_id") == '1467881649067050'){
  276. var cookietime = $.cookie("time");
  277. lock_time = cookietime;
  278. }
  279. else {
  280. $.removeCookie('time');
  281. $.removeCookie('self_id');
  282. }
  283.  
  284. //kenny的閱讀題型
  285. //重作的時間要另外計算
  286. if (typeof(redo_lock_time) != 'undefined' && redo_lock_time > 0) {
  287. lock_time = redo_lock_time;
  288. redo_lock_time = 0;
  289. }
  290.  
  291. //N分鐘後開放放棄此題
  292. var giveup_time = (1 * 60);
  293. //計時器計時時也會執行這個function(每秒執行1次)
  294. timer1.timer_custom_func = function() {
  295.  
  296. var eta_sec = lock_time - this.timer_number;
  297.  
  298. //如果是考試的題型,每秒要去修改時間 Daky、Lewis 1040624
  299. if(eta_sec <= 0){
  300. //如果有设定不要时间到跳题,就不会跳题
  301. $.post('../common/exam_timeout.php', {
  302. }, function(res) {
  303. console.log(res);
  304. $.removeCookie('time');
  305. //window.location.href = 'main.php';
  306.  
  307. if(typeof(exam_submit) !=='undefined'){ //如果function 不是undefined 就呼叫強制送出
  308. exam_submit();
  309. }
  310. });
  311. return false;
  312. }else{
  313. $.cookie("time", eta_sec, { expires: 1 });
  314. $.cookie("self_id", '1467881649067050', { expires: 1 });
  315. }
  316.  
  317. //控制是否顯示時間
  318. if ($('#eta_time').attr('data-no-show') !== 'true') {
  319. //console.log(eta_sec);
  320. if(eta_sec>=0) $('#' + this.display_id).text(eta_sec.toString().toHHMMSS()); //時間大於0,才去更新時間 Daky
  321. }else {
  322. $('#' + this.display_id).text('显示');
  323. }
  324. //剩下不到30秒時,時鐘變紅
  325. if (eta_sec < 30) { $('#' + this.display_id).css('color', '#f00'); }
  326. else { $('#' + this.display_id).css('color', 'inherit'); }
  327. //如果不是考試的題型,會有鎖專心碼 Lewis 1040625
  328. //如果是體驗課,加上nolock就不會鎖了 Daky 1040922
  329. }
  330. //题号
  331. var main_question_id = ('30996'!='')?'<span id="main_question_id" style="float: right;color: gainsboro;">System Question ID:30996</span>':'';
  332. //面包屑
  333. $('#course_title').html('SAT >> Homework – Math 2 >> Unit 4 ' + main_question_id);
  334.  
  335. function exam_submit() {
  336. //轉轉轉
  337. showLoading();
  338. //送出時計時暫停
  339. timer1.timer_pause();
  340. //表格題
  341. if ($('.panel-info').length > 0) {
  342. //alert($('.panel-info').length);
  343. var raw_q_option = $('#exam-form input[name=q_option]').val();
  344. var options_num = new Array();
  345. $('.panel-info').each(function() {
  346. var span_num = 0;
  347. var _this = $(this);
  348. _this.find('span.droppable').each(function() {
  349. if ($(this).html() != '&nbsp;') {
  350. span_num += 1;
  351. }
  352. });
  353. options_num.push(span_num);
  354. });
  355. var q_options = raw_q_option.split('|');
  356. var new_q_options = new Array();
  357. var opt_k = 0;
  358. $(options_num).each(function(k, v) {
  359. var tmp_arr = new Array();
  360. for (i = 0; i < v; i++) {
  361. tmp_arr.push(q_options[opt_k]);
  362. opt_k += 1;
  363. }
  364. new_q_options.push(tmp_arr);
  365. });
  366. $('#exam-form input[name=q_option]').val(JSON.stringify(new_q_options));
  367. //return false;
  368. }
  369. //上傳筆記檔案
  370. if($(':file').length > 0 && $(':file').change()){
  371. var formData = new FormData(document.getElementById("exam-form"));
  372. $.ajax({
  373. url: '../exam/check_lewis.php', //Server script to process data
  374. type: 'POST',
  375. //Form data
  376. data: formData,
  377. //Options to tell jQuery not to process data or worry about content-type.
  378. cache: false,
  379. contentType: false,
  380. processData: false,
  381. success: function(res) {
  382. $('#Images').attr({'value':res});
  383. }
  384. });
  385. }
  386. //把exam-form裡面element的值都抓出來,塞進submit_data這個變數
  387. var submit_data = $('#exam-form').serialize();
  388. $.ajax({
  389. url: '../exam/check.php',
  390. type: 'POST',
  391. data: submit_data + '&qid=30996&spend=' + timer1.timer_number, //timer_number
  392. success: function(res) {
  393. if (res !== '') {
  394. var res_obj = $.parseJSON(res);
  395. if (res_obj !== null && typeof(res_obj) !== 'undefined') {
  396. if (res_obj.res_type == "dialog") {
  397. //拿掉轉轉轉
  398. hideLoading();
  399. $('#loadingOverlay').hide();
  400. $('body').css('overflow', 'auto');
  401. message_dialog(res_obj.dialog_msg, res_obj.dialog_title, res_obj.dialog_type, function() {
  402. $('#loadingOverlay').show();
  403. $('body').css('overflow', 'hidden');
  404. exam_load();
  405. });
  406. }
  407. }
  408. else {
  409. //如果有其他訊息,顯示在console裡面
  410. console.log(res);
  411. exam_load();
  412. }
  413. }
  414. else { exam_load(); }
  415. }
  416. });
  417. }
  418. function exam_initial() {
  419. //重設計時器(從0開始)
  420. timer1.timer_reset();
  421. timer1.timer_play();
  422. $('#eta_time').click(function() {
  423. var cur_stat = ($(this).attr('data-no-show') === undefined) ? false : ($(this).attr('data-no-show') === 'true' ? true : false);
  424. $(this).attr('data-no-show', !cur_stat);
  425. });
  426. //把目前單元的tooltip直接顯示出來
  427. //$(selector).tooltip('show') => 顯示
  428. //$(selector).tooltip('hide') => 隱藏
  429. $('[data-toggle="tooltip"]').tooltip({
  430. html: true
  431. });
  432.  
  433. //如果.task-now跟.task-redo兩個同時存在的話,顯示.task-now就好
  434. if ($('.task-now').length > 0 && $('.task-redo').length > 0) {
  435. $('.task-now, #eta_time').tooltip('show');
  436. $('.task-redo').css('border', '5px solid transparent');
  437. }
  438. else {
  439. $('.task-now, .task-redo, #eta_time').tooltip('show');
  440. }
  441.  
  442. if (typeof(tooltip_timeout) != 'undefined') { clearTimeout(tooltip_timeout); }
  443. //5秒後隱藏
  444. tooltip_timeout = setTimeout(function() {
  445. $('.task-now, .task-redo, #eta_time').tooltip('hide');
  446. }, 5000);
  447. //顯示tooltip時先把其他的隱藏
  448. $('[data-toggle="tooltip"]').on('show.bs.tooltip', function() {
  449. $('[data-toggle="tooltip"]').not($(this)).tooltip('hide');
  450. });
  451. //回報難點
  452. $('#btn_hard').unbind();//20160603 Daky 避免重複綁定多次點擊
  453. $('#btn_hard').bind('click', function() {
  454. //轉轉轉
  455. showLoading();
  456. //回報時間
  457. var report_time = getDateTime();
  458. //回報內容
  459. var text = "請於下方輸入您的困難點 或 想詢問老師的問題。";
  460. //彈出輸入框
  461. var comment = prompt(text, "");
  462. if (comment != null) {
  463. $.post('../common/log.php', {
  464. 'log_type': 'hard_point',
  465. 'log_content': encodeURI(JSON.stringify({
  466. 'qid': '30996',
  467. 'comment':comment,
  468. 'chapter':$('#course_title').text(),
  469. 'report_time': report_time
  470. })),
  471. 'qid': '30996'
  472. }, function(res) {
  473. hideLoading();
  474. var result = $.parseJSON(res);
  475. message_dialog(result.message, result.title, result.type);
  476. });
  477. return false;
  478. }
  479. else {
  480. //拿掉轉轉轉
  481. hideLoading();
  482. }
  483. });
  484. //暫停
  485. $('#btn_stop').unbind();//20160603 Daky 避免重複綁定多次點擊
  486. $('#btn_stop').bind('click', function() {
  487. if(examtime) {
  488. //如果該題有定義恢復時要做什麼,就呼叫他
  489. if(typeof(exam_stop) == 'function'){ exam_stop(); }
  490. //時間暫停
  491. timer1.timer_pause();
  492. //寫入暫停的log
  493. var pause_time = getDateTime();
  494. $.post('../common/log.php', {
  495. 'log_type': 'pause',
  496. 'log_content': encodeURI(JSON.stringify({
  497. 'pause_time': pause_time
  498. }))
  499. });
  500. //黑屏
  501. $('<div></div>',{'id': 'pauseOverlay'}).css({
  502. 'position': 'fixed',
  503. 'left': '0',
  504. 'top': '0',
  505. 'width': '100%',
  506. 'height': '100%',
  507. 'z-index': '9998',
  508. 'background-color': 'rgba(0, 0, 0, 0.8)'
  509. }).appendTo('body');
  510. //暫停文字
  511. $('<h2></h2>').text('暂停中').css({
  512. 'position': 'absolute',
  513. 'width': '200px',
  514. 'height': '52px',
  515. 'left': '50%',
  516. 'top': '50%',
  517. 'font-size': '52px',
  518. 'letter-spacing': '14px',
  519. 'line-height': '52px',
  520. 'color': 'rgb(255, 255, 255)',
  521. 'margin': '-120px 0px 0px -90px',
  522. 'z-index': '9999'
  523. }).appendTo('#pauseOverlay');;
  524. //恢復按鈕
  525. $('<button></button>').text('继续作答').addClass('btn btn-primary').attr('id', 'btn_go').css({
  526. 'position': 'absolute',
  527. 'height': '53px',
  528. 'width': '152px',
  529. 'left': '50%',
  530. 'top': '50%',
  531. 'font-size': '26px',
  532. 'margin': '-34px 0px 0px -76px',
  533. 'z-index': '9999'
  534. }).click(function() {
  535. //如果該題有定義恢復時要做什麼,就呼叫他
  536. if(typeof(exam_continue) == 'function'){ exam_continue(); }
  537. //寫入恢復的log
  538. var resume_time = getDateTime();
  539. $.post('../common/log.php', {
  540. 'log_type': 'resume',
  541. 'log_content': encodeURI(JSON.stringify({
  542. 'resume_time': resume_time,
  543. 'pause_time': pause_time
  544. }))
  545. });
  546. //移除黑屏
  547. $('#pauseOverlay').remove();
  548. //啟用背景卷軸
  549. $('body').css('overflow', 'auto');
  550. //將判斷是否正在計時的flag設為true
  551. examtime = true;
  552. //時間繼續
  553. timer1.timer_play();
  554. }).appendTo('#pauseOverlay');
  555. //停用背景卷軸
  556. $('body').css('overflow', 'hidden');
  557. }
  558. //如果有正在播放的影片就暫停
  559. if ($('video:visible').length > 0) {
  560. $('video:visible').get(0).pause();
  561. }
  562. examtime = !examtime;
  563. return false;
  564. });
  565. //掃盲
  566. $('#btn_scan').click(function() {
  567. //轉轉轉
  568. showLoading();
  569. $.post('../main/scan_info.php', {
  570. 'id': '15110504028',
  571. }, function(res) {
  572. hideLoading();
  573. message_dialog(res, '掃盲紀錄', 'info');
  574. });
  575. return false;
  576. });
  577. //求救
  578. $('#btn_help').click(function() {
  579. //轉轉轉
  580. //showLoading();
  581. //求救時間
  582. var help_time = getDateTime();
  583. $.post('../common/log.php', {
  584. 'log_type': 'help',
  585. 'log_content': encodeURI(JSON.stringify({
  586. 'qid': '30996',
  587. 'help_time': help_time
  588. })),
  589. 'qid': '30996',
  590. 'qtype': '80',
  591. }, function(res){
  592. //console.log(res);
  593. if(res.length != 2){
  594. var result = $.parseJSON(res);
  595. message_dialog(result.message, result.title, result.type);
  596. }
  597. });
  598. return false;
  599. });
  600. hideLoading();
  601. }
  602.  
  603. function exam_load() {
  604. showLoading();
  605. //載入題目
  606. $('#question_field').load('question_inc.php', function() {
  607. //載入上方進度圖
  608. $('#main_header_inner').load('main_header.php', function() {
  609. //載入完成後觸發
  610. exam_initial();
  611. $('.correct-answer').parent().css('background', '#F9F9F9');
  612. });
  613. });
  614. }
  615. function getDateTime() {
  616. var now = new Date();
  617. var year = now.getFullYear();
  618. var month = now.getMonth()+1;
  619. var day = now.getDate();
  620. var hour = now.getHours();
  621. var minute = now.getMinutes();
  622. var second = now.getSeconds();
  623. if(month.toString().length == 1) { var month = '0' + month; }
  624. if(day.toString().length == 1) { var day = '0' + day; }
  625. if(hour.toString().length == 1) { var hour = '0' + hour; }
  626. if(minute.toString().length == 1) { var minute = '0' + minute; }
  627. if(second.toString().length == 1) { var second = '0' + second; }
  628. var dateTime = year + '/' + month + '/' + day + ' ' + hour + ':' + minute + ':' + second;
  629. return dateTime;
  630. }
  631. </script>
Advertisement
Add Comment
Please, Sign In to add comment