PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | assets/js/dist/admin/editor/quiz.js +107 -121 4.1.7 → 4.4.9 View file →
@@ -1,5 +1,5 @@
1 -/******/ (function() { // webpackBootstrap
1 +/******/ (() => { // webpackBootstrap
2 2 /******/ var __webpack_modules__ = ({
3 3
4 4 /***/ "./assets/src/apps/js/admin/editor/actions/modal-quiz-items.js":
5 5 /*!*********************************************************************!*\
@@ -4,12 +4,15 @@
4 4 /***/ "./assets/src/apps/js/admin/editor/actions/modal-quiz-items.js":
5 5 /*!*********************************************************************!*\
6 6 !*** ./assets/src/apps/js/admin/editor/actions/modal-quiz-items.js ***!
7 7 \*********************************************************************/
8 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9 9
10 10 "use strict";
11 11 __webpack_require__.r(__webpack_exports__);
12 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
13 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14 +/* harmony export */ });
12 15 const ModalQuizItems = {
13 16 toggle: function (context) {
14 17 context.commit('TOGGLE');
15 18 },
@@ -28,13 +31,11 @@
28 31 page: payload.page,
29 32 exclude: JSON.stringify([])
30 33 }).then(function (response) {
31 34 var result = response.body;
32 -
33 35 if (!result.success) {
34 36 return;
35 37 }
36 -
37 38 var data = result.data;
38 39 context.commit('SET_LIST_ITEMS', data.items);
39 40 context.commit('UPDATE_PAGINATION', data.pagination);
40 41 context.commit('SEARCH_ITEM_SUCCESS');
@@ -52,9 +53,8 @@
52 53 context.commit('REMOVE_ADDED_ITEM', index);
53 54 },
54 55 addQuestionsToQuiz: function (context, quiz) {
55 56 var items = context.getters.addedItems;
56 -
57 57 if (items.length > 0) {
58 58 LP.Request({
59 59 type: 'add-questions-to-quiz',
60 60 items: JSON.stringify(items),
@@ -60,12 +60,12 @@
60 60 items: JSON.stringify(items),
61 61 draft_quiz: JSON.stringify(quiz)
62 62 }).then(function (response) {
63 63 var result = response.body;
64 -
65 64 if (result.success) {
66 - var questions = result.data; // update quiz list questions
65 + var questions = result.data;
67 66
67 + // update quiz list questions
68 68 context.commit('lqs/SET_QUESTIONS', questions, {
69 69 root: true
70 70 });
71 71 context.commit('TOGGLE');
@@ -75,9 +75,9 @@
75 75 });
76 76 }
77 77 }
78 78 };
79 -/* harmony default export */ __webpack_exports__["default"] = (ModalQuizItems);
79 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ModalQuizItems);
80 80
81 81 /***/ }),
82 82
83 83 /***/ "./assets/src/apps/js/admin/editor/actions/question-list.js":
@@ -83,23 +83,24 @@
83 83 /***/ "./assets/src/apps/js/admin/editor/actions/question-list.js":
84 84 /*!******************************************************************!*\
85 85 !*** ./assets/src/apps/js/admin/editor/actions/question-list.js ***!
86 86 \******************************************************************/
87 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
87 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
88 88
89 89 "use strict";
90 90 __webpack_require__.r(__webpack_exports__);
91 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
92 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
93 +/* harmony export */ });
91 94 const $ = window.jQuery;
92 95 const QuestionList = {
93 96 toggleAll: function (context) {
94 97 var hidden = context.getters.isHiddenListQuestions;
95 -
96 98 if (hidden) {
97 99 context.commit('OPEN_LIST_QUESTIONS');
98 100 } else {
99 101 context.commit('CLOSE_LIST_QUESTIONS');
100 102 }
101 -
102 103 LP.Request({
103 104 type: 'hidden-questions',
104 105 hidden: context.getters.hiddenQuestions
105 106 });
@@ -118,9 +119,8 @@
118 119 question: JSON.stringify(payload.question),
119 120 draft_quiz: JSON.stringify(payload.quiz)
120 121 }).then(function (response) {
121 122 var result = response.body;
122 -
123 123 if (result.success) {
124 124 context.commit('UPDATE_NEW_QUESTION_TYPE', payload.question.type, {
125 125 root: true
126 126 });
@@ -160,9 +160,8 @@
160 160 question_id: payload.question_id,
161 161 question_type: payload.type
162 162 }).then(function (response) {
163 163 var result = response.body;
164 -
165 164 if (result.success) {
166 165 var question = result.data;
167 166 context.commit('CHANGE_QUESTION_TYPE', question);
168 167 context.commit('UPDATE_NEW_QUESTION_TYPE', question.type.key, {
@@ -180,9 +179,8 @@
180 179 type: 'clone-question',
181 180 question: JSON.stringify(question)
182 181 }).then(function (response) {
183 182 var result = response.body;
184 -
185 183 if (result.success) {
186 184 var question = result.data;
187 185 context.commit('ADD_NEW_QUESTION', result.data);
188 186 context.commit('UPDATE_NEW_QUESTION_TYPE', question.type.key, {
@@ -201,9 +199,8 @@
201 199 type: 'remove-question',
202 200 question_id: question_id
203 201 }).then(function (response) {
204 202 var result = response.body;
205 -
206 203 if (result.success) {
207 204 question.id = question.temp_id;
208 205 question.temp_id = 0;
209 206 context.commit('REMOVE_QUESTION', question);
@@ -233,9 +230,8 @@
233 230 context.commit('CLOSE_QUESTION', question);
234 231 } else {
235 232 context.commit('OPEN_QUESTION', question);
236 233 }
237 -
238 234 LP.Request({
239 235 type: 'hidden-questions',
240 236 hidden: context.getters.hiddenQuestions
241 237 });
@@ -247,9 +243,9 @@
247 243 question_id: payload.question_id,
248 244 order: JSON.stringify(payload.order)
249 245 }).then(function (response) {
250 246 var result = response.body,
251 - order = result.data;
247 + order = result.data;
252 248 context.commit('SORT_QUESTION_ANSWERS', order);
253 249 context.commit('UPDATE_QUESTION_SUCCESS', payload.question_id);
254 250 }, function (error) {
255 251 context.commit('UPDATE_QUESTION_FAILURE', payload.question_id);
@@ -277,9 +273,8 @@
277 273 question_id: payload.question_id,
278 274 correct: JSON.stringify(payload.correct)
279 275 }).then(function (response) {
280 276 var result = response.body;
281 -
282 277 if (result.success) {
283 278 context.commit('CHANGE_QUESTION_CORRECT_ANSWERS', result.data);
284 279 context.commit('UPDATE_QUESTION_SUCCESS', payload.question_id);
285 280 }
@@ -297,14 +292,13 @@
297 292 question_id: payload.question_id,
298 293 answer_id: payload.answer_id
299 294 }).then(function (response) {
300 295 var result = response.body;
301 -
302 296 if (result.success) {
303 297 context.commit('DELETE_QUESTION_ANSWER', {
304 298 question_id: payload.question_id,
305 - answer_id: payload.temp_id //answer_id: payload.answer_id
306 -
299 + answer_id: payload.temp_id
300 + //answer_id: payload.answer_id
307 301 });
308 302 context.commit('UPDATE_QUESTION_SUCCESS', payload.question_id);
309 303 }
310 304 }, function (error) {
@@ -313,9 +307,9 @@
313 307 });
314 308 },
315 309 newQuestionAnswer: function (context, data) {
316 310 var temp_id = LP.uniqueId(),
317 - question_id = data.question_id;
311 + question_id = data.question_id;
318 312 context.commit('UPDATE_QUESTION_REQUEST', question_id);
319 313 context.commit('ADD_QUESTION_ANSWER', {
320 314 question_id: question_id,
321 315 answer: {
@@ -328,9 +322,8 @@
328 322 question_id: question_id,
329 323 question_answer_id: temp_id
330 324 }).then(function (response) {
331 325 var result = response.body;
332 -
333 326 if (result.success) {
334 327 var answer = result.data;
335 328 context.commit('ADD_QUESTION_ANSWER', {
336 329 question_id: question_id,
@@ -369,9 +362,9 @@
369 362 context.commit('UPDATE_QUESTION_FAILURE', payload.question.id);
370 363 });
371 364 }
372 365 };
373 -/* harmony default export */ __webpack_exports__["default"] = (QuestionList);
366 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (QuestionList);
374 367
375 368 /***/ }),
376 369
377 370 /***/ "./assets/src/apps/js/admin/editor/actions/quiz.js":
@@ -377,12 +370,15 @@
377 370 /***/ "./assets/src/apps/js/admin/editor/actions/quiz.js":
378 371 /*!*********************************************************!*\
379 372 !*** ./assets/src/apps/js/admin/editor/actions/quiz.js ***!
380 373 \*********************************************************/
381 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
374 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
382 375
383 376 "use strict";
384 377 __webpack_require__.r(__webpack_exports__);
378 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
379 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
380 +/* harmony export */ });
385 381 const Quiz = {
386 382 heartbeat: function (context) {
387 383 LP.Request({
388 384 type: 'heartbeat'
@@ -395,9 +391,8 @@
395 391 },
396 392 newRequest: function (context) {
397 393 context.commit('INCREASE_NUMBER_REQUEST');
398 394 context.commit('UPDATE_STATUS', 'loading');
399 -
400 395 window.onbeforeunload = function () {
401 396 return '';
402 397 };
403 398 },
@@ -402,9 +397,8 @@
402 397 };
403 398 },
404 399 requestCompleted: function (context, status) {
405 400 context.commit('DECREASE_NUMBER_REQUEST');
406 -
407 401 if (context.getters.currentRequest === 0) {
408 402 context.commit('UPDATE_STATUS', status);
409 403 window.onbeforeunload = null;
410 404 }
@@ -409,9 +403,9 @@
409 403 window.onbeforeunload = null;
410 404 }
411 405 }
412 406 };
413 -/* harmony default export */ __webpack_exports__["default"] = (Quiz);
407 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Quiz);
414 408
415 409 /***/ }),
416 410
417 411 /***/ "./assets/src/apps/js/admin/editor/fill-in-blanks.js":
@@ -417,25 +411,21 @@
417 411 /***/ "./assets/src/apps/js/admin/editor/fill-in-blanks.js":
418 412 /*!***********************************************************!*\
419 413 !*** ./assets/src/apps/js/admin/editor/fill-in-blanks.js ***!
420 414 \***********************************************************/
421 -/***/ (function() {
415 +/***/ (() => {
422 416
423 417 (function ($) {
424 418 window.FIB = {
425 419 getSelectedText: function getSelectedText() {
426 420 let html = '';
427 -
428 421 if (typeof window.getSelection !== 'undefined') {
429 422 const sel = window.getSelection();
430 -
431 423 if (sel.rangeCount) {
432 424 const container = document.createElement('div');
433 -
434 425 for (let i = 0, len = sel.rangeCount; i < len; ++i) {
435 426 container.appendChild(sel.getRangeAt(i).cloneContents());
436 427 }
437 -
438 428 html = container.innerHTML;
439 429 }
440 430 } else if (typeof document.selection !== 'undefined') {
441 431 if (document.selection.type === 'Text') {
@@ -441,24 +431,20 @@
441 431 if (document.selection.type === 'Text') {
442 432 html = document.selection.createRange().htmlText;
443 433 }
444 434 }
445 -
446 435 return html;
447 436 },
448 -
449 437 createTextNode(content) {
450 438 return document.createTextNode(content);
451 439 },
452 -
453 440 isContainHtml: function isContainHtml(content) {
454 441 const $el = $(content),
455 - sel = 'b.fib-blank';
442 + sel = 'b.fib-blank';
456 443 return $el.is(sel) || $el.find(sel).length || $el.parent().is(sel);
457 444 },
458 445 getSelectionRange: function getSelectionRange() {
459 446 let t = '';
460 -
461 447 if (window.getSelection) {
462 448 t = window.getSelection();
463 449 } else if (document.getSelection) {
464 450 t = document.getSelection();
@@ -464,16 +450,13 @@
464 450 t = document.getSelection();
465 451 } else if (document.selection) {
466 452 t = document.selection.createRange().text;
467 453 }
468 -
469 454 return t;
470 455 },
471 -
472 456 outerHTML($dom) {
473 457 return $('<div>').append($($dom).clone()).html();
474 458 },
475 -
476 459 doUpgrade(callback) {
477 460 $.ajax({
478 461 url: '',
479 462 data: {
@@ -478,17 +461,14 @@
478 461 url: '',
479 462 data: {
480 463 'lp-ajax': 'fib-upgrade'
481 464 },
482 -
483 465 success(res) {
484 466 console.log(res);
485 467 callback && callback.call(res);
486 468 }
487 -
488 469 });
489 470 }
490 -
491 471 };
492 472 $(document).ready(function () {
493 473 $('#do-upgrade-fib').on('click', function () {
494 474 const $button = $(this).prop('disabled', true).addClass('ajaxloading');
@@ -504,12 +484,15 @@
504 484 /***/ "./assets/src/apps/js/admin/editor/getters/modal-quiz-items.js":
505 485 /*!*********************************************************************!*\
506 486 !*** ./assets/src/apps/js/admin/editor/getters/modal-quiz-items.js ***!
507 487 \*********************************************************************/
508 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
488 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
509 489
510 490 "use strict";
511 491 __webpack_require__.r(__webpack_exports__);
492 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
493 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
494 +/* harmony export */ });
512 495 const ModalQuizItems = {
513 496 status: function (state) {
514 497 return state.status;
515 498 },
@@ -520,9 +503,8 @@
520 503 return state.items.map(function (item) {
521 504 var find = _getters.addedItems.find(function (_item) {
522 505 return item.id === _item.id;
523 506 });
524 -
525 507 item.added = !!find;
526 508 return item;
527 509 });
528 510 },
@@ -538,9 +520,9 @@
538 520 quiz: function (state) {
539 521 return state.quizId;
540 522 }
541 523 };
542 -/* harmony default export */ __webpack_exports__["default"] = (ModalQuizItems);
524 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ModalQuizItems);
543 525
544 526 /***/ }),
545 527
546 528 /***/ "./assets/src/apps/js/admin/editor/getters/question-list.js":
@@ -546,12 +528,15 @@
546 528 /***/ "./assets/src/apps/js/admin/editor/getters/question-list.js":
547 529 /*!******************************************************************!*\
548 530 !*** ./assets/src/apps/js/admin/editor/getters/question-list.js ***!
549 531 \******************************************************************/
550 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
532 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
551 533
552 534 "use strict";
553 535 __webpack_require__.r(__webpack_exports__);
536 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
537 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
538 +/* harmony export */ });
554 539 const QuestionList = {
555 540 listQuestions: function (state) {
556 541 return state.questions || [];
557 542 },
@@ -591,9 +576,9 @@
591 576 statusUpdateQuestionAnswer: function (state) {
592 577 return state.statusUpdateQuestionAnswer;
593 578 }
594 579 };
595 -/* harmony default export */ __webpack_exports__["default"] = (QuestionList);
580 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (QuestionList);
596 581
597 582 /***/ }),
598 583
599 584 /***/ "./assets/src/apps/js/admin/editor/getters/quiz.js":
@@ -599,12 +584,15 @@
599 584 /***/ "./assets/src/apps/js/admin/editor/getters/quiz.js":
600 585 /*!*********************************************************!*\
601 586 !*** ./assets/src/apps/js/admin/editor/getters/quiz.js ***!
602 587 \*********************************************************/
603 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
588 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
604 589
605 590 "use strict";
606 591 __webpack_require__.r(__webpack_exports__);
592 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
593 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
594 +/* harmony export */ });
607 595 const Quiz = {
608 596 heartbeat: function (state) {
609 597 return state.heartbeat;
610 598 },
@@ -629,9 +617,9 @@
629 617 nonce: function (state) {
630 618 return state.nonce;
631 619 }
632 620 };
633 -/* harmony default export */ __webpack_exports__["default"] = (Quiz);
621 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Quiz);
634 622
635 623 /***/ }),
636 624
637 625 /***/ "./assets/src/apps/js/admin/editor/http.js":
@@ -637,14 +625,14 @@
637 625 /***/ "./assets/src/apps/js/admin/editor/http.js":
638 626 /*!*************************************************!*\
639 627 !*** ./assets/src/apps/js/admin/editor/http.js ***!
640 628 \*************************************************/
641 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
629 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
642 630
643 631 "use strict";
644 632 __webpack_require__.r(__webpack_exports__);
645 633 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
646 -/* harmony export */ "default": function() { return /* binding */ HTTP; }
634 +/* harmony export */ "default": () => (/* binding */ HTTP)
647 635 /* harmony export */ });
648 636 function HTTP(options) {
649 637 const $ = window.jQuery || jQuery;
650 638 const $VueHTTP = Vue.http;
@@ -652,15 +640,15 @@
652 640 ns: 'LPRequest',
653 641 store: false
654 642 }, options || {});
655 643 let $publishingAction = null;
656 -
657 644 LP.Request = function (payload) {
658 645 $publishingAction = $('#publishing-action');
659 646 payload.id = options.store.getters.id;
660 647 payload.nonce = options.store.getters.nonce;
661 648 payload['lp-ajax'] = options.store.getters.action;
662 - payload.code = options.store.getters.code;
649 + //payload.code = options.store.getters.code;
650 +
663 651 $publishingAction.find('#publish').addClass('disabled');
664 652 $publishingAction.find('.spinner').addClass('is-active');
665 653 $publishingAction.addClass('code-' + payload.code);
666 654 return $VueHTTP.post(options.store.getters.urlAjax, payload, {
@@ -670,32 +658,26 @@
670 658 code: payload.code
671 659 }
672 660 });
673 661 };
674 -
675 662 $VueHTTP.interceptors.push(function (request, next) {
676 663 if (request.params.namespace !== options.ns) {
677 664 next();
678 665 return;
679 666 }
680 -
681 667 options.store.dispatch('newRequest');
682 668 next(function (response) {
683 669 if (!jQuery.isPlainObject(response.body)) {
684 670 response.body = LP.parseJSON(response.body);
685 671 }
686 -
687 672 const body = response.body;
688 673 const result = body.success || false;
689 -
690 674 if (result) {
691 675 options.store.dispatch('requestCompleted', 'successful');
692 676 } else {
693 677 options.store.dispatch('requestCompleted', 'failed');
694 678 }
695 -
696 679 $publishingAction.removeClass('code-' + request.params.code);
697 -
698 680 if (!$publishingAction.attr('class')) {
699 681 $publishingAction.find('#publish').removeClass('disabled');
700 682 $publishingAction.find('.spinner').removeClass('is-active');
701 683 }
@@ -708,12 +690,15 @@
708 690 /***/ "./assets/src/apps/js/admin/editor/mutations/modal-quiz-items.js":
709 691 /*!***********************************************************************!*\
710 692 !*** ./assets/src/apps/js/admin/editor/mutations/modal-quiz-items.js ***!
711 693 \***********************************************************************/
712 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
694 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
713 695
714 696 "use strict";
715 697 __webpack_require__.r(__webpack_exports__);
698 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
699 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
700 +/* harmony export */ });
716 701 const ModalQuizItems = {
717 702 TOGGLE: function (state) {
718 703 state.open = !state.open;
719 704 },
@@ -749,9 +734,9 @@
749 734 SEARCH_ITEM_FAIL: function (state) {
750 735 state.status = 'fail';
751 736 }
752 737 };
753 -/* harmony default export */ __webpack_exports__["default"] = (ModalQuizItems);
738 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ModalQuizItems);
754 739
755 740 /***/ }),
756 741
757 742 /***/ "./assets/src/apps/js/admin/editor/mutations/question-list.js":
@@ -757,12 +742,15 @@
757 742 /***/ "./assets/src/apps/js/admin/editor/mutations/question-list.js":
758 743 /*!********************************************************************!*\
759 744 !*** ./assets/src/apps/js/admin/editor/mutations/question-list.js ***!
760 745 \********************************************************************/
761 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
746 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
762 747
763 748 "use strict";
764 749 __webpack_require__.r(__webpack_exports__);
750 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
751 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
752 +/* harmony export */ });
765 753 var $ = window.jQuery;
766 754 const QuestionList = {
767 755 SORT_QUESTIONS: function (state, orders) {
768 756 state.questions = state.questions.map(function (question) {
@@ -779,9 +767,8 @@
779 767 ADD_QUESTION_ANSWER: function (state, payload) {
780 768 state.questions = state.questions.map(function (question) {
781 769 if (question.id === payload.question_id) {
782 770 var found = false;
783 -
784 771 if (payload.answer.temp_id) {
785 772 for (var i = 0, n = question.answers.length; i < n; i++) {
786 773 if (question.answers[i].question_answer_id == payload.answer.temp_id) {
787 774 found = true;
@@ -788,13 +775,11 @@
788 775 $Vue.set(question.answers, i, payload.answer);
789 776 }
790 777 }
791 778 }
792 -
793 779 !found && question.answers.push(payload.answer);
794 780 return question;
795 781 }
796 -
797 782 return question;
798 783 });
799 784 },
800 785 CHANGE_QUESTION_CORRECT_ANSWERS: function (state, data) {
@@ -801,9 +786,8 @@
801 786 state.questions = state.questions.map(function (question) {
802 787 if (parseInt(question.id) === data.id) {
803 788 question.answers = data.answers;
804 789 }
805 -
806 790 return question;
807 791 });
808 792 },
809 793 SET_QUESTIONS: function (state, questions) {
@@ -810,9 +794,8 @@
810 794 state.questions = questions;
811 795 },
812 796 ADD_NEW_QUESTION: function (state, question) {
813 797 var found = false;
814 -
815 798 if (question.temp_id) {
816 799 for (var i = 0, n = state.questions.length; i < n; i++) {
817 800 if (state.questions[i].id === question.temp_id) {
818 801 $Vue.set(state.questions, i, question);
@@ -820,20 +803,16 @@
820 803 break;
821 804 }
822 805 }
823 806 }
824 -
825 807 if (!found) {
826 808 var _last_child = $('.lp-list-questions .main > div:last-child');
827 -
828 809 if (_last_child.length) {
829 810 var _offset = _last_child.offset().top;
830 -
831 811 $('html,body').animate({
832 812 scrollTop: _offset
833 813 });
834 814 }
835 -
836 815 state.questions.push(question);
837 816 }
838 817 },
839 818 CHANGE_QUESTION_TYPE: function (state, data) {
@@ -842,16 +821,14 @@
842 821 question.answers = data.answers;
843 822 question.type = data.type;
844 823 question.open = true;
845 824 }
846 -
847 825 return question;
848 826 });
849 827 },
850 828 REMOVE_QUESTION: function (state, item) {
851 829 var questions = state.questions,
852 - index = questions.indexOf(item);
853 -
830 + index = questions.indexOf(item);
854 831 if (item.temp_id) {
855 832 state.questions[index].id = item.temp_id;
856 833 } else {
857 834 state.questions.splice(index, 1);
@@ -858,9 +835,9 @@
858 835 }
859 836 },
860 837 DELETE_QUESTION_ANSWER: function (state, payload) {
861 838 var question_id = payload.question_id,
862 - answer_id = payload.answer_id;
839 + answer_id = payload.answer_id;
863 840 state.questions = state.questions.map(function (question) {
864 841 if (question.id === question_id) {
865 842 var answers = question.answers;
866 843 answers.forEach(function (answer) {
@@ -869,13 +846,13 @@
869 846 answers.splice(index, 1);
870 847 }
871 848 });
872 849 }
873 -
874 850 return question;
875 851 });
876 852 },
877 - REMOVE_QUESTIONS: function () {// code
853 + REMOVE_QUESTIONS: function () {
854 + // code
878 855 },
879 856 CLOSE_QUESTION: function (state, question) {
880 857 state.questions.forEach(function (_question, index) {
881 858 if (question.id === _question.id) {
@@ -924,20 +901,19 @@
924 901 state.questions.map(function (question, index) {
925 902 if (question.id == data.question_id) {
926 903 for (var i = 0, n = question.answers.length; i < n; i++) {
927 904 if (question.answers[i].question_answer_id == data.answer_id) {
928 - question.answers[i].question_answer_id = data.temp_id; //state.questions[index].answers.splice(i, 1);
929 -
905 + question.answers[i].question_answer_id = data.temp_id;
906 + //state.questions[index].answers.splice(i, 1);
930 907 break;
931 908 }
932 909 }
933 -
934 910 return false;
935 911 }
936 912 });
937 913 }
938 914 };
939 -/* harmony default export */ __webpack_exports__["default"] = (QuestionList);
915 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (QuestionList);
940 916
941 917 /***/ }),
942 918
943 919 /***/ "./assets/src/apps/js/admin/editor/mutations/quiz.js":
@@ -943,12 +919,15 @@
943 919 /***/ "./assets/src/apps/js/admin/editor/mutations/quiz.js":
944 920 /*!***********************************************************!*\
945 921 !*** ./assets/src/apps/js/admin/editor/mutations/quiz.js ***!
946 922 \***********************************************************/
947 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
923 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
948 924
949 925 "use strict";
950 926 __webpack_require__.r(__webpack_exports__);
927 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
928 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
929 +/* harmony export */ });
951 930 const Quiz = {
952 931 UPDATE_HEART_BEAT: function (state, status) {
953 932 state.heartbeat = !!status;
954 933 },
@@ -964,9 +943,9 @@
964 943 DECREASE_NUMBER_REQUEST: function (state) {
965 944 state.countCurrentRequest--;
966 945 }
967 946 };
968 -/* harmony default export */ __webpack_exports__["default"] = (Quiz);
947 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Quiz);
969 948
970 949 /***/ }),
971 950
972 951 /***/ "./assets/src/apps/js/admin/editor/store/i18n.js":
@@ -972,14 +951,16 @@
972 951 /***/ "./assets/src/apps/js/admin/editor/store/i18n.js":
973 952 /*!*******************************************************!*\
974 953 !*** ./assets/src/apps/js/admin/editor/store/i18n.js ***!
975 954 \*******************************************************/
976 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
955 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
977 956
978 957 "use strict";
979 958 __webpack_require__.r(__webpack_exports__);
959 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
960 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
961 +/* harmony export */ });
980 962 const $ = window.jQuery || jQuery;
981 -
982 963 const i18n = function i18n(i18n) {
983 964 const state = $.extend({}, i18n);
984 965 const getters = {
985 966 all: function (state) {
@@ -991,11 +972,10 @@
991 972 state: state,
992 973 getters: getters
993 974 };
994 975 };
976 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (i18n);
995 977
996 -/* harmony default export */ __webpack_exports__["default"] = (i18n);
997 -
998 978 /***/ }),
999 979
1000 980 /***/ "./assets/src/apps/js/admin/editor/store/modal-quiz-items.js":
1001 981 /*!*******************************************************************!*\
@@ -1000,12 +980,15 @@
1000 980 /***/ "./assets/src/apps/js/admin/editor/store/modal-quiz-items.js":
1001 981 /*!*******************************************************************!*\
1002 982 !*** ./assets/src/apps/js/admin/editor/store/modal-quiz-items.js ***!
1003 983 \*******************************************************************/
1004 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
984 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1005 985
1006 986 "use strict";
1007 987 __webpack_require__.r(__webpack_exports__);
988 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
989 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
990 +/* harmony export */ });
1008 991 /* harmony import */ var _getters_modal_quiz_items__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/modal-quiz-items */ "./assets/src/apps/js/admin/editor/getters/modal-quiz-items.js");
1009 992 /* harmony import */ var _mutations_modal_quiz_items__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/modal-quiz-items */ "./assets/src/apps/js/admin/editor/mutations/modal-quiz-items.js");
1010 993 /* harmony import */ var _actions_modal_quiz_items__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/modal-quiz-items */ "./assets/src/apps/js/admin/editor/actions/modal-quiz-items.js");
1011 994
@@ -1011,9 +994,8 @@
1011 994
1012 995
1013 996
1014 997 const $ = window.jQuery || jQuery;
1015 -
1016 998 const Quiz = function (data) {
1017 999 var state = $.extend({
1018 1000 quizId: false,
1019 1001 pagination: '',
@@ -1026,11 +1008,10 @@
1026 1008 mutations: _mutations_modal_quiz_items__WEBPACK_IMPORTED_MODULE_1__["default"],
1027 1009 actions: _actions_modal_quiz_items__WEBPACK_IMPORTED_MODULE_2__["default"]
1028 1010 };
1029 1011 };
1012 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Quiz);
1030 1013
1031 -/* harmony default export */ __webpack_exports__["default"] = (Quiz);
1032 -
1033 1014 /***/ }),
1034 1015
1035 1016 /***/ "./assets/src/apps/js/admin/editor/store/question-list.js":
1036 1017 /*!****************************************************************!*\
@@ -1035,12 +1016,15 @@
1035 1016 /***/ "./assets/src/apps/js/admin/editor/store/question-list.js":
1036 1017 /*!****************************************************************!*\
1037 1018 !*** ./assets/src/apps/js/admin/editor/store/question-list.js ***!
1038 1019 \****************************************************************/
1039 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1020 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1040 1021
1041 1022 "use strict";
1042 1023 __webpack_require__.r(__webpack_exports__);
1024 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1025 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1026 +/* harmony export */ });
1043 1027 /* harmony import */ var _getters_question_list__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/question-list */ "./assets/src/apps/js/admin/editor/getters/question-list.js");
1044 1028 /* harmony import */ var _mutations_question_list__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/question-list */ "./assets/src/apps/js/admin/editor/mutations/question-list.js");
1045 1029 /* harmony import */ var _actions_question_list__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/question-list */ "./assets/src/apps/js/admin/editor/actions/question-list.js");
1046 1030
@@ -1046,18 +1030,18 @@
1046 1030
1047 1031
1048 1032
1049 1033 const $ = window.jQuery || jQuery;
1050 -
1051 1034 const QuestionList = function QuestionList(data) {
1052 1035 const listQuestions = data.listQuestions;
1053 - var state = $.extend({
1036 + const state = $.extend({
1054 1037 statusUpdateQuestions: {},
1055 1038 statusUpdateQuestionItem: {},
1056 1039 statusUpdateQuestionAnswer: {},
1057 1040 questions: listQuestions.questions.map(function (question) {
1058 - var hiddenQuestions = listQuestions.hidden_questions;
1059 - var find = hiddenQuestions.find(function (questionId) {
1041 + const hiddenQuestions = listQuestions.hidden_questions;
1042 + const ArrQuestionIds = Object.keys(hiddenQuestions);
1043 + const find = ArrQuestionIds.find(function (questionId) {
1060 1044 return parseInt(question.id) === parseInt(questionId);
1061 1045 });
1062 1046 question.open = !find;
1063 1047 return question;
@@ -1064,17 +1048,16 @@
1064 1048 })
1065 1049 }, listQuestions);
1066 1050 return {
1067 1051 namespaced: true,
1068 - state: state,
1052 + state,
1069 1053 getters: _getters_question_list__WEBPACK_IMPORTED_MODULE_0__["default"],
1070 1054 mutations: _mutations_question_list__WEBPACK_IMPORTED_MODULE_1__["default"],
1071 1055 actions: _actions_question_list__WEBPACK_IMPORTED_MODULE_2__["default"]
1072 1056 };
1073 1057 };
1058 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (QuestionList);
1074 1059
1075 -/* harmony default export */ __webpack_exports__["default"] = (QuestionList);
1076 -
1077 1060 /***/ }),
1078 1061
1079 1062 /***/ "./assets/src/apps/js/admin/editor/store/quiz.js":
1080 1063 /*!*******************************************************!*\
@@ -1079,12 +1062,15 @@
1079 1062 /***/ "./assets/src/apps/js/admin/editor/store/quiz.js":
1080 1063 /*!*******************************************************!*\
1081 1064 !*** ./assets/src/apps/js/admin/editor/store/quiz.js ***!
1082 1065 \*******************************************************/
1083 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1066 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1084 1067
1085 1068 "use strict";
1086 1069 __webpack_require__.r(__webpack_exports__);
1070 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1071 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1072 +/* harmony export */ });
1087 1073 /* harmony import */ var _getters_quiz__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/quiz */ "./assets/src/apps/js/admin/editor/getters/quiz.js");
1088 1074 /* harmony import */ var _mutations_quiz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/quiz */ "./assets/src/apps/js/admin/editor/mutations/quiz.js");
1089 1075 /* harmony import */ var _actions_quiz__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/quiz */ "./assets/src/apps/js/admin/editor/actions/quiz.js");
1090 1076 /* harmony import */ var _store_modal_quiz_items__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../store/modal-quiz-items */ "./assets/src/apps/js/admin/editor/store/modal-quiz-items.js");
@@ -1096,9 +1082,8 @@
1096 1082
1097 1083
1098 1084
1099 1085 const $ = window.jQuery || jQuery;
1100 -
1101 1086 const Quiz = function Quiz(data) {
1102 1087 const state = $.extend({
1103 1088 status: 'success',
1104 1089 heartbeat: true,
@@ -1115,11 +1100,10 @@
1115 1100 lqs: (0,_store_question_list__WEBPACK_IMPORTED_MODULE_5__["default"])(data)
1116 1101 }
1117 1102 };
1118 1103 };
1104 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Quiz);
1119 1105
1120 -/* harmony default export */ __webpack_exports__["default"] = (Quiz);
1121 -
1122 1106 /***/ })
1123 1107
1124 1108 /******/ });
1125 1109 /************************************************************************/
@@ -1148,23 +1132,23 @@
1148 1132 /******/ }
1149 1133 /******/
1150 1134 /************************************************************************/
1151 1135 /******/ /* webpack/runtime/compat get default export */
1152 -/******/ !function() {
1136 +/******/ (() => {
1153 1137 /******/ // getDefaultExport function for compatibility with non-harmony modules
1154 -/******/ __webpack_require__.n = function(module) {
1138 +/******/ __webpack_require__.n = (module) => {
1155 1139 /******/ var getter = module && module.__esModule ?
1156 -/******/ function() { return module['default']; } :
1157 -/******/ function() { return module; };
1140 +/******/ () => (module['default']) :
1141 +/******/ () => (module);
1158 1142 /******/ __webpack_require__.d(getter, { a: getter });
1159 1143 /******/ return getter;
1160 1144 /******/ };
1161 -/******/ }();
1145 +/******/ })();
1162 1146 /******/
1163 1147 /******/ /* webpack/runtime/define property getters */
1164 -/******/ !function() {
1148 +/******/ (() => {
1165 1149 /******/ // define getter functions for harmony exports
1166 -/******/ __webpack_require__.d = function(exports, definition) {
1150 +/******/ __webpack_require__.d = (exports, definition) => {
1167 1151 /******/ for(var key in definition) {
1168 1152 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
1169 1153 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
1170 1154 /******/ }
@@ -1169,30 +1153,30 @@
1169 1153 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
1170 1154 /******/ }
1171 1155 /******/ }
1172 1156 /******/ };
1173 -/******/ }();
1157 +/******/ })();
1174 1158 /******/
1175 1159 /******/ /* webpack/runtime/hasOwnProperty shorthand */
1176 -/******/ !function() {
1177 -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
1178 -/******/ }();
1160 +/******/ (() => {
1161 +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
1162 +/******/ })();
1179 1163 /******/
1180 1164 /******/ /* webpack/runtime/make namespace object */
1181 -/******/ !function() {
1165 +/******/ (() => {
1182 1166 /******/ // define __esModule on exports
1183 -/******/ __webpack_require__.r = function(exports) {
1167 +/******/ __webpack_require__.r = (exports) => {
1184 1168 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1185 1169 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1186 1170 /******/ }
1187 1171 /******/ Object.defineProperty(exports, '__esModule', { value: true });
1188 1172 /******/ };
1189 -/******/ }();
1173 +/******/ })();
1190 1174 /******/
1191 1175 /************************************************************************/
1192 1176 var __webpack_exports__ = {};
1193 1177 // This entry need to be wrapped in an IIFE because it need to be in strict mode.
1194 -!function() {
1178 +(() => {
1195 1179 "use strict";
1196 1180 /*!*************************************************!*\
1197 1181 !*** ./assets/src/apps/js/admin/editor/quiz.js ***!
1198 1182 \*************************************************/
@@ -1205,8 +1189,9 @@
1205 1189
1206 1190
1207 1191 window.$Vue = window.$Vue || Vue;
1208 1192 window.$Vuex = window.$Vuex || Vuex;
1193 +
1209 1194 /**
1210 1195 * Init app.
1211 1196 *
1212 1197 * @since 3.0.0
@@ -1224,8 +1209,9 @@
1224 1209 template: '<lp-quiz-editor></lp-quiz-editor>'
1225 1210 });
1226 1211 }, 100);
1227 1212 });
1228 -}();
1213 +})();
1214 +
1229 1215 /******/ })()
1230 1216 ;
1231 1217 //# sourceMappingURL=quiz.js.map