Astra Starter Sites - Version 1.3.4

Version Description

Download this release

Release Info

Developer vrundakansara
Plugin Icon Astra Starter Sites
Version 1.3.4
Comparing to
See all releases

Code changes from version 1.3.3 to 1.3.4

Files changed (39) hide show
  1. astra-sites.php +2 -2
  2. inc/assets/css/admin.css +654 -654
  3. inc/assets/css/install-theme.css +20 -20
  4. inc/assets/js/admin-page.js +1814 -1814
  5. inc/assets/js/astra-sites-api.js +64 -64
  6. inc/assets/js/astra-sites-notices.js +20 -20
  7. inc/assets/js/eventsource.js +673 -673
  8. inc/assets/js/eventsource.min.js +5 -5
  9. inc/assets/js/install-theme.js +107 -107
  10. inc/assets/js/render-grid.js +596 -596
  11. inc/classes/class-astra-sites-importer-log.php +601 -601
  12. inc/classes/class-astra-sites-importer.php +573 -573
  13. inc/classes/class-astra-sites-notices.php +214 -214
  14. inc/classes/class-astra-sites-page.php +360 -360
  15. inc/classes/class-astra-sites-white-label.php +239 -239
  16. inc/classes/class-astra-sites.php +586 -586
  17. inc/classes/compatibility/astra-pro/class-astra-sites-compatibility-astra-pro.php +299 -299
  18. inc/importers/batch-processing/class-astra-sites-batch-processing-beaver-builder.php +261 -261
  19. inc/importers/batch-processing/class-astra-sites-batch-processing-brizy.php +125 -125
  20. inc/importers/batch-processing/class-astra-sites-batch-processing-elementor.php +111 -111
  21. inc/importers/batch-processing/class-astra-sites-batch-processing-gutenberg.php +146 -146
  22. inc/importers/batch-processing/class-astra-sites-batch-processing-misc.php +137 -137
  23. inc/importers/batch-processing/class-astra-sites-batch-processing-widgets.php +97 -97
  24. inc/importers/batch-processing/class-astra-sites-batch-processing.php +209 -209
  25. inc/importers/batch-processing/helpers/class-astra-sites-image-importer.php +263 -263
  26. inc/importers/batch-processing/helpers/class-wp-async-request.php +164 -164
  27. inc/importers/batch-processing/helpers/class-wp-background-process-astra.php +65 -65
  28. inc/importers/batch-processing/helpers/class-wp-background-process.php +513 -513
  29. inc/importers/class-astra-site-options-import.php +289 -289
  30. inc/importers/class-astra-sites-helper.php +311 -311
  31. inc/importers/class-widgets-importer.php +278 -278
  32. inc/importers/wxr-importer/class-astra-wxr-importer.php +441 -441
  33. inc/importers/wxr-importer/class-logger.php +139 -139
  34. inc/importers/wxr-importer/class-wp-importer-logger-serversentevents.php +43 -43
  35. inc/importers/wxr-importer/class-wxr-import-info.php +20 -20
  36. inc/importers/wxr-importer/class-wxr-importer.php +2300 -2300
  37. inc/includes/admin-page.php +410 -410
  38. languages/astra-sites.pot +804 -804
  39. readme.txt +308 -305
astra-sites.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Astra Starter Sites – Elementor, Beaver Builder & Gutenberg Templates
4
  * Plugin URI: http://www.wpastra.com/pro/
5
  * Description: Import free sites build with Astra theme.
6
- * Version: 1.3.3
7
  * Author: Brainstorm Force
8
  * Author URI: http://www.brainstormforce.com
9
  * Text Domain: astra-sites
@@ -19,7 +19,7 @@ if ( ! defined( 'ASTRA_SITES_NAME' ) ) {
19
  }
20
 
21
  if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
- define( 'ASTRA_SITES_VER', '1.3.3' );
23
  }
24
 
25
  if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
3
  * Plugin Name: Astra Starter Sites – Elementor, Beaver Builder & Gutenberg Templates
4
  * Plugin URI: http://www.wpastra.com/pro/
5
  * Description: Import free sites build with Astra theme.
6
+ * Version: 1.3.4
7
  * Author: Brainstorm Force
8
  * Author URI: http://www.brainstormforce.com
9
  * Text Domain: astra-sites
19
  }
20
 
21
  if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
+ define( 'ASTRA_SITES_VER', '1.3.4' );
23
  }
24
 
25
  if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
