Astra Starter Sites - Version 1.0.13

Version Description

Download this release

Release Info

Developer Nikschavan
Plugin Icon Astra Starter Sites
Version 1.0.13
Comparing to
See all releases

Code changes from version 1.0.12 to 1.0.13

astra-sites.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Astra Sites - Lite
4
  * Plugin URI: http://www.wpastra.com/pro/
5
  * Description: Import free sites build with Astra theme.
6
- * Version: 1.0.12
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.0.12' );
23
  }
24
 
25
  if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
3
  * Plugin Name: Astra Sites - Lite
4
  * Plugin URI: http://www.wpastra.com/pro/
5
  * Description: Import free sites build with Astra theme.
6
+ * Version: 1.0.13
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.0.13' );
23
  }
24
 
25
  if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
inc/assets/css/admin.css CHANGED
@@ -1,5 +1,5 @@
1
  .wrap .status,
2
- .wrap .demo-type {
3
  position: absolute;
4
  z-index: 1;
5
  color: #fff;
@@ -8,29 +8,29 @@
8
  text-transform: uppercase;
9
  }
10
  .wrap .status,
11
- .wrap .demo-type.premium {
12
  background: #0073aa;
13
  }
14
  .wrap .status {
15
  left: -0.5em;
16
  }
17
- .wrap .demo-type.premium {
18
  right: -0.5em;
19
  }
20
 
21
  .wrap .status.publish,
22
- .wrap .demo-type.free {
23
  display: none;
24
  }
25
 
26
- .install-theme-info .demo-type {
27
  display: none;
28
  }
29
 
30
  .theme {
31
  position: relative;
32
  }
33
- .wrap .astra-sites-preview .demo-type.premium {
34
  display: block;
35
  display: none;
36
  position: relative;
@@ -48,7 +48,7 @@
48
  width: 100%;
49
  }
50
 
51
- .install-theme-info .demo-type.premium {
52
  display: none;
53
  }
54
 
@@ -220,4 +220,19 @@
220
  margin-left: 0;
221
  width: auto;
222
  float: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  }
1
  .wrap .status,
2
+ .wrap .site-type {
3
  position: absolute;
4
  z-index: 1;
5
  color: #fff;
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;
48
  width: 100%;
49
  }
50
 
51
+ .install-theme-info .site-type.premium {
52
  display: none;
53
  }
54
 
220
  margin-left: 0;
221
  width: auto;
222
  float: none;
223
+ }
224
+ .filters-wrap {
225
+ display: inline-block;
226
+ }
227
+ .spinner-wrap {
228
+ text-align: center;
229
+ }
230
+ .spinner-wrap .spinner {
231
+ float: none;
232
+ }
233
+ .hide-me {
234
+ display: none !important;
235
+ }
236
+ #astra-sites-admin {
237
+ height: 100vh;
238
  }
