LearnPress – WordPress LMS Plugin - Version 3.2.0

Version Description

~ Fixed issue info of order added manual not correct. ~ Fixed issue course duplicated is published. ~ Fixed issue Course content column show as "No Content". ~ Fixed some issues related to cache.

Download this release

Release Info

Developer phonglq.foobla
Plugin Icon 128x128 LearnPress – WordPress LMS Plugin
Version 3.2.0
Comparing to
See all releases

Code changes from version 3.1.0.1 to 3.2.0

Files changed (97) hide show
  1. assets/css/admin/admin.css +133 -9
  2. assets/css/learnpress.css +33 -1
  3. assets/js/admin/admin.js +4 -2
  4. assets/js/admin/question-editor.js +20 -16
  5. assets/js/admin/quiz-editor.js +14 -10
  6. assets/js/admin/sync-data.js +269 -0
  7. assets/js/admin/update.js +225 -42
  8. assets/js/admin/utils.js +1 -1
  9. assets/js/admin/utils/_advertisement.js +21 -4
  10. assets/js/frontend/course.js +2 -1
  11. assets/js/global.js +232 -212
  12. assets/scss/_mixin.scss +31 -0
  13. assets/scss/admin/_advertisment.scss +6 -9
  14. assets/scss/admin/admin.scss +138 -0
  15. assets/scss/frontend/_curriculum.scss +4 -2
  16. inc/abstracts/abstract-assets.php +1 -1
  17. inc/abstracts/abstract-background-process.php +0 -3
  18. inc/abstracts/abstract-object-data.php +44 -10
  19. inc/abstracts/abstract-post-data.php +19 -0
  20. inc/admin/class-lp-admin-ajax.php +150 -12
  21. inc/admin/class-lp-admin-assets.php +3 -0
  22. inc/admin/class-lp-post-type-actions.php +188 -0
  23. inc/admin/class-lp-updater.php +4 -5
  24. inc/admin/lp-admin-actions.php +3 -4
  25. inc/admin/lp-admin-functions.php +45 -4
  26. inc/admin/views/meta-boxes/tabs.php +2 -2
  27. inc/admin/views/tools/database/html-repair-database.php +65 -0
  28. inc/admin/views/tools/html-database.php +2 -3
  29. inc/background-process/class-lp-background-sync-data.php +81 -0
  30. inc/class-lp-ajax.php +2 -2
  31. inc/class-lp-cache.php +0 -738
  32. inc/class-lp-debug.php +21 -0
  33. inc/class-lp-exception.php +7 -0
  34. inc/class-lp-page-controller.php +83 -20
  35. inc/class-lp-preview-course.php +11 -12
  36. inc/class-lp-query.php +1 -4
  37. inc/class-lp-repair-database.php +868 -0
  38. inc/class-lp-request-handler.php +65 -38
  39. inc/class-lp-schedules.php +82 -16
  40. inc/class-lp-settings.php +1 -1
  41. inc/class-lp-strings.php +33 -4
  42. inc/class-lp-thumbnail-helper.php +109 -0
  43. inc/course/abstract-course.php +310 -393
  44. inc/course/class-lp-course-item.php +47 -89
  45. inc/course/class-lp-course-section.php +45 -24
  46. inc/course/class-lp-course.php +7 -10
  47. inc/course/lp-course-functions.php +83 -57
  48. inc/curds/class-lp-course-curd.php +601 -117
  49. inc/curds/class-lp-helper-curd.php +17 -6
  50. inc/curds/class-lp-order-curd.php +27 -36
  51. inc/curds/class-lp-question-curd.php +75 -63
  52. inc/curds/class-lp-quiz-curd.php +104 -39
  53. inc/curds/class-lp-section-curd.php +127 -78
  54. inc/curds/class-lp-user-curd.php +421 -189
  55. inc/curds/class-lp-user-item-curd.php +159 -8
  56. inc/custom-post-types/course.php +77 -60
  57. inc/custom-post-types/order.php +100 -34
  58. inc/custom-post-types/question.php +6 -7
  59. inc/custom-post-types/quiz.php +3 -3
  60. inc/debug.php +1 -1
  61. inc/interfaces/interface-curd.php +18 -3
  62. inc/libraries/meta-box/css/image-advanced.css +52 -0
  63. inc/libraries/meta-box/img/loader.gif +0 -0
  64. inc/libraries/meta-box/inc/fields/thickbox-image.php +80 -0
  65. inc/libraries/meta-box/js/thickbox-image.js +34 -0
  66. inc/libraries/wp-background-process.php +4 -4
  67. inc/lp-constants.php +15 -2
  68. inc/lp-core-functions.php +160 -47
  69. inc/lp-strings.php +12 -0
  70. inc/lp-template-functions.php +7 -3
  71. inc/order/class-lp-order.php +25 -29
  72. inc/question/class-lp-question.php +46 -17
  73. inc/quiz/class-lp-quiz-factory.php +72 -45
  74. inc/quiz/class-lp-quiz.php +33 -4
  75. inc/updates/learnpress-update-1.0.7.php +5 -1
  76. inc/updates/learnpress-update-1.0.8.php +5 -1
  77. inc/updates/learnpress-update-2.0.php +5 -1
  78. inc/updates/learnpress-update-2.1.1.php +5 -1
  79. inc/updates/learnpress-update-3.0.0.php +168 -113
  80. inc/updates/learnpress-update-3.0.4.php +6 -4
  81. inc/updates/learnpress-update-3.0.8.php +5 -4
  82. inc/updates/learnpress-update-base.php +62 -19
  83. inc/user-item/class-lp-user-item-course.php +318 -93
  84. inc/user-item/class-lp-user-item-quiz.php +156 -92
  85. inc/user-item/class-lp-user-item.php +305 -50
  86. inc/user/abstract-lp-user.php +526 -725
  87. inc/user/class-lp-profile-tabs.php +15 -1
  88. inc/user/class-lp-profile.php +45 -0
  89. inc/user/class-lp-user-factory.php +0 -1
  90. inc/user/lp-user-functions.php +68 -111
  91. learnpress.php +17 -11
  92. readme.txt +68 -57
  93. templates/content-lesson/block-content.php +17 -0
  94. templates/content-quiz/progress.php +2 -2
  95. templates/single-course/content-learning.php +1 -0
  96. templates/single-course/progress.php +1 -0
  97. templates/single-course/remaining-time.php +7 -1
assets/css/admin/admin.css CHANGED
@@ -25,6 +25,22 @@
25
  -o-transform: rotate(360deg);
26
  transform: rotate(360deg); } }
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * Styles for displaying list of table
30
  */
@@ -688,11 +704,10 @@
688
  z-index: 20; }
689
 
690
  .learn-press-advertisement-slider {
691
- margin: 0px 20px 0px 180px;
692
  position: relative;
693
  overflow: hidden;
694
  box-sizing: border-box;
695
- padding-bottom: 50px;
696
  z-index: 10; }
697
  .learn-press-advertisement-slider .slider-items:after {
698
  clear: both;
@@ -704,14 +719,13 @@
704
  width: 100%;
705
  margin-right: -100%;
706
  padding: 20px;
707
- visibility: hidden;
708
  opacity: 0;
709
  background: #FFF;
710
  -webkit-box-sizing: border-box;
711
  -moz-box-sizing: border-box;
712
  box-sizing: border-box;
713
- -webkit-transition: visibility 0.5s linear, opacity 0.5s linear;
714
- transition: visibility 0.5s linear, opacity 0.5s linear; }
715
  .learn-press-advertisement-slider .slide-item .slide-thumbnail {
716
  float: left;
717
  width: 35%; }
@@ -729,11 +743,10 @@
729
  .learn-press-advertisement-slider .slide-item .slide-detail .description-short {
730
  display: none; }
731
  .learn-press-advertisement-slider .slide-item.slide-active {
732
- visibility: visible;
733
  opacity: 1; }
734
  .learn-press-advertisement-slider .slider-controls {
735
  position: absolute;
736
- bottom: 70px;
737
  right: 20px; }
738
  .learn-press-advertisement-slider .slider-controls .next-item,