inc/assets/css/admin.css CHANGED
@@ -1,655 +1,655 @@
1
- .wrap .status,
2
- .wrap .site-type {
3
- position: absolute;
4
- z-index: 1;
5
- color: #fff;
6
- padding: 0.5em 1em;
7
- top: -0.5em;
8
- text-transform: uppercase;
9
- }
10
- .wrap .status,
11
- .wrap .site-type.premium {
12
- background: #0073aa;
13
- }
14
- .wrap .status {
15
- left: -0.5em;
16
- }
17
- .wrap .site-type.premium {
18
- right: -0.5em;
19
- }
20
-
21
- .wrap .status.publish,
22
- .wrap .site-type.free {
23
- display: none;
24
- }
25
-
26
- .install-theme-info .site-type {
27
- display: none;
28
- }
29
-
30
- .theme {
31
- position: relative;
32
- }
33
- .wrap .astra-sites-preview .site-type.premium {
34
- display: block;
35
- display: none;
36
- position: relative;
37
- margin: 0.5em 0em 1em 0em;
38
- top: 0;
39
- left: 0;
40
- text-align: center;
41
- }
42
-
43
- .theme-details-read-more.open {
44
- margin: 0.5em 0 0 0;
45
- }
46
-
47
- .astra-sites-preview .theme-screenshot {
48
- width: 100%;
49
- }
50
-
51
- .install-theme-info .site-type.premium {
52
- display: none;
53
- }
54
-
55
- /**
56
- * Required Plugins
57
- */
58
- .required-plugins.loading {
59
- text-align: center;
60
- }
61
- .required-plugins button {
62
- float: right;
63
- }
64
- .required-plugins .plugin-card {
65
- float: none;
66
- width: 100%;
67
- border: none;
68
- margin: 0 0 0.8em 0;
69
- display: flex;
70
- justify-content: space-between;
71
- align-items: center;
72
- transition: background ease 0.8s;
73
- }
74
- .required-plugins .plugin-card.plugin-card-update-failed {
75
- flex-wrap: wrap;
76
- }
77
- .required-plugins .spinner {
78
- float: none;
79
- margin: 0;
80
- }
81
-
82
- .expanded .wp-full-overlay-footer {
83
- height: 111px;
84
- }
85
-
86
- .wp-full-overlay-footer .view-site,
87
- .wp-full-overlay-footer .go-pro,
88
- .wp-full-overlay-footer .astra-demo-import {
89
- width: 100%;
90
- text-align: center;
91
- }
92
-
93
- .wp-core-ui .wp-full-overlay-footer .button.button-hero,
94
- .wp-core-ui .wp-full-overlay-footer .button-group.button-hero .button {
95
- padding: 0 10px 1px;
96
- }
97
-
98
- .wp-full-overlay-footer .installing:before {
99
- vertical-align: text-bottom;
100
- }
101
-
102
- .astra-sites-advanced-options-wrap h4 {
103
- margin: 1em 0 0.5em 0;
104
- padding: 0.5em 0;
105
- transition: all ease 0.3s;
106
- }
107
-
108
- /**
109
- * Read more link
110
- */
111
- .wp-core-ui .theme-details-read-more:focus,
112
- .wp-core-ui .theme-details-read-more:hover {
113
- outline: none;
114
- box-shadow: none;
115
- }
116
- .wp-core-ui .theme-details-read-more {
117
- margin: 10px 0;
118
- display: none;
119
- text-decoration: none;
120
- }
121
-
122
- /**
123
- * Go pro.
124
- */
125
- .wp-core-ui .go-pro.button[disabled] {
126
- background-color: #fcb92c !important;
127
- color: white !important;
128
- box-shadow: 1px 0 #eab23a !important;
129
- text-shadow: 1px 0 #6b4e13 !important;
130
- border-color: #e2a932 !important;
131
- cursor: pointer;
132
- }
133
- .wp-core-ui .view-site .dashicons,
134
- .wp-core-ui .go-pro .dashicons {
135
- font-size: 1rem;
136
- vertical-align: middle;
137
- }
138
-
139
- /**
140
- * Errors
141
- */
142
- .plugin-card-update-failed .notice {
143
- margin-top: 1.5em;
144
- }
145
-
146
- .no-themes {
147
- margin-top: 40px;
148
- }
149
-
150
- .no-themes p {
151
- font-size: 15px;
152
- }
153
-
154
- .no-themes .left-margin {
155
- margin-left: 30px;
156
- }
157
-
158
- /**
159
- *
160
- */
161
- .astra-sites-preview .wp-full-overlay-sidebar-content {
162
- bottom: 100px;
163
- }
164
-
165
- .footer-import-button-wrap {
166
- padding: 10px 20px;
167
- }
168
-
169
- .footer-import-button-wrap .button {
170
- margin: 0;
171
- }
172
-
173
- .astra-sites-preview.expanded .wp-full-overlay-footer {
174
- left: initial;
175
- }
176
-
177
- /**
178
- * Menu Page
179
- */
180
- .astra-sites-title {
181
- float: left;
182
- font-size: 23px;
183
- font-weight: 400;
184
- margin: 0 0 6px 0px;
185
- padding: 0;
186
- line-height: 29px;
187
- }
188
-
189
- #astra-sites-menu-page {
190
- margin-top: 10px;
191
- }
192
-
193
- /**
194
- * API Error
195
- */
196
- .astra-api-error {
197
- margin: 0 0 0.5em 0;
198
- }
199
-
200
- /**
201
- * Grid
202
- */
203
- .wp-filter .search-form {
204
- margin-left: 1em;
205
- }
206
- .wp-filter .search-form input[type="search"] {
207
- width: 200px;
208
- font-size: 13px;
209
- padding: 5px 10px;
210
- }
211
- .section-left {
212
- display: inline-block;
213
- }
214
- .section-right {
215
- float: right;
216
- }
217
- .filter-count {
218
- min-width: 3em;
219
- }
220
- .astra-site-preview-on {
221
- overflow: hidden;
222
- }
223
-
224
- .appearance_page_astra-sites .notice {
225
- margin-left: 0;
226
- width: auto;
227
- float: none;
228
- }
229
- .filters-wrap {
230
- display: inline-block;
231
- }
232
- .spinner-wrap {
233
- text-align: center;
234
- }
235
- .spinner-wrap .spinner {
236
- float: none;
237
- }
238
- .hide-me {
239
- display: none !important;
240
- }
241
- #astra-sites-admin {
242
- height: 100vh;
243
- }
244
- .install-theme-info > .notice {
245
- margin: 5px 0 10px 0;
246
- }
247
-
248
- .astra-sites-suggestions:before {
249
- border: 5px dashed #ccc;
250
- position: absolute;
251
- left: 0;
252
- right: 0;
253
- top: 0;
254
- bottom: 0px;
255
- }
256
-
257
- .astra-sites-suggestions {
258
- min-height: 280px;
259
- border: none !important;
260
- }
261
-
262
- .astra-sites-suggestions a {
263
- border: none;
264
- outline: none;
265
- }
266
-
267
- .astra-sites-suggestions .inner {
268
- border: 6px solid #24282e !important;
269
- padding: 27% 10% 50% 10%;
270
- text-align: center;
271
- position: absolute;
272
- left: 0;
273
- right: 0;
274
- top: 0;
275
- background: #33383d;
276
- bottom: 0;
277
- color: #eee;
278
- cursor: auto;
279
- }
280
-
281
- .astra-sites-suggestions .inner a {
282
- color: #00b9eb;
283
- }
284
-
285
- .astra-sites-suggestions p {
286
- font-size: 1rem;
287
- margin: 0;
288
- }
289
-
290
- .astra-notice {
291
- margin: 2em 2em 0em 0em;
292
- }
293
-
294
- .no-themes .description {
295
- display: block;
296
- }
297
-
298
- /**
299
- * Responsive Button UI
300
- */
301
- .astra-sites-preview .wp-full-overlay-footer .devices button.active:before,
302
- .astra-sites-preview .wp-full-overlay-footer .devices button:hover:before {
303
- color: #0073aa;
304
- }
305
- .astra-sites-preview .wp-full-overlay-footer .devices button:before {
306
- color: #c1c1c1;
307
- }
308
- .astra-sites-preview .wp-full-overlay-footer .devices button:hover {
309
- background-color: transparent;
310
- }
311
- .astra-sites-preview .wp-full-overlay-footer .devices button {
312
- border: none;
313
- }
314
- .astra-sites-preview .wp-full-overlay-footer .devices button:focus,
315
- .astra-sites-preview .wp-full-overlay-footer .devices button.active:hover {
316
- border-bottom-color: transparent;
317
- background-color: transparent;
318
- }
319
- .not-click-able {
320
- pointer-events: none !important;
321
- }
322
- body.page-builder-selected .select-page-builder,
323
- body.loading-content .select-page-builder {
324
- display: none;
325
- }
326
- .select-page-builder .up-arrow {
327
- -webkit-transform: rotate(90deg);
328
- -moz-transform: rotate(90deg);
329
- -ms-transform: rotate(90deg);
330
- transform: rotate(90deg);
331
- display: inline-block;
332
- font-size: 1.5em;
333
- color: #797979;
334
- vertical-align: middle;
335
- margin-right: 10px;
336
- -webkit-transition: all linear 0.6s;
337
- -moz-transition: all linear 0.6s;
338
- -ms-transition: all linear 0.6s;
339
- transition: all linear 0.6s;
340
- -webkit-animation-duration: 1s;
341
- animation-duration: 1s;
342
- -webkit-animation-fill-mode: both;
343
- animation-fill-mode: both;
344
- -webkit-animation-timing-function: ease-in-out;
345
- animation-timing-function: ease-in-out;
346
- animation-iteration-count: infinite;
347
- -webkit-animation-iteration-count: infinite;
348
- animation-name: bounce;
349
- -moz-animation-name: bounce;
350
- }
351
- .select-page-builder {
352
- margin-left: 6em;
353
- }
354
-
355
- .select-page-builder img {
356
- max-width: 100%;
357
- }
358
-
359
- .select-page-builder .note-wrap {
360
- position: absolute;
361
- padding: 40px 0;
362
- margin-left: 170px;
363
- right: 0;
364
- left: 0;
365
- }
366
-
367
- .select-page-builder h3 {
368
- margin: 0;
369
- font-size: 2em;
370
- }
371
- .select-page-builder {
372
- margin: -20px 0 0 -5px;
373
- position: absolute;
374
- }
375
- .select-page-builder .note {
376
- margin-left: 1.5em;
377
- }
378
-
379
- @keyframes bounce {
380
- 0%,
381
- 100%,
382
- 20%,
383
- 50%,
384
- 80% {
385
- -webkit-transform: translateY(-0px) rotate(90deg);
386
- -moz-transform: translateY(-0px) rotate(90deg);
387
- -ms-transform: translateY(-0px) rotate(90deg);
388
- transform: translateY(-0px) rotate(90deg);
389
- }
390
- 40% {
391
- -webkit-transform: translateY(-2px) rotate(90deg);
392
- -moz-transform: translateY(-2px) rotate(90deg);
393
- -ms-transform: translateY(-2px) rotate(90deg);
394
- transform: translateY(-2px) rotate(90deg);
395
- }
396
- 60% {
397
- -webkit-transform: translateY(-1px) rotate(90deg);
398
- -moz-transform: translateY(-1px) rotate(90deg);
399
- -ms-transform: translateY(-1px) rotate(90deg);
400
- transform: translateY(-1px) rotate(90deg);
401
- }
402
- }
403
-
404
- /**
405
- * Processing Animation
406
- */
407
- .astra-demo-import.disabled {
408
- pointer-events: none;
409
- }
410
- .astra-demo-import.button.updating-message:before,
411
- .astra-demo-import.button.installing:before {
412
- -webkit-animation: cssAnimation .72s ease infinite;
413
- -moz-animation: cssAnimation .72s ease infinite;
414
- -o-animation: cssAnimation .72s ease infinite;
415
- -ms-animation: cssAnimation .72s ease infinite;
416
- animation: cssAnimation .72s ease infinite;
417
- }
418
-
419
- @-webkit-keyframes cssAnimation {
420
- from {
421
- -webkit-transform: rotate(0);
422
- -moz-transform: rotate(0);
423
- -o-transform: rotate(0);
424
- -ms-transform: rotate(0);
425
- transform: rotate(0);
426
- }
427
- to {
428
- -webkit-transform: rotate(360deg);
429
- -moz-transform: rotate(360deg);
430
- -o-transform: rotate(360deg);
431
- -ms-transform: rotate(360deg);
432
- transform: rotate(360deg);
433
- }
434
- }
435
- @-moz-keyframes cssAnimation {
436
- from {
437
- -webkit-transform: rotate(0);
438
- -moz-transform: rotate(0);
439
- -o-transform: rotate(0);
440
- -ms-transform: rotate(0);
441
- transform: rotate(0);
442
- }
443
- to {
444
- -webkit-transform: rotate(360deg);
445
- -moz-transform: rotate(360deg);
446
- -o-transform: rotate(360deg);
447
- -ms-transform: rotate(360deg);
448
- transform: rotate(360deg);
449
- }
450
- }
451
- @-o-keyframes cssAnimation {
452
- from {
453
- -webkit-transform: rotate(0);
454
- -moz-transform: rotate(0);
455
- -o-transform: rotate(0);
456
- -ms-transform: rotate(0);
457
- transform: rotate(0);
458
- }
459
- to {
460
- -webkit-transform: rotate(360deg);
461
- -moz-transform: rotate(360deg);
462
- -o-transform: rotate(360deg);
463
- -ms-transform: rotate(360deg);
464
- transform: rotate(360deg);
465
- }
466
- }
467
-
468
- #astra-sites-filters {
469
- display: inline-block;
470
- width: 100%;
471
- }
472
-
473
- .astra-site-down {
474
- padding: 1em 2em;
475
- margin-top: 1em;
476
- }
477
-
478
- #astra-sites-menu-page .nav-tab-wrapper {
479
- border: none;
480
- }
481
-
482
- #astra-sites-filters .wp-filter {
483
- margin-top: 0;
484
- }
485
-
486
- /**
487
- * Welcome Screen
488
- */
489
- .astra-sites-welcome {
490
- padding: 10em 0;
491
- text-align: center;
492
- }
493
- .astra-sites-welcome .inner {
494
- margin: 0 auto;
495
- display: inline-block;
496
- max-width: 700px;
497
- background: #fff;
498
- padding: 3em;
499
- }
500
-
501
- .astra-sites-welcome h1 {
502
- font-size: 2.5em;
503
- margin-bottom: 1em;
504
- }
505
-
506
- .astra-sites-welcome p.description {
507
- font-size: 1rem;
508
- margin-bottom: 2em;
509
- }
510
-
511
- .astra-sites-welcome select {
512
- padding: 5px;
513
- height: 100%;
514
- }
515
-
516
- .astra-sites-welcome p.submit {
517
- text-align: center;
518
- margin: 0;
519
- padding: 0;
520
- margin-left: .5em;
521
- }
522
-
523
- .astra-sites-welcome .fields {
524
- display: flex;
525
- vertical-align: middle;
526
- align-items: center;
527
- justify-content: center;
528
- }
529
-
530
- .astra-sites-welcome #submit {
531
- line-height: 1;
532
- padding: .5rem 1rem;
533
- height: auto;
534
- }
535
-
536
- .astra-site-page-builder {
537
- opacity: 0;
538
- visibility: hidden;
539
- }
540
-
541
- .required-plugins-list {
542
- margin-left: 2em;
543
- margin-top: .5em;
544
- margin-bottom: .5em;
545
- list-style-type: disc;
546
- }
547
-
548
- .required-plugins-list .plugin-card {
549
- background: transparent;
550
- border: none;
551
- margin: 0;
552
- line-height: 2;
553
- float: none;
554
- width: 100%;
555
- }
556
-
557
- .required-plugins-list .spinner {
558
- float: none;
559
- margin: 0;
560
- }
561
-
562
- #astra-site-import-process-wrap {
563
- display: flex;
564
- align-items: center;
565
- margin-top: -2px;
566
- z-index: 999999;
567
- position: relative;
568
- border-radius: 3px;
569
- overflow: hidden;
570
- }
571
- #astra-site-import-process-wrap progress {
572
- padding: 0px;
573
- border: 0 none;
574
- background: #0085bd;
575
- border-radius: 5px;
576
- height: 4px;
577
- flex: 1;
578
- }
579
-
580
- #astra-site-import-process-wrap progress::-webkit-progress-value {
581
- background: #00679b;
582
- }
583
- #astra-site-import-process-wrap progress::-webkit-progress-bar {
584
- background: transparent;
585
- }
586
-
587
- .theme-browser .theme .site-preview > .theme-screenshot {
588
- transition: all linear 5s;
589
- background-position: center top;
590
- background-size: cover;
591
- background-repeat: no-repeat;
592
- }
593
- .theme-browser .theme .site-preview > .theme-screenshot:hover {
594
- background-position: center bottom;
595
- background-size: cover;
596
- }
597
-
598
- .astra-sites-tooltip-icon {
599
- cursor: pointer;
600
- }
601
-
602
- .astra-sites-preview .disabled {
603
- pointer-events: none;
604
- }
605
-
606
- .astra-sites-tooltip-icon .dashicons {
607
- color: #5d5d5d;
608
- font-size: 18px;
609
- }
610
-
611
- #astra-sites-welcome-form-inline {
612
- position: absolute;
613
- right: 1em;
614
- top: 0;
615
- border-radius: 0;
616
- line-height: 1.7;
617
- padding: 0px 5px 2px 5px;
618
- outline: 2px solid transparent;
619
- outline-offset: 0;
620
- background: #fafafa;
621
- border: 1px solid #ccc;
622
- color: #72777c;
623
- font-weight: normal;
624
- font-size: 10px;
625
- font-size: 13px;
626
- line-height: 26px;
627
- height: 28px;
628
- cursor: pointer;
629
- }
630
-
631
- #astra-sites-welcome-form-inline select,
632
- #astra-sites-welcome-form-inline select:focus {
633
- border: none;
634
- outline: none;
635
- box-shadow: none;
636
- color: #72777c;
637
- }
638
-
639
- #astra-sites-menu-page .wp-full-overlay-main:before {
640
- content: '';
641
- display: none;
642
- }
643
-
644
- .theme-screenshot-wrap {
645
- overflow: hidden;
646
- max-height: 300px;
647
- margin: 15px 0;
648
- border: 1px solid #ccc;
649
- }
650
-
651
- .astra-sites-preview .install-theme-info .theme-screenshot {
652
- width: 100%;
653
- border: none;
654
- margin: 0;
655
  }
