LearnPress – WordPress LMS Plugin - Version 4.0.1

Version Description

~ Fixed: upgrade LP error if mysql version < 5.7 - "Specified key was too long". ~ Fixed: minor bugs.

Download this release

Release Info

Developer ThimPress
Plugin Icon 128x128 LearnPress – WordPress LMS Plugin
Version 4.0.1
Comparing to
See all releases

Code changes from version 4.0.0 to 4.0.1

Files changed (34) hide show
  1. assets/js/dist/admin/editor/course.min.js +1 -1
  2. assets/js/dist/admin/editor/question.min.js +1 -1
  3. assets/js/dist/admin/editor/quiz.min.js +1 -1
  4. assets/js/dist/admin/pages/search-lp-addons-themes.js +152 -0
  5. assets/js/dist/admin/pages/search-lp-addons-themes.min.js +1 -0
  6. assets/js/dist/admin/pages/setup.js +255 -0
  7. assets/js/dist/admin/pages/setup.min.js +1 -0
  8. assets/js/dist/admin/pages/statistic.js +385 -0
  9. assets/js/dist/admin/pages/statistic.min.js +1 -0
  10. assets/js/dist/admin/pages/sync-data.js +355 -0
  11. assets/js/dist/admin/pages/sync-data.min.js +1 -0
  12. assets/js/dist/admin/pages/tools.js +71 -71
  13. assets/js/dist/admin/pages/tools.min.js +1 -1
  14. assets/js/dist/frontend/single-course.js +14 -16
  15. assets/js/dist/frontend/single-course.min.js +1 -1
  16. assets/js/dist/frontend/single-curriculum.js +14 -16
  17. assets/js/dist/frontend/single-curriculum.min.js +1 -1
  18. assets/js/dist/utils.min.js +1 -1
  19. assets/src/apps/js/admin/pages/tools/database/upgrade.js +10 -13
  20. assets/src/apps/js/frontend/show-lp-overlay-complete-item.js +1 -1
  21. assets/src/apps/js/utils/handle-ajax-api.js +21 -0
  22. assets/src/apps/js/utils/lp-modal-overlay.js +52 -0
  23. inc/databases/class-lp-db.php +72 -30
  24. inc/gateways/class-lp-gateway-abstract.php +2 -2
  25. inc/handle-steps/class-lp-handle-steps.php +3 -1
  26. inc/handle-steps/class-lp-handle-upgrade-db-steps.php +18 -4
  27. inc/lp-core-functions.php +66 -0
  28. inc/updates/learnpress-upgrade-4.php +164 -86
  29. inc/user/abstract-lp-user.php +1 -14
  30. learnpress.php +3 -1
  31. readme.txt +510 -505
  32. templates/single-course/buttons/purchase.php +6 -1
  33. templates/single-course/content-protected.php +2 -2
  34. templates/single-course/item-comments.php +1 -1