inc/assets/js/admin-page.js ADDED
@@ -0,0 +1,893 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ (function($){
78
+
79
+ AstraSitesAdmin = {
80
+
81
+ init: function()
82
+ {
83
+ this._resetPagedCount();
84
+ this._bind();
85
+ },
86
+
87
+ /**
88
+ * Binds events for the Astra Sites.
89
+ *
90
+ * @since 1.0.0
91
+ * @access private
92
+ * @method _bind
93
+ */
94
+ _bind: function()
95
+ {
96
+ $( document ).on('click' , '.theme-browser .theme-screenshot, .theme-browser .more-details, .theme-browser .install-theme-preview', AstraSitesAdmin._preview);
97
+ $( document ).on('click' , '.next-theme', AstraSitesAdmin._nextTheme);
98
+ $( document ).on('click' , '.previous-theme', AstraSitesAdmin._previousTheme);
99
+ $( document ).on('click' , '.collapse-sidebar', AstraSitesAdmin._collapse);
100
+ $( document ).on('click' , '.astra-demo-import', AstraSitesAdmin._importDemo);
101
+ $( document ).on('click' , '.install-now', AstraSitesAdmin._installNow);
102
+ $( document ).on('click' , '.close-full-overlay', AstraSitesAdmin._fullOverlay);
103
+ $( document ).on('click' , '.activate-now', AstraSitesAdmin._activateNow);
104
+ $( document ).on('wp-plugin-installing' , AstraSitesAdmin._pluginInstalling);
105
+ $( document ).on('wp-plugin-install-error' , AstraSitesAdmin._installError);
106
+ $( document ).on('wp-plugin-install-success' , AstraSitesAdmin._installSuccess);
107
+
108
+ },
109
+
110
+ /**
111
+ * Install Now
112
+ */
113
+ _installNow: function(event)
114
+ {
115
+ event.preventDefault();
116
+
117
+ var $button = jQuery( event.target ),
118
+ $document = jQuery(document);
119
+
120
+ if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
121
+ return;
122
+ }
123
+
124
+ if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) {
125
+ wp.updates.requestFilesystemCredentials( event );
126
+
127
+ $document.on( 'credential-modal-cancel', function() {
128
+ var $message = $( '.install-now.updating-message' );
129
+
130
+ $message
131
+ .removeClass( 'updating-message' )
132
+ .text( wp.updates.l10n.installNow );
133
+
134
+ wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' );
135
+ } );
136
+ }
137
+
138
+ wp.updates.installPlugin( {
139
+ slug: $button.data( 'slug' )
140
+ } );
141
+ },
142
+
143
+ /**
144
+ * Install Success
145
+ */
146
+ _installSuccess: function( event, response ) {
147
+
148
+ event.preventDefault();
149
+
150
+ var $message = jQuery( '.plugin-card-' + response.slug ).find( '.button' );
151
+ var $siteOptions = jQuery( '.wp-full-overlay-header').find('.astra-site-options').val();
152
+ var $enabledExtensions = jQuery( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
153
+
154
+ // Transform the 'Install' button into an 'Activate' button.
155
+ var $init = $message.data('init');
156
+
157
+ $message.removeClass( 'install-now installed button-disabled updated-message' )
158
+ .addClass('updating-message')
159
+ .html( astraSitesAdmin.strings.btnActivating );
160
+
161
+ // Reset not installed plugins list.
162
+ var pluginsList = astraSitesAdmin.requiredPlugins.notinstalled;
163
+ astraSitesAdmin.requiredPlugins.notinstalled = AstraSitesAdmin._removePluginFromQueue( response.slug, pluginsList );
164
+
165
+ // WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
166
+ setTimeout( function() {
167
+
168
+ jQuery.ajax({
169
+ url: astraSitesAdmin.ajaxurl,
170
+ type: 'POST',
171
+ data: {
172
+ 'action' : 'astra-required-plugin-activate',
173
+ 'init' : $init,
174
+ 'options' : $siteOptions,
175
+ 'enabledExtensions' : $enabledExtensions,
176
+ },
177
+ })
178
+ .done(function (result) {
179
+
180
+ if( result.success ) {
181
+
182
+ var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
183
+
184
+ // Reset not installed plugins list.
185
+ astraSitesAdmin.requiredPlugins.inactive = AstraSitesAdmin._removePluginFromQueue( response.slug, pluginsList );
186
+
187
+ $message.removeClass( 'button-primary install-now activate-now updating-message' )
188
+ .attr('disabled', 'disabled')
189
+ .addClass('disabled')
190
+ .text( astraSitesAdmin.strings.btnActive );
191
+
192
+ // Enable Demo Import Button
193
+ AstraSitesAdmin._enable_demo_import_button();
194
+
195
+ } else {
196
+
197
+ $message.removeClass( 'updating-message' );
198
+
199
+ }
200
+
201
+ });
202
+
203
+ }, 1200 );
204
+
205
+ },
206
+
207
+ /**
208
+ * Plugin Installation Error.
209
+ */
210
+ _installError: function( event, response ) {
211
+
212
+ var $card = jQuery( '.plugin-card-' + response.slug );
213
+
214
+ $card
215
+ .addClass( 'button-primary' )
216
+ .html( wp.updates.l10n.installNow );
217
+ },
218
+
219
+ /**
220
+ * Installing Plugin
221
+ */
222
+ _pluginInstalling: function(event, args) {
223
+ event.preventDefault();
224
+
225
+ var $card = jQuery( '.plugin-card-' + args.slug );
226
+ var $button = $card.find( '.button' );
227
+
228
+ $card.addClass('updating-message');
229
+ $button.addClass('already-started');
230
+
231
+ },
232
+
233
+ /**
234
+ * Render Demo Preview
235
+ */
236
+ _activateNow: function( eventn ) {
237
+
238
+ event.preventDefault();
239
+
240
+ var $button = jQuery( event.target ),
241
+ $init = $button.data( 'init' ),
242
+ $slug = $button.data( 'slug' );
243
+
244
+ if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
245
+ return;
246
+ }
247
+
248
+ $button.addClass('updating-message button-primary')
249
+ .html( astraSitesAdmin.strings.btnActivating );
250
+
251
+ var $siteOptions = jQuery( '.wp-full-overlay-header').find('.astra-site-options').val();
252
+ var $enabledExtensions = jQuery( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
253
+
254
+ jQuery.ajax({
255
+ url: astraSitesAdmin.ajaxurl,
256
+ type: 'POST',
257
+ data: {
258
+ 'action' : 'astra-required-plugin-activate',
259
+ 'init' : $init,
260
+ 'options' : $siteOptions,
261
+ 'enabledExtensions' : $enabledExtensions,
262
+ },
263
+ })
264
+ .done(function (result) {
265
+
266
+ if( result.success ) {
267
+
268
+ var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
269
+
270
+ // Reset not installed plugins list.
271
+ astraSitesAdmin.requiredPlugins.inactive = AstraSitesAdmin._removePluginFromQueue( $slug, pluginsList );
272
+
273
+ $button.removeClass( 'button-primary install-now activate-now updating-message' )
274
+ .attr('disabled', 'disabled')
275
+ .addClass('disabled')
276
+ .text( astraSitesAdmin.strings.btnActive );
277
+
278
+ // Enable Demo Import Button
279
+ AstraSitesAdmin._enable_demo_import_button();
280
+
281
+ }
282
+
283
+ })
284
+ .fail(function () {
285
+ });
286
+
287
+ },
288
+
289
+ /**
290
+ * Full Overlay
291
+ */
292
+ _fullOverlay: function (event) {
293
+ event.preventDefault();
294
+
295
+ jQuery('.theme-install-overlay').css('display', 'none');
296
+ jQuery('.theme-install-overlay').remove();
297
+ jQuery('.theme-preview-on').removeClass('theme-preview-on');
298
+ jQuery('html').removeClass('astra-site-preview-on');
299
+ },
300
+
301
+ /**
302
+ * Bulk Plugin Active & Install
303
+ */
304
+ _bulkPluginInstallActivate: function()
305
+ {
306
+ if( 0 === astraSitesAdmin.requiredPlugins.length ) {
307
+ return;
308
+ }
309
+
310
+ jQuery('.required-plugins')
311
+ .find('.install-now')
312
+ .addClass( 'updating-message' )
313
+ .removeClass( 'install-now' )
314
+ .text( wp.updates.l10n.installing );
315
+
316
+ jQuery('.required-plugins')
317
+ .find('.activate-now')
318
+ .addClass('updating-message')
319
+ .removeClass( 'activate-now' )
320
+ .html( astraSitesAdmin.strings.btnActivating );
321
+
322
+ var not_installed = astraSitesAdmin.requiredPlugins.notinstalled || '';
323
+ var activate_plugins = astraSitesAdmin.requiredPlugins.inactive || '';
324
+
325
+ // First Install Bulk.
326
+ if( not_installed.length > 0 ) {
327
+ AstraSitesAdmin._installAllPlugins( not_installed );
328
+ }
329
+
330
+ // Second Activate Bulk.
331
+ if( activate_plugins.length > 0 ) {
332
+ AstraSitesAdmin._activateAllPlugins( activate_plugins );
333
+ }
334
+
335
+ },
336
+
337
+ /**
338
+ * Activate All Plugins.
339
+ */
340
+ _activateAllPlugins: function( activate_plugins ) {
341
+
342
+ // Process of cloud templates - (download, remove & fetch).
343
+ AstraSitesAjaxQueue.run();
344
+
345
+ jQuery.each( activate_plugins, function(index, single_plugin) {
346
+
347
+ var $card = jQuery( '.plugin-card-' + single_plugin.slug ),
348
+ $button = $card.find('.button'),
349
+ $siteOptions = jQuery( '.wp-full-overlay-header').find('.astra-site-options').val(),
350
+ $enabledExtensions = jQuery( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
351
+
352
+ $button.addClass('updating-message');
353
+
354
+ AstraSitesAjaxQueue.add({
355
+ url: astraSitesAdmin.ajaxurl,
356
+ type: 'POST',
357
+ data: {
358
+ 'action' : 'astra-required-plugin-activate',
359
+ 'init' : single_plugin.init,
360
+ 'options' : $siteOptions,
361
+ 'enabledExtensions' : $enabledExtensions,
362
+ },
363
+ success: function( result ){
364
+
365
+ if( result.success ) {
366
+
367
+ var $card = jQuery( '.plugin-card-' + single_plugin.slug );
368
+ var $button = $card.find( '.button' );
369
+ if( ! $button.hasClass('already-started') ) {
370
+ var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
371
+
372
+ // Reset not installed plugins list.
373
+ astraSitesAdmin.requiredPlugins.inactive = AstraSitesAdmin._removePluginFromQueue( single_plugin.slug, pluginsList );
374
+ }
375
+
376
+ $button.removeClass( 'button-primary install-now activate-now updating-message' )
377
+ .attr('disabled', 'disabled')
378
+ .addClass('disabled')
379
+ .text( astraSitesAdmin.strings.btnActive );
380
+
381
+ // Enable Demo Import Button
382
+ AstraSitesAdmin._enable_demo_import_button();
383
+ }
384
+ }
385
+ });
386
+ });
387
+ },
388
+
389
+ /**
390
+ * Install All Plugins.
391
+ */
392
+ _installAllPlugins: function( not_installed ) {
393
+
394
+ jQuery.each( not_installed, function(index, single_plugin) {
395
+
396
+ var $card = jQuery( '.plugin-card-' + single_plugin.slug ),
397
+ $button = $card.find('.button');
398
+
399
+ if( ! $button.hasClass('already-started') ) {
400
+
401
+ // Add each plugin activate request in Ajax queue.
402
+ // @see wp-admin/js/updates.js
403
+ wp.updates.queue.push( {
404
+ action: 'install-plugin', // Required action.
405
+ data: {
406
+ slug: single_plugin.slug
407
+ }
408
+ } );
409
+ }
410
+ });
411
+
412
+ // Required to set queue.
413
+ wp.updates.queueChecker();
414
+ },
415
+
416
+ /**
417
+ * Fires when a nav item is clicked.
418
+ *
419
+ * @since 1.0
420
+ * @access private
421
+ * @method _importDemo
422
+ */
423
+ _importDemo: function()
424
+ {
425
+ var $this = jQuery(this),
426
+ $theme = $this.closest('.astra-sites-preview').find('.wp-full-overlay-header'),
427
+ apiURL = $theme.data('demo-api') || '',
428
+ plugins = $theme.data('required-plugins');
429
+
430
+ var disabled = $this.attr('data-import');
431
+
432
+ if ( typeof disabled !== 'undefined' && disabled === 'disabled' ) {
433
+
434
+ $this.addClass('updating-message')
435
+ .text( wp.updates.l10n.installing );
436
+
437
+ /**
438
+ * Process Bulk Plugin Install & Activate
439
+ */
440
+ AstraSitesAdmin._bulkPluginInstallActivate();
441
+
442
+ return;
443
+ }
444
+
445
+ // Proceed?
446
+ if( ! confirm( astraSitesAdmin.strings.importWarning ) ) {
447
+ return;
448
+ }
449
+
450
+ jQuery('.astra-demo-import').attr('data-import', 'disabled')
451
+ .addClass('updating-message installing')
452
+ .text( astraSitesAdmin.strings.importingDemo );
453
+
454
+ $this.closest('.theme').focus();
455
+
456
+ var $theme = $this.closest('.astra-sites-preview').find('.wp-full-overlay-header');
457
+
458
+ var apiURL = $theme.data('demo-api') || '';
459
+
460
+ jQuery.ajax({
461
+ url: astraSitesAdmin.ajaxurl,
462
+ type: 'POST',
463
+ dataType: 'json',
464
+ data: {
465
+ action: 'astra-import-demo',
466
+ api_url: apiURL
467
+ },
468
+ })
469
+ .done(function ( demos ) {
470
+
471
+ // Success?
472
+ if( demos.success ) {
473
+ jQuery('.astra-demo-import').removeClass('updating-message installing')
474
+ .removeAttr('data-import')
475
+ .addClass('view-site')
476
+ .removeClass('astra-demo-import')
477
+ .text( astraSitesAdmin.strings.viewSite )
478
+ .attr('target', '_blank')
479
+ .append('<i class="dashicons dashicons-external"></i>')
480
+ .attr('href', astraSitesAdmin.siteURL );
481
+
482
+ } else {
483
+
484
+ var output = '<div class="astra-api-error notice notice-error notice-alt is-dismissible">';
485
+ output += ' <p>'+demos.message+'</p>';
486
+ output += ' <button type="button" class="notice-dismiss">';
487
+ output += ' <span class="screen-reader-text">'+commonL10n.dismiss+'</span>';
488
+ output += ' </button>';
489
+ output += '</div>';
490
+
491
+ jQuery('.install-theme-info').prepend( output );
492
+
493
+ // !important to add trigger.
494
+ // Which reinitialize the dismiss error message events.
495
+ jQuery(document).trigger('wp-updates-notice-added');
496
+ }
497
+
498
+ })
499
+ .fail(function ( demos ) {
500
+ jQuery('.astra-demo-import').removeClass('updating-message installing')
501
+ .removeAttr('data-import')
502
+ .addClass('view-site')
503
+ .removeClass('astra-demo-import')
504
+ .attr('target', '_blank')
505
+ .attr('href', astraSitesAdmin.strings.importFailedURL );
506
+
507
+ jQuery('.wp-full-overlay-header .view-site').text( astraSitesAdmin.strings.importFailedBtnSmall ).append('<i class="dashicons dashicons-external"></i>');
508
+ jQuery('.footer-import-button-wrap .view-site').text( astraSitesAdmin.strings.importFailedBtnLarge ).append('<i class="dashicons dashicons-external"></i>');
509
+ });
510
+ },
511
+
512
+ /**
513
+ * Collapse Sidebar.
514
+ */
515
+ _collapse: function() {
516
+ event.preventDefault();
517
+
518
+ overlay = jQuery('.wp-full-overlay');
519
+
520
+ if (overlay.hasClass('expanded')) {
521
+ overlay.removeClass('expanded');
522
+ overlay.addClass('collapsed');
523
+ return;
524
+ }
525
+
526
+ if (overlay.hasClass('collapsed')) {
527
+ overlay.removeClass('collapsed');
528
+ overlay.addClass('expanded');
529
+ return;
530
+ }
531
+ },
532
+
533
+ /**
534
+ * Previous Theme.
535
+ */
536
+ _previousTheme: function (event) {
537
+ event.preventDefault();
538
+
539
+ currentDemo = jQuery('.theme-preview-on');
540
+ currentDemo.removeClass('theme-preview-on');
541
+ prevDemo = currentDemo.prev('.theme');
542
+ prevDemo.addClass('theme-preview-on');
543
+
544
+ AstraSitesAdmin._renderDemoPreview(prevDemo);
545
+ },
546
+
547
+ /**
548
+ * Next Theme.
549
+ */
550
+ _nextTheme: function (event) {
551
+ event.preventDefault();
552
+ currentDemo = jQuery('.theme-preview-on')
553
+ currentDemo.removeClass('theme-preview-on');
554
+ nextDemo = currentDemo.next('.theme');
555
+ nextDemo.addClass('theme-preview-on');
556
+
557
+ AstraSitesAdmin._renderDemoPreview( nextDemo );
558
+ },
559
+
560
+ /**
561
+ * Individual Site Preview
562
+ *
563
+ * On click on image, more link & preview button.
564
+ */
565
+ _preview: function( event ) {
566
+
567
+ event.preventDefault();
568
+
569
+ var self = jQuery(this).parents('.theme');
570
+ self.addClass('theme-preview-on');
571
+
572
+ jQuery('html').addClass('astra-site-preview-on');
573
+
574
+ AstraSitesAdmin._renderDemoPreview( self );
575
+ },
576
+
577
+ /**
578
+ * Check Next Previous Buttons.
579
+ */
580
+ _checkNextPrevButtons: function() {
581
+ currentDemo = jQuery('.theme-preview-on');
582
+ nextDemo = currentDemo.nextAll('.theme').length;
583
+ prevDemo = currentDemo.prevAll('.theme').length;
584
+
585
+ if (nextDemo == 0) {
586
+ jQuery('.next-theme').addClass('disabled');
587
+ } else if (nextDemo != 0) {
588
+ jQuery('.next-theme').removeClass('disabled');
589
+ }
590
+
591
+ if (prevDemo == 0) {
592
+ jQuery('.previous-theme').addClass('disabled');
593
+ } else if (prevDemo != 0) {
594
+ jQuery('.previous-theme').removeClass('disabled');
595
+ }
596
+
597
+ return;
598
+ },
599
+
600
+ /**
601
+ * Render Demo Preview
602
+ */
603
+ _renderDemoPreview: function(anchor) {
604
+
605
+ var demoId = anchor.data('id') || '',
606
+ apiURL = anchor.data('demo-api') || '',
607
+ demoType = anchor.data('demo-type') || '',
608
+ demoURL = anchor.data('demo-url') || '',
609
+ screenshot = anchor.data('screenshot') || '',
610
+ demo_name = anchor.data('demo-name') || '',
611
+ demo_slug = anchor.data('demo-slug') || '',
612
+ content = anchor.data('content') || '',
613
+ requiredPlugins = anchor.data('required-plugins') || '',
614
+ astraSiteOptions = anchor.find('.astra-site-options').val() || '';
615
+ astraEnabledExtensions = anchor.find('.astra-enabled-extensions').val() || '';
616
+
617
+ var template = wp.template('astra-site-preview');
618
+
619
+ templateData = [{
620
+ id : demoId,
621
+ astra_demo_type : demoType,
622
+ astra_demo_url : demoURL,
623
+ demo_api : apiURL,
624
+ screenshot : screenshot,
625
+ demo_name : demo_name,
626
+ slug : demo_slug,
627
+ content : content,
628
+ required_plugins : JSON.stringify(requiredPlugins),
629
+ astra_site_options : astraSiteOptions,
630
+ astra_enabled_extensions : astraEnabledExtensions,
631
+ }];
632
+
633
+ // delete any earlier fullscreen preview before we render new one.
634
+ jQuery('.theme-install-overlay').remove();
635
+
636
+ jQuery('#astra-sites-menu-page').append(template(templateData[0]));
637
+ jQuery('.theme-install-overlay').css('display', 'block');
638
+ AstraSitesAdmin._checkNextPrevButtons();
639
+
640
+ var desc = jQuery('.theme-details');
641
+ var descHeight = parseInt( desc.outerHeight() );
642
+ var descBtn = jQuery('.theme-details-read-more');
643
+
644
+ if( jQuery.isArray( requiredPlugins ) ) {
645
+
646
+ if( descHeight >= 55 ) {
647
+
648
+ // Show button.
649
+ descBtn.css( 'display', 'inline-block' );
650
+
651
+ // Set height upto 3 line.
652
+ desc.css( 'height', 57 );
653
+
654
+ // Button Click.
655
+ descBtn.click(function(event) {
656
+
657
+ if( descBtn.hasClass('open') ) {
658
+ desc.animate({ height: 57 },
659
+ 300, function() {
660
+ descBtn.removeClass('open');
661
+ descBtn.html( astraSitesAdmin.strings.DescExpand );
662
+ });
663
+ } else {
664
+ desc.animate({ height: descHeight },
665
+ 300, function() {
666
+ descBtn.addClass('open');
667
+ descBtn.html( astraSitesAdmin.strings.DescCollapse );
668
+ });
669
+ }
670
+
671
+ });
672
+ }
673
+
674
+ // or
675
+ var $pluginsFilter = jQuery( '#plugin-filter' ),
676
+ data = {
677
+ _ajax_nonce : astraSitesAdmin._ajax_nonce,
678
+ required_plugins : requiredPlugins
679
+ };
680
+
681
+ jQuery('.required-plugins').addClass('loading').html('<span class="spinner is-active"></span>');
682
+
683
+ wp.ajax.post( 'astra-required-plugins', data ).done( function( response ) {
684
+
685
+ // Remove loader.
686
+ jQuery('.required-plugins').removeClass('loading').html('');
687
+
688
+ /**
689
+ * Count remaining plugins.
690
+ * @type number
691
+ */
692
+ var remaining_plugins = 0;
693
+
694
+ /**
695
+ * Not Installed
696
+ *
697
+ * List of not installed required plugins.
698
+ */
699
+ if ( typeof response.notinstalled !== 'undefined' ) {
700
+
701
+ // Add not have installed plugins count.
702
+ remaining_plugins += parseInt( response.notinstalled.length );
703
+
704
+ jQuery( response.notinstalled ).each(function( index, plugin ) {
705
+
706
+ var output = '<div class="plugin-card ';
707
+ output += ' plugin-card-'+plugin.slug+'"';
708
+ output += ' data-slug="'+plugin.slug+'"';
709
+ output += ' data-init="'+plugin.init+'">';
710
+ output += ' <span class="title">'+plugin.name+'</span>';
711
+ output += ' <button class="button install-now"';
712
+ output += ' data-init="' + plugin.init + '"';
713
+ output += ' data-slug="' + plugin.slug + '"';
714
+ output += ' data-name="' + plugin.name + '">';
715
+ output += wp.updates.l10n.installNow;
716
+ output += ' </button>';
717
+ // output += ' <span class="dashicons-no dashicons"></span>';
718
+ output += '</div>';
719
+
720
+ jQuery('.required-plugins').append(output);
721
+
722
+ });
723
+ }
724
+
725
+ /**
726
+ * Inactive
727
+ *
728
+ * List of not inactive required plugins.
729
+ */
730
+ if ( typeof response.inactive !== 'undefined' ) {
731
+
732
+ // Add inactive plugins count.
733
+ remaining_plugins += parseInt( response.inactive.length );
734
+
735
+ jQuery( response.inactive ).each(function( index, plugin ) {
736
+
737
+ var output = '<div class="plugin-card ';
738
+ output += ' plugin-card-'+plugin.slug+'"';
739
+ output += ' data-slug="'+plugin.slug+'"';
740
+ output += ' data-init="'+plugin.init+'">';
741
+ output += ' <span class="title">'+plugin.name+'</span>';
742
+ output += ' <button class="button activate-now button-primary"';
743
+ output += ' data-init="' + plugin.init + '"';
744
+ output += ' data-slug="' + plugin.slug + '"';
745
+ output += ' data-name="' + plugin.name + '">';
746
+ output += wp.updates.l10n.activatePlugin;
747
+ output += ' </button>';
748
+ // output += ' <span class="dashicons-no dashicons"></span>';
749
+ output += '</div>';
750
+
751
+ jQuery('.required-plugins').append(output);
752
+
753
+ });
754
+ }
755
+
756
+ /**
757
+ * Active
758
+ *
759
+ * List of not active required plugins.
760
+ */
761
+ if ( typeof response.active !== 'undefined' ) {
762
+
763
+ jQuery( response.active ).each(function( index, plugin ) {
764
+
765
+ var output = '<div class="plugin-card ';
766
+ output += ' plugin-card-'+plugin.slug+'"';
767
+ output += ' data-slug="'+plugin.slug+'"';
768
+ output += ' data-init="'+plugin.init+'">';
769
+ output += ' <span class="title">'+plugin.name+'</span>';
770
+ output += ' <button class="button disabled"';
771
+ output += ' data-slug="' + plugin.slug + '"';
772
+ output += ' data-name="' + plugin.name + '">';
773
+ output += astraSitesAdmin.strings.btnActive;
774
+ output += ' </button>';
775
+ // output += ' <span class="dashicons-yes dashicons"></span>';
776
+ output += '</div>';
777
+
778
+ jQuery('.required-plugins').append(output);
779
+
780
+ });
781
+ }
782
+
783
+ /**
784
+ * Enable Demo Import Button
785
+ * @type number
786
+ */
787
+ astraSitesAdmin.requiredPlugins = response;
788
+ AstraSitesAdmin._enable_demo_import_button();
789
+
790
+ } );
791
+
792
+ } else {
793
+
794
+ // Enable Demo Import Button
795
+ AstraSitesAdmin._enable_demo_import_button( demoType );
796
+ jQuery('.required-plugins-wrap').remove();
797
+ }
798
+
799
+ return;
800
+ },
801
+
802
+ /**
803
+ * Enable Demo Import Button.
804
+ */
805
+ _enable_demo_import_button: function( type = 'free' ) {
806
+
807
+ switch( type ) {
808
+
809
+ case 'free':
810
+ var all_buttons = parseInt( jQuery( '.plugin-card .button' ).length ) || 0,
811
+ disabled_buttons = parseInt( jQuery( '.plugin-card .button.disabled' ).length ) || 0;
812
+
813
+ if( all_buttons === disabled_buttons ) {
814
+
815
+ jQuery('.astra-demo-import')
816
+ .removeAttr('data-import')
817
+ .removeClass('updating-message')
818
+ .addClass('button-primary')
819
+ .text( astraSitesAdmin.strings.importDemo );
820
+ }
821
+
822
+ break;
823
+
824
+ case 'upgrade':
825
+ var demo_slug = jQuery('.wp-full-overlay-header').attr('data-demo-slug');
826
+
827
+ jQuery('.astra-demo-import')
828
+ .addClass('go-pro button-primary')
829
+ .removeClass('astra-demo-import')
830
+ .attr('target', '_blank')
831
+ .attr('href', astraSitesAdmin.getUpgradeURL + demo_slug )
832
+ .text( astraSitesAdmin.getUpgradeText )
833
+ .append('<i class="dashicons dashicons-external"></i>');
834
+ break;
835
+
836
+ default:
837
+ var demo_slug = jQuery('.wp-full-overlay-header').attr('data-demo-slug');
838
+
839
+ jQuery('.astra-demo-import')
840
+ .addClass('go-pro button-primary')
841
+ .removeClass('astra-demo-import')
842
+ .attr('target', '_blank')
843
+ .attr('href', astraSitesAdmin.getProURL )
844
+ .text( astraSitesAdmin.getProText )
845
+ .append('<i class="dashicons dashicons-external"></i>');
846
+ break;
847
+ }
848
+
849
+ },
850
+
851
+ /**
852
+ * Update Page Count.
853
+ */
854
+ _updatedPagedCount: function() {
855
+ paged = parseInt(jQuery('body').attr('data-astra-demo-paged'));
856
+ jQuery('body').attr('data-astra-demo-paged', paged + 1);
857
+ window.setTimeout(function () {
858
+ jQuery('body').data('scrolling', false);
859
+ }, 800);
860
+ },
861
+
862
+ /**
863
+ * Reset Page Count.
864
+ */
865
+ _resetPagedCount: function() {
866
+
867
+ $('body').addClass('loading-content');
868
+ $('body').attr('data-astra-demo-last-request', '1');
869
+ $('body').attr('data-astra-demo-paged', '1');
870
+ $('body').attr('data-astra-demo-search', '');
871
+ $('body').attr('data-scrolling', false);
872
+
873
+ },
874
+
875
+ /**
876
+ * Remove plugin from the queue.
877
+ */
878
+ _removePluginFromQueue: function( removeItem, pluginsList ) {
879
+ return jQuery.grep(pluginsList, function( value ) {
880
+ return value.slug != removeItem;
881
+ });
882
+ }
883
+
884
+ };
885
+
886
+ /**
887
+ * Initialize AstraSitesAdmin
888
+ */
889
+ $(function(){
890
+ AstraSitesAdmin.init();
891
+ });
892
+
893
+ })(jQuery);
inc/assets/js/astra-sites-api.js ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ (function($){
3
+
4
+ AstraSitesAPI = {
5
+
6
+ _api_url : astraSitesApi.ApiURL,
7
+
8
+ /**
9
+ * API Request
10
+ */
11
+ _api_request: function( args ) {
12
+
13
+ // Set API Request Data.
14
+ var data = {
15
+ url: AstraSitesAPI._api_url + args.slug,
16
+ cache: false,
17
+ };
18
+
19
+ // Set API Request Header.
20
+ if( astraRenderGrid.headers ) {
21
+ data.headers = astraRenderGrid.headers;
22
+ }
23
+
24
+ $.ajax( data )
25
+ .done(function( items, status, XHR ) {
26
+
27
+ if( 'success' === status && XHR.getResponseHeader('x-wp-total') ) {
28
+
29
+ var data = {
30
+ args : args,
31
+ items : items,
32
+ items_count : XHR.getResponseHeader('x-wp-total') || 0,
33
+ };
34
+
35
+ if( 'undefined' !== args.trigger && '' !== args.trigger ) {
36
+ $(document).trigger( args.trigger, [data] );
37
+ }
38
+
39
+ } else {
40
+ $(document).trigger( 'astra-sites-api-request-error' );
41
+ }
42
+
43
+ })
44
+ .fail(function( jqXHR, textStatus ) {
45
+
46
+ $(document).trigger( 'astra-sites-api-request-fail' );
47
+
48
+ })
49
+ .always(function() {
50
+
51
+ $(document).trigger( 'astra-sites-api-request-always' );
52
+
53
+ });
54
+
55
+ },
56
+
57
+ };
58
+
59
+ })(jQuery);
inc/assets/js/render-grid.js ADDED
@@ -0,0 +1,502 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+ AstraRender = {
3
+
4
+ _ref : null,
5
+
6
+ /**
7
+ * _api_params = {
8
+ * 'search' : '',
9
+ * 'per_page' : '',
10
+ * 'astra-site-category' : '',
11
+ * 'astra-site-page-builder' : '',
12
+ * 'page' : '',
13
+ * };
14
+ *
15
+ * E.g. per_page=<page-id>&astra-site-category=<category-ids>&astra-site-page-builder=<page-builder-ids>&page=<page>
16
+ */
17
+ _api_params : {},
18
+ _breakpoint : 768,
19
+
20
+ init: function()
21
+ {
22
+ this._resetPagedCount();
23
+ this._bind();
24
+ this._showFilters();
25
+ },
26
+
27
+ /**
28
+ * Binds events for the Astra Sites.
29
+ *
30
+ * @since 1.0.0
31
+ * @access private
32
+ * @method _bind
33
+ */
34
+ _bind: function()
35
+ {
36
+ $( document ).on('astra-sites-api-request-fail' , AstraRender._apiFailed );
37
+ $( document ).on('astra-api-post-loaded-on-scroll' , AstraRender._reinitGridScrolled );
38
+ $( document ).on('astra-api-post-loaded' , AstraRender._reinitGrid );
39
+ $( document ).on('astra-api-category-loaded' , AstraRender._addFilters );
40
+ $( document ).on('astra-api-all-category-loaded' , AstraRender._loadFirstGrid );
41
+
42
+ // Event's for API request.
43
+ $( document ).on('click' , '.filter-links a', AstraRender._filterClick );
44
+ $( document ).on('keyup input' , '#wp-filter-search-input', AstraRender._search );
45
+ $( document ).on('scroll' , AstraRender._scroll );
46
+
47
+ },
48
+
49
+ /**
50
+ * On Filter Clicked
51
+ *
52
+ * Prepare Before API Request:
53
+ * - Empty search input field to avoid search term on filter click.
54
+ * - Remove Inline Height
55
+ * - Added 'hide-me' class to hide the 'No more sites!' string.
56
+ * - Added 'loading-content' for body.
57
+ * - Show spinner.
58
+ */
59
+ _filterClick: function( event ) {
60
+
61
+ event.preventDefault();
62
+
63
+ $(this).parents('.filter-links').find('a').removeClass('current');
64
+ $(this).addClass('current');
65
+
66
+ // Prepare Before Search.
67
+ $('#wp-filter-search-input').val('');
68
+ $('#astra-sites').hide().css('height', '');
69
+ $('body').addClass('loading-content');
70
+ $('#astra-sites-admin').find('.spinner').removeClass('hide-me');
71
+
72
+ // Show sites.
73
+ AstraRender._showSites();
74
+ },
75
+
76
+ /**
77
+ * Search Site.
78
+ *
79
+ * Prepare Before API Request:
80
+ * - Remove Inline Height
81
+ * - Added 'hide-me' class to hide the 'No more sites!' string.
82
+ * - Added 'loading-content' for body.
83
+ * - Show spinner.
84
+ */
85
+ _search: function() {
86
+
87
+ $this = jQuery('#wp-filter-search-input').val();
88
+
89
+ // Prepare Before Search.
90
+ $('#astra-sites').hide().css('height', '');
91
+ $('body').addClass('loading-content');
92
+ $('#astra-sites-admin').find('.spinner').removeClass('hide-me');
93
+
94
+ window.clearTimeout(AstraRender._ref);
95
+ AstraRender._ref = window.setTimeout(function () {
96
+ AstraRender._ref = null;
97
+
98
+ AstraRender._resetPagedCount();
99
+ jQuery('body').addClass('loading-content');
100
+ jQuery('body').attr('data-astra-demo-search', $this);
101
+
102
+ AstraRender._showSites();
103
+
104
+ }, 500);
105
+
106
+ },
107
+
108
+ /**
109
+ * On Scroll
110
+ */
111
+ _scroll: function(event) {
112
+
113
+ if( ! $('body').hasClass('listed-all-sites') ) {
114
+
115
+ var scrollDistance = jQuery(window).scrollTop();
116
+
117
+ var themesBottom = Math.abs(jQuery(window).height() - jQuery('#astra-sites').offset().top - jQuery('#astra-sites').height());
118
+ themesBottom = themesBottom - 100;
119
+
120
+ ajaxLoading = jQuery('body').data('scrolling');
121
+
122
+ if (scrollDistance > themesBottom && ajaxLoading == false) {
123
+ AstraRender._updatedPagedCount();
124
+
125
+ if( ! $('#astra-sites .no-themes').length ) {
126
+ $('#astra-sites-admin').find('.spinner').addClass('is-active');
127
+ }
128
+
129
+ jQuery('body').data('scrolling', true);
130
+
131
+ /**
132
+ * @see _reinitGridScrolled() which called in trigger 'astra-api-post-loaded-on-scroll'
133
+ */
134
+ AstraRender._showSites( false, 'astra-api-post-loaded-on-scroll' );
135
+ }
136
+ }
137
+ },
138
+
139
+ /**
140
+ * Lazy Load Images
141
+ *
142
+ * @see http://jquery.eisbehr.de/lazy/#features
143
+ */
144
+ _lazyLoad: function() {
145
+
146
+ $('#astra-sites img').Lazy({
147
+ effect: 'fadeIn',
148
+ });
149
+ },
150
+
151
+ _apiAddParam_status: function() {
152
+ if( astraRenderGrid.sites && astraRenderGrid.sites.status ) {
153
+ AstraRender._api_params['status'] = astraRenderGrid.sites.status;
154
+ }
155
+ },
156
+
157
+ // Add 'search'
158
+ _apiAddParam_search: function() {
159
+ var search_val = jQuery('#wp-filter-search-input').val() || '';
160
+ if( '' !== search_val ) {
161
+ AstraRender._api_params['search'] = search_val;
162
+ }
163
+ },
164
+
165
+ _apiAddParam_per_page: function() {
166
+