LearnPress – WordPress LMS Plugin - Version 3.2.5.3

Version Description

~ Changed SQL to read course items by user item ID. ~ Improved performance in admin orders page. ~ Upgraded Vue/Vuex to latest version. ~ Added new theme to LP ad.

Download this release

Release Info

Developer tunnhn
Plugin Icon 128x128 LearnPress – WordPress LMS Plugin
Version 3.2.5.3
Comparing to
See all releases

Code changes from version 3.2.5.2 to 3.2.5.3

Files changed (71) hide show
  1. assets/js/admin/admin.js +0 -1
  2. assets/js/admin/course-editor.js +56 -57
  3. assets/js/admin/meta-box-order.js +4 -2
  4. assets/js/admin/modal-search-items.js +7 -5
  5. assets/js/admin/modal-search-users.js +8 -5
  6. assets/js/admin/question-editor.js +22 -17
  7. assets/js/admin/quiz-editor.js +65 -64
  8. assets/js/admin/statistic.js +0 -1
  9. assets/js/admin/sync-data.js +0 -1
  10. assets/js/admin/update.js +0 -3
  11. assets/js/admin/utils/_dropdown-pages.js +0 -1
  12. assets/js/global.js +3 -2
  13. assets/js/vendor/{sortable.1.6.0.js → sortable.js} +0 -0
  14. assets/js/vendor/{vue-resource.1.3.4.js → vue-resource.js} +0 -0
  15. assets/js/vendor/vue.js +11722 -9834
  16. assets/js/vendor/vue.min.js +3 -3
  17. assets/js/vendor/{vuedraggable.2.14.1.js → vuedraggable.js} +0 -0
  18. assets/js/vendor/vuex.2.3.1.js +0 -809
  19. assets/js/vendor/vuex.js +1005 -0
  20. inc/admin/class-lp-admin-assets.php +5 -5
  21. inc/admin/class-lp-post-type-actions.php +4 -0
  22. inc/admin/lp-admin-functions.php +2 -0
  23. inc/admin/views/course/added-items-preview.php +6 -3
  24. inc/admin/views/course/curriculum.php +4 -3
  25. inc/admin/views/course/editor.php +4 -3
  26. inc/admin/views/course/modal-choose-items.php +8 -6
  27. inc/admin/views/course/new-section-item.php +5 -3
  28. inc/admin/views/course/new-section.php +5 -3
  29. inc/admin/views/course/pagination.php +5 -3
  30. inc/admin/views/course/section-item.php +5 -3
  31. inc/admin/views/course/section.php +5 -3
  32. inc/admin/views/course/sections.php +5 -3
  33. inc/admin/views/question/actions.php +4 -3
  34. inc/admin/views/question/answer.php +4 -3
  35. inc/admin/views/question/editor.php +4 -3
  36. inc/admin/views/question/option.php +4 -3
  37. inc/admin/views/quiz/added-items-preview.php +4 -3
  38. inc/admin/views/quiz/editor.php +4 -3
  39. inc/admin/views/quiz/modal-choose-items.php +9 -6
  40. inc/admin/views/quiz/pagination.php +4 -3
  41. inc/admin/views/quiz/question-actions.php +4 -3
  42. inc/admin/views/quiz/question-answer-option.php +4 -3
  43. inc/admin/views/quiz/question-answer.php +5 -3
  44. inc/admin/views/quiz/question-meta.php +4 -3
  45. inc/admin/views/quiz/question-settings.php +5 -3
  46. inc/admin/views/quiz/question.php +4 -3
  47. inc/admin/views/quiz/questions.php +4 -4
  48. inc/admin/views/tools/course/html-course.php +4 -1
  49. inc/admin/views/tools/course/html-user-item.php +3 -1
  50. inc/admin/views/tools/course/html-user.php +3 -1
  51. inc/class-lp-assets.php +3 -3
  52. inc/curds/class-lp-course-curd.php +1 -1
  53. inc/curds/class-lp-helper-curd.php +4 -3
  54. inc/curds/class-lp-order-curd.php +12 -4
  55. inc/curds/class-lp-quiz-curd.php +2 -1
  56. inc/curds/class-lp-user-curd.php +10 -9
  57. inc/custom-post-types/abstract.php +1 -1
  58. inc/custom-post-types/course.php +6 -2
  59. inc/custom-post-types/order.php +12 -19
  60. inc/emails/class-lp-email-cancelled-order-instructor.php +4 -1
  61. inc/emails/class-lp-email-enrolled-course-instructor.php +4 -1
  62. inc/emails/class-lp-email-finished-course-instructor.php +4 -1
  63. inc/emails/class-lp-email-new-order-instructor.php +4 -1
  64. inc/lp-constants.php +1 -1
  65. inc/lp-core-functions.php +14 -7
  66. inc/lp-template-functions.php +9 -6
  67. inc/quiz/class-lp-quiz.php +7 -6
  68. inc/user-item/class-lp-user-item-quiz.php +1 -1
  69. learnpress.php +1 -1
  70. readme.txt +7 -1
  71. templates/emails/order-items-table.php +1 -1
assets/js/admin/admin.js CHANGED
@@ -66,7 +66,6 @@
66
  order: order
67
  },
68
  success: function (response) {
69
- console.log(response)
70
  }
71
  });
72
  }
66
  order: order
67
  },
68
  success: function (response) {
 
69
  }
70
  });
71
  }
assets/js/admin/course-editor.js CHANGED
@@ -15,8 +15,12 @@
15
  };
16
  })(window);
17
 