assets/js/dist/admin/editor/course.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=7)}([function(t,e,n){"use strict";function i(t){var e=window.jQuery||jQuery,n=Vue.http;t=e.extend({ns:"LPRequest",store:!1},t||{});var i=null;LP.Request=function(o){return i=e("#publishing-action"),o.id=t.store.getters.id,o.nonce=t.store.getters.nonce,o["lp-ajax"]=t.store.getters.action,o.code=t.store.getters.code,i.find("#publish").addClass("disabled"),i.find(".spinner").addClass("is-active"),i.addClass("code-"+o.code),n.post(t.store.getters.urlAjax,o,{emulateJSON:!0,params:{namespace:t.ns,code:o.code}})},n.interceptors.push((function(e,n){e.params.namespace===t.ns?(t.store.dispatch("newRequest"),n((function(n){jQuery.isPlainObject(n.body)||(n.body=LP.parseJSON(n.body)),n.body.success||!1?t.store.dispatch("requestCompleted","successful"):t.store.dispatch("requestCompleted","failed"),i.removeClass("code-"+e.params.code),i.attr("class")||(i.find("#publish").removeClass("disabled"),i.find(".spinner").removeClass("is-active"))}))):n()}))}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";var i=window.jQuery||jQuery;e.a=function(t){return{namespaced:!0,state:i.extend({},t),getters:{all:function(t){return t}}}}},,,,,,function(t,e,n){"use strict";n.r(e);var i=n(0),o={status:function(t){return t.status},pagination:function(t){return t.pagination},items:function(t,e){return t.items.map((function(t){var n=e.addedItems.find((function(e){return t.id===e.id}));return t.added=!!n,t}))},addedItems:function(t){return t.addedItems},isOpen:function(t){return t.open},types:function(t){return t.types},section:function(t){return t.sectionId}},s={TOGGLE:function(t){t.open=!t.open},SET_SECTION:function(t,e){t.sectionId=e},SET_LIST_ITEMS:function(t,e){t.items=e},ADD_ITEM:function(t,e){t.addedItems.push(e)},REMOVE_ADDED_ITEM:function(t,e){t.addedItems.forEach((function(n,i){n.id===e.id&&t.addedItems.splice(i,1)}))},RESET:function(t){t.addedItems=[],t.items=[]},UPDATE_PAGINATION:function(t,e){t.pagination=e},SEARCH_ITEMS_REQUEST:function(t){t.status="loading"},SEARCH_ITEMS_SUCCESS:function(t){t.status="successful"},SEARCH_ITEMS_FAILURE:function(t){t.status="failed"}},c={toggle:function(t){t.commit("TOGGLE")},open:function(t,e){t.commit("SET_SECTION",e),t.commit("RESET"),t.commit("TOGGLE")},searchItems:function(t,e){t.commit("SEARCH_ITEMS_REQUEST"),LP.Request({type:"search-items",query:e.query,item_type:e.type,page:e.page,exclude:JSON.stringify([])}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("SET_LIST_ITEMS",i.items),t.commit("UPDATE_PAGINATION",i.pagination),t.commit("SEARCH_ITEMS_SUCCESS")}}),(function(e){t.commit("SEARCH_ITEMS_FAILURE"),console.error(e)}))},addItem:function(t,e){t.commit("ADD_ITEM",e)},removeItem:function(t,e){t.commit("REMOVE_ADDED_ITEM",e)},addItemsToSection:function(t){var e=t.getters.addedItems;e.length>0&&LP.Request({type:"add-items-to-section",section_id:t.getters.section,items:JSON.stringify(e)}).then((function(e){var n=e.body;if(n.success){t.commit("TOGGLE");var i=n.data;t.commit("ss/UPDATE_SECTION_ITEMS",{section_id:t.getters.section,items:i},{root:!0})}}),(function(t){console.error(t)}))}},u=window.jQuery||jQuery,r=function(t){var e=u.extend({},t.chooseItems);return e.sectionId=!1,e.pagination="",e.status="",{namespaced:!0,state:e,getters:o,mutations:s,actions:c}},d=window.jQuery||jQuery,a={toggleAllSections:function(t){t.getters.isHiddenAllSections?t.commit("OPEN_ALL_SECTIONS"):t.commit("CLOSE_ALL_SECTIONS"),LP.Request({type:"hidden-sections",hidden:t.getters.hiddenSections})},updateSectionsOrder:function(t,e){LP.Request({type:"sort-sections",order:JSON.stringify(e)}).then((function(e){var n=e.body.data;t.commit("SORT_SECTION",n)}),(function(t){console.error(t)}))},toggleSection:function(t,e){e.open?t.commit("CLOSE_SECTION",e):t.commit("OPEN_SECTION",e),LP.Request({type:"hidden-sections",hidden:t.getters.hiddenSections})},updateSection:function(t,e){t.commit("UPDATE_SECTION_REQUEST",e.id),LP.Request({type:"update-section",section:JSON.stringify(e)}).then((function(){t.commit("UPDATE_SECTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_SECTION_FAILURE",e.id)}))},removeSection:function(t,e){t.commit("REMOVE_SECTION",e.index),LP.Request({type:"remove-section",section_id:e.section.id}).then((function(t){t.body}),(function(t){console.error(t)}))},newSection:function(t,e){var n={type:"new-section",section_name:e,temp_id:LP.uniqueId()};t.commit("ADD_NEW_SECTION",{id:n.temp_id,items:[],open:!1,title:n.section_name}),LP.Request(n).then((function(e){var n=e.body;if(n.success){var i=d.extend({},n.data,{open:!0});t.commit("ADD_NEW_SECTION",i)}}),(function(t){console.error(t)}))},updateSectionItem:function(t,e){t.commit("UPDATE_SECTION_ITEM_REQUEST",e.item.id),LP.Request({type:"update-section-item",section_id:e.section_id,item:JSON.stringify(e.item)}).then((function(n){t.commit("UPDATE_SECTION_ITEM_SUCCESS",e.item.id);var i=n.body;if(i.success){var o=i.data;t.commit("UPDATE_SECTION_ITEM",{section_id:e.section_id,item:o})}}),(function(n){t.commit("UPDATE_SECTION_ITEM_FAILURE",e.item.id),console.error(n)}))},removeSectionItem:function(t,e){var n=e.item.id;t.commit("REMOVE_SECTION_ITEM",e),e.item.temp_id=0,LP.Request({type:"remove-section-item",section_id:e.section_id,item_id:n}).then((function(){t.commit("REMOVE_SECTION_ITEM",e)}))},deleteSectionItem:function(t,e){var n=e.item.id;t.commit("REMOVE_SECTION_ITEM",e),e.item.temp_id=0,LP.Request({type:"delete-section-item",section_id:e.section_id,item_id:n}).then((function(){t.commit("REMOVE_SECTION_ITEM",e)}))},newSectionItem:function(t,e){t.commit("APPEND_EMPTY_ITEM_TO_SECTION",e),LP.Request({type:"new-section-item",section_id:e.section_id,item:JSON.stringify(e.item)}).then((function(n){var i=n.body;if(i.success){var o={};d.each(i.data,(function(t,e){o[e.old_id?e.old_id:e.id]=e})),t.commit("UPDATE_ITEM_SECTION_BY_ID",{section_id:e.section_id,items:o})}}),(function(t){console.error(t)}))},updateSectionItems:function(t,e){var n=t.state;LP.Request({type:"update-section-items",section_id:e.section_id,items:JSON.stringify(e.items),last_section:n.sections[n.sections.length-1]===e.section_id}).then((function(t){t.body.success}),(function(t){console.error(t)}))}},E={SORT_SECTION:function(t,e){t.sections=t.sections.map((function(t){return t.order=e[t.id],t}))},SET_SECTIONS:function(t,e){t.sections=e},ADD_NEW_SECTION:function(t,e){var n;void 0===e.open&&(e.open=!0),e.temp_id&&t.sections.map((function(t,i){if(e.temp_id==t.id)return n=i,!1})),void 0!==n?$Vue.set(t.sections,n,e):t.sections.push(e)},ADD_EMPTY_SECTION:function(t,e){e.open=!0,t.sections.push(e)},REMOVE_SECTION:function(t,e){t.sections.splice(e,1)},REMOVE_SECTION_ITEM:function(t,e){var n=t.sections.find((function(t){return t.id===e.section_id})).items||[],i=e.item,o=-1;n.forEach((function(t,e){t.id===i.id&&(o=e)})),-1!==o&&(i.temp_id?n[o].id=i.temp_id:n.splice(o,1))},UPDATE_SECTION_ITEMS:function(t,e){var n=t.sections.find((function(t){return parseInt(t.id)===parseInt(e.section_id)}));n&&(n.items=e.items)},UPDATE_SECTION_ITEM:function(t,e){},CLOSE_SECTION:function(t,e){t.sections.forEach((function(n,i){e.id===n.id&&(t.sections[i].open=!1)}))},OPEN_SECTION:function(t,e){t.sections.forEach((function(n,i){e.id===n.id&&(t.sections[i].open=!0)}))},OPEN_ALL_SECTIONS:function(t){t.sections=t.sections.map((function(t){return t.open=!0,t}))},CLOSE_ALL_SECTIONS:function(t){t.sections=t.sections.map((function(t){return t.open=!1,t}))},UPDATE_SECTION_REQUEST:function(t,e){$Vue.set(t.statusUpdateSection,e,"updating")},UPDATE_SECTION_SUCCESS:function(t,e){$Vue.set(t.statusUpdateSection,e,"successful")},UPDATE_SECTION_FAILURE:function(t,e){$Vue.set(t.statusUpdateSection,e,"failed")},UPDATE_SECTION_ITEM_REQUEST:function(t,e){$Vue.set(t.statusUpdateSectionItem,e,"updating")},UPDATE_SECTION_ITEM_SUCCESS:function(t,e){$Vue.set(t.statusUpdateSectionItem,e,"successful")},UPDATE_SECTION_ITEM_FAILURE:function(t,e){$Vue.set(t.statusUpdateSectionItem,e,"failed")},APPEND_EMPTY_ITEM_TO_SECTION:function(t,e){var n=t.sections.find((function(t){return parseInt(t.id)===parseInt(e.section_id)}));n&&n.items.push({id:e.item.id,title:e.item.title,type:"empty-item"})},UPDATE_ITEM_SECTION_BY_ID:function(t,e){var n=t.sections.find((function(t){return parseInt(t.id)===parseInt(e.section_id)}));if(n)for(var i=0;i<n.items.length;i++)try{if(!n.items[i])continue;var o=n.items[i].id;o&&e.items[o]&&$Vue.set(n.items,i,e.items[o])}catch(t){console.log(t)}}},m={sections:function(t){return t.sections||[]},urlEdit:function(t){return t.urlEdit},hiddenSections:function(t){return t.sections.filter((function(t){return!t.open})).map((function(t){return parseInt(t.id)}))},isHiddenAllSections:function(t,e){var n=e.sections;return e.hiddenSections.length===n.length},statusUpdateSection:function(t){return t.statusUpdateSection},statusUpdateSectionItem:function(t){return t.statusUpdateSectionItem}},f=window.jQuery,_=function(t){var e=f.extend({},t.sections);return e.statusUpdateSection={},e.statusUpdateSectionItem={},e.sections=e.sections.map((function(t){var n=e.hidden_sections.find((function(e){return parseInt(t.id)===parseInt(e)}));return t.open=!n,t})),{namespaced:!0,state:e,getters:m,mutations:E,actions:a}},S=n(1),T={heartbeat:function(t){return t.heartbeat},action:function(t){return t.action},id:function(t){return t.course_id},autoDraft:function(t){return t.auto_draft},disable_curriculum:function(t){return t.disable_curriculum},status:function(t){return t.status||"error"},currentRequest:function(t){return t.countCurrentRequest||0},urlAjax:function(t){return t.ajax},nonce:function(t){return t.nonce}},p={UPDATE_HEART_BEAT:function(t,e){t.heartbeat=!!e},UPDATE_AUTO_DRAFT_STATUS:function(t,e){t.auto_draft=e},UPDATE_STATUS:function(t,e){t.status=e},INCREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest++},DECREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest--}},I={heartbeat:function(t){LP.Request({type:"heartbeat"}).then((function(e){var n=e.body;t.commit("UPDATE_HEART_BEAT",!!n.success)}),(function(e){t.commit("UPDATE_HEART_BEAT",!1)}))},draftCourse:function(t,e){t.getters.autoDraft&&LP.Request({type:"draft-course",course:JSON.stringify(e)}).then((function(e){e.body.success&&t.commit("UPDATE_AUTO_DRAFT_STATUS",!1)}))},newRequest:function(t){t.commit("INCREASE_NUMBER_REQUEST"),t.commit("UPDATE_STATUS","loading"),window.onbeforeunload=function(){return""}},requestCompleted:function(t,e){t.commit("DECREASE_NUMBER_REQUEST"),0===t.getters.currentRequest&&(t.commit("UPDATE_STATUS",e),window.onbeforeunload=null)}},l=window.jQuery,O=function(t){var e=l.extend({},t.root);return e.status="success",e.heartbeat=!0,e.countCurrentRequest=0,{state:e,getters:T,mutations:p,actions:I,modules:{ci:r(t),i18n:Object(S.a)(t.i18n),ss:_(t)}}};window.$Vue=window.$Vue||Vue,window.$Vuex=window.$Vuex||Vuex,(0,window.jQuery)(document).ready((function(){window.LP_Curriculum_Store=new $Vuex.Store(O(lpAdminCourseEditorSettings)),Object(i.a)({ns:"LPCurriculumRequest",store:LP_Curriculum_Store}),setTimeout((function(){window.LP_Course_Editor=new $Vue({el:"#admin-editor-lp_course",template:"<lp-course-editor></lp-course-editor>"})}),100)}))}]);
1
+ !function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}({0:function(t,e,n){"use strict";function i(t){var e=window.jQuery||jQuery,n=Vue.http;t=e.extend({ns:"LPRequest",store:!1},t||{});var i=null;LP.Request=function(o){return i=e("#publishing-action"),o.id=t.store.getters.id,o.nonce=t.store.getters.nonce,o["lp-ajax"]=t.store.getters.action,o.code=t.store.getters.code,i.find("#publish").addClass("disabled"),i.find(".spinner").addClass("is-active"),i.addClass("code-"+o.code),n.post(t.store.getters.urlAjax,o,{emulateJSON:!0,params:{namespace:t.ns,code:o.code}})},n.interceptors.push((function(e,n){e.params.namespace===t.ns?(t.store.dispatch("newRequest"),n((function(n){jQuery.isPlainObject(n.body)||(n.body=LP.parseJSON(n.body)),n.body.success||!1?t.store.dispatch("requestCompleted","successful"):t.store.dispatch("requestCompleted","failed"),i.removeClass("code-"+e.params.code),i.attr("class")||(i.find("#publish").removeClass("disabled"),i.find(".spinner").removeClass("is-active"))}))):n()}))}n.d(e,"a",(function(){return i}))},1:function(t,e,n){"use strict";var i=window.jQuery||jQuery;e.a=function(t){return{namespaced:!0,state:i.extend({},t),getters:{all:function(t){return t}}}}},11:function(t,e,n){"use strict";n.r(e);var i=n(0),o={status:function(t){return t.status},pagination:function(t){return t.pagination},items:function(t,e){return t.items.map((function(t){var n=e.addedItems.find((function(e){return t.id===e.id}));return t.added=!!n,t}))},addedItems:function(t){return t.addedItems},isOpen:function(t){return t.open},types:function(t){return t.types},section:function(t){return t.sectionId}},s={TOGGLE:function(t){t.open=!t.open},SET_SECTION:function(t,e){t.sectionId=e},SET_LIST_ITEMS:function(t,e){t.items=e},ADD_ITEM:function(t,e){t.addedItems.push(e)},REMOVE_ADDED_ITEM:function(t,e){t.addedItems.forEach((function(n,i){n.id===e.id&&t.addedItems.splice(i,1)}))},RESET:function(t){t.addedItems=[],t.items=[]},UPDATE_PAGINATION:function(t,e){t.pagination=e},SEARCH_ITEMS_REQUEST:function(t){t.status="loading"},SEARCH_ITEMS_SUCCESS:function(t){t.status="successful"},SEARCH_ITEMS_FAILURE:function(t){t.status="failed"}},c={toggle:function(t){t.commit("TOGGLE")},open:function(t,e){t.commit("SET_SECTION",e),t.commit("RESET"),t.commit("TOGGLE")},searchItems:function(t,e){t.commit("SEARCH_ITEMS_REQUEST"),LP.Request({type:"search-items",query:e.query,item_type:e.type,page:e.page,exclude:JSON.stringify([])}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("SET_LIST_ITEMS",i.items),t.commit("UPDATE_PAGINATION",i.pagination),t.commit("SEARCH_ITEMS_SUCCESS")}}),(function(e){t.commit("SEARCH_ITEMS_FAILURE"),console.error(e)}))},addItem:function(t,e){t.commit("ADD_ITEM",e)},removeItem:function(t,e){t.commit("REMOVE_ADDED_ITEM",e)},addItemsToSection:function(t){var e=t.getters.addedItems;e.length>0&&LP.Request({type:"add-items-to-section",section_id:t.getters.section,items:JSON.stringify(e)}).then((function(e){var n=e.body;if(n.success){t.commit("TOGGLE");var i=n.data;t.commit("ss/UPDATE_SECTION_ITEMS",{section_id:t.getters.section,items:i},{root:!0})}}),(function(t){console.error(t)}))}},u=window.jQuery||jQuery,r=function(t){var e=u.extend({},t.chooseItems);return e.sectionId=!1,e.pagination="",e.status="",{namespaced:!0,state:e,getters:o,mutations:s,actions:c}},d=window.jQuery||jQuery,a={toggleAllSections:function(t){t.getters.isHiddenAllSections?t.commit("OPEN_ALL_SECTIONS"):t.commit("CLOSE_ALL_SECTIONS"),LP.Request({type:"hidden-sections",hidden:t.getters.hiddenSections})},updateSectionsOrder:function(t,e){LP.Request({type:"sort-sections",order:JSON.stringify(e)}).then((function(e){var n=e.body.data;t.commit("SORT_SECTION",n)}),(function(t){console.error(t)}))},toggleSection:function(t,e){e.open?t.commit("CLOSE_SECTION",e):t.commit("OPEN_SECTION",e),LP.Request({type:"hidden-sections",hidden:t.getters.hiddenSections})},updateSection:function(t,e){t.commit("UPDATE_SECTION_REQUEST",e.id),LP.Request({type:"update-section",section:JSON.stringify(e)}).then((function(){t.commit("UPDATE_SECTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_SECTION_FAILURE",e.id)}))},removeSection:function(t,e){t.commit("REMOVE_SECTION",e.index),LP.Request({type:"remove-section",section_id:e.section.id}).then((function(t){t.body}),(function(t){console.error(t)}))},newSection:function(t,e){var n={type:"new-section",section_name:e,temp_id:LP.uniqueId()};t.commit("ADD_NEW_SECTION",{id:n.temp_id,items:[],open:!1,title:n.section_name}),LP.Request(n).then((function(e){var n=e.body;if(n.success){var i=d.extend({},n.data,{open:!0});t.commit("ADD_NEW_SECTION",i)}}),(function(t){console.error(t)}))},updateSectionItem:function(t,e){t.commit("UPDATE_SECTION_ITEM_REQUEST",e.item.id),LP.Request({type:"update-section-item",section_id:e.section_id,item:JSON.stringify(e.item)}).then((function(n){t.commit("UPDATE_SECTION_ITEM_SUCCESS",e.item.id);var i=n.body;if(i.success){var o=i.data;t.commit("UPDATE_SECTION_ITEM",{section_id:e.section_id,item:o})}}),(function(n){t.commit("UPDATE_SECTION_ITEM_FAILURE",e.item.id),console.error(n)}))},removeSectionItem:function(t,e){var n=e.item.id;t.commit("REMOVE_SECTION_ITEM",e),e.item.temp_id=0,LP.Request({type:"remove-section-item",section_id:e.section_id,item_id:n}).then((function(){t.commit("REMOVE_SECTION_ITEM",e)}))},deleteSectionItem:function(t,e){var n=e.item.id;t.commit("REMOVE_SECTION_ITEM",e),e.item.temp_id=0,LP.Request({type:"delete-section-item",section_id:e.section_id,item_id:n}).then((function(){t.commit("REMOVE_SECTION_ITEM",e)}))},newSectionItem:function(t,e){t.commit("APPEND_EMPTY_ITEM_TO_SECTION",e),LP.Request({type:"new-section-item",section_id:e.section_id,item:JSON.stringify(e.item)}).then((function(n){var i=n.body;if(i.success){var o={};d.each(i.data,(function(t,e){o[e.old_id?e.old_id:e.id]=e})),t.commit("UPDATE_ITEM_SECTION_BY_ID",{section_id:e.section_id,items:o})}}),(function(t){console.error(t)}))},updateSectionItems:function(t,e){var n=t.state;LP.Request({type:"update-section-items",section_id:e.section_id,items:JSON.stringify(e.items),last_section:n.sections[n.sections.length-1]===e.section_id}).then((function(t){t.body.success}),(function(t){console.error(t)}))}},E={SORT_SECTION:function(t,e){t.sections=t.sections.map((function(t){return t.order=e[t.id],t}))},SET_SECTIONS:function(t,e){t.sections=e},ADD_NEW_SECTION:function(t,e){var n;void 0===e.open&&(e.open=!0),e.temp_id&&t.sections.map((function(t,i){if(e.temp_id==t.id)return n=i,!1})),void 0!==n?$Vue.set(t.sections,n,e):t.sections.push(e)},ADD_EMPTY_SECTION:function(t,e){e.open=!0,t.sections.push(e)},REMOVE_SECTION:function(t,e){t.sections.splice(e,1)},REMOVE_SECTION_ITEM:function(t,e){var n=t.sections.find((function(t){return t.id===e.section_id})).items||[],i=e.item,o=-1;n.forEach((function(t,e){t.id===i.id&&(o=e)})),-1!==o&&(i.temp_id?n[o].id=i.temp_id:n.splice(o,1))},UPDATE_SECTION_ITEMS:function(t,e){var n=t.sections.find((function(t){return parseInt(t.id)===parseInt(e.section_id)}));n&&(n.items=e.items)},UPDATE_SECTION_ITEM:function(t,e){},CLOSE_SECTION:function(t,e){t.sections.forEach((function(n,i){e.id===n.id&&(t.sections[i].open=!1)}))},OPEN_SECTION:function(t,e){t.sections.forEach((function(n,i){e.id===n.id&&(t.sections[i].open=!0)}))},OPEN_ALL_SECTIONS:function(t){t.sections=t.sections.map((function(t){return t.open=!0,t}))},CLOSE_ALL_SECTIONS:function(t){t.sections=t.sections.map((function(t){return t.open=!1,t}))},UPDATE_SECTION_REQUEST:function(t,e){$Vue.set(t.statusUpdateSection,e,"updating")},UPDATE_SECTION_SUCCESS:function(t,e){$Vue.set(t.statusUpdateSection,e,"successful")},UPDATE_SECTION_FAILURE:function(t,e){$Vue.set(t.statusUpdateSection,e,"failed")},UPDATE_SECTION_ITEM_REQUEST:function(t,e){$Vue.set(t.statusUpdateSectionItem,e,"updating")},UPDATE_SECTION_ITEM_SUCCESS:function(t,e){$Vue.set(t.statusUpdateSectionItem,e,"successful")},UPDATE_SECTION_ITEM_FAILURE:function(t,e){$Vue.set(t.statusUpdateSectionItem,e,"failed")},APPEND_EMPTY_ITEM_TO_SECTION:function(t,e){var n=t.sections.find((function(t){return parseInt(t.id)===parseInt(e.section_id)}));n&&n.items.push({id:e.item.id,title:e.item.title,type:"empty-item"})},UPDATE_ITEM_SECTION_BY_ID:function(t,e){var n=t.sections.find((function(t){return parseInt(t.id)===parseInt(e.section_id)}));if(n)for(var i=0;i<n.items.length;i++)try{if(!n.items[i])continue;var o=n.items[i].id;o&&e.items[o]&&$Vue.set(n.items,i,e.items[o])}catch(t){console.log(t)}}},m={sections:function(t){return t.sections||[]},urlEdit:function(t){return t.urlEdit},hiddenSections:function(t){return t.sections.filter((function(t){return!t.open})).map((function(t){return parseInt(t.id)}))},isHiddenAllSections:function(t,e){var n=e.sections;return e.hiddenSections.length===n.length},statusUpdateSection:function(t){return t.statusUpdateSection},statusUpdateSectionItem:function(t){return t.statusUpdateSectionItem}},f=window.jQuery,_=function(t){var e=f.extend({},t.sections);return e.statusUpdateSection={},e.statusUpdateSectionItem={},e.sections=e.sections.map((function(t){var n=e.hidden_sections.find((function(e){return parseInt(t.id)===parseInt(e)}));return t.open=!n,t})),{namespaced:!0,state:e,getters:m,mutations:E,actions:a}},S=n(1),T={heartbeat:function(t){return t.heartbeat},action:function(t){return t.action},id:function(t){return t.course_id},autoDraft:function(t){return t.auto_draft},disable_curriculum:function(t){return t.disable_curriculum},status:function(t){return t.status||"error"},currentRequest:function(t){return t.countCurrentRequest||0},urlAjax:function(t){return t.ajax},nonce:function(t){return t.nonce}},p={UPDATE_HEART_BEAT:function(t,e){t.heartbeat=!!e},UPDATE_AUTO_DRAFT_STATUS:function(t,e){t.auto_draft=e},UPDATE_STATUS:function(t,e){t.status=e},INCREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest++},DECREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest--}},I={heartbeat:function(t){LP.Request({type:"heartbeat"}).then((function(e){var n=e.body;t.commit("UPDATE_HEART_BEAT",!!n.success)}),(function(e){t.commit("UPDATE_HEART_BEAT",!1)}))},draftCourse:function(t,e){t.getters.autoDraft&&LP.Request({type:"draft-course",course:JSON.stringify(e)}).then((function(e){e.body.success&&t.commit("UPDATE_AUTO_DRAFT_STATUS",!1)}))},newRequest:function(t){t.commit("INCREASE_NUMBER_REQUEST"),t.commit("UPDATE_STATUS","loading"),window.onbeforeunload=function(){return""}},requestCompleted:function(t,e){t.commit("DECREASE_NUMBER_REQUEST"),0===t.getters.currentRequest&&(t.commit("UPDATE_STATUS",e),window.onbeforeunload=null)}},l=window.jQuery,O=function(t){var e=l.extend({},t.root);return e.status="success",e.heartbeat=!0,e.countCurrentRequest=0,{state:e,getters:T,mutations:p,actions:I,modules:{ci:r(t),i18n:Object(S.a)(t.i18n),ss:_(t)}}};window.$Vue=window.$Vue||Vue,window.$Vuex=window.$Vuex||Vuex,(0,window.jQuery)(document).ready((function(){window.LP_Curriculum_Store=new $Vuex.Store(O(lpAdminCourseEditorSettings)),Object(i.a)({ns:"LPCurriculumRequest",store:LP_Curriculum_Store}),setTimeout((function(){window.LP_Course_Editor=new $Vue({el:"#admin-editor-lp_course",template:"<lp-course-editor></lp-course-editor>"})}),100)}))}});
assets/js/dist/admin/editor/question.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10)}({0:function(e,t,n){"use strict";function o(e){var t=window.jQuery||jQuery,n=Vue.http;e=t.extend({ns:"LPRequest",store:!1},e||{});var o=null;LP.Request=function(r){return o=t("#publishing-action"),r.id=e.store.getters.id,r.nonce=e.store.getters.nonce,r["lp-ajax"]=e.store.getters.action,r.code=e.store.getters.code,o.find("#publish").addClass("disabled"),o.find(".spinner").addClass("is-active"),o.addClass("code-"+r.code),n.post(e.store.getters.urlAjax,r,{emulateJSON:!0,params:{namespace:e.ns,code:r.code}})},n.interceptors.push((function(t,n){t.params.namespace===e.ns?(e.store.dispatch("newRequest"),n((function(n){jQuery.isPlainObject(n.body)||(n.body=LP.parseJSON(n.body)),n.body.success||!1?e.store.dispatch("requestCompleted","successful"):e.store.dispatch("requestCompleted","failed"),o.removeClass("code-"+t.params.code),o.attr("class")||(o.find("#publish").removeClass("disabled"),o.find(".spinner").removeClass("is-active"))}))):n()}))}n.d(t,"a",(function(){return o}))},10:function(e,t,n){"use strict";n.r(t);var o=n(0),r={id:function(e){return e.id},type:function(e){return e.type},code:function(e){return Date.now()},autoDraft:function(e){return e.auto_draft},answers:function(e){return Object.values(e.answers)||[]},settings:function(e){return e.setting},types:function(e){return e.questionTypes||[]},numberCorrect:function(e){var t=0;return Object.keys(e.answers).forEach((function(n){"yes"===e.answers[n].is_true&&(t+=1)})),t},status:function(e){return e.status},currentRequest:function(e){return e.countCurrentRequest||0},action:function(e){return e.action},nonce:function(e){return e.nonce},externalComponent:function(e){return e.externalComponent||[]},supportAnswerOptions:function(e){return e.supportAnswerOptions||[]},state:function(e){return e},i18n:function(e){return e.i18n}},u={UPDATE_STATUS:function(e,t){e.status=t},UPDATE_AUTO_DRAFT_STATUS:function(e,t){e.auto_draft=t},CHANGE_QUESTION_TYPE:function(e,t){e.answers=t.answers,e.type=t.type},SET_ANSWERS:function(e,t){e.answers=t},DELETE_ANSWER:function(e,t){for(var n=0,o=e.answers.length;n<o;n++)if(e.answers[n].question_answer_id==t){e.answers[n].question_answer_id=LP.uniqueId();break}},ADD_NEW_ANSWER:function(e,t){e.answers.push(t)},UPDATE_ANSWERS:function(e,t){e.answers=t},INCREASE_NUMBER_REQUEST:function(e){e.countCurrentRequest++},DECREASE_NUMBER_REQUEST:function(e){e.countCurrentRequest--}},i={changeQuestionType:function(e,t){LP.Request({type:"change-question-type",question_type:t.type,draft_question:e.getters.autoDraft?JSON.stringify(t.question):""}).then((function(t){var n=t.body;n.success&&(e.commit("UPDATE_AUTO_DRAFT_STATUS",!1),e.commit("CHANGE_QUESTION_TYPE",n.data))}))},updateAnswersOrder:function(e,t){LP.Request({type:"sort-answer",order:t}).then((function(e){e.body.success}))},updateAnswerTitle:function(e,t){void 0!==t.question_answer_id&&(t=JSON.stringify(t),LP.Request({type:"update-answer-title",answer:t}))},updateCorrectAnswer:function(e,t){LP.Request({type:"change-correct",correct:JSON.stringify(t)}).then((function(t){var n=t.body;n.success&&(e.commit("UPDATE_ANSWERS",n.data),e.commit("UPDATE_AUTO_DRAFT_STATUS",!1))}))},deleteAnswer:function(e,t){e.commit("DELETE_ANSWER",t.id),LP.Request({type:"delete-answer",answer_id:t.id}).then((function(t){var n=t.body;n.success&&e.commit("SET_ANSWERS",n.data)}))},newAnswer:function(e,t){e.commit("ADD_NEW_ANSWER",t.answer),LP.Request({type:"new-answer"}).then((function(t){var n=t.body;n.success&&e.commit("UPDATE_ANSWERS",n.data)}))},newRequest:function(e){e.commit("INCREASE_NUMBER_REQUEST"),e.commit("UPDATE_STATUS","loading"),window.onbeforeunload=function(){return""}},requestCompleted:function(e,t){e.commit("DECREASE_NUMBER_REQUEST"),0===e.getters.currentRequest&&(e.commit("UPDATE_STATUS",t),window.onbeforeunload=null)}},s=window.jQuery||jQuery,c=function(e){return{state:s.extend({status:"successful",countCurrentRequest:0,i18n:s.extend({},e.i18n)},e.root),getters:r,mutations:u,actions:i}};n(2);window.$Vue=window.$Vue||Vue,window.$Vuex=window.$Vuex||Vuex;var a=window.jQuery;a(document).ready((function(){window.LP_Question_Store=new $Vuex.Store(c(lp_question_editor)),Object(o.a)({ns:"LPQuestionEditorRequest",store:LP_Question_Store}),setTimeout((function(){a("#admin-editor-lp_question").length&&(window.LP_Question_Editor=new $Vue({el:"#admin-editor-lp_question",template:"<lp-question-editor></lp-question-editor>"}))}),100)}))},2:function(e,t){var n;n=jQuery,window.FIB={getSelectedText:function(){var e="";if(void 0!==window.getSelection){var t=window.getSelection();if(t.rangeCount){for(var n=document.createElement("div"),o=0,r=t.rangeCount;o<r;++o)n.appendChild(t.getRangeAt(o).cloneContents());e=n.innerHTML}}else void 0!==document.selection&&"Text"===document.selection.type&&(e=document.selection.createRange().htmlText);return e},createTextNode:function(e){return document.createTextNode(e)},isContainHtml:function(e){var t=n(e),o="b.fib-blank";return t.is(o)||t.find(o).length||t.parent().is(o)},getSelectionRange:function(){var e="";return window.getSelection?e=window.getSelection():document.getSelection?e=document.getSelection():document.selection&&(e=document.selection.createRange().text),e},outerHTML:function(e){return n("<div>").append(n(e).clone()).html()},doUpgrade:function(e){n.ajax({url:"",data:{"lp-ajax":"fib-upgrade"},success:function(t){console.log(t),e&&e.call(t)}})}},n(document).ready((function(){n("#do-upgrade-fib").on("click",(function(){var e=n(this).prop("disabled",!0).addClass("ajaxloading");FIB.doUpgrade((function(){e.prop("disabled",!1).removeClass("ajaxloading")}))}))}))}});
1
+ !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}({0:function(e,t,n){"use strict";function o(e){var t=window.jQuery||jQuery,n=Vue.http;e=t.extend({ns:"LPRequest",store:!1},e||{});var o=null;LP.Request=function(r){return o=t("#publishing-action"),r.id=e.store.getters.id,r.nonce=e.store.getters.nonce,r["lp-ajax"]=e.store.getters.action,r.code=e.store.getters.code,o.find("#publish").addClass("disabled"),o.find(".spinner").addClass("is-active"),o.addClass("code-"+r.code),n.post(e.store.getters.urlAjax,r,{emulateJSON:!0,params:{namespace:e.ns,code:r.code}})},n.interceptors.push((function(t,n){t.params.namespace===e.ns?(e.store.dispatch("newRequest"),n((function(n){jQuery.isPlainObject(n.body)||(n.body=LP.parseJSON(n.body)),n.body.success||!1?e.store.dispatch("requestCompleted","successful"):e.store.dispatch("requestCompleted","failed"),o.removeClass("code-"+t.params.code),o.attr("class")||(o.find("#publish").removeClass("disabled"),o.find(".spinner").removeClass("is-active"))}))):n()}))}n.d(t,"a",(function(){return o}))},14:function(e,t,n){"use strict";n.r(t);var o=n(0),r={id:function(e){return e.id},type:function(e){return e.type},code:function(e){return Date.now()},autoDraft:function(e){return e.auto_draft},answers:function(e){return Object.values(e.answers)||[]},settings:function(e){return e.setting},types:function(e){return e.questionTypes||[]},numberCorrect:function(e){var t=0;return Object.keys(e.answers).forEach((function(n){"yes"===e.answers[n].is_true&&(t+=1)})),t},status:function(e){return e.status},currentRequest:function(e){return e.countCurrentRequest||0},action:function(e){return e.action},nonce:function(e){return e.nonce},externalComponent:function(e){return e.externalComponent||[]},supportAnswerOptions:function(e){return e.supportAnswerOptions||[]},state:function(e){return e},i18n:function(e){return e.i18n}},u={UPDATE_STATUS:function(e,t){e.status=t},UPDATE_AUTO_DRAFT_STATUS:function(e,t){e.auto_draft=t},CHANGE_QUESTION_TYPE:function(e,t){e.answers=t.answers,e.type=t.type},SET_ANSWERS:function(e,t){e.answers=t},DELETE_ANSWER:function(e,t){for(var n=0,o=e.answers.length;n<o;n++)if(e.answers[n].question_answer_id==t){e.answers[n].question_answer_id=LP.uniqueId();break}},ADD_NEW_ANSWER:function(e,t){e.answers.push(t)},UPDATE_ANSWERS:function(e,t){e.answers=t},INCREASE_NUMBER_REQUEST:function(e){e.countCurrentRequest++},DECREASE_NUMBER_REQUEST:function(e){e.countCurrentRequest--}},i={changeQuestionType:function(e,t){LP.Request({type:"change-question-type",question_type:t.type,draft_question:e.getters.autoDraft?JSON.stringify(t.question):""}).then((function(t){var n=t.body;n.success&&(e.commit("UPDATE_AUTO_DRAFT_STATUS",!1),e.commit("CHANGE_QUESTION_TYPE",n.data))}))},updateAnswersOrder:function(e,t){LP.Request({type:"sort-answer",order:t}).then((function(e){e.body.success}))},updateAnswerTitle:function(e,t){void 0!==t.question_answer_id&&(t=JSON.stringify(t),LP.Request({type:"update-answer-title",answer:t}))},updateCorrectAnswer:function(e,t){LP.Request({type:"change-correct",correct:JSON.stringify(t)}).then((function(t){var n=t.body;n.success&&(e.commit("UPDATE_ANSWERS",n.data),e.commit("UPDATE_AUTO_DRAFT_STATUS",!1))}))},deleteAnswer:function(e,t){e.commit("DELETE_ANSWER",t.id),LP.Request({type:"delete-answer",answer_id:t.id}).then((function(t){var n=t.body;n.success&&e.commit("SET_ANSWERS",n.data)}))},newAnswer:function(e,t){e.commit("ADD_NEW_ANSWER",t.answer),LP.Request({type:"new-answer"}).then((function(t){var n=t.body;n.success&&e.commit("UPDATE_ANSWERS",n.data)}))},newRequest:function(e){e.commit("INCREASE_NUMBER_REQUEST"),e.commit("UPDATE_STATUS","loading"),window.onbeforeunload=function(){return""}},requestCompleted:function(e,t){e.commit("DECREASE_NUMBER_REQUEST"),0===e.getters.currentRequest&&(e.commit("UPDATE_STATUS",t),window.onbeforeunload=null)}},s=window.jQuery||jQuery,c=function(e){return{state:s.extend({status:"successful",countCurrentRequest:0,i18n:s.extend({},e.i18n)},e.root),getters:r,mutations:u,actions:i}};n(2);window.$Vue=window.$Vue||Vue,window.$Vuex=window.$Vuex||Vuex;var a=window.jQuery;a(document).ready((function(){window.LP_Question_Store=new $Vuex.Store(c(lp_question_editor)),Object(o.a)({ns:"LPQuestionEditorRequest",store:LP_Question_Store}),setTimeout((function(){a("#admin-editor-lp_question").length&&(window.LP_Question_Editor=new $Vue({el:"#admin-editor-lp_question",template:"<lp-question-editor></lp-question-editor>"}))}),100)}))},2:function(e,t){var n;n=jQuery,window.FIB={getSelectedText:function(){var e="";if(void 0!==window.getSelection){var t=window.getSelection();if(t.rangeCount){for(var n=document.createElement("div"),o=0,r=t.rangeCount;o<r;++o)n.appendChild(t.getRangeAt(o).cloneContents());e=n.innerHTML}}else void 0!==document.selection&&"Text"===document.selection.type&&(e=document.selection.createRange().htmlText);return e},createTextNode:function(e){return document.createTextNode(e)},isContainHtml:function(e){var t=n(e),o="b.fib-blank";return t.is(o)||t.find(o).length||t.parent().is(o)},getSelectionRange:function(){var e="";return window.getSelection?e=window.getSelection():document.getSelection?e=document.getSelection():document.selection&&(e=document.selection.createRange().text),e},outerHTML:function(e){return n("<div>").append(n(e).clone()).html()},doUpgrade:function(e){n.ajax({url:"",data:{"lp-ajax":"fib-upgrade"},success:function(t){console.log(t),e&&e.call(t)}})}},n(document).ready((function(){n("#do-upgrade-fib").on("click",(function(){var e=n(this).prop("disabled",!0).addClass("ajaxloading");FIB.doUpgrade((function(){e.prop("disabled",!1).removeClass("ajaxloading")}))}))}))}});
assets/js/dist/admin/editor/quiz.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=8)}([function(t,e,n){"use strict";function i(t){var e=window.jQuery||jQuery,n=Vue.http;t=e.extend({ns:"LPRequest",store:!1},t||{});var i=null;LP.Request=function(o){return i=e("#publishing-action"),o.id=t.store.getters.id,o.nonce=t.store.getters.nonce,o["lp-ajax"]=t.store.getters.action,o.code=t.store.getters.code,i.find("#publish").addClass("disabled"),i.find(".spinner").addClass("is-active"),i.addClass("code-"+o.code),n.post(t.store.getters.urlAjax,o,{emulateJSON:!0,params:{namespace:t.ns,code:o.code}})},n.interceptors.push((function(e,n){e.params.namespace===t.ns?(t.store.dispatch("newRequest"),n((function(n){jQuery.isPlainObject(n.body)||(n.body=LP.parseJSON(n.body)),n.body.success||!1?t.store.dispatch("requestCompleted","successful"):t.store.dispatch("requestCompleted","failed"),i.removeClass("code-"+e.params.code),i.attr("class")||(i.find("#publish").removeClass("disabled"),i.find(".spinner").removeClass("is-active"))}))):n()}))}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";var i=window.jQuery||jQuery;e.a=function(t){return{namespaced:!0,state:i.extend({},t),getters:{all:function(t){return t}}}}},function(t,e){var n;n=jQuery,window.FIB={getSelectedText:function(){var t="";if(void 0!==window.getSelection){var e=window.getSelection();if(e.rangeCount){for(var n=document.createElement("div"),i=0,o=e.rangeCount;i<o;++i)n.appendChild(e.getRangeAt(i).cloneContents());t=n.innerHTML}}else void 0!==document.selection&&"Text"===document.selection.type&&(t=document.selection.createRange().htmlText);return t},createTextNode:function(t){return document.createTextNode(t)},isContainHtml:function(t){var e=n(t),i="b.fib-blank";return e.is(i)||e.find(i).length||e.parent().is(i)},getSelectionRange:function(){var t="";return window.getSelection?t=window.getSelection():document.getSelection?t=document.getSelection():document.selection&&(t=document.selection.createRange().text),t},outerHTML:function(t){return n("<div>").append(n(t).clone()).html()},doUpgrade:function(t){n.ajax({url:"",data:{"lp-ajax":"fib-upgrade"},success:function(e){console.log(e),t&&t.call(e)}})}},n(document).ready((function(){n("#do-upgrade-fib").on("click",(function(){var t=n(this).prop("disabled",!0).addClass("ajaxloading");FIB.doUpgrade((function(){t.prop("disabled",!1).removeClass("ajaxloading")}))}))}))},,,,,,function(t,e,n){"use strict";n.r(e);var i={heartbeat:function(t){return t.heartbeat},questionTypes:function(t){return t.types},defaultNewQuestionType:function(t){return t.default_new},action:function(t){return t.action},id:function(t){return t.quiz_id},status:function(t){return t.status||"error"},currentRequest:function(t){return t.countCurrentRequest||0},nonce:function(t){return t.nonce}},o={UPDATE_HEART_BEAT:function(t,e){t.heartbeat=!!e},UPDATE_STATUS:function(t,e){t.status=e},UPDATE_NEW_QUESTION_TYPE:function(t,e){t.default_new=e},INCREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest++},DECREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest--}},s={heartbeat:function(t){LP.Request({type:"heartbeat"}).then((function(e){var n=e.body;t.commit("UPDATE_HEART_BEAT",!!n.success)}),(function(e){t.commit("UPDATE_HEART_BEAT",!1)}))},newRequest:function(t){t.commit("INCREASE_NUMBER_REQUEST"),t.commit("UPDATE_STATUS","loading"),window.onbeforeunload=function(){return""}},requestCompleted:function(t,e){t.commit("DECREASE_NUMBER_REQUEST"),0===t.getters.currentRequest&&(t.commit("UPDATE_STATUS",e),window.onbeforeunload=null)}},u={status:function(t){return t.status},pagination:function(t){return t.pagination},items:function(t,e){return t.items.map((function(t){var n=e.addedItems.find((function(e){return t.id===e.id}));return t.added=!!n,t}))},code:function(t){return Date.now()},addedItems:function(t){return t.addedItems},isOpen:function(t){return t.open},quiz:function(t){return t.quizId}},r={TOGGLE:function(t){t.open=!t.open},SET_QUIZ:function(t,e){t.quizId=e},SET_LIST_ITEMS:function(t,e){t.items=e},ADD_ITEM:function(t,e){t.addedItems.push(e)},REMOVE_ADDED_ITEM:function(t,e){t.addedItems.forEach((function(n,i){n.id===e.id&&t.addedItems.splice(i,1)}))},RESET:function(t){t.addedItems=[],t.items=[]},UPDATE_PAGINATION:function(t,e){t.pagination=e},SEARCH_ITEM_REQUEST:function(t){t.status="loading"},SEARCH_ITEM_SUCCESS:function(t){t.status="successful"},SEARCH_ITEM_FAIL:function(t){t.status="fail"}},c={toggle:function(t){t.commit("TOGGLE")},open:function(t,e){t.commit("SET_QUIZ",e),t.commit("RESET"),t.commit("TOGGLE")},searchItems:function(t,e){t.commit("SEARCH_ITEM_REQUEST"),LP.Request({type:"search-items",query:e.query,page:e.page,exclude:JSON.stringify([])}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("SET_LIST_ITEMS",i.items),t.commit("UPDATE_PAGINATION",i.pagination),t.commit("SEARCH_ITEM_SUCCESS")}}),(function(e){t.commit("SEARCH_ITEMS_FAIL"),console.log(e)}))},addItem:function(t,e){t.commit("ADD_ITEM",e)},removeItem:function(t,e){t.commit("REMOVE_ADDED_ITEM",e)},addQuestionsToQuiz:function(t,e){var n=t.getters.addedItems;n.length>0&&LP.Request({type:"add-questions-to-quiz",items:JSON.stringify(n),draft_quiz:JSON.stringify(e)}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("lqs/SET_QUESTIONS",i,{root:!0}),t.commit("TOGGLE")}}),(function(t){console.log(t)}))}},d=window.jQuery||jQuery,a=function(t){return{namespaced:!0,state:d.extend({quizId:!1,pagination:"",status:""},t.chooseItems),getters:u,mutations:r,actions:c}},E=n(1),_={listQuestions:function(t){return t.questions||[]},questionsOrder:function(t){return t.order||[]},externalComponent:function(t){return t.externalComponent||[]},supportAnswerOptions:function(t){return t.supportAnswerOptions||[]},hiddenQuestionsSettings:function(t){return t.hidden_questions_settings||[]},hiddenQuestions:function(t){return t.questions.filter((function(t){return!t.open})).map((function(t){return parseInt(t.id)}))},isHiddenListQuestions:function(t,e){var n=e.listQuestions,i=e.hiddenQuestions;return n.length===i.length},disableUpdateList:function(t){return t.disableUpdateList},statusUpdateQuestions:function(t){return t.statusUpdateQuestions},statusUpdateQuestionItem:function(t){return t.statusUpdateQuestionItem},statusUpdateQuestionAnswer:function(t){return t.statusUpdateQuestionAnswer}},f=window.jQuery,m={SORT_QUESTIONS:function(t,e){t.questions=t.questions.map((function(t){return t.order=e[t.id],t}))},SORT_QUESTION_ANSWERS:function(t,e){t.questions=t.questions.map((function(t){return t.answers.answer_order=e[t.answers.question_answer_id],t}))},ADD_QUESTION_ANSWER:function(t,e){t.questions=t.questions.map((function(t){if(t.id===e.question_id){var n=!1;if(e.answer.temp_id)for(var i=0,o=t.answers.length;i<o;i++)t.answers[i].question_answer_id==e.answer.temp_id&&(n=!0,$Vue.set(t.answers,i,e.answer));return!n&&t.answers.push(e.answer),t}return t}))},CHANGE_QUESTION_CORRECT_ANSWERS:function(t,e){t.questions=t.questions.map((function(t){return parseInt(t.id)===e.id&&(t.answers=e.answers),t}))},SET_QUESTIONS:function(t,e){t.questions=e},ADD_NEW_QUESTION:function(t,e){var n=!1;if(e.temp_id)for(var i=0,o=t.questions.length;i<o;i++)if(t.questions[i].id===e.temp_id){$Vue.set(t.questions,i,e),n=!0;break}if(!n){var s=f(".lp-list-questions .main > div:last-child");if(s.length){var u=s.offset().top;f("html,body").animate({scrollTop:u})}t.questions.push(e)}},CHANGE_QUESTION_TYPE:function(t,e){t.questions=t.questions.map((function(t){return parseInt(t.id)===e.id&&(t.answers=e.answers,t.type=e.type,t.open=!0),t}))},REMOVE_QUESTION:function(t,e){var n=t.questions.indexOf(e);e.temp_id?t.questions[n].id=e.temp_id:t.questions.splice(n,1)},DELETE_QUESTION_ANSWER:function(t,e){var n=e.question_id,i=e.answer_id;t.questions=t.questions.map((function(t){if(t.id===n){var e=t.answers;e.forEach((function(t){if(t.question_answer_id===i){var n=e.indexOf(t);e.splice(n,1)}}))}return t}))},REMOVE_QUESTIONS:function(){},CLOSE_QUESTION:function(t,e){t.questions.forEach((function(n,i){e.id===n.id&&(t.questions[i].open=!1)}))},OPEN_QUESTION:function(t,e){t.questions.forEach((function(n,i){e.id===n.id&&(t.questions[i].open=!0)}))},CLOSE_LIST_QUESTIONS:function(t){t.questions=t.questions.map((function(t){return t.open=!1,t}))},OPEN_LIST_QUESTIONS:function(t){t.questions=t.questions.map((function(t){return t.open=!0,t}))},UPDATE_QUESTION_REQUEST:function(t,e){$Vue.set(t.statusUpdateQuestionItem,e,"updating")},UPDATE_QUESTION_SUCCESS:function(t,e){$Vue.set(t.statusUpdateQuestionItem,e,"successful")},UPDATE_QUESTION_FAILURE:function(t,e){$Vue.set(t.statusUpdateQuestionItem,e,"failed")},UPDATE_QUESTION_ANSWER_REQUEST:function(t,e){$Vue.set(t.statusUpdateQuestionAnswer,e,"updating")},UPDATE_QUESTION_ANSWER_SUCCESS:function(t,e){$Vue.set(t.statusUpdateQuestionAnswer,e,"successful")},UPDATE_QUESTION_ANSWER_FAIL:function(t,e){$Vue.set(t.statusUpdateQuestionAnswer,e,"failed")},DELETE_ANSWER:function(t,e){t.questions.map((function(t,n){if(t.id==e.question_id){for(var i=0,o=t.answers.length;i<o;i++)if(t.answers[i].question_answer_id==e.answer_id){t.answers[i].question_answer_id=e.temp_id;break}return!1}}))}},S=window.jQuery,T={toggleAll:function(t){t.getters.isHiddenListQuestions?t.commit("OPEN_LIST_QUESTIONS"):t.commit("CLOSE_LIST_QUESTIONS"),LP.Request({type:"hidden-questions",hidden:t.getters.hiddenQuestions})},updateQuizQuestionsHidden:function(t,e){LP.Request(S.extend({},e,{type:"update-quiz-questions-hidden"}))},newQuestion:function(t,e){var n=JSON.parse(JSON.stringify(e.question));n.settings={},t.commit("ADD_NEW_QUESTION",n),LP.Request({type:"new-question",question:JSON.stringify(e.question),draft_quiz:JSON.stringify(e.quiz)}).then((function(n){var i=n.body;i.success&&(t.commit("UPDATE_NEW_QUESTION_TYPE",e.question.type,{root:!0}),t.commit("ADD_NEW_QUESTION",i.data),t.commit("CLOSE_LIST_QUESTIONS"),t.commit("OPEN_QUESTION",i.data))}),(function(t){console.log(t)}))},updateQuestionsOrder:function(t,e){LP.Request({type:"sort-questions",order:JSON.stringify(e)}).then((function(n){t.commit("SORT_QUESTIONS",e)}),(function(t){console.log(t)}))},updateQuestionTitle:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.id),LP.Request({type:"update-question-title",question:JSON.stringify(e)}).then((function(){t.commit("UPDATE_QUESTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.id)}))},changeQuestionType:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"change-question-type",question_id:e.question_id,question_type:e.type}).then((function(n){var i=n.body;if(i.success){var o=i.data;t.commit("CHANGE_QUESTION_TYPE",o),t.commit("UPDATE_NEW_QUESTION_TYPE",o.type.key,{root:!0}),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id)}})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.question_id)}))},isHiddenQuestionsSettings:function(t,e){},cloneQuestion:function(t,e){LP.Request({type:"clone-question",question:JSON.stringify(e)}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("ADD_NEW_QUESTION",n.data),t.commit("UPDATE_NEW_QUESTION_TYPE",i.type.key,{root:!0})}}),(function(t){console.log(t)}))},removeQuestion:function(t,e){var n=e.id;e.temp_id=LP.uniqueId(),t.commit("REMOVE_QUESTION",e),LP.Request({type:"remove-question",question_id:n}).then((function(n){n.body.success&&(e.id=e.temp_id,e.temp_id=0,t.commit("REMOVE_QUESTION",e))}),(function(t){console.error(t)}))},deleteQuestion:function(t,e){var n=e.id;e.temp_id=LP.uniqueId(),t.commit("REMOVE_QUESTION",e),LP.Request({type:"delete-question",question_id:n}).then((function(){e.id=e.temp_id,e.temp_id=0,t.commit("REMOVE_QUESTION",e),t.commit("UPDATE_QUESTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.id)}))},toggleQuestion:function(t,e){e.open?t.commit("CLOSE_QUESTION",e):t.commit("OPEN_QUESTION",e),LP.Request({type:"hidden-questions",hidden:t.getters.hiddenQuestions})},updateQuestionAnswersOrder:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"sort-question-answers",question_id:e.question_id,order:JSON.stringify(e.order)}).then((function(n){var i=n.body.data;t.commit("SORT_QUESTION_ANSWERS",i),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id)}),(function(n){t.commit("UPDATE_QUESTION_FAILURE",e.question_id),console.log(n)}))},updateQuestionAnswerTitle:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"update-question-answer-title",question_id:parseInt(e.question_id),answer:JSON.stringify(e.answer)}).then((function(){t.commit("UPDATE_QUESTION_ANSWER_SUCCESS",parseInt(e.question_id)),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id)})).catch((function(){t.commit("UPDATE_QUESTION_ANSWER_FAILURE",parseInt(e.question_id)),t.commit("UPDATE_QUESTION_FAILURE",e.question_id)}))},updateQuestionCorrectAnswer:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"change-question-correct-answer",question_id:e.question_id,correct:JSON.stringify(e.correct)}).then((function(n){var i=n.body;i.success&&(t.commit("CHANGE_QUESTION_CORRECT_ANSWERS",i.data),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id))}),(function(n){t.commit("UPDATE_QUESTION_FAILURE",e.question_id),console.log(n)}))},deleteQuestionAnswer:function(t,e){e.temp_id=LP.uniqueId(),t.commit("DELETE_ANSWER",e),t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"delete-question-answer",question_id:e.question_id,answer_id:e.answer_id}).then((function(n){n.body.success&&(t.commit("DELETE_QUESTION_ANSWER",{question_id:e.question_id,answer_id:e.temp_id}),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id))}),(function(n){t.commit("UPDATE_QUESTION_FAILURE",e.question_id),console.log(n)}))},newQuestionAnswer:function(t,e){var n=LP.uniqueId(),i=e.question_id;t.commit("UPDATE_QUESTION_REQUEST",i),t.commit("ADD_QUESTION_ANSWER",{question_id:i,answer:{text:LP_Quiz_Store.getters["i18n/all"].new_option,question_answer_id:n}}),LP.Request({type:"new-question-answer",question_id:i,question_answer_id:n}).then((function(n){var o=n.body;if(o.success){var s=o.data;t.commit("ADD_QUESTION_ANSWER",{question_id:i,answer:s}),t.commit("UPDATE_QUESTION_SUCCESS",i),e.success&&setTimeout((function(){e.success.apply(e.context,[s])}),300)}}),(function(e){t.commit("UPDATE_QUESTION_FAILURE",i),console.error(e)}))},updateQuestionContent:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.id),LP.Request({type:"update-question-content",question:JSON.stringify(e)}).then((function(){t.commit("UPDATE_QUESTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.id)}))},updateQuestionMeta:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question.id),LP.Request({type:"update-question-meta",question:JSON.stringify(e.question),meta_key:e.meta_key}).then((function(){t.commit("UPDATE_QUESTION_SUCCESS",e.question.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.question.id)}))}},p=window.jQuery||jQuery,U=function(t){var e=t.listQuestions;return{namespaced:!0,state:p.extend({statusUpdateQuestions:{},statusUpdateQuestionItem:{},statusUpdateQuestionAnswer:{},questions:e.questions.map((function(t){var n=e.hidden_questions.find((function(e){return parseInt(t.id)===parseInt(e)}));return t.open=!n,t}))},e),getters:_,mutations:m,actions:T}},l=window.jQuery||jQuery,q=function(t){return{state:l.extend({status:"success",heartbeat:!0,countCurrentRequest:0},t.root),getters:i,mutations:o,actions:s,modules:{cqi:a(t),i18n:Object(E.a)(t.i18n),lqs:U(t)}}},Q=n(0);n(2);window.$Vue=window.$Vue||Vue,window.$Vuex=window.$Vuex||Vuex,window.jQuery(document).ready((function(){window.LP_Quiz_Store=new $Vuex.Store(q(lp_quiz_editor)),Object(Q.a)({ns:"LPListQuizQuestionsRequest",store:LP_Quiz_Store}),setTimeout((function(){window.LP_Quiz_Editor=new $Vue({el:"#admin-editor-lp_quiz",template:"<lp-quiz-editor></lp-quiz-editor>"})}),100)}))}]);
1
+ !function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=12)}({0:function(t,e,n){"use strict";function i(t){var e=window.jQuery||jQuery,n=Vue.http;t=e.extend({ns:"LPRequest",store:!1},t||{});var i=null;LP.Request=function(o){return i=e("#publishing-action"),o.id=t.store.getters.id,o.nonce=t.store.getters.nonce,o["lp-ajax"]=t.store.getters.action,o.code=t.store.getters.code,i.find("#publish").addClass("disabled"),i.find(".spinner").addClass("is-active"),i.addClass("code-"+o.code),n.post(t.store.getters.urlAjax,o,{emulateJSON:!0,params:{namespace:t.ns,code:o.code}})},n.interceptors.push((function(e,n){e.params.namespace===t.ns?(t.store.dispatch("newRequest"),n((function(n){jQuery.isPlainObject(n.body)||(n.body=LP.parseJSON(n.body)),n.body.success||!1?t.store.dispatch("requestCompleted","successful"):t.store.dispatch("requestCompleted","failed"),i.removeClass("code-"+e.params.code),i.attr("class")||(i.find("#publish").removeClass("disabled"),i.find(".spinner").removeClass("is-active"))}))):n()}))}n.d(e,"a",(function(){return i}))},1:function(t,e,n){"use strict";var i=window.jQuery||jQuery;e.a=function(t){return{namespaced:!0,state:i.extend({},t),getters:{all:function(t){return t}}}}},12:function(t,e,n){"use strict";n.r(e);var i={heartbeat:function(t){return t.heartbeat},questionTypes:function(t){return t.types},defaultNewQuestionType:function(t){return t.default_new},action:function(t){return t.action},id:function(t){return t.quiz_id},status:function(t){return t.status||"error"},currentRequest:function(t){return t.countCurrentRequest||0},nonce:function(t){return t.nonce}},o={UPDATE_HEART_BEAT:function(t,e){t.heartbeat=!!e},UPDATE_STATUS:function(t,e){t.status=e},UPDATE_NEW_QUESTION_TYPE:function(t,e){t.default_new=e},INCREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest++},DECREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest--}},s={heartbeat:function(t){LP.Request({type:"heartbeat"}).then((function(e){var n=e.body;t.commit("UPDATE_HEART_BEAT",!!n.success)}),(function(e){t.commit("UPDATE_HEART_BEAT",!1)}))},newRequest:function(t){t.commit("INCREASE_NUMBER_REQUEST"),t.commit("UPDATE_STATUS","loading"),window.onbeforeunload=function(){return""}},requestCompleted:function(t,e){t.commit("DECREASE_NUMBER_REQUEST"),0===t.getters.currentRequest&&(t.commit("UPDATE_STATUS",e),window.onbeforeunload=null)}},u={status:function(t){return t.status},pagination:function(t){return t.pagination},items:function(t,e){return t.items.map((function(t){var n=e.addedItems.find((function(e){return t.id===e.id}));return t.added=!!n,t}))},code:function(t){return Date.now()},addedItems:function(t){return t.addedItems},isOpen:function(t){return t.open},quiz:function(t){return t.quizId}},r={TOGGLE:function(t){t.open=!t.open},SET_QUIZ:function(t,e){t.quizId=e},SET_LIST_ITEMS:function(t,e){t.items=e},ADD_ITEM:function(t,e){t.addedItems.push(e)},REMOVE_ADDED_ITEM:function(t,e){t.addedItems.forEach((function(n,i){n.id===e.id&&t.addedItems.splice(i,1)}))},RESET:function(t){t.addedItems=[],t.items=[]},UPDATE_PAGINATION:function(t,e){t.pagination=e},SEARCH_ITEM_REQUEST:function(t){t.status="loading"},SEARCH_ITEM_SUCCESS:function(t){t.status="successful"},SEARCH_ITEM_FAIL:function(t){t.status="fail"}},c={toggle:function(t){t.commit("TOGGLE")},open:function(t,e){t.commit("SET_QUIZ",e),t.commit("RESET"),t.commit("TOGGLE")},searchItems:function(t,e){t.commit("SEARCH_ITEM_REQUEST"),LP.Request({type:"search-items",query:e.query,page:e.page,exclude:JSON.stringify([])}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("SET_LIST_ITEMS",i.items),t.commit("UPDATE_PAGINATION",i.pagination),t.commit("SEARCH_ITEM_SUCCESS")}}),(function(e){t.commit("SEARCH_ITEMS_FAIL"),console.log(e)}))},addItem:function(t,e){t.commit("ADD_ITEM",e)},removeItem:function(t,e){t.commit("REMOVE_ADDED_ITEM",e)},addQuestionsToQuiz:function(t,e){var n=t.getters.addedItems;n.length>0&&LP.Request({type:"add-questions-to-quiz",items:JSON.stringify(n),draft_quiz:JSON.stringify(e)}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("lqs/SET_QUESTIONS",i,{root:!0}),t.commit("TOGGLE")}}),(function(t){console.log(t)}))}},d=window.jQuery||jQuery,a=function(t){return{namespaced:!0,state:d.extend({quizId:!1,pagination:"",status:""},t.chooseItems),getters:u,mutations:r,actions:c}},E=n(1),_={listQuestions:function(t){return t.questions||[]},questionsOrder:function(t){return t.order||[]},externalComponent:function(t){return t.externalComponent||[]},supportAnswerOptions:function(t){return t.supportAnswerOptions||[]},hiddenQuestionsSettings:function(t){return t.hidden_questions_settings||[]},hiddenQuestions:function(t){return t.questions.filter((function(t){return!t.open})).map((function(t){return parseInt(t.id)}))},isHiddenListQuestions:function(t,e){var n=e.listQuestions,i=e.hiddenQuestions;return n.length===i.length},disableUpdateList:function(t){return t.disableUpdateList},statusUpdateQuestions:function(t){return t.statusUpdateQuestions},statusUpdateQuestionItem:function(t){return t.statusUpdateQuestionItem},statusUpdateQuestionAnswer:function(t){return t.statusUpdateQuestionAnswer}},f=window.jQuery,m={SORT_QUESTIONS:function(t,e){t.questions=t.questions.map((function(t){return t.order=e[t.id],t}))},SORT_QUESTION_ANSWERS:function(t,e){t.questions=t.questions.map((function(t){return t.answers.answer_order=e[t.answers.question_answer_id],t}))},ADD_QUESTION_ANSWER:function(t,e){t.questions=t.questions.map((function(t){if(t.id===e.question_id){var n=!1;if(e.answer.temp_id)for(var i=0,o=t.answers.length;i<o;i++)t.answers[i].question_answer_id==e.answer.temp_id&&(n=!0,$Vue.set(t.answers,i,e.answer));return!n&&t.answers.push(e.answer),t}return t}))},CHANGE_QUESTION_CORRECT_ANSWERS:function(t,e){t.questions=t.questions.map((function(t){return parseInt(t.id)===e.id&&(t.answers=e.answers),t}))},SET_QUESTIONS:function(t,e){t.questions=e},ADD_NEW_QUESTION:function(t,e){var n=!1;if(e.temp_id)for(var i=0,o=t.questions.length;i<o;i++)if(t.questions[i].id===e.temp_id){$Vue.set(t.questions,i,e),n=!0;break}if(!n){var s=f(".lp-list-questions .main > div:last-child");if(s.length){var u=s.offset().top;f("html,body").animate({scrollTop:u})}t.questions.push(e)}},CHANGE_QUESTION_TYPE:function(t,e){t.questions=t.questions.map((function(t){return parseInt(t.id)===e.id&&(t.answers=e.answers,t.type=e.type,t.open=!0),t}))},REMOVE_QUESTION:function(t,e){var n=t.questions.indexOf(e);e.temp_id?t.questions[n].id=e.temp_id:t.questions.splice(n,1)},DELETE_QUESTION_ANSWER:function(t,e){var n=e.question_id,i=e.answer_id;t.questions=t.questions.map((function(t){if(t.id===n){var e=t.answers;e.forEach((function(t){if(t.question_answer_id===i){var n=e.indexOf(t);e.splice(n,1)}}))}return t}))},REMOVE_QUESTIONS:function(){},CLOSE_QUESTION:function(t,e){t.questions.forEach((function(n,i){e.id===n.id&&(t.questions[i].open=!1)}))},OPEN_QUESTION:function(t,e){t.questions.forEach((function(n,i){e.id===n.id&&(t.questions[i].open=!0)}))},CLOSE_LIST_QUESTIONS:function(t){t.questions=t.questions.map((function(t){return t.open=!1,t}))},OPEN_LIST_QUESTIONS:function(t){t.questions=t.questions.map((function(t){return t.open=!0,t}))},UPDATE_QUESTION_REQUEST:function(t,e){$Vue.set(t.statusUpdateQuestionItem,e,"updating")},UPDATE_QUESTION_SUCCESS:function(t,e){$Vue.set(t.statusUpdateQuestionItem,e,"successful")},UPDATE_QUESTION_FAILURE:function(t,e){$Vue.set(t.statusUpdateQuestionItem,e,"failed")},UPDATE_QUESTION_ANSWER_REQUEST:function(t,e){$Vue.set(t.statusUpdateQuestionAnswer,e,"updating")},UPDATE_QUESTION_ANSWER_SUCCESS:function(t,e){$Vue.set(t.statusUpdateQuestionAnswer,e,"successful")},UPDATE_QUESTION_ANSWER_FAIL:function(t,e){$Vue.set(t.statusUpdateQuestionAnswer,e,"failed")},DELETE_ANSWER:function(t,e){t.questions.map((function(t,n){if(t.id==e.question_id){for(var i=0,o=t.answers.length;i<o;i++)if(t.answers[i].question_answer_id==e.answer_id){t.answers[i].question_answer_id=e.temp_id;break}return!1}}))}},S=window.jQuery,T={toggleAll:function(t){t.getters.isHiddenListQuestions?t.commit("OPEN_LIST_QUESTIONS"):t.commit("CLOSE_LIST_QUESTIONS"),LP.Request({type:"hidden-questions",hidden:t.getters.hiddenQuestions})},updateQuizQuestionsHidden:function(t,e){LP.Request(S.extend({},e,{type:"update-quiz-questions-hidden"}))},newQuestion:function(t,e){var n=JSON.parse(JSON.stringify(e.question));n.settings={},t.commit("ADD_NEW_QUESTION",n),LP.Request({type:"new-question",question:JSON.stringify(e.question),draft_quiz:JSON.stringify(e.quiz)}).then((function(n){var i=n.body;i.success&&(t.commit("UPDATE_NEW_QUESTION_TYPE",e.question.type,{root:!0}),t.commit("ADD_NEW_QUESTION",i.data),t.commit("CLOSE_LIST_QUESTIONS"),t.commit("OPEN_QUESTION",i.data))}),(function(t){console.log(t)}))},updateQuestionsOrder:function(t,e){LP.Request({type:"sort-questions",order:JSON.stringify(e)}).then((function(n){t.commit("SORT_QUESTIONS",e)}),(function(t){console.log(t)}))},updateQuestionTitle:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.id),LP.Request({type:"update-question-title",question:JSON.stringify(e)}).then((function(){t.commit("UPDATE_QUESTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.id)}))},changeQuestionType:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"change-question-type",question_id:e.question_id,question_type:e.type}).then((function(n){var i=n.body;if(i.success){var o=i.data;t.commit("CHANGE_QUESTION_TYPE",o),t.commit("UPDATE_NEW_QUESTION_TYPE",o.type.key,{root:!0}),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id)}})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.question_id)}))},isHiddenQuestionsSettings:function(t,e){},cloneQuestion:function(t,e){LP.Request({type:"clone-question",question:JSON.stringify(e)}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("ADD_NEW_QUESTION",n.data),t.commit("UPDATE_NEW_QUESTION_TYPE",i.type.key,{root:!0})}}),(function(t){console.log(t)}))},removeQuestion:function(t,e){var n=e.id;e.temp_id=LP.uniqueId(),t.commit("REMOVE_QUESTION",e),LP.Request({type:"remove-question",question_id:n}).then((function(n){n.body.success&&(e.id=e.temp_id,e.temp_id=0,t.commit("REMOVE_QUESTION",e))}),(function(t){console.error(t)}))},deleteQuestion:function(t,e){var n=e.id;e.temp_id=LP.uniqueId(),t.commit("REMOVE_QUESTION",e),LP.Request({type:"delete-question",question_id:n}).then((function(){e.id=e.temp_id,e.temp_id=0,t.commit("REMOVE_QUESTION",e),t.commit("UPDATE_QUESTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.id)}))},toggleQuestion:function(t,e){e.open?t.commit("CLOSE_QUESTION",e):t.commit("OPEN_QUESTION",e),LP.Request({type:"hidden-questions",hidden:t.getters.hiddenQuestions})},updateQuestionAnswersOrder:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"sort-question-answers",question_id:e.question_id,order:JSON.stringify(e.order)}).then((function(n){var i=n.body.data;t.commit("SORT_QUESTION_ANSWERS",i),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id)}),(function(n){t.commit("UPDATE_QUESTION_FAILURE",e.question_id),console.log(n)}))},updateQuestionAnswerTitle:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"update-question-answer-title",question_id:parseInt(e.question_id),answer:JSON.stringify(e.answer)}).then((function(){t.commit("UPDATE_QUESTION_ANSWER_SUCCESS",parseInt(e.question_id)),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id)})).catch((function(){t.commit("UPDATE_QUESTION_ANSWER_FAILURE",parseInt(e.question_id)),t.commit("UPDATE_QUESTION_FAILURE",e.question_id)}))},updateQuestionCorrectAnswer:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"change-question-correct-answer",question_id:e.question_id,correct:JSON.stringify(e.correct)}).then((function(n){var i=n.body;i.success&&(t.commit("CHANGE_QUESTION_CORRECT_ANSWERS",i.data),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id))}),(function(n){t.commit("UPDATE_QUESTION_FAILURE",e.question_id),console.log(n)}))},deleteQuestionAnswer:function(t,e){e.temp_id=LP.uniqueId(),t.commit("DELETE_ANSWER",e),t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"delete-question-answer",question_id:e.question_id,answer_id:e.answer_id}).then((function(n){n.body.success&&(t.commit("DELETE_QUESTION_ANSWER",{question_id:e.question_id,answer_id:e.temp_id}),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id))}),(function(n){t.commit("UPDATE_QUESTION_FAILURE",e.question_id),console.log(n)}))},newQuestionAnswer:function(t,e){var n=LP.uniqueId(),i=e.question_id;t.commit("UPDATE_QUESTION_REQUEST",i),t.commit("ADD_QUESTION_ANSWER",{question_id:i,answer:{text:LP_Quiz_Store.getters["i18n/all"].new_option,question_answer_id:n}}),LP.Request({type:"new-question-answer",question_id:i,question_answer_id:n}).then((function(n){var o=n.body;if(o.success){var s=o.data;t.commit("ADD_QUESTION_ANSWER",{question_id:i,answer:s}),t.commit("UPDATE_QUESTION_SUCCESS",i),e.success&&setTimeout((function(){e.success.apply(e.context,[s])}),300)}}),(function(e){t.commit("UPDATE_QUESTION_FAILURE",i),console.error(e)}))},updateQuestionContent:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.id),LP.Request({type:"update-question-content",question:JSON.stringify(e)}).then((function(){t.commit("UPDATE_QUESTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.id)}))},updateQuestionMeta:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question.id),LP.Request({type:"update-question-meta",question:JSON.stringify(e.question),meta_key:e.meta_key}).then((function(){t.commit("UPDATE_QUESTION_SUCCESS",e.question.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.question.id)}))}},p=window.jQuery||jQuery,U=function(t){var e=t.listQuestions;return{namespaced:!0,state:p.extend({statusUpdateQuestions:{},statusUpdateQuestionItem:{},statusUpdateQuestionAnswer:{},questions:e.questions.map((function(t){var n=e.hidden_questions.find((function(e){return parseInt(t.id)===parseInt(e)}));return t.open=!n,t}))},e),getters:_,mutations:m,actions:T}},l=window.jQuery||jQuery,q=function(t){return{state:l.extend({status:"success",heartbeat:!0,countCurrentRequest:0},t.root),getters:i,mutations:o,actions:s,modules:{cqi:a(t),i18n:Object(E.a)(t.i18n),lqs:U(t)}}},Q=n(0);n(2);window.$Vue=window.$Vue||Vue,window.$Vuex=window.$Vuex||Vuex,window.jQuery(document).ready((function(){window.LP_Quiz_Store=new $Vuex.Store(q(lp_quiz_editor)),Object(Q.a)({ns:"LPListQuizQuestionsRequest",store:LP_Quiz_Store}),setTimeout((function(){window.LP_Quiz_Editor=new $Vue({el:"#admin-editor-lp_quiz",template:"<lp-quiz-editor></lp-quiz-editor>"})}),100)}))},2:function(t,e){var n;n=jQuery,window.FIB={getSelectedText:function(){var t="";if(void 0!==window.getSelection){var e=window.getSelection();if(e.rangeCount){for(var n=document.createElement("div"),i=0,o=e.rangeCount;i<o;++i)n.appendChild(e.getRangeAt(i).cloneContents());t=n.innerHTML}}else void 0!==document.selection&&"Text"===document.selection.type&&(t=document.selection.createRange().htmlText);return t},createTextNode:function(t){return document.createTextNode(t)},isContainHtml:function(t){var e=n(t),i="b.fib-blank";return e.is(i)||e.find(i).length||e.parent().is(i)},getSelectionRange:function(){var t="";return window.getSelection?t=window.getSelection():document.getSelection?t=document.getSelection():document.selection&&(t=document.selection.createRange().text),t},outerHTML:function(t){return n("<div>").append(n(t).clone()).html()},doUpgrade:function(t){n.ajax({url:"",data:{"lp-ajax":"fib-upgrade"},success:function(e){console.log(e),t&&t.call(e)}})}},n(document).ready((function(){n("#do-upgrade-fib").on("click",(function(){var t=n(this).prop("disabled",!0).addClass("ajaxloading");FIB.doUpgrade((function(){t.prop("disabled",!1).removeClass("ajaxloading")}))}))}))}});
assets/js/dist/admin/pages/search-lp-addons-themes.js ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/search-lp-addons-themes.js");
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ({
88
+
89
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/search-lp-addons-themes.js":
90
+ /*!**********************************************************************************************************************************************************************************!*\
91
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/search-lp-addons-themes.js ***!
92
+ \**********************************************************************************************************************************************************************************/
93
+ /*! no static exports found */
94
+ /***/ (function(module, exports) {
95
+
96
+ (function ($) {
97
+ var timer = null,
98
+ $wraps = null,
99
+ $cloneWraps = null;
100
+
101
+ var onSearch = function onSearch(keyword) {
102
+ if (!$cloneWraps) {
103
+ $cloneWraps = $wraps.clone();
104
+ }
105
+
106
+ var keywords = keyword.toLowerCase().split(/\s+/).filter(function (a, b) {
107
+ return a.length >= 3;
108
+ });
109
+
110
+ var foundItems = function foundItems($w1, $w2) {
111
+ return $w1.find('.plugin-card').each(function () {
112
+ var $item = $(this),
113
+ itemText = $item.find('.item-title').text().toLowerCase(),
114
+ itemDesc = $item.find('.column-description, .theme-description').text();
115
+
116
+ var found = function found() {
117
+ var reg = new RegExp(keywords.join('|'), 'ig');
118
+ return itemText.match(reg) || itemDesc.match(reg);
119
+ };
120
+
121
+ if (keywords.length) {
122
+ if (found()) {
123
+ var $clone = $item.clone();
124
+ $w2.append($clone);
125
+ }
126
+ } else {
127
+ $w2.append($item.clone());
128
+ }
129
+ });
130
+ };
131
+
132
+ $wraps.each(function (i) {
133
+ var $this = $(this).html(''),
134
+ $items = foundItems($cloneWraps.eq(i), $this),
135
+ count = $this.children().length;
136
+ $this.prev('h2').find('span').html(count);
137
+ });
138
+ };
139
+
140
+ $(document).on('keyup', '.lp-search-addon', function (e) {
141
+ timer && clearTimeout(timer);
142
+ timer = setTimeout(onSearch, 300, e.target.value);
143
+ });
144
+ jQuery(function () {
145
+ $wraps = $('.addons-browse');
146
+ });
147
+ })(jQuery);
148
+
149
+ /***/ })
150
+
151
+ /******/ });
152
+ //# sourceMappingURL=search-lp-addons-themes.js.map
assets/js/dist/admin/pages/search-lp-addons-themes.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=9)}({9:function(e,n){var t,r,o,i,u;t=jQuery,r=null,o=null,i=null,u=function(e){i||(i=o.clone());var n=e.toLowerCase().split(/\s+/).filter((function(e,n){return e.length>=3}));o.each((function(e){var r,o,u=t(this).html(""),l=(r=i.eq(e),o=u,r.find(".plugin-card").each((function(){var e,r=t(this),i=r.find(".item-title").text().toLowerCase(),u=r.find(".column-description, .theme-description").text();if(n.length){if(e=new RegExp(n.join("|"),"ig"),i.match(e)||u.match(e)){var l=r.clone();o.append(l)}}else o.append(r.clone())})),u.children().length);u.prev("h2").find("span").html(l)}))},t(document).on("keyup",".lp-search-addon",(function(e){r&&clearTimeout(r),r=setTimeout(u,300,e.target.value)})),jQuery((function(){o=t(".addons-browse")}))}});
assets/js/dist/admin/pages/setup.js ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/setup.js");
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ({
88
+
89
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/setup.js":
90
+ /*!****************************************************************************************************************************************************************!*\
91
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/setup.js ***!
92
+ \****************************************************************************************************************************************************************/
93
+ /*! no static exports found */
94
+ /***/ (function(module, exports) {
95
+
96
+ (function ($) {
97
+ 'use strict';
98
+
99
+ var $main, $setupForm;
100
+
101
+ var checkForm = function checkForm($form) {
102
+ var $emails = $form.find('input[type="email"]');
103
+ var valid = true;
104
+ $emails.each(function () {
105
+ var $this = $(this);
106
+ $this.css('border-color', '');
107
+
108
+ switch ($this.attr('name')) {
109
+ case 'settings[paypal][paypal_email]':
110
+ case 'settings[paypal][paypal_sandbox_email]':
111
+ if (!$this.closest('tr').prev().find('input[type="checkbox"]').is(':checked')) {
112
+ return;
113
+ }
114
+
115
+ break;
116
+ }
117
+
118
+ if (!isEmail(this.value)) {
119
+ valid = false;
120
+ $this.css('border-color', '#FF0000');
121
+ }
122
+ });
123
+ return valid;
124
+ };
125
+
126
+ var blockContent = function blockContent(block) {
127
+ $main.toggleClass('loading', block === undefined ? true : block);
128
+ };
129
+
130
+ var getFormData = function getFormData(more) {
131
+ $setupForm = $('#learn-press-setup-form');
132
+ var data = $setupForm.serializeJSON();
133
+ return $.extend(data, more || {});
134
+ };
135
+
136
+ var replaceMainContent = function replaceMainContent(newContent) {
137
+ var $newContent = $(newContent);
138
+ $main.replaceWith($newContent);
139
+ $main = $newContent;
140
+ };
141
+
142
+ var navPages = function navPages(e) {
143
+ e.preventDefault();
144
+
145
+ if (!checkForm($setupForm)) {
146
+ return;
147
+ }
148
+
149
+ var loadUrl = $(this).attr('href');
150
+ $main.addClass('loading');
151
+ $.post({
152
+ url: loadUrl,
153
+ data: getFormData(),
154
+ success: function success(res) {
155
+ var $html = $(res);
156
+ replaceMainContent($html.contents().filter('#main'));
157
+ LP.setUrl(loadUrl);
158
+ $('.learn-press-dropdown-pages').LP('DropdownPages');
159
+ $('.learn-press-tip').LP('QuickTip');
160
+ $main.removeClass('loading');
161
+ }
162
+ });
163
+ };
164
+
165
+ var updateCurrency = function updateCurrency() {
166
+ var m = $(this).children(':selected').html().match(/\((.*)\)/),
167
+ symbol = m ? m[1] : '';
168
+ $('#currency-pos').children().each(function () {
169
+ var $option = $(this);
170
+ var text = $option.html();
171
+
172
+ switch ($option.val()) {
173
+ case 'left':
174
+ text = text.replace(/\( (.*)69/, '( ' + symbol + '69');
175
+ break;
176
+
177
+ case 'right':
178
+ text = text.replace(/9([^0-9]*) \)/, '9' + symbol + ' )');
179
+ break;
180
+
181
+ case 'left_with_space':
182
+ text = text.replace(/\( (.*) 6/, '( ' + symbol + ' 6');
183
+ break;
184
+
185
+ case 'right_with_space':
186
+ text = text.replace(/9 (.*) \)/, '9 ' + symbol + ' )');
187
+ break;
188
+ }
189
+
190
+ $option.html(text);
191
+ });
192
+ };
193
+
194
+ var updatePrice = function updatePrice() {
195
+ $.post({
196
+ url: '',
197
+ dataType: 'html',
198
+ data: getFormData({
199
+ 'lp-ajax': 'get-price-format'
200
+ }),
201
+ success: function success(res) {
202
+ $('#preview-price').html(res);
203
+ }
204
+ });
205
+ };
206
+
207
+ var createPages = function createPages(e) {
208
+ e.preventDefault();
209
+ blockContent();
210
+ $.post({
211
+ url: $(this).attr('href'),
212
+ dataType: 'html',
213
+ data: getFormData({
214
+ 'lp-ajax': 'setup-create-pages'
215
+ }),
216
+ success: function success(res) {
217
+ replaceMainContent($(res).contents().filter('#main'));
218
+ $('.learn-press-dropdown-pages').LP('DropdownPages');
219
+ blockContent(false);
220
+ }
221
+ });
222
+ };
223
+
224
+ var installSampleCourse = function installSampleCourse(e) {
225
+ e.preventDefault();
226
+ var $button = $(this);
227
+ blockContent();
228
+ $.post({
229
+ url: $(this).attr('href'),
230
+ dataType: 'html',
231
+ data: {},
232
+ success: function success(res) {
233
+ blockContent(false);
234
+ $button.replaceWith($(res).find('a:first').addClass('button button-primary'));
235
+ }
236
+ });
237
+ };
238
+
239
+ function isEmail(email) {
240
+ var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
241
+ return re.test(email);
242
+ }
243
+
244
+ $(function () {
245
+ $main = $('#main');
246
+ $setupForm = $('#learn-press-setup-form');
247
+ $('.learn-press-select2').select2();
248
+ $(document).on('click', '.buttons .button', navPages).on('change', '#currency', updateCurrency).on('change', 'input, select', updatePrice).on('click', '#create-pages', createPages).on('click', '#install-sample-course', installSampleCourse);
249
+ });
250
+ })(jQuery);
251
+
252
+ /***/ })
253
+
254
+ /******/ });
255
+ //# sourceMappingURL=setup.js.map
assets/js/dist/admin/pages/setup.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=6)}({6:function(e,t){!function(e){"use strict";var t,r,n=function(e){t.toggleClass("loading",void 0===e||e)},a=function(t){var n=(r=e("#learn-press-setup-form")).serializeJSON();return e.extend(n,t||{})},s=function(r){var n=e(r);t.replaceWith(n),t=n},c=function(n){if(n.preventDefault(),c=r.find('input[type="email"]'),o=!0,c.each((function(){var t,r=e(this);switch(r.css("border-color",""),r.attr("name")){case"settings[paypal][paypal_email]":case"settings[paypal][paypal_sandbox_email]":if(!r.closest("tr").prev().find('input[type="checkbox"]').is(":checked"))return}t=this.value,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t)||(o=!1,r.css("border-color","#FF0000"))})),o){var c,o,i=e(this).attr("href");t.addClass("loading"),e.post({url:i,data:a(),success:function(r){var n=e(r);s(n.contents().filter("#main")),LP.setUrl(i),e(".learn-press-dropdown-pages").LP("DropdownPages"),e(".learn-press-tip").LP("QuickTip"),t.removeClass("loading")}})}},o=function(){var t=e(this).children(":selected").html().match(/\((.*)\)/),r=t?t[1]:"";e("#currency-pos").children().each((function(){var t=e(this),n=t.html();switch(t.val()){case"left":n=n.replace(/\( (.*)69/,"( "+r+"69");break;case"right":n=n.replace(/9([^0-9]*) \)/,"9"+r+" )");break;case"left_with_space":n=n.replace(/\( (.*) 6/,"( "+r+" 6");break;case"right_with_space":n=n.replace(/9 (.*) \)/,"9 "+r+" )")}t.html(n)}))},i=function(){e.post({url:"",dataType:"html",data:a({"lp-ajax":"get-price-format"}),success:function(t){e("#preview-price").html(t)}})},l=function(t){t.preventDefault(),n(),e.post({url:e(this).attr("href"),dataType:"html",data:a({"lp-ajax":"setup-create-pages"}),success:function(t){s(e(t).contents().filter("#main")),e(".learn-press-dropdown-pages").LP("DropdownPages"),n(!1)}})},u=function(t){t.preventDefault();var r=e(this);n(),e.post({url:e(this).attr("href"),dataType:"html",data:{},success:function(t){n(!1),r.replaceWith(e(t).find("a:first").addClass("button button-primary"))}})};e((function(){t=e("#main"),r=e("#learn-press-setup-form"),e(".learn-press-select2").select2(),e(document).on("click",".buttons .button",c).on("change","#currency",o).on("change","input, select",i).on("click","#create-pages",l).on("click","#install-sample-course",u)}))}(jQuery)}});
assets/js/dist/admin/pages/statistic.js ADDED
@@ -0,0 +1,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/statistic.js");
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ({
88
+
89
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/statistic.js":
90
+ /*!********************************************************************************************************************************************************************!*\
91
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/statistic.js ***!
92
+ \********************************************************************************************************************************************************************/
93
+ /*! no static exports found */
94
+ /***/ (function(module, exports) {
95
+
96
+ (function ($) {
97
+ $.fn.LP_Chart_Line = function (data, config) {
98
+ return $.each(this, function () {
99
+ var $elem = $(this),
100
+ $canvas = $('<canvas />');
101
+ $elem.html('');
102
+ $canvas.appendTo($elem);
103
+ new Chart($canvas.get(0).getContext('2d')).Line(data, config);
104
+ }); //
105
+ };
106
+
107
+ $.fn.LP_Statistic_Users = function () {
108
+ if (parseInt($(this).length) === 0) {
109
+ return;
110
+ }
111
+
112
+ return $.each(this, function () {
113
+ var $buttons = $('.chart-buttons button').on('click', function () {
114
+ var $button = $(this),
115
+ type = $button.data('type');
116
+ var from = '',
117
+ to = '';
118
+ $buttons.not(this).not('[data-type="user-custom-time"]').prop('disabled', false);
119
+
120
+ if (type == 'user-custom-time') {
121
+ from = $('#user-custom-time input[name="from"]').val();
122
+ to = $('#user-custom-time input[name="to"]').val();
123
+
124
+ if (from == '' || to == '') {
125
+ return false;
126
+ }
127
+ } else {
128
+ $button.prop('disabled', true);
129
+ }
130
+
131
+ var $container = $('#learn-press-chart');
132
+ $container.addClass('loading');
133
+ $.ajax({
134
+ url: 'admin-ajax.php',
135
+ data: {
136
+ action: 'learnpress_load_chart',
137
+ type: type,
138
+ range: [from, to]
139
+ },
140
+ dataType: 'text',
141
+ success: function success(response) {
142
+ response = LP.parseJSON(response);
143
+ $container.LP_Chart_Line(response, LP_Chart_Config);
144
+ $container.removeClass('loading');
145
+ }
146
+ });
147
+ return false;
148
+ }),
149
+ $inputs = $('.chart-buttons #user-custom-time input[type="text"]').on('change', function () {
150
+ var _valid_date = function _valid_date() {
151
+ if (new Date($inputs[0].value) < new Date($inputs[1].value)) {
152
+ return true;
153
+ }
154
+ };
155
+
156
+ $buttons.filter('[data-type="user-custom-time"]').prop('disabled', $inputs.filter(function () {
157
+ return this.value == '';
158
+ }).get().length || !_valid_date());
159
+ });
160
+ });
161
+ };
162
+
163
+ $.fn.LP_Statistic_Courses = function () {
164
+ if (parseInt($(this).length) === 0) {
165
+ return;
166
+ }
167
+
168
+ return $.each(this, function () {
169
+ var $buttons = $('.chart-buttons button').on('click', function () {
170
+ var $button = $(this),
171
+ type = $button.data('type'),
172
+ from = '',
173
+ to = '',
174
+ $container = $('#learn-press-chart');
175
+ $buttons.not(this).not('[data-type="course-custom-time"]').prop('disabled', false);
176
+
177
+ if (type == 'course-custom-time') {
178
+ from = $('#course-custom-time input[name="from"]').val();
179
+ to = $('#course-custom-time input[name="to"]').val();
180
+
181
+ if (from == '' || to == '') {
182
+ return false;
183
+ }
184
+ } else {
185
+ $button.prop('disabled', true);
186
+ }
187
+
188
+ $container.addClass('loading');
189
+ $.ajax({
190
+ url: 'admin-ajax.php',
191
+ data: {
192
+ action: 'learnpress_load_chart',
193
+ type: type,
194
+ range: [from, to]
195
+ },
196
+ dataType: 'text',
197
+ success: function success(response) {
198
+ response = LP.parseJSON(response);
199
+ $container.LP_Chart_Line(response, LP_Chart_Config);
200
+ $container.removeClass('loading');
201
+ }
202
+ });
203
+ return false;
204
+ }),
205
+ $inputs = $('.chart-buttons #course-custom-time input[type="text"]').on('change', function () {
206
+ var _valid_date = function _valid_date() {
207
+ if (new Date($inputs[0].value) < new Date($inputs[1].value)) {
208
+ return true;
209
+ }
210
+ };
211
+
212
+ $buttons.filter('[data-type="course-custom-time"]').prop('disabled', $inputs.filter(function () {
213
+ return this.value == '';
214
+ }).get().length || !_valid_date());
215
+ });
216
+ });
217
+ };
218
+
219
+ $.fn.LP_Statistic_Orders = function () {
220
+ if (parseInt($(this).length) === 0) {
221
+ return;
222
+ }
223
+
224
+ $('.panel_report_option').hide();
225
+ $('#panel_report_sales_by_' + $('#report_sales_by').val()).show();
226
+ $('#report_sales_by').on('change', function () {
227
+ $('.panel_report_option').hide();
228
+ $('#panel_report_sales_by_' + $(this).val()).show();
229
+
230
+ if ('date' == $(this).val()) {
231
+ LP_Statistic_Orders_Upgrade_Chart();
232
+ }
233
+ });
234
+ /**
235
+ * Upgrade Chart for Order Statistics
236
+ *
237
+ * @return {boolean}
238
+ */
239
+
240
+ var LP_Statistic_Orders_Upgrade_Chart = function LP_Statistic_Orders_Upgrade_Chart() {
241
+ var type = '',
242
+ from = '',
243
+ to = '',
244
+ report_sales_by = 'date',
245
+ cat_id = 0,
246
+ course_id = 0;
247
+ report_sales_by = $('#report_sales_by').val();
248
+ $container = $('#learn-press-chart');
249
+ $container.addClass('loading'); // get type
250
+
251
+ var $buttons = $('.chart-buttons button:disabled').not('[data-type="order-custom-time"]');
252
+
253
+ if (parseInt($buttons.length) > 0) {
254
+ type = $($buttons[0]).data('type');
255
+ } else {
256
+ type = 'order-custom-time';
257
+ from = $('#order-custom-time input[name="from"]').val();
258
+ to = $('#order-custom-time input[name="to"]').val();
259
+
260
+ if (from == '' || to == '') {
261
+ return false;
262
+ }
263
+ }
264
+
265
+ if ('course' === report_sales_by) {
266
+ course_id = $('#report-by-course-id').val();
267
+ } else if ('category' === report_sales_by) {
268
+ cat_id = $('#report-by-course-category-id').val();
269
+ }
270
+
271
+ $.ajax({
272
+ url: 'admin-ajax.php',
273
+ data: {
274
+ action: 'learnpress_load_chart',
275
+ type: type,
276
+ range: [from, to],
277
+ report_sales_by: report_sales_by,
278
+ course_id: course_id,
279
+ cat_id: cat_id
280
+ },
281
+ dataType: 'text',
282
+ success: function success(response) {
283
+ response = LP.parseJSON(response);
284
+ $container.LP_Chart_Line(response, LP_Chart_Config);
285
+ $container.removeClass('loading');
286
+ }
287
+ });
288
+ };
289
+
290
+ $('#report-by-course-id').select2({
291
+ placeholder: 'Select a course',
292
+ minimumInputLength: 1,
293
+ ajax: {
294
+ url: ajaxurl + '?action=learnpress_search_course',
295
+ dataType: 'json',
296
+ quietMillis: 250,
297
+ data: function data(term, page) {
298
+ return {
299
+ q: term // search term
300
+
301
+ };
302
+ },
303
+ results: function results(data, page) {
304
+ return {
305
+ results: data.items
306
+ };
307
+ },
308
+ cache: true
309
+ }
310
+ });
311
+ $('#report-by-course-id').on('change', function () {
312
+ LP_Statistic_Orders_Upgrade_Chart();
313
+ });
314
+ $('#report-by-course-category-id').select2({
315
+ placeholder: 'Select a course',
316
+ minimumInputLength: 1,
317
+ ajax: {
318
+ url: ajaxurl + '?action=learnpress_search_course_category',
319
+ dataType: 'json',
320
+ quietMillis: 250,
321
+ data: function data(term, page) {
322
+ return {
323
+ q: term // search term
324
+
325
+ };
326
+ },
327
+ results: function results(data, page) {
328
+ return {
329
+ results: data.items
330
+ };
331
+ },
332
+ cache: true
333
+ }
334
+ });
335
+ $('#report-by-course-category-id').on('change', function () {
336
+ LP_Statistic_Orders_Upgrade_Chart();
337
+ });
338
+ var $buttons = $('.chart-buttons button').on('click', function () {
339
+ var $button = $(this),
340
+ type = $button.data('type'),
341
+ from = '',
342
+ to = '',
343
+ $container = $('#learn-press-chart');
344
+ $buttons.not(this).not('[data-type="order-custom-time"]').prop('disabled', false);
345
+
346
+ if (type !== 'order-custom-time') {
347
+ $button.prop('disabled', true);
348
+ $('#order-custom-time input[name="from"]').val('');
349
+ $('#order-custom-time input[name="to"]').val('');
350
+ }
351
+
352
+ LP_Statistic_Orders_Upgrade_Chart();
353
+ return false;
354
+ });
355
+ var $inputs = $('.chart-buttons #order-custom-time input[type="text"]').on('change', function () {
356
+ var _valid_date = function _valid_date() {
357
+ if (new Date($inputs[0].value) < new Date($inputs[1].value)) {
358
+ return true;
359
+ }
360
+ };
361
+
362
+ $buttons.filter('[data-type="order-custom-time"]').prop('disabled', $inputs.filter(function () {
363
+ return this.value == '';
364
+ }).get().length || !_valid_date());
365
+ });
366
+ };
367
+
368
+ $(function () {
369
+ if (typeof $.fn.datepicker != 'undefined') {
370
+ $('.date-picker').datepicker({
371
+ dateFormat: 'yy/mm/dd'
372
+ });
373
+ }
374
+
375
+ $('.learn-press-statistic-users').LP_Statistic_Users();
376
+ $('.learn-press-statistic-courses').LP_Statistic_Courses();
377
+ $('.learn-press-statistic-orders').LP_Statistic_Orders();
378
+ });
379
+ return;
380
+ })(jQuery);
381
+
382
+ /***/ })
383
+
384
+ /******/ });
385
+ //# sourceMappingURL=statistic.js.map
assets/js/dist/admin/pages/statistic.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(t){var e={};function r(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}({7:function(t,e){var r;(r=jQuery).fn.LP_Chart_Line=function(t,e){return r.each(this,(function(){var n=r(this),a=r("<canvas />");n.html(""),a.appendTo(n),new Chart(a.get(0).getContext("2d")).Line(t,e)}))},r.fn.LP_Statistic_Users=function(){if(0!==parseInt(r(this).length))return r.each(this,(function(){var t=r(".chart-buttons button").on("click",(function(){var e=r(this),n=e.data("type"),a="",o="";if(t.not(this).not('[data-type="user-custom-time"]').prop("disabled",!1),"user-custom-time"==n){if(a=r('#user-custom-time input[name="from"]').val(),o=r('#user-custom-time input[name="to"]').val(),""==a||""==o)return!1}else e.prop("disabled",!0);var i=r("#learn-press-chart");return i.addClass("loading"),r.ajax({url:"admin-ajax.php",data:{action:"learnpress_load_chart",type:n,range:[a,o]},dataType:"text",success:function(t){t=LP.parseJSON(t),i.LP_Chart_Line(t,LP_Chart_Config),i.removeClass("loading")}}),!1})),e=r('.chart-buttons #user-custom-time input[type="text"]').on("change",(function(){t.filter('[data-type="user-custom-time"]').prop("disabled",e.filter((function(){return""==this.value})).get().length||!function(){if(new Date(e[0].value)<new Date(e[1].value))return!0}())}))}))},r.fn.LP_Statistic_Courses=function(){if(0!==parseInt(r(this).length))return r.each(this,(function(){var t=r(".chart-buttons button").on("click",(function(){var e=r(this),n=e.data("type"),a="",o="",i=r("#learn-press-chart");if(t.not(this).not('[data-type="course-custom-time"]').prop("disabled",!1),"course-custom-time"==n){if(a=r('#course-custom-time input[name="from"]').val(),o=r('#course-custom-time input[name="to"]').val(),""==a||""==o)return!1}else e.prop("disabled",!0);return i.addClass("loading"),r.ajax({url:"admin-ajax.php",data:{action:"learnpress_load_chart",type:n,range:[a,o]},dataType:"text",success:function(t){t=LP.parseJSON(t),i.LP_Chart_Line(t,LP_Chart_Config),i.removeClass("loading")}}),!1})),e=r('.chart-buttons #course-custom-time input[type="text"]').on("change",(function(){t.filter('[data-type="course-custom-time"]').prop("disabled",e.filter((function(){return""==this.value})).get().length||!function(){if(new Date(e[0].value)<new Date(e[1].value))return!0}())}))}))},r.fn.LP_Statistic_Orders=function(){if(0!==parseInt(r(this).length)){r(".panel_report_option").hide(),r("#panel_report_sales_by_"+r("#report_sales_by").val()).show(),r("#report_sales_by").on("change",(function(){r(".panel_report_option").hide(),r("#panel_report_sales_by_"+r(this).val()).show(),"date"==r(this).val()&&t()}));var t=function(){var t,e="",n="",a="",o=0,i=0;t=r("#report_sales_by").val(),$container=r("#learn-press-chart"),$container.addClass("loading");var s=r(".chart-buttons button:disabled").not('[data-type="order-custom-time"]');if(parseInt(s.length)>0)e=r(s[0]).data("type");else if(e="order-custom-time",n=r('#order-custom-time input[name="from"]').val(),a=r('#order-custom-time input[name="to"]').val(),""==n||""==a)return!1;"course"===t?i=r("#report-by-course-id").val():"category"===t&&(o=r("#report-by-course-category-id").val()),r.ajax({url:"admin-ajax.php",data:{action:"learnpress_load_chart",type:e,range:[n,a],report_sales_by:t,course_id:i,cat_id:o},dataType:"text",success:function(t){t=LP.parseJSON(t),$container.LP_Chart_Line(t,LP_Chart_Config),$container.removeClass("loading")}})};r("#report-by-course-id").select2({placeholder:"Select a course",minimumInputLength:1,ajax:{url:ajaxurl+"?action=learnpress_search_course",dataType:"json",quietMillis:250,data:function(t,e){return{q:t}},results:function(t,e){return{results:t.items}},cache:!0}}),r("#report-by-course-id").on("change",(function(){t()})),r("#report-by-course-category-id").select2({placeholder:"Select a course",minimumInputLength:1,ajax:{url:ajaxurl+"?action=learnpress_search_course_category",dataType:"json",quietMillis:250,data:function(t,e){return{q:t}},results:function(t,e){return{results:t.items}},cache:!0}}),r("#report-by-course-category-id").on("change",(function(){t()}));var e=r(".chart-buttons button").on("click",(function(){var n=r(this),a=n.data("type");return r("#learn-press-chart"),e.not(this).not('[data-type="order-custom-time"]').prop("disabled",!1),"order-custom-time"!==a&&(n.prop("disabled",!0),r('#order-custom-time input[name="from"]').val(""),r('#order-custom-time input[name="to"]').val("")),t(),!1})),n=r('.chart-buttons #order-custom-time input[type="text"]').on("change",(function(){e.filter('[data-type="order-custom-time"]').prop("disabled",n.filter((function(){return""==this.value})).get().length||!function(){if(new Date(n[0].value)<new Date(n[1].value))return!0}())}))}},r((function(){void 0!==r.fn.datepicker&&r(".date-picker").datepicker({dateFormat:"yy/mm/dd"}),r(".learn-press-statistic-users").LP_Statistic_Users(),r(".learn-press-statistic-courses").LP_Statistic_Courses(),r(".learn-press-statistic-orders").LP_Statistic_Orders()}))}});
assets/js/dist/admin/pages/sync-data.js ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/sync-data.js");
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ({
88
+
89
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/sync-data.js":
90
+ /*!********************************************************************************************************************************************************************!*\
91
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/sync-data.js ***!
92
+ \********************************************************************************************************************************************************************/
93
+ /*! no static exports found */
94
+ /***/ (function(module, exports) {
95
+
96
+ (function ($) {
97
+ var Sync_Base = {
98
+ id: 'sync-base',
99
+ syncing: false,
100
+ items: false,
101
+ completed: false,
102
+ callback: null,
103
+ methodGetItems: '',
104
+ itemsKey: '',
105
+ chunkSize: 50,
106
+ sync: function sync(callback) {
107
+ if (this.syncing) {
108
+ return;
109
+ }
110
+
111
+ this.callback = callback;
112
+
113
+ if (this.items === false) {
114
+ this.get_items();
115
+ } else if (!this.dispatch()) {
116
+ this.completed = true;
117
+ this.callToCallback();
118
+ return;
119
+ }
120
+
121
+ this.syncing = true;
122
+ },
123
+ init: function init() {
124
+ this.syncing = false;
125
+ this.items = false;
126
+ this.completed = false;
127
+ },
128
+ is_completed: function is_completed() {
129
+ return this.completed;
130
+ },
131
+ dispatch: function dispatch() {
132
+ var that = this,
133
+ items = this.items ? this.items.splice(0, this.chunkSize) : false;
134
+
135
+ if (!items || items.length === 0) {
136
+ return false;
137
+ }
138
+
139
+ $.ajax({
140
+ url: '',
141
+ data: {
142
+ 'lp-ajax': this.id,
143
+ sync: items
144
+ },
145
+ method: 'post',
146
+ success: function success(response) {
147
+ response = LP.parseJSON(response);
148
+ that.syncing = false;
149
+
150
+ if (response.result !== 'success') {
151
+ that.completed = true;
152
+ }
153
+
154
+ that.callToCallback();
155
+
156
+ if (that.is_completed()) {
157
+ return;
158
+ }
159
+
160
+ that.sync(that.callback);
161
+ }
162
+ });
163
+ return true;
164
+ },
165
+ callToCallback: function callToCallback() {
166
+ this.callback && this.callback.call(this);
167
+ },
168
+ get_items: function get_items() {
169
+ var that = this;
170
+ $.ajax({
171
+ url: '',
172
+ data: {
173
+ 'lp-ajax': this.id,
174
+ sync: this.methodGetItems
175
+ },
176
+ success: function success(response) {
177
+ that.syncing = false;
178
+ response = LP.parseJSON(response);
179
+
180
+ if (response[that.itemsKey]) {
181
+ that.items = response[that.itemsKey];
182
+ that.sync(that.callback);
183
+ } else {
184
+ that.completed = true;
185
+ that.items = [];
186
+ that.callToCallback();
187
+ }
188
+ }
189
+ });
190
+ }
191
+ };
192
+ var Sync_Course_Orders = $.extend({}, Sync_Base, {
193
+ id: 'sync-course-orders',
194
+ methodGetItems: 'get-courses',
195
+ itemsKey: 'courses'
196
+ });
197
+ var Sync_User_Courses = $.extend({}, Sync_Base, {
198
+ id: 'sync-user-courses',
199
+ methodGetItems: 'get-users',
200
+ itemsKey: 'users',
201
+ chunkSize: 500
202
+ });
203
+ var Sync_User_Orders = $.extend({}, Sync_Base, {
204
+ id: 'sync-user-orders',
205
+ methodGetItems: 'get-users',
206
+ itemsKey: 'users',
207
+ chunkSize: 500
208
+ });
209
+ var Sync_Course_Final_Quiz = $.extend({}, Sync_Base, {
210
+ id: 'sync-course-final-quiz',
211
+ methodGetItems: 'get-courses',
212
+ itemsKey: 'courses',
213
+ chunkSize: 500
214
+ });
215
+ var Sync_Remove_Older_Data = $.extend({}, Sync_Base, {
216
+ id: 'sync-remove-older-data',
217
+ methodGetItems: 'remove-older-data',
218
+ itemsKey: '_nothing_here',
219
+ chunkSize: 500
220
+ });
221
+ var Sync_Calculate_Course_Results = $.extend({}, Sync_Base, {
222
+ id: 'sync-calculate-course-results',
223
+ methodGetItems: 'get-users',
224
+ itemsKey: 'users',
225
+ chunkSize: 1
226
+ });
227
+ window.LP_Sync_Data = {
228
+ syncs: [],
229
+ syncing: 0,
230
+ options: {},
231
+ start: function start(options) {
232
+ this.syncs = [];
233
+ this.options = $.extend({
234
+ onInit: function onInit() {},
235
+ onStart: function onStart() {},
236
+ onCompleted: function onCompleted() {},
237
+ onCompletedAll: function onCompletedAll() {}
238
+ }, options || {});
239
+
240
+ if (!this.get_syncs()) {
241
+ return;
242
+ }
243
+
244
+ this.reset();
245
+ this.options.onInit.call(this);
246
+
247
+ var that = this,
248
+ syncing = 0,
249
+ totalSyncs = this.syncs.length,
250
+ syncCallback = function syncCallback($sync) {
251
+ if ($sync.is_completed()) {
252
+ syncing++;
253
+ that.options.onCompleted.call(that, $sync);
254
+
255
+ if (syncing >= totalSyncs) {
256
+ that.options.onCompletedAll.call(that);
257
+ return;
258
+ }
259
+
260
+ that.sync(syncing, syncCallback);
261
+ }
262
+ };
263
+
264
+ this.sync(syncing, syncCallback);
265
+ },
266
+ reset: function reset() {
267
+ for (var sync in this.syncs) {
268
+ try {
269
+ this[this.syncs[sync]].init();
270
+ } catch (e) {}
271
+ }
272
+ },
273
+ sync: function sync(_sync, callback) {
274
+ var that = this,
275
+ $sync = this[this.syncs[_sync]];
276
+ that.options.onStart.call(that, $sync);
277
+ $sync.sync(function () {
278
+ callback.call(that, $sync);
279
+ });
280
+ },
281
+ get_syncs: function get_syncs() {
282
+ var syncs = $('input[name^="lp-repair"]:checked').serializeJSON()['lp-repair'];
283
+
284
+ if (!syncs) {
285
+ return false;
286
+ }
287
+
288
+ for (var sync in syncs) {
289
+ if (syncs[sync] !== 'yes') {
290
+ continue;
291
+ }
292
+
293
+ sync = sync.replace(/[-]+/g, '_');
294
+
295
+ if (!this[sync]) {
296
+ continue;
297
+ }
298
+
299
+ this.syncs.push(sync);
300
+ }
301
+
302
+ return this.syncs;
303
+ },
304
+ get_sync: function get_sync(id) {
305
+ id = id.replace(/[-]+/g, '_');
306
+ return this[id];
307
+ },
308
+ sync_course_orders: Sync_Course_Orders,
309
+ sync_user_orders: Sync_User_Orders,
310
+ sync_user_courses: Sync_User_Courses,
311
+ sync_course_final_quiz: Sync_Course_Final_Quiz,
312
+ sync_remove_older_data: Sync_Remove_Older_Data,
313
+ sync_calculate_course_results: Sync_Calculate_Course_Results
314
+ };
315
+ $(document).ready(function () {
316
+ function initSyncs() {
317
+ var $chkAll = $('#learn-press-check-all-syncs'),
318
+ $chks = $('#learn-press-syncs').find('[name^="lp-repair"]');
319
+ $chkAll.on('click', function () {
320
+ $chks.prop('checked', this.checked);
321
+ });
322
+ $chks.on('click', function () {
323
+ $chkAll.prop('checked', $chks.filter(':checked').length === $chks.length);
324
+ });
325
+ }
326
+
327
+ initSyncs();
328
+ }).on('click', '.lp-button-repair', function () {
329
+ function getInput(sync) {
330
+ return $('ul#learn-press-syncs').find('input[name*="' + sync + '"]');
331
+ }
332
+
333
+ LP_Sync_Data.start({
334
+ onInit: function onInit() {
335
+ $('ul#learn-press-syncs').children().removeClass('syncing synced');
336
+ $('.lp-button-repair').prop('disabled', true);
337
+ },
338
+ onStart: function onStart($sync) {
339
+ getInput($sync.id).closest('li').addClass('syncing');
340
+ },
341
+ onCompleted: function onCompleted($sync) {
342
+ getInput($sync.id).closest('li').removeClass('syncing').addClass('synced');
343
+ },
344
+ onCompletedAll: function onCompletedAll() {
345
+ $('ul#learn-press-syncs').children().removeClass('syncing synced');
346
+ $('.lp-button-repair').prop('disabled', false);
347
+ }
348
+ });
349
+ });
350
+ })(jQuery);
351
+
352
+ /***/ })
353
+
354
+ /******/ });
355
+ //# sourceMappingURL=sync-data.js.map
assets/js/dist/admin/pages/sync-data.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t={};function s(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}s.m=e,s.c=t,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)s.d(n,i,function(t){return e[t]}.bind(null,i));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=8)}({8:function(e,t){var s,n,i,c,r,o,l,a;s=jQuery,n={id:"sync-base",syncing:!1,items:!1,completed:!1,callback:null,methodGetItems:"",itemsKey:"",chunkSize:50,sync:function(e){if(!this.syncing){if(this.callback=e,!1===this.items)this.get_items();else if(!this.dispatch())return this.completed=!0,void this.callToCallback();this.syncing=!0}},init:function(){this.syncing=!1,this.items=!1,this.completed=!1},is_completed:function(){return this.completed},dispatch:function(){var e=this,t=!!this.items&&this.items.splice(0,this.chunkSize);return!(!t||0===t.length||(s.ajax({url:"",data:{"lp-ajax":this.id,sync:t},method:"post",success:function(t){t=LP.parseJSON(t),e.syncing=!1,"success"!==t.result&&(e.completed=!0),e.callToCallback(),e.is_completed()||e.sync(e.callback)}}),0))},callToCallback:function(){this.callback&&this.callback.call(this)},get_items:function(){var e=this;s.ajax({url:"",data:{"lp-ajax":this.id,sync:this.methodGetItems},success:function(t){e.syncing=!1,(t=LP.parseJSON(t))[e.itemsKey]?(e.items=t[e.itemsKey],e.sync(e.callback)):(e.completed=!0,e.items=[],e.callToCallback())}})}},i=s.extend({},n,{id:"sync-course-orders",methodGetItems:"get-courses",itemsKey:"courses"}),c=s.extend({},n,{id:"sync-user-courses",methodGetItems:"get-users",itemsKey:"users",chunkSize:500}),r=s.extend({},n,{id:"sync-user-orders",methodGetItems:"get-users",itemsKey:"users",chunkSize:500}),o=s.extend({},n,{id:"sync-course-final-quiz",methodGetItems:"get-courses",itemsKey:"courses",chunkSize:500}),l=s.extend({},n,{id:"sync-remove-older-data",methodGetItems:"remove-older-data",itemsKey:"_nothing_here",chunkSize:500}),a=s.extend({},n,{id:"sync-calculate-course-results",methodGetItems:"get-users",itemsKey:"users",chunkSize:1}),window.LP_Sync_Data={syncs:[],syncing:0,options:{},start:function(e){if(this.syncs=[],this.options=s.extend({onInit:function(){},onStart:function(){},onCompleted:function(){},onCompletedAll:function(){}},e||{}),this.get_syncs()){this.reset(),this.options.onInit.call(this);var t=this,n=0,i=this.syncs.length;this.sync(n,(function e(s){if(s.is_completed()){if(n++,t.options.onCompleted.call(t,s),n>=i)return void t.options.onCompletedAll.call(t);t.sync(n,e)}}))}},reset:function(){for(var e in this.syncs)try{this[this.syncs[e]].init()}catch(e){}},sync:function(e,t){var s=this,n=this[this.syncs[e]];s.options.onStart.call(s,n),n.sync((function(){t.call(s,n)}))},get_syncs:function(){var e=s('input[name^="lp-repair"]:checked').serializeJSON()["lp-repair"];if(!e)return!1;for(var t in e)"yes"===e[t]&&this[t=t.replace(/[-]+/g,"_")]&&this.syncs.push(t);return this.syncs},get_sync:function(e){return this[e=e.replace(/[-]+/g,"_")]},sync_course_orders:i,sync_user_orders:r,sync_user_courses:c,sync_course_final_quiz:o,sync_remove_older_data:l,sync_calculate_course_results:a},s(document).ready((function(){var e,t;e=s("#learn-press-check-all-syncs"),t=s("#learn-press-syncs").find('[name^="lp-repair"]'),e.on("click",(function(){t.prop("checked",this.checked)})),t.on("click",(function(){e.prop("checked",t.filter(":checked").length===t.length)}))})).on("click",".lp-button-repair",(function(){function e(e){return s("ul#learn-press-syncs").find('input[name*="'+e+'"]')}LP_Sync_Data.start({onInit:function(){s("ul#learn-press-syncs").children().removeClass("syncing synced"),s(".lp-button-repair").prop("disabled",!0)},onStart:function(t){e(t.id).closest("li").addClass("syncing")},onCompleted:function(t){e(t.id).closest("li").removeClass("syncing").addClass("synced")},onCompletedAll:function(){s("ul#learn-press-syncs").children().removeClass("syncing synced"),s(".lp-button-repair").prop("disabled",!1)}})}))}});
assets/js/dist/admin/pages/tools.js CHANGED
@@ -81,21 +81,21 @@
81
  /******/