739
  .learn-press-advertisement-slider .slider-controls .prev-item {
@@ -755,9 +768,9 @@
755
  .learn-press-advertisement-slider .slider-controls .prev-item:hover:before {
756
  color: #0085ba; }
757
  .learn-press-advertisement-slider .slider-controls .next-item:before {
758
- content: "\f341"; }
759
- .learn-press-advertisement-slider .slider-controls .prev-item:before {
760
  content: "\f345"; }
 
 
761
 
762
  @media only screen and (max-width: 1200px) {
763
  .learn-press-advertisement-slider .slide-item .slide-thumbnail {
@@ -3196,3 +3209,114 @@ body.lp-item-moving {
3196
 
3197
  .learnpress .actions {
3198
  margin: 0; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  -o-transform: rotate(360deg);
26
  transform: rotate(360deg); } }
27
 
28
+ @-webkit-keyframes animation4 /* Safari and Chrome */ {
29
+ from {
30
+ left: -40%;
31
+ width: 40%; }
32
+ to {
33
+ left: 100%;
34
+ width: 10%; } }
35
+
36
+ @keyframes animation4 {
37
+ from {
38
+ left: -40%;
39
+ width: 40%; }
40
+ to {
41
+ left: 100%;
42
+ width: 10%; } }
43
+
44
  /**
45
  * Styles for displaying list of table
46
  */
704
  z-index: 20; }
705
 
706
  .learn-press-advertisement-slider {
707
+ margin: 50px 20px 0 0;
708
  position: relative;
709
  overflow: hidden;
710
  box-sizing: border-box;
 
711
  z-index: 10; }
712
  .learn-press-advertisement-slider .slider-items:after {
713
  clear: both;
719
  width: 100%;
720
  margin-right: -100%;
721
  padding: 20px;
 
722
  opacity: 0;
723
  background: #FFF;
724
  -webkit-box-sizing: border-box;
725
  -moz-box-sizing: border-box;
726
  box-sizing: border-box;
727
+ -webkit-transition: opacity 0.5s linear;
728
+ transition: opacity 0.5s linear; }
729
  .learn-press-advertisement-slider .slide-item .slide-thumbnail {
730
  float: left;
731
  width: 35%; }
743
  .learn-press-advertisement-slider .slide-item .slide-detail .description-short {
744
  display: none; }
745
  .learn-press-advertisement-slider .slide-item.slide-active {
 
746
  opacity: 1; }
747
  .learn-press-advertisement-slider .slider-controls {
748
  position: absolute;
749
+ bottom: 20px;
750
  right: 20px; }
751
  .learn-press-advertisement-slider .slider-controls .next-item,
752
  .learn-press-advertisement-slider .slider-controls .prev-item {
768
  .learn-press-advertisement-slider .slider-controls .prev-item:hover:before {
769
  color: #0085ba; }
770
  .learn-press-advertisement-slider .slider-controls .next-item:before {
 
 
771
  content: "\f345"; }
772
+ .learn-press-advertisement-slider .slider-controls .prev-item:before {
773
+ content: "\f341"; }
774
 
775
  @media only screen and (max-width: 1200px) {
776
  .learn-press-advertisement-slider .slide-item .slide-thumbnail {
3209
 
3210
  .learnpress .actions {
3211
  margin: 0; }
3212
+
3213
+ #learn-press-syncs li {
3214
+ position: relative; }
3215
+ #learn-press-syncs li.syncing, #learn-press-syncs li.synced {
3216
+ padding-left: 24px; }
3217
+ #learn-press-syncs li.syncing input[type="checkbox"], #learn-press-syncs li.synced input[type="checkbox"] {
3218
+ display: none; }
3219
+ #learn-press-syncs li.syncing:after {
3220
+ content: "\f463";
3221
+ -webkit-animation: rotating4 2s linear infinite;
3222
+ -moz-animation: rotating4 2s linear infinite;
3223
+ -ms-animation: rotating4 2s linear infinite;
3224
+ -o-animation: rotating4 2s linear infinite;
3225
+ animation: rotating4 2s linear infinite; }
3226
+ #learn-press-syncs li.synced:after {
3227
+ content: "\f147";
3228
+ color: #2773aa; }
3229
+ #learn-press-syncs li:after {
3230
+ font-family: dashicons;
3231
+ display: block;
3232
+ position: absolute;
3233
+ left: -3px;
3234
+ top: 0px;
3235
+ height: 24px;
3236
+ width: 24px;
3237
+ font-size: 19px;
3238
+ text-align: center;
3239
+ line-height: 24px; }
3240
+
3241
+ #learn-press-updater .updater-progress {
3242
+ position: relative;
3243
+ margin: 0 2px; }
3244
+ #learn-press-updater .updater-progress ul {
3245
+ display: flex;
3246
+ height: 5px;
3247
+ position: relative;
3248
+ background: #EEE; }
3249
+ #learn-press-updater .updater-progress ul li {
3250
+ flex: 1;
3251
+ position: relative;
3252
+ margin: 0; }
3253
+ #learn-press-updater .updater-progress ul li:after {
3254
+ content: attr(data-version);
3255
+ background: #DDD;
3256
+ padding: 3px 5px;
3257
+ border-radius: 3px;
3258
+ font-size: 12px;
3259
+ color: #FFF;
3260
+ position: absolute;
3261
+ right: 0;
3262
+ top: -30px;
3263
+ display: none; }
3264
+ #learn-press-updater .updater-progress ul li:before {
3265
+ content: ''; }
3266
+ #learn-press-updater .updater-progress ul li:last-child:after {
3267
+ _display: block; }
3268
+ #learn-press-updater .updater-progress ul:after {
3269
+ height: 20px;
3270
+ position: absolute;
3271
+ top: 0;
3272
+ left: 0;
3273
+ width: 0; }
3274
+ #learn-press-updater .updater-progress .updater-progress-status {
3275
+ position: absolute;
3276
+ height: 5px;
3277
+ top: 0;
3278
+ left: 0;
3279
+ width: 0;
3280
+ background: #5bc4f9;
3281
+ -webkit-transition: width 0.25s;
3282
+ -moz-transition: width 0.25s;
3283
+ -ms-transition: width 0.25s;
3284
+ -o-transition: width 0.25s;
3285
+ transition: width 0.25s; }
3286
+ #learn-press-updater .updater-progress .updater-progress-status:before {
3287
+ _content: attr(data-value) "%";
3288
+ position: absolute;
3289
+ top: -20px;
3290
+ right: 0;
3291
+ background: #5bc4f9;
3292
+ padding: 0 5px;
3293
+ font-size: 12px;
3294
+ color: #FFF;
3295
+ border-radius: 3px; }
3296
+ #learn-press-updater .updater-progress .updater-progress-status .updater-progress-animation {
3297
+ position: absolute;
3298
+ height: 5px;
3299
+ top: 0;
3300
+ left: 0;
3301
+ width: 100%;
3302
+ background: #5bc4f9;
3303
+ overflow: hidden; }
3304
+ #learn-press-updater .updater-progress .updater-progress-status .updater-progress-animation:not(.completed):after {
3305
+ content: '';
3306
+ height: 5px;
3307
+ background: #8dd9ff;
3308
+ position: absolute;
3309
+ -webkit-animation: animation4 1.5s ease-out infinite;
3310
+ -moz-animation: animation4 1.5s ease-out infinite;
3311
+ -ms-animation: animation4 1.5s ease-out infinite;
3312
+ -o-animation: animation4 1.5s ease-out infinite;
3313
+ animation: animation4 1.5s ease-out infinite; }
3314
+
3315
+ #learn-press-updater .updating-message {
3316
+ color: #a24666; }
3317
+
3318
+ #learn-press-updater .completed-message {
3319
+ color: #3c8eb7; }
3320
+
3321
+ #learn-press-updater {
3322
+ display: none; }
assets/css/learnpress.css CHANGED
@@ -25,6 +25,22 @@
25
  -o-transform: rotate(360deg);
26
  transform: rotate(360deg); } }
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  @keyframes lp-rotating {
29
  from {
30
  transform: rotate(0deg);
@@ -866,7 +882,7 @@ ul.learn-press-nav-tabs {
866
  content: "\f00c"; }
867
  .course-curriculum ul.curriculum-sections .section-content .course-item.has-status.status-completed .course-item-status {
868
  color: #00adff; }
869
- .course-curriculum ul.curriculum-sections .section-content .course-item.has-status.passed {
870
  border-color: #00adff;
871
  color: #00adff; }
872
  .course-curriculum ul.curriculum-sections .section-content .course-item.has-status.item-failed .course-item-status, .course-curriculum ul.curriculum-sections .section-content .course-item.has-status.failed .course-item-status {
@@ -1738,6 +1754,22 @@ body.lp-preview #course-item-content-header {
1738
  -o-transform: rotate(360deg);
1739
  transform: rotate(360deg); } }
1740
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1741
  #popup_container {
1742
  opacity: 0;
1743
  transform: scale(0.5); }
25
  -o-transform: rotate(360deg);
26
  transform: rotate(360deg); } }
27
 