18
- jQuery(function ($) {
 
 
 
19
 
 
20
 
21
  /**
22
  * I18n Store
@@ -24,7 +28,7 @@ jQuery(function ($) {
24
  * @since 3.0.0
25
  */
26
 
27
- var LP_Curriculum_i18n_Store = (function (Vue, helpers, data) {
28
  var state = helpers.cloneObject(data.i18n);
29
 
30
  var getters = {
@@ -39,14 +43,14 @@ jQuery(function ($) {
39
  getters: getters
40
  };
41
 
42
- })(Vue, LP_Helpers, lpAdminCourseEditorSettings);
43
 
44
  /**
45
  * Sections Store.
46
  *
47
  * @since 3.0.0
48
  */
49
- var LP_Curriculum_Sections_Store = (function (Vue, helpers, data) {
50
  var state = helpers.cloneObject(data.sections);
51
 
52
  state.statusUpdateSection = {};
@@ -111,9 +115,7 @@ jQuery(function ($) {
111
  var pos;
112
 
113
  if (newSection.temp_id) {
114
- console.log(newSection)
115
  state.sections.map(function (section, i) {
116
- console.log(section)
117
  if (newSection.temp_id == section.id) {
118
  pos = i;
119
  return false;
@@ -122,7 +124,7 @@ jQuery(function ($) {
122
  }
123
 
124
  if (pos !== undefined) {
125
- Vue.set(state.sections, pos, newSection);
126
  } else {
127
  state.sections.push(newSection);
128
  }
@@ -205,27 +207,27 @@ jQuery(function ($) {
205
  },
206
 
207
  'UPDATE_SECTION_REQUEST': function (state, sectionId) {
208
- Vue.set(state.statusUpdateSection, sectionId, 'updating');
209
  },
210
 
211
  'UPDATE_SECTION_SUCCESS': function (state, sectionId) {
212
- Vue.set(state.statusUpdateSection, sectionId, 'successful');
213
  },
214
 
215
  'UPDATE_SECTION_FAILURE': function (state, sectionId) {
216
- Vue.set(state.statusUpdateSection, sectionId, 'failed');
217
  },
218
 
219
  'UPDATE_SECTION_ITEM_REQUEST': function (state, itemId) {
220
- Vue.set(state.statusUpdateSectionItem, itemId, 'updating');
221
  },
222
 
223
  'UPDATE_SECTION_ITEM_SUCCESS': function (state, itemId) {
224
- Vue.set(state.statusUpdateSectionItem, itemId, 'successful');
225
  },
226
 
227
  'UPDATE_SECTION_ITEM_FAILURE': function (state, itemId) {
228
- Vue.set(state.statusUpdateSectionItem, itemId, 'failed');
229
  },
230
  'APPEND_EMPTY_ITEM_TO_SECTION': function (state, data) {
231
 
@@ -257,7 +259,7 @@ jQuery(function ($) {
257
  var item_id = section.items[i].id;
258
  if (item_id) {
259
  if (data.items[item_id]) {
260
- Vue.set(section.items, i, data.items[item_id])
261
  }
262
  }
263
  } catch (ex) {
@@ -280,14 +282,14 @@ jQuery(function ($) {
280
  context.commit('CLOSE_ALL_SECTIONS');
281
  }
282
 
283
- Vue.http.LPRequest({
284
  type: 'hidden-sections',
285
  hidden: context.getters['hiddenSections']
286
  });
287
  },
288
 
289
  updateSectionsOrder: function (context, order) {
290
- Vue.http.LPRequest({
291
  type: 'sort-sections',
292
  order: JSON.stringify(order)
293
  }).then(
@@ -309,7 +311,7 @@ jQuery(function ($) {
309
  context.commit('OPEN_SECTION', section);
310
  }
311
 
312
- Vue.http.LPRequest({
313
  type: 'hidden-sections',
314
  hidden: context.getters['hiddenSections']
315
  });
@@ -318,11 +320,10 @@ jQuery(function ($) {
318
  updateSection: function (context, section) {
319
  context.commit('UPDATE_SECTION_REQUEST', section.id);
320
 
321
- Vue.http
322
- .LPRequest({
323
- type: 'update-section',
324
- section: JSON.stringify(section)
325
- })
326
  .then(function () {
327
  context.commit('UPDATE_SECTION_SUCCESS', section.id);
328
  })
@@ -334,7 +335,7 @@ jQuery(function ($) {
334
  removeSection: function (context, payload) {
335
  context.commit('REMOVE_SECTION', payload.index);
336
 
337
- Vue.http.LPRequest({
338
  type: 'remove-section',
339
  section_id: payload.section.id
340
  }).then(
@@ -360,7 +361,7 @@ jQuery(function ($) {
360
  title: newSection.section_name
361
  });
362
 
363
- Vue.http.LPRequest(newSection).then(
364
  function (response) {
365
  var result = response.body;
366
 
@@ -380,7 +381,7 @@ jQuery(function ($) {
380
  updateSectionItem: function (context, payload) {
381
  context.commit('UPDATE_SECTION_ITEM_REQUEST', payload.item.id);
382
 
383
- Vue.http.LPRequest({
384
  type: 'update-section-item',
385
  section_id: payload.section_id,
386
  item: JSON.stringify(payload.item)
@@ -407,12 +408,11 @@ jQuery(function ($) {
407
  var id = payload.item.id;
408
  context.commit('REMOVE_SECTION_ITEM', payload);
409
  payload.item.temp_id = 0;
410
- Vue.http
411
- .LPRequest({
412
- type: 'remove-section-item',
413
- section_id: payload.section_id,
414
- item_id: id
415
- }).then(
416
  function () {
417
  context.commit('REMOVE_SECTION_ITEM', payload);
418
  }
@@ -423,12 +423,11 @@ jQuery(function ($) {
423
  var id = payload.item.id;
424
  context.commit('REMOVE_SECTION_ITEM', payload);
425
  payload.item.temp_id = 0;
426
- Vue.http
427
- .LPRequest({
428
- type: 'delete-section-item',
429
- section_id: payload.section_id,
430
- item_id: id
431
- }).then(
432
  function () {
433
  context.commit('REMOVE_SECTION_ITEM', payload);
434
  }
@@ -439,7 +438,7 @@ jQuery(function ($) {
439
 
440
  context.commit('APPEND_EMPTY_ITEM_TO_SECTION', payload)
441
  //context.commit('UPDATE_SECTION_ITEMS', {section_id: payload.section_id, items: result.data});
442
- Vue.http.LPRequest({
443
  type: 'new-section-item',
444
  section_id: payload.section_id,
445
  item: JSON.stringify(payload.item)
@@ -466,7 +465,7 @@ jQuery(function ($) {
466
  },
467
 
468
  updateSectionItems: function (context, payload) {
469
- Vue.http.LPRequest({
470
  type: 'update-section-items',
471
  section_id: payload.section_id,
472
  items: JSON.stringify(payload.items),
@@ -493,7 +492,7 @@ jQuery(function ($) {
493
  mutations: mutations,
494
  actions: actions
495
  };
496
- })(Vue, LP_Helpers, lpAdminCourseEditorSettings);
497
 
498
 
499
  /**
@@ -503,7 +502,7 @@ jQuery(function ($) {
503
  *
504
  * @type {{namespaced, state, getters, mutations, actions}}
505
  */
506
- var LP_Choose_Items_Modal_Store = (function (exports, Vue, helpers, data) {
507
  var state = helpers.cloneObject(data.chooseItems);
508
  state.sectionId = false;
509
  state.pagination = '';
@@ -594,7 +593,7 @@ jQuery(function ($) {
594
  searchItems: function (context, payload) {
595
  context.commit('SEARCH_ITEMS_REQUEST');
596
 
597
- Vue.http.LPRequest({
598
  type: 'search-items',
599
  query: payload.query,
600
  item_type: payload.type,
@@ -634,7 +633,7 @@ jQuery(function ($) {
634
  var items = context.getters.addedItems;
635
 
636
  if (items.length > 0) {
637
- Vue.http.LPRequest({
638
  type: 'add-items-to-section',
639
  section_id: context.getters.section,
640
  items: JSON.stringify(items)
@@ -667,14 +666,14 @@ jQuery(function ($) {
667
  mutations: mutations,
668
  actions: actions
669
  }
670
- })(window, Vue, LP_Helpers, lpAdminCourseEditorSettings);
671
 
672
  /**
673
  * Root Store
674
  *
675
  * @since 3.0.0
676
  */
677
- (function (exports, Vue, Vuex, helpers, data) {
678
  var state = helpers.cloneObject(data.root);
679
 
680
  state.status = 'success';
@@ -737,7 +736,7 @@ jQuery(function ($) {
737
 
738
  var actions = {
739
  heartbeat: function (context) {
740
- Vue.http.LPRequest({
741
  type: 'heartbeat'
742
  }).then(
743
  function (response) {
@@ -754,7 +753,7 @@ jQuery(function ($) {
754
  var auto_draft = context.getters['autoDraft'];
755
 
756
  if (auto_draft) {
757
- Vue.http.LPRequest({
758
  type: 'draft-course',
759
  course: JSON.stringify(payload)
760
  }).then(function (response) {
@@ -789,7 +788,7 @@ jQuery(function ($) {
789
  }
790
  };
791
 
792
- exports.LP_Curriculum_Store = new Vuex.Store({
793
  state: state,
794
  getters: getters,
795
  mutations: mutations,
@@ -801,20 +800,20 @@ jQuery(function ($) {
801
  }
802
  });
803
 
804
- })(window, Vue, Vuex, LP_Helpers, lpAdminCourseEditorSettings);
805
 
806
  /**
807
  * HTTP
808
  *
809
  * @since 3.0.0
810
  */
811
- (function (exports, Vue, $store) {
812
- Vue.http.LPRequest = function (payload) {
813
  payload['id'] = $store.getters.id;
814
  payload['nonce'] = $store.getters.nonce;
815
  payload['lp-ajax'] = $store.getters.action;
816
 
817
- return Vue.http.post($store.getters.urlAjax,
818
  payload,
819
  {
820
  emulateJSON: true,
@@ -824,7 +823,7 @@ jQuery(function ($) {
824
  });
825
  };
826
 
827
- Vue.http.interceptors.push(function (request, next) {
828
  if (request.params['namespace'] !== 'LPCurriculumRequest') {
829
  next();
830
  return;
@@ -848,20 +847,20 @@ jQuery(function ($) {
848
  }
849
  });
850
  });
851
- })(window, Vue, LP_Curriculum_Store);
852
 
853
  /**
854
  * Init app.
855
  *
856
  * @since 3.0.0
857
  */
858
- (function ($, Vue, $store) {
859
  $(document).ready(function () {
860
- window.LP_Course_Editor = new Vue({
861
  el: '#admin-editor-lp_course',
862
  template: '<lp-course-editor></lp-course-editor>'
863
  });
864
  });
865
- })(jQuery, Vue, LP_Curriculum_Store);
866
 
867
  });
15
  };
16
  })(window);
17
 
18
+ window.$Vue = window.$Vue || Vue;
19
+ window.$Vuex = window.$Vuex || Vuex;
20
+
21
+ var $VueHTTP = Vue.http;
22
 
23
+ jQuery(function ($) {
24
 
25
  /**
26
  * I18n Store
28
  * @since 3.0.0
29
  */
30
 
31
+ var LP_Curriculum_i18n_Store = (function (helpers, data) {
32
  var state = helpers.cloneObject(data.i18n);
33
 
34
  var getters = {
43
  getters: getters
44
  };
45
 
46
+ })(LP_Helpers, lpAdminCourseEditorSettings);
47
 
48
  /**
49
  * Sections Store.
50
  *
51
  * @since 3.0.0
52
  */
53
+ var LP_Curriculum_Sections_Store = (function (helpers, data) {
54
  var state = helpers.cloneObject(data.sections);
55
 
56
  state.statusUpdateSection = {};
115
  var pos;
116
 
117
  if (newSection.temp_id) {
 
118
  state.sections.map(function (section, i) {
 
119
  if (newSection.temp_id == section.id) {
120
  pos = i;
121
  return false;
124
  }
125
 
126
  if (pos !== undefined) {
127
+ $Vue.set(state.sections, pos, newSection);
128
  } else {
129
  state.sections.push(newSection);
130
  }
207
  },
208
 
209
  'UPDATE_SECTION_REQUEST': function (state, sectionId) {
210
+ $Vue.set(state.statusUpdateSection, sectionId, 'updating');
211
  },
212
 
213
  'UPDATE_SECTION_SUCCESS': function (state, sectionId) {
214
+ $Vue.set(state.statusUpdateSection, sectionId, 'successful');
215
  },
216
 
217
  'UPDATE_SECTION_FAILURE': function (state, sectionId) {
218
+ $Vue.set(state.statusUpdateSection, sectionId, 'failed');
219
  },
220
 
221
  'UPDATE_SECTION_ITEM_REQUEST': function (state, itemId) {
222
+ $Vue.set(state.statusUpdateSectionItem, itemId, 'updating');
223
  },
224
 
225
  'UPDATE_SECTION_ITEM_SUCCESS': function (state, itemId) {
226
+ $Vue.set(state.statusUpdateSectionItem, itemId, 'successful');
227
  },
228
 
229
  'UPDATE_SECTION_ITEM_FAILURE': function (state, itemId) {
230
+ $Vue.set(state.statusUpdateSectionItem, itemId, 'failed');
231
  },
232
  'APPEND_EMPTY_ITEM_TO_SECTION': function (state, data) {
233
 
259
  var item_id = section.items[i].id;
260
  if (item_id) {
261
  if (data.items[item_id]) {
262
+ $Vue.set(section.items, i, data.items[item_id])
263
  }
264
  }
265
  } catch (ex) {
282
  context.commit('CLOSE_ALL_SECTIONS');
283
  }
284
 
285
+ LP.Request({
286
  type: 'hidden-sections',
287
  hidden: context.getters['hiddenSections']
288
  });
289
  },
290
 
291
  updateSectionsOrder: function (context, order) {
292
+ LP.Request({
293
  type: 'sort-sections',
294
  order: JSON.stringify(order)
295
  }).then(
311
  context.commit('OPEN_SECTION', section);
312
  }
313
 
314
+ LP.Request({
315
  type: 'hidden-sections',
316
  hidden: context.getters['hiddenSections']
317
  });
320
  updateSection: function (context, section) {
321
  context.commit('UPDATE_SECTION_REQUEST', section.id);
322
 
323
+ LP.Request({
324
+ type: 'update-section',
325
+ section: JSON.stringify(section)
326
+ })
 
327
  .then(function () {
328
  context.commit('UPDATE_SECTION_SUCCESS', section.id);
329
  })
335
  removeSection: function (context, payload) {
336
  context.commit('REMOVE_SECTION', payload.index);
337
 
338
+ LP.Request({
339
  type: 'remove-section',
340
  section_id: payload.section.id
341
  }).then(
361
  title: newSection.section_name
362
  });
363
 
364
+ LP.Request(newSection).then(
365
  function (response) {
366
  var result = response.body;
367
 
381
  updateSectionItem: function (context, payload) {
382
  context.commit('UPDATE_SECTION_ITEM_REQUEST', payload.item.id);
383
 
384
+ LP.Request({
385
  type: 'update-section-item',
386
  section_id: payload.section_id,
387
  item: JSON.stringify(payload.item)
408
  var id = payload.item.id;
409
  context.commit('REMOVE_SECTION_ITEM', payload);
410
  payload.item.temp_id = 0;
411
+ LP.Request({
412
+ type: 'remove-section-item',
413
+ section_id: payload.section_id,
414
+ item_id: id
415
+ }).then(
 
416
  function () {
417
  context.commit('REMOVE_SECTION_ITEM', payload);
418
  }
423
  var id = payload.item.id;
424
  context.commit('REMOVE_SECTION_ITEM', payload);
425
  payload.item.temp_id = 0;
426
+ LP.Request({
427
+ type: 'delete-section-item',
428
+ section_id: payload.section_id,
429
+ item_id: id
430
+ }).then(
 
431
  function () {
432
  context.commit('REMOVE_SECTION_ITEM', payload);
433
  }
438
 
439
  context.commit('APPEND_EMPTY_ITEM_TO_SECTION', payload)
440
  //context.commit('UPDATE_SECTION_ITEMS', {section_id: payload.section_id, items: result.data});
441
+ LP.Request({
442
  type: 'new-section-item',
443
  section_id: payload.section_id,
444
  item: JSON.stringify(payload.item)
465
  },
466
 
467
  updateSectionItems: function (context, payload) {
468
+ LP.Request({
469
  type: 'update-section-items',
470
  section_id: payload.section_id,
471
  items: JSON.stringify(payload.items),
492
  mutations: mutations,
493
  actions: actions
494
  };
495
+ })(LP_Helpers, lpAdminCourseEditorSettings);
496
 
497
 
498
  /**
502
  *
503
  * @type {{namespaced, state, getters, mutations, actions}}
504
  */
505
+ var LP_Choose_Items_Modal_Store = (function (exports, helpers, data) {
506
  var state = helpers.cloneObject(data.chooseItems);
507
  state.sectionId = false;
508
  state.pagination = '';
593
  searchItems: function (context, payload) {
594
  context.commit('SEARCH_ITEMS_REQUEST');
595
 
596
+ LP.Request({
597
  type: 'search-items',
598
  query: payload.query,
599
  item_type: payload.type,
633
  var items = context.getters.addedItems;
634
 
635
  if (items.length > 0) {
636
+ LP.Request({
637
  type: 'add-items-to-section',
638
  section_id: context.getters.section,
639
  items: JSON.stringify(items)
666
  mutations: mutations,
667
  actions: actions
668
  }
669
+ })(window, LP_Helpers, lpAdminCourseEditorSettings);
670
 
671
  /**
672
  * Root Store
673
  *
674
  * @since 3.0.0
675
  */
676
+ (function (exports, helpers, data) {
677
  var state = helpers.cloneObject(data.root);
678
 
679
  state.status = 'success';
736
 
737
  var actions = {
738
  heartbeat: function (context) {
739
+ LP.Request({
740
  type: 'heartbeat'
741
  }).then(
742
  function (response) {
753
  var auto_draft = context.getters['autoDraft'];
754
 
755
  if (auto_draft) {
756
+ LP.Request({
757
  type: 'draft-course',
758
  course: JSON.stringify(payload)
759
  }).then(function (response) {
788
  }
789
  };
790
 
791
+ exports.LP_Curriculum_Store = new $Vuex.Store({
792
  state: state,
793
  getters: getters,
794
  mutations: mutations,
800
  }
801
  });
802
 
803
+ })(window, LP_Helpers, lpAdminCourseEditorSettings);
804
 
805
  /**
806
  * HTTP
807
  *
808
  * @since 3.0.0
809
  */
810
+ (function (exports, $store) {
811
+ LP.Request = function (payload) {
812
  payload['id'] = $store.getters.id;
813
  payload['nonce'] = $store.getters.nonce;
814
  payload['lp-ajax'] = $store.getters.action;
815
 
816
+ return $VueHTTP.post($store.getters.urlAjax,
817
  payload,
818
  {
819
  emulateJSON: true,
823
  });
824
  };
825
 
826
+ $VueHTTP.interceptors.push(function (request, next) {
827
  if (request.params['namespace'] !== 'LPCurriculumRequest') {
828
  next();
829
  return;
847
  }
848
  });
849
  });
850
+ })(window, LP_Curriculum_Store);
851
 
852
  /**
853
  * Init app.
854
  *
855
  * @since 3.0.0
856
  */
857
+ (function ($, $store) {
858
  $(document).ready(function () {
859
+ window.LP_Course_Editor = new $Vue({
860
  el: '#admin-editor-lp_course',
861
  template: '<lp-course-editor></lp-course-editor>'
862
  });
863
  });
864
+ })(jQuery, LP_Curriculum_Store);
865
 
866
  });
assets/js/admin/meta-box-order.js CHANGED
@@ -1,6 +1,8 @@
1
  ;
2
  (function ($) {
3
  "use strict";
 
 
4
  $(document).ready(function () {
5
 
6
  var $listItems = $('.list-order-items').find('tbody'),
@@ -60,7 +62,7 @@
60
  $listItems.find('.no-order-items').show();
61
  }
62
 
63
- Vue.http.post(
64
  window.location.href, {
65
  order_id: $('#post_ID').val(),
66
  items: [item_id],
@@ -102,7 +104,7 @@
102
  callbacks: {
103
  addItems: function () {
104
  var that = this;
105
- Vue.http.post(
106
  window.location.href, {
107
  order_id: this.contextId,
108
  items: this.selected,
1
  ;
2
  (function ($) {
3
  "use strict";
4
+ window.$Vue = window.$Vue || Vue;
5
+
6
  $(document).ready(function () {
7
 
8
  var $listItems = $('.list-order-items').find('tbody'),
62
  $listItems.find('.no-order-items').show();
63
  }
64
 
65
+ $Vue.http.post(
66
  window.location.href, {
67
  order_id: $('#post_ID').val(),
68
  items: [item_id],
104
  callbacks: {
105
  addItems: function () {
106
  var that = this;
107
+ $Vue.http.post(
108
  window.location.href, {
109
  order_id: this.contextId,
110
  items: this.selected,
assets/js/admin/modal-search-items.js CHANGED
@@ -1,9 +1,11 @@
1
  /*global jQuery, Backbone, _ */
2
- (function ($, Vue, _) {
3
  'use strict';
 
 
4
 
5
  $(document).ready(function () {
6
- Vue.component('learn-press-modal-search-items', {
7
  template: '#learn-press-modal-search-items',
8
  data: function () {
9
  return {
@@ -37,7 +39,7 @@
37
  search: _.debounce(function (term) {
38
  $('#modal-search-items').addClass('loading');
39
  var that = this;
40
- Vue.http.post(
41
  window.location.href, {
42
  type: this.postType,
43
  context: this.context,
@@ -112,7 +114,7 @@
112
  }
113
  });
114
 
115
- window.LP.$modalSearchItems = new Vue({
116
  el: '#vue-modal-search-items',
117
  data: {
118
  show: false,
@@ -140,4 +142,4 @@
140
  }
141
  });
142
  });
143
- }(jQuery, Vue, _));
1
  /*global jQuery, Backbone, _ */
2
+ (function ($, _) {
3
  'use strict';
4
+ window.$Vue = window.$Vue || Vue;
5
+ var $VueHTTP = $Vue.http;
6
 
7
  $(document).ready(function () {
8
+ $Vue.component('learn-press-modal-search-items', {
9
  template: '#learn-press-modal-search-items',
10
  data: function () {
11
  return {
39
  search: _.debounce(function (term) {
40
  $('#modal-search-items').addClass('loading');
41
  var that = this;
42
+ $VueHTTP.post(
43
  window.location.href, {
44
  type: this.postType,
45
  context: this.context,
114
  }
115
  });
116
 
117
+ window.LP.$modalSearchItems = new $Vue({
118
  el: '#vue-modal-search-items',
119
  data: {
120
  show: false,
142
  }
143
  });
144
  });
145
+ }(jQuery, _));
assets/js/admin/modal-search-users.js CHANGED
@@ -1,9 +1,12 @@
1
  /*global jQuery, Backbone, _ */
2
- ( function ($, Vue, _) {
3
  'use strict';
 
 
 
4
 
5
  $(document).ready(function () {
6
- Vue.component('learn-press-modal-search-users', {
7
  template: '#learn-press-modal-search-users',
8
  data: function () {
9
  return {
@@ -32,7 +35,7 @@
32
  },
33
  search: _.debounce(function (term) {
34
  var that = this;
35
- Vue.http.post(
36
  window.location.href, {
37
  type: this.postType,
38
  context: this.context,
@@ -114,7 +117,7 @@
114
  }
115
  });
116
 
117
- window.LP.$modalSearchUsers = new Vue({
118
  el: '#vue-modal-search-users',
119
  data: {
120
  show: false,
@@ -142,4 +145,4 @@
142
  });
143
  });
144
 
145
- }(jQuery, Vue, _));
1
  /*global jQuery, Backbone, _ */
2
+ ( function ($, _) {
3
  'use strict';
4
+ window.$Vue = window.$Vue || Vue;
5
+
6
+ var $VueHTTP = $Vue.http;
7
 
8
  $(document).ready(function () {
9
+ $Vue.component('learn-press-modal-search-users', {
10
  template: '#learn-press-modal-search-users',
11
  data: function () {
12
  return {
35
  },
36
  search: _.debounce(function (term) {
37
  var that = this;
38
+ $VueHTTP.post(
39
  window.location.href, {
40
  type: this.postType,
41
  context: this.context,
117
  }
118
  });
119
 
120
+ window.LP.$modalSearchUsers = new $Vue({
121
  el: '#vue-modal-search-users',
122
  data: {
123
  show: false,
145
  });
146
  });
147
 
148
+ }(jQuery, _));
assets/js/admin/question-editor.js CHANGED
@@ -15,12 +15,17 @@
15
  };
16
  })(window);
17
 
 
 
 
 
 
18
  /**
19
  * Root Store
20
  *
21
  * @since 3.0.0
22
  */
23
- (function (exports, Vue, Vuex, helpers, data) {
24
 
25
  var state = helpers.cloneObject(data.root),
26
  i18n = helpers.cloneObject(data.i18n);
@@ -129,7 +134,7 @@
129
  var actions = {
130
 
131
  changeQuestionType: function (context, payload) {
132
- Vue.http.LPRequest({
133
  type: 'change-question-type',
134
  question_type: payload.type,
135
  draft_question: context.getters.autoDraft ? JSON.stringify(payload.question) : ''
@@ -144,7 +149,7 @@
144
  },
145
 
146
  updateAnswersOrder: function (context, order) {
147
- Vue.http.LPRequest({
148
  type: 'sort-answer',
149
  order: order
150
  }).then(
@@ -162,14 +167,14 @@
162
  return;
163
  }
164
  answer = JSON.stringify(answer);
165
- Vue.http.LPRequest({
166
  type: 'update-answer-title',
167
  answer: answer
168
  })
169
  },
170
 
171
  updateCorrectAnswer: function (context, correct) {
172
- Vue.http.LPRequest({
173
  type: 'change-correct',
174
  correct: JSON.stringify(correct)
175
  }).then(
@@ -186,7 +191,7 @@
186
  deleteAnswer: function (context, payload) {
187
 
188
  context.commit('DELETE_ANSWER', payload.id);
189
- Vue.http.LPRequest({
190
  type: 'delete-answer',
191
  answer_id: payload.id
192
  }).then(
@@ -203,7 +208,7 @@
203
 
204
  newAnswer: function (context, data) {
205
  context.commit('ADD_NEW_ANSWER', data.answer);
206
- Vue.http.LPRequest({
207
  type: 'new-answer'
208
  }).then(
209
  function (response) {
@@ -236,14 +241,14 @@
236
  }
237
  };
238
 
239
- exports.LP_Question_Store = new Vuex.Store({
240
  state: state,
241
  getters: getters,
242
  mutations: mutations,
243
  actions: actions
244
  });
245
 
246
- })(window, Vue, Vuex, LP_Helpers, lp_question_editor);
247
 
248
 
249
  /**
@@ -251,11 +256,11 @@
251
  *
252
  * @since 3.0.0
253
  */
254
- (function (exports, Vue, $store) {
255
  var $ = jQuery,
256
  $publishingAction = null;
257
 
258
- Vue.http.LPRequest = function (payload) {
259
  $publishingAction = $('#publishing-action');
260
 
261
  payload['id'] = $store.getters.id;
@@ -267,7 +272,7 @@
267
  $publishingAction.find('.spinner').addClass('is-active');
268
  $publishingAction.addClass('code-' + payload['code']);
269
 
270
- return Vue.http.post($store.getters.urlAjax,
271
  payload,
272
  {
273
  emulateJSON: true,
@@ -278,7 +283,7 @@
278
  });
279
  };
280
 
281
- Vue.http.interceptors.push(function (request, next) {
282
  if (request.params['namespace'] !== 'LPQuestionEditorRequest') {
283
  next();
284
  return;
@@ -307,7 +312,7 @@
307
 
308
  });
309
  });
310
- })(window, Vue, LP_Question_Store);
311
 
312
 
313
  /**
@@ -315,11 +320,11 @@
315
  *
316
  * @since 3.0.0
317
  */
318
- (function ($, Vue, $store) {
319
  $(document).ready(function () {
320
- window.LP_Question_Editor = new Vue({
321
  el: '#admin-editor-lp_question',
322
  template: '<lp-question-editor></lp-question-editor>'
323
  });
324
  });
325
- })(jQuery, Vue, LP_Question_Store);
15
  };
16
  })(window);
17
 
18
+ window.$Vue = window.$Vue || Vue;
19
+ window.$Vuex = window.$Vuex || Vuex;
20
+
21
+ var $VueHTTP = Vue.http;
22
+
23
  /**
24
  * Root Store
25
  *
26
  * @since 3.0.0
27
  */
28
+ (function (exports, helpers, data) {
29
 
30
  var state = helpers.cloneObject(data.root),
31
  i18n = helpers.cloneObject(data.i18n);
134
  var actions = {
135
 
136
  changeQuestionType: function (context, payload) {
137
+ LP.Request({
138
  type: 'change-question-type',
139
  question_type: payload.type,
140
  draft_question: context.getters.autoDraft ? JSON.stringify(payload.question) : ''
149
  },
150
 
151
  updateAnswersOrder: function (context, order) {
152
+ LP.Request({
153
  type: 'sort-answer',
154
  order: order
155
  }).then(
167
  return;
168
  }
169
  answer = JSON.stringify(answer);
170
+ LP.Request({
171
  type: 'update-answer-title',
172
  answer: answer
173
  })
174
  },
175
 
176
  updateCorrectAnswer: function (context, correct) {
177
+ LP.Request({
178
  type: 'change-correct',
179
  correct: JSON.stringify(correct)
180
  }).then(
191
  deleteAnswer: function (context, payload) {
192
 
193
  context.commit('DELETE_ANSWER', payload.id);
194
+ LP.Request({
195
  type: 'delete-answer',
196
  answer_id: payload.id
197
  }).then(
208
 
209
  newAnswer: function (context, data) {
210
  context.commit('ADD_NEW_ANSWER', data.answer);
211
+ LP.Request({
212
  type: 'new-answer'
213
  }).then(
214
  function (response) {
241
  }
242
  };
243
 
244
+ exports.LP_Question_Store = new $Vuex.Store({
245
  state: state,
246
  getters: getters,
247
  mutations: mutations,
248
  actions: actions
249
  });
250
 
251
+ })(window, LP_Helpers, lp_question_editor);
252
 
253
 
254
  /**
256
  *
257
  * @since 3.0.0
258
  */
259
+ (function (exports, $store) {
260
  var $ = jQuery,
261
  $publishingAction = null;
262
 
263
+ LP.Request = function (payload) {
264
  $publishingAction = $('#publishing-action');
265
 
266
  payload['id'] = $store.getters.id;
272
  $publishingAction.find('.spinner').addClass('is-active');
273
  $publishingAction.addClass('code-' + payload['code']);
274
 
275
+ return $VueHTTP.post($store.getters.urlAjax,
276
  payload,
277
  {
278
  emulateJSON: true,
283
  });
284
  };
285
 
286
+ $VueHTTP.interceptors.push(function (request, next) {
287
  if (request.params['namespace'] !== 'LPQuestionEditorRequest') {
288
  next();
289
  return;
312
 
313
  });
314
  });
315
+ })(window, LP_Question_Store);
316
 
317
 
318
  /**
320
  *
321
  * @since 3.0.0
322
  */
323
+ (function ($, $store) {
324
  $(document).ready(function () {
325
+ window.LP_Question_Editor = new $Vue({
326
  el: '#admin-editor-lp_question',
327
  template: '<lp-question-editor></lp-question-editor>'
328
  });
329
  });
330
+ })(jQuery, LP_Question_Store);
assets/js/admin/quiz-editor.js CHANGED
@@ -15,12 +15,17 @@
15
  };
16
  })(window);
17
 
 
 
 
 
 
18
  /**
19
  * Choose quiz items modal store.
20
  *
21
  * @since 3.0.0
22
  */
23
- var LP_Choose_Quiz_Items_Modal_Store = (function (exports, Vue, helpers, data) {
24
 
25
  var state = helpers.cloneObject(data.chooseItems);
26
  state.quizId = false;
@@ -114,13 +119,12 @@ var LP_Choose_Quiz_Items_Modal_Store = (function (exports, Vue, helpers, data) {
114
  searchItems: function (context, payload) {
115
  context.commit('SEARCH_ITEM_REQUEST');
116
 
117
- Vue.http
118
- .LPRequest({
119
- type: 'search-items',
120
- query: payload.query,
121
- page: payload.page,
122
- exclude: JSON.stringify([])
123
- }).then(
124
  function (response) {
125
  var result = response.body;
126
 
@@ -156,7 +160,7 @@ var LP_Choose_Quiz_Items_Modal_Store = (function (exports, Vue, helpers, data) {
156
  var items = context.getters.addedItems;
157
 
158
  if (items.length > 0) {
159
- Vue.http.LPRequest({
160
  type: 'add-questions-to-quiz',
161
  items: JSON.stringify(items),
162
  draft_quiz: JSON.stringify(quiz)
@@ -188,14 +192,14 @@ var LP_Choose_Quiz_Items_Modal_Store = (function (exports, Vue, helpers, data) {
188
  actions: actions
189
  }
190
 
191
- })(window, Vue, LP_Helpers, lp_quiz_editor);
192
 
193
  /**
194
  * I18n Store
195
  *
196
  * @since 3.0.0
197
  */
198
- var LP_Quiz_i18n_Store = (function (Vue, helpers, data) {
199
 
200
  var state = helpers.cloneObject(data.i18n);
201
 
@@ -211,14 +215,14 @@ var LP_Quiz_i18n_Store = (function (Vue, helpers, data) {
211
  getters: getters
212
  }
213
 
214
- })(Vue, LP_Helpers, lp_quiz_editor);
215
 
216
  /**
217
  * List quiz questions store.
218
  *
219
  * @since 3.0.0
220
  */
221
- var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
222
 
223
  var state = helpers.cloneObject(data.listQuestions);
224
 
@@ -300,7 +304,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
300
  for (var i = 0, n = question.answers.length; i < n; i++) {
301
  if (question.answers[i].question_answer_id == payload.answer.temp_id) {
302
  found = true;
303
- Vue.set(question.answers, i, payload.answer);
304
  }
305
  }
306
  }
@@ -328,7 +332,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
328
  if (question.temp_id) {
329
  for (var i = 0, n = state.questions.length; i < n; i++) {
330
  if (state.questions[i].id === question.temp_id) {
331
- Vue.set(state.questions, i, question);
332
  found = true;
333
  break;
334
  }
@@ -413,23 +417,23 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
413
  })
414
  },
415
  'UPDATE_QUESTION_REQUEST': function (state, questionId) {
416
- Vue.set(state.statusUpdateQuestionItem, questionId, 'updating');
417
  },
418
  'UPDATE_QUESTION_SUCCESS': function (state, questionID) {
419
- Vue.set(state.statusUpdateQuestionItem, questionID, 'successful');
420
  },
421
  'UPDATE_QUESTION_FAILURE': function (state, questionID) {
422
- Vue.set(state.statusUpdateQuestionItem, questionID, 'failed')
423
  },
424
 
425
  'UPDATE_QUESTION_ANSWER_REQUEST': function (state, question_id) {
426
- Vue.set(state.statusUpdateQuestionAnswer, question_id, 'updating');
427
  },
428
  'UPDATE_QUESTION_ANSWER_SUCCESS': function (state, question_id) {
429
- Vue.set(state.statusUpdateQuestionAnswer, question_id, 'successful');
430
  },
431
  'UPDATE_QUESTION_ANSWER_FAIL': function (state, question_id) {
432
- Vue.set(state.statusUpdateQuestionAnswer, question_id, 'failed');
433
  },
434
  'DELETE_ANSWER': function (state, data) {
435
  state.questions.map(function (question, index) {
@@ -459,14 +463,14 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
459
  context.commit('CLOSE_LIST_QUESTIONS');
460
  }
461
 
462
- Vue.http.LPRequest({
463
  type: 'hidden-questions',
464
  hidden: context.getters['hiddenQuestions']
465
  })
466
  },
467
 
468
  updateQuizQuestionsHidden: function (context, data) {
469
- Vue.http.LPRequest($.extend({}, data, {
470
  type: 'update-quiz-questions-hidden'
471
  }));
472
  },
@@ -475,7 +479,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
475
  var newQuestion = JSON.parse(JSON.stringify(payload.question));
476
  newQuestion.settings = {};
477
  context.commit('ADD_NEW_QUESTION', newQuestion);
478
- Vue.http.LPRequest({
479
  type: 'new-question',
480
  question: JSON.stringify(payload.question),
481
  draft_quiz: JSON.stringify(payload.quiz)
@@ -499,7 +503,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
499
  },
500
 
501
  updateQuestionsOrder: function (context, order) {
502
- Vue.http.LPRequest({
503
  type: 'sort-questions',
504
  order: JSON.stringify(order)
505
  }).then(
@@ -516,7 +520,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
516
 
517
  context.commit('UPDATE_QUESTION_REQUEST', question.id);
518
 
519
- Vue.http.LPRequest({
520
  type: 'update-question-title',
521
  question: JSON.stringify(question)
522
  }).then(
@@ -533,7 +537,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
533
 
534
  context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
535
 
536
- Vue.http.LPRequest({
537
  type: 'change-question-type',
538
  question_id: payload.question_id,
539
  question_type: payload.type
@@ -556,7 +560,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
556
  },
557
 
558
  cloneQuestion: function (context, question) {
559
- Vue.http.LPRequest({
560
  type: 'clone-question',
561
  question: JSON.stringify(question)
562
  }).then(
@@ -581,7 +585,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
581
  question.temp_id = LP.uniqueId();
582
  context.commit('REMOVE_QUESTION', question);
583
 
584
- Vue.http.LPRequest({
585
  type: 'remove-question',
586
  question_id: question_id
587
  }).then(
@@ -604,11 +608,10 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
604
  var question_id = question.id;
605
  question.temp_id = LP.uniqueId();
606
  context.commit('REMOVE_QUESTION', question);
607
- Vue.http
608
- .LPRequest({
609
- type: 'delete-question',
610
- question_id: question.id
611
- })
612
  .then(function () {
613
  question.id = question.temp_id;
614
  question.temp_id = 0;
@@ -627,7 +630,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
627
  context.commit('OPEN_QUESTION', question);
628
  }
629
 
630
- Vue.http.LPRequest({
631
  type: 'hidden-questions',
632
  hidden: context.getters['hiddenQuestions']
633
  }
@@ -637,7 +640,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
637
  updateQuestionAnswersOrder: function (context, payload) {
638
  context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
639
 
640
- Vue.http.LPRequest({
641
  type: 'sort-question-answers',
642
  question_id: payload.question_id,
643
  order: JSON.stringify(payload.order)
@@ -659,7 +662,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
659
 
660
  context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
661
 
662
- Vue.http.LPRequest({
663
  type: 'update-question-answer-title',
664
  question_id: parseInt(payload.question_id),
665
  answer: JSON.stringify(payload.answer)
@@ -678,7 +681,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
678
  updateQuestionCorrectAnswer: function (context, payload) {
679
  context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
680
 
681
- Vue.http.LPRequest({
682
  type: 'change-question-correct-answer',
683
  question_id: payload.question_id,
684
  correct: JSON.stringify(payload.correct)
@@ -702,7 +705,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
702
  context.commit('DELETE_ANSWER', payload);
703
  context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
704
 
705
- Vue.http.LPRequest({
706
  type: 'delete-question-answer',
707
  question_id: payload.question_id,
708
  answer_id: payload.answer_id
@@ -734,12 +737,11 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
734
  question_id: question_id,
735
  answer: {'text': LP_Quiz_Store.getters['i18n/all'].new_option, 'question_answer_id': temp_id}
736
  });
737
- Vue.http
738
- .LPRequest({
739
- type: 'new-question-answer',
740
- question_id: question_id,
741
- question_answer_id: temp_id
742
- })
743
  .then(
744
  function (response) {
745
  var result = response.body;
@@ -764,7 +766,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
764
 
765
  context.commit('UPDATE_QUESTION_REQUEST', question.id);
766
 
767
- Vue.http.LPRequest({
768
  type: 'update-question-content',
769
  question: JSON.stringify(question)
770
  }).then(
@@ -781,7 +783,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
781
 
782
  context.commit('UPDATE_QUESTION_REQUEST', payload.question.id);
783
 
784
- Vue.http.LPRequest({
785
  type: 'update-question-meta',
786
  question: JSON.stringify(payload.question),
787
  meta_key: payload.meta_key
@@ -804,14 +806,14 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
804
  actions: actions
805
  }
806
 
807
- })(Vue, LP_Helpers, lp_quiz_editor, jQuery);
808
 
809
  /**
810
  * Root Store
811
  *
812
  * @since 3.0.0
813
  */
814
- (function (exports, Vue, Vuex, helpers, data) {
815
 
816
  var state = helpers.cloneObject(data.root);
817
 
@@ -871,11 +873,10 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
871
 
872
  var actions = {
873
  heartbeat: function (context) {
874
- Vue.http
875
- .LPRequest({
876
- type: 'heartbeat'
877
- }
878
- )
879
  .then(
880
  function (response) {
881
  var result = response.body;
@@ -906,7 +907,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
906
  }
907
  };
908
 
909
- exports.LP_Quiz_Store = new Vuex.Store({
910
  state: state,
911
  getters: getters,
912
  mutations: mutations,
@@ -918,7 +919,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
918
  }
919
  });
920
 
921
- })(window, Vue, Vuex, LP_Helpers, lp_quiz_editor);
922
 
923
 
924
  /**
@@ -926,11 +927,11 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
926
  *
927
  * @since 3.0.0
928
  */
929
- (function (exports, Vue, $store) {
930
  var $ = jQuery,
931
  $publishingAction = null;
932
 
933
- Vue.http.LPRequest = function (payload) {
934
  payload['id'] = $store.getters.id;
935
  payload['nonce'] = $store.getters.nonce;
936
  payload['lp-ajax'] = $store.getters.action;
@@ -942,7 +943,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
942
  $publishingAction.find('.spinner').addClass('is-active');
943
  $publishingAction.addClass('code-' + payload['code']);
944
 
945
- return Vue.http.post($store.getters.urlAjax,
946
  payload, {
947
  emulateJSON: true,
948
  params: {
@@ -952,7 +953,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
952
  });
953
  };
954
 
955
- Vue.http.interceptors.push(function (request, next) {
956
  if (request.params['namespace'] !== 'LPListQuizQuestionsRequest') {
957
  next();
958
  return;
@@ -984,18 +985,18 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
984
  });
985
  });
986
 
987
- })(window, Vue, LP_Quiz_Store);
988
 
989
  /**
990
  * Init app.
991
  *
992
  * @since 3.0.0
993
  */
994
- (function ($, Vue, $store) {
995
  $(document).ready(function () {
996
- window.LP_Quiz_Editor = new Vue({
997
  el: '#admin-editor-lp_quiz',
998
  template: '<lp-quiz-editor></lp-quiz-editor>'
999
  });
1000
  });
1001
- })(jQuery, Vue, LP_Quiz_Store);
15
  };
16
  })(window);
17
 
18
+ window.$Vue = window.$Vue || Vue;
19
+ window.$Vuex = window.$Vuex || Vuex;
20
+
21
+ var $VueHTTP = Vue.http;
22
+
23
  /**
24
  * Choose quiz items modal store.
25
  *
26
  * @since 3.0.0
27
  */
28
+ var LP_Choose_Quiz_Items_Modal_Store = (function (exports, helpers, data) {
29
 
30
  var state = helpers.cloneObject(data.chooseItems);
31
  state.quizId = false;
119
  searchItems: function (context, payload) {
120
  context.commit('SEARCH_ITEM_REQUEST');
121
 
122
+ LP.Request({
123
+ type: 'search-items',
124
+ query: payload.query,
125
+ page: payload.page,
126
+ exclude: JSON.stringify([])
127
+ }).then(
 
128
  function (response) {
129
  var result = response.body;
130
 
160
  var items = context.getters.addedItems;
161
 
162
  if (items.length > 0) {
163
+ LP.Request({
164
  type: 'add-questions-to-quiz',
165
  items: JSON.stringify(items),
166
  draft_quiz: JSON.stringify(quiz)
192
  actions: actions
193
  }
194
 
195
+ })(window, LP_Helpers, lp_quiz_editor);
196
 
197
  /**
198
  * I18n Store
199
  *
200
  * @since 3.0.0
201
  */
202
+ var LP_Quiz_i18n_Store = (function (helpers, data) {
203
 
204
  var state = helpers.cloneObject(data.i18n);
205
 
215
  getters: getters
216
  }
217
 
218
+ })(LP_Helpers, lp_quiz_editor);
219
 
220
  /**
221
  * List quiz questions store.
222
  *
223
  * @since 3.0.0
224
  */
225
+ var LP_List_Quiz_Questions_Store = (function (helpers, data, $) {
226
 
227
  var state = helpers.cloneObject(data.listQuestions);
228
 
304
  for (var i = 0, n = question.answers.length; i < n; i++) {
305
  if (question.answers[i].question_answer_id == payload.answer.temp_id) {
306
  found = true;
307
+ $Vue.set(question.answers, i, payload.answer);
308
  }
309
  }
310
  }
332
  if (question.temp_id) {
333
  for (var i = 0, n = state.questions.length; i < n; i++) {
334
  if (state.questions[i].id === question.temp_id) {
335
+ $Vue.set(state.questions, i, question);
336
  found = true;
337
  break;
338
  }
417
  })
418
  },
419
  'UPDATE_QUESTION_REQUEST': function (state, questionId) {
420
+ $Vue.set(state.statusUpdateQuestionItem, questionId, 'updating');
421
  },
422
  'UPDATE_QUESTION_SUCCESS': function (state, questionID) {
423
+ $Vue.set(state.statusUpdateQuestionItem, questionID, 'successful');
424
  },
425
  'UPDATE_QUESTION_FAILURE': function (state, questionID) {
426
+ $Vue.set(state.statusUpdateQuestionItem, questionID, 'failed')
427
  },
428
 
429
  'UPDATE_QUESTION_ANSWER_REQUEST': function (state, question_id) {
430
+ $Vue.set(state.statusUpdateQuestionAnswer, question_id, 'updating');
431
  },
432
  'UPDATE_QUESTION_ANSWER_SUCCESS': function (state, question_id) {
433
+ $Vue.set(state.statusUpdateQuestionAnswer, question_id, 'successful');
434
  },
435
  'UPDATE_QUESTION_ANSWER_FAIL': function (state, question_id) {
436
+ $Vue.set(state.statusUpdateQuestionAnswer, question_id, 'failed');
437
  },
438
  'DELETE_ANSWER': function (state, data) {
439
  state.questions.map(function (question, index) {
463
  context.commit('CLOSE_LIST_QUESTIONS');
464
  }
465
 
466
+ LP.Request({
467
  type: 'hidden-questions',
468
  hidden: context.getters['hiddenQuestions']
469
  })
470
  },
471
 
472
  updateQuizQuestionsHidden: function (context, data) {
473
+ LP.Request($.extend({}, data, {
474
  type: 'update-quiz-questions-hidden'
475
  }));
476
  },
479
  var newQuestion = JSON.parse(JSON.stringify(payload.question));
480
  newQuestion.settings = {};
481
  context.commit('ADD_NEW_QUESTION', newQuestion);
482
+ LP.Request({
483
  type: 'new-question',
484
  question: JSON.stringify(payload.question),
485
  draft_quiz: JSON.stringify(payload.quiz)
503
  },
504
 
505
  updateQuestionsOrder: function (context, order) {
506
+ LP.Request({
507
  type: 'sort-questions',
508
  order: JSON.stringify(order)
509
  }).then(
520
 
521
  context.commit('UPDATE_QUESTION_REQUEST', question.id);
522
 
523
+ LP.Request({
524
  type: 'update-question-title',
525
  question: JSON.stringify(question)
526
  }).then(
537
 
538
  context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
539
 
540
+ LP.Request({
541
  type: 'change-question-type',
542
  question_id: payload.question_id,
543
  question_type: payload.type
560
  },
561
 
562
  cloneQuestion: function (context, question) {
563
+ LP.Request({
564
  type: 'clone-question',
565
  question: JSON.stringify(question)
566
  }).then(
585
  question.temp_id = LP.uniqueId();
586
  context.commit('REMOVE_QUESTION', question);
587
 
588
+ LP.Request({
589
  type: 'remove-question',
590
  question_id: question_id
591
  }).then(
608
  var question_id = question.id;
609
  question.temp_id = LP.uniqueId();
610
  context.commit('REMOVE_QUESTION', question);
611
+ LP.Request({
612
+ type: 'delete-question',
613
+ question_id: question_id
614
+ })
 
615
  .then(function () {
616
  question.id = question.temp_id;
617
  question.temp_id = 0;
630
  context.commit('OPEN_QUESTION', question);
631
  }
632
 
633
+ LP.Request({
634
  type: 'hidden-questions',
635
  hidden: context.getters['hiddenQuestions']
636
  }
640
  updateQuestionAnswersOrder: function (context, payload) {
641
  context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
642
 
643
+ LP.Request({
644
  type: 'sort-question-answers',
645
  question_id: payload.question_id,
646
  order: JSON.stringify(payload.order)
662
 
663
  context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
664
 
665
+ LP.Request({
666
  type: 'update-question-answer-title',
667
  question_id: parseInt(payload.question_id),
668
  answer: JSON.stringify(payload.answer)
681
  updateQuestionCorrectAnswer: function (context, payload) {
682
  context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
683
 
684
+ LP.Request({
685
  type: 'change-question-correct-answer',
686
  question_id: payload.question_id,
687
  correct: JSON.stringify(payload.correct)
705
  context.commit('DELETE_ANSWER', payload);
706
  context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
707
 
708
+ LP.Request({
709
  type: 'delete-question-answer',
710
  question_id: payload.question_id,
711
  answer_id: payload.answer_id
737
  question_id: question_id,
738
  answer: {'text': LP_Quiz_Store.getters['i18n/all'].new_option, 'question_answer_id': temp_id}
739
  });
740
+ LP.Request({
741
+ type: 'new-question-answer',
742
+ question_id: question_id,
743
+ question_answer_id: temp_id
744
+ })
 
745
  .then(
746
  function (response) {
747
  var result = response.body;
766
 
767
  context.commit('UPDATE_QUESTION_REQUEST', question.id);
768
 
769
+ LP.Request({
770
  type: 'update-question-content',
771
  question: JSON.stringify(question)
772
  }).then(
783
 
784
  context.commit('UPDATE_QUESTION_REQUEST', payload.question.id);
785
 
786
+ LP.Request({
787
  type: 'update-question-meta',
788
  question: JSON.stringify(payload.question),
789
  meta_key: payload.meta_key
806
  actions: actions
807
  }
808
 
809
+ })(LP_Helpers, lp_quiz_editor, jQuery);
810
 
811
  /**
812
  * Root Store
813
  *
814
  * @since 3.0.0
815
  */
816
+ (function (exports, helpers, data) {
817
 
818
  var state = helpers.cloneObject(data.root);
819
 
873
 
874
  var actions = {
875
  heartbeat: function (context) {
876
+ LP.Request({
877
+ type: 'heartbeat'
878
+ }
879
+ )
 
880
  .then(
881
  function (response) {
882
  var result = response.body;
907
  }
908
  };
909
 
910
+ exports.LP_Quiz_Store = new $Vuex.Store({
911
  state: state,
912
  getters: getters,
913
  mutations: mutations,
919
  }
920
  });
921
 
922
+ })(window, LP_Helpers, lp_quiz_editor);
923
 
924
 
925
  /**
927
  *
928
  * @since 3.0.0
929
  */
930
+ (function (exports, $store) {
931
  var $ = jQuery,
932
  $publishingAction = null;
933
 
934
+ LP.Request = function (payload) {
935
  payload['id'] = $store.getters.id;
936
  payload['nonce'] = $store.getters.nonce;
937
  payload['lp-ajax'] = $store.getters.action;
943
  $publishingAction.find('.spinner').addClass('is-active');
944
  $publishingAction.addClass('code-' + payload['code']);
945
 
946
+ return $VueHTTP.post($store.getters.urlAjax,
947
  payload, {
948
  emulateJSON: true,
949
  params: {
953
  });
954
  };
955
 
956
+ $VueHTTP.interceptors.push(function (request, next) {
957
  if (request.params['namespace'] !== 'LPListQuizQuestionsRequest') {
958
  next();
959
  return;
985
  });
986
  });
987
 
988
+ })(window, LP_Quiz_Store);
989
 
990
  /**
991
  * Init app.
992
  *
993
  * @since 3.0.0
994
  */
995
+ (function ($, $store) {
996
  $(document).ready(function () {
997
+ window.LP_Quiz_Editor = new $Vue({
998
  el: '#admin-editor-lp_quiz',
999
  template: '<lp-quiz-editor></lp-quiz-editor>'
1000
  });
1001
  });
1002
+ })(jQuery, LP_Quiz_Store);
assets/js/admin/statistic.js CHANGED
@@ -131,7 +131,6 @@
131
  * @returns {Boolean}
132
  */
133
  var LP_Statistic_Orders_Upgrade_Chart =function(){
134
- console.log('abc');
135
  var type = '', from = '', to = '', report_sales_by = 'date', cat_id = 0, course_id = 0;
136
  report_sales_by = $('#report_sales_by').val();
137
  $container = $('#learn-press-chart');
131
  * @returns {Boolean}
132
  */
133
  var LP_Statistic_Orders_Upgrade_Chart =function(){
 
134
  var type = '', from = '', to = '', report_sales_by = 'date', cat_id = 0, course_id = 0;
135
  report_sales_by = $('#report_sales_by').val();
136
  $container = $('#learn-press-chart');
assets/js/admin/sync-data.js CHANGED
@@ -87,7 +87,6 @@
87
  that.items = [];
88
  that.callToCallback();
89
  }
90
- console.log('Get items: ', that.items.length);
91
  }
92
  });
93
  }
87
  that.items = [];
88
  that.callToCallback();
89
  }
 
90
  }
91
  });
92
  }
assets/js/admin/update.js CHANGED
@@ -124,8 +124,6 @@
124
  i = i ? i : 1;
125
 
126
  if (p) {
127
- console.log('Updating ...', this.packages.currentVersion(), p)
128
-
129
  $.ajax({
130
  url: lpGlobalSettings.admin_url,
131
  data: {
@@ -154,7 +152,6 @@
154
  }
155
  },
156
  error: function () {
157
- console.log('Update Error: Retry!');
158
  that.doUpdate(p, i);
159
  }
160
  });
124
  i = i ? i : 1;
125
 
126
  if (p) {
 
 
127
  $.ajax({
128
  url: lpGlobalSettings.admin_url,
129
  data: {
152
  }
153
  },
154
  error: function () {
 
155
  that.doUpdate(p, i);
156
  }
157
  });
assets/js/admin/utils/_dropdown-pages.js CHANGED
@@ -28,7 +28,6 @@
28
  $sel.append($option);
29
  } else {
30
  $option.insertAfter($('option[value="' + args.positions[position - 1] + '"]', $sel));
31
- console.log($('option[value="' + args.positions[position - 1] + '"]', $sel))
32
  }
33
  });
34
  }
28
  $sel.append($option);
29
  } else {
30
  $option.insertAfter($('option[value="' + args.positions[position - 1] + '"]', $sel));
 
31
  }
32
  });
33
  }
assets/js/global.js CHANGED
@@ -1273,7 +1273,8 @@ if (typeof window.LP == 'undefined') {
1273
  }
1274
 
1275
  $('#field-_lp_sale_start div, #field-_lp_sale_end div').remove('.learn-press-tip-floating');
1276
- if (_start_date < _end_date) {
 
1277
  _parent_start.append('<div class="learn-press-tip-floating">' + lpAdminCourseEditorSettings.i18n.notice_sale_start_date + '</div>')
1278
  }
1279
  });
@@ -1291,7 +1292,7 @@ if (typeof window.LP == 'undefined') {
1291
  }
1292
 
1293
  $('#field-_lp_sale_start div, #field-_lp_sale_end div').remove('.learn-press-tip-floating');
1294
- if (_start_date < _end_date) {
1295
  _parent_end.append('<div class="learn-press-tip-floating">' + lpAdminCourseEditorSettings.i18n.notice_sale_end_date + '</div>')
1296
  }
1297
  });
1273
  }
1274
 
1275
  $('#field-_lp_sale_start div, #field-_lp_sale_end div').remove('.learn-press-tip-floating');
1276
+
1277
+ if (_start_date > _end_date) {
1278
  _parent_start.append('<div class="learn-press-tip-floating">' + lpAdminCourseEditorSettings.i18n.notice_sale_start_date + '</div>')
1279
  }
1280
  });
1292
  }
1293
 
1294
  $('#field-_lp_sale_start div, #field-_lp_sale_end div').remove('.learn-press-tip-floating');
1295
+ if (_start_date > _end_date) {
1296
  _parent_end.append('<div class="learn-press-tip-floating">' + lpAdminCourseEditorSettings.i18n.notice_sale_end_date + '</div>')
1297
  }
1298
  });
assets/js/vendor/{sortable.1.6.0.js → sortable.js} RENAMED
File without changes
assets/js/vendor/{vue-resource.1.3.4.js → vue-resource.js} RENAMED
File without changes
assets/js/vendor/vue.js CHANGED
@@ -1,10057 +1,11945 @@
1
  /*!
2
- * Vue.js v2.4.0
3
- * (c) 2014-2017 Evan You
4
  * Released under the MIT License.
5
  */
6
- (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
8
- typeof define === 'function' && define.amd ? define(factory) :
9
- (global.Vue = factory());
10
- }(this, (function () { 'use strict';
11
-
12
- /* */
13
 
14
- // these helpers produces better vm code in JS engines due to their
15
- // explicitness and function inlining
16
- function isUndef (v) {
17
- return v === undefined || v === null
18
- }
19
 
20
- function isDef (v) {
21
- return v !== undefined && v !== null
22
- }
23
 
24
- function isTrue (v) {
25
- return v === true
26
- }
27
 
28
- function isFalse (v) {
29
- return v === false
30
- }
 
 
31
 
32
- /**
33
- * Check if value is primitive
34
- */
35
- function isPrimitive (value) {
36
- return typeof value === 'string' || typeof value === 'number'
37
- }
38
-
39
- /**
40
- * Quick object check - this is primarily used to tell
41
- * Objects from primitive values when we know the value
42
- * is a JSON-compliant type.
43
- */
44
- function isObject (obj) {
45
- return obj !== null && typeof obj === 'object'
46
- }
47
 
48
- var _toString = Object.prototype.toString;
 
 
49
 
50
- /**
51
- * Strict object type check. Only returns true
52
- * for plain JavaScript objects.
53
- */
54
- function isPlainObject (obj) {
55
- return _toString.call(obj) === '[object Object]'
56
- }
57
 
58
- function isRegExp (v) {
59
- return _toString.call(v) === '[object RegExp]'
60
- }
 
 
 
 
 
 
 
 
 
61
 
62
- /**
63
- * Check if val is a valid array index.
64
- */
65
- function isValidArrayIndex (val) {
66
- var n = parseFloat(val);
67
- return n >= 0 && Math.floor(n) === n && isFinite(val)
68
- }
 
69
 
70
- /**
71
- * Convert a value to a string that is actually rendered.
72
- */
73
- function toString (val) {
74
- return val == null
75
- ? ''
76
- : typeof val === 'object'
77
- ? JSON.stringify(val, null, 2)
78
- : String(val)
79
- }
80
-
81
- /**
82
- * Convert a input value to a number for persistence.
83
- * If the conversion fails, return original string.
84
- */
85
- function toNumber (val) {
86
- var n = parseFloat(val);
87
- return isNaN(n) ? val : n
88
- }
89
-
90
- /**
91
- * Make a map and return a function for checking if a key
92
- * is in that map.
93
- */
94
- function makeMap (
95
- str,
96
- expectsLowerCase
97
- ) {
98
- var map = Object.create(null);
99
- var list = str.split(',');
100
- for (var i = 0; i < list.length; i++) {
101
- map[list[i]] = true;
102
- }
103
- return expectsLowerCase
104
- ? function (val) { return map[val.toLowerCase()]; }
105
- : function (val) { return map[val]; }
106
- }
107
-
108
- /**
109
- * Check if a tag is a built-in tag.
110
- */
111
- var isBuiltInTag = makeMap('slot,component', true);
112
 
113
- /**
114
- * Check if a attribute is a reserved attribute.
115
- */
116
- var isReservedAttribute = makeMap('key,ref,slot,is');
117
 
118
- /**
119
- * Remove an item from an array
120
- */
121
- function remove (arr, item) {
122
- if (arr.length) {
123
- var index = arr.indexOf(item);
124
- if (index > -1) {
125
- return arr.splice(index, 1)
126
  }
127
- }
128
- }
129
 
130
- /**
131
- * Check whether the object has the property.
132
- */
133
- var hasOwnProperty = Object.prototype.hasOwnProperty;
134
- function hasOwn (obj, key) {
135
- return hasOwnProperty.call(obj, key)
136
- }
137
 
138
- /**
139
- * Create a cached version of a pure function.
140
- */
141
- function cached (fn) {
142
- var cache = Object.create(null);
143
- return (function cachedFn (str) {
144
- var hit = cache[str];
145
- return hit || (cache[str] = fn(str))
146
- })
147
- }
148
-
149
- /**
150
- * Camelize a hyphen-delimited string.
151
- */
152
- var camelizeRE = /-(\w)/g;
153
- var camelize = cached(function (str) {
154
- return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
155
- });
156
 
157
- /**
158
- * Capitalize a string.
159
- */
160
- var capitalize = cached(function (str) {
161
- return str.charAt(0).toUpperCase() + str.slice(1)
162
- });
 
163
 
164
- /**
165
- * Hyphenate a camelCase string.
166
- */
167
- var hyphenateRE = /([^-])([A-Z])/g;
168
- var hyphenate = cached(function (str) {
169
- return str
170
- .replace(hyphenateRE, '$1-$2')
171
- .replace(hyphenateRE, '$1-$2')
172
- .toLowerCase()
173
- });
174
-
175
- /**
176
- * Simple bind, faster than native
177
- */
178
- function bind (fn, ctx) {
179
- function boundFn (a) {
180
- var l = arguments.length;
181
- return l
182
- ? l > 1
183
- ? fn.apply(ctx, arguments)
184
- : fn.call(ctx, a)
185
- : fn.call(ctx)
186
- }
187
- // record original fn length
188
- boundFn._length = fn.length;
189
- return boundFn
190
- }
191
-
192
- /**
193
- * Convert an Array-like object to a real Array.
194
- */
195
- function toArray (list, start) {
196
- start = start || 0;
197
- var i = list.length - start;
198
- var ret = new Array(i);
199
- while (i--) {
200
- ret[i] = list[i + start];
201
- }
202
- return ret
203
- }
204
-
205
- /**
206
- * Mix properties into target object.
207
- */
208
- function extend (to, _from) {
209
- for (var key in _from) {
210
- to[key] = _from[key];
211
- }
212
- return to
213
- }
214
-
215
- /**
216
- * Merge an Array of Objects into a single Object.
217
- */
218
- function toObject (arr) {
219
- var res = {};
220
- for (var i = 0; i < arr.length; i++) {
221
- if (arr[i]) {
222
- extend(res, arr[i]);
223
- }
224
- }
225
- return res
226
- }
227
-
228
- /**
229
- * Perform no operation.
230
- * Stubbing args to make Flow happy without leaving useless transpiled code
231
- * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
232
- */
233
- function noop (a, b, c) {}
234
 
235
- /**
236
- * Always return false.
237
- */
238
- var no = function (a, b, c) { return false; };
 
 
 
239
 
240
- /**
241
- * Return same value
242
- */
243
- var identity = function (_) { return _; };
 
 
 
 
 
 
244
 
245
- /**
246
- * Generate a static keys string from compiler modules.
247
- */
248
- function genStaticKeys (modules) {
249
- return modules.reduce(function (keys, m) {
250
- return keys.concat(m.staticKeys || [])
251
- }, []).join(',')
252
- }
253
-
254
- /**
255
- * Check if two values are loosely equal - that is,
256
- * if they are plain objects, do they have the same shape?
257
- */
258
- function looseEqual (a, b) {
259
- var isObjectA = isObject(a);
260
- var isObjectB = isObject(b);
261
- if (isObjectA && isObjectB) {
262
- try {
263
- return JSON.stringify(a) === JSON.stringify(b)
264
- } catch (e) {
265
- // possible circular reference
266
- return a === b
267
- }
268
- } else if (!isObjectA && !isObjectB) {
269
- return String(a) === String(b)
270
- } else {
271
- return false
272
- }
273
- }
274
-
275
- function looseIndexOf (arr, val) {
276
- for (var i = 0; i < arr.length; i++) {
277
- if (looseEqual(arr[i], val)) { return i }
278
- }
279
- return -1
280
- }
281
-
282
- /**
283
- * Ensure a function is called only once.
284
- */
285
- function once (fn) {
286
- var called = false;
287
- return function () {
288
- if (!called) {
289
- called = true;
290
- fn.apply(this, arguments);
291
- }
292
- }
293
- }
294
-
295
- var SSR_ATTR = 'data-server-rendered';
296
-
297
- var ASSET_TYPES = [
298
- 'component',
299
- 'directive',
300
- 'filter'
301
- ];
302
-
303
- var LIFECYCLE_HOOKS = [
304
- 'beforeCreate',
305
- 'created',
306
- 'beforeMount',
307
- 'mounted',
308
- 'beforeUpdate',
309
- 'updated',
310
- 'beforeDestroy',
311
- 'destroyed',
312
- 'activated',
313
- 'deactivated'
314
- ];
315
-
316
- /* */
317
-
318
- var config = ({
319
- /**
320
- * Option merge strategies (used in core/util/options)
321
- */
322
- optionMergeStrategies: Object.create(null),
323
 
324
- /**
325
- * Whether to suppress warnings.
326
- */
327
- silent: false,
 
 
328
 
329
- /**
330
- * Show production mode tip message on boot?
331
- */
332
- productionTip: "development" !== 'production',
 
 
 
333
 
334
- /**
335
- * Whether to enable devtools
336
- */
337
- devtools: "development" !== 'production',
 
 
 
338
 
339
- /**
340
- * Whether to record perf
341
- */
342
- performance: false,
 
 
 
 
 
 
343
 
344
- /**
345
- * Error handler for watcher errors
346
- */
347
- errorHandler: null,
348
 
349
- /**
350
- * Warn handler for watcher warns
351
- */
352
- warnHandler: null,
353
 
354
- /**
355
- * Ignore certain custom elements
356
- */
357
- ignoredElements: [],
358
 
359
- /**
360
- * Custom user key aliases for v-on
361
- */
362
- keyCodes: Object.create(null),
 
 
 
 
 
 
 
 
363
 
364
- /**
365
- * Check if a tag is reserved so that it cannot be registered as a
366
- * component. This is platform-dependent and may be overwritten.
367
- */
368
- isReservedTag: no,
 
 
 
 
369
 
370
- /**
371
- * Check if an attribute is reserved so that it cannot be used as a component
372
- * prop. This is platform-dependent and may be overwritten.
373
- */
374
- isReservedAttr: no,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
 
376
- /**
377
- * Check if a tag is an unknown element.
378
- * Platform-dependent.
379
- */
380
- isUnknownElement: no,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
 
382
- /**
383
- * Get the namespace of an element
384
- */
385
- getTagNamespace: noop,
386
 
387
- /**
388
- * Parse the real tag name for the specific platform.
389
- */
390
- parsePlatformTagName: identity,
 
391
 
392
- /**
393
- * Check if an attribute must be bound using property, e.g. value
394
- * Platform-dependent.
395
- */
396
- mustUseProp: no,
 
 
 
 
 
 
 
 
 
397
 
398
- /**
399
- * Exposed for legacy reasons
400
- */
401
- _lifecycleHooks: LIFECYCLE_HOOKS
402
- });
403
 
404
- /* */
405
 
406
- var emptyObject = Object.freeze({});
407
 
408
- /**
409
- * Check if a string starts with $ or _
410
- */
411
- function isReserved (str) {
412
- var c = (str + '').charCodeAt(0);
413
- return c === 0x24 || c === 0x5F
414
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415
 
416
- /**
417
- * Define a property.
418
- */
419
- function def (obj, key, val, enumerable) {
420
- Object.defineProperty(obj, key, {
421
- value: val,
422
- enumerable: !!enumerable,
423
- writable: true,
424
- configurable: true
425
- });
426
- }
427
-
428
- /**
429
- * Parse simple path.
430
- */
431
- var bailRE = /[^\w.$]/;
432
- function parsePath (path) {
433
- if (bailRE.test(path)) {
434
- return
435
- }
436
- var segments = path.split('.');
437
- return function (obj) {
438
- for (var i = 0; i < segments.length; i++) {
439
- if (!obj) { return }
440
- obj = obj[segments[i]];
441
- }
442
- return obj
443
- }
444
- }
445
-
446
- /* */
447
-
448
- var warn = noop;
449
- var tip = noop;
450
- var formatComponentName = (null); // work around flow check
451
-
452
- {
453
- var hasConsole = typeof console !== 'undefined';
454
- var classifyRE = /(?:^|[-_])(\w)/g;
455
- var classify = function (str) { return str
456
- .replace(classifyRE, function (c) { return c.toUpperCase(); })
457
- .replace(/[-_]/g, ''); };
458
-
459
- warn = function (msg, vm) {
460
- var trace = vm ? generateComponentTrace(vm) : '';
461
-
462
- if (config.warnHandler) {
463
- config.warnHandler.call(null, msg, vm, trace);
464
- } else if (hasConsole && (!config.silent)) {
465
- console.error(("[Vue warn]: " + msg + trace));
466
- }
467
- };
468
-
469
- tip = function (msg, vm) {
470
- if (hasConsole && (!config.silent)) {
471
- console.warn("[Vue tip]: " + msg + (
472
- vm ? generateComponentTrace(vm) : ''
473
- ));
474
- }
475
- };
476
-
477
- formatComponentName = function (vm, includeFile) {
478
- if (vm.$root === vm) {
479
- return '<Root>'
480
- }
481
- var name = typeof vm === 'string'
482
- ? vm
483
- : typeof vm === 'function' && vm.options
484
- ? vm.options.name
485
- : vm._isVue
486
- ? vm.$options.name || vm.$options._componentTag
487
- : vm.name;
488
-
489
- var file = vm._isVue && vm.$options.__file;
490
- if (!name && file) {
491
- var match = file.match(/([^/\\]+)\.vue$/);
492
- name = match && match[1];
493
- }
494
-
495
- return (
496
- (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
497
- (file && includeFile !== false ? (" at " + file) : '')
498
- )
499
- };
500
-
501
- var repeat = function (str, n) {
502
- var res = '';
503
- while (n) {
504
- if (n % 2 === 1) { res += str; }
505
- if (n > 1) { str += str; }
506
- n >>= 1;
507
- }
508
- return res
509
- };
510
-
511
- var generateComponentTrace = function (vm) {
512
- if (vm._isVue && vm.$parent) {
513
- var tree = [];
514
- var currentRecursiveSequence = 0;
515
- while (vm) {
516
- if (tree.length > 0) {
517
- var last = tree[tree.length - 1];
518
- if (last.constructor === vm.constructor) {
519
- currentRecursiveSequence++;
520
- vm = vm.$parent;
521
- continue
522
- } else if (currentRecursiveSequence > 0) {
523
- tree[tree.length - 1] = [last, currentRecursiveSequence];
524
- currentRecursiveSequence = 0;
525
- }
526
- }
527
- tree.push(vm);
528
- vm = vm.$parent;
529
- }
530
- return '\n\nfound in\n\n' + tree
531
- .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
532
- ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
533
- : formatComponentName(vm))); })
534
- .join('\n')
535
- } else {
536
- return ("\n\n(found in " + (formatComponentName(vm)) + ")")
537
  }
538
- };
539
- }
540
-
541
- /* */
542
 
543
- function handleError (err, vm, info) {
544
- if (config.errorHandler) {
545
- config.errorHandler.call(null, err, vm, info);
546
- } else {
547
- {
548
- warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
549
- }
550
- /* istanbul ignore else */
551
- if (inBrowser && typeof console !== 'undefined') {
552
- console.error(err);
553
- } else {
554
- throw err
555
- }
556
- }
557
- }
558
-
559
- /* */
560
- /* globals MutationObserver */
561
-
562
- // can we use __proto__?
563
- var hasProto = '__proto__' in {};
564
-
565
- // Browser environment sniffing
566
- var inBrowser = typeof window !== 'undefined';
567
- var UA = inBrowser && window.navigator.userAgent.toLowerCase();
568
- var isIE = UA && /msie|trident/.test(UA);
569
- var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
570
- var isEdge = UA && UA.indexOf('edge/') > 0;
571
- var isAndroid = UA && UA.indexOf('android') > 0;
572
- var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
573
- var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
574
-
575
- // Firefix has a "watch" function on Object.prototype...
576
- var nativeWatch = ({}).watch;
577
-
578
- var supportsPassive = false;
579
- if (inBrowser) {
580
- try {
581
- var opts = {};
582
- Object.defineProperty(opts, 'passive', ({
583
- get: function get () {
584
- /* istanbul ignore next */
585
- supportsPassive = true;
586
- }
587
- })); // https://github.com/facebook/flow/issues/285
588
- window.addEventListener('test-passive', null, opts);
589
- } catch (e) {}
590
- }
591
-
592
- // this needs to be lazy-evaled because vue may be required before
593
- // vue-server-renderer can set VUE_ENV
594
- var _isServer;
595
- var isServerRendering = function () {
596
- if (_isServer === undefined) {
597
- /* istanbul ignore if */
598
- if (!inBrowser && typeof global !== 'undefined') {
599
- // detect presence of vue-server-renderer and avoid
600
- // Webpack shimming the process
601
- _isServer = global['process'].env.VUE_ENV === 'server';
602
- } else {
603
- _isServer = false;
604
  }
605
- }
606
- return _isServer
607
- };
608
 
609
- // detect devtools
610
- var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
611
 
612
- /* istanbul ignore next */
613
- function isNative (Ctor) {
614
- return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
615
- }
616
 
617
- var hasSymbol =
618
- typeof Symbol !== 'undefined' && isNative(Symbol) &&
619
- typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
 
 
 
 
 
 
 
 
 
 
620
 
621
- /**
622
- * Defer a task to execute it asynchronously.
623
- */
624
- var nextTick = (function () {
625
- var callbacks = [];
626
- var pending = false;
627
- var timerFunc;
628
-
629
- function nextTickHandler () {
630
- pending = false;
631
- var copies = callbacks.slice(0);
632
- callbacks.length = 0;
633
- for (var i = 0; i < copies.length; i++) {
634
- copies[i]();
635
- }
636
- }
637
-
638
- // the nextTick behavior leverages the microtask queue, which can be accessed
639
- // via either native Promise.then or MutationObserver.
640
- // MutationObserver has wider support, however it is seriously bugged in
641
- // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
642
- // completely stops working after triggering a few times... so, if native
643
- // Promise is available, we will use it:
644
- /* istanbul ignore if */
645
- if (typeof Promise !== 'undefined' && isNative(Promise)) {
646
- var p = Promise.resolve();
647
- var logError = function (err) { console.error(err); };
648
- timerFunc = function () {
649
- p.then(nextTickHandler).catch(logError);
650
- // in problematic UIWebViews, Promise.then doesn't completely break, but
651
- // it can get stuck in a weird state where callbacks are pushed into the
652
- // microtask queue but the queue isn't being flushed, until the browser
653
- // needs to do some other work, e.g. handle a timer. Therefore we can
654
- // "force" the microtask queue to be flushed by adding an empty timer.
655
- if (isIOS) { setTimeout(noop); }
656
- };
657
- } else if (typeof MutationObserver !== 'undefined' && (
658
- isNative(MutationObserver) ||
659
- // PhantomJS and iOS 7.x
660
- MutationObserver.toString() === '[object MutationObserverConstructor]'
661
- )) {
662
- // use MutationObserver where native Promise is not available,
663
- // e.g. PhantomJS IE11, iOS7, Android 4.4
664
- var counter = 1;
665
- var observer = new MutationObserver(nextTickHandler);
666
- var textNode = document.createTextNode(String(counter));
667
- observer.observe(textNode, {
668
- characterData: true
669
- });
670
- timerFunc = function () {
671
- counter = (counter + 1) % 2;
672
- textNode.data = String(counter);
673
- };
674
- } else {
675
- // fallback to setTimeout
676
- /* istanbul ignore next */
677
- timerFunc = function () {
678
- setTimeout(nextTickHandler, 0);
679
- };
680
- }
681
 
682
- return function queueNextTick (cb, ctx) {
683
- var _resolve;
684
- callbacks.push(function () {
685
- if (cb) {
686
  try {
687
- cb.call(ctx);
688
- } catch (e) {
689
- handleError(e, ctx, 'nextTick');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
690
  }
691
- } else if (_resolve) {
692
- _resolve(ctx);
693
- }
694
- });
695
- if (!pending) {
696
- pending = true;
697
- timerFunc();
698
- }
699
- if (!cb && typeof Promise !== 'undefined') {
700
- return new Promise(function (resolve, reject) {
701
- _resolve = resolve;
702
- })
703
- }
704
- }
705
- })();
706
-
707
- var _Set;
708
- /* istanbul ignore if */
709
- if (typeof Set !== 'undefined' && isNative(Set)) {
710
- //