82
  /******/
83
  /******/ // Load entry module and return exports
84
- /******/ return __webpack_require__(__webpack_require__.s = "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/js/admin/pages/tools.js");
85
  /******/ })
86
  /************************************************************************/
87
  /******/ ({
88
 
89
- /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/js/admin/pages/tools.js":
90
- /*!***********************************************************************************************************************************************************!*\
91
- !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/js/admin/pages/tools.js ***!
92
- \***********************************************************************************************************************************************************/
93
  /*! no exports provided */
94
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
95
 
96
  "use strict";
97
  __webpack_require__.r(__webpack_exports__);
98
- /* harmony import */ var _tools_database_upgrade__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools/database/upgrade */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/js/admin/pages/tools/database/upgrade.js");
99
 
100
 
101
  (function ($) {
@@ -207,17 +207,17 @@ __webpack_require__.r(__webpack_exports__);
207
 
208
  /***/ }),
209
 
210
- /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/js/admin/pages/tools/database/upgrade.js":
211
- /*!****************************************************************************************************************************************************************************!*\
212
- !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/js/admin/pages/tools/database/upgrade.js ***!
213
- \****************************************************************************************************************************************************************************/
214
  /*! exports provided: default */
215
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
216
 
217
  "use strict";
218
  __webpack_require__.r(__webpack_exports__);
219
- /* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../utils/lp-modal-overlay */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/js/utils/lp-modal-overlay.js");
220
- /* harmony import */ var _utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../utils/handle-ajax-api */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/js/utils/handle-ajax-api.js");
221
 
222
 
223
  var $ = jQuery;
@@ -232,8 +232,8 @@ var upgradeDB = function upgradeDB() {
232
 
233
  if (elWrapperTermsUpgrade.length) {
234
  // Show Terms Upgrade.
235
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].setContentModal(elWrapperTermsUpgrade.html());
236
- var elTermUpdate = _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["elLPOverlay"].find('.terms-upgrade');
237
  var elLPAgreeTerm = elTermUpdate.find('input[name=lp-agree-term]');
238
  var elTermMessage = elTermUpdate.find('.error');
239
  var elMessageUpgrading = $('input[name=message-when-upgrading]').val();
@@ -246,43 +246,43 @@ var upgradeDB = function upgradeDB() {
246
  Object(_utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__["default"])('/lp/v1/database/agree_terms', {
247
  agree_terms: 1
248
  }, {});
249
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elFooter.find('.learn-press-notice').remove();
250
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elFooter.prepend('<span class="learn-press-notice">' + elMessageUpgrading + '</span>');
251
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].setContentModal(elStatusUpgrade.html());
252
  return true;
253
  }
254
 
255
  elTermMessage.show();
256
  elTermMessage.addClass('learn-press-message');
257
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elMainContent.animate({
258
  scrollTop: elTermMessage.offset().top
259
  });
260
  return false;
261
  };
262
  } else {
263
  // Show Steps Upgrade.
264
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].setContentModal(elStatusUpgrade.html());
265
 
