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/question.js +51 -73 4.1.6.9.2 → 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/question.js":
5 5 /*!*************************************************************!*\
@@ -4,12 +4,15 @@
4 4 /***/ "./assets/src/apps/js/admin/editor/actions/question.js":
5 5 /*!*************************************************************!*\
6 6 !*** ./assets/src/apps/js/admin/editor/actions/question.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 Question = {
13 16 changeQuestionType(context, payload) {
14 17 const draftQuestion = undefined !== payload.question ? payload.question : '';
15 18 LP.Request({
@@ -17,9 +20,8 @@
17 20 question_type: payload.type,
18 21 draft_question: context.getters.autoDraft ? draftQuestion : ''
19 22 }).then(function (response) {
20 23 const result = response.body;
21 -
22 24 if (result.success) {
23 25 context.commit('UPDATE_AUTO_DRAFT_STATUS', false);
24 26 context.commit('CHANGE_QUESTION_TYPE', result.data);
25 27 }
@@ -24,9 +26,8 @@
24 26 context.commit('CHANGE_QUESTION_TYPE', result.data);
25 27 }
26 28 });
27 29 },
28 -
29 30 updateAnswersOrder(context, order) {
30 31 LP.Request({
31 32 type: 'sort-answer',
32 33 order
@@ -31,19 +32,17 @@
31 32 type: 'sort-answer',
32 33 order
33 34 }).then(function (response) {
34 35 const result = response.body;
35 -
36 - if (result.success) {// context.commit('SET_ANSWERS', result.data);
36 + if (result.success) {
37 + // context.commit('SET_ANSWERS', result.data);
37 38 }
38 39 });
39 40 },
40 -
41 41 updateAnswerTitle(context, answer) {
42 42 if (typeof answer.question_answer_id == 'undefined') {
43 43 return;
44 44 }
45 -
46 45 answer = JSON.stringify(answer);
47 46 LP.Request({
48 47 type: 'update-answer-title',
49 48 answer
@@ -48,9 +47,8 @@
48 47 type: 'update-answer-title',
49 48 answer
50 49 });
51 50 },
52 -
53 51 updateCorrectAnswer(context, correct) {
54 52 LP.Request({
55 53 type: 'change-correct',
56 54 correct: JSON.stringify(correct)
@@ -55,9 +53,8 @@
55 53 type: 'change-correct',
56 54 correct: JSON.stringify(correct)
57 55 }).then(function (response) {
58 56 const result = response.body;
59 -
60 57 if (result.success) {
61 58 context.commit('UPDATE_ANSWERS', result.data);
62 59 context.commit('UPDATE_AUTO_DRAFT_STATUS', false);
63 60 }
@@ -62,9 +59,8 @@
62 59 context.commit('UPDATE_AUTO_DRAFT_STATUS', false);
63 60 }
64 61 });
65 62 },
66 -
67 63 deleteAnswer(context, payload) {
68 64 context.commit('DELETE_ANSWER', payload.id);
69 65 LP.Request({
70 66 type: 'delete-answer',
@@ -70,16 +66,15 @@
70 66 type: 'delete-answer',
71 67 answer_id: payload.id
72 68 }).then(function (response) {
73 69 const result = response.body;
74 -
75 70 if (result.success) {
76 71 context.commit('SET_ANSWERS', result.data);
77 - } else {// notice error
72 + } else {
73 + // notice error
78 74 }
79 75 });
80 76 },
81 -
82 77 newAnswer(context, data) {
83 78 context.commit('ADD_NEW_ANSWER', data.answer);
84 79 LP.Request({
85 80 type: 'new-answer'
@@ -84,36 +79,31 @@
84 79 LP.Request({
85 80 type: 'new-answer'
86 81 }).then(function (response) {
87 82 const result = response.body;
88 -
89 83 if (result.success) {
90 84 context.commit('UPDATE_ANSWERS', result.data);
91 - } else {// notice error
85 + } else {
86 + // notice error
92 87 }
93 88 });
94 89 },
95 -
96 90 newRequest(context) {
97 91 context.commit('INCREASE_NUMBER_REQUEST');
98 92 context.commit('UPDATE_STATUS', 'loading');
99 -
100 93 window.onbeforeunload = function () {
101 94 return '';
102 95 };
103 96 },
104 -
105 97 requestCompleted(context, status) {
106 98 context.commit('DECREASE_NUMBER_REQUEST');
107 -
108 99 if (context.getters.currentRequest === 0) {
109 100 context.commit('UPDATE_STATUS', status);
110 101 window.onbeforeunload = null;
111 102 }
112 103 }
113 -
114 104 };
115 -/* harmony default export */ __webpack_exports__["default"] = (Question);
105 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Question);
116 106
117 107 /***/ }),
118 108
119 109 /***/ "./assets/src/apps/js/admin/editor/fill-in-blanks.js":
@@ -119,25 +109,21 @@
119 109 /***/ "./assets/src/apps/js/admin/editor/fill-in-blanks.js":
120 110 /*!***********************************************************!*\
121 111 !*** ./assets/src/apps/js/admin/editor/fill-in-blanks.js ***!
122 112 \***********************************************************/
123 -/***/ (function() {
113 +/***/ (() => {
124 114
125 115 (function ($) {
126 116 window.FIB = {
127 117 getSelectedText: function getSelectedText() {
128 118 let html = '';
129 -
130 119 if (typeof window.getSelection !== 'undefined') {
131 120 const sel = window.getSelection();
132 -
133 121 if (sel.rangeCount) {
134 122 const container = document.createElement('div');
135 -
136 123 for (let i = 0, len = sel.rangeCount; i < len; ++i) {
137 124 container.appendChild(sel.getRangeAt(i).cloneContents());
138 125 }
139 -
140 126 html = container.innerHTML;
141 127 }
142 128 } else if (typeof document.selection !== 'undefined') {
143 129 if (document.selection.type === 'Text') {
@@ -143,24 +129,20 @@
143 129 if (document.selection.type === 'Text') {
144 130 html = document.selection.createRange().htmlText;
145 131 }
146 132 }
147 -
148 133 return html;
149 134 },
150 -
151 135 createTextNode(content) {
152 136 return document.createTextNode(content);
153 137 },
154 -
155 138 isContainHtml: function isContainHtml(content) {
156 139 const $el = $(content),
157 - sel = 'b.fib-blank';
140 + sel = 'b.fib-blank';
158 141 return $el.is(sel) || $el.find(sel).length || $el.parent().is(sel);
159 142 },
160 143 getSelectionRange: function getSelectionRange() {
161 144 let t = '';
162 -
163 145 if (window.getSelection) {
164 146 t = window.getSelection();
165 147 } else if (document.getSelection) {
166 148 t = document.getSelection();
@@ -166,16 +148,13 @@
166 148 t = document.getSelection();
167 149 } else if (document.selection) {
168 150 t = document.selection.createRange().text;
169 151 }
170 -
171 152 return t;
172 153 },
173 -
174 154 outerHTML($dom) {
175 155 return $('<div>').append($($dom).clone()).html();
176 156 },
177 -
178 157 doUpgrade(callback) {
179 158 $.ajax({
180 159 url: '',
181 160 data: {
@@ -180,17 +159,14 @@
180 159 url: '',
181 160 data: {
182 161 'lp-ajax': 'fib-upgrade'
183 162 },
184 -
185 163 success(res) {
186 164 console.log(res);
187 165 callback && callback.call(res);
188 166 }
189 -
190 167 });
191 168 }
192 -
193 169 };
194 170 $(document).ready(function () {
195 171 $('#do-upgrade-fib').on('click', function () {
196 172 const $button = $(this).prop('disabled', true).addClass('ajaxloading');
@@ -206,12 +182,15 @@
206 182 /***/ "./assets/src/apps/js/admin/editor/getters/question.js":
207 183 /*!*************************************************************!*\
208 184 !*** ./assets/src/apps/js/admin/editor/getters/question.js ***!
209 185 \*************************************************************/
210 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
186 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
211 187
212 188 "use strict";
213 189 __webpack_require__.r(__webpack_exports__);
190 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
191 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
192 +/* harmony export */ });
214 193 const Question = {
215 194 id: function (state) {
216 195 return state.id;
217 196 },
@@ -266,9 +245,9 @@
266 245 i18n: function (state) {
267 246 return state.i18n;
268 247 }
269 248 };
270 -/* harmony default export */ __webpack_exports__["default"] = (Question);
249 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Question);
271 250
272 251 /***/ }),
273 252
274 253 /***/ "./assets/src/apps/js/admin/editor/http.js":
@@ -274,14 +253,14 @@
274 253 /***/ "./assets/src/apps/js/admin/editor/http.js":
275 254 /*!*************************************************!*\
276 255 !*** ./assets/src/apps/js/admin/editor/http.js ***!
277 256 \*************************************************/
278 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
257 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
279 258
280 259 "use strict";
281 260 __webpack_require__.r(__webpack_exports__);
282 261 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
283 -/* harmony export */ "default": function() { return /* binding */ HTTP; }
262 +/* harmony export */ "default": () => (/* binding */ HTTP)
284 263 /* harmony export */ });
285 264 function HTTP(options) {
286 265 const $ = window.jQuery || jQuery;
287 266 const $VueHTTP = Vue.http;
@@ -289,15 +268,15 @@
289 268 ns: 'LPRequest',
290 269 store: false
291 270 }, options || {});
292 271 let $publishingAction = null;
293 -
294 272 LP.Request = function (payload) {
295 273 $publishingAction = $('#publishing-action');
296 274 payload.id = options.store.getters.id;
297 275 payload.nonce = options.store.getters.nonce;
298 276 payload['lp-ajax'] = options.store.getters.action;
299 - payload.code = options.store.getters.code;
277 + //payload.code = options.store.getters.code;
278 +
300 279 $publishingAction.find('#publish').addClass('disabled');
301 280 $publishingAction.find('.spinner').addClass('is-active');
302 281 $publishingAction.addClass('code-' + payload.code);
303 282 return $VueHTTP.post(options.store.getters.urlAjax, payload, {
@@ -307,32 +286,26 @@
307 286 code: payload.code
308 287 }
309 288 });
310 289 };
311 -
312 290 $VueHTTP.interceptors.push(function (request, next) {
313 291 if (request.params.namespace !== options.ns) {
314 292 next();
315 293 return;
316 294 }
317 -
318 295 options.store.dispatch('newRequest');
319 296 next(function (response) {
320 297 if (!jQuery.isPlainObject(response.body)) {
321 298 response.body = LP.parseJSON(response.body);
322 299 }
323 -
324 300 const body = response.body;
325 301 const result = body.success || false;
326 -
327 302 if (result) {
328 303 options.store.dispatch('requestCompleted', 'successful');
329 304 } else {
330 305 options.store.dispatch('requestCompleted', 'failed');
331 306 }
332 -
333 307 $publishingAction.removeClass('code-' + request.params.code);
334 -
335 308 if (!$publishingAction.attr('class')) {
336 309 $publishingAction.find('#publish').removeClass('disabled');
337 310 $publishingAction.find('.spinner').removeClass('is-active');
338 311 }
@@ -345,12 +318,15 @@
345 318 /***/ "./assets/src/apps/js/admin/editor/mutations/question.js":
346 319 /*!***************************************************************!*\
347 320 !*** ./assets/src/apps/js/admin/editor/mutations/question.js ***!
348 321 \***************************************************************/
349 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
322 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
350 323
351 324 "use strict";
352 325 __webpack_require__.r(__webpack_exports__);
326 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
327 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
328 +/* harmony export */ });
353 329 const Question = {
354 330 UPDATE_STATUS: function (state, status) {
355 331 state.status = status;
356 332 },
@@ -384,9 +360,9 @@
384 360 DECREASE_NUMBER_REQUEST: function (state) {
385 361 state.countCurrentRequest--;
386 362 }
387 363 };
388 -/* harmony default export */ __webpack_exports__["default"] = (Question);
364 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Question);
389 365
390 366 /***/ }),
391 367
392 368 /***/ "./assets/src/apps/js/admin/editor/store/question.js":
@@ -392,12 +368,15 @@
392 368 /***/ "./assets/src/apps/js/admin/editor/store/question.js":
393 369 /*!***********************************************************!*\
394 370 !*** ./assets/src/apps/js/admin/editor/store/question.js ***!
395 371 \***********************************************************/
396 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
372 +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
397 373
398 374 "use strict";
399 375 __webpack_require__.r(__webpack_exports__);
376 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
377 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
378 +/* harmony export */ });
400 379 /* harmony import */ var _getters_question__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/question */ "./assets/src/apps/js/admin/editor/getters/question.js");
401 380 /* harmony import */ var _mutations_question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/question */ "./assets/src/apps/js/admin/editor/mutations/question.js");
402 381 /* harmony import */ var _actions_question__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/question */ "./assets/src/apps/js/admin/editor/actions/question.js");
403 382
@@ -403,9 +382,8 @@
403 382
404 383
405 384
406 385 const $ = window.jQuery || jQuery;
407 -
408 386 const Question = function Question(data) {
409 387 var state = $.extend({
410 388 status: 'successful',
411 389 countCurrentRequest: 0,
@@ -417,11 +395,10 @@
417 395 mutations: _mutations_question__WEBPACK_IMPORTED_MODULE_1__["default"],
418 396 actions: _actions_question__WEBPACK_IMPORTED_MODULE_2__["default"]
419 397 };
420 398 };
399 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Question);
421 400
422 -/* harmony default export */ __webpack_exports__["default"] = (Question);
423 -
424 401 /***/ })
425 402
426 403 /******/ });
427 404 /************************************************************************/
@@ -450,23 +427,23 @@
450 427 /******/ }
451 428 /******/
452 429 /************************************************************************/
453 430 /******/ /* webpack/runtime/compat get default export */
454 -/******/ !function() {
431 +/******/ (() => {
455 432 /******/ // getDefaultExport function for compatibility with non-harmony modules
456 -/******/ __webpack_require__.n = function(module) {
433 +/******/ __webpack_require__.n = (module) => {
457 434 /******/ var getter = module && module.__esModule ?
458 -/******/ function() { return module['default']; } :
459 -/******/ function() { return module; };
435 +/******/ () => (module['default']) :
436 +/******/ () => (module);
460 437 /******/ __webpack_require__.d(getter, { a: getter });
461 438 /******/ return getter;
462 439 /******/ };
463 -/******/ }();
440 +/******/ })();
464 441 /******/
465 442 /******/ /* webpack/runtime/define property getters */
466 -/******/ !function() {
443 +/******/ (() => {
467 444 /******/ // define getter functions for harmony exports
468 -/******/ __webpack_require__.d = function(exports, definition) {
445 +/******/ __webpack_require__.d = (exports, definition) => {
469 446 /******/ for(var key in definition) {
470 447 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
471 448 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
472 449 /******/ }
@@ -471,30 +448,30 @@
471 448 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
472 449 /******/ }
473 450 /******/ }
474 451 /******/ };
475 -/******/ }();
452 +/******/ })();
476 453 /******/
477 454 /******/ /* webpack/runtime/hasOwnProperty shorthand */
478 -/******/ !function() {
479 -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
480 -/******/ }();
455 +/******/ (() => {
456 +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
457 +/******/ })();
481 458 /******/
482 459 /******/ /* webpack/runtime/make namespace object */
483 -/******/ !function() {
460 +/******/ (() => {
484 461 /******/ // define __esModule on exports
485 -/******/ __webpack_require__.r = function(exports) {
462 +/******/ __webpack_require__.r = (exports) => {
486 463 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
487 464 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
488 465 /******/ }
489 466 /******/ Object.defineProperty(exports, '__esModule', { value: true });
490 467 /******/ };
491 -/******/ }();
468 +/******/ })();
492 469 /******/
493 470 /************************************************************************/
494 471 var __webpack_exports__ = {};
495 472 // This entry need to be wrapped in an IIFE because it need to be in strict mode.
496 -!function() {
473 +(() => {
497 474 "use strict";
498 475 /*!*****************************************************!*\
499 476 !*** ./assets/src/apps/js/admin/editor/question.js ***!
500 477 \*****************************************************/
@@ -508,14 +485,14 @@
508 485
509 486 window.$Vue = window.$Vue || Vue;
510 487 window.$Vuex = window.$Vuex || Vuex;
511 488 const $ = window.jQuery;
489 +
512 490 /**
513 491 * Init app.
514 492 *
515 493 * @since 3.0.0
516 494 */
517 -
518 495 $(document).ready(function () {
519 496 window.LP_Question_Store = new $Vuex.Store((0,_store_question__WEBPACK_IMPORTED_MODULE_1__["default"])(lp_question_editor));
520 497 (0,_http__WEBPACK_IMPORTED_MODULE_0__["default"])({
521 498 ns: 'LPQuestionEditorRequest',
@@ -529,8 +506,9 @@
529 506 });
530 507 }
531 508 }, 100);
532 509 });
533 -}();
510 +})();
511 +
534 512 /******/ })()
535 513 ;
536 514 //# sourceMappingURL=question.js.map