28
+ @-webkit-keyframes animation4 /* Safari and Chrome */ {
29
+ from {
30
+ left: -40%;
31
+ width: 40%; }
32
+ to {
33
+ left: 100%;
34
+ width: 10%; } }
35
+
36
+ @keyframes animation4 {
37
+ from {
38
+ left: -40%;
39
+ width: 40%; }
40
+ to {
41
+ left: 100%;
42
+ width: 10%; } }
43
+
44
  @keyframes lp-rotating {
45
  from {
46
  transform: rotate(0deg);
882
  content: "\f00c"; }
883
  .course-curriculum ul.curriculum-sections .section-content .course-item.has-status.status-completed .course-item-status {
884
  color: #00adff; }
885
+ .course-curriculum ul.curriculum-sections .section-content .course-item.has-status.passed .course-item-status {
886
  border-color: #00adff;
887
  color: #00adff; }
888
  .course-curriculum ul.curriculum-sections .section-content .course-item.has-status.item-failed .course-item-status, .course-curriculum ul.curriculum-sections .section-content .course-item.has-status.failed .course-item-status {
1754
  -o-transform: rotate(360deg);
1755
  transform: rotate(360deg); } }
1756
 
1757
+ @-webkit-keyframes animation4 /* Safari and Chrome */ {
1758
+ from {
1759
+ left: -40%;
1760
+ width: 40%; }
1761
+ to {
1762
+ left: 100%;
1763
+ width: 10%; } }
1764
+
1765
+ @keyframes animation4 {
1766
+ from {
1767
+ left: -40%;
1768
+ width: 40%; }
1769
+ to {
1770
+ left: 100%;
1771
+ width: 10%; } }
1772
+
1773
  #popup_container {
1774
  opacity: 0;
1775
  transform: scale(0.5); }
assets/js/admin/admin.js CHANGED
@@ -302,11 +302,13 @@
302
 
303
  function pluginActions(e) {
304
 
305
- if ($(e.target).closest('.learnpress-premium-plugin').length) {
 
306
  return;
307
  }
308
 
309
  e.preventDefault();
 
310
  var $plugin = $(this).closest('.plugin-card');
311
  if ($(this).hasClass('updating-message')) {
312
  return;
@@ -411,7 +413,7 @@
411
  function _ready() {
412
 
413
  $('.learn-press-dropdown-pages').dropdownPages();
414
- $('.learn-press-advertisement-slider').LP_Advertisement_Slider();
415
  $('.learn-press-toggle-item-preview').on('change', updateItemPreview);
416
  $('.learn-press-tip').QuickTip();
417
 
302
 
303
  function pluginActions(e) {
304
 
305
+ // Premium addon
306
+ if ($(e.target).hasClass('buy-now')) {
307
  return;
308
  }
309
 
310
  e.preventDefault();
311
+
312
  var $plugin = $(this).closest('.plugin-card');
313
  if ($(this).hasClass('updating-message')) {
314
  return;
413
  function _ready() {
414
 
415
  $('.learn-press-dropdown-pages').dropdownPages();
416
+ $('.learn-press-advertisement-slider').LP_Advertisement_Slider().appendTo($('#wpbody-content'));
417
  $('.learn-press-toggle-item-preview').on('change', updateItemPreview);
418
  $('.learn-press-tip').QuickTip();
419
 
assets/js/admin/question-editor.js CHANGED
@@ -35,8 +35,8 @@
35
  type: function (state) {
36
  return state.type;
37
  },
38
- code: function(state){
39
- return Date.now();
40
  }
41
  ,
42
  autoDraft: function (state) {
@@ -158,10 +158,10 @@
158
  },
159
 
160
  updateAnswerTitle: function (context, answer) {
161
- if(typeof answer.question_answer_id == 'undefined'){
162
- return;
163
- }
164
- answer = JSON.stringify(answer);
165
  Vue.http.LPRequest({
166
  type: 'update-answer-title',
167
  answer: answer
@@ -252,16 +252,21 @@
252
  * @since 3.0.0
253
  */
254
  (function (exports, Vue, $store) {
 
 
255
 
256
  Vue.http.LPRequest = function (payload) {
 
 
257
  payload['id'] = $store.getters.id;
258
  payload['nonce'] = $store.getters.nonce;
259
  payload['lp-ajax'] = $store.getters.action;
260
  payload['code'] = $store.getters.code;
261
- $( '#publishing-action #publish' ).addClass( 'disabled' );
262
- $( '#publishing-action .spinner' ).addClass( 'is-active' );
263
- $( '#publishing-action' ).addClass( 'code-'+payload['code'] );
264
-
 
265
  return Vue.http.post($store.getters.urlAjax,
266
  payload,
267
  {
@@ -294,13 +299,12 @@
294
  } else {
295
  $store.dispatch('requestCompleted', 'failed');
296
  }
297
-
298
- $( '#publishing-action' ).removeClass( 'code-'+request.params.code );
299
- if(!$( '#publishing-action' ).attr('class')){
300
- $( '#publishing-action #publish' ).removeClass( 'disabled' );
301
- $( '#publishing-action .spinner' ).removeClass( 'is-active' );
302
  }
303
-
304
  });
305
  });
306
  })(window, Vue, LP_Question_Store);
35
  type: function (state) {
36
  return state.type;
37
  },
38
+ code: function (state) {
39
+ return Date.now();
40
  }
41
  ,
42
  autoDraft: function (state) {
158
  },
159
 
160
  updateAnswerTitle: function (context, answer) {
161
+ if (typeof answer.question_answer_id == 'undefined') {
162
+ return;
163
+ }
164
+ answer = JSON.stringify(answer);
165
  Vue.http.LPRequest({
166
  type: 'update-answer-title',
167
  answer: answer
252
  * @since 3.0.0
253
  */
254
  (function (exports, Vue, $store) {
255
+ var $ = jQuery,
256
+ $publishingAction = null;
257
 
258
  Vue.http.LPRequest = function (payload) {
259
+ $publishingAction = $('#publishing-action');
260
+
261
  payload['id'] = $store.getters.id;
262
  payload['nonce'] = $store.getters.nonce;
263
  payload['lp-ajax'] = $store.getters.action;
264
  payload['code'] = $store.getters.code;
265
+
266
+ $publishingAction.find('#publish').addClass('disabled');
267
+ $publishingAction.find('.spinner').addClass('is-active');
268
+ $publishingAction.addClass('code-' + payload['code']);
269
+
270
  return Vue.http.post($store.getters.urlAjax,
271
  payload,
272
  {
299
  } else {
300
  $store.dispatch('requestCompleted', 'failed');
301
  }
302
+ $publishingAction.removeClass('code-' + request.params.code);
303
+ if (!$publishingAction.attr('class')) {
304
+ $publishingAction.find('#publish').removeClass('disabled');
305
+ $publishingAction.find('.spinner').removeClass('is-active');
 
306
  }
307
+
308
  });
309
  });
310
  })(window, Vue, LP_Question_Store);
assets/js/admin/quiz-editor.js CHANGED
@@ -45,8 +45,8 @@ var LP_Choose_Quiz_Items_Modal_Store = (function (exports, Vue, helpers, data) {
45
  return item;
46
  });
47
  },
48
- code: function(state){
49
- return Date.now();
50
  },
51
  addedItems: function (state) {
52
  return state.addedItems;
@@ -927,16 +927,20 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
927
  * @since 3.0.0
928
  */
929
  (function (exports, Vue, $store) {
 
 
930
 
931
  Vue.http.LPRequest = function (payload) {
932
  payload['id'] = $store.getters.id;
933
  payload['nonce'] = $store.getters.nonce;
934
  payload['lp-ajax'] = $store.getters.action;
935
-
936
  payload['code'] = Date.now();
937
- $( '#publishing-action #publish' ).addClass( 'disabled' );
938
- $( '#publishing-action .spinner' ).addClass( 'is-active' );
939
- $( '#publishing-action' ).addClass( 'code-'+payload['code'] );
 
 
 
940
 
941
  return Vue.http.post($store.getters.urlAjax,
942
  payload, {
@@ -971,10 +975,10 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
971
  $store.dispatch('requestComplete', 'fail');
972
  }
973
 
974
- $( '#publishing-action' ).removeClass( 'code-'+request.params.code );
975
- if(!$( '#publishing-action' ).attr('class')){
976
- $( '#publishing-action #publish' ).removeClass( 'disabled' );
977
- $( '#publishing-action .spinner' ).removeClass( 'is-active' );
978
  }
979
 
980
  });
45
  return item;
46
  });
47
  },
48
+ code: function (state) {
49
+ return Date.now();
50
  },
51
  addedItems: function (state) {
52
  return state.addedItems;
927
  * @since 3.0.0
928
  */
929
  (function (exports, Vue, $store) {
930
+ var $ = jQuery,
931
+ $publishingAction = null;
932
 
933
  Vue.http.LPRequest = function (payload) {
934
  payload['id'] = $store.getters.id;
935
  payload['nonce'] = $store.getters.nonce;
936
  payload['lp-ajax'] = $store.getters.action;
 
937
  payload['code'] = Date.now();
938
+
939
+ $publishingAction = $('#publishing-action');
940
+
941
+ $publishingAction.find('#publish').addClass('disabled');
942
+ $publishingAction.find('.spinner').addClass('is-active');
943
+ $publishingAction.addClass('code-' + payload['code']);
944
 
945
  return Vue.http.post($store.getters.urlAjax,
946
  payload, {
975
  $store.dispatch('requestComplete', 'fail');
976
  }
977
 
978
+ $publishingAction.removeClass('code-' + request.params.code);
979
+ if (!$publishingAction.attr('class')) {
980
+ $publishingAction.find('#publish').removeClass('disabled');
981
+ $publishingAction.find('.spinner').removeClass('is-active');
982
  }
983
 
984
  });
assets/js/admin/sync-data.js ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function ($) {
2
+ var Sync_Base = {
3
+ id: 'sync-base',
4
+ syncing: false,
5
+ items: false,
6
+ completed: false,
7
+ callback: null,
8
+ methodGetItems: '',
9
+ itemsKey: '',
10
+ chunkSize: 50,
11
+ sync: function (callback) {
12
+ if (this.syncing) {
13
+ return;
14
+ }
15
+
16
+ this.callback = callback;
17
+
18
+ if (this.items === false) {
19
+ this.get_items();
20
+ } else {
21
+ if (!this.dispatch()) {
22
+ this.completed = true;
23
+ this.callToCallback();
24
+ return;
25
+ }
26
+ }
27
+
28
+ this.syncing = true;
29
+ },
30
+ init: function () {
31
+ this.syncing = false;
32
+ this.items = false;
33
+ this.completed = false;
34
+ },
35
+ is_completed: function () {
36
+ return this.completed;
37
+ },
38
+ dispatch: function () {
39
+ var that = this,
40
+ items = this.items ? this.items.splice(0, this.chunkSize) : false;
41
+ if (!items || items.length === 0) {
42
+ return false;
43
+ }
44
+ $.ajax({
45
+ url: '',
46
+ data: {
47
+ 'lp-ajax': this.id,
48
+ sync: items
49
+ },
50
+ method: 'post',
51
+ success: function (response) {
52
+ response = LP.parseJSON(response)
53
+ that.syncing = false;
54
+ if (response.result !== 'success') {
55
+ that.completed = true;
56
+ }
57
+ that.callToCallback();
58
+ if (that.is_completed()) {
59
+ return;
60
+ }
61
+
62
+ that.sync(that.callback);
63
+ }
64
+ });
65
+
66
+ return true;
67
+ },
68
+ callToCallback: function () {
69
+ this.callback && this.callback.call(this);
70
+ },
71
+ get_items: function () {
72
+ var that = this;
73
+ $.ajax({
74
+ url: '',
75
+ data: {
76
+ 'lp-ajax': this.id,
77
+ sync: this.methodGetItems
78
+ },
79
+ success: function (response) {
80
+ that.syncing = false;
81
+ response = LP.parseJSON(response);
82
+ if (response[that.itemsKey]) {
83
+ that.items = response[that.itemsKey];
84
+ that.sync(that.callback);
85
+ } else {
86
+ that.completed = true;
87
+ that.items = [];
88
+ that.callToCallback();
89
+ }
90
+ console.log('Get items: ', that.items.length);
91
+ }
92
+ });
93
+ }
94
+ };
95
+
96
+ var Sync_Course_Orders = $.extend({}, Sync_Base, {
97
+ id: 'sync-course-orders',
98
+ methodGetItems: 'get-courses',
99
+ itemsKey: 'courses'
100
+ });
101
+
102
+ var Sync_User_Courses = $.extend({}, Sync_Base, {
103
+ id: 'sync-user-courses',
104
+ methodGetItems: 'get-users',
105
+ itemsKey: 'users',
106
+ chunkSize: 500
107
+ });
108
+
109
+ var Sync_User_Orders = $.extend({}, Sync_Base, {
110
+ id: 'sync-user-orders',
111
+ methodGetItems: 'get-users',
112
+ itemsKey: 'users',
113
+ chunkSize: 500
114
+ });
115
+
116
+ var Sync_Course_Final_Quiz = $.extend({}, Sync_Base, {
117
+ id: 'sync-course-final-quiz',
118
+ methodGetItems: 'get-courses',
119
+ itemsKey: 'courses',
120
+ chunkSize: 500
121
+ });
122
+
123
+ var Sync_Remove_Older_Data = $.extend({}, Sync_Base, {
124
+ id: 'sync-remove-older-data',
125
+ methodGetItems: 'remove-older-data',
126
+ itemsKey: '_nothing_here',
127
+ chunkSize: 500
128
+ });
129
+
130
+ var Sync_Calculate_Course_Results = $.extend({}, Sync_Base, {
131
+ id: 'sync-calculate-course-results',
132
+ methodGetItems: 'get-users',
133
+ itemsKey: 'users',
134
+ chunkSize: 1
135
+ });
136
+
137
+
138
+ window.LP_Sync_Data = {
139
+ syncs: [],
140
+ syncing: 0,
141
+ options: {},
142
+ start: function (options) {
143
+ this.syncs = [];
144
+ this.options = $.extend({
145
+ onInit: function () {
146
+ },
147
+ onStart: function () {
148
+
149
+ },
150
+ onCompleted: function () {
151
+
152
+ },
153
+ onCompletedAll: function () {
154
+
155
+ }
156
+ }, options || {});
157
+
158
+ if (!this.get_syncs()) {
159
+ return;
160
+ }
161
+ this.reset();
162
+ this.options.onInit.call(this);
163
+ var that = this,
164
+ syncing = 0,
165
+ totalSyncs = this.syncs.length,
166
+ syncCallback = function ($sync) {
167
+
168
+ if ($sync.is_completed()) {
169
+ syncing++;
170
+ that.options.onCompleted.call(that, $sync)
171
+ if (syncing >= totalSyncs) {
172
+
173
+ that.options.onCompletedAll.call(that)
174
+ return;
175
+ }
176
+ that.sync(syncing, syncCallback)
177
+ }
178
+ };
179
+ this.sync(syncing, syncCallback);
180
+ },
181
+ reset: function () {
182
+ for (var sync in this.syncs) {
183
+ try {
184
+ this[this.syncs[sync]].init();
185
+ } catch (e) {
186
+ }
187
+ }
188
+ },
189
+ sync: function (sync, callback) {
190
+ var that = this,
191
+ $sync = this[this.syncs[sync]];
192
+ that.options.onStart.call(that, $sync);
193
+ $sync.sync(function () {
194
+ callback.call(that, $sync)
195
+ })
196
+ },
197
+ get_syncs: function () {
198
+ var syncs = $('input[name^="lp-repair"]:checked').serializeJSON()['lp-repair'];
199
+ if (!syncs) {
200
+ return false;
201
+ }
202
+
203
+ for (var sync in syncs) {
204
+ if (syncs[sync] !== 'yes') {
205
+ continue;
206
+ }
207
+
208
+ sync = sync.replace(/[-]+/g, '_');
209
+
210
+ if (!this[sync]) {
211
+ continue;
212
+ }
213
+
214
+ this.syncs.push(sync);
215
+ }
216
+
217
+ return this.syncs;
218
+ },
219
+ get_sync: function (id) {
220
+ id = id.replace(/[-]+/g, '_');
221
+ return this[id];
222
+ },
223
+ sync_course_orders: Sync_Course_Orders,
224
+ sync_user_orders: Sync_User_Orders,
225
+ sync_user_courses: Sync_User_Courses,
226
+ sync_course_final_quiz: Sync_Course_Final_Quiz,
227
+ sync_remove_older_data: Sync_Remove_Older_Data,
228
+ sync_calculate_course_results: Sync_Calculate_Course_Results
229
+ }
230
+
231
+ $(document).ready(function () {
232
+ function initSyncs() {
233
+ var $chkAll = $('#learn-press-check-all-syncs'),
234
+ $chks = $('#learn-press-syncs').find('[name^="lp-repair"]');
235
+
236
+ $chkAll.on('click', function () {
237
+ $chks.prop('checked', this.checked)
238
+ });
239
+
240
+ $chks.on('click', function () {
241
+ $chkAll.prop('checked', $chks.filter(':checked').length === $chks.length);
242
+ })
243
+ }
244
+
245
+ initSyncs();
246
+ }).on('click', '.lp-button-repair', function () {
247
+ function getInput(sync) {
248
+ return $('ul#learn-press-syncs').find('input[name*="' + sync + '"]')
249
+ }
250
+
251
+ LP_Sync_Data.start({
252
+ onInit: function () {
253
+ $('ul#learn-press-syncs').children().removeClass('syncing synced');
254
+ $('.lp-button-repair').prop('disabled', true);
255
+ },
256
+ onStart: function ($sync) {
257
+ getInput($sync.id).closest('li').addClass('syncing');
258
+ },
259
+ onCompleted: function ($sync) {
260
+ getInput($sync.id).closest('li').removeClass('syncing').addClass('synced');
261
+ },
262
+ onCompletedAll: function () {
263
+ $('ul#learn-press-syncs').children().removeClass('syncing synced');
264
+ $('.lp-button-repair').prop('disabled', false);
265
+ }
266
+ });
267
+ });
268
+
269
+ })(jQuery);
assets/js/admin/update.js CHANGED
@@ -1,56 +1,239 @@
1
  ;(function ($) {
2
  'use strict';
3
 
4
- function init() {
5
- var i18n = window.lpUpdateSettings || {};
6
- $(document).on('click', '#button-update', function (e) {
7
- e.preventDefault();
8
- var $form = $('#learn-press-update-form'),
9
- loadUrl = $(this).attr('href'),
10
- $main = $('#main').addClass('loading');
11
- $('.learn-press-message').remove();
12
- $.post({
13
- url: loadUrl,
14
- data: $form.serializeJSON(),
15
- success: function (res) {
16
- $(res).insertBefore($form);
17
- $main.removeClass('loading');
18
- }
19
- });
20
- }).on('click', '.lp-button-upgrade', function (e) {
21
- e.preventDefault();
 
 
 
 
 
 
22
 
23
- if (!confirm(i18n.i18n_confirm)) {
 
 
 
 
24
  return false;
25
  }
26
 
27
- var $btn = $(this),
28
- url = $btn.addClass('disabled').attr('href'),
29
- context = $btn.data('context');
30
- $.post({
31
- url: url,
32
- data: {
33
- context: context
34
- },
35
- success: function (res) {
36
- var $msg = $(res);
37
- if (context == 'message') {
38
- $btn.closest('.notice').replaceWith($msg);
39
- } else {
40
- $msg.insertBefore($btn);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  }
43
- });
44
- }).on('click', '#skip-notice-install', function(){
45
- $.post({
46
- url: '',
47
- data: {
48
- 'lp-ajax': 'skip-notice-install'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
- $('#notice-install').fadeOut();
53
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
55
 
56
  $(document).ready(init);
1
  ;(function ($) {
2
  'use strict';
3
 
4
+ var Package = function (data) {
5
+ this.data = data;
6
+
7
+ var currentIndex = -1,
8
+ currentVersion = null,
9
+ currentPackage = null,
10
+ versions = Object.keys(this.data);
11
+
12
+ this.reset = function (current) {
13
+ current = (current === undefined || current > versions.length - 1 || current < 0 ) ? 0 : current;
14
+ currentIndex = current;
15
+ currentVersion = versions[current];
16
+ currentPackage = this.data[currentVersion];
17
+
18
+ return currentPackage;
19
+ }
20
+
21
+ this.next = function () {
22
+ if (currentIndex >= versions.length - 1) {
23
+ return false;
24
+ }
25
+
26
+ currentIndex++;
27
+ this.reset(currentIndex);
28
 
29
+ return currentPackage;
30
+ }
31
+
32
+ this.prev = function () {
33
+ if (currentIndex <= 0) {
34
  return false;
35
  }
36
 
37
+ currentIndex--;
38
+ this.reset(currentIndex);
39
+
40
+ return currentPackage;
41
+ }
42
+
43
+ this.currentVersion = function () {
44
+ return currentVersion;
45
+ }
46
+
47
+ this.hasPackage = function () {
48
+ return versions.length
49
+ }
50
+
51
+ this.getPercentCompleted = function () {
52
+ return (currentIndex) / versions.length;
53
+ }
54
+
55
+ this.getTotal = function () {
56
+ return versions.length;
57
+ }
58
+
59
+ if (!this.data) {
60
+ return;
61
+ }
62
+
63
+ }
64
+ var UpdaterSettings = {
65
+ el: '#learn-press-updater',
66
+ data: {
67
+ packages: null,
68
+ status: '',
69
+ force: false,
70
+ },
71
+ watch: {
72
+ packages: function (newPackages, oldPackages) {
73
+ if (newPackages) {
74
+
75
+ }
76
+ }
77
+ },
78
+ mounted: function () {
79
+ $(this.$el).show();
80
+ },
81
+ methods: {
82
+ getUpdatePackages: function (callback) {
83
+ var that = this;
84
+ $.ajax({
85
+ url: lpGlobalSettings.admin_url,
86
+ data: {
87
+ 'lp-ajax': 'get-update-packages',
88
+ force: this.force,
89
+ _wpnonce: lpGlobalSettings._wpnonce
90
+ },
91
+ success: function (res) {
92
+ var packages = LP.parseJSON(res);
93
+ that.packages = new Package(packages);
94
+ callback && callback.call(that)
95
  }
96
+ })
97
+ },
98
+ start: function (e, force) {
99
+ this.packages = null;
100
+ this.force = force;
101
+ this.getUpdatePackages(function () {
102
+ if (this.packages.hasPackage()) {
103
+ var p = this.packages.next();
104
+ this.status = 'updating';
105
+ this.doUpdate(p);
106
+ }
107
+ });
108
+ },
109
+ getPackages: function () {
110
+ return this.packages ? this.packages.data : {};
111
+ },
112
+ hasPackage: function () {
113
+ return !$.isEmptyObject(this.getPackages());
114
+ },
115
+ updateButtonClass: function () {
116
+ return {
117
+ 'disabled': this.status === 'updating'
118
  }
119
+ },
120
+ doUpdate: function (p, i) {
121
+ var that = this;
122
+
123
+ p = p ? p : this.packages.next();
124
+ i = i ? i : 1;
125
+
126
+ if (p) {
127
+ console.log('Updating ...', this.packages.currentVersion(), p)
128
+
129
+ $.ajax({
130
+ url: lpGlobalSettings.admin_url,
131
+ data: {
132
+ 'lp-ajax': 'do-update-package',
133
+ package: p,
134
+ version: this.packages.currentVersion(),
135
+ _wpnonce: lpGlobalSettings._wpnonce,
136
+ force: this.force,
137
+ i: i
138
+ },
139
+ success: function (res) {
140
+ var response = LP.parseJSON(res),
141
+ $status = $(that.$el).find('.updater-progress-status');
142
+ if (response.done === 'yes') {
143
+ that.update(that.packages.getPercentCompleted() * 100);
144
+ that.doUpdate();
145
+ } else {
146
+ var newWidth = that.packages.getPercentCompleted() * 100;
147
+ if (response.percent) {
148
+ var stepWidth = 1 / that.packages.getTotal();
149
+ newWidth += (stepWidth * response.percent);
150
+ }
151
+
152
+ that.update(newWidth);
153
+ that.doUpdate(p, ++i);
154
+ }
155
+ },
156
+ error: function () {
157
+ console.log('Update Error: Retry!');
158
+ that.doUpdate(p, i);
159
+ }
160
+ });
161
+
162
+ } else {
163
+ that.update(100).addClass('completed');
164
+ setTimeout(function (x) {
165
+ x.status = 'completed';
166
+ }, 2000, this);
167
  }
168
+ },
169
+ update: function (value) {
170
+ return $(this.$el).find('.updater-progress-status').css('width', value + '%').attr('data-value', parseInt(value));
171
+ }
172
+ }
173
+ };
174
+
175
+
176
+
177
+ function init() {
178
+
179
+ window.lpGlobalSettings = window.lpGlobalSettings || {};
180
+
181
+ if($('#learn-press-updater').length) {
182
+ var Updater = new Vue(UpdaterSettings);
183
+ }
184
+
185
 
186
+ // return;
187
+ //
188
+ // var i18n = window.lpUpdateSettings || {};
189
+ // $(document).on('click', '#button-update', function (e) {
190
+ // e.preventDefault();
191
+ // var $form = $('#learn-press-update-form'),
192
+ // loadUrl = $(this).attr('href'),
193
+ // $main = $('#main').addClass('loading');
194
+ // $('.learn-press-message').remove();
195
+ // $.post({
196
+ // url: loadUrl,
197
+ // data: $form.serializeJSON(),
198
+ // success: function (res) {
199
+ // $(res).insertBefore($form);
200
+ // $main.removeClass('loading');
201
+ // }
202
+ // });
203
+ // }).on('click', '.lp-button-upgrade', function (e) {
204
+ // e.preventDefault();
205
+ //
206
+ // if (!confirm(i18n.i18n_confirm)) {
207
+ // return false;
208
+ // }
209
+ //
210
+ // var $btn = $(this),
211
+ // url = $btn.addClass('disabled').attr('href'),
212
+ // context = $btn.data('context');
213
+ // $.post({
214
+ // url: url,
215
+ // data: {
216
+ // context: context
217
+ // },
218
+ // success: function (res) {
219
+ // var $msg = $(res);
220
+ // if (context == 'message') {
221
+ // $btn.closest('.notice').replaceWith($msg);
222
+ // } else {
223
+ // $msg.insertBefore($btn);
224
+ // }
225
+ // }
226
+ // });
227
+ // }).on('click', '#skip-notice-install', function(){
228
+ // $.post({
229
+ // url: '',
230
+ // data: {
231
+ // 'lp-ajax': 'skip-notice-install'
232
+ // }
233
+ // });
234
+ //
235
+ // $('#notice-install').fadeOut();
236
+ // });
237
  }
238
 
239
  $(document).ready(init);
assets/js/admin/utils.js CHANGED
@@ -1 +1 @@
1
- function login(){alert()}!function(e){e.fn.advancedList=function(t){for(var n=[],i=1;i<arguments.length;i++)n.push(arguments[i]);return e.each(this,function(){var i=e(this).data("advancedList");return i||(i=new function(t,n){function i(e){o.children(":eq("+(e-1)+")").remove(),s.options.onRemove&&s.options.onRemove.call(s)}function a(t,n){var i={},a=function(){var t=e(s.options.template);return t.length?t.html():s.options.template}();e.isPlainObject(t)?i=e.extend({id:0,text:""},t):"string"==typeof t?i={id:"",text:t}:void 0!==t[0]&&(i={id:t[1]?t[1]:"",text:t[0]});for(var d in i){var r=new RegExp("{{"+d+"}}","g");a=a.replace(r,i[d])}if(a=e(a),void 0!==n){var l=o.children(":eq("+(n-1)+")");l.length?a.insertBefore(l):o.append(a)}else o.append(a);o.children().detach().each(function(){o.append("\n").append(this)}),s.options.onAdd&&s.options.onAdd.call(s)}var s=this,o=e(t).hasClass("advanced-list")?e(t):e(".advanced-list",t);this.options=e.extend({template:'<li data-id="{{id}}"><span class="remove-item"></span><span>{{text}}</span> </li>'},n||{}),this.$el=o,o.on("click",".remove-item",function(t){t.preventDefault(),i(o.children().index(e(this).closest("li"))+1)}),this.add=a,this.remove=i}(this,t),e(this).data("advancedList",i)),"string"==typeof t&&e.isFunction(i[t])?i[t].apply(i,n):this})}}(jQuery),function(e){function t(t,n){function i(){d.append(c).append(l),d.on("click",".next-item",s),d.on("click",".prev-item",o),a()}function a(e){e=void 0!==e?e:p,r.eq(e).addClass("slide-active").siblings().removeClass("slide-active")}function s(){p<r.length-1?p++:p=0,a(p)}function o(){p>0?p--:p=r.length-1,a(p)}this.options=e.extend({},n||{});var d=e(t),r=d.find(".slide-item"),l=e('<div class="slider-controls"><div class="next-item"></div><div class="prev-item"></div></div>'),c=e('<div class="slider-items"></div>').append(r),p=0;i()}e.fn.LP_Advertisement_Slider=function(n){return e.each(this,function(){var i=e(this).data("LP_Advertisement_Slider");return i||(i=new t(this,n),e(this).data("LP_Advertisement_Slider",i)),this})}}(jQuery),function(e){function t(t,n){this.options=e.extend({ID:"",name:"Add new page"},n||{});var i=e(t),a=i.find("select"),s=i.find(".list-pages-wrapper"),o=i.find(".quick-add-page-actions"),d=i.find(".quick-add-page-inline");a.change(function(){o.addClass("hide-if-js"),"add_new_page"===this.value?(s.addClass("hide-if-js"),d.removeClass("hide-if-js").find("input").focus().val("")):parseInt(this.value)&&(o.find("a.edit-page").attr("href","post.php?post="+this.value+"&action=edit"),o.find("a.view-page").attr("href",lpGlobalSettings.siteurl+"?page_id="+this.value),o.removeClass("hide-if-js"),a.attr("data-selected",this.value))}),a.css("width",a.width()+50).find("option").each(function(){e(this).html(e(this).html().replace(/&nbsp;&nbsp;&nbsp;/g,""))}),a.select2({allowClear:!0}),a.on("select2:select",function(e){e.params.data}),i.on("click",".quick-add-page-inline button",function(){var t=e(this),n=d.find("input"),i=n.val();if(!i)return alert("Please enter the name of page"),void n.focus();t.prop("disabled",!0),e.ajax({url:lpGlobalSettings.ajax,data:{action:"learnpress_create_page",page_name:i},type:"post",dataType:"html",success:function(n){(n=LP.parseJSON(n)).page?(!function(t){var n=e('<option value="'+t.ID+'">'+t.name+"</option>"),i=e.inArray(t.ID+"",t.positions);e(".learn-press-dropdown-pages select").each(function(){var a=e(this),s=n.clone();0==i?e("option",a).each(function(){if(parseInt(e(this).val()))return s.insertBefore(e(this)),!1}):i==t.positions.length-1?a.append(s):(s.insertAfter(e('option[value="'+t.positions[i-1]+'"]',a)),console.log(e('option[value="'+t.positions[i-1]+'"]',a)))})}({ID:n.page.ID,name:n.page.post_title,positions:n.positions}),a.val(n.page.ID).focus().trigger("change"),d.addClass("hide-if-js")):n.error&&alert(n.error),t.prop("disabled",!1),s.removeClass("hide-if-js")}})}).on("click",".quick-add-page-inline a",function(e){e.preventDefault(),d.addClass("hide-if-js"),a.val(a.attr("data-selected")+"").removeAttr("disabled").trigger("change"),s.removeClass("hide-if-js")}).on("click",".button-quick-add-page",function(e){a.val("add_new_page").trigger("change")}).on("keypress keydown",'.quick-add-page-inline input[type="text"]',function(t){13==t.keyCode&&"keypress"==t.type?(t.preventDefault(),e(this).siblings("button").trigger("click")):27==t.keyCode&&"keydown"==t.type&&e(this).siblings("a").trigger("click")})}e.fn.dropdownPages=function(){return e.each(this,function(){var n=e(this).data("dropdownPages");return n||(n=new t(this,{}),e(this).data("dropdownPages",n)),n})}}(jQuery),function(e){var t=null,n=null,i=null,a=function(t){i||(i=n.clone()),keywords=t.toLowerCase().split(/\s+/).filter(function(e,t){return e.length>=3});n.each(function(t){var n=e(this).html(""),a=(function(t,n){t.find(".plugin-card").each(function(){var t=e(this),i=t.find(".item-title").text().toLowerCase(),a=t.find(".column-description, .theme-description").text();if(keywords.length){if(function(){var e=new RegExp(keywords.join("|"),"ig");return i.match(e)||a.match(e)}()){var s=t.clone();n.append(s)}}else n.append(t.clone())})}(i.eq(t),n),n.children().length);n.prev("h2").find("span").html(a)})};e(document).on("keyup",".lp-search-addon",function(e){t&&clearTimeout(t),t=setTimeout(a,300,e.target.value)}).ready(function(){n=e(".addons-browse")})}(jQuery);
1
+ function login(){alert()}!function(c){var n=function(e,t){var l=this,r=c(e).hasClass("advanced-list")?c(e):c(".advanced-list",e);function i(e){r.children(":eq("+(e-1)+")").remove(),l.options.onRemove&&l.options.onRemove.call(l)}this.options=c.extend({template:'<li data-id="{{id}}"><span class="remove-item"></span><span>{{text}}</span> </li>'},t||{}),(this.$el=r).on("click",".remove-item",function(e){e.preventDefault(),i(r.children().index(c(this).closest("li"))+1)}),this.add=function(e,t){var i={},n=(a=c(l.options.template),a.length?a.html():l.options.template);var a;for(var s in c.isPlainObject(e)?i=c.extend({id:0,text:""},e):"string"==typeof e?i={id:"",text:e}:void 0!==e[0]&&(i={id:e[1]?e[1]:"",text:e[0]}),i){var o=new RegExp("{{"+s+"}}","g");n=n.replace(o,i[s])}if(n=c(n),void 0!==t){var d=r.children(":eq("+(t-1)+")");d.length?n.insertBefore(d):r.append(n)}else r.append(n);r.children().detach().each(function(){r.append("\n").append(this)}),l.options.onAdd&&l.options.onAdd.call(l)},this.remove=i};c.fn.advancedList=function(t){for(var i=[],e=1;e<arguments.length;e++)i.push(arguments[e]);return c.each(this,function(){var e=c(this).data("advancedList");return e||(e=new n(this,t),c(this).data("advancedList",e)),"string"==typeof t&&c.isFunction(e[t])?e[t].apply(e,i):this})}}(jQuery),function(p){function i(e,t){this.options=p.extend({},t||{});var i=p(e),n=i.find(".slide-item"),a=p('<div class="slider-controls"><div class="prev-item"></div><div class="next-item"></div></div>'),s=p('<div class="slider-items"></div>').append(n),o=0,d=null;function l(e){e=void 0!==e?e:o;var t=n.eq(e);t.show(),setTimeout(function(){t.addClass("slide-active")},1),t.siblings().removeClass("slide-active"),d&&clearTimeout(d),d=setTimeout(function(){t.siblings().hide()},500)}function r(){o<n.length-1?o++:o=0,l(o)}function c(){0<o?o--:o=n.length-1,l(o)}i.append(s),n.each(function(){p(this).append(a.clone())}),i.on("click",".next-item",r),i.on("click",".prev-item",c),l()}p.fn.LP_Advertisement_Slider=function(t){return p.each(this,function(){var e=p(this).data("LP_Advertisement_Slider");return e||(e=new i(this,t),p(this).data("LP_Advertisement_Slider",e)),this})}}(jQuery),function(l){function t(e,t){this.options=l.extend({ID:"",name:"Add new page"},t||{});var i=l(e),s=i.find("select"),o=i.find(".list-pages-wrapper"),n=i.find(".quick-add-page-actions"),d=i.find(".quick-add-page-inline");s.change(function(){n.addClass("hide-if-js"),"add_new_page"===this.value?(o.addClass("hide-if-js"),d.removeClass("hide-if-js").find("input").focus().val("")):parseInt(this.value)&&(n.find("a.edit-page").attr("href","post.php?post="+this.value+"&action=edit"),n.find("a.view-page").attr("href",lpGlobalSettings.siteurl+"?page_id="+this.value),n.removeClass("hide-if-js"),s.attr("data-selected",this.value))}),s.css("width",s.width()+50).find("option").each(function(){l(this).html(l(this).html().replace(/&nbsp;&nbsp;&nbsp;/g,""))}),s.select2({allowClear:!0}),s.on("select2:select",function(e){e.params.data}),i.on("click",".quick-add-page-inline button",function(){var t=l(this),e=d.find("input"),i=e.val();if(!i)return alert("Please enter the name of page"),void e.focus();t.prop("disabled",!0),l.ajax({url:lpGlobalSettings.ajax,data:{action:"learnpress_create_page",page_name:i},type:"post",dataType:"html",success:function(e){var i,n,a;(e=LP.parseJSON(e)).page?(i={ID:e.page.ID,name:e.page.post_title,positions:e.positions},n=l('<option value="'+i.ID+'">'+i.name+"</option>"),a=l.inArray(i.ID+"",i.positions),l(".learn-press-dropdown-pages select").each(function(){var e=l(this),t=n.clone();0==a?l("option",e).each(function(){if(parseInt(l(this).val()))return t.insertBefore(l(this)),!1}):a==i.positions.length-1?e.append(t):(t.insertAfter(l('option[value="'+i.positions[a-1]+'"]',e)),console.log(l('option[value="'+i.positions[a-1]+'"]',e)))}),s.val(e.page.ID).focus().trigger("change"),d.addClass("hide-if-js")):e.error&&alert(e.error),t.prop("disabled",!1),o.removeClass("hide-if-js")}})}).on("click",".quick-add-page-inline a",function(e){e.preventDefault(),d.addClass("hide-if-js"),s.val(s.attr("data-selected")+"").removeAttr("disabled").trigger("change"),o.removeClass("hide-if-js")}).on("click",".button-quick-add-page",function(e){s.val("add_new_page").trigger("change")}).on("keypress keydown",'.quick-add-page-inline input[type="text"]',function(e){13==e.keyCode&&"keypress"==e.type?(e.preventDefault(),l(this).siblings("button").trigger("click")):27==e.keyCode&&"keydown"==e.type&&l(this).siblings("a").trigger("click")})}l.fn.dropdownPages=function(){return l.each(this,function(){var e=l(this).data("dropdownPages");return e||(e=new t(this,{}),l(this).data("dropdownPages",e)),e})}}(jQuery),function(o){var t=null,i=null,a=null,n=function(e){a||(a=i.clone()),keywords=e.toLowerCase().split(/\s+/).filter(function(e,t){return 3<=e.length});i.each(function(e){var t,s,i=o(this).html(""),n=(t=a.eq(e),s=i,t.find(".plugin-card").each(function(){var e,t=o(this),i=t.find(".item-title").text().toLowerCase(),n=t.find(".column-description, .theme-description").text();if(keywords.length){if(e=new RegExp(keywords.join("|"),"ig"),i.match(e)||n.match(e)){var a=t.clone();s.append(a)}}else s.append(t.clone())}),i.children().length);i.prev("h2").find("span").html(n)})};o(document).on("keyup",".lp-search-addon",function(e){t&&clearTimeout(t),t=setTimeout(n,300,e.target.value)}).ready(function(){i=o(".addons-browse")})}(jQuery);
assets/js/admin/utils/_advertisement.js CHANGED
@@ -3,9 +3,10 @@
3
  this.options = $.extend({}, options || {});
4
  var $el = $(el),
5
  $items = $el.find('.slide-item'),
6
- $controls = $('<div class="slider-controls"><div class="next-item"></div><div class="prev-item"></div></div>'),
7
  $wrapItems = $('<div class="slider-items"></div>').append($items),
8
- itemIndex = 0;
 
9
 
10
  function init() {
11
  createHTML();
@@ -14,12 +15,28 @@
14
  }
15
 
16
  function createHTML() {
17
- $el.append($wrapItems).append($controls);
 
 
 
18
  }
19
 
20
  function activeItem(index) {
21
  index = index !== undefined ? index : itemIndex;
22
- $items.eq(index).addClass('slide-active').siblings().removeClass('slide-active');
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
 
25
  function nextItem() {
3
  this.options = $.extend({}, options || {});
4
  var $el = $(el),
5
  $items = $el.find('.slide-item'),
6
+ $controls = $('<div class="slider-controls"><div class="prev-item"></div><div class="next-item"></div></div>'),
7
  $wrapItems = $('<div class="slider-items"></div>').append($items),
8
+ itemIndex = 0,
9
+ timer = null;
10
 
11
  function init() {
12
  createHTML();
15
  }
16
 
17
  function createHTML() {
18
+ $el.append($wrapItems);
19
+ $items.each(function () {
20
+ $(this).append($controls.clone())
21
+ })
22
  }
23
 
24
  function activeItem(index) {
25
  index = index !== undefined ? index : itemIndex;
26
+ var activeItem = $items.eq(index);
27
+
28
+ activeItem.show();
29
+ // A ha???
30
+ setTimeout(function () {
31
+ activeItem.addClass('slide-active');
32
+ }, 1);
33
+
34
+ activeItem.siblings().removeClass('slide-active');
35
+
36
+ timer && clearTimeout(timer);
37
+ timer = setTimeout(function () {
38
+ activeItem.siblings().hide();
39
+ }, 500)
40
  }
41
 
42
  function nextItem() {
assets/js/frontend/course.js CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * LearnPress frontend course app.
4
  *
5
- * @version 3.x.x
6
  * @author ThimPress
7
  * @package LearnPress/JS/Course
8
  */
@@ -236,6 +236,7 @@
236
  }
237
 
238
  function maybeShowCurriculum(e) {
 
239
  var offset = $(this).offset(),
240
  offsetX = e.pageX - offset.left,
241
  curriculumWidth = getCurriculumWidth();
2
  /**
3
  * LearnPress frontend course app.
4
  *
5
+ * @version 3.2.0
6
  * @author ThimPress
7
  * @package LearnPress/JS/Course
8
  */
236
  }
237
 
238
  function maybeShowCurriculum(e) {
239
+ return;
240
  var offset = $(this).offset(),
241
  offsetX = e.pageX - offset.left,
242
  curriculumWidth = getCurriculumWidth();
assets/js/global.js CHANGED
@@ -1,10 +1,8 @@
1
  /**
2
  * Common functions/utils used in all page
3
  */
4
-
5
-
6
- if (typeof window.LP === 'undefined') {
7
- window.LP = window.LearnPress = {};
8
  }
9
 
10
 
@@ -121,38 +119,38 @@ if (typeof window.LP === 'undefined') {
121
  var keys = this.name.match(validate),
122
  objPath = "indexed['" + match[0] + "']";
123
 
124
- if (keys) {
125
- if (typeof indexed[match[0]] !== 'object') {
126
- indexed[match[0]] = {};
127
- }
128
-
129
- $.each(keys, function (i, prop) {
130
- prop = prop.replace(/\]|\[/g, '');
131
- var rawPath = objPath.replace(/'|\[|\]/g, ''),
132
- objExp = '',
133
- preObjPath = objPath;
134
-
135
- if (prop === '') {
136
- if (arrayKeys[rawPath] === undefined) {
137
- arrayKeys[rawPath] = 0;
138
- } else {
139
- arrayKeys[rawPath]++;
140
- }
141
- objPath += "['" + arrayKeys[rawPath] + "']";
142
- } else {
143
- if (!isNaN(prop)) {
144
- arrayKeys[rawPath] = prop;
145
- }
146
- objPath += "['" + prop + "']";
147
- }
148
- try {
149
- if (i === keys.length - 1) {
150
- objExp = objPath + "= !(that.value + '').length || isNaN(that.value) ? that.value : Number(that.value);";
151
- end = true;
152
- } else {
153
- objExp = objPath + "={}";
154
- end = false;
155
- }
156
 
157
  var evalString = "" +
158
  "if( typeof " + objPath + " == 'undefined'){" + objExp + ";" +
@@ -188,6 +186,8 @@ if (typeof window.LP === 'undefined') {
188
  if (!content || ($el.data('LP_Tooltip') !== undefined)) {
189
  return;
190
  }
 
 
191
  var $tooltip = null;
192
  $el.hover(function (e) {
193
  $tooltip = $('<div class="learn-press-tooltip-bubble"/>').html(content).appendTo($('body')).hide();
@@ -199,166 +199,166 @@ if (typeof window.LP === 'undefined') {
199
  position.left += left;
200
  } else {
201
 
202
- }
203
- if ($.isNumeric(top)) {
204
- position.top += top;
205
- } else {
206
-
207
- }
208
- }
209
- $tooltip.css({
210
- top: position.top,
211
- left: position.left
212
- });
213
- $tooltip.fadeIn();
214
- }, function () {
215
- $tooltip && $tooltip.remove();
216
- });
217
- $el.data('LP_Tooltip', true);
218
- });
219
- };
220
- $.fn.hasEvent = function (name) {
221
- var events = $(this).data('events');
222
- if (typeof events.LP === 'undefined') {
223
- return false;
224
- }
225
- for (i = 0; i < events.LP.length; i++) {
226
- if (events.LP[i].namespace === name) {
227
- return true;
228
- }
229
- }
230
- return false;
231
- };
232
- $.fn.dataToJSON = function () {
233
- var json = {};
234
- $.each(this[0].attributes, function () {
235
- var m = this.name.match(/^data-(.*)/);
236
- if (m) {
237
- json[m[1]] = this.value;
238
- }
239
- });
240
- return json;
241
- };
242
-
243
- String.prototype.getQueryVar = function (name) {
244
- name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
245
- var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
246
- results = regex.exec(this);
247
- return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
248
- };
249
- String.prototype.addQueryVar = function (name, value) {
250
- var url = this,
251
- m = url.split('#');
252
- url = m[0];
253
- if (name.match(/\[/)) {
254
- url += url.match(/\?/) ? '&' : '?';
255
- url += name + '=' + value;
256
- } else {
257
- if ((url.indexOf('&' + name + '=') !== -1) || (url.indexOf('?' + name + '=') !== -1)) {
258
- url = url.replace(new RegExp(name + "=([^&#]*)", 'g'), name + '=' + value);
259
- } else {
260
- url += url.match(/\?/) ? '&' : '?';
261
- url += name + '=' + value;
262
- }
263
- }
264
- return url + (m[1] ? '#' + m[1] : '');
265
- };
266
- String.prototype.removeQueryVar = function (name) {
267
- var url = this;
268
- var m = url.split('#');
269
- url = m[0];
270
- name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
271
- var regex = new RegExp("[\\?&]" + name + "([\[][^=]*)?=([^&#]*)", 'g');
272
- url = url.replace(regex, '');
273
- return url + (m[1] ? '#' + m[1] : '');
274
- };
275
-
276
- if ($.isEmptyObject("") === false) {
277
- $.isEmptyObject = function (a) {
278
- for (prop in a) {
279
- if (a.hasOwnProperty(prop)) {
280
- return false;
281
- }
282
- }
283
- return true;
284
- };
285
- }
286
-
287
- LP.MessageBox = {
288
- /*
289
- *
290
- */
291
- $block: null,
292
- $window: null,
293
- events: {},
294
- instances: [],
295
- instance: null,
296
- quickConfirm: function (elem, args) {
297
- var $e = $(elem);
298
- $('[learn-press-quick-confirm]').each(function () {
299
- ($ins = $(this).data('quick-confirm')) && (console.log($ins), $ins.destroy());
300
- });
301
- !$e.attr('learn-press-quick-confirm') && $e.attr('learn-press-quick-confirm', 'true').data('quick-confirm',
302
- new (function (elem, args) {
303
- var $elem = $(elem),
304
- $div = $('<span class="learn-press-quick-confirm"></span>').insertAfter($elem), //($(document.body)),
305
- offset = $(elem).position() || {left: 0, top: 0},
306
- timerOut = null,
307
- timerHide = null,
308
- n = 3,
309
- hide = function () {
310
- $div.fadeOut('fast', function () {
311
- $(this).remove();
312
- $div.parent().css('position', '');
313
- });
314
- $elem.removeAttr('learn-press-quick-confirm').data('quick-confirm', undefined);
315
- stop();
316
- },
317
- stop = function () {
318
- timerHide && clearInterval(timerHide);
319
- timerOut && clearInterval(timerOut);
320
- },
321
- start = function () {
322
- timerOut = setInterval(function () {
323
- if (--n === 0) {
324
- hide.call($div[0]);
325
- $.isFunction(args.onCancel) && args.onCancel(args.data);
326
- stop();
327
- }
328
- $div.find('span').html(' (' + n + ')');
329
- }, 1000);
330
-
331
- timerHide = setInterval(function () {
332
- if (!$elem.is(':visible') || $elem.css("visibility") === 'hidden') {
333
- stop();
334
- $div.remove();
335
- $div.parent().css('position', '');
336
- $.isFunction(args.onCancel) && args.onCancel(args.data);
337
- }
338
- }, 350);
339
- };
340
- args = $.extend({
341
- message: '',
342
- data: null,
343
- onOk: null,
344
- onCancel: null,
345
- offset: {top: 0, left: 0}
346
- }, args || {});
347
- $div.html(args.message || $elem.attr('data-confirm-remove') || 'Are you sure?').append('<span> (' + n + ')</span>').css({});
348
- $div.click(function () {
349
- $.isFunction(args.onOk) && args.onOk(args.data);
350
- hide();
351
- }).hover(function () {
352
- stop();
353
- }, function () {
354
- start();
355
- });
356
- //$div.parent().css('position', 'relative');
357
- $div.css({
358
- left: ((offset.left + $elem.outerWidth()) - $div.outerWidth()) + args.offset.left,
359
- top: offset.top + $elem.outerHeight() + args.offset.top + 5
360
- }).hide().fadeIn('fast');
361
- start();
362
 
363
  this.destroy = function () {
364
  $div.remove();
@@ -684,7 +684,7 @@ if (typeof window.LP === 'undefined') {
684
  dataType = args.dataType || 'json',
685
  data = args.action ? $.extend(args.data, {'lp-ajax': args.action}) : args.data,
686
  beforeSend = args.beforeSend || function () {
687
- },
688
  url = args.url || window.location.href;
689
  // console.debug( beforeSend );
690
  $.ajax({
@@ -815,7 +815,7 @@ if (typeof window.LP === 'undefined') {
815
  }
816
  if (reqWidth > seed.length) { // so short we pad
817
  return new Array(1 + (reqWidth - seed.length))
818
- .join('0') + seed;
819
  }
820
  return seed;
821
  };
@@ -832,7 +832,7 @@ if (typeof window.LP === 'undefined') {
832
 
833
  retId = prefix; // start with prefix, add current milliseconds hex string
834
  retId += formatSeed(parseInt(new Date()
835
- .getTime() / 1000, 10), 8);
836
  retId += formatSeed(this.php_js.uniqidSeed, 5); // add seed hex string
837
  if (more_entropy) {
838
  // for more entropy we add a float lower to 10
@@ -887,7 +887,7 @@ if (typeof window.LP === 'undefined') {
887
  });
888
  return $el;
889
  },
890
- template: _.memoize(function (id, data) {
891
  var compiled,
892
  options = {
893
  evaluate: /<#([\s\S]+?)#>/g,
@@ -903,7 +903,9 @@ if (typeof window.LP === 'undefined') {
903
  return data ? tmpl(data) : tmpl;
904
  }, function (a, b) {
905
  return a + '-' + JSON.stringify(b);
906
- }),
 
 
907
  alert: function (localize, callback) {
908
  var title = '',
909
  message = '';
@@ -1060,8 +1062,11 @@ if (typeof window.LP === 'undefined') {
1060
  });
1061
  };
1062
 
 
 
1063
  function QuickTip(el, options) {
1064
- var $el = $(el);
 
1065
 
1066
  options = $.extend({
1067
  event: 'hover',
@@ -1072,17 +1077,27 @@ if (typeof window.LP === 'undefined') {
1072
  tipClass: ''
1073
  }, options, $el.data());
1074
 
1075
- var content = $el.data('content-tip') || $el.html(),
 
 
1076
  $tip = $('<div class="learn-press-tip-floating">' + content + '</div>'),
1077
  t = null,
1078
  closeInterval = 0,
1079
  useData = false,
1080
- arrowOffset = options.arrowOffset == 'el' ? $el.outerWidth() / 2 : 8;
 
 
 
 
 
 
 
1081
 
1082
  $tip.addClass(options.tipClass);
1083
 
 
1084
  if ($el.attr('data-content-tip')) {
1085
- $el.removeAttr('data-content-tip');
1086
  useData = true;
1087
  }
1088
 
@@ -1142,6 +1157,10 @@ if (typeof window.LP === 'undefined') {
1142
  show();
1143
  })
1144
  }
 
 
 
 
1145
  $el.hover(
1146
  function (e) {
1147
  e.stopPropagation();
@@ -1156,7 +1175,6 @@ if (typeof window.LP === 'undefined') {
1156
  }
1157
  }
1158
  ).addClass('ready');
1159
-
1160
  return {
1161
  close: close,
1162
  open: open
@@ -1315,9 +1333,9 @@ if (typeof window.LP === 'undefined') {
1315
  });
1316
  })();
1317
 
1318
- $(document).on('click', '[data-block-content="yes"]', function () {
1319
- LP.blockContent();
1320
- });
1321
 
1322
  $('.learn-press-tooltip, .lp-passing-conditional').LP_Tooltip({offset: [24, 24]});
1323
 
@@ -1331,9 +1349,11 @@ if (typeof window.LP === 'undefined') {
1331
  }, delay, $el);
1332
  }
1333
  });
 
 
 
 
1334
  });
1335
  LearnPress = LP;
1336
 
1337
- })(jQuery);
1338
-
1339
-
1
  /**
2
  * Common functions/utils used in all page
3
  */
4
+ if (typeof window.LP == 'undefined') {
5
+ window.LP = window.LearnPress = {};
 
 
6
  }
7
 
8
 
119
  var keys = this.name.match(validate),
120
  objPath = "indexed['" + match[0] + "']";
121
 
122
+ if (keys) {
123
+ if (typeof indexed[match[0]] != 'object') {
124
+ indexed[match[0]] = {};
125
+ }
126
+
127
+ $.each(keys, function (i, prop) {
128
+ prop = prop.replace(/\]|\[/g, '');
129
+ var rawPath = objPath.replace(/'|\[|\]/g, ''),
130
+ objExp = '',
131
+ preObjPath = objPath;
132
+
133
+ if (prop == '') {
134
+ if (arrayKeys[rawPath] == undefined) {
135
+ arrayKeys[rawPath] = 0;
136
+ } else {
137
+ arrayKeys[rawPath]++;
138
+ }
139
+ objPath += "['" + arrayKeys[rawPath] + "']";
140
+ } else {
141
+ if (!isNaN(prop)) {
142
+ arrayKeys[rawPath] = prop;
143
+ }
144
+ objPath += "['" + prop + "']";
145
+ }
146
+ try {
147
+ if (i == keys.length - 1) {
148
+ objExp = objPath + "=that.value;";
149
+ end = true;
150
+ } else {
151
+ objExp = objPath + "={}";
152
+ end = false;
153
+ }
154
 
155
  var evalString = "" +
156
  "if( typeof " + objPath + " == 'undefined'){" + objExp + ";" +
186
  if (!content || ($el.data('LP_Tooltip') !== undefined)) {
187
  return;
188
  }
189
+
190
+ console.log(content);
191
  var $tooltip = null;
192
  $el.hover(function (e) {
193
  $tooltip = $('<div class="learn-press-tooltip-bubble"/>').html(content).appendTo($('body')).hide();
199
  position.left += left;
200
  } else {
201
 
202
+ }
203
+ if ($.isNumeric(top)) {
204
+ position.top += top;
205
+ } else {
206
+
207
+ }
208
+ }
209
+ $tooltip.css({
210
+ top : position.top,
211
+ left: position.left
212
+ });
213
+ $tooltip.fadeIn();
214
+ }, function () {
215
+ $tooltip && $tooltip.remove();
216
+ });
217
+ $el.data('tooltip', true);
218
+ });
219
+ };
220
+ $.fn.hasEvent = function (name) {
221
+ var events = $(this).data('events');
222
+ if (typeof events.LP == 'undefined') {
223
+ return false;
224
+ }
225
+ for (i = 0; i < events.LP.length; i++) {
226
+ if (events.LP[i].namespace == name) {
227
+ return true;
228
+ }
229
+ }
230
+ return false;
231
+ };
232
+ $.fn.dataToJSON = function () {
233
+ var json = {};
234
+ $.each(this[0].attributes, function () {
235
+ var m = this.name.match(/^data-(.*)/);
236
+ if (m) {
237
+ json[m[1]] = this.value;
238
+ }
239
+ });
240
+ return json;
241
+ };
242
+
243
+ String.prototype.getQueryVar = function (name) {
244
+ name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
245
+ var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
246
+ results = regex.exec(this);
247
+ return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
248
+ };
249
+ String.prototype.addQueryVar = function (name, value) {
250
+ var url = this,
251
+ m = url.split('#');
252
+ url = m[0];
253
+ if (name.match(/\[/)) {
254
+ url += url.match(/\?/) ? '&' : '?';
255
+ url += name + '=' + value;
256
+ } else {
257
+ if ((url.indexOf('&' + name + '=') != -1) || (url.indexOf('?' + name + '=') != -1)) {
258
+ url = url.replace(new RegExp(name + "=([^&#]*)", 'g'), name + '=' + value);
259
+ } else {
260
+ url += url.match(/\?/) ? '&' : '?';
261
+ url += name + '=' + value;
262
+ }
263
+ }
264
+ return url + (m[1] ? '#' + m[1] : '');
265
+ };
266
+ String.prototype.removeQueryVar = function (name) {
267
+ var url = this;
268
+ var m = url.split('#');
269
+ url = m[0];
270
+ name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
271
+ var regex = new RegExp("[\\?&]" + name + "([\[][^=]*)?=([^&#]*)", 'g');
272
+ url = url.replace(regex, '');
273
+ return url + (m[1] ? '#' + m[1] : '');
274
+ };
275
+
276
+ if ($.isEmptyObject("") == false) {
277
+ $.isEmptyObject = function (a) {
278
+ for (prop in a) {
279
+ if (a.hasOwnProperty(prop)) {
280
+ return false;
281
+ }
282
+ }
283
+ return true;
284
+ };
285
+ }
286
+
287
+ LP.MessageBox = {
288
+ /*
289
+ *
290
+ */
291
+ $block : null,
292
+ $window : null,
293
+ events : {},
294
+ instances : [],
295
+ instance : null,
296
+ quickConfirm : function (elem, args) {
297
+ var $e = $(elem);
298
+ $('[learn-press-quick-confirm]').each(function () {
299
+ ( $ins = $(this).data('quick-confirm') ) && ( console.log($ins), $ins.destroy() );
300
+ });
301
+ !$e.attr('learn-press-quick-confirm') && $e.attr('learn-press-quick-confirm', 'true').data('quick-confirm',
302
+ new (function (elem, args) {
303
+ var $elem = $(elem),
304
+ $div = $('<span class="learn-press-quick-confirm"></span>').insertAfter($elem), //($(document.body)),
305
+ offset = $(elem).position() || {left: 0, top: 0},
306
+ timerOut = null,
307
+ timerHide = null,
308
+ n = 3,
309
+ hide = function () {
310
+ $div.fadeOut('fast', function () {
311
+ $(this).remove();
312
+ $div.parent().css('position', '');
313
+ });
314
+ $elem.removeAttr('learn-press-quick-confirm').data('quick-confirm', undefined);
315
+ stop();
316
+ },
317
+ stop = function () {
318
+ timerHide && clearInterval(timerHide);
319
+ timerOut && clearInterval(timerOut);
320
+ },
321
+ start = function () {
322
+ timerOut = setInterval(function () {
323
+ if (--n == 0) {
324
+ hide.call($div[0]);
325
+ $.isFunction(args.onCancel) && args.onCancel(args.data);
326
+ stop();
327
+ }
328
+ $div.find('span').html(' (' + n + ')');
329
+ }, 1000);
330
+
331
+ timerHide = setInterval(function () {
332
+ if (!$elem.is(':visible') || $elem.css("visibility") == 'hidden') {
333
+ stop();
334
+ $div.remove();
335
+ $div.parent().css('position', '');
336
+ $.isFunction(args.onCancel) && args.onCancel(args.data);
337
+ }
338
+ }, 350);
339
+ };
340
+ args = $.extend({
341
+ message : '',
342
+ data : null,
343
+ onOk : null,
344
+ onCancel: null,
345
+ offset : {top: 0, left: 0}
346
+ }, args || {});
347
+ $div.html(args.message || $elem.attr('data-confirm-remove') || 'Are you sure?').append('<span> (' + n + ')</span>').css({});
348
+ $div.click(function () {
349
+ $.isFunction(args.onOk) && args.onOk(args.data);
350
+ hide();
351
+ }).hover(function () {
352
+ stop();
353
+ }, function () {
354
+ start();
355
+ });
356
+ //$div.parent().css('position', 'relative');
357
+ $div.css({
358
+ left: ( ( offset.left + $elem.outerWidth() ) - $div.outerWidth() ) + args.offset.left,
359
+ top : offset.top + $elem.outerHeight() + args.offset.top + 5
360
+ }).hide().fadeIn('fast');
361
+ start();
362
 
363
  this.destroy = function () {
364
  $div.remove();
684
  dataType = args.dataType || 'json',
685
  data = args.action ? $.extend(args.data, {'lp-ajax': args.action}) : args.data,
686
  beforeSend = args.beforeSend || function () {
687
+ },
688
  url = args.url || window.location.href;
689
  // console.debug( beforeSend );
690
  $.ajax({
815
  }
816
  if (reqWidth > seed.length) { // so short we pad
817
  return new Array(1 + (reqWidth - seed.length))
818
+ .join('0') + seed;
819
  }
820
  return seed;
821
  };
832
 
833
  retId = prefix; // start with prefix, add current milliseconds hex string
834
  retId += formatSeed(parseInt(new Date()
835
+ .getTime() / 1000, 10), 8);
836
  retId += formatSeed(this.php_js.uniqidSeed, 5); // add seed hex string
837
  if (more_entropy) {
838
  // for more entropy we add a float lower to 10
887
  });
888
  return $el;
889
  },
890
+ template: typeof _ !== 'undefined' ? _.memoize(function (id, data) {
891
  var compiled,
892
  options = {
893
  evaluate: /<#([\s\S]+?)#>/g,
903
  return data ? tmpl(data) : tmpl;
904
  }, function (a, b) {
905
  return a + '-' + JSON.stringify(b);
906
+ }) : function () {
907
+ return '';
908
+ },
909
  alert: function (localize, callback) {
910
  var title = '',
911
  message = '';
1062
  });
1063
  };
1064
 
1065
+ var xxx = 0;
1066
+
1067
  function QuickTip(el, options) {
1068
+ var $el = $(el),
1069
+ uniId = $el.attr('data-id') || LP.uniqueId();
1070
 
1071
  options = $.extend({
1072
  event: 'hover',
1077
  tipClass: ''
1078
  }, options, $el.data());
1079
 
1080
+ $el.attr('data-id', uniId);
1081
+
1082
+ var content = $el.attr('data-content-tip') || $el.html(),
1083
  $tip = $('<div class="learn-press-tip-floating">' + content + '</div>'),
1084
  t = null,
1085
  closeInterval = 0,
1086
  useData = false,
1087
+ arrowOffset = options.arrowOffset === 'el' ? $el.outerWidth() / 2 : 8,
1088
+ $content = $('#__' + uniId);
1089
+
1090
+ if ($content.length === 0) {
1091
+ $(document.body).append($('<div />').attr('id', '__' + uniId).html(content).css('display', 'none'))
1092
+ }
1093
+
1094
+ content = $content.html();
1095
 
1096
  $tip.addClass(options.tipClass);
1097
 
1098
+ $el.data('content-tip', content);
1099
  if ($el.attr('data-content-tip')) {
1100
+ //$el.removeAttr('data-content-tip');
1101
  useData = true;
1102
  }
1103
 
1157
  show();
1158
  })
1159
  }
1160
+
1161
+ $(document).on('learn-press/close-all-quick-tip', function () {
1162
+ close();
1163
+ });
1164
  $el.hover(
1165
  function (e) {
1166
  e.stopPropagation();
1175
  }
1176
  }
1177
  ).addClass('ready');
 
1178
  return {
1179
  close: close,
1180
  open: open
1333
  });
1334
  })();
1335
 
1336
+ // $(document).on('click', '[data-block-content="yes"]', function () {
1337
+ // LP.blockContent();
1338
+ // });
1339
 
1340
  $('.learn-press-tooltip, .lp-passing-conditional').LP_Tooltip({offset: [24, 24]});
1341
 
1349
  }, delay, $el);
1350
  }
1351
  });
1352
+
1353
+ $(document).on('click', function () {
1354
+ $(document).trigger('learn-press/close-all-quick-tip')
1355
+ })
1356
  });
1357
  LearnPress = LP;
1358
 
1359
+ })(jQuery);
 
 
assets/scss/_mixin.scss CHANGED
@@ -145,3 +145,34 @@
145
  -o-animation: $args;
146
  animation: $args;
147
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  -o-animation: $args;
146
  animation: $args;
147
  }
148
+
149
+ @-webkit-keyframes animation4 /* Safari and Chrome */
150
+ {
151
+ from {
152
+ left: -40%;
153
+ width: 40%;
154
+ }
155
+ to {
156
+ left: 100%;
157
+ width: 10%;
158
+ }
159
+ }
160
+
161
+ @keyframes animation4 {
162
+ from {
163
+ left: -40%;
164