266
  checkValidBeforeUpgrade = function checkValidBeforeUpgrade() {
267
  return true;
268
  };
269
  }
270
 
271
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].setTitleModal(elToolUpgradeDB.find('h2').html());
272
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elBtnYes.text('Upgrade');
273
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elBtnYes.show();
274
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elBtnNo.text('close');
275
 
276
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].callBackYes = function () {
277
  if (!checkValidBeforeUpgrade()) {
278
  return;
279
  }
280
 
281
  isUpgrading = 1;
282
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elBtnYes.hide();
283
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elBtnNo.hide();
284
  var urlHandle = '/lp/v1/database/upgrade';
285
- var elGroupStep = _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["elLPOverlay"].find('.lp-group-step');
286
  var elItemSteps = elToolUpgradeDB.find('.lp-item-step'); // Get params.
287
 
288
  var steps = [];
@@ -315,8 +315,8 @@ var upgradeDB = function upgradeDB() {
315
 
316
  var scrollToStepCurrent = function scrollToStepCurrent(stepCurrent) {
317
  elItemStepCurrent = elGroupStep.find('input[value=' + stepCurrent + ']').closest('.lp-item-step');
318
- var offset = elItemStepCurrent.offset().top - _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elMainContent.offset().top + _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elMainContent.scrollTop();
319
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elMainContent.stop().animate({
320
  scrollTop: offset
321
  }, 600);
322
  };
@@ -342,40 +342,40 @@ var upgradeDB = function upgradeDB() {
342
  isUpgrading = 0;
343
  elItemStepCurrent.removeClass('running').addClass('completed');
344
  setTimeout(function () {
345
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].setContentModal(elWrapperUpgradeMessage.html());
346
  }, 1000);
347
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elFooter.find('.learn-press-notice').remove();
348
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elBtnNo.show();
349
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elBtnNo.on('click', function () {
350
  window.location.reload();
351
  });
352
  } else {
353
  isUpgrading = 0;
354
- _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["lpModalOverlay"].elFooter.find('.learn-press-notice').remove();
355
  el