1
+ .wrap .status,
2
+ .wrap .site-type {
3
+ position: absolute;
4
+ z-index: 1;
5
+ color: #fff;
6
+ padding: 0.5em 1em;
7
+ top: -0.5em;
8
+ text-transform: uppercase;
9
+ }
10
+ .wrap .status,
11
+ .wrap .site-type.premium {
12
+ background: #0073aa;
13
+ }
14
+ .wrap .status {
15
+ left: -0.5em;
16
+ }
17
+ .wrap .site-type.premium {
18
+ right: -0.5em;
19
+ }
20
+
21
+ .wrap .status.publish,
22
+ .wrap .site-type.free {
23
+ display: none;
24
+ }
25
+
26
+ .install-theme-info .site-type {
27
+ display: none;
28
+ }
29
+
30
+ .theme {
31
+ position: relative;
32
+ }
33
+ .wrap .astra-sites-preview .site-type.premium {
34
+ display: block;
35
+ display: none;
36
+ position: relative;
37
+ margin: 0.5em 0em 1em 0em;
38
+ top: 0;
39
+ left: 0;
40
+ text-align: center;
41
+ }
42
+
43
+ .theme-details-read-more.open {
44
+ margin: 0.5em 0 0 0;
45
+ }
46
+
47
+ .astra-sites-preview .theme-screenshot {
48
+ width: 100%;
49
+ }
50
+
51
+ .install-theme-info .site-type.premium {
52
+ display: none;
53
+ }
54
+
55
+ /**
56
+ * Required Plugins
57
+ */
58
+ .required-plugins.loading {
59
+ text-align: center;
60
+ }
61
+ .required-plugins button {
62
+ float: right;
63
+ }
64
+ .required-plugins .plugin-card {
65
+ float: none;
66
+ width: 100%;
67
+ border: none;
68
+ margin: 0 0 0.8em 0;
69
+ display: flex;
70
+ justify-content: space-between;
71
+ align-items: center;
72
+ transition: background ease 0.8s;
73
+ }
74
+ .required-plugins .plugin-card.plugin-card-update-failed {
75
+ flex-wrap: wrap;
76
+ }
77
+ .required-plugins .spinner {
78
+ float: none;
79
+ margin: 0;
80
+ }
81
+
82
+ .expanded .wp-full-overlay-footer {
83
+ height: 111px;
84
+ }
85
+
86
+ .wp-full-overlay-footer .view-site,
87
+ .wp-full-overlay-footer .go-pro,
88
+ .wp-full-overlay-footer .astra-demo-import {
89
+ width: 100%;
90
+ text-align: center;
91
+ }
92
+
93
+ .wp-core-ui .wp-full-overlay-footer .button.button-hero,
94
+ .wp-core-ui .wp-full-overlay-footer .button-group.button-hero .button {
95
+ padding: 0 10px 1px;
96
+ }
97
+
98
+ .wp-full-overlay-footer .installing:before {
99
+ vertical-align: text-bottom;
100
+ }
101
+
102
+ .astra-sites-advanced-options-wrap h4 {
103
+ margin: 1em 0 0.5em 0;
104
+ padding: 0.5em 0;
105
+ transition: all ease 0.3s;
106
+ }
107
+
108
+ /**
109
+ * Read more link
110
+ */
111
+ .wp-core-ui .theme-details-read-more:focus,
112
+ .wp-core-ui .theme-details-read-more:hover {
113
+ outline: none;
114
+ box-shadow: none;
115
+ }
116
+ .wp-core-ui .theme-details-read-more {
117
+ margin: 10px 0;
118
+ display: none;
119
+ text-decoration: none;
120
+ }
121
+
122
+ /**
123
+ * Go pro.
124
+ */
125
+ .wp-core-ui .go-pro.button[disabled] {
126
+ background-color: #fcb92c !important;
127
+ color: white !important;
128
+ box-shadow: 1px 0 #eab23a !important;
129
+ text-shadow: 1px 0 #6b4e13 !important;
130
+ border-color: #e2a932 !important;
131
+ cursor: pointer;
132
+ }
133
+ .wp-core-ui .view-site .dashicons,
134
+ .wp-core-ui .go-pro .dashicons {
135
+ font-size: 1rem;
136
+ vertical-align: middle;
137
+ }
138
+
139
+ /**
140
+ * Errors
141
+ */
142
+ .plugin-card-update-failed .notice {
143
+ margin-top: 1.5em;
144
+ }
145
+
146
+ .no-themes {
147
+ margin-top: 40px;
148
+ }
149
+
150
+ .no-themes p {
151
+ font-size: 15px;
152
+ }
153
+
154
+ .no-themes .left-margin {
155
+ margin-left: 30px;
156
+ }
157
+
158
+ /**
159
+ *
160
+ */
161
+ .astra-sites-preview .wp-full-overlay-sidebar-content {
162
+ bottom: 100px;
163
+ }
164
+
165
+ .footer-import-button-wrap {
166
+ padding: 10px 20px;
167
+ }
168
+
169
+ .footer-import-button-wrap .button {
170
+ margin: 0;
171
+ }
172
+
173
+ .astra-sites-preview.expanded .wp-full-overlay-footer {
174
+ left: initial;
175
+ }
176
+
177
+ /**
178
+ * Menu Page
179
+ */
180
+ .astra-sites-title {
181
+ float: left;
182
+ font-size: 23px;
183
+ font-weight: 400;
184
+ margin: 0 0 6px 0px;
185
+ padding: 0;
186
+ line-height: 29px;
187
+ }
188
+
189
+ #astra-sites-menu-page {
190
+ margin-top: 10px;
191
+ }
192
+
193
+ /**
194
+ * API Error
195
+ */
196
+ .astra-api-error {
197
+ margin: 0 0 0.5em 0;
198
+ }
199
+
200
+ /**
201
+ * Grid
202
+ */
203
+ .wp-filter .search-form {
204
+ margin-left: 1em;
205
+ }
206
+ .wp-filter .search-form input[type="search"] {
207
+ width: 200px;
208
+ font-size: 13px;
209
+ padding: 5px 10px;
210
+ }
211
+ .section-left {
212
+ display: inline-block;
213
+ }
214
+ .section-right {
215
+ float: right;
216
+ }
217
+ .filter-count {
218
+ min-width: 3em;
219
+ }
220
+ .astra-site-preview-on {
221
+ overflow: hidden;
222
+ }
223
+
224
+ .appearance_page_astra-sites .notice {
225
+ margin-left: 0;
226
+ width: auto;
227
+ float: none;
228
+ }
229
+ .filters-wrap {
230
+ display: inline-block;
231
+ }
232
+ .spinner-wrap {
233
+ text-align: center;
234
+ }
235
+ .spinner-wrap .spinner {
236
+ float: none;
237
+ }
238
+ .hide-me {
239
+ display: none !important;
240
+ }
241
+ #astra-sites-admin {
242
+ height: 100vh;
243
+ }
244
+ .install-theme-info > .notice {
245
+ margin: 5px 0 10px 0;
246
+ }
247
+
248
+ .astra-sites-suggestions:before {
249
+ border: 5px dashed #ccc;
250
+ position: absolute;
251
+ left: 0;
252
+ right: 0;
253
+ top: 0;
254
+ bottom: 0px;
255
+ }
256
+
257
+ .astra-sites-suggestions {
258
+ min-height: 280px;
259
+ border: none !important;
260
+ }
261
+
262
+ .astra-sites-suggestions a {
263
+ border: none;
264
+ outline: none;
265
+ }
266
+
267
+ .astra-sites-suggestions .inner {
268
+ border: 6px solid #24282e !important;
269
+ padding: 27% 10% 50% 10%;
270
+ text-align: center;
271
+ position: absolute;
272
+ left: 0;
273
+ right: 0;
274
+ top: 0;
275
+ background: #33383d;
276
+ bottom: 0;
277
+ color: #eee;
278
+ cursor: auto;
279
+ }
280
+
281
+ .astra-sites-suggestions .inner a {
282
+ color: #00b9eb;
283
+ }
284
+
285
+ .astra-sites-suggestions p {
286
+ font-size: 1rem;
287
+ margin: 0;
288
+ }
289
+
290
+ .astra-notice {
291
+ margin: 2em 2em 0em 0em;
292
+ }
293
+
294
+ .no-themes .description {
295
+ display: block;
296
+ }
297
+
298
+ /**
299
+ * Responsive Button UI
300
+ */
301
+ .astra-sites-preview .wp-full-overlay-footer .devices button.active:before,
302
+ .astra-sites-preview .wp-full-overlay-footer .devices button:hover:before {
303
+ color: #0073aa;
304
+ }
305
+ .astra-sites-preview .wp-full-overlay-footer .devices button:before {
306
+ color: #c1c1c1;
307
+ }
308
+ .astra-sites-preview .wp-full-overlay-footer .devices button:hover {
309
+ background-color: transparent;
310
+ }
311
+ .astra-sites-preview .wp-full-overlay-footer .devices button {
312
+ border: none;
313
+ }
314
+ .astra-sites-preview .wp-full-overlay-footer .devices button:focus,
315
+ .astra-sites-preview .wp-full-overlay-footer .devices button.active:hover {
316
+ border-bottom-color: transparent;
317
+ background-color: transparent;
318
+ }
319
+ .not-click-able {
320
+ pointer-events: none !important;
321
+ }
322
+ body.page-builder-selected .select-page-builder,
323
+ body.loading-content .select-page-builder {
324
+ display: none;
325
+ }
326
+ .select-page-builder .up-arrow {
327
+ -webkit-transform: rotate(90deg);
328
+ -moz-transform: rotate(90deg);
329
+ -ms-transform: rotate(90deg);
330
+ transform: rotate(90deg);
331
+ display: inline-block;
332
+ font-size: 1.5em;
333
+ color: #797979;
334
+ vertical-align: middle;
335
+ margin-right: 10px;
336
+ -webkit-transition: all linear 0.6s;
337
+ -moz-transition: all linear 0.6s;
338
+ -ms-transition: all linear 0.6s;
339
+ transition: all linear 0.6s;
340
+ -webkit-animation-duration: 1s;
341
+ animation-duration: 1s;
342
+ -webkit-animation-fill-mode: both;
343
+ animation-fill-mode: both;
344
+ -webkit-animation-timing-function: ease-in-out;
345
+ animation-timing-function: ease-in-out;
346
+ animation-iteration-count: infinite;
347
+ -webkit-animation-iteration-count: infinite;
348
+ animation-name: bounce;
349
+ -moz-animation-name: bounce;
350
+ }
351
+ .select-page-builder {
352
+ margin-left: 6em;
353
+ }
354
+
355
+ .select-page-builder img {
356
+ max-width: 100%;
357
+ }
358
+
359
+ .select-page-builder .note-wrap {
360
+ position: absolute;
361
+ padding: 40px 0;
362
+ margin-left: 170px;
363
+ right: 0;
364
+ left: 0;
365
+ }
366
+
367
+ .select-page-builder h3 {
368
+ margin: 0;
369
+ font-size: 2em;
370
+ }
371
+ .select-page-builder {
372
+ margin: -20px 0 0 -5px;
373
+ position: absolute;
374
+ }
375
+ .select-page-builder .note {
376
+ margin-left: 1.5em;
377
+ }
378
+
379
+ @keyframes bounce {
380
+ 0%,
381
+ 100%,
382
+ 20%,
383
+ 50%,
384
+ 80% {
385
+ -webkit-transform: translateY(-0px) rotate(90deg);
386
+ -moz-transform: translateY(-0px) rotate(90deg);
387
+ -ms-transform: translateY(-0px) rotate(90deg);
388
+ transform: translateY(-0px) rotate(90deg);
389
+ }
390
+ 40% {
391
+ -webkit-transform: translateY(-2px) rotate(90deg);
392
+ -moz-transform: translateY(-2px) rotate(90deg);
393
+ -ms-transform: translateY(-2px) rotate(90deg);
394
+ transform: translateY(-2px) rotate(90deg);
395
+ }
396
+ 60% {
397
+ -webkit-transform: translateY(-1px) rotate(90deg);
398
+ -moz-transform: translateY(-1px) rotate(90deg);
399
+ -ms-transform: translateY(-1px) rotate(90deg);
400
+ transform: translateY(-1px) rotate(90deg);
401
+ }
402
+ }
403
+
404
+ /**
405
+ * Processing Animation
406
+ */
407
+ .astra-demo-import.disabled {
408
+ pointer-events: none;
409
+ }
410
+ .astra-demo-import.button.updating-message:before,
411
+ .astra-demo-import.button.installing:before {
412
+ -webkit-animation: cssAnimation .72s ease infinite;
413
+ -moz-animation: cssAnimation .72s ease infinite;
414
+ -o-animation: cssAnimation .72s ease infinite;
415
+ -ms-animation: cssAnimation .72s ease infinite;
416
+ animation: cssAnimation .72s ease infinite;
417
+ }
418
+
419
+ @-webkit-keyframes cssAnimation {
420
+ from {
421
+ -webkit-transform: rotate(0);
422
+ -moz-transform: rotate(0);
423
+ -o-transform: rotate(0);
424
+ -ms-transform: rotate(0);
425
+ transform: rotate(0);
426
+ }
427
+ to {
428
+ -webkit-transform: rotate(360deg);
429
+ -moz-transform: rotate(360deg);
430
+ -o-transform: rotate(360deg);
431
+ -ms-transform: rotate(360deg);
432
+ transform: rotate(360deg);
433
+ }
434
+ }
435
+ @-moz-keyframes cssAnimation {
436
+ from {
437
+ -webkit-transform: rotate(0);
438
+ -moz-transform: rotate(0);
439
+ -o-transform: rotate(0);
440
+ -ms-transform: rotate(0);
441
+ transform: rotate(0);
442
+ }
443
+ to {
444
+ -webkit-transform: rotate(360deg);
445
+ -moz-transform: rotate(360deg);
446
+ -o-transform: rotate(360deg);
447
+ -ms-transform: rotate(360deg);
448
+ transform: rotate(360deg);
449
+ }
450
+ }
451
+ @-o-keyframes cssAnimation {
452
+ from {
453
+ -webkit-transform: rotate(0);
454
+ -moz-transform: rotate(0);
455
+ -o-transform: rotate(0);
456
+ -ms-transform: rotate(0);
457
+ transform: rotate(0);
458
+ }
459
+ to {
460
+ -webkit-transform: rotate(360deg);
461
+ -moz-transform: rotate(360deg);
462
+ -o-transform: rotate(360deg);
463
+ -ms-transform: rotate(360deg);
464
+ transform: rotate(360deg);
465
+ }
466
+ }
467
+
468
+ #astra-sites-filters {
469
+ display: inline-block;
470
+ width: 100%;
471
+ }
472
+
473
+ .astra-site-down {
474
+ padding: 1em 2em;
475
+ margin-top: 1em;
476
+ }
477
+
478
+ #astra-sites-menu-page .nav-tab-wrapper {
479
+ border: none;
480
+ }
481
+
482
+ #astra-sites-filters .wp-filter {
483
+ margin-top: 0;
484
+ }
485
+
486
+ /**
487
+ * Welcome Screen
488
+ */
489
+ .astra-sites-welcome {
490
+ padding: 10em 0;
491
+ text-align: center;
492
+ }
493
+ .astra-sites-welcome .inner {
494
+ margin: 0 auto;
495
+ display: inline-block;
496
+ max-width: 700px;
497
+ background: #fff;
498
+ padding: 3em;
499
+ }
500
+
501
+ .astra-sites-welcome h1 {
502
+ font-size: 2.5em;
503
+ margin-bottom: 1em;
504
+ }
505
+
506
+ .astra-sites-welcome p.description {
507
+ font-size: 1rem;
508
+ margin-bottom: 2em;
509
+ }
510
+
511
+ .astra-sites-welcome select {
512
+ padding: 5px;
513
+ height: 100%;
514
+ }
515
+
516
+ .astra-sites-welcome p.submit {
517
+ text-align: center;
518
+ margin: 0;
519
+ padding: 0;
520
+ margin-left: .5em;
521
+ }
522
+
523
+ .astra-sites-welcome .fields {
524
+ display: flex;
525
+ vertical-align: middle;
526
+ align-items: center;
527
+ justify-content: center;
528
+ }
529
+
530
+ .astra-sites-welcome #submit {
531
+ line-height: 1;
532
+ padding: .5rem 1rem;
533
+ height: auto;
534
+ }
535
+
536
+ .astra-site-page-builder {
537
+ opacity: 0;
538
+ visibility: hidden;
539
+ }
540
+
541
+ .required-plugins-list {
542
+ margin-left: 2em;
543
+ margin-top: .5em;
544
+ margin-bottom: .5em;
545
+ list-style-type: disc;
546
+ }
547
+
548
+ .required-plugins-list .plugin-card {
549
+ background: transparent;
550
+ border: none;
551
+ margin: 0;
552
+ line-height: 2;
553
+ float: none;
554
+ width: 100%;
555
+ }
556
+
557
+ .required-plugins-list .spinner {
558
+ float: none;
559
+ margin: 0;
560
+ }
561
+
562
+ #astra-site-import-process-wrap {
563
+ display: flex;
564
+ align-items: center;
565
+ margin-top: -2px;
566
+ z-index: 999999;
567
+ position: relative;
568
+ border-radius: 3px;
569
+ overflow: hidden;
570
+ }
571
+ #astra-site-import-process-wrap progress {
572
+ padding: 0px;
573
+ border: 0 none;
574
+ background: #0085bd;
575
+ border-radius: 5px;
576
+ height: 4px;
577
+ flex: 1;
578
+ }
579
+
580
+ #astra-site-import-process-wrap progress::-webkit-progress-value {
581
+ background: #00679b;
582
+ }
583
+ #astra-site-import-process-wrap progress::-webkit-progress-bar {
584
+ background: transparent;
585
+ }
586
+
587
+ .theme-browser .theme .site-preview > .theme-screenshot {
588
+ transition: all linear 5s;
589
+ background-position: center top;
590
+ background-size: cover;
591
+ background-repeat: no-repeat;
592
+ }
593
+ .theme-browser .theme .site-preview > .theme-screenshot:hover {
594
+ background-position: center bottom;
595
+ background-size: cover;
596
+ }
597
+
598
+ .astra-sites-tooltip-icon {
599
+ cursor: pointer;
600
+ }
601
+
602
+ .astra-sites-preview .disabled {
603
+ pointer-events: none;
604
+ }
605
+
606
+ .astra-sites-tooltip-icon .dashicons {
607
+ color: #5d5d5d;
608
+ font-size: 18px;
609
+ }
610
+
611
+ #astra-sites-welcome-form-inline {
612
+ position: absolute;
613
+ right: 1em;
614
+ top: 0;
615
+ border-radius: 0;
616
+ line-height: 1.7;
617
+ padding: 0px 5px 2px 5px;
618
+ outline: 2px solid transparent;
619
+ outline-offset: 0;
620
+ background: #fafafa;
621
+ border: 1px solid #ccc;
622
+ color: #72777c;
623
+ font-weight: normal;
624
+ font-size: 10px;
625
+ font-size: 13px;
626
+ line-height: 26px;
627
+ height: 28px;
628
+ cursor: pointer;
629
+ }
630
+
631
+ #astra-sites-welcome-form-inline select,
632
+ #astra-sites-welcome-form-inline select:focus {
633
+ border: none;
634
+ outline: none;
635
+ box-shadow: none;
636
+ color: #72777c;
637
+ }
638
+
639
+ #astra-sites-menu-page .wp-full-overlay-main:before {
640
+ content: '';
641
+ display: none;
642
+ }
643
+
644
+ .theme-screenshot-wrap {
645
+ overflow: hidden;
646
+ max-height: 300px;
647
+ margin: 15px 0;
648
+ border: 1px solid #ccc;
649
+ }
650
+
651
+ .astra-sites-preview .install-theme-info .theme-screenshot {
652
+ width: 100%;
653
+ border: none;
654
+ margin: 0;
655
  }
