Version Description
Download this release
Release Info
Developer | Nikschavan |
Plugin | |
Version | 1.1.4 |
Comparing to | |
See all releases |
Code changes from version 1.1.3 to 1.1.4
- astra-sites.php +2 -2
- inc/admin/class-astra-sites-page.php +0 -270
- inc/admin/view-astra-sites.php +0 -211
- inc/assets/css/admin.css +3 -0
- inc/assets/js/admin-page.js +24 -10
- inc/assets/js/admin.js +0 -1138
- inc/assets/js/astra-sites-notices.js +1 -1
- inc/assets/vendor/js/jquery.lazy.js +0 -830
- inc/assets/vendor/js/jquery.lazy.min.js +0 -2
- inc/classes/class-astra-sites-importer.php +4 -1
- inc/classes/class-astra-sites-notices.php +3 -7
- inc/classes/class-astra-sites.php +3 -3
- inc/classes/compatibility/class-astra-sites-compatibility-astra-pro.php +0 -86
- inc/classes/compatibility/class-astra-sites-compatibility-so-widgets.php +0 -86
- inc/classes/compatibility/class-astra-sites-compatibility.php +4 -0
- inc/classes/compatibility/elementor/background-processing/class-astra-elementor-image-importer-process.php +0 -64
- inc/classes/compatibility/elementor/class-astra-sites-compatibility-elementor.php +0 -144
- inc/classes/compatibility/elementor/class-astra-sites-source-remote.php +0 -302
- inc/classes/compatibility/woocommerce/class-astra-sites-compatibility-woocommerce.php +85 -0
- inc/classes/vendor/wp-async-request.php +0 -164
- inc/classes/vendor/wp-background-process.php +0 -507
- inc/importers/class-astra-site-options-import.php +53 -5
- languages/astra-sites.pot +38 -42
- readme.txt +6 -1
astra-sites.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Astra Starter Sites
|
4 |
* Plugin URI: http://www.wpastra.com/pro/
|
5 |
* Description: Import free sites build with Astra theme.
|
6 |
-
* Version: 1.1.
|
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.1.
|
23 |
}
|
24 |
|
25 |
if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
|
3 |
* Plugin Name: Astra Starter Sites
|
4 |
* Plugin URI: http://www.wpastra.com/pro/
|
5 |
* Description: Import free sites build with Astra theme.
|
6 |
+
* Version: 1.1.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.1.4' );
|
23 |
}
|
24 |
|
25 |
if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
|
inc/admin/class-astra-sites-page.php
DELETED
@@ -1,270 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Astra Sites Page
|
4 |
-
*
|
5 |
-
* @since 1.0.6
|
6 |
-
* @package Astra Sites
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
if ( ! class_exists( 'Astra_Sites_Page' ) ) {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Astra Admin Settings
|
17 |
-
*/
|
18 |
-
class Astra_Sites_Page {
|
19 |
-
|
20 |
-
/**
|
21 |
-
* View all actions
|
22 |
-
*
|
23 |
-
* @since 1.0.6
|
24 |
-
* @var array $view_actions
|
25 |
-
*/
|
26 |
-
static public $view_actions = array();
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Menu page title
|
30 |
-
*
|
31 |
-
* @since 1.0.6
|
32 |
-
* @var array $menu_page_title
|
33 |
-
*/
|
34 |
-
static public $menu_page_title = ASTRA_SITES_NAME;
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Plugin slug
|
38 |
-
*
|
39 |
-
* @since 1.0.6
|
40 |
-
* @var array $plugin_slug
|
41 |
-
*/
|
42 |
-
static public $plugin_slug = 'astra-sites';
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Default Menu position
|
46 |
-
*
|
47 |
-
* @since 1.0.6
|
48 |
-
* @var array $default_menu_position
|
49 |
-
*/
|
50 |
-
static public $default_menu_position = 'themes.php';
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Parent Page Slug
|
54 |
-
*
|
55 |
-
* @since 1.0.6
|
56 |
-
* @var array $parent_page_slug
|
57 |
-
*/
|
58 |
-
static public $parent_page_slug = 'general';
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Current Slug
|
62 |
-
*
|
63 |
-
* @since 1.0.6
|
64 |
-
* @var array $current_slug
|
65 |
-
*/
|
66 |
-
static public $current_slug = 'general';
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Constructor
|
70 |
-
*/
|
71 |
-
function __construct() {
|
72 |
-
|
73 |
-
if ( ! is_admin() ) {
|
74 |
-
return;
|
75 |
-
}
|
76 |
-
|
77 |
-
add_action( 'after_setup_theme', __CLASS__ . '::init_admin_settings', 99 );
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Admin settings init
|
82 |
-
*/
|
83 |
-
static public function init_admin_settings() {
|
84 |
-
|
85 |
-
self::$menu_page_title = apply_filters( 'astra_sites_menu_page_title', __( 'Astra Sites' , 'astra-sites' ) );
|
86 |
-
|
87 |
-
if ( isset( $_REQUEST['page'] ) && strpos( $_REQUEST['page'], self::$plugin_slug ) !== false ) {
|
88 |
-
|
89 |
-
// Let extensions hook into saving.
|
90 |
-
self::save_settings();
|
91 |
-
}
|
92 |
-
|
93 |
-
add_action( 'admin_menu', __CLASS__ . '::add_admin_menu', 100 );
|
94 |
-
|
95 |
-
add_action( 'astra_sites_menu_general_action', __CLASS__ . '::general_page' );
|
96 |
-
}
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Save All admin settings here
|
100 |
-
*/
|
101 |
-
static public function save_settings() {
|
102 |
-
|
103 |
-
// Only admins can save settings.
|
104 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
105 |
-
return;
|
106 |
-
}
|
107 |
-
|
108 |
-
// Let extensions hook into saving.
|
109 |
-
do_action( 'astra_sites_save_settings' );
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Init Nav Menu
|
114 |
-
*
|
115 |
-
* @param mixed $action Action name.
|
116 |
-
* @since 1.0.6
|
117 |
-
*/
|
118 |
-
static public function init_nav_menu( $action = '' ) {
|
119 |
-
|
120 |
-
if ( '' !== $action ) {
|
121 |
-
self::render_tab_menu( $action );
|
122 |
-
}
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Render tab menu
|
127 |
-
*
|
128 |
-
* @param mixed $action Action name.
|
129 |
-
* @since 1.0.6
|
130 |
-
*/
|
131 |
-
static public function render_tab_menu( $action = '' ) {
|
132 |
-
?>
|
133 |
-
<div id="astra-sites-menu-page">
|
134 |
-
<?php self::render( $action ); ?>
|
135 |
-
</div>
|
136 |
-
<?php
|
137 |
-
}
|
138 |
-
|
139 |
-
/**
|
140 |
-
* View actions
|
141 |
-
*
|
142 |
-
* @since 1.0.11
|
143 |
-
*/
|
144 |
-
static public function get_view_actions() {
|
145 |
-
|
146 |
-
if ( empty( self::$view_actions ) ) {
|
147 |
-
|
148 |
-
self::$view_actions = apply_filters(
|
149 |
-
'astra_sites_menu_item', array()
|
150 |
-
);
|
151 |
-
}
|
152 |
-
|
153 |
-
return self::$view_actions;
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Prints HTML content for tabs
|
158 |
-
*
|
159 |
-
* @param mixed $action Action name.
|
160 |
-
* @since 1.0.6
|
161 |
-
*/
|
162 |
-
static public function render( $action ) {
|
163 |
-
|
164 |
-
?>
|
165 |
-
<div class="nav-tab-wrapper">
|
166 |
-
<h1 class='astra-sites-title'> <?php echo esc_html( self::$menu_page_title ); ?> </h1>
|
167 |
-
<?php
|
168 |
-
$view_actions = self::get_view_actions();
|
169 |
-
|
170 |
-
foreach ( $view_actions as $slug => $data ) {
|
171 |
-
|
172 |
-
if ( ! $data['show'] ) {
|
173 |
-
continue;
|
174 |
-
}
|
175 |
-
|
176 |
-
$url = self::get_page_url( $slug );
|
177 |
-
|
178 |
-
if ( $slug == self::$parent_page_slug ) {
|
179 |
-
update_option( 'astra_parent_page_url', $url );
|
180 |
-
}
|
181 |
-
|
182 |
-
$active = ( $slug == $action ) ? 'nav-tab-active' : '';
|
183 |
-
?>
|
184 |
-
<a class='nav-tab <?php echo esc_attr( $active ); ?>' href='<?php echo esc_url( $url ); ?>'> <?php echo esc_html( $data['label'] ); ?> </a>
|
185 |
-
<?php } ?>
|
186 |
-
</div><!-- .nav-tab-wrapper -->
|
187 |
-
|
188 |
-
<?php
|
189 |
-
// Settings update message.
|
190 |
-
if ( isset( $_REQUEST['message'] ) && ( 'saved' == $_REQUEST['message'] || 'saved_ext' == $_REQUEST['message'] ) ) {
|
191 |
-
?>
|
192 |
-
<span id="message" class="notice notice-success is-dismissive"><p> <?php esc_html_e( 'Settings saved successfully.', 'astra-sites' ); ?> </p></span>
|
193 |
-
<?php
|
194 |
-
}
|
195 |
-
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Get and return page URL
|
200 |
-
*
|
201 |
-
* @param string $menu_slug Menu name.
|
202 |
-
* @since 1.0.6
|
203 |
-
* @return string page url
|
204 |
-
*/
|
205 |
-
static public function get_page_url( $menu_slug ) {
|
206 |
-
|
207 |
-
$parent_page = self::$default_menu_position;
|
208 |
-
|
209 |
-
if ( strpos( $parent_page, '?' ) !== false ) {
|
210 |
-
$query_var = '&page=' . self::$plugin_slug;
|
211 |
-
} else {
|
212 |
-
$query_var = '?page=' . self::$plugin_slug;
|
213 |
-
}
|
214 |
-
|
215 |
-
$parent_page_url = admin_url( $parent_page . $query_var );
|
216 |
-
|
217 |
-
$url = $parent_page_url . '&action=' . $menu_slug;
|
218 |
-
|
219 |
-
return esc_url( $url );
|
220 |
-
}
|
221 |
-
|
222 |
-
/**
|
223 |
-
* Add main menu
|
224 |
-
*
|
225 |
-
* @since 1.0.6
|
226 |
-
*/
|
227 |
-
static public function add_admin_menu() {
|
228 |
-
|
229 |
-
$parent_page = self::$default_menu_position;
|
230 |
-
$page_title = self::$menu_page_title;
|
231 |
-
$capability = 'manage_options';
|
232 |
-
$page_menu_slug = self::$plugin_slug;
|
233 |
-
$page_menu_func = __CLASS__ . '::menu_callback';
|
234 |
-
|
235 |
-
add_theme_page( $page_title, $page_title, $capability, $page_menu_slug, $page_menu_func );
|
236 |
-
}
|
237 |
-
|
238 |
-
/**
|
239 |
-
* Menu callback
|
240 |
-
*
|
241 |
-
* @since 1.0.6
|
242 |
-
*/
|
243 |
-
static public function menu_callback() {
|
244 |
-
|
245 |
-
$current_slug = isset( $_GET['action'] ) ? esc_attr( $_GET['action'] ) : self::$current_slug;
|
246 |
-
|
247 |
-
$active_tab = str_replace( '_', '-', $current_slug );
|
248 |
-
$current_slug = str_replace( '-', '_', $current_slug );
|
249 |
-
|
250 |
-
?>
|
251 |
-
<div class="astra-sites-menu-page-wrapper">
|
252 |
-
<?php self::init_nav_menu( $active_tab ); ?>
|
253 |
-
<?php do_action( 'astra_sites_menu_' . esc_attr( $current_slug ) . '_action' ); ?>
|
254 |
-
</div>
|
255 |
-
<?php
|
256 |
-
}
|
257 |
-
|
258 |
-
/**
|
259 |
-
* Include general page
|
260 |
-
*
|
261 |
-
* @since 1.0.6
|
262 |
-
*/
|
263 |
-
static public function general_page() {
|
264 |
-
require_once ASTRA_SITES_DIR . 'inc/admin/view-astra-sites.php';
|
265 |
-
}
|
266 |
-
}
|
267 |
-
|
268 |
-
new Astra_Sites_Page;
|
269 |
-
|
270 |
-
}// End if().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
5 |
-
* @package Astra Addon
|
6 |
-
*/
|
7 |
-
|
8 |
-
defined( 'ABSPATH' ) or exit;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Initial Demo List
|
12 |
-
*
|
13 |
-
* Generated though PHP
|
14 |
-
*/
|
15 |
-
?>
|
16 |
-
<div class="wrap">
|
17 |
-
|
18 |
-
|
19 |
-
<div class="wp-filter hide-if-no-js">
|
20 |
-
|
21 |
-
<div class="section-left">
|
22 |
-
|
23 |
-
<div class="filter-count">
|
24 |
-
<span class="count"></span>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<ul class="filter-links astra-page-builder">
|
28 |
-
<?php
|
29 |
-
foreach ( Astra_Sites::get_page_builders() as $key => $category ) {
|
30 |
-
$current = '';
|
31 |
-
|
32 |
-
if ( 0 === $key ) {
|
33 |
-
$current = 'current';
|
34 |
-
}
|
35 |
-
?>
|
36 |
-
<li>
|
37 |
-
<a href="#"
|
38 |
-
data-sort="<?php echo esc_attr( $category['slug'] ); ?>"
|
39 |
-
data-id="<?php echo esc_attr( $category['id'] ); ?>"
|
40 |
-
class="<?php echo esc_attr( $current ); ?>">
|
41 |
-
<?php echo esc_attr( $category['name'] ); ?>
|
42 |
-
</a>
|
43 |
-
</li>
|
44 |
-
<?php } ?>
|
45 |
-
</ul>
|
46 |
-
</div>
|
47 |
-
|
48 |
-
<div class="section-right">
|
49 |
-
<ul class="filter-links astra-category">
|
50 |
-
|
51 |
-
<li><a href="#" data-sort="all" class="current" data-id="all"><?php esc_html_e( 'All', 'astra-sites' ); ?></a></li>
|
52 |
-
|
53 |
-
<?php foreach ( Astra_Sites::get_demo_categories() as $key => $category ) { ?>
|
54 |
-
<li>
|
55 |
-
<a href="#"
|
56 |
-
data-sort="<?php echo esc_attr( $category['slug'] ); ?>"
|
57 |
-
data-id="<?php echo esc_attr( $category['id'] ); ?>">
|
58 |
-
<?php echo esc_attr( $category['name'] ); ?>
|
59 |
-
</a>
|
60 |
-
</li>
|
61 |
-
<?php } ?>
|
62 |
-
</ul>
|
63 |
-
|
64 |
-
<div class="search-form">
|
65 |
-
<label class="screen-reader-text" for="wp-filter-search-input"><?php esc_html_e( 'Search Sites', 'astra-sites' ); ?></label>
|
66 |
-
<input placeholder="<?php esc_attr_e( 'Search Sites...', 'astra-sites' ); ?>" type="search" aria-describedby="live-search-desc" id="wp-filter-search-input" class="wp-filter-search">
|
67 |
-
</div>
|
68 |
-
</div>
|
69 |
-
|
70 |
-
</div>
|
71 |
-
|
72 |
-
<?php do_action( 'astra_sites_before_site_grid' ); ?>
|
73 |
-
|
74 |
-
<span class="spinner"></span>
|
75 |
-
|
76 |
-
<div class="theme-browser rendered">
|
77 |
-
<div class="themes wp-clearfix"></div>
|
78 |
-
</div>
|
79 |
-
|
80 |
-
<?php do_action( 'astra_sites_after_site_grid' ); ?>
|
81 |
-
|
82 |
-
</div>
|
83 |
-
|
84 |
-
<?php
|
85 |
-
/**
|
86 |
-
* Regenerated Demo List
|
87 |
-
*
|
88 |
-
* Generated though JS after search demo, filter demo etc.
|
89 |
-
*/
|
90 |
-
?>
|
91 |
-
<script type="text/template" id="tmpl-astra-single-demo">
|
92 |
-
<div class="theme astra-theme {{data.status}}" tabindex="0" aria-describedby="astra-theme-action astra-theme-name"
|
93 |
-
data-demo-id="{{{data.id}}}"
|
94 |
-
data-demo-type="{{{data.astra_demo_type}}}"
|
95 |
-
data-demo-url="{{{data.astra_demo_url}}}"
|
96 |
-
data-demo-api="{{{data.demo_api}}}"
|
97 |
-
data-demo-name="{{{data.demo_name}}}"
|
98 |
-
data-demo-slug="{{{data.slug}}}"
|
99 |
-
data-screenshot="{{{data.screenshot}}}"
|
100 |
-
data-content="{{{data.content}}}"
|
101 |
-
data-required-plugins="{{data.required_plugins}}">
|
102 |
-
<input type="hidden" class="astra-site-options" value="{{data.astra_site_options}}" >
|
103 |
-
<input type="hidden" class="astra-enabled-extensions" value="{{data.astra_enabled_extensions}}" >
|
104 |
-
|
105 |
-
<span class="status {{data.status}}">{{data.status}}</span>
|
106 |
-
|
107 |
-
<span class="demo-type {{{data.astra_demo_type}}}">{{{data.astra_demo_type}}}</span>
|
108 |
-
|
109 |
-
<div class="theme-screenshot">
|
110 |
-
<# if ( data.screenshot.length ) { #>
|
111 |
-
<img src="{{{data.screenshot}}}" alt="">
|
112 |
-
<# } #>
|
113 |
-
</div>
|
114 |
-
|
115 |
-
<a href="{{{data.astra_demo_url}}}" target="_blank">
|
116 |
-
<span class="more-details" id="astra-theme-action"><?php esc_html_e( 'Details & Preview', 'astra-sites' ); ?></span>
|
117 |
-
</a>
|
118 |
-
|
119 |
-
<h3 class="theme-name" id="astra-theme-name">{{{data.demo_name}}}</h3>
|
120 |
-
|
121 |
-
<div class="theme-actions">
|
122 |
-
<button class="button preview install-theme-preview"><?php esc_html_e( 'Preview', 'astra-sites' ); ?></button>
|
123 |
-
|
124 |
-
</div>
|
125 |
-
|
126 |
-
</div>
|
127 |
-
</script>
|
128 |
-
|
129 |
-
<?php
|
130 |
-
/**
|
131 |
-
* Single Demo Preview
|
132 |
-
*/
|
133 |
-
?>
|
134 |
-
<script type="text/template" id="tmpl-astra-demo-preview">
|
135 |
-
<div class="astra-sites-preview theme-install-overlay wp-full-overlay expanded">
|
136 |
-
<div class="wp-full-overlay-sidebar">
|
137 |
-
<div class="wp-full-overlay-header"
|
138 |
-
data-demo-id="{{{data.id}}}"
|
139 |
-
data-demo-type="{{{data.astra_demo_type}}}"
|
140 |
-
data-demo-url="{{{data.astra_demo_url}}}"
|
141 |
-
data-demo-api="{{{data.demo_api}}}"
|
142 |
-
data-demo-name="{{{data.demo_name}}}"
|
143 |
-
data-demo-slug="{{{data.slug}}}"
|
144 |
-
data-screenshot="{{{data.screenshot}}}"
|
145 |
-
data-content="{{{data.content}}}"
|
146 |
-
data-required-plugins="{{data.required_plugins}}">
|
147 |
-
<input type="hidden" class="astra-site-options" value="{{data.astra_site_options}}" >
|
148 |
-
<input type="hidden" class="astra-enabled-extensions" value="{{data.astra_enabled_extensions}}" >
|
149 |
-
<button class="close-full-overlay"><span class="screen-reader-text"><?php esc_html_e( 'Close', 'astra-sites' ); ?></span></button>
|
150 |
-
<button class="previous-theme"><span class="screen-reader-text"><?php esc_html_e( 'Previous', 'astra-sites' ); ?></span></button>
|
151 |
-
<button class="next-theme"><span class="screen-reader-text"><?php esc_html_e( 'Next', 'astra-sites' ); ?></span></button>
|
152 |
-
<a class="button hide-if-no-customize astra-demo-import" href="#" data-import="disabled"><?php esc_html_e( 'Install Plugins', 'astra-sites' ); ?></a>
|
153 |
-
|
154 |
-
</div>
|
155 |
-
<div class="wp-full-overlay-sidebar-content">
|
156 |
-
<div class="install-theme-info">
|
157 |
-
|
158 |
-
<span class="demo-type {{{data.astra_demo_type}}}">{{{data.astra_demo_type}}}</span>
|
159 |
-
<h3 class="theme-name">{{{data.demo_name}}}</h3>
|
160 |
-
|
161 |
-
<# if ( data.screenshot.length ) { #>
|
162 |
-
<img class="theme-screenshot" src="{{{data.screenshot}}}" alt="">
|
163 |
-
<# } #>
|
164 |
-
|
165 |
-
<div class="theme-details">
|
166 |
-
{{{data.content}}}
|
167 |
-
</div>
|
168 |
-
<a href="#" class="theme-details-read-more"><?php _e( 'Read more', 'astra-sites' ); ?> …</a>
|
169 |
-
|
170 |
-
<div class="required-plugins-wrap">
|
171 |
-
<h4><?php _e( 'Required Plugins', 'astra-sites' ); ?> </h4>
|
172 |
-
<div class="required-plugins"></div>
|
173 |
-
</div>
|
174 |
-
</div>
|
175 |
-
</div>
|
176 |
-
|
177 |
-
<div class="wp-full-overlay-footer">
|
178 |
-
<div class="footer-import-button-wrap">
|
179 |
-
<a class="button button-hero hide-if-no-customize astra-demo-import" href="#" data-import="disabled">
|
180 |
-
<?php esc_html_e( 'Install Plugins', 'astra-sites' ); ?>
|
181 |
-
</a>
|
182 |
-
</div>
|
183 |
-
<button type="button" class="collapse-sidebar button" aria-expanded="true"
|
184 |
-
aria-label="Collapse Sidebar">
|
185 |
-
<span class="collapse-sidebar-arrow"></span>
|
186 |
-
<span class="collapse-sidebar-label"><?php esc_html_e( 'Collapse', 'astra-sites' ); ?></span>
|
187 |
-
</button>
|
188 |
-
</div>
|
189 |
-
</div>
|
190 |
-
<div class="wp-full-overlay-main">
|
191 |
-
<iframe src="{{{data.astra_demo_url}}}" title="<?php esc_attr_e( 'Preview', 'astra-sites' ); ?>"></iframe>
|
192 |
-
</div>
|
193 |
-
</div>
|
194 |
-
</script>
|
195 |
-
|
196 |
-
<script type="text/template" id="tmpl-astra-no-demos">
|
197 |
-
<div class="no-themes">
|
198 |
-
<?php
|
199 |
-
|
200 |
-
/* translators: %1$s & %2$s are a Demo API URL */
|
201 |
-
printf( __( '<p> It seems the demo data server, <i><a href="%1$s">%2$s</a></i> is unreachable from your site.</p>', 'astra-sites' ) , esc_url( Astra_Sites::$api_url ), esc_url( Astra_Sites::$api_url ) );
|
202 |
-
|
203 |
-
_e( '<p class="left-margin"> 1. Sometimes, simple page reload fixes any temporary issues. No kidding!</p>', 'astra-sites' );
|
204 |
-
|
205 |
-
_e( '<p class="left-margin"> 2. If that does not work, you will need to talk to your server administrator and check if demo server is being blocked by the firewall!</p>', 'astra-sites' );
|
206 |
-
|
207 |
-
/* translators: %1$s is a support link */
|
208 |
-
printf( __( '<p>If that does not help, please open up a <a href="%1$s" target="_blank">Support Ticket</a> and we will be glad take a closer look for you.</p>', 'astra-sites' ), esc_url( 'https://wpastra.com/support/' ) );
|
209 |
-
?>
|
210 |
-
</div>
|
211 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/assets/css/admin.css
CHANGED
@@ -315,4 +315,7 @@
|
|
315 |
.astra-sites-preview .wp-full-overlay-footer .devices button.active:hover {
|
316 |
border-bottom-color: transparent;
|
317 |
background-color: transparent;
|
|
|
|
|
|
|
318 |
}
|
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 |
}
|
inc/assets/js/admin-page.js
CHANGED
@@ -197,6 +197,7 @@ var AstraSitesAjaxQueue = (function() {
|
|
197 |
$.ajax({
|
198 |
url : astraSitesAdmin.ajaxurl,
|
199 |
type : 'POST',
|
|
|
200 |
data : {
|
201 |
action : 'astra-sites-import-end',
|
202 |
},
|
@@ -231,6 +232,7 @@ var AstraSitesAjaxQueue = (function() {
|
|
231 |
$.ajax({
|
232 |
url : astraSitesAdmin.ajaxurl,
|
233 |
type : 'POST',
|
|
|
234 |
data : {
|
235 |
action : 'astra-sites-import-widgets',
|
236 |
widgets_data : AstraSitesAdmin.widgets_data,
|
@@ -268,6 +270,7 @@ var AstraSitesAjaxQueue = (function() {
|
|
268 |
$.ajax({
|
269 |
url : astraSitesAdmin.ajaxurl,
|
270 |
type : 'POST',
|
|
|
271 |
data : {
|
272 |
action : 'astra-sites-import-options',
|
273 |
options_data : AstraSitesAdmin.options_data,
|
@@ -306,6 +309,7 @@ var AstraSitesAjaxQueue = (function() {
|
|
306 |
$.ajax({
|
307 |
url : astraSitesAdmin.ajaxurl,
|
308 |
type : 'POST',
|
|
|
309 |
data : {
|
310 |
action : 'astra-sites-import-prepare-xml',
|
311 |
wxr_url : AstraSitesAdmin.wxr_url,
|
@@ -375,6 +379,7 @@ var AstraSitesAjaxQueue = (function() {
|
|
375 |
$.ajax({
|
376 |
url : astraSitesAdmin.ajaxurl,
|
377 |
type : 'POST',
|
|
|
378 |
data : {
|
379 |
action : 'astra-sites-import-customizer-settings',
|
380 |
customizer_data : AstraSitesAdmin.customizer_data,
|
@@ -611,14 +616,14 @@ var AstraSitesAjaxQueue = (function() {
|
|
611 |
|
612 |
var $card = jQuery( '.plugin-card-' + response.slug );
|
613 |
|
614 |
-
AstraSitesAdmin._log(
|
615 |
|
616 |
$card
|
617 |
.removeClass( 'button-primary' )
|
618 |
.addClass( 'disabled' )
|
619 |
.html( wp.updates.l10n.installFailedShort );
|
620 |
|
621 |
-
AstraSitesAdmin._importFailMessage(
|
622 |
},
|
623 |
|
624 |
/**
|
@@ -849,7 +854,7 @@ var AstraSitesAjaxQueue = (function() {
|
|
849 |
|
850 |
var disabled = $this.attr('data-import');
|
851 |
|
852 |
-
if ( typeof disabled !== 'undefined' && disabled === 'disabled' ) {
|
853 |
|
854 |
$('.astra-demo-import').addClass('updating-message installing')
|
855 |
.text( wp.updates.l10n.installing );
|
@@ -903,6 +908,7 @@ var AstraSitesAjaxQueue = (function() {
|
|
903 |
$.ajax({
|
904 |
url : astraSitesAdmin.ajaxurl,
|
905 |
type : 'POST',
|
|
|
906 |
data : {
|
907 |
'action' : 'astra-sites-import-set-site-data',
|
908 |
'api_url' : apiURL,
|
@@ -914,13 +920,6 @@ var AstraSitesAjaxQueue = (function() {
|
|
914 |
})
|
915 |
.done(function ( demo_data ) {
|
916 |
|
917 |
-
/**
|
918 |
-
* Set log file URL
|
919 |
-
*/
|
920 |
-
if( astraSitesAdmin.debug && ( undefined !== demo_data.data.log_file.abs_url || null !== demo_data.data.log_file.abs_url ) ) {
|
921 |
-
AstraSitesAdmin.log_file_url = decodeURIComponent( demo_data.data.log_file.url ) || '';
|
922 |
-
}
|
923 |
-
|
924 |
// 1. Fail - Request Site Import
|
925 |
if( false === demo_data.success ) {
|
926 |
|
@@ -928,6 +927,11 @@ var AstraSitesAjaxQueue = (function() {
|
|
928 |
|
929 |
} else {
|
930 |
|
|
|
|
|
|
|
|
|
|
|
931 |
// 1. Pass - Request Site Import
|
932 |
AstraSitesAdmin._log( astraSitesAdmin.log.processingRequest );
|
933 |
|
@@ -1115,6 +1119,11 @@ var AstraSitesAjaxQueue = (function() {
|
|
1115 |
required_plugins : requiredPlugins
|
1116 |
};
|
1117 |
|
|
|
|
|
|
|
|
|
|
|
1118 |
jQuery('.required-plugins').addClass('loading').html('<span class="spinner is-active"></span>');
|
1119 |
|
1120 |
// Required Required.
|
@@ -1133,6 +1142,11 @@ var AstraSitesAjaxQueue = (function() {
|
|
1133 |
})
|
1134 |
.done(function ( response ) {
|
1135 |
|
|
|
|
|
|
|
|
|
|
|
1136 |
// Remove loader.
|
1137 |
jQuery('.required-plugins').removeClass('loading').html('');
|
1138 |
|
197 |
$.ajax({
|
198 |
url : astraSitesAdmin.ajaxurl,
|
199 |
type : 'POST',
|
200 |
+
dataType: 'json',
|
201 |
data : {
|
202 |
action : 'astra-sites-import-end',
|
203 |
},
|
232 |
$.ajax({
|
233 |
url : astraSitesAdmin.ajaxurl,
|
234 |
type : 'POST',
|
235 |
+
dataType: 'json',
|
236 |
data : {
|
237 |
action : 'astra-sites-import-widgets',
|
238 |
widgets_data : AstraSitesAdmin.widgets_data,
|
270 |
$.ajax({
|
271 |
url : astraSitesAdmin.ajaxurl,
|
272 |
type : 'POST',
|
273 |
+
dataType: 'json',
|
274 |
data : {
|
275 |
action : 'astra-sites-import-options',
|
276 |
options_data : AstraSitesAdmin.options_data,
|
309 |
$.ajax({
|
310 |
url : astraSitesAdmin.ajaxurl,
|
311 |
type : 'POST',
|
312 |
+
dataType: 'json',
|
313 |
data : {
|
314 |
action : 'astra-sites-import-prepare-xml',
|
315 |
wxr_url : AstraSitesAdmin.wxr_url,
|
379 |
$.ajax({
|
380 |
url : astraSitesAdmin.ajaxurl,
|
381 |
type : 'POST',
|
382 |
+
dataType: 'json',
|
383 |
data : {
|
384 |
action : 'astra-sites-import-customizer-settings',
|
385 |
customizer_data : AstraSitesAdmin.customizer_data,
|
616 |
|
617 |
var $card = jQuery( '.plugin-card-' + response.slug );
|
618 |
|
619 |
+
AstraSitesAdmin._log( response.errorMessage + ' ' + response.slug );
|
620 |
|
621 |
$card
|
622 |
.removeClass( 'button-primary' )
|
623 |
.addClass( 'disabled' )
|
624 |
.html( wp.updates.l10n.installFailedShort );
|
625 |
|
626 |
+
AstraSitesAdmin._importFailMessage( response.errorMessage );
|
627 |
},
|
628 |
|
629 |
/**
|
854 |
|
855 |
var disabled = $this.attr('data-import');
|
856 |
|
857 |
+
if ( typeof disabled !== 'undefined' && disabled === 'disabled' || $this.hasClass('disabled') ) {
|
858 |
|
859 |
$('.astra-demo-import').addClass('updating-message installing')
|
860 |
.text( wp.updates.l10n.installing );
|
908 |
$.ajax({
|
909 |
url : astraSitesAdmin.ajaxurl,
|
910 |
type : 'POST',
|
911 |
+
dataType: 'json',
|
912 |
data : {
|
913 |
'action' : 'astra-sites-import-set-site-data',
|
914 |
'api_url' : apiURL,
|
920 |
})
|
921 |
.done(function ( demo_data ) {
|
922 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
923 |
// 1. Fail - Request Site Import
|
924 |
if( false === demo_data.success ) {
|
925 |
|
927 |
|
928 |
} else {
|
929 |
|
930 |
+
// Set log file URL.
|
931 |
+
if( 'log_file' in demo_data.data ){
|
932 |
+
AstraSitesAdmin.log_file_url = decodeURIComponent( demo_data.data.log_file ) || '';
|
933 |
+
}
|
934 |
+
|
935 |
// 1. Pass - Request Site Import
|
936 |
AstraSitesAdmin._log( astraSitesAdmin.log.processingRequest );
|
937 |
|
1119 |
required_plugins : requiredPlugins
|
1120 |
};
|
1121 |
|
1122 |
+
// Add disabled class from import button.
|
1123 |
+
$('.astra-demo-import')
|
1124 |
+
.addClass('disabled not-click-able')
|
1125 |
+
.removeAttr('data-import');
|
1126 |
+
|
1127 |
jQuery('.required-plugins').addClass('loading').html('<span class="spinner is-active"></span>');
|
1128 |
|
1129 |
// Required Required.
|
1142 |
})
|
1143 |
.done(function ( response ) {
|
1144 |
|
1145 |
+
// Release disabled class from import button.
|
1146 |
+
$('.astra-demo-import')
|
1147 |
+
.removeClass('disabled not-click-able')
|
1148 |
+
.attr('data-import', 'disabled');
|
1149 |
+
|
1150 |
// Remove loader.
|
1151 |
jQuery('.required-plugins').removeClass('loading').html('');
|
1152 |
|
inc/assets/js/admin.js
DELETED
@@ -1,1138 +0,0 @@
|
|
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 |
-
AstraSites = {
|
81 |
-
|
82 |
-
_ref: null,
|
83 |
-
|
84 |
-
_iconUploader: null,
|
85 |
-
|
86 |
-
init: function()
|
87 |
-
{
|
88 |
-
this._bind();
|
89 |
-
this._resetPagedCount();
|
90 |
-
this._initial_load_demos();
|
91 |
-
},
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Binds events for the Astra Sites.
|
95 |
-
*
|
96 |
-
* @since 1.0.1
|
97 |
-
* @access private
|
98 |
-
* @method _bind
|
99 |
-
*/
|
100 |
-
_bind: function()
|
101 |
-
{
|
102 |
-
$( document ).on('scroll', AstraSites._scroll);
|
103 |
-
$( document ).on('click', '.astra-demo-import', AstraSites._importDemo);
|
104 |
-
$( document ).on('click', '.install-now', AstraSites._installNow);
|
105 |
-
$( document ).on('click', '.theme-browser .theme-screenshot, .theme-browser .more-details, .theme-browser .install-theme-preview', AstraSites._preview);
|
106 |
-
$( document ).on('click', '.collapse-sidebar', AstraSites._collapse);
|
107 |
-
$( document ).on('click', '.filter-links li a', AstraSites._filter);
|
108 |
-
$( document ).on('click', '.activate-now', AstraSites._activateNow);
|
109 |
-
$( document ).on('click', '.close-full-overlay', AstraSites._fullOverlay);
|
110 |
-
$( document ).on('click', '.next-theme', AstraSites._nextTheme);
|
111 |
-
$( document ).on('click', '.previous-theme', AstraSites._previousTheme);
|
112 |
-
$( document ).on('keyup input', '#wp-filter-search-input', AstraSites._serach);
|
113 |
-
$( document ).on('wp-plugin-installing', AstraSites._pluginInstalling);
|
114 |
-
$( document ).on('wp-plugin-install-error', AstraSites._installError);
|
115 |
-
$( document ).on('wp-plugin-install-success', AstraSites._installSuccess);
|
116 |
-
},
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Previous Theme.
|
120 |
-
*/
|
121 |
-
_previousTheme: function (event) {
|
122 |
-
event.preventDefault();
|
123 |
-
|
124 |
-
currentDemo = jQuery('.theme-preview-on');
|
125 |
-
currentDemo.removeClass('theme-preview-on');
|
126 |
-
prevDemo = currentDemo.prev('.theme');
|
127 |
-
prevDemo.addClass('theme-preview-on');
|
128 |
-
|
129 |
-
AstraSites._renderDemoPreview(prevDemo);
|
130 |
-
},
|
131 |
-
|
132 |
-
_fullOverlay: function (event) {
|
133 |
-
event.preventDefault();
|
134 |
-
|
135 |
-
jQuery('.theme-install-overlay').css('display', 'none');
|
136 |
-
jQuery('.theme-install-overlay').remove();
|
137 |
-
jQuery('.theme-preview-on').removeClass('theme-preview-on');
|
138 |
-
jQuery('html').removeClass('astra-site-preview-on');
|
139 |
-
},
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Next Theme.
|
143 |
-
*/
|
144 |
-
_nextTheme: function (event) {
|
145 |
-
event.preventDefault();
|
146 |
-
currentDemo = jQuery('.theme-preview-on')
|
147 |
-
currentDemo.removeClass('theme-preview-on');
|
148 |
-
nextDemo = currentDemo.next('.theme');
|
149 |
-
nextDemo.addClass('theme-preview-on');
|
150 |
-
|
151 |
-
AstraSites._renderDemoPreview( nextDemo );
|
152 |
-
},
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Plugin Installation Error.
|
156 |
-
*/
|
157 |
-
_installError: function( event, response ) {
|
158 |
-
|
159 |
-
var $card = jQuery( '.plugin-card-' + response.slug );
|
160 |
-
|
161 |
-
$card
|
162 |
-
.addClass( 'button-primary' )
|
163 |
-
.html( wp.updates.l10n.installNow );
|
164 |
-
},
|
165 |
-
|
166 |
-
_installSuccess: function( event, response ) {
|
167 |
-
|
168 |
-
event.preventDefault();
|
169 |
-
|
170 |
-
var $message = jQuery( '.plugin-card-' + response.slug ).find( '.button' );
|
171 |
-
var $siteOptions = jQuery( '.wp-full-overlay-header').find('.astra-site-options').val();
|
172 |
-
var $enabledExtensions = jQuery( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
|
173 |
-
|
174 |
-
// Transform the 'Install' button into an 'Activate' button.
|
175 |
-
var $init = $message.data('init');
|
176 |
-
|
177 |
-
$message.removeClass( 'install-now installed button-disabled updated-message' )
|
178 |
-
.addClass('updating-message')
|
179 |
-
.html( astraDemo.strings.btnActivating );
|
180 |
-
|
181 |
-
// Reset not installed plugins list.
|
182 |
-
var pluginsList = astraDemo.requiredPlugins.notinstalled;
|
183 |
-
astraDemo.requiredPlugins.notinstalled = AstraSites._removePluginFromQueue( response.slug, pluginsList );
|
184 |
-
|
185 |
-
// WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
|
186 |
-
setTimeout( function() {
|
187 |
-
|
188 |
-
jQuery.ajax({
|
189 |
-
url: astraDemo.ajaxurl,
|
190 |
-
type: 'POST',
|
191 |
-
data: {
|
192 |
-
'action' : 'astra-required-plugin-activate',
|
193 |
-
'init' : $init,
|
194 |
-
'options' : $siteOptions,
|
195 |
-
'enabledExtensions' : $enabledExtensions,
|
196 |
-
},
|
197 |
-
})
|
198 |
-
.done(function (result) {
|
199 |
-
|
200 |
-
if( result.success ) {
|
201 |
-
|
202 |
-
var pluginsList = astraDemo.requiredPlugins.inactive;
|
203 |
-
|
204 |
-
// Reset not installed plugins list.
|
205 |
-
astraDemo.requiredPlugins.inactive = AstraSites._removePluginFromQueue( response.slug, pluginsList );
|
206 |
-
|
207 |
-
$message.removeClass( 'button-primary install-now activate-now updating-message' )
|
208 |
-
.attr('disabled', 'disabled')
|
209 |
-
.addClass('disabled')
|
210 |
-
.text( astraDemo.strings.btnActive );
|
211 |
-
|
212 |
-
// Enable Demo Import Button
|
213 |
-
AstraSites._enable_demo_import_button();
|
214 |
-
|
215 |
-
} else {
|
216 |
-
|
217 |
-
$message.removeClass( 'updating-message' );
|
218 |
-
|
219 |
-
}
|
220 |
-
|
221 |
-
});
|
222 |
-
|
223 |
-
}, 1200 );
|
224 |
-
|
225 |
-
},
|
226 |
-
|
227 |
-
/**
|
228 |
-
* Render Demo Preview
|
229 |
-
*/
|
230 |
-
_activateNow: function( eventn ) {
|
231 |
-
|
232 |
-
event.preventDefault();
|
233 |
-
|
234 |
-
var $button = jQuery( event.target ),
|
235 |
-
$init = $button.data( 'init' ),
|
236 |
-
$slug = $button.data( 'slug' );
|
237 |
-
|
238 |
-
if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
|
239 |
-
return;
|
240 |
-
}
|
241 |
-
|
242 |
-
$button.addClass('updating-message button-primary')
|
243 |
-
.html( astraDemo.strings.btnActivating );
|
244 |
-
|
245 |
-
var $siteOptions = jQuery( '.wp-full-overlay-header').find('.astra-site-options').val();
|
246 |
-
var $enabledExtensions = jQuery( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
|
247 |
-
|
248 |
-
jQuery.ajax({
|
249 |
-
url: astraDemo.ajaxurl,
|
250 |
-
type: 'POST',
|
251 |
-
data: {
|
252 |
-
'action' : 'astra-required-plugin-activate',
|
253 |
-
'init' : $init,
|
254 |
-
'options' : $siteOptions,
|
255 |
-
'enabledExtensions' : $enabledExtensions,
|
256 |
-
},
|
257 |
-
})
|
258 |
-
.done(function (result) {
|
259 |
-
|
260 |
-
if( result.success ) {
|
261 |
-
|
262 |
-
var pluginsList = astraDemo.requiredPlugins.inactive;
|
263 |
-
|
264 |
-
// Reset not installed plugins list.
|
265 |
-
astraDemo.requiredPlugins.inactive = AstraSites._removePluginFromQueue( $slug, pluginsList );
|
266 |
-
|
267 |
-
$button.removeClass( 'button-primary install-now activate-now updating-message' )
|
268 |
-
.attr('disabled', 'disabled')
|
269 |
-
.addClass('disabled')
|
270 |
-
.text( astraDemo.strings.btnActive );
|
271 |
-
|
272 |
-
// Enable Demo Import Button
|
273 |
-
AstraSites._enable_demo_import_button();
|
274 |
-
|
275 |
-
}
|
276 |
-
|
277 |
-
})
|
278 |
-
.fail(function () {
|
279 |
-
});
|
280 |
-
|
281 |
-
},
|
282 |
-
|
283 |
-
_renderDemoPreview: function(anchor) {
|
284 |
-
|
285 |
-
var demoId = anchor.data('id') || '',
|
286 |
-
apiURL = anchor.data('demo-api') || '',
|
287 |
-
demoType = anchor.data('demo-type') || '',
|
288 |
-
demoURL = anchor.data('demo-url') || '',
|
289 |
-
screenshot = anchor.data('screenshot') || '',
|
290 |
-
demo_name = anchor.data('demo-name') || '',
|
291 |
-
demo_slug = anchor.data('demo-slug') || '',
|
292 |
-
content = anchor.data('content') || '',
|
293 |
-
requiredPlugins = anchor.data('required-plugins') || '',
|
294 |
-
astraSiteOptions = anchor.find('.astra-site-options').val() || '';
|
295 |
-
astraEnabledExtensions = anchor.find('.astra-enabled-extensions').val() || '';
|
296 |
-
|
297 |
-
var template = wp.template('astra-demo-preview');
|
298 |
-
|
299 |
-
templateData = [{
|
300 |
-
id : demoId,
|
301 |
-
astra_demo_type : demoType,
|
302 |
-
astra_demo_url : demoURL,
|
303 |
-
demo_api : apiURL,
|
304 |
-
screenshot : screenshot,
|
305 |
-
demo_name : demo_name,
|
306 |
-
slug : demo_slug,
|
307 |
-
content : content,
|
308 |
-
required_plugins : JSON.stringify(requiredPlugins),
|
309 |
-
astra_site_options : astraSiteOptions,
|
310 |
-
astra_enabled_extensions : astraEnabledExtensions,
|
311 |
-
}];
|
312 |
-
|
313 |
-
// delete any earlier fullscreen preview before we render new one.
|
314 |
-
jQuery('.theme-install-overlay').remove();
|
315 |
-
|
316 |
-
jQuery('#astra-sites-menu-page').append(template(templateData[0]));
|
317 |
-
jQuery('.theme-install-overlay').css('display', 'block');
|
318 |
-
AstraSites._checkNextPrevButtons();
|
319 |
-
|
320 |
-
var desc = jQuery('.theme-details');
|
321 |
-
var descHeight = parseInt( desc.outerHeight() );
|
322 |
-
var descBtn = jQuery('.theme-details-read-more');
|
323 |
-
|
324 |
-
if( jQuery.isArray( requiredPlugins ) ) {
|
325 |
-
|
326 |
-
if( descHeight >= 55 ) {
|
327 |
-
|
328 |
-
// Show button.
|
329 |
-
descBtn.css( 'display', 'inline-block' );
|
330 |
-
|
331 |
-
// Set height upto 3 line.
|
332 |
-
desc.css( 'height', 57 );
|
333 |
-
|
334 |
-
// Button Click.
|
335 |
-
descBtn.click(function(event) {
|
336 |
-
|
337 |
-
if( descBtn.hasClass('open') ) {
|
338 |
-
desc.animate({ height: 57 },
|
339 |
-
300, function() {
|
340 |
-
descBtn.removeClass('open');
|
341 |
-
descBtn.html( astraDemo.strings.DescExpand );
|
342 |
-
});
|
343 |
-
} else {
|
344 |
-
desc.animate({ height: descHeight },
|
345 |
-
300, function() {
|
346 |
-
descBtn.addClass('open');
|
347 |
-
descBtn.html( astraDemo.strings.DescCollapse );
|
348 |
-
});
|
349 |
-
}
|
350 |
-
|
351 |
-
});
|
352 |
-
}
|
353 |
-
|
354 |
-
// or
|
355 |
-
var $pluginsFilter = jQuery( '#plugin-filter' ),
|
356 |
-
data = {
|
357 |
-
_ajax_nonce : astraDemo._ajax_nonce,
|
358 |
-
required_plugins : requiredPlugins
|
359 |
-
};
|
360 |
-
|
361 |
-
jQuery('.required-plugins').addClass('loading').html('<span class="spinner is-active"></span>');
|
362 |
-
|
363 |
-
wp.ajax.post( 'astra-required-plugins', data ).done( function( response ) {
|
364 |
-
|
365 |
-
// Remove loader.
|
366 |
-
jQuery('.required-plugins').removeClass('loading').html('');
|
367 |
-
|
368 |
-
/**
|
369 |
-
* Count remaining plugins.
|
370 |
-
* @type number
|
371 |
-
*/
|
372 |
-
var remaining_plugins = 0;
|
373 |
-
|
374 |
-
/**
|
375 |
-
* Not Installed
|
376 |
-
*
|
377 |
-
* List of not installed required plugins.
|
378 |
-
*/
|
379 |
-
if ( typeof response.notinstalled !== 'undefined' ) {
|
380 |
-
|
381 |
-
// Add not have installed plugins count.
|
382 |
-
remaining_plugins += parseInt( response.notinstalled.length );
|
383 |
-
|
384 |
-
jQuery( response.notinstalled ).each(function( index, plugin ) {
|
385 |
-
|
386 |
-
var output = '<div class="plugin-card ';
|
387 |
-
output += ' plugin-card-'+plugin.slug+'"';
|
388 |
-
output += ' data-slug="'+plugin.slug+'"';
|
389 |
-
output += ' data-init="'+plugin.init+'">';
|
390 |
-
output += ' <span class="title">'+plugin.name+'</span>';
|
391 |
-
output += ' <button class="button install-now"';
|
392 |
-
output += ' data-init="' + plugin.init + '"';
|
393 |
-
output += ' data-slug="' + plugin.slug + '"';
|
394 |
-
output += ' data-name="' + plugin.name + '">';
|
395 |
-
output += wp.updates.l10n.installNow;
|
396 |
-
output += ' </button>';
|
397 |
-
// output += ' <span class="dashicons-no dashicons"></span>';
|
398 |
-
output += '</div>';
|
399 |
-
|
400 |
-
jQuery('.required-plugins').append(output);
|
401 |
-
|
402 |
-
});
|
403 |
-
}
|
404 |
-
|
405 |
-
/**
|
406 |
-
* Inactive
|
407 |
-
*
|
408 |
-
* List of not inactive required plugins.
|
409 |
-
*/
|
410 |
-
if ( typeof response.inactive !== 'undefined' ) {
|
411 |
-
|
412 |
-
// Add inactive plugins count.
|
413 |
-
remaining_plugins += parseInt( response.inactive.length );
|
414 |
-
|
415 |
-
jQuery( response.inactive ).each(function( index, plugin ) {
|
416 |
-
|
417 |
-
var output = '<div class="plugin-card ';
|
418 |
-
output += ' plugin-card-'+plugin.slug+'"';
|
419 |
-
output += ' data-slug="'+plugin.slug+'"';
|
420 |
-
output += ' data-init="'+plugin.init+'">';
|
421 |
-
output += ' <span class="title">'+plugin.name+'</span>';
|
422 |
-
output += ' <button class="button activate-now button-primary"';
|
423 |
-
output += ' data-init="' + plugin.init + '"';
|
424 |
-
output += ' data-slug="' + plugin.slug + '"';
|
425 |
-
output += ' data-name="' + plugin.name + '">';
|
426 |
-
output += wp.updates.l10n.activatePlugin;
|
427 |
-
output += ' </button>';
|
428 |
-
// output += ' <span class="dashicons-no dashicons"></span>';
|
429 |
-
output += '</div>';
|
430 |
-
|
431 |
-
jQuery('.required-plugins').append(output);
|
432 |
-
|
433 |
-
});
|
434 |
-
}
|
435 |
-
|
436 |
-
/**
|
437 |
-
* Active
|
438 |
-
*
|
439 |
-
* List of not active required plugins.
|
440 |
-
*/
|
441 |
-
if ( typeof response.active !== 'undefined' ) {
|
442 |
-
|
443 |
-
jQuery( response.active ).each(function( index, plugin ) {
|
444 |
-
|
445 |
-
var output = '<div class="plugin-card ';
|
446 |
-
output += ' plugin-card-'+plugin.slug+'"';
|
447 |
-
output += ' data-slug="'+plugin.slug+'"';
|
448 |
-
output += ' data-init="'+plugin.init+'">';
|
449 |
-
output += ' <span class="title">'+plugin.name+'</span>';
|
450 |
-
output += ' <button class="button disabled"';
|
451 |
-
output += ' data-slug="' + plugin.slug + '"';
|
452 |
-
output += ' data-name="' + plugin.name + '">';
|
453 |
-
output += astraDemo.strings.btnActive;
|
454 |
-
output += ' </button>';
|
455 |
-
// output += ' <span class="dashicons-yes dashicons"></span>';
|
456 |
-
output += '</div>';
|
457 |
-
|
458 |
-
jQuery('.required-plugins').append(output);
|
459 |
-
|
460 |
-
});
|
461 |
-
}
|
462 |
-
|
463 |
-
/**
|
464 |
-
* Enable Demo Import Button
|
465 |
-
* @type number
|
466 |
-
*/
|
467 |
-
astraDemo.requiredPlugins = response;
|
468 |
-
AstraSites._enable_demo_import_button();
|
469 |
-
|
470 |
-
} );
|
471 |
-
|
472 |
-
} else {
|
473 |
-
|
474 |
-
// Enable Demo Import Button
|
475 |
-
AstraSites._enable_demo_import_button( demoType );
|
476 |
-
jQuery('.required-plugins-wrap').remove();
|
477 |
-
}
|
478 |
-
|
479 |
-
return;
|
480 |
-
},
|
481 |
-
|
482 |
-
/**
|
483 |
-
* Check Next Previous Buttons.
|
484 |
-
*/
|
485 |
-
_checkNextPrevButtons: function() {
|
486 |
-
currentDemo = jQuery('.theme-preview-on');
|
487 |
-
nextDemo = currentDemo.nextAll('.theme').length;
|
488 |
-
prevDemo = currentDemo.prevAll('.theme').length;
|
489 |
-
|
490 |
-
if (nextDemo == 0) {
|
491 |
-
jQuery('.next-theme').addClass('disabled');
|
492 |
-
} else if (nextDemo != 0) {
|
493 |
-
jQuery('.next-theme').removeClass('disabled');
|
494 |
-
}
|
495 |
-
|
496 |
-
if (prevDemo == 0) {
|
497 |
-
jQuery('.previous-theme').addClass('disabled');
|
498 |
-
} else if (prevDemo != 0) {
|
499 |
-
jQuery('.previous-theme').removeClass('disabled');
|
500 |
-
}
|
501 |
-
|
502 |
-
return;
|
503 |
-
},
|
504 |
-
|
505 |
-
/**
|
506 |
-
* Filter Demo by Category.
|
507 |
-
*/
|
508 |
-
_filter: function(event) {
|
509 |
-
event.preventDefault();
|
510 |
-
|
511 |
-
$this = jQuery(this);
|
512 |
-
$this.parent('li').siblings().find('.current').removeClass('current');
|
513 |
-
$this.addClass('current');
|
514 |
-
|
515 |
-
var astra_page_builder = jQuery('.filter-links.astra-page-builder'),
|
516 |
-
astra_category = jQuery('.filter-links.astra-category'),
|
517 |
-
page_builder_id = astra_page_builder.find('.current').data('id'),
|
518 |
-
category_id = astra_category.find('.current').data('id');
|
519 |
-
|
520 |
-
AstraSites._resetPagedCount();
|
521 |
-
|
522 |
-
paged = parseInt(jQuery('body').attr('data-astra-demo-paged'));
|
523 |
-
|
524 |
-
jQuery('body').addClass('loading-content');
|
525 |
-
jQuery('.theme-browser .theme').remove();
|
526 |
-
jQuery('.no-themes').remove();
|
527 |
-
jQuery('#wp-filter-search-input').val('');
|
528 |
-
|
529 |
-
jQuery.ajax({
|
530 |
-
url: astraDemo.ajaxurl,
|
531 |
-
type: 'POST',
|
532 |
-
dataType: 'json',
|
533 |
-
data: {
|
534 |
-
action: 'astra-list-sites',
|
535 |
-
paged: paged,
|
536 |
-
page_builder_id : page_builder_id,
|
537 |
-
category_id : category_id,
|
538 |
-
},
|
539 |
-
})
|
540 |
-
.done(function (demos) {
|
541 |
-
|
542 |
-
jQuery('.filter-count .count').text( demos.sites_count );
|
543 |
-
jQuery('body').removeClass('loading-content');
|
544 |
-
|
545 |
-
if ( demos.sites_count > 0 ) {
|
546 |
-
AstraSites._renderDemoGrid(demos.sites);
|
547 |
-
} else {
|
548 |
-
jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.searchNoFound+'</p>');
|
549 |
-
}
|
550 |
-
|
551 |
-
})
|
552 |
-
.fail(function () {
|
553 |
-
jQuery('body').removeClass('loading-content');
|
554 |
-
jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.responseError+'</p>');
|
555 |
-
});
|
556 |
-
|
557 |
-
},
|
558 |
-
|
559 |
-
|
560 |
-
/**
|
561 |
-
* Search Site.
|
562 |
-
*/
|
563 |
-
_serach: function() {
|
564 |
-
$this = jQuery('#wp-filter-search-input').val();
|
565 |
-
|
566 |
-
id = '';
|
567 |
-
if ($this.length < 2) {
|
568 |
-
id = 'all';
|
569 |
-
}
|
570 |
-
|
571 |
-
var astra_page_builder = jQuery('.filter-links.astra-page-builder'),
|
572 |
-
astra_category = jQuery('.filter-links.astra-category'),
|
573 |
-
page_builder_id = astra_page_builder.find('.current').data('id'),
|
574 |
-
category_id = astra_category.find('.current').data('id');
|
575 |
-
|
576 |
-
|
577 |
-
window.clearTimeout(AstraSites._ref);
|
578 |
-
AstraSites._ref = window.setTimeout(function () {
|
579 |
-
AstraSites._ref = null;
|
580 |
-
|
581 |
-
AstraSites._resetPagedCount();
|
582 |
-
jQuery('body').addClass('loading-content');
|
583 |
-
jQuery('.theme-browser .theme').remove();
|
584 |
-
jQuery('.no-themes').remove();
|
585 |
-
jQuery('body').attr('data-astra-demo-search', $this);
|
586 |
-
|
587 |
-
jQuery.ajax({
|
588 |
-
url: astraDemo.ajaxurl,
|
589 |
-
type: 'POST',
|
590 |
-
dataType: 'json',
|
591 |
-
data: {
|
592 |
-
action: 'astra-list-sites',
|
593 |
-
search: $this,
|
594 |
-
page_builder_id : page_builder_id,
|
595 |
-
category_id : category_id,
|
596 |
-
},
|
597 |
-
})
|
598 |
-
.done(function (demos) {
|
599 |
-
jQuery('body').removeClass('loading-content');
|
600 |
-
|
601 |
-
jQuery('.filter-count .count').text( demos.sites_count );
|
602 |
-
|
603 |
-
if ( demos.sites_count > 0 ) {
|
604 |
-
AstraSites._renderDemoGrid(demos.sites);
|
605 |
-
} else {
|
606 |
-
jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.searchNoFound+'</p>');
|
607 |
-
}
|
608 |
-
|
609 |
-
})
|
610 |
-
.fail(function () {
|
611 |
-
jQuery('body').removeClass('loading-content');
|
612 |
-
jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.responseError+'.</p>');
|
613 |
-
});
|
614 |
-
|
615 |
-
|
616 |
-
}, 500);
|
617 |
-
|
618 |
-
},
|
619 |
-
|
620 |
-
/**
|
621 |
-
* Collapse Sidebar.
|
622 |
-
*/
|
623 |
-
_collapse: function() {
|
624 |
-
event.preventDefault();
|
625 |
-
|
626 |
-
overlay = jQuery('.wp-full-overlay');
|
627 |
-
|
628 |
-
if (overlay.hasClass('expanded')) {
|
629 |
-
overlay.removeClass('expanded');
|
630 |
-
overlay.addClass('collapsed');
|
631 |
-
return;
|
632 |
-
}
|
633 |
-
|
634 |
-
if (overlay.hasClass('collapsed')) {
|
635 |
-
overlay.removeClass('collapsed');
|
636 |
-
overlay.addClass('expanded');
|
637 |
-
return;
|
638 |
-
}
|
639 |
-
},
|
640 |
-
|
641 |
-
/**
|
642 |
-
* Individual Site Preview
|
643 |
-
*
|
644 |
-
* On click on image, more link & preview button.
|
645 |
-
*/
|
646 |
-
_preview: function( event ) {
|
647 |
-
|
648 |
-
event.preventDefault();
|
649 |
-
|
650 |
-
$this = jQuery(this).parents('.theme');
|
651 |
-
$this.addClass('theme-preview-on');
|
652 |
-
|
653 |
-
jQuery('html').addClass('astra-site-preview-on');
|
654 |
-
|
655 |
-
AstraSites._renderDemoPreview($this);
|
656 |
-
},
|
657 |
-
|
658 |
-
_scroll: function(event) {
|
659 |
-
|
660 |
-
var scrollDistance = jQuery(window).scrollTop();
|
661 |
-
|
662 |
-
var themesBottom = Math.abs(jQuery(window).height() - jQuery('.themes').offset().top - jQuery('.themes').height());
|
663 |
-
themesBottom = themesBottom * 20 / 100;
|
664 |
-
|
665 |
-
ajaxLoading = jQuery('body').data('scrolling');
|
666 |
-
|
667 |
-
if (scrollDistance > themesBottom && ajaxLoading == false) {
|
668 |
-
AstraSites._updatedPagedCount();
|
669 |
-
|
670 |
-
jQuery('body').data('scrolling', true);
|
671 |
-
|
672 |
-
var body = jQuery('body'),
|
673 |
-
id = body.attr('data-astra-site-category'),
|
674 |
-
search = body.attr('data-astra-demo-search'),
|
675 |
-
paged = body.attr('data-astra-demo-paged');
|
676 |
-
|
677 |
-
if (search !== '') {
|
678 |
-
id = '';
|
679 |
-
} else {
|
680 |
-
search = '';
|
681 |
-
}
|
682 |
-
|
683 |
-
jQuery('.no-themes').remove();
|
684 |
-
|
685 |
-
var astra_page_builder = jQuery('.filter-links.astra-page-builder'),
|
686 |
-
astra_category = jQuery('.filter-links.astra-category'),
|
687 |
-
page_builder_id = astra_page_builder.find('.current').data('id'),
|
688 |
-
category_id = astra_category.find('.current').data('id');
|
689 |
-
|
690 |
-
jQuery.ajax({
|
691 |
-
url: astraDemo.ajaxurl,
|
692 |
-
type: 'POST',
|
693 |
-
dataType: 'json',
|
694 |
-
data: {
|
695 |
-
action: 'astra-list-sites',
|
696 |
-
paged: paged,
|
697 |
-
search: search,
|
698 |
-
page_builder_id : page_builder_id,
|
699 |
-
category_id : category_id,
|
700 |
-
},
|
701 |
-
})
|
702 |
-
.done(function (demos) {
|
703 |
-
jQuery('body').removeClass('loading-content');
|
704 |
-
if ( demos.sites_count > 0 ) {
|
705 |
-
AstraSites._renderDemoGrid(demos.sites);
|
706 |
-
}
|
707 |
-
})
|
708 |
-
.fail(function () {
|
709 |
-
jQuery('body').removeClass('loading-content');
|
710 |
-
jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.responseError+'</p>');
|
711 |
-
});
|
712 |
-
|
713 |
-
}
|
714 |
-
},
|
715 |
-
|
716 |
-
_installNow: function(event)
|
717 |
-
{
|
718 |
-
event.preventDefault();
|
719 |
-
|
720 |
-
var $button = jQuery( event.target ),
|
721 |
-
$document = jQuery(document);
|
722 |
-
|
723 |
-
if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
|
724 |
-
return;
|
725 |
-
}
|
726 |
-
|
727 |
-
if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) {
|
728 |
-
wp.updates.requestFilesystemCredentials( event );
|
729 |
-
|
730 |
-
$document.on( 'credential-modal-cancel', function() {
|
731 |
-
var $message = $( '.install-now.updating-message' );
|
732 |
-
|
733 |
-
$message
|
734 |
-
.removeClass( 'updating-message' )
|
735 |
-
.text( wp.updates.l10n.installNow );
|
736 |
-
|
737 |
-
wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' );
|
738 |
-
} );
|
739 |
-
}
|
740 |
-
|
741 |
-
wp.updates.installPlugin( {
|
742 |
-
slug: $button.data( 'slug' )
|
743 |
-
} );
|
744 |
-
},
|
745 |
-
|
746 |
-
/**
|
747 |
-
* Update Page Count.
|
748 |
-
*/
|
749 |
-
_updatedPagedCount: function() {
|
750 |
-
paged = parseInt(jQuery('body').attr('data-astra-demo-paged'));
|
751 |
-
jQuery('body').attr('data-astra-demo-paged', paged + 1);
|
752 |
-
window.setTimeout(function () {
|
753 |
-
jQuery('body').data('scrolling', false);
|
754 |
-
}, 800);
|
755 |
-
},
|
756 |
-
|
757 |
-
_resetPagedCount: function() {
|
758 |
-
|
759 |
-
categoryId = jQuery('.astra-category.filter-links li .current').data('id');
|
760 |
-
jQuery('body').attr('data-astra-demo-paged', '1');
|
761 |
-
jQuery('body').attr('data-astra-site-category', categoryId);
|
762 |
-
jQuery('body').attr('data-astra-demo-search', '');
|
763 |
-
jQuery('body').attr('data-scrolling', false);
|
764 |
-
jQuery('body').attr( 'data-required-plugins', 0 )
|
765 |
-
|
766 |
-
},
|
767 |
-
|
768 |
-
_initial_load_demos: function() {
|
769 |
-
|
770 |
-
var astra_page_builder = jQuery('.filter-links.astra-page-builder'),
|
771 |
-
astra_category = jQuery('.filter-links.astra-category'),
|
772 |
-
page_builder_id = astra_page_builder.find('.current').data('id'),
|
773 |
-
category_id = astra_category.find('.current').data('id');
|
774 |
-
|
775 |
-
jQuery('body').addClass('loading-content');
|
776 |
-
|
777 |
-
jQuery.ajax({
|
778 |
-
url: astraDemo.ajaxurl,
|
779 |
-
type: 'POST',
|
780 |
-
dataType: 'json',
|
781 |
-
data: {
|
782 |
-
action : 'astra-list-sites',
|
783 |
-
paged : '1',
|
784 |
-
page_builder_id : page_builder_id,
|
785 |
-
category_id : category_id,
|
786 |
-
},
|
787 |
-
})
|
788 |
-
.done(function (demos) {
|
789 |
-
|
790 |
-
jQuery('body').removeClass('loading-content');
|
791 |
-
jQuery('.filter-count .count').text( demos.sites_count );
|
792 |
-
|
793 |
-
// Has sites?
|
794 |
-
if ( demos.sites_count > 0 ) {
|
795 |
-
AstraSites._renderDemoGrid( demos.sites );
|
796 |
-
|
797 |
-
// Something is wrong in API request.
|
798 |
-
} else {
|
799 |
-
var template = wp.template('astra-no-demos');
|
800 |
-
jQuery('.themes').append( template );
|
801 |
-
}
|
802 |
-
|
803 |
-
})
|
804 |
-
.fail(function () {
|
805 |
-
jQuery('body').removeClass('loading-content');
|
806 |
-
jQuery('.spinner').after('<p class="no-themes" style="display:block;">'+astraDemo.strings.responseError+'</p>');
|
807 |
-
});
|
808 |
-
},
|
809 |
-
|
810 |
-
/**
|
811 |
-
* Render Demo Grid.
|
812 |
-
*/
|
813 |
-
_renderDemoGrid: function(demos) {
|
814 |
-
|
815 |
-
jQuery.each(demos, function (index, demo) {
|
816 |
-
|
817 |
-
id = demo.id;
|
818 |
-
content = demo.content;
|
819 |
-
demo_api = demo.demo_api;
|
820 |
-
demo_name = demo.title;
|
821 |
-
demo_slug = demo.slug;
|
822 |
-
screenshot = demo.featured_image_url;
|
823 |
-
astra_demo_url = demo.astra_demo_url;
|
824 |
-
astra_demo_type = demo.astra_demo_type;
|
825 |
-
requiredPlugins = demo.required_plugins;
|
826 |
-
status = demo.status;
|
827 |
-
astraSiteOptions = demo.astra_site_options || '';
|
828 |
-
astraEnabledExtensions = demo.astra_enabled_extensions || '';
|
829 |
-
|
830 |
-
templateData = [{
|
831 |
-
id: id,
|
832 |
-
astra_demo_type: astra_demo_type,
|
833 |
-
status: status,
|
834 |
-
astra_demo_url: astra_demo_url,
|
835 |
-
demo_api: demo_api,
|
836 |
-
screenshot: screenshot,
|
837 |
-
demo_name: demo_name,
|
838 |
-
slug: demo_slug,
|
839 |
-
content: content,
|
840 |
-
required_plugins: requiredPlugins,
|
841 |
-
astra_site_options: astraSiteOptions,
|
842 |
-
astra_enabled_extensions: astraEnabledExtensions
|
843 |
-
}]
|
844 |
-
|
845 |
-
var template = wp.template('astra-single-demo');
|
846 |
-
jQuery('.themes').append(template(templateData[0]));
|
847 |
-
});
|
848 |
-
|
849 |
-
},
|
850 |
-
|
851 |
-
_pluginInstalling: function(event, args) {
|
852 |
-
event.preventDefault();
|
853 |
-
|
854 |
-
var $card = jQuery( '.plugin-card-' + args.slug );
|
855 |
-
var $button = $card.find( '.button' );
|
856 |
-
|
857 |
-
$card.addClass('updating-message');
|
858 |
-
$button.addClass('already-started');
|
859 |
-
|
860 |
-
},
|
861 |
-
|
862 |
-
/**
|
863 |
-
* Fires when a nav item is clicked.
|
864 |
-
*
|
865 |
-
* @since 1.0
|
866 |
-
* @access private
|
867 |
-
* @method _importDemo
|
868 |
-
*/
|
869 |
-
_importDemo: function()
|
870 |
-
{
|
871 |
-
var $this = jQuery(this),
|
872 |
-
$theme = $this.closest('.astra-sites-preview').find('.wp-full-overlay-header'),
|
873 |
-
apiURL = $theme.data('demo-api') || '',
|
874 |
-
plugins = $theme.data('required-plugins');
|
875 |
-
|
876 |
-
var disabled = $this.attr('data-import');
|
877 |
-
|
878 |
-
if ( typeof disabled !== 'undefined' && disabled === 'disabled' ) {
|
879 |
-
|
880 |
-
$this.addClass('updating-message')
|
881 |
-
.text( wp.updates.l10n.installing );
|
882 |
-
|
883 |
-
/**
|
884 |
-
* Process Bulk Plugin Install & Activate
|
885 |
-
*/
|
886 |
-
AstraSites._bulkPluginInstallActivate();
|
887 |
-
|
888 |
-
return;
|
889 |
-
}
|
890 |
-
|
891 |
-
// Proceed?
|
892 |
-
if( ! confirm( astraDemo.strings.importWarning ) ) {
|
893 |
-
return;
|
894 |
-
}
|
895 |
-
|
896 |
-
jQuery('.astra-demo-import').attr('data-import', 'disabled')
|
897 |
-
.addClass('updating-message installing')
|
898 |
-
.text( astraDemo.strings.importingDemo );
|
899 |
-
|
900 |
-
$this.closest('.theme').focus();
|
901 |
-
|
902 |
-
var $theme = $this.closest('.astra-sites-preview').find('.wp-full-overlay-header');
|
903 |
-
|
904 |
-
var apiURL = $theme.data('demo-api') || '';
|
905 |
-
|
906 |
-
jQuery.ajax({
|
907 |
-
url: astraDemo.ajaxurl,
|
908 |
-
type: 'POST',
|
909 |
-
dataType: 'json',
|
910 |
-
data: {
|
911 |
-
action: 'astra-import-demo',
|
912 |
-
api_url: apiURL
|
913 |
-
},
|
914 |
-
})
|
915 |
-
.done(function ( demos ) {
|
916 |
-
|
917 |
-
// Success?
|
918 |
-
if( demos.success ) {
|
919 |
-
jQuery('.astra-demo-import').removeClass('updating-message installing')
|
920 |
-
.removeAttr('data-import')
|
921 |
-
.addClass('view-site')
|
922 |
-
.removeClass('astra-demo-import')
|
923 |
-
.text( astraDemo.strings.viewSite )
|
924 |
-
.attr('target', '_blank')
|
925 |
-
.append('<i class="dashicons dashicons-external"></i>')
|
926 |
-
.attr('href', astraDemo.siteURL );
|
927 |
-
|
928 |
-
} else {
|
929 |
-
|
930 |
-
var output = '<div class="astra-api-error notice notice-error notice-alt is-dismissible">';
|
931 |
-
output += ' <p>'+demos.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 |
-
jQuery('.install-theme-info').prepend( output );
|
938 |
-
|
939 |
-
// !important to add trigger.
|
940 |
-
// Which reinitialize the dismiss error message events.
|
941 |
-
jQuery(document).trigger('wp-updates-notice-added');
|
942 |
-
}
|
943 |
-
|
944 |
-
})
|
945 |
-
.fail(function ( demos ) {
|
946 |
-
jQuery('.astra-demo-import').removeClass('updating-message installing')
|
947 |
-
.removeAttr('data-import')
|
948 |
-
.addClass('view-site')
|
949 |
-
.removeClass('astra-demo-import')
|
950 |
-
.attr('target', '_blank')
|
951 |
-
.attr('href', astraDemo.strings.importFailedURL );
|
952 |
-
|
953 |
-
jQuery('.wp-full-overlay-header .view-site').text( astraDemo.strings.importFailedBtnSmall ).append('<i class="dashicons dashicons-external"></i>');
|
954 |
-
jQuery('.footer-import-button-wrap .view-site').text( astraDemo.strings.importFailedBtnLarge ).append('<i class="dashicons dashicons-external"></i>');
|
955 |
-
});
|
956 |
-
},
|
957 |
-
|
958 |
-
_bulkPluginInstallActivate: function()
|
959 |
-
{
|
960 |
-
if( 0 === astraDemo.requiredPlugins.length ) {
|
961 |
-
return;
|
962 |
-
}
|
963 |
-
|
964 |
-
jQuery('.required-plugins')
|
965 |
-
.find('.install-now')
|
966 |
-
.addClass( 'updating-message' )
|
967 |
-
.removeClass( 'install-now' )
|
968 |
-
.text( wp.updates.l10n.installing );
|
969 |
-
|
970 |
-
jQuery('.required-plugins')
|
971 |
-
.find('.activate-now')
|
972 |
-
.addClass('updating-message')
|
973 |
-
.removeClass( 'activate-now' )
|
974 |
-
.html( astraDemo.strings.btnActivating );
|
975 |
-
|
976 |
-
var not_installed = astraDemo.requiredPlugins.notinstalled || '';
|
977 |
-
var activate_plugins = astraDemo.requiredPlugins.inactive || '';
|
978 |
-
|
979 |
-
// First Install Bulk.
|
980 |
-
if( not_installed.length > 0 ) {
|
981 |
-
AstraSites._installAllPlugins( not_installed );
|
982 |
-
}
|
983 |
-
|
984 |
-
// Second Activate Bulk.
|
985 |
-
if( activate_plugins.length > 0 ) {
|
986 |
-
AstraSites._activateAllPlugins( activate_plugins );
|
987 |
-
}
|
988 |
-
|
989 |
-
},
|
990 |
-
|
991 |
-
/**
|
992 |
-
* Install All Plugins.
|
993 |
-
*/
|
994 |
-
_installAllPlugins: function( not_installed ) {
|
995 |
-
|
996 |
-
jQuery.each( not_installed, function(index, single_plugin) {
|
997 |
-
|
998 |
-
var $card = jQuery( '.plugin-card-' + single_plugin.slug ),
|
999 |
-
$button = $card.find('.button');
|
1000 |
-
|
1001 |
-
if( ! $button.hasClass('already-started') ) {
|
1002 |
-
|
1003 |
-
// Add each plugin activate request in Ajax queue.
|
1004 |
-
// @see wp-admin/js/updates.js
|
1005 |
-
wp.updates.queue.push( {
|
1006 |
-
action: 'install-plugin', // Required action.
|
1007 |
-
data: {
|
1008 |
-
slug: single_plugin.slug
|
1009 |
-
}
|
1010 |
-
} );
|
1011 |
-
}
|
1012 |
-
});
|
1013 |
-
|
1014 |
-
// Required to set queue.
|
1015 |
-
wp.updates.queueChecker();
|
1016 |
-
},
|
1017 |
-
|
1018 |
-
|
1019 |
-
/**
|
1020 |
-
* Activate All Plugins.
|
1021 |
-
*/
|
1022 |
-
_activateAllPlugins: function( activate_plugins ) {
|
1023 |
-
|
1024 |
-
// Process of cloud templates - (download, remove & fetch).
|
1025 |
-
AstraSitesAjaxQueue.run();
|
1026 |
-
|
1027 |
-
jQuery.each( activate_plugins, function(index, single_plugin) {
|
1028 |
-
|
1029 |
-
var $card = jQuery( '.plugin-card-' + single_plugin.slug ),
|
1030 |
-
$button = $card.find('.button'),
|
1031 |
-
$siteOptions = jQuery( '.wp-full-overlay-header').find('.astra-site-options').val(),
|
1032 |
-
$enabledExtensions = jQuery( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
|
1033 |
-
|
1034 |
-
$button.addClass('updating-message');
|
1035 |
-
|
1036 |
-
AstraSitesAjaxQueue.add({
|
1037 |
-
url: astraDemo.ajaxurl,
|
1038 |
-
type: 'POST',
|
1039 |
-
data: {
|
1040 |
-
'action' : 'astra-required-plugin-activate',
|
1041 |
-
'init' : single_plugin.init,
|
1042 |
-
'options' : $siteOptions,
|
1043 |
-
'enabledExtensions' : $enabledExtensions,
|
1044 |
-
},
|
1045 |
-
success: function( result ){
|
1046 |
-
|
1047 |
-
if( result.success ) {
|
1048 |
-
|
1049 |
-
var $card = jQuery( '.plugin-card-' + single_plugin.slug );
|
1050 |
-
var $button = $card.find( '.button' );
|
1051 |
-
if( ! $button.hasClass('already-started') ) {
|
1052 |
-
var pluginsList = astraDemo.requiredPlugins.inactive;
|
1053 |
-
|
1054 |
-
// Reset not installed plugins list.
|
1055 |
-
astraDemo.requiredPlugins.inactive = AstraSites._removePluginFromQueue( single_plugin.slug, pluginsList );
|
1056 |
-
}
|
1057 |
-
|
1058 |
-
$button.removeClass( 'button-primary install-now activate-now updating-message' )
|
1059 |
-
.attr('disabled', 'disabled')
|
1060 |
-
.addClass('disabled')
|
1061 |
-
.text( astraDemo.strings.btnActive );
|
1062 |
-
|
1063 |
-
// Enable Demo Import Button
|
1064 |
-
AstraSites._enable_demo_import_button();
|
1065 |
-
}
|
1066 |
-
}
|
1067 |
-
});
|
1068 |
-
});
|
1069 |
-
},
|
1070 |
-
|
1071 |
-
/**
|
1072 |
-
* Enable Demo Import Button.
|
1073 |
-
*/
|
1074 |
-
_enable_demo_import_button: function( type = 'free' ) {
|
1075 |
-
|
1076 |
-
switch( type ) {
|
1077 |
-
|
1078 |
-
case 'free':
|
1079 |
-
var all_buttons = parseInt( jQuery( '.plugin-card .button' ).length ) || 0,
|
1080 |
-
disabled_buttons = parseInt( jQuery( '.plugin-card .button.disabled' ).length ) || 0;
|
1081 |
-
|
1082 |
-
if( all_buttons === disabled_buttons ) {
|
1083 |
-
|
1084 |
-
jQuery('.astra-demo-import')
|
1085 |
-
.removeAttr('data-import')
|
1086 |
-
.removeClass('updating-message')
|
1087 |
-
.addClass('button-primary')
|
1088 |
-
.text( astraDemo.strings.importDemo );
|
1089 |
-
}
|
1090 |
-
|
1091 |
-
break;
|
1092 |
-
|
1093 |
-
case 'upgrade':
|
1094 |
-
var demo_slug = jQuery('.wp-full-overlay-header').attr('data-demo-slug');
|
1095 |
-
|
1096 |
-
jQuery('.astra-demo-import')
|
1097 |
-
.addClass('go-pro button-primary')
|
1098 |
-
.removeClass('astra-demo-import')
|
1099 |
-
.attr('target', '_blank')
|
1100 |
-
.attr('href', astraDemo.getUpgradeURL + demo_slug )
|
1101 |
-
.text( astraDemo.getUpgradeText )
|
1102 |
-
.append('<i class="dashicons dashicons-external"></i>');
|
1103 |
-
break;
|
1104 |
-
|
1105 |
-
default:
|
1106 |
-
var demo_slug = jQuery('.wp-full-overlay-header').attr('data-demo-slug');
|
1107 |
-
|
1108 |
-
jQuery('.astra-demo-import')
|
1109 |
-
.addClass('go-pro button-primary')
|
1110 |
-
.removeClass('astra-demo-import')
|
1111 |
-
.attr('target', '_blank')
|
1112 |
-
.attr('href', astraDemo.getProURL )
|
1113 |
-
.text( astraDemo.getProText )
|
1114 |
-
.append('<i class="dashicons dashicons-external"></i>');
|
1115 |
-
break;
|
1116 |
-
}
|
1117 |
-
|
1118 |
-
},
|
1119 |
-
|
1120 |
-
/**
|
1121 |
-
* Remove plugin from the queue.
|
1122 |
-
*/
|
1123 |
-
_removePluginFromQueue: function( removeItem, pluginsList ) {
|
1124 |
-
return jQuery.grep(pluginsList, function( value ) {
|
1125 |
-
return value.slug != removeItem;
|
1126 |
-
});
|
1127 |
-
}
|
1128 |
-
|
1129 |
-
};
|
1130 |
-
|
1131 |
-
/**
|
1132 |
-
* Initialize AstraSites
|
1133 |
-
*/
|
1134 |
-
$(function(){
|
1135 |
-
AstraSites.init();
|
1136 |
-
});
|
1137 |
-
|
1138 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/assets/js/astra-sites-notices.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
jQuery(document).ready(function ($) {
|
2 |
|
3 |
-
jQuery( '.astra-notice.is-dismissible' ).on( 'click', function() {
|
4 |
var $id = jQuery( this ).attr( 'id' ) || '';
|
5 |
var $time = jQuery( this ).attr( 'dismissible-time' ) || '';
|
6 |
var $meta = jQuery( this ).attr( 'dismissible-meta' ) || '';
|
1 |
jQuery(document).ready(function ($) {
|
2 |
|
3 |
+
jQuery( '.astra-notice.is-dismissible .notice-dismiss' ).on( 'click', function() {
|
4 |
var $id = jQuery( this ).attr( 'id' ) || '';
|
5 |
var $time = jQuery( this ).attr( 'dismissible-time' ) || '';
|
6 |
var $meta = jQuery( this ).attr( 'dismissible-meta' ) || '';
|
inc/assets/vendor/js/jquery.lazy.js
DELETED
@@ -1,830 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* jQuery & Zepto Lazy - v1.7.5
|
3 |
-
* http://jquery.eisbehr.de/lazy/
|
4 |
-
*
|
5 |
-
* Copyright 2012 - 2017, Daniel 'Eisbehr' Kern
|
6 |
-
*
|
7 |
-
* Dual licensed under the MIT and GPL-2.0 licenses:
|
8 |
-
* http://www.opensource.org/licenses/mit-license.php
|
9 |
-
* http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
-
*
|
11 |
-
* $("img.lazy").lazy();
|
12 |
-
*/
|
13 |
-
|
14 |
-
;(function(window, undefined) {
|
15 |
-
"use strict";
|
16 |
-
|
17 |
-
// noinspection JSUnresolvedVariable
|
18 |
-
/**
|
19 |
-
* library instance - here and not in construct to be shorter in minimization
|
20 |
-
* @return void
|
21 |
-
*/
|
22 |
-
var $ = window.jQuery || window.Zepto,
|
23 |
-
|
24 |
-
/**
|
25 |
-
* unique plugin instance id counter
|
26 |
-
* @type {number}
|
27 |
-
*/
|
28 |
-
lazyInstanceId = 0,
|
29 |
-
|
30 |
-
/**
|
31 |
-
* helper to register window load for jQuery 3
|
32 |
-
* @type {boolean}
|
33 |
-
*/
|
34 |
-
windowLoaded = false;
|
35 |
-
|
36 |
-
/**
|
37 |
-
* make lazy available to jquery - and make it a bit more case-insensitive :)
|
38 |
-
* @access public
|
39 |
-
* @type {function}
|
40 |
-
* @param {object} settings
|
41 |
-
* @return void
|
42 |
-
*/
|
43 |
-
$.fn.Lazy = $.fn.lazy = function(settings) {
|
44 |
-
return new LazyPlugin(this, settings);
|
45 |
-
};
|
46 |
-
|
47 |
-
/**
|
48 |
-
* helper to add plugins to lazy prototype configuration
|
49 |
-
* @access public
|
50 |
-
* @type {function}
|
51 |
-
* @param {string|Array} names
|
52 |
-
* @param {string|Array} [elements]
|
53 |
-
* @param {function} loader
|
54 |
-
* @return void
|
55 |
-
*/
|
56 |
-
$.Lazy = $.lazy = function(names, elements, loader) {
|
57 |
-
// make second parameter optional
|
58 |
-
if( $.isFunction(elements) ) {
|
59 |
-
loader = elements;
|
60 |
-
elements = [];
|
61 |
-
}
|
62 |
-
|
63 |
-
// exit here if parameter is not a callable function
|
64 |
-
if( !$.isFunction(loader) ) return;
|
65 |
-
|
66 |
-
// make parameters an array of names to be sure
|
67 |
-
names = $.isArray(names) ? names : [names];
|
68 |
-
elements = $.isArray(elements) ? elements : [elements];
|
69 |
-
|
70 |
-
var config = LazyPlugin.prototype.config,
|
71 |
-
forced = config._f || (config._f = {});
|
72 |
-
|
73 |
-
// add the loader plugin for every name
|
74 |
-
for( var i = 0, l = names.length; i < l; i++ )
|
75 |
-
if( config[names[i]] === undefined || $.isFunction(config[names[i]]) )
|
76 |
-
config[names[i]] = loader;
|
77 |
-
|
78 |
-
// add forced elements loader
|
79 |
-
for( var c = 0, a = elements.length; c < a; c++ )
|
80 |
-
forced[elements[c]] = names[0];
|
81 |
-
};
|
82 |
-
|
83 |
-
/**
|
84 |
-
* contains all logic and the whole element handling
|
85 |
-
* is packed in a private function outside class to reduce memory usage, because it will not be created on every plugin instance
|
86 |
-
* @access private
|
87 |
-
* @type {function}
|
88 |
-
* @param {LazyPlugin} instance
|
89 |
-
* @param {object} config
|
90 |
-
* @param {object|Array} items
|
91 |
-
* @param {object} events
|
92 |
-
* @param {string} namespace
|
93 |
-
* @return void
|
94 |
-
*/
|
95 |
-
function _executeLazy(instance, config, items, events, namespace) {
|
96 |
-
/**
|
97 |
-
* a helper to trigger the 'onFinishedAll' callback after all other events
|
98 |
-
* @access private
|
99 |
-
* @type {number}
|
100 |
-
*/
|
101 |
-
var _awaitingAfterLoad = 0,
|
102 |
-
|
103 |
-
/**
|
104 |
-
* visible content width
|
105 |
-
* @access private
|
106 |
-
* @type {number}
|
107 |
-
*/
|
108 |
-
_actualWidth = -1,
|
109 |
-
|
110 |
-
/**
|
111 |
-
* visible content height
|
112 |
-
* @access private
|
113 |
-
* @type {number}
|
114 |
-
*/
|
115 |
-
_actualHeight = -1,
|
116 |
-
|
117 |
-
/**
|
118 |
-
* determine possibly detected high pixel density
|
119 |
-
* @access private
|
120 |
-
* @type {boolean}
|
121 |
-
*/
|
122 |
-
_isRetinaDisplay = false,
|
123 |
-
|
124 |
-
/**
|
125 |
-
* dictionary entry for better minimization
|
126 |
-
* @access private
|
127 |
-
* @type {string}
|
128 |
-
*/
|
129 |
-
_afterLoad = "afterLoad",
|
130 |
-
|
131 |
-
/**
|
132 |
-
* dictionary entry for better minimization
|
133 |
-
* @access private
|
134 |
-
* @type {string}
|
135 |
-
*/
|
136 |
-
_load = "load",
|
137 |
-
|
138 |
-
/**
|
139 |
-
* dictionary entry for better minimization
|
140 |
-
* @access private
|
141 |
-
* @type {string}
|
142 |
-
*/
|
143 |
-
_error = "error",
|
144 |
-
|
145 |
-
/**
|
146 |
-
* dictionary entry for better minimization
|
147 |
-
* @access private
|
148 |
-
* @type {string}
|
149 |
-
*/
|
150 |
-
_img = "img",
|
151 |
-
|
152 |
-
/**
|
153 |
-
* dictionary entry for better minimization
|
154 |
-
* @access private
|
155 |
-
* @type {string}
|
156 |
-
*/
|
157 |
-
_src = "src",
|
158 |
-
|
159 |
-
/**
|
160 |
-
* dictionary entry for better minimization
|
161 |
-
* @access private
|
162 |
-
* @type {string}
|
163 |
-
*/
|
164 |
-
_srcset = "srcset",
|
165 |
-
|
166 |
-
/**
|
167 |
-
* dictionary entry for better minimization
|
168 |
-
* @access private
|
169 |
-
* @type {string}
|
170 |
-
*/
|
171 |
-
_sizes = "sizes",
|
172 |
-
|
173 |
-
/**
|
174 |
-
* dictionary entry for better minimization
|
175 |
-
* @access private
|
176 |
-
* @type {string}
|
177 |
-
*/
|
178 |
-
_backgroundImage = "background-image";
|
179 |
-
|
180 |
-
/**
|
181 |
-
* initialize plugin
|
182 |
-
* bind loading to events or set delay time to load all items at once
|
183 |
-
* @access private
|
184 |
-
* @return void
|
185 |
-
*/
|
186 |
-
function _initialize() {
|
187 |
-
// detect actual device pixel ratio
|
188 |
-
// noinspection JSUnresolvedVariable
|
189 |
-
_isRetinaDisplay = window.devicePixelRatio > 1;
|
190 |
-
|
191 |
-
// prepare all initial items
|
192 |
-
_prepareItems(items);
|
193 |
-
|
194 |
-
// if delay time is set load all items at once after delay time
|
195 |
-
if( config.delay >= 0 ) setTimeout(function() { _lazyLoadItems(true); }, config.delay);
|
196 |
-
|
197 |
-
// if no delay is set or combine usage is active bind events
|
198 |
-
if( config.delay < 0 || config.combined ) {
|
199 |
-
// create unique event function
|
200 |
-
events.e = _throttle(config.throttle, function(event) {
|
201 |
-
// reset detected window size on resize event
|
202 |
-
if( event.type === "resize" )
|
203 |
-
_actualWidth = _actualHeight = -1;
|
204 |
-
|
205 |
-
// execute 'lazy magic'
|
206 |
-
_lazyLoadItems(event.all);
|
207 |
-
});
|
208 |
-
|
209 |
-
// create function to add new items to instance
|
210 |
-
events.a = function(additionalItems) {
|
211 |
-
_prepareItems(additionalItems);
|
212 |
-
items.push.apply(items, additionalItems);
|
213 |
-
};
|
214 |
-
|
215 |
-
// create function to get all instance items left
|
216 |
-
events.g = function() {
|
217 |
-
// filter loaded items before return in case internal filter was not running until now
|
218 |
-
return (items = $(items).filter(function() {
|
219 |
-
return !$(this).data(config.loadedName);
|
220 |
-
}));
|
221 |
-
};
|
222 |
-
|
223 |
-
// create function to force loading elements
|
224 |
-
events.f = function(forcedItems) {
|
225 |
-
for( var i = 0; i < forcedItems.length; i++ ) {
|
226 |
-
// only handle item if available in current instance
|
227 |
-
// use a compare function, because Zepto can't handle object parameter for filter
|
228 |
-
// var item = items.filter(forcedItems[i]);
|
229 |
-
/* jshint loopfunc: true */
|
230 |
-
var item = items.filter(function() {
|
231 |
-
return this === forcedItems[i];
|
232 |
-
});
|
233 |
-
|
234 |
-
if( item.length ) {
|
235 |
-
_lazyLoadItems(false, item);
|
236 |
-
}
|
237 |
-
}
|
238 |
-
};
|
239 |
-
|
240 |
-
// load initial items
|
241 |
-
_lazyLoadItems();
|
242 |
-
|
243 |
-
// bind lazy load functions to scroll and resize event
|
244 |
-
// noinspection JSUnresolvedVariable
|
245 |
-
$(config.appendScroll).on("scroll." + namespace + " resize." + namespace, events.e);
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* prepare items before handle them
|
251 |
-
* @access private
|
252 |
-
* @param {Array|object|jQuery} items
|
253 |
-
* @return void
|
254 |
-
*/
|
255 |
-
function _prepareItems(items) {
|
256 |
-
// fetch used configurations before loops
|
257 |
-
var defaultImage = config.defaultImage,
|
258 |
-
placeholder = config.placeholder,
|
259 |
-
imageBase = config.imageBase,
|
260 |
-
srcsetAttribute = config.srcsetAttribute,
|
261 |
-
loaderAttribute = config.loaderAttribute,
|
262 |
-
forcedTags = config._f || {};
|
263 |
-
|
264 |
-
// filter items and only add those who not handled yet and got needed attributes available
|
265 |
-
items = $(items).filter(function() {
|
266 |
-
var element = $(this),
|
267 |
-
tag = _getElementTagName(this);
|
268 |
-
|
269 |
-
return !element.data(config.handledName) &&
|
270 |
-
(element.attr(config.attribute) || element.attr(srcsetAttribute) || element.attr(loaderAttribute) || forcedTags[tag] !== undefined);
|
271 |
-
})
|
272 |
-
|
273 |
-
// append plugin instance to all elements
|
274 |
-
.data("plugin_" + config.name, instance);
|
275 |
-
|
276 |
-
for( var i = 0, l = item |