inc/assets/css/install-theme.css CHANGED
@@ -1,21 +1,21 @@
1
- .processing:before {
2
- margin: 0 3px 0px 0px;
3
- }
4
- .processing:before {
5
- animation: rotation 2s infinite linear;
6
- }
7
- .processing:before {
8
- color: #f56e28;
9
- content: "\f463";
10
- }
11
- .processing:before {
12
- display: inline-block;
13
- font: normal 20px/1 dashicons;
14
- -webkit-font-smoothing: antialiased;
15
- -moz-osx-font-smoothing: grayscale;
16
- vertical-align: top;
17
- }
18
- #astra-theme-activation-nag a {
19
- box-shadow: none;
20
- outline: none;
21
  }
1
+ .processing:before {
2
+ margin: 0 3px 0px 0px;
3
+ }
4
+ .processing:before {
5
+ animation: rotation 2s infinite linear;
6
+ }
7
+ .processing:before {
8
+ color: #f56e28;
9
+ content: "\f463";
10
+ }
11
+ .processing:before {
12
+ display: inline-block;
13
+ font: normal 20px/1 dashicons;
14
+ -webkit-font-smoothing: antialiased;
15
+ -moz-osx-font-smoothing: grayscale;
16
+ vertical-align: top;
17
+ }
18
+ #astra-theme-activation-nag a {
19
+ box-shadow: none;
20
+ outline: none;
21
  }
inc/assets/js/admin-page.js CHANGED
@@ -1,1815 +1,1815 @@
1
- /**
2
- * AJAX Request Queue
3
- *
4
- * - add()
5
- * - remove()
6
- * - run()
7
- * - stop()
8
- *
9
- * @since 1.0.0
10
- */
11
- var AstraSitesAjaxQueue = (function() {
12
-
13
- var requests = [];
14
-
15
- return {
16
-
17
- /**
18
- * Add AJAX request
19
- *
20
- * @since 1.0.0
21
- */
22
- add: function(opt) {
23
- requests.push(opt);
24
- },
25
-
26
- /**
27
- * Remove AJAX request
28
- *
29
- * @since 1.0.0
30
- */
31
- remove: function(opt) {
32
- if( jQuery.inArray(opt, requests) > -1 )
33
- requests.splice($.inArray(opt, requests), 1);
34
- },
35
-
36
- /**
37
- * Run / Process AJAX request
38
- *
39
- * @since 1.0.0
40
- */
41
- run: function() {
42
- var self = this,
43
- oriSuc;
44
-
45
- if( requests.length ) {
46
- oriSuc = requests[0].complete;
47
-
48
- requests[0].complete = function() {
49
- if( typeof(oriSuc) === 'function' ) oriSuc();
50
- requests.shift();
51
- self.run.apply(self, []);
52
- };
53
-
54
- jQuery.ajax(requests[0]);
55
-
56
- } else {
57
-
58
- self.tid = setTimeout(function() {
59
- self.run.apply(self, []);
60
- }, 1000);
61
- }
62
- },
63
-
64
- /**
65
- * Stop AJAX request
66
- *
67
- * @since 1.0.0
68
- */
69
- stop: function() {
70
-
71
- requests = [];
72
- clearTimeout(this.tid);
73
- }
74
- };
75
-
76
- }());
77
-
78
- (function($){
79
-
80
- var AstraSSEImport = {
81
- complete: {
82
- posts: 0,
83
- media: 0,
84
- users: 0,
85
- comments: 0,
86
- terms: 0,
87
- },
88
-
89
- updateDelta: function (type, delta) {
90
- this.complete[ type ] += delta;
91
-
92
- var self = this;
93
- requestAnimationFrame(function () {
94
- self.render();
95
- });
96
- },
97
- updateProgress: function ( type, complete, total ) {
98
- var text = complete + '/' + total;
99
-
100
- if( 'undefined' !== type && 'undefined' !== text ) {
101
- total = parseInt( total, 10 );
102
- if ( 0 === total || isNaN( total ) ) {
103
- total = 1;
104
- }
105
- var percent = parseInt( complete, 10 ) / total;
106
- var progress = Math.round( percent * 100 ) + '%';
107
- var progress_bar = percent * 100;
108
-
109
- if( progress_bar <= 100 ) {
110
- document.getElementById( 'astra-site-import-process' ).value = progress_bar;
111
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingXML + ' '+progress );
112
- }
113
- }
114
- },
115
- render: function () {
116
- var types = Object.keys( this.complete );
117
- var complete = 0;
118
- var total = 0;
119
-
120
-
121
- for (var i = types.length - 1; i >= 0; i--) {
122
- var type = types[i];
123
- this.updateProgress( type, this.complete[ type ], this.data.count[ type ] );
124
-
125
- complete += this.complete[ type ];
126
- total += this.data.count[ type ];
127
- }
128
-
129
- this.updateProgress( 'total', complete, total );
130
- }
131
- };
132
-
133
- AstraSitesAdmin = {
134
-
135
- reset_remaining_posts: 0,
136
- reset_remaining_wp_forms: 0,
137
- reset_remaining_terms: 0,
138
- reset_processed_posts: 0,
139
- reset_processed_wp_forms: 0,
140
- reset_processed_terms: 0,
141
- site_imported_data: null,
142
-
143
- backup_taken: false,
144
-
145
- current_site: [],
146
- current_screen: '',
147
-
148
- templateData: {},
149
-
150
- log_file : '',
151
- customizer_data : '',
152
- wxr_url : '',
153
- wpforms_url : '',
154
- options_data : '',
155
- widgets_data : '',
156
-
157
- init: function()
158
- {
159
- this._resetPagedCount();
160
- this._bind();
161
- },
162
-
163
- /**
164
- * Debugging.
165
- *
166
- * @param {mixed} data Mixed data.
167
- */
168
- _log: function( data ) {
169
-
170
- if( astraSitesAdmin.debug ) {
171
-
172
- var date = new Date();
173
- var time = date.toLocaleTimeString();
174
-
175
- if (typeof data == 'object') {
176
- console.log('%c ' + JSON.stringify( data ) + ' ' + time, 'background: #ededed; color: #444');
177
- } else {
178
- console.log('%c ' + data + ' ' + time, 'background: #ededed; color: #444');
179
- }
180
-
181
-
182
- }
183
- },
184
-
185
- /**
186
- * Binds events for the Astra Sites.
187
- *
188
- * @since 1.0.0
189
- * @access private
190
- * @method _bind
191
- */
192
- _bind: function()
193
- {
194
- $( document ).on( 'click' , '.astra-sites-reset-data .checkbox', AstraSitesAdmin._toggle_reset_notice );
195
- $( document ).on('change' , '#astra-sites-welcome-form-inline select', AstraSitesAdmin._change_page_builder);
196
- $( document ).on('click' , '.astra-sites-tooltip-icon', AstraSitesAdmin._toggle_tooltip);
197
- $( document ).on('click' , '.astra-sites-advanced-options-button', AstraSitesAdmin._toggle_advanced_options);
198
-
199
- $( document ).on('click' , '.astra-import-settings', AstraSitesAdmin._import_settings);
200
- $( document ).on('click' , '.devices button', AstraSitesAdmin._previewDevice);
201
- $( document ).on('click' , '.theme-browser .theme-screenshot, .theme-browser .more-details, .theme-browser .install-theme-preview', AstraSitesAdmin._preview);
202
- $( document ).on('click' , '.next-theme', AstraSitesAdmin._nextTheme);
203
- $( document ).on('click' , '.previous-theme', AstraSitesAdmin._previousTheme);
204
- $( document ).on('click' , '.collapse-sidebar', AstraSitesAdmin._collapse);
205
- $( document ).on('click' , '.astra-demo-import', AstraSitesAdmin._importDemo);
206
-
207
- $( document ).on('astra-sites-install-and-activate-required-plugins-done' , AstraSitesAdmin._process_import );
208
-
209
- $( document ).on('click' , '.install-now', AstraSitesAdmin._installNow);
210
- $( document ).on('click' , '.close-full-overlay', AstraSitesAdmin._fullOverlay);
211
- $( document ).on('click' , '.activate-now', AstraSitesAdmin._activateNow);
212
- $( document ).on('wp-plugin-installing' , AstraSitesAdmin._pluginInstalling);
213
- $( document ).on('wp-plugin-install-error' , AstraSitesAdmin._installError);
214
- $( document ).on('wp-plugin-install-success' , AstraSitesAdmin._installSuccess);
215
-
216
- $( document ).on( 'astra-sites-import-set-site-data-done' , AstraSitesAdmin._resetData );
217
- $( document ).on( 'astra-sites-reset-data' , AstraSitesAdmin._backup_before_rest_options );
218
- $( document ).on( 'astra-sites-backup-settings-before-reset-done' , AstraSitesAdmin._reset_customizer_data );
219
- $( document ).on( 'astra-sites-reset-customizer-data-done' , AstraSitesAdmin._reset_site_options );
220
- $( document ).on( 'astra-sites-reset-site-options-done' , AstraSitesAdmin._reset_widgets_data );
221
- $( document ).on( 'astra-sites-reset-widgets-data-done' , AstraSitesAdmin._reset_terms );
222
- $( document ).on( 'astra-sites-delete-terms-done' , AstraSitesAdmin._reset_wp_forms );
223
- $( document ).on( 'astra-sites-delete-wp-forms-done' , AstraSitesAdmin._reset_posts );
224
-
225
- $( document ).on('astra-sites-reset-data-done' , AstraSitesAdmin._recheck_backup_options );
226
- $( document ).on('astra-sites-backup-settings-done' , AstraSitesAdmin._importWPForms );
227
- $( document ).on('astra-sites-import-wpforms-done' , AstraSitesAdmin._importCustomizerSettings );
228
- $( document ).on('astra-sites-import-customizer-settings-done' , AstraSitesAdmin._importXML );
229
- $( document ).on('astra-sites-import-xml-done' , AstraSitesAdmin._importSiteOptions );
230
- $( document ).on('astra-sites-import-options-done' , AstraSitesAdmin._importWidgets );
231
- $( document ).on('astra-sites-import-widgets-done' , AstraSitesAdmin._importEnd );
232
-
233
- },
234
-
235
- _change_page_builder: function() {
236
- $(this).closest('form').submit();
237
- },
238
-
239
- _toggle_tooltip: function( event ) {
240
- event.preventDefault();
241
- var tip_id = $( this ).data('tip-id') || '';
242
- if( tip_id && $( '#' + tip_id ).length ) {
243
- $( '#' + tip_id ).toggle();
244
- }
245
- },
246
-
247
- _toggle_advanced_options: function( event ) {
248
- event.preventDefault();
249
- $('.astra-sites-advanced-options').toggle();
250
- },
251
-
252
- _resetData: function( event ) {
253
- event.preventDefault();
254
-
255
- if ( $( '.astra-sites-reset-data' ).find('.checkbox').is(':checked') ) {
256
- $(document).trigger( 'astra-sites-reset-data' );
257
- } else {
258
- $(document).trigger( 'astra-sites-reset-data-done' );
259
- }
260
- },
261
-
262
- _reset_customizer_data() {
263
- $.ajax({
264
- url : astraSitesAdmin.ajaxurl,
265
- type : 'POST',
266
- data : {
267
- action : 'astra-sites-reset-customizer-data'
268
- },
269
- beforeSend: function() {
270
- AstraSitesAdmin._log( 'Reseting Customizer Data' );
271
- $('.button-hero.astra-demo-import').text( 'Reseting Customizer Data' );
272
- },
273
- })
274
- .fail(function( jqXHR ){
275
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
276
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
277
- })
278
- .done(function ( data ) {
279
- $(document).trigger( 'astra-sites-reset-customizer-data-done' );
280
- });
281
- },
282
-
283
- _reset_site_options: function() {
284
- // Site Options.
285
- $.ajax({
286
- url : astraSitesAdmin.ajaxurl,
287
- type : 'POST',
288
- data : {
289
- action : 'astra-sites-reset-site-options'
290
- },
291
- beforeSend: function() {
292
- AstraSitesAdmin._log( 'Reseting Site Options' );
293
- $('.button-hero.astra-demo-import').text( 'Reseting Site Options' );
294
- },
295
- })
296
- .fail(function( jqXHR ){
297
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
298
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
299
- })
300
- .done(function ( data ) {
301
-
302
-
303
- $(document).trigger( 'astra-sites-reset-site-options-done' );
304
- });
305
- },
306
-
307
- _reset_widgets_data: function() {
308
- // Widgets.
309
- $.ajax({
310
- url : astraSitesAdmin.ajaxurl,
311
- type : 'POST',
312
- data : {
313
- action : 'astra-sites-reset-widgets-data'
314
- },
315
- beforeSend: function() {
316
- AstraSitesAdmin._log( 'Reseting Widgets' );
317
- $('.button-hero.astra-demo-import').text( 'Reseting Widgets' );
318
- },
319
- })
320
- .fail(function( jqXHR ){
321
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
322
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
323
- })
324
- .done(function ( data ) {
325
- AstraSitesAdmin._log( data );
326
- $(document).trigger( 'astra-sites-reset-widgets-data-done' );
327
- });
328
- },
329
-
330
- _reset_posts: function() {
331
- if( AstraSitesAdmin.site_imported_data['reset_posts'].length ) {
332
-
333
- AstraSitesAdmin.reset_remaining_posts = AstraSitesAdmin.site_imported_data['reset_posts'].length;
334
-
335
- // Delete all posts.
336
- // AstraSitesAjaxQueue.stop();
337
- // AstraSitesAjaxQueue.run();
338
-
339
- $.each( AstraSitesAdmin.site_imported_data['reset_posts'], function(index, post_id) {
340
- AstraSitesAjaxQueue.add({
341
- url: astraSitesAdmin.ajaxurl,
342
- type: 'POST',
343
- data: {
344
- action : 'astra-sites-delete-posts',
345
- post_id : post_id,
346
- },
347
- success: function( result ){
348
-
349
- if( AstraSitesAdmin.reset_processed_posts < AstraSitesAdmin.site_imported_data['reset_posts'].length ) {
350
- AstraSitesAdmin.reset_processed_posts+=1;
351
- }
352
-
353
- $('.button-hero.astra-demo-import').text( 'Deleting Item ' + AstraSitesAdmin.reset_processed_posts + ' of ' + AstraSitesAdmin.site_imported_data['reset_posts'].length );
354
- AstraSitesAdmin.reset_remaining_posts-=1;
355
- if( 0 == AstraSitesAdmin.reset_remaining_posts ) {
356
- $(document).trigger( 'astra-sites-delete-posts-done' );
357
- $(document).trigger( 'astra-sites-reset-data-done' );
358
- }
359
- }
360
- });
361
- });
362
- AstraSitesAjaxQueue.run();
363
-
364
- } else {
365
- $(document).trigger( 'astra-sites-delete-posts-done' );
366
- $(document).trigger( 'astra-sites-reset-data-done' );
367
- }
368
- },
369
-
370
- _reset_wp_forms: function() {
371
-
372
- AstraSitesAdmin._log( AstraSitesAdmin.site_imported_data['reset_wp_forms'] );
373
- AstraSitesAdmin._log( AstraSitesAdmin.site_imported_data['reset_wp_forms'].length );
374
-
375
- if( AstraSitesAdmin.site_imported_data['reset_wp_forms'].length ) {
376
- AstraSitesAdmin.reset_remaining_wp_forms = AstraSitesAdmin.site_imported_data['reset_wp_forms'].length;
377
-
378
- $.each( AstraSitesAdmin.site_imported_data['reset_wp_forms'], function(index, post_id) {
379
- AstraSitesAdmin._log( 'WP Form ID: ' + post_id );
380
- AstraSitesAjaxQueue.add({
381
- url: astraSitesAdmin.ajaxurl,
382
- type: 'POST',
383
- data: {
384
- action : 'astra-sites-delete-wp-forms',
385
- post_id : post_id,
386
- },
387
- success: function( result ){
388
- AstraSitesAdmin._log( 'WP Forms Results' );
389
- AstraSitesAdmin._log( result );
390
- if( AstraSitesAdmin.reset_processed_wp_forms < AstraSitesAdmin.site_imported_data['reset_wp_forms'].length ) {
391
- AstraSitesAdmin.reset_processed_wp_forms+=1;
392
- }
393
-
394
- $('.button-hero.astra-demo-import').text( 'Deleting Form ' + AstraSitesAdmin.reset_processed_wp_forms + ' of ' + AstraSitesAdmin.site_imported_data['reset_wp_forms'].length );
395
- AstraSitesAdmin.reset_remaining_wp_forms-=1;
396
- if( 0 == AstraSitesAdmin.reset_remaining_wp_forms ) {
397
- $(document).trigger( 'astra-sites-delete-wp-forms-done' );
398
- }
399
- }
400
- });
401
- });
402
- AstraSitesAjaxQueue.run();
403
-
404
- } else {
405
- $(document).trigger( 'astra-sites-delete-wp-forms-done' );
406
- }
407
- },
408
-
409
-
410
- _reset_terms: function() {
411
-
412
- AstraSitesAdmin._log( AstraSitesAdmin.site_imported_data['reset_terms'] );
413
- AstraSitesAdmin._log( AstraSitesAdmin.site_imported_data['reset_terms'].length );
414
-
415
- if( AstraSitesAdmin.site_imported_data['reset_terms'].length ) {
416
- AstraSitesAdmin.reset_remaining_terms = AstraSitesAdmin.site_imported_data['reset_terms'].length;
417
-
418
- $.each( AstraSitesAdmin.site_imported_data['reset_terms'], function(index, term_id) {
419
- AstraSitesAjaxQueue.add({
420
- url: astraSitesAdmin.ajaxurl,
421
- type: 'POST',
422
- data: {
423
- action : 'astra-sites-delete-terms',
424
- term_id : term_id,
425
- },
426
- success: function( result ){
427
- if( AstraSitesAdmin.reset_processed_terms < AstraSitesAdmin.site_imported_data['reset_terms'].length ) {
428
- AstraSitesAdmin.reset_processed_terms+=1;
429
- }
430
- AstraSitesAdmin._log( result );
431
- $('.button-hero.astra-demo-import').text( 'Deleting Term ' + AstraSitesAdmin.reset_processed_terms + ' of ' + AstraSitesAdmin.site_imported_data['reset_terms'].length );
432
- AstraSitesAdmin.reset_remaining_terms-=1;
433
- AstraSitesAdmin._log( AstraSitesAdmin.reset_remaining_terms );
434
- if( 0 == AstraSitesAdmin.reset_remaining_terms ) {
435
- $(document).trigger( 'astra-sites-delete-terms-done' );
436
- }
437
- }
438
- });
439
- });
440
- AstraSitesAjaxQueue.run();
441
-
442
- } else {
443
- $(document).trigger( 'astra-sites-delete-terms-done' );
444
- }
445
-
446
- },
447
-
448
- _toggle_reset_notice: function() {
449
- if ( $( this ).is(':checked') ) {
450
- $('#astra-sites-tooltip-reset-data').show();
451
- } else {
452
- $('#astra-sites-tooltip-reset-data').hide();
453
- }
454
- },
455
-
456
- _backup_before_rest_options: function() {
457
- AstraSitesAdmin._backupOptions( 'astra-sites-backup-settings-before-reset-done' );
458
- AstraSitesAdmin.backup_taken = true;
459
- },
460
-
461
- _recheck_backup_options: function() {
462
- AstraSitesAdmin._backupOptions( 'astra-sites-backup-settings-done' );
463
- AstraSitesAdmin.backup_taken = true;
464
- },
465
-
466
- _backupOptions: function( trigger_name ) {
467
- $.ajax({
468
- url : astraSitesAdmin.ajaxurl,
469
- type : 'POST',
470
- data : {
471
- action : 'astra-sites-backup-settings',
472
- },
473
- beforeSend: function() {
474
- AstraSitesAdmin._log( astraSitesAdmin.log.importWPForms );
475
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.backupCustomizer );
476
- },
477
- })
478
- .fail(function( jqXHR ){
479
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText );
480
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
481
- })
482
- .done(function ( data ) {
483
-
484
- // 1. Pass - Import Customizer Options.
485
- AstraSitesAdmin._log( astraSitesAdmin.log.backupCustomizerSuccess );
486
-
487
- // Custom trigger.
488
- $(document).trigger( trigger_name );
489
- });
490
- },
491
-
492
- _import_settings: function( event ) {
493
- event.preventDefault();
494
-
495
- var btn = $(this);
496
-
497
- btn.addClass('updating-message');
498
-
499
-
500
- $.ajax({
501
- url : astraSitesAdmin.ajaxurl,
502
- type : 'POST',
503
- dataType: 'json',
504
- data : {
505
- action : 'astra-sites-import-customizer-settings',
506
- customizer_data : AstraSitesAdmin.current_site['astra-site-customizer-data'],
507
- },
508
- beforeSend: function() {
509
- AstraSitesAdmin._log( astraSitesAdmin.log.importCustomizer );
510
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingCustomizer );
511
- },
512
- })
513
- .fail(function( jqXHR ){
514
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
515
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
516
- })
517
- .done(function ( customizer_data ) {
518
-
519
- btn.removeClass( 'updating-message' );
520
-
521
- // 1. Fail - Import Customizer Options.
522
- if( false === customizer_data.success ) {
523
- AstraSitesAdmin._importFailMessage( customizer_data.data );
524
- AstraSitesAdmin._log( customizer_data.data );
525
- } else {
526
-
527
- // 1. Pass - Import Customizer Options.
528
- AstraSitesAdmin._log( astraSitesAdmin.log.importCustomizerSuccess );
529
-
530
- $(document).trigger( 'astra-sites-import-customizer-settings-done' );
531
- }
532
- });
533
- },
534
-
535
- /**
536
- * 5. Import Complete.
537
- */
538
- _importEnd: function( event ) {
539
-
540
- $.ajax({
541
- url : astraSitesAdmin.ajaxurl,
542
- type : 'POST',
543
- dataType: 'json',
544
- data : {
545
- action : 'astra-sites-import-end',
546
- },
547
- beforeSend: function() {
548
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importComplete );
549
- }
550
- })
551
- .fail(function( jqXHR ){
552
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
553
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
554
- })
555
- .done(function ( data ) {
556
-
557
- // 5. Fail - Import Complete.
558
- if( false === data.success ) {
559
- AstraSitesAdmin._importFailMessage( data.data );
560
- AstraSitesAdmin._log( data.data );
561
- } else {
562
-
563
- $('body').removeClass('importing-site');
564
- $('.previous-theme, .next-theme').removeClass('disabled');
565
-
566
- // 5. Pass - Import Complete.
567
- AstraSitesAdmin._importSuccessMessage();
568
- AstraSitesAdmin._log( astraSitesAdmin.log.success + ' ' + astraSitesAdmin.siteURL );
569
- }
570
- });
571
- },
572
-
573
- /**
574
- * 4. Import Widgets.
575
- */
576
- _importWidgets: function( event ) {
577
- if ( AstraSitesAdmin._is_process_widgets() ) {
578
- $.ajax({
579
- url : astraSitesAdmin.ajaxurl,
580
- type : 'POST',
581
- dataType: 'json',
582
- data : {
583
- action : 'astra-sites-import-widgets',
584
- widgets_data : AstraSitesAdmin.widgets_data,
585
- },
586
- beforeSend: function() {
587
- AstraSitesAdmin._log( astraSitesAdmin.log.importWidgets );
588
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingWidgets );
589
- },
590
- })
591
- .fail(function( jqXHR ){
592
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText );
593
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
594
- })
595
- .done(function ( widgets_data ) {
596
-
597
- // 4. Fail - Import Widgets.
598
- if( false === widgets_data.success ) {
599
- AstraSitesAdmin._importFailMessage( widgets_data.data );
600
- AstraSitesAdmin._log( widgets_data.data );
601
-
602
- } else {
603
-
604
- // 4. Pass - Import Widgets.
605
- AstraSitesAdmin._log( astraSitesAdmin.log.importWidgetsSuccess );
606
- $(document).trigger( 'astra-sites-import-widgets-done' );
607
- }
608
- });
609
- } else {
610
- $(document).trigger( 'astra-sites-import-widgets-done' );
611
- }
612
- },
613
-
614
- /**
615
- * 3. Import Site Options.
616
- */
617
- _importSiteOptions: function( event ) {
618
-
619
- if ( AstraSitesAdmin._is_process_xml() ) {
620
- $.ajax({
621
- url : astraSitesAdmin.ajaxurl,
622
- type : 'POST',
623
- dataType: 'json',
624
- data : {
625
- action : 'astra-sites-import-options',
626
- options_data : AstraSitesAdmin.options_data,
627
- },
628
- beforeSend: function() {
629
- AstraSitesAdmin._log( astraSitesAdmin.log.importOptions );
630
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingOptions );
631
- $('.astra-demo-import .percent').html('');
632
- },
633
- })
634
- .fail(function( jqXHR ){
635
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText );
636
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
637
- })
638
- .done(function ( options_data ) {
639
-
640
- // 3. Fail - Import Site Options.
641
- if( false === options_data.success ) {
642
- AstraSitesAdmin._log( options_data );
643
- AstraSitesAdmin._importFailMessage( options_data.data );
644
- AstraSitesAdmin._log( options_data.data );
645
-
646
- } else {
647
-
648
- // 3. Pass - Import Site Options.
649
- AstraSitesAdmin._log( astraSitesAdmin.log.importOptionsSuccess );
650
- $(document).trigger( 'astra-sites-import-options-done' );
651
- }
652
- });
653
- } else {
654
- $(document).trigger( 'astra-sites-import-options-done' );
655
- }
656
- },
657
-
658
- /**
659
- * 2. Prepare XML Data.
660
- */
661
- _importXML: function() {
662
-
663
- if ( AstraSitesAdmin._is_process_xml() ) {
664
- $.ajax({
665
- url : astraSitesAdmin.ajaxurl,
666
- type : 'POST',
667
- dataType: 'json',
668
- data : {
669
- action : 'astra-sites-import-prepare-xml',
670
- wxr_url : AstraSitesAdmin.current_site['astra-site-wxr-path'],
671
- },
672
- beforeSend: function() {
673
- $('#astra-site-import-process-wrap').show();
674
- AstraSitesAdmin._log( astraSitesAdmin.log.importXMLPrepare );
675
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importXMLPreparing );
676
- },
677
- })
678
- .fail(function( jqXHR ){
679
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText );
680
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
681
- })
682
- .done(function ( xml_data ) {
683
-
684
-
685
- // 2. Fail - Prepare XML Data.
686
- if( false === xml_data.success ) {
687
- AstraSitesAdmin._log( xml_data );
688
- var error_msg = xml_data.data.error || xml_data.data;
689
- AstraSitesAdmin._importFailMessage( error_msg );
690
- AstraSitesAdmin._log( error_msg );
691
-
692
- } else {
693
-
694
- // 2. Pass - Prepare XML Data.
695
- AstraSitesAdmin._log( astraSitesAdmin.log.importXMLPrepareSuccess );
696
-
697
- // Import XML though Event Source.
698
- AstraSSEImport.data = xml_data.data;
699
- AstraSSEImport.render();
700
-
701
- AstraSitesAdmin._log( astraSitesAdmin.log.importXML );
702
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingXML );
703
-
704
- var evtSource = new EventSource( AstraSSEImport.data.url );
705
- evtSource.onmessage = function ( message ) {
706
- var data = JSON.parse( message.data );
707
- switch ( data.action ) {
708
- case 'updateDelta':
709
- AstraSSEImport.updateDelta( data.type, data.delta );
710
- break;
711
-
712
- case 'complete':
713
- evtSource.close();
714
-
715
- // 2. Pass - Import XML though "Source Event".
716
- AstraSitesAdmin._log( astraSitesAdmin.log.importXMLSuccess );
717
- AstraSitesAdmin._log( '----- SSE - XML import Complete -----' );
718
-
719
- document.getElementById( 'astra-site-import-process' ).value = 100;
720
-
721
-
722
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingXML + ' (100%)' );
723
-
724
- $('#astra-site-import-process-wrap').hide();
725
-
726
- $(document).trigger( 'astra-sites-import-xml-done' );
727
-
728
- break;
729
- }
730
- };
731
- evtSource.addEventListener( 'log', function ( message ) {
732
- var data = JSON.parse( message.data );
733
- AstraSitesAdmin._log( data.level + ' ' + data.message );
734
- });
735
- }
736
- });
737
- } else {
738
- $(document).trigger( 'astra-sites-import-xml-done' );
739
- }
740
-
741
-
742
- },
743
-
744
- _is_process_xml: function() {
745
- if ( $( '.astra-sites-import-xml' ).find('.checkbox').is(':checked') ) {
746
- return true;
747
- }
748
- return false;
749
- },
750
-
751
- _is_process_customizer: function() {
752
- if ( $( '.astra-sites-import-customizer' ).find('.checkbox').is(':checked') ) {
753
- return true;
754
- }
755
- return false;
756
- },
757
-
758
- _is_process_widgets: function() {
759
- if ( $( '.astra-sites-import-widgets' ).find('.checkbox').is(':checked') ) {
760
- return true;
761
- }
762
- return false;
763
- },
764
-
765
- /**
766
- * 1. Import WPForms Options.
767
- */
768
- _importWPForms: function( event ) {
769
- if ( AstraSitesAdmin._is_process_customizer() ) {
770
- $.ajax({
771
- url : astraSitesAdmin.ajaxurl,
772
- type : 'POST',
773
- dataType: 'json',
774
- data : {
775
- action : 'astra-sites-import-wpforms',
776
- wpforms_url : AstraSitesAdmin.wpforms_url,
777
- },
778
- beforeSend: function() {
779
- AstraSitesAdmin._log( astraSitesAdmin.log.importWPForms );
780
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingWPForms );
781
- },
782
- })
783
- .fail(function( jqXHR ){
784
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText );
785
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
786
- })
787
- .done(function ( forms ) {
788
-
789
- // 1. Fail - Import WPForms Options.
790
- if( false === forms.success ) {
791
- AstraSitesAdmin._importFailMessage( forms.data );
792
- AstraSitesAdmin._log( forms.data );
793
- } else {
794
-
795
- // 1. Pass - Import Customizer Options.
796
- AstraSitesAdmin._log( astraSitesAdmin.log.importWPFormsSuccess );
797
-
798
- $(document).trigger( 'astra-sites-import-wpforms-done' );
799
- }
800
- });
801
- } else {
802
- $(document).trigger( 'astra-sites-import-wpforms-done' );
803
- }
804
- },
805
-
806
- /**
807
- * 1. Import Customizer Options.
808
- */
809
- _importCustomizerSettings: function( event ) {
810
- if ( AstraSitesAdmin._is_process_customizer() ) {
811
- $.ajax({
812
- url : astraSitesAdmin.ajaxurl,
813
- type : 'POST',
814
- dataType: 'json',
815
- data : {
816
- action : 'astra-sites-import-customizer-settings',
817
- customizer_data : AstraSitesAdmin.customizer_data,
818
- },
819
- beforeSend: function() {
820
- AstraSitesAdmin._log( astraSitesAdmin.log.importCustomizer );
821
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingCustomizer );
822
- },
823
- })
824
- .fail(function( jqXHR ){
825
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText );
826
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
827
- })
828
- .done(function ( customizer_data ) {
829
-
830
- // 1. Fail - Import Customizer Options.
831
- if( false === customizer_data.success ) {
832
- AstraSitesAdmin._importFailMessage( customizer_data.data );
833
- AstraSitesAdmin._log( customizer_data.data );
834
- } else {
835
-
836
- // 1. Pass - Import Customizer Options.
837
- AstraSitesAdmin._log( astraSitesAdmin.log.importCustomizerSuccess );
838
-
839
- $(document).trigger( 'astra-sites-import-customizer-settings-done' );
840
- }
841
- });
842
- } else {
843
- $(document).trigger( 'astra-sites-import-customizer-settings-done' );
844
- }
845
-
846
- },
847
-
848
- /**
849
- * Import Success Button.
850
- *
851
- * @param {string} data Error message.
852
- */
853
- _importSuccessMessage: function() {
854
-
855
- $('.astra-demo-import').removeClass('updating-message installing')
856
- .removeAttr('data-import')
857
- .addClass('view-site')
858
- .removeClass('astra-demo-import')
859
- .text( astraSitesAdmin.strings.viewSite )
860
- .attr('target', '_blank')
861
- .append('<i class="dashicons dashicons-external"></i>')
862
- .attr('href', astraSitesAdmin.siteURL );
863
- },
864
-
865
- /**
866
- * Preview Device
867
- */
868
- _previewDevice: function( event ) {
869
- var device = $( event.currentTarget ).data( 'device' );
870
-
871
- $('.theme-install-overlay')
872
- .removeClass( 'preview-desktop preview-tablet preview-mobile' )
873
- .addClass( 'preview-' + device )
874
- .data( 'current-preview-device', device );
875
-
876
- AstraSitesAdmin._tooglePreviewDeviceButtons( device );
877
- },
878
-
879
- /**
880
- * Toggle Preview Buttons
881
- */
882
- _tooglePreviewDeviceButtons: function( newDevice ) {
883
- var $devices = $( '.wp-full-overlay-footer .devices' );
884
-
885
- $devices.find( 'button' )
886
- .removeClass( 'active' )
887
- .attr( 'aria-pressed', false );
888
-
889
- $devices.find( 'button.preview-' + newDevice )
890
- .addClass( 'active' )
891
- .attr( 'aria-pressed', true );
892
- },
893
-
894
- /**
895
- * Import Error Button.
896
- *
897
- * @param {string} data Error message.
898
- */
899
- _importFailMessage: function( message, from ) {
900
-
901
- $('.astra-demo-import')
902
- .addClass('go-pro button-primary')
903
- .removeClass('updating-message installing')
904
- .removeAttr('data-import')
905
- .attr('target', '_blank')
906
- .append('<i class="dashicons dashicons-external"></i>')
907
- .removeClass('astra-demo-import');
908
-
909
- // Add the doc link due to import log file not generated.
910
- if( 'undefined' === from ) {
911
-
912
- $('.wp-full-overlay-header .go-pro').text( astraSitesAdmin.strings.importFailedBtnSmall );
913
- $('.wp-full-overlay-footer .go-pro').text( astraSitesAdmin.strings.importFailedBtnLarge );
914
- $('.go-pro').attr('href', astraSitesAdmin.log.serverConfiguration );
915
-
916
- // Add the import log file link.
917
- } else {
918
-
919
- $('.wp-full-overlay-header .go-pro').text( astraSitesAdmin.strings.importFailBtn );
920
- $('.wp-full-overlay-footer .go-pro').text( astraSitesAdmin.strings.importFailBtnLarge )
921
-
922
- // Add the import log file link.
923
- if( 'undefined' !== AstraSitesAdmin.log_file_url ) {
924
- $('.go-pro').attr('href', AstraSitesAdmin.log_file_url );
925
- } else {
926
- $('.go-pro').attr('href', astraSitesAdmin.log.serverConfiguration );
927
- }
928
- }
929
-
930
- var output = '<div class="astra-api-error notice notice-error notice-alt is-dismissible">';
931
- output += ' <p>'+message+'</p>';
932
- output += ' <button type="button" class="notice-dismiss">';
933
- output += ' <span class="screen-reader-text">'+commonL10n.dismiss+'</span>';
934
- output += ' </button>';
935
- output += '</div>';
936
-
937
- // Fail Notice.
938
- $('.install-theme-info').append( output );
939
-
940
-
941
- // !important to add trigger.
942
- // Which reinitialize the dismiss error message events.
943
- $(document).trigger('wp-updates-notice-added');
944
- },
945
-
946
-
947
- /**
948
- * Install Now
949
- */
950
- _installNow: function(event)
951
- {
952
- event.preventDefault();
953
-
954
- var $button = jQuery( event.target ),
955
- $document = jQuery(document);
956
-
957
- if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
958
- return;
959
- }
960
-
961
- if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) {
962
- wp.updates.requestFilesystemCredentials( event );
963
-
964
- $document.on( 'credential-modal-cancel', function() {
965
- var $message = $( '.install-now.updating-message' );
966
-
967
- $message
968
- .removeClass( 'updating-message' )
969
- .text( wp.updates.l10n.installNow );
970
-
971
- wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' );
972
- } );
973
- }
974
-
975
- AstraSitesAdmin._log( astraSitesAdmin.log.installingPlugin + ' ' + $button.data( 'slug' ) );
976
-
977
- wp.updates.installPlugin( {
978
- slug: $button.data( 'slug' )
979
- } );
980
- },
981
-
982
- /**
983
- * Install Success
984
- */
985
- _installSuccess: function( event, response ) {
986
-
987
- event.preventDefault();
988
-
989
- AstraSitesAdmin._log( astraSitesAdmin.log.installed + ' ' + response.slug );
990
-
991
- var $siteOptions = $( '.wp-full-overlay-header').find('.astra-site-options').val();
992
- var $enabledExtensions = $( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
993
-
994
- // Transform the 'Install' button into an 'Activate' button.
995
- var $init = $( '.plugin-card-' + response.slug ).data('init');
996
-
997
- // Reset not installed plugins list.
998
- var pluginsList = astraSitesAdmin.requiredPlugins.notinstalled;
999
- astraSitesAdmin.requiredPlugins.notinstalled = AstraSitesAdmin._removePluginFromQueue( response.slug, pluginsList );
1000
-
1001
- // WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
1002
- setTimeout( function() {
1003
-
1004
- $.ajax({
1005
- url: astraSitesAdmin.ajaxurl,
1006
- type: 'POST',
1007
- data: {
1008
- 'action' : 'astra-required-plugin-activate',
1009
- 'init' : $init,
1010
- 'options' : $siteOptions,
1011
- 'enabledExtensions' : $enabledExtensions,
1012
- },
1013
- })
1014
- .done(function (result) {
1015
-
1016
- if( result.success ) {
1017
-
1018
- var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
1019
-
1020
- // Reset not installed plugins list.
1021
- astraSitesAdmin.requiredPlugins.inactive = AstraSitesAdmin._removePluginFromQueue( response.slug, pluginsList );
1022
-
1023
- // Enable Demo Import Button
1024
- AstraSitesAdmin._enable_demo_import_button();
1025
-
1026
- }
1027
- });
1028
-
1029
- }, 1200 );
1030
-
1031
- },
1032
-
1033
- /**
1034
- * Plugin Installation Error.
1035
- */
1036
- _installError: function( event, response ) {
1037
-
1038
- var $card = $( '.plugin-card-' + response.slug );
1039
-
1040
- AstraSitesAdmin._log( response.errorMessage + ' ' + response.slug );
1041
-
1042
- $card
1043
- .removeClass( 'button-primary' )
1044
- .addClass( 'disabled' )
1045
- .html( wp.updates.l10n.installFailedShort );
1046
-
1047
- AstraSitesAdmin._importFailMessage( response.errorMessage );
1048
- },
1049
-
1050
- /**
1051
- * Installing Plugin
1052
- */
1053
- _pluginInstalling: function(event, args) {
1054
- event.preventDefault();
1055
-
1056
- var $card = $( '.plugin-card-' + args.slug );
1057
-
1058
- AstraSitesAdmin._log( astraSitesAdmin.log.installingPlugin + ' ' + args.slug );
1059
-
1060
- $card.addClass('updating-message');
1061
-
1062
- },
1063
-
1064
- /**
1065
- * Render Demo Preview
1066
- */
1067
- _activateNow: function( eventn ) {
1068
-
1069
- event.preventDefault();
1070
-
1071
- var $button = jQuery( event.target ),
1072
- $init = $button.data( 'init' ),
1073
- $slug = $button.data( 'slug' );
1074
-
1075
- if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
1076
- return;
1077
- }
1078
-
1079
- AstraSitesAdmin._log( astraSitesAdmin.log.activating + ' ' + $slug );
1080
-
1081
- $button.addClass('updating-message button-primary')
1082
- .html( astraSitesAdmin.strings.btnActivating );
1083
-
1084
- var $siteOptions = jQuery( '.wp-full-overlay-header').find('.astra-site-options').val();
1085
- var $enabledExtensions = jQuery( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
1086
-
1087
- $.ajax({
1088
- url: astraSitesAdmin.ajaxurl,
1089
- type: 'POST',
1090
- data: {
1091
- 'action' : 'astra-required-plugin-activate',
1092
- 'init' : $init,
1093
- 'options' : $siteOptions,
1094
- 'enabledExtensions' : $enabledExtensions,
1095
- },
1096
- })
1097
- .done(function (result) {
1098
-
1099
- if( result.success ) {
1100
-
1101
- AstraSitesAdmin._log( astraSitesAdmin.log.activated + ' ' + $slug );
1102
-
1103
- var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
1104
-
1105
- // Reset not installed plugins list.
1106
- astraSitesAdmin.requiredPlugins.inactive = AstraSitesAdmin._removePluginFromQueue( $slug, pluginsList );
1107
-
1108
- $button.removeClass( 'button-primary install-now activate-now updating-message' )
1109
- .attr('disabled', 'disabled')
1110
- .addClass('disabled')
1111
- .text( astraSitesAdmin.strings.btnActive );
1112
-
1113
- // Enable Demo Import Button
1114
- AstraSitesAdmin._enable_demo_import_button();
1115
-
1116
- }
1117
-
1118
- })
1119
- .fail(function () {
1120
- });
1121
-
1122
- },
1123
-
1124
- /**
1125
- * Full Overlay
1126
- */
1127
- _fullOverlay: function (event) {
1128
- event.preventDefault();
1129
-
1130
- // Import process is started?
1131
- // And Closing the window? Then showing the warning confirm message.
1132
- if( $('body').hasClass('importing-site') && ! confirm( astraSitesAdmin.strings.warningBeforeCloseWindow ) ) {
1133
- return;
1134
- }
1135
-
1136
- $('body').removeClass('importing-site');
1137
- $('.previous-theme, .next-theme').removeClass('disabled');
1138
- $('.theme-install-overlay').css('display', 'none');
1139
- $('.theme-install-overlay').remove();
1140
- $('.theme-preview-on').removeClass('theme-preview-on');
1141
- $('html').removeClass('astra-site-preview-on');
1142
- },
1143
-
1144
- /**
1145
- * Bulk Plugin Active & Install
1146
- */
1147
- _bulkPluginInstallActivate: function()
1148
- {
1149
- if( 0 === astraSitesAdmin.requiredPlugins.length ) {
1150
- return;
1151
- }
1152
-
1153
- var not_installed = astraSitesAdmin.requiredPlugins.notinstalled || '';
1154
- var activate_plugins = astraSitesAdmin.requiredPlugins.inactive || '';
1155
-
1156
- // First Install Bulk.
1157
- if( not_installed.length > 0 ) {
1158
- AstraSitesAdmin._installAllPlugins( not_installed );
1159
- }
1160
-
1161
- // Second Activate Bulk.
1162
- if( activate_plugins.length > 0 ) {
1163
- AstraSitesAdmin._activateAllPlugins( activate_plugins );
1164
- }
1165
-
1166
- if( activate_plugins.length <= 0 && not_installed.length <= 0 ) {
1167
- AstraSitesAdmin._enable_demo_import_button();
1168
- }
1169
-
1170
- },
1171
-
1172
- /**
1173
- * Activate All Plugins.
1174
- */
1175
- _activateAllPlugins: function( activate_plugins ) {
1176
-
1177
- AstraSitesAdmin._log( astraSitesAdmin.log.bulkActivation );
1178
-
1179
- $.each( activate_plugins, function(index, single_plugin) {
1180
-
1181
- var $card = $( '.plugin-card-' + single_plugin.slug ),
1182
- $siteOptions = $( '.wp-full-overlay-header').find('.astra-site-options').val(),
1183
- $enabledExtensions = $( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
1184
-
1185
- AstraSitesAjaxQueue.add({
1186
- url: astraSitesAdmin.ajaxurl,
1187
- type: 'POST',
1188
- data: {
1189
- 'action' : 'astra-required-plugin-activate',
1190
- 'init' : single_plugin.init,
1191
- 'options' : $siteOptions,
1192
- 'enabledExtensions' : $enabledExtensions,
1193
- },
1194
- success: function( result ){
1195
-
1196
- if( result.success ) {
1197
-
1198
- AstraSitesAdmin._log( astraSitesAdmin.log.activate + ' ' + single_plugin.slug );
1199
-
1200
- var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
1201
-
1202
- // Reset not installed plugins list.
1203
- astraSitesAdmin.requiredPlugins.inactive = AstraSitesAdmin._removePluginFromQueue( single_plugin.slug, pluginsList );
1204
-
1205
- // Enable Demo Import Button
1206
- AstraSitesAdmin._enable_demo_import_button();
1207
- } else {
1208
- AstraSitesAdmin._log( astraSitesAdmin.log.activationError + ' - ' + single_plugin.slug );
1209
- }
1210
- }
1211
- });
1212
- });
1213
- AstraSitesAjaxQueue.run();
1214
- },
1215
-
1216
- /**
1217
- * Install All Plugins.
1218
- */
1219
- _installAllPlugins: function( not_installed ) {
1220
-
1221
- AstraSitesAdmin._log( astraSitesAdmin.log.bulkInstall );
1222
-
1223
- $.each( not_installed, function(index, single_plugin) {
1224
-
1225
- var $card = $( '.plugin-card-' + single_plugin.slug );
1226
-
1227
- // Add each plugin activate request in Ajax queue.
1228
- // @see wp-admin/js/updates.js
1229
- wp.updates.queue.push( {
1230
- action: 'install-plugin', // Required action.
1231
- data: {
1232
- slug: single_plugin.slug
1233
- }
1234
- } );
1235
- });
1236
-
1237
- // Required to set queue.
1238
- wp.updates.queueChecker();
1239
- },
1240
-
1241
- /**
1242
- * Fires when a nav item is clicked.
1243
- *
1244
- * @since 1.0
1245
- * @access private
1246
- * @method _importDemo
1247
- */
1248
- _importDemo: function(event) {
1249
- event.preventDefault();
1250
-
1251
- var disabled = $(this).attr('data-import');
1252
-
1253
- if ( typeof disabled !== 'undefined' && disabled === 'disabled' || $this.hasClass('disabled') ) {
1254
-
1255
- $('.astra-demo-import').addClass('updating-message installing')
1256
- .text( wp.updates.l10n.installing );
1257
-
1258
- /**
1259
- * Process Bulk Plugin Install & Activate
1260
- */
1261
- AstraSitesAdmin._bulkPluginInstallActivate();
1262
- }
1263
- },
1264
-
1265
- _process_import() {
1266
-
1267
- var $theme = $('.astra-sites-preview').find('.wp-full-overlay-header'),
1268
- apiURL = $theme.data('demo-api') || '';
1269
-
1270
- $('body').addClass('importing-site');
1271
- $('.previous-theme, .next-theme').addClass('disabled');
1272
-
1273
- // Remove all notices before import start.
1274
- $('.install-theme-info > .notice').remove();
1275
-
1276
- $('.astra-demo-import').attr('data-import', 'disabled')
1277
- .addClass('updating-message installing')
1278
- .text( astraSitesAdmin.strings.importingDemo );
1279
-
1280
- // Site Import by API URL.
1281
- if( apiURL ) {
1282
- AstraSitesAdmin._importSite( apiURL );
1283
- }
1284
-
1285
- },
1286
-
1287
- /**
1288
- * Start Import Process by API URL.
1289
- *
1290
- * @param {string} apiURL Site API URL.
1291
- */
1292
- _importSite: function( apiURL ) {
1293
-
1294
- AstraSitesAdmin._log( astraSitesAdmin.log.api + ' : ' + apiURL );
1295
- AstraSitesAdmin._log( astraSitesAdmin.log.importing );
1296
-
1297
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.gettingData );
1298
-
1299
- // 1. Request Site Import
1300
- $.ajax({
1301
- url : astraSitesAdmin.ajaxurl,
1302
- type : 'POST',
1303
- dataType: 'json',
1304
- data : {
1305
- 'action' : 'astra-sites-import-set-site-data',
1306
- 'api_url' : apiURL,
1307
- },
1308
- })
1309
- .fail(function( jqXHR ){
1310
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
1311
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
1312
- })
1313
- .done(function ( demo_data ) {
1314
-
1315
- // 1. Fail - Request Site Import
1316
- if( false === demo_data.success ) {
1317
-
1318
- AstraSitesAdmin._importFailMessage( demo_data.data );
1319
-
1320
- } else {
1321
-
1322
- // Set log file URL.
1323
- if( 'log_file' in demo_data.data ){
1324
- AstraSitesAdmin.log_file_url = decodeURIComponent( demo_data.data.log_file ) || '';
1325
- }
1326
-
1327
- // 1. Pass - Request Site Import
1328
- AstraSitesAdmin._log( astraSitesAdmin.log.processingRequest );
1329
-
1330
- AstraSitesAdmin.customizer_data = JSON.stringify( demo_data.data['astra-site-customizer-data'] ) || '';
1331
- AstraSitesAdmin.wxr_url = encodeURI( demo_data.data['astra-site-wxr-path'] ) || '';
1332
- AstraSitesAdmin.wpforms_url = encodeURI( demo_data.data['astra-site-wpforms-path'] ) || '';
1333
- AstraSitesAdmin.options_data = JSON.stringify( demo_data.data['astra-site-options-data'] ) || '';
1334
- AstraSitesAdmin.widgets_data = JSON.stringify( demo_data.data['astra-site-widgets-data'] ) || '';
1335
-
1336
- $(document).trigger( 'astra-sites-import-set-site-data-done' );
1337
- }
1338
-
1339
- });
1340
-
1341
- },
1342
-
1343
- /**
1344
- * Collapse Sidebar.
1345
- */
1346
- _collapse: function() {
1347
- event.preventDefault();
1348
-
1349
- overlay = jQuery('.wp-full-overlay');
1350
-
1351
- if (overlay.hasClass('expanded')) {
1352
- overlay.removeClass('expanded');
1353
- overlay.addClass('collapsed');
1354
- return;
1355
- }
1356
-
1357
- if (overlay.hasClass('collapsed')) {
1358
- overlay.removeClass('collapsed');
1359
- overlay.addClass('expanded');
1360
- return;
1361
- }
1362
- },
1363
-
1364
- /**
1365
- * Previous Theme.
1366
- */
1367
- _previousTheme: function (event) {
1368
- event.preventDefault();
1369
-
1370
- currentDemo = jQuery('.theme-preview-on');
1371
- currentDemo.removeClass('theme-preview-on');
1372
- prevDemo = currentDemo.prev('.theme');
1373
- prevDemo.addClass('theme-preview-on');
1374
-
1375
- var site_id = $(this).parents('.wp-full-overlay-header').data('demo-id') || '';
1376
-
1377
- if( AstraSitesAPI._stored_data ) {
1378
- var site_data = AstraSitesAdmin._get_site_details( site_id );
1379
-
1380
-
1381
- if( site_data ) {
1382
- // Set current site details.
1383
- AstraSitesAdmin.current_site = site_data;
1384
- }
1385
- }
1386
-
1387
- AstraSitesAdmin._renderDemoPreview(prevDemo);
1388
- },
1389
-
1390
- /**
1391
- * Next Theme.
1392
- */
1393
- _nextTheme: function (event) {
1394
- event.preventDefault();
1395
- currentDemo = jQuery('.theme-preview-on')
1396
- currentDemo.removeClass('theme-preview-on');
1397
- nextDemo = currentDemo.next('.theme');
1398
- nextDemo.addClass('theme-preview-on');
1399
-
1400
- var site_id = $(this).parents('.wp-full-overlay-header').data('demo-id') || '';
1401
-
1402
- if( AstraSitesAPI._stored_data ) {
1403
- var site_data = AstraSitesAdmin._get_site_details( site_id );
1404
-
1405
-
1406
-
1407
- if( site_data ) {
1408
- // Set current site details.
1409
- AstraSitesAdmin.current_site = site_data;
1410
- }
1411
- }
1412
-
1413
- AstraSitesAdmin._renderDemoPreview( nextDemo );
1414
- },
1415
-
1416
- _set_current_screen: function( screen ) {
1417
- AstraSitesAdmin.current_screen = screen;
1418
- var old_screen = $('.astra-sites-preview').attr( 'screen' ) || '';
1419
-
1420
-
1421
- if( old_screen ) {
1422
- $('.astra-sites-preview').removeClass( 'screen-' + old_screen );
1423
- }
1424
-
1425
- $('.astra-sites-preview').attr( 'screen', screen );
1426
- $('.astra-sites-preview').addClass( 'screen-' + screen );
1427
- },
1428
-
1429
- /**
1430
- * Individual Site Preview
1431
- *
1432
- * On click on image, more link & preview button.
1433
- */
1434
- _preview: function( event ) {
1435
-
1436
- event.preventDefault();
1437
-
1438
- var site_id = $(this).parents('.site-single').data('demo-id') || '';
1439
-
1440
- if( AstraSitesAPI._stored_data ) {
1441
- var site_data = AstraSitesAdmin._get_site_details( site_id );
1442
-
1443
- if( site_data ) {
1444
- // Set current site details.
1445
- AstraSitesAdmin.current_site = site_data;
1446
-
1447
- // Set current screen.
1448
- AstraSitesAdmin._set_current_screen( 'get-started' );
1449
- }
1450
- }
1451
-
1452
- var self = $(this).parents('.theme');
1453
- self.addClass('theme-preview-on');
1454
-
1455
- $('html').addClass('astra-site-preview-on');
1456
-
1457
- AstraSitesAdmin._renderDemoPreview( self );
1458
- },
1459
-
1460
- _get_site_details: function( site_id ) {
1461
- var all_sites = AstraSitesAPI._stored_data['astra-sites'] || [];
1462
-
1463
- if( ! all_sites ) {
1464
- return false;
1465
- }
1466
-
1467
- var single_site = all_sites.filter(function (site) { return site.id == site_id });
1468
- if( ! single_site ) {
1469
- return false;
1470
- }
1471
-
1472
- if( ! $.isArray( single_site ) ) {
1473
- return false;
1474
- }
1475
-
1476
- return single_site[0];
1477
- },
1478
-
1479
- /**
1480
- * Check Next Previous Buttons.
1481
- */
1482
- _checkNextPrevButtons: function() {
1483
- currentDemo = jQuery('.theme-preview-on');
1484
- nextDemo = currentDemo.nextAll('.theme').length;
1485
- prevDemo = currentDemo.prevAll('.theme').length;
1486
-
1487
- if (nextDemo == 0) {
1488
- jQuery('.next-theme').addClass('disabled');
1489
- } else if (nextDemo != 0) {
1490
- jQuery('.next-theme').removeClass('disabled');
1491
- }