CMP – Coming Soon & Maintenance Plugin by NiteoThemes - Version 3.9.3

Version Description

Download this release

Release Info

Developer niteo
Plugin Icon 128x128 CMP – Coming Soon & Maintenance Plugin by NiteoThemes
Version 3.9.3
Comparing to
See all releases

Code changes from version 3.9.2 to 3.9.3

img/thumbnails/saturn/screenshot1.jpg ADDED
Binary file
img/thumbnails/saturn/screenshot2.jpg ADDED
Binary file
img/thumbnails/saturn/screenshot3.jpg ADDED
Binary file
img/thumbnails/saturn_thumbnail.jpg ADDED
Binary file
inc/render/custom-css.php CHANGED
@@ -1,5 +1,10 @@
1
 
2
  <?php
 
 
 
 
 
3
  $css = '';
4
  $themeslug = $this->cmp_selectedTheme();
5
  $countdown_action = get_option('niteoCS_countdown_action', 'no-action');
@@ -176,6 +181,17 @@ if ( class_exists('Cookie_Notice') && get_option('cmp_cookie_notice_comp', '1')
176
  <?php
177
  }
178
 
 
 
 
 
 
 
 
 
 
 
 
179
 
180
  $css = ob_get_clean();
181
 
1
 
2
  <?php
3
+ /**
4
+ * Detect plugin. For use on Front End only.
5
+ */
6
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
7
+
8
  $css = '';
9
  $themeslug = $this->cmp_selectedTheme();
10
  $countdown_action = get_option('niteoCS_countdown_action', 'no-action');
181
  <?php
182
  }
183
 
184
+ // Styles for Plugin Name Weglot
185
+ if ( is_plugin_active( 'weglot/weglot.php' ) && defined('WEGLOT_VERSION') ) { ?>
186
+
187
+ <link rel='stylesheet' id='weglot-css-css' href='https://cmp.weglot-translate.com/wp-content/plugins/weglot/dist/css/front-css.css?ver=<?php echo WEGLOT_VERSION;?>' media='' />
188
+ <style>
189
+ aside.country-selector.weglot-dropdown.weglot-default.weglot-invert span {
190
+ color: black!important;
191
+ }
192
+ </style>
193
+ <?php
194
+ }
195
 
196
  $css = ob_get_clean();
197
 
inc/render/head-scripts.php CHANGED
@@ -1,9 +1,6 @@
1
  <?php
2
 
3
- /**
4
- * Detect plugin. For use on Front End only.
5
- */
6
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
7
 
8
  $this->cmp_wp_head();
9
 
@@ -69,14 +66,3 @@ if ( ( function_exists('cn_cookies_accepted') && get_option('cmp_cookie_notice_c
69
  }
70
  }
71
 
72
- // Styles for Plugin Name Weglot
73
- if ( is_plugin_active( 'weglot/weglot.php' ) && defined('WEGLOT_VERSION') ) { ?>
74
-
75
- <link rel='stylesheet' id='weglot-css-css' href='https://cmp.weglot-translate.com/wp-content/plugins/weglot/dist/css/front-css.css?ver=<?php echo WEGLOT_VERSION;?>' media='' />
76
- <style>
77
- aside.country-selector.weglot-dropdown.weglot-default.weglot-invert span {
78
- color: black!important;
79
- }
80
- </style>
81
- <?php
82
- }
1
  <?php
2
 
3
+
 
 
 
4
 
5
  $this->cmp_wp_head();
6
 
66
  }
67
  }
68
 
 
 
 
 
 
 
 
 
 
 
 
inc/render/javascripts.php CHANGED
@@ -420,9 +420,9 @@ if ( isset( $theme_supports['counter_script']) && $theme_supports['counter_scrip
420
 
421
  if ( $counter_script && get_option('niteoCS_counter', '1') == '1') {
422
  $countdown_action = get_option('niteoCS_countdown_action', 'no-action');
423
-
424
  // counter script for day only
425
- if ( $themeslug === 'delta' || $themeslug === 'mercury' || $themeslug === 'libra' || $themeslug === 'thor' || $themeslug === 'headliner' || $themeslug === 'mosaic' ) { ?>
426
  <script>
427
  var countdown = document.getElementById('counter');
428
  var count = parseInt(document.getElementById('counter-day').textContent);
420
 
421
  if ( $counter_script && get_option('niteoCS_counter', '1') == '1') {
422
  $countdown_action = get_option('niteoCS_countdown_action', 'no-action');
423
+ $days_counter = array('delta', 'mercury', 'libra', 'thor', 'headliner', 'mosaic', 'saturn');
424
  // counter script for day only
425
+ if ( in_array($themeslug, $days_counter) ) { ?>
426
  <script>
427
  var countdown = document.getElementById('counter');
428
  var count = parseInt(document.getElementById('counter-day').textContent);
inc/render/social-icons.php CHANGED
@@ -11,7 +11,7 @@ if ( get_option('niteoCS_socialmedia') ) {
11
  //sort social icons array by hidden, then order key
12
  uasort( $socialmedia , array($this,'sort_social') );
13
 
14
- $theme_html = ( $themeslug == 'stylo' || $themeslug == 'mosaic') ? '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="3em" height="3em" viewBox="0 0 80 80" xml:space="preserve"><circle transform="rotate(-90 40 40)" class="another-circle" cx="40" cy="40" r="36" /></svg>' : '';
15
 
16
  if ( $title == true ) {
17
  $soc_title = $this->cmp_wpml_translate_string( stripslashes( get_option('niteoCS_soc_title', 'GET SOCIAL WITH US') ), 'Social Icons Title' );;
11
  //sort social icons array by hidden, then order key
12
  uasort( $socialmedia , array($this,'sort_social') );
13
 
14
+ $theme_html = ( $themeslug == 'stylo' || $themeslug == 'mosaic' || $themeslug == 'saturn') ? '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="3em" height="3em" viewBox="0 0 80 80" xml:space="preserve"><circle transform="rotate(-90 40 40)" class="another-circle" cx="40" cy="40" r="36" /></svg>' : '';
15
 
16
  if ( $title == true ) {
17
  $soc_title = $this->cmp_wpml_translate_string( stripslashes( get_option('niteoCS_soc_title', 'GET SOCIAL WITH US') ), 'Social Icons Title' );;
inc/settings/settings-background.php CHANGED
@@ -158,8 +158,8 @@ $mobile_banner_custom_id = get_option('niteoCS_mobile_banner_id', '');
158
 
159
  $i = 0;
160
  foreach ( $ids as $id ) {
161
- if ( $i == 0 ) {
162
- $img = wp_get_attachment_image_src( $id, 'large' ); ?>
163
  <div class="big-thumb">
164
  <div class="thumbnail-overlay"></div>
165
  <?php
@@ -169,7 +169,6 @@ $mobile_banner_custom_id = get_option('niteoCS_mobile_banner_id', '');
169
  </div>
170
  <?php
171
  } else {
172
- $img = wp_get_attachment_image_src( $id, 'medium' );
173
  if ( isset ($img[0] ) ) {
174
  echo '<img src="' . $img[0] . '" alt="" class="no-blur">';
175
  }
158
 
159
  $i = 0;
160
  foreach ( $ids as $id ) {
161
+ $img = wp_get_attachment_image_src( $id, 'large' );
162
+ if ( $i == 0 ) { ?>
163
  <div class="big-thumb">
164
  <div class="thumbnail-overlay"></div>
165
  <?php
169
  </div>
170
  <?php
171
  } else {
 
172
  if ( isset ($img[0] ) ) {
173
  echo '<img src="' . $img[0] . '" alt="" class="no-blur">';
174
  }
inc/settings/settings-seo.php CHANGED
@@ -60,7 +60,7 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
60
  echo '<img src="'.esc_url( $niteoCS_seo_img_url ).'" alt="">';
61
  } ?>
62
  </div>
63
- <span class="cmp-hint">* <?php _e('By default seleceted Background image is displayed on Social Networks if your Website is shared. You can overwrite the image by selecting your custom image here.', 'cmp-coming-soon-maintenance');?></span>
64
  <br><br>
65
  <input id="delete-seo_img" type="button" class="button" value="Remove Image" />
66
  </fieldset>
60
  echo '<img src="'.esc_url( $niteoCS_seo_img_url ).'" alt="">';
61
  } ?>
62
  </div>
63
+ <span class="cmp-hint">* <?php _e('By default selected Background image is displayed on Social Networks if your Website is shared. You can overwrite the image by selecting your custom image here.', 'cmp-coming-soon-maintenance');?></span>
64
  <br><br>
65
  <input id="delete-seo_img" type="button" class="button" value="Remove Image" />
66
  </fieldset>
js/cmp-advanced.js CHANGED
@@ -1,287 +1,251 @@
1
  jQuery(document).ready(function ($) {
2
-
3
- var tab = document.location.hash.substring(1);
4
- var action = jQuery("#csoptions").attr("action");
5
- var importing = false;
6
-
7
- // function to tab navigation
8
- navtab = function (tab) {
9
- jQuery(
10
- ".cmp-coming-soon-maintenance .nav-tab-wrapper .nav-tab"
11
- ).removeClass("nav-tab-active");
12
-
13
- jQuery('.nav-tab-wrapper .nav-tab[data-tab="' + tab + '"]').addClass("nav-tab-active");
14
-
15
- jQuery(".cmp-coming-soon-maintenance .table-wrapper." + tab).css(
16
- "display",
17
- "block"
18
- );
19
- jQuery(".cmp-coming-soon-maintenance .table-wrapper-css." + tab).css(
20
- "display",
21
- "block"
22
- );
23
- jQuery(".cmp-coming-soon-maintenance .comingsoon." + tab).css(
24
- "display",
25
- "block"
26
- );
27
-
28
- jQuery(".cmp-coming-soon-maintenance .table-wrapper:not(." + tab + ")").css(
29
- "display",
30
- "none"
31
- );
32
- jQuery(".cmp-coming-soon-maintenance .table-wrapper-css:not(." + tab).css(
33
- "display",
34
- "none"
35
- );
36
- jQuery(".cmp-coming-soon-maintenance .comingsoon:not(." + tab + ")").css(
37
- "display",
38
- "none"
39
- );
40
-
41
- if (tab == "install") {
42
- jQuery(".cmp-coming-soon-maintenance .submit").css("display", "none");
43
- jQuery(".cmp-coming-soon-maintenance #csoptions").attr("action", action);
44
- } else {
45
- jQuery(".cmp-coming-soon-maintenance .submit").css("display", "block");
46
- // change form action to display current tab after save
47
- jQuery(".cmp-coming-soon-maintenance #csoptions").attr(
48
- "action",
49
- action + "#" + tab
50
- );
51
- }
52
- };
53
-
54
- if (tab != "") {
55
- navtab(tab);
56
- } else {
57
- jQuery(".cmp-coming-soon-maintenance .table-wrapper-css").css(
58
- "display",
59
- "none"
60
- );
61
- }
62
-
63
- window.onhashchange = function () {
64
- tab = document.location.hash.substring(1);
65
- navtab(tab);
66
- };
67
-
68
- jQuery(".cmp-coming-soon-maintenance .nav-tab").click(function (e) {
69
- e.preventDefault();
70
- tab = jQuery(this).data("tab");
71
- document.location.hash = tab;
72
- });
73
-
74
- toggle_settings('page-whitelist');
75
- toggle_settings('cmp-bypass');
76
- toggle_settings('cmp-topbar-icon');
77
- toggle_settings('countdown-toggle');
78
- toggle_settings('mode-change-toggle');
79
- toggle_settings('cmp-wpautop');
80
- toggle_settings('cmp-cookienotice');
81
- cmp_repeat_fields('head_scripts');
82
- cmp_repeat_fields('footer_scripts');
83
-
84
- // upload json file button
85
- jQuery('#cmp-import-json').on('change', function (e) {
86
- // change label
87
- jQuery('.import-json-label').attr('data-default', e.target.files[0].name);
88
-
89
- var reader = new FileReader();
90
- reader.onload = function (e) {
91
- jQuery('#cmp-import-input').val(e.target.result);
92
- }
93
-
94
- reader.readAsText(e.target.files[0]);
95
-
96
- // enable import button
97
- $('#cmp-import-settings').attr('disabled', false);
98
- jQuery('.import-json-label').removeClass('import-fail');
99
-
100
- importing = false;
101
- });
102
-
103
- // export button ajax call
104
- jQuery('#cmp-export-json').click(function (e) {
105
- e.preventDefault();
106
-
107
- var data = {
108
- action: "cmp_ajax_export_settings",
109
- security: jQuery(this).data('security'),
110
- };
111
-
112
- jQuery.post(ajaxurl, data, function (response) {
113
- if (response) {
114
- jQuery('<iframe />').attr('src', ajaxurl + '?action=cmp_ajax_export_settings&security=' + jQuery('#cmp-export-json').data('security')).appendTo('body').hide();
115
- }
116
- });
117
- });
118
-
119
- // import button ajax call
120
- jQuery('#cmp-import-settings').click(function (e) {
121
-
122
- e.preventDefault();
123
-
124
- if (importing === true) {
125
- return false;
126
- }
127
-
128
- var json = jQuery('#cmp-import-input').val();
129
- var $label = jQuery('.import-json-label');
130
-
131
- // remove settings keys with media if no media import
132
- if (!jQuery('#cmp-import-media').is(':checked')) {
133
-
134
- var settings = new Array('niteoCS_banner_id', 'niteoCS_logo_id', 'niteoCS_seo_img_id');
135
-
136
- json = jQuery.parseJSON(json);
137
-
138
- json.map(function (value, index) {
139
- for (var key in value) {
140
- if (settings.indexOf(key) > -1) {
141
- json.splice(index, 1);
142
- }
143
-
144
- }
145
- });
146
-
147
- json = JSON.stringify(json);
148
-
149
- }
150
-
151
- var data = {
152
- action: "cmp_ajax_import_settings",
153
- security: jQuery(this).data('security'),
154
- json: json
155
- };
156
-
157
- importing = true;
158
-
159
- var ajaxTime = new Date().getTime();
160
-
161
- // change label
162
- $label.html('<i class="fa fa-cog fa-spin" aria-hidden="true"></i> importing..');
163
- $label.attr('data-default', '');
164
-
165
- jQuery.post(ajaxurl, data, function (response) {
166
-
167
- if (response) {
168
- var totalTime = new Date().getTime() - ajaxTime;
169
- var result = jQuery.parseJSON(response);
170
-
171
- if (totalTime > 2000) {
172
- if (result.result == 'success') {
173
- $label.addClass('import-success');
174
- } else {
175
- $label.addClass('import-fail');
176
- }
177
-
178
- $label.html('');
179
- $label.attr('data-default', result.message);
180
-
181
- } else {
182
- setTimeout(function () {
183
-
184
- if (result.result == 'success') {
185
- $label.addClass('import-success');
186
- } else {
187
- $label.addClass('import-fail');
188
- }
189
-
190
- $label.html('');
191
- $label.attr('data-default', result.message);
192
- }, 2000 - totalTime);
193
- }
194
-
195
- }
196
- });
197
- });
198
-
199
- function toggle_settings(classname) {
200
- jQuery('.' + classname).change(function () {
201
- var value = jQuery('.' + classname + ':checked').val();
202
- value = (jQuery.isNumeric(value)) ? 'x' + value : value;
203
- value = (value === undefined) ? 'x' + 0 : value;
204
-
205
- jQuery('.' + classname + '-switch.' + value).css('display', 'block');
206
- jQuery('.' + classname + '-switch:not(.' + value + ')').css('display', 'none');
207
- });
208
-
209
- jQuery('.' + classname).first().trigger('change');
210
- }
211
-
212
- jQuery('.cmp-whitelist-select, .cmp-blacklist, .cmp-user_roles').select2({
213
- width: 'calc(100% - 1em)',
214
- placeholder: 'Click to select..',
215
- });
216
-
217
- jQuery('select[name="niteoCS_topbar_version"]').select2({
218
- width: 'calc(100% - 1em)',
219
- minimumResultsForSearch: -1
220
- });
221
-
222
-
223
- function copyTextToClipboard(text) {
224
- var textArea = document.createElement("textarea");
225
- textArea.style.position = 'fixed';
226
- textArea.style.top = 0;
227
- textArea.style.left = 0;
228
- textArea.style.width = '2em';
229
- textArea.style.height = '2em';
230
- textArea.style.padding = 0;
231
- textArea.style.border = 'none';
232
- textArea.style.outline = 'none';
233
- textArea.style.boxShadow = 'none';
234
- textArea.style.background = 'transparent';
235
- textArea.value = text;
236
-
237
- document.body.appendChild(textArea);
238
- textArea.focus();
239
- textArea.select();
240
-
241
- try {
242
- var successful = document.execCommand('copy');
243
- var msg = successful ? 'successful' : 'unsuccessful';
244
- console.log('Copying text command was ' + msg);
245
- } catch (err) {
246
- console.log('Oops, unable to copy');
247
- }
248
-
249
- document.body.removeChild(textArea);
250
- }
251
-
252
-
253
- jQuery('#copy-bypass').click(function (e) {
254
- e.preventDefault();
255
- copyTextToClipboard(jQuery('#bypass-code').html());
256
-
257
- });
258
-
259
-
260
-
261
-
262
- function cmp_repeat_fields(field_id) {
263
- jQuery('#add-' + field_id).click(function (e) {
264
- e.preventDefault();
265
- var $wrapper = jQuery('#wrapper-' + field_id);
266
- var $target = jQuery('#wrapper-' + field_id + ' .target-repeater-fields');
267
- var $fields = $wrapper.find('.source-repeater-fields').children().clone();
268
- $($fields[0]).val('');
269
- $($target).append($fields);
270
- });
271
-
272
- cmp_delete_field(field_id);
273
- }
274
-
275
- function cmp_delete_field(field_id) {
276
- jQuery('#wrapper-' + field_id + ' .target-repeater-fields').on('click', '.delete-' + field_id, function (e) {
277
- e.preventDefault();
278
- $(this).prev().remove();
279
- $(this).remove();
280
- });
281
-
282
- jQuery('#wrapper-' + field_id + ' .source-repeater-fields').on('click', '.delete-' + field_id, function (e) {
283
- e.preventDefault();
284
- $(this).prev().val('');
285
- });
286
- }
287
  });
1
  jQuery(document).ready(function ($) {
2
+ var tab = document.location.hash.substring(1);
3
+ var action = jQuery('#csoptions').attr('action');
4
+ var importing = false;
5
+
6
+ // function to tab navigation
7
+ navtab = function (tab) {
8
+ jQuery('.cmp-coming-soon-maintenance .nav-tab-wrapper .nav-tab').removeClass('nav-tab-active');
9
+
10
+ jQuery('.nav-tab-wrapper .nav-tab[data-tab="' + tab + '"]').addClass('nav-tab-active');
11
+
12
+ jQuery('.cmp-coming-soon-maintenance .table-wrapper.' + tab).css('display', 'block');
13
+ jQuery('.cmp-coming-soon-maintenance .table-wrapper-css.' + tab).css('display', 'block');
14
+ jQuery('.cmp-coming-soon-maintenance .comingsoon.' + tab).css('display', 'block');
15
+
16
+ jQuery('.cmp-coming-soon-maintenance .table-wrapper:not(.' + tab + ')').css('display', 'none');
17
+ jQuery('.cmp-coming-soon-maintenance .table-wrapper-css:not(.' + tab).css('display', 'none');
18
+ jQuery('.cmp-coming-soon-maintenance .comingsoon:not(.' + tab + ')').css('display', 'none');
19
+
20
+ if (tab == 'install') {
21
+ jQuery('.cmp-coming-soon-maintenance .submit').css('display', 'none');
22
+ jQuery('.cmp-coming-soon-maintenance #csoptions').attr('action', action);
23
+ } else {
24
+ jQuery('.cmp-coming-soon-maintenance .submit').css('display', 'block');
25
+ // change form action to display current tab after save
26
+ jQuery('.cmp-coming-soon-maintenance #csoptions').attr('action', action + '#' + tab);
27
+ }
28
+ };
29
+
30
+ if (tab != '') {
31
+ navtab(tab);
32
+ } else {
33
+ jQuery('.cmp-coming-soon-maintenance .table-wrapper-css').css('display', 'none');
34
+ }
35
+
36
+ window.onhashchange = function () {
37
+ tab = document.location.hash.substring(1);
38
+ navtab(tab);
39
+ };
40
+
41
+ jQuery('.cmp-coming-soon-maintenance .nav-tab').click(function (e) {
42
+ e.preventDefault();
43
+ tab = jQuery(this).data('tab');
44
+ document.location.hash = tab;
45
+ });
46
+
47
+ toggle_settings('page-whitelist');
48
+ toggle_settings('cmp-bypass');
49
+ toggle_settings('cmp-topbar-icon');
50
+ toggle_settings('countdown-toggle');
51
+ toggle_settings('mode-change-toggle');
52
+ toggle_settings('cmp-wpautop');
53
+ toggle_settings('cmp-cookienotice');
54
+ cmp_repeat_fields('head_scripts');
55
+ cmp_repeat_fields('footer_scripts');
56
+
57
+ // upload json file button
58
+ jQuery('#cmp-import-json').on('change', function (e) {
59
+ // change label
60
+ jQuery('.import-json-label').attr('data-default', e.target.files[0].name);
61
+
62
+ var reader = new FileReader();
63
+ reader.onload = function (e) {
64
+ jQuery('#cmp-import-input').val(e.target.result);
65
+ };
66
+
67
+ reader.readAsText(e.target.files[0]);
68
+
69
+ // enable import button
70
+ $('#cmp-import-settings').attr('disabled', false);
71
+ jQuery('.import-json-label').removeClass('import-fail');
72
+
73
+ importing = false;
74
+ });
75
+
76
+ // export button ajax call
77
+ jQuery('#cmp-export-json').click(function (e) {
78
+ e.preventDefault();
79
+
80
+ var data = {
81
+ action: 'cmp_ajax_export_settings',
82
+ security: jQuery(this).data('security'),
83
+ };
84
+
85
+ jQuery.post(ajaxurl, data, function (response) {
86
+ // if (response) {
87
+ jQuery('<iframe />')
88
+ .attr('src', ajaxurl + '?action=cmp_ajax_export_settings&security=' + jQuery('#cmp-export-json').data('security'))
89
+ .appendTo('body')
90
+ .hide();
91
+ // }
92
+ });
93
+ });
94
+
95
+ // import button ajax call
96
+ jQuery('#cmp-import-settings').click(function (e) {
97
+ e.preventDefault();
98
+
99
+ if (importing === true) {
100
+ return false;
101
+ }
102
+
103
+ var json = jQuery('#cmp-import-input').val();
104
+ var $label = jQuery('.import-json-label');
105
+
106
+ // remove settings keys with media if no media import
107
+ if (!jQuery('#cmp-import-media').is(':checked')) {
108
+ var settings = new Array('niteoCS_banner_id', 'niteoCS_logo_id', 'niteoCS_seo_img_id');
109
+
110
+ json = jQuery.parseJSON(json);
111
+
112
+ json.map(function (value, index) {
113
+ for (var key in value) {
114
+ if (settings.indexOf(key) > -1) {
115
+ json.splice(index, 1);
116
+ }
117
+ }
118
+ });
119
+
120
+ json = JSON.stringify(json);
121
+ }
122
+
123
+ var data = {
124
+ action: 'cmp_ajax_import_settings',
125
+ security: jQuery(this).data('security'),
126
+ json: json,
127
+ };
128
+
129
+ importing = true;
130
+
131
+ var ajaxTime = new Date().getTime();
132
+
133
+ // change label
134
+ $label.html('<i class="fa fa-cog fa-spin" aria-hidden="true"></i> importing..');
135
+ $label.attr('data-default', '');
136
+
137
+ jQuery.post(ajaxurl, data, function (response) {
138
+ if (response) {
139
+ var totalTime = new Date().getTime() - ajaxTime;
140
+ var result = jQuery.parseJSON(response);
141
+
142
+ if (totalTime > 2000) {
143
+ if (result.result == 'success') {
144
+ $label.addClass('import-success');
145
+ } else {
146
+ $label.addClass('import-fail');
147
+ }
148
+
149
+ $label.html('');
150
+ $label.attr('data-default', result.message);
151
+ } else {
152
+ setTimeout(function () {
153
+ if (result.result == 'success') {
154
+ $label.addClass('import-success');
155
+ } else {
156
+ $label.addClass('import-fail');
157
+ }
158
+
159
+ $label.html('');
160
+ $label.attr('data-default', result.message);
161
+ }, 2000 - totalTime);
162
+ }
163
+ }
164
+ });
165
+ });
166
+
167
+ function toggle_settings(classname) {
168
+ jQuery('.' + classname).change(function () {
169
+ var value = jQuery('.' + classname + ':checked').val();
170
+ value = jQuery.isNumeric(value) ? 'x' + value : value;
171
+ value = value === undefined ? 'x' + 0 : value;
172
+
173
+ jQuery('.' + classname + '-switch.' + value).css('display', 'block');
174
+ jQuery('.' + classname + '-switch:not(.' + value + ')').css('display', 'none');
175
+ });
176
+
177
+ jQuery('.' + classname)
178
+ .first()
179
+ .trigger('change');
180
+ }
181
+
182
+ jQuery('.cmp-whitelist-select, .cmp-blacklist, .cmp-user_roles').select2({
183
+ width: 'calc(100% - 1em)',
184
+ placeholder: 'Click to select..',
185
+ });
186
+
187
+ jQuery('select[name="niteoCS_topbar_version"]').select2({
188
+ width: 'calc(100% - 1em)',
189
+ minimumResultsForSearch: -1,
190
+ });
191
+
192
+ function copyTextToClipboard(text) {
193
+ var textArea = document.createElement('textarea');
194
+ textArea.style.position = 'fixed';
195
+ textArea.style.top = 0;
196
+ textArea.style.left = 0;
197
+ textArea.style.width = '2em';
198
+ textArea.style.height = '2em';
199
+ textArea.style.padding = 0;
200
+ textArea.style.border = 'none';
201
+ textArea.style.outline = 'none';
202
+ textArea.style.boxShadow = 'none';
203
+ textArea.style.background = 'transparent';
204
+ textArea.value = text;
205
+
206
+ document.body.appendChild(textArea);
207
+ textArea.focus();
208
+ textArea.select();
209
+
210
+ try {
211
+ var successful = document.execCommand('copy');
212
+ var msg = successful ? 'successful' : 'unsuccessful';
213
+ console.log('Copying text command was ' + msg);
214
+ } catch (err) {
215
+ console.log('Oops, unable to copy');
216
+ }
217
+
218
+ document.body.removeChild(textArea);
219
+ }
220
+
221
+ jQuery('#copy-bypass').click(function (e) {
222
+ e.preventDefault();
223
+ copyTextToClipboard(jQuery('#bypass-code').html());
224
+ });
225
+
226
+ function cmp_repeat_fields(field_id) {
227
+ jQuery('#add-' + field_id).click(function (e) {
228
+ e.preventDefault();
229
+ var $wrapper = jQuery('#wrapper-' + field_id);
230
+ var $target = jQuery('#wrapper-' + field_id + ' .target-repeater-fields');
231
+ var $fields = $wrapper.find('.source-repeater-fields').children().clone();
232
+ $($fields[0]).val('');
233
+ $($target).append($fields);
234
+ });
235
+
236
+ cmp_delete_field(field_id);
237
+ }
238
+
239
+ function cmp_delete_field(field_id) {
240
+ jQuery('#wrapper-' + field_id + ' .target-repeater-fields').on('click', '.delete-' + field_id, function (e) {
241
+ e.preventDefault();
242
+ $(this).prev().remove();
243
+ $(this).remove();
244
+ });
245
+
246
+ jQuery('#wrapper-' + field_id + ' .source-repeater-fields').on('click', '.delete-' + field_id, function (e) {
247
+ e.preventDefault();
248
+ $(this).prev().val('');
249
+ });
250
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  });
js/settings.js CHANGED
@@ -1,1413 +1,993 @@
1
  jQuery(document).ready(function ($) {
2
- var tab = document.location.hash.substring(1);
3
- var action = jQuery("#csoptions").attr("action");
4
- var settings = jQuery(
5
- "#csoptions fieldset:not(.skip-preview-validation *)"
6
- ).serialize();
7
-
8
- // ini custom css textarea to codeEditor
9
- if (wp.codeEditor && jQuery('#niteoCS_custom_css').length) {
10
- wp.codeEditor.initialize("niteoCS_custom_css");
11
- }
12
-
13
- // function to tab navigation
14
- navtab = function (tab) {
15
- jQuery(
16
- ".cmp-coming-soon-maintenance .nav-tab-wrapper .nav-tab"
17
- ).removeClass("nav-tab-active");
18
- jQuery(".nav-tab-wrapper ." + tab).addClass("nav-tab-active");
19
-
20
- jQuery(".cmp-coming-soon-maintenance .table-wrapper." + tab).css(
21
- "display",
22
- "block"
23
- );
24
- jQuery(".cmp-coming-soon-maintenance .table-wrapper-css." + tab).css(
25
- "display",
26
- "block"
27
- );
28
- jQuery(".cmp-coming-soon-maintenance .comingsoon." + tab).css(
29
- "display",
30
- "block"
31
- );
32
-
33
- jQuery(".cmp-coming-soon-maintenance .table-wrapper:not(." + tab + ")").css(
34
- "display",
35
- "none"
36
- );
37
- jQuery(".cmp-coming-soon-maintenance .table-wrapper-css:not(." + tab).css(
38
- "display",
39
- "none"
40
- );
41
- jQuery(".cmp-coming-soon-maintenance .comingsoon:not(." + tab + ")").css(
42
- "display",
43
- "none"
44
- );
45
-
46
- if (tab == "install") {
47
- jQuery(".cmp-coming-soon-maintenance .submit").css("display", "none");
48
- jQuery(".cmp-coming-soon-maintenance #csoptions").attr("action", action);
49
- } else {
50
- jQuery(".cmp-coming-soon-maintenance .submit").css("display", "block");
51
- // change form action to display current tab after save
52
- jQuery(".cmp-coming-soon-maintenance #csoptions").attr(
53
- "action",
54
- action + "#" + tab
55
- );
56
- }
57
- };
58
-
59
- if (tab != "") {
60
- navtab(tab);
61
- } else {
62
- jQuery(".cmp-coming-soon-maintenance .table-wrapper-css").css(
63
- "display",
64
- "none"
65
- );
66
- }
67
-
68
- window.onhashchange = function () {
69
- tab = document.location.hash.substring(1);
70
- navtab(tab);
71
- };
72
-
73
-
74
- jQuery(".cmp-coming-soon-maintenance .nav-tab:not(.theme-preview):not(.advanced)").click(function (e) {
75
- e.preventDefault();
76
- tab = jQuery(this).data("tab");
77
- document.location.hash = tab;
78
- });
79
-
80
- // update range inputs on change
81
- update_range(".cmp-coming-soon-maintenance .blur-range", "span", "html");
82
- update_range(
83
- ".cmp-coming-soon-maintenance .background-overlay-opacity",
84
- "span",
85
- "html"
86
- );
87
- update_range("#logo_size_slider", "#niteoCS_logo_size", "val");
88
- update_range("#niteoCS_logo_size", "#logo_size_slider", "val");
89
-
90
- // create media upload buttons
91
- // selector, multipe, type, element to render
92
- media_upload_button("logo", false, "image", "img");
93
- media_upload_button("favicon", false, "image", "img");
94
- media_upload_button("seo_img", false, "image", "img");
95
- media_upload_button("images", true, "image", "img");
96
- media_upload_button("mobile-images", true, "image", "img");
97
- media_upload_button("pattern", false, "image", "background");
98
- media_upload_button("video-thumb", false, "image", "img");
99
- media_upload_button("video-local", false, "video", "video");
100
- media_upload_button("subs-img", false, "image", "img");
101
-
102
- // show / hide settings
103
- toggle_settings("analytics");
104
- toggle_settings("contact-form");
105
- toggle_settings("subscribe");
106
- toggle_settings("background-effect");
107
- toggle_settings("special-effect");
108
- toggle_settings("cmp-logo");
109
- toggle_settings("background-type");
110
- toggle_settings("counter");
111
- toggle_settings("progress-bar");
112
- toggle_settings("overlay-text");
113
- toggle_settings("cmp-logo-size");
114
- toggle_settings("recaptcha-toggle");
115
- toggle_settings("login-icon");
116
- toggle_settings("custom-mobile-imgs");
117
- toggle_settings("lang-switcher");
118
-
119
- toggle_select("counter-action");
120
- toggle_select("subscribe-method");
121
- toggle_select("background-overlay");
122
- toggle_select("banner-video-source");
123
- toggle_select("progress-bar-type");
124
-
125
- // change all selects to select2
126
- jQuery(
127
- ".cmp-coming-soon-maintenance select:not(.headings-google-font):not(.content-google-font )"
128
- ).select2({
129
- width: "100%",
130
- minimumResultsForSearch: -1,
131
- placeholder: "Click to select.."
132
- });
133
-
134
- jQuery(".cmp-coming-soon-maintenance #cmp-status").click(function () {
135
- jQuery(".cmp-coming-soon-maintenance .cmp-status input[type=radio]").prop(
136
- "disabled",
137
- function (_, val) {
138
- return !val;
139
- }
140
- );
141
- jQuery("#cmp-toggle-adminbar").toggleClass("status-1");
142
- jQuery('.cmp-status-pages').fadeToggle();
143
- });
144
-
145
- jQuery('.cmp-status-pages input[type=radio]').change(function () {
146
- jQuery('.cmp-status-pages input[type=radio]').parent().removeClass('active');
147
- jQuery(this).parent().addClass('active');
148
-
149
- });
150
-
151
- cmp_status_inputs();
152
-
153
- function cmp_status_inputs() {
154
- // Make clickable status radio buttons
155
- jQuery(
156
- ".cmp-coming-soon-maintenance .cmp-status.switch:not(.disabled)"
157
- ).click(function () {
158
- if (
159
- jQuery(".cmp-coming-soon-maintenance #cmp-status").prop("checked") ==
160
- false
161
- ) {
162
- return;
163
- }
164
- var $children = jQuery(this).children("input");
165
- $children.prop("checked", true);
166
- jQuery(".cmp-coming-soon-maintenance .cmp-status.switch").removeClass(
167
- "active"
168
- );
169
- jQuery(this).addClass("active");
170
-
171
- $children.trigger("change");
172
-
173
- if ($children.val() == "3") {
174
- jQuery(".cmp-coming-soon-maintenance .redirect-inputs").fadeIn("fast");
175
- } else {
176
- jQuery(".cmp-coming-soon-maintenance .redirect-inputs").fadeOut("fast");
177
- }
178
- });
179
- }
180
-
181
- // expandable tabs
182
- jQuery(".cmp-coming-soon-maintenance .table-wrapper h3").click(function () {
183
- jQuery(this)
184
- .parent()
185
- .toggleClass("closed");
186
- });
187
-
188
- // test unsplash image
189
- jQuery(".cmp-coming-soon-maintenance #test-unsplash").click(function (e) {
190
- e.preventDefault();
191
-
192
- var media_wrapper = jQuery(".cmp-coming-soon-maintenance #unsplash-media"),
193
- unsplash_feed = jQuery(
194
- '.cmp-coming-soon-maintenance .unsplash_banner select[name^="unsplash_feed"] option:selected'
195
- ).val(),
196
- unsp_url = "",
197
- feat = "",
198
- custom_str = "",
199
- security = jQuery(this).data("security");
200
-
201
- // return if not specific unsplash photo selected - throttling due too much requests
202
- if (unsplash_feed != 0) return;
203
-
204
- switch (unsplash_feed) {
205
- // specific photo
206
- case "0":
207
- unsp_url = jQuery(
208
- ".cmp-coming-soon-maintenance #niteoCS-unsplash-0"
209
- ).val();
210
- break;
211
-
212
- default:
213
- break;
214
- }
215
-
216
- if (unsplash_feed == 3 || unsp_url != "" || custom_str != "") {
217
- var params = {
218
- feed: unsplash_feed,
219
- url: unsp_url,
220
- feat: feat,
221
- custom_str: custom_str
222
- };
223
-
224
- jQuery(this).prop("disabled", true);
225
- jQuery(this).html(
226
- '<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span> loading..</span>'
227
- );
228
- // media_wrapper.html('');
229
-
230
- var data = {
231
- action: "niteo_unsplash",
232
- security: security,
233
- params: params
234
- };
235
-
236
- jQuery.post(ajaxurl, data, function (response) {
237
- var unsplash = JSON.parse(response);
238
-
239
- jQuery("#unsplash_img").remove();
240
-
241
- var loadingTimeout = setTimeout(function () {
242
- jQuery("#test-unsplash").prop("disabled", false);
243
- jQuery("#test-unsplash").text("Display Unsplash Photo");
244
- jQuery("#unsplash-media").html(
245
- '<p>It seems <a href="https://status.unsplash.com/" target="_blank">Unsplash API</a> is not responding. Please try again later.</p>'
246
- );
247
- }, 5000);
248
-
249
- if (unsplash.response == "200") {
250
- var unsplash = jQuery.parseJSON(unsplash.body);
251
-
252
- if (unsplash[0]) {
253
- var img = unsplash[0]["urls"]["raw"] + "?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&fit=max&w=588";
254
- var author = unsplash[0]["user"]["name"];
255
- var author_url = unsplash[0]["user"]["links"]["html"];
256
- var img_url = unsplash[0]["links"]["html"];
257
- var img_id = unsplash[0]["id"];
258
- } else {
259
- var img = unsplash["urls"]["raw"] + "?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&fit=max&w=588";
260
- var author = unsplash["user"]["name"];
261
- var author_url = unsplash["user"]["links"]["html"];
262
- var img_url = unsplash["links"]["html"];
263
- var img_id = unsplash["id"];
264
- }
265
-
266
- jQuery("<img />", { src: img, id: "unsplash_img" }).one(
267
- "load",
268
- function () {
269
- //Set something to run when it finishes loading
270
- jQuery(this).appendTo(media_wrapper);
271
- jQuery(this).fadeIn();
272
- jQuery("#test-unsplash").prop("disabled", false);
273
- jQuery("#test-unsplash").text("Display Unsplash Photo");
274
- jQuery(".unsplash-id").html(
275
- '<a href="' +
276
- img_url +
277
- '" target="_blank">Photo</a> (ID: ' +
278
- img_id +
279
- ') by <a href="' +
280
- author_url +
281
- '" target="_blank">' +
282
- author +
283
- '</a> / <a href="https://unsplash.com/" target="_blank">Unsplash</a>'
284
- );
285
- jQuery(".blur-range").trigger("input");
286
- clearTimeout(loadingTimeout);
287
- }
288
- );
289
- } else {
290
- jQuery(".cmp-coming-soon-maintenance #test-unsplash").prop(
291
- "disabled",
292
- false
293
- );
294
- jQuery(".cmp-coming-soon-maintenance #test-unsplash").text(
295
- "Display Unsplash Photo"
296
- );
297
- jQuery(".cmp-coming-soon-maintenance #unsplash-media").html(
298
- "<p>Error " +
299
- unsplash.response +
300
- ': <span style="text-transform:lowercase;">' +
301
- JSON.parse(unsplash.body).errors +
302
- "</span></p>"
303
- );
304
- clearTimeout(loadingTimeout);
305
- }
306
- });
307
- } else {
308
- jQuery(".cmp-coming-soon-maintenance #unsplash_img").remove();
309
- }
310
- });
311
-
312
- videoPreview = function () {
313
- // return of video background is not selected
314
- if (
315
- jQuery(".cmp-coming-soon-maintenance .background-type:checked").val() !=
316
- "5"
317
- ) {
318
- return;
319
- }
320
-
321
- var source = jQuery(".cmp-coming-soon-maintenance .banner-video-source").val();
322
-
323
- if (source == "youtube") {
324
- var youtubeURL = jQuery(
325
- ".cmp-coming-soon-maintenance #niteoCS-youtube-url"
326
- ).val();
327
-
328
- // get YT thumbnail and append it to wrapper
329
- if (youtubeURL != "") {
330
- var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
331
- var ytID = youtubeURL.match(regExp);
332
-
333
- if (ytID && ytID[7].length == 11) {
334
- jQuery(
335
- ".cmp-coming-soon-maintenance .video-yt-wrapper .video-yt-thumb-wrapper"
336
- ).html("");
337
- var ytThumb =
338
- "https://img.youtube.com/vi/" + ytID[7] + "/maxresdefault.jpg";
339
- jQuery(
340
- ".cmp-coming-soon-maintenance .video-yt-wrapper .video-yt-thumb-wrapper"
341
- ).append('<img src="' + ytThumb + '" alt=""/>');
342
- jQuery(".cmp-coming-soon-maintenance .blur-range").trigger("input");
343
- } else {
344
- jQuery(
345
- ".cmp-coming-soon-maintenance .video-yt-wrapper .video-yt-thumb-wrapper"
346
- ).html("");
347
- }
348
- }
349
- }
350
-
351
- // append local video
352
- if (source == "local") {
353
- var videoURL = jQuery("#niteoCS-video-local-id").data("url");
354
-
355
- if (videoURL != "") {
356
- jQuery(".cmp-coming-soon-maintenance .video-local-wrapper").html(
357
- '<video width="600" height="400" controls><source src="' +
358
- videoURL +
359
- '" type="video/mp4">Your browser does not support the video tag.</video>'
360
- );
361
- }
362
- }
363
- };
364
-
365
- // display video on load
366
- videoPreview();
367
-
368
- // display videos on background change to video type
369
- jQuery(".cmp-coming-soon-maintenance .background-type").on(
370
- "change",
371
- function () {
372
- videoPreview();
373
- }
374
- );
375
-
376
- // display YT video while inserting YT URL
377
- jQuery(".cmp-coming-soon-maintenance #niteoCS-youtube-url").on(
378
- "keyup",
379
- function () {
380
- videoPreview();
381
- }
382
- );
383
-
384
- jQuery(".cmp-coming-soon-maintenance .banner-video-source").on(
385
- "change",
386
- function () {
387
- videoPreview();
388
- }
389
- );
390
-
391
- // display selected unsplash feed
392
- var unsplashfeed = jQuery(
393
- '.unsplash_banner select[name^="unsplash_feed"] option:selected'
394
- ).val();
395
- jQuery(".unsplash-feed-" + unsplashfeed).css("display", "block");
396
-
397
- jQuery('.unsplash_banner select[name^="unsplash_feed"]').on(
398
- "change",
399
- function () {
400
- unsplashfeed = jQuery(
401
- '.unsplash_banner select[name^="unsplash_feed"] option:selected'
402
- ).val();
403
- jQuery(".unsplash-feed").css("display", "none");
404
- jQuery(".unsplash-feed-" + unsplashfeed).css("display", "block");
405
- jQuery("#test-unsplash").trigger("click");
406
- }
407
- );
408
-
409
- // load unsplash upon load if unsplash is selected
410
- if (jQuery("#csoptions .niteoCS_banner:checked").val() == 1) {
411
- jQuery("#test-unsplash").trigger("click");
412
- }
413
-
414
- // preview gradient on select change
415
- jQuery(".cmp-coming-soon-maintenance select.background-gradient")
416
- .on("change", function () {
417
- var gradient = jQuery(
418
- ".cmp-coming-soon-maintenance select.background-gradient option:selected"
419
- ).val();
420
-
421
- if (gradient == "custom") {
422
- jQuery(".cmp-coming-soon-maintenance .custom-gradient").css(
423
- "display",
424
- "block"
425
- );
426
- jQuery(".cmp-coming-soon-maintenance .gradient-preview").css({
427
- background:
428
- "-moz-linear-gradient(-45deg, " +
429
- jQuery("#niteoCS_gradient_one").val() +
430
- " 0%, " +
431
- jQuery("#niteoCS_gradient_two").val() +
432
- " 100%)",
433
- background:
434
- "-webkit-linear-gradient(-45deg, " +
435
- jQuery("#niteoCS_gradient_one").val() +
436
- " 0%, " +
437
- jQuery("#niteoCS_gradient_two").val() +
438
- " 100%)",
439
- background:
440
- "linear-gradient(135deg, " +
441
- jQuery("#niteoCS_gradient_one").val() +
442
- " 0%, " +
443
- jQuery("#niteoCS_gradient_two").val() +
444
- " 100%)"
445
- });
446
- } else {
447
- colors = gradient.split(":");
448
- jQuery(".cmp-coming-soon-maintenance .custom-gradient").css(
449
- "display",
450
- "none"
451
- );
452
- jQuery(".cmp-coming-soon-maintenance .gradient-preview").css({
453
- background:
454
- "-moz-linear-gradient(-45deg, " +
455
- colors[0] +
456
- " 0%, " +
457
- colors[1] +
458
- " 100%)",
459
- background:
460
- "-webkit-linear-gradient(-45deg, " +
461
- colors[0] +
462
- " 0%, " +
463
- colors[1] +
464
- " 100%)",
465
- background:
466
- "linear-gradient(135deg, " +
467
- colors[0] +
468
- " 0%, " +
469
- colors[1] +
470
- " 100%)"
471
- });
472
- }
473
- })
474
- .trigger("change");
475
-
476
- // banner background colorpicker
477
- jQuery(".cmp-coming-soon-maintenance #niteoCS_banner_color").wpColorPicker({
478
- change: function (event, ui) {
479
- jQuery(".color-preview").css("background-color", ui.color.toString());
480
- }
481
- });
482
-
483
- // banner gradient background colorpicker one
484
- jQuery(".cmp-coming-soon-maintenance #niteoCS_gradient_one").wpColorPicker({
485
- change: function (event, ui) {
486
- jQuery(".gradient-preview").css({
487
- background:
488
- "-moz-linear-gradient(-45deg, " +
489
- ui.color.toString() +
490
- " 0%, " +
491
- jQuery("#niteoCS_gradient_two").val() +
492
- " 100%)",
493
- background:
494
- "-webkit-linear-gradient(-45deg, " +
495
- ui.color.toString() +
496
- " 0%, " +
497
- jQuery("#niteoCS_gradient_two").val() +
498
- " 100%)",
499
- background:
500
- "linear-gradient(135deg, " +
501
- ui.color.toString() +
502
- " 0%, " +
503
- jQuery("#niteoCS_gradient_two").val() +
504
- " 100%)"
505
- });
506
- }
507
- });
508
-
509
- // banner gradient background colorpicker two
510
- jQuery(".cmp-coming-soon-maintenance #niteoCS_gradient_two").wpColorPicker({
511
- change: function (event, ui) {
512
- jQuery(".gradient-preview").css({
513
- background:
514
- "-moz-linear-gradient(-45deg, " +
515
- jQuery("#niteoCS_gradient_one").val() +
516
- " 0%, " +
517
- ui.color.toString() +
518
- " 100%)",
519
- background:
520
- "-webkit-linear-gradient(-45deg, " +
521
- jQuery("#niteoCS_gradient_one").val() +
522
- " 0%, " +
523
- ui.color.toString() +
524
- " 100%)",
525
- background:
526
- "linear-gradient(135deg, " +
527
- jQuery("#niteoCS_gradient_one").val() +
528
- " 0%, " +
529
- ui.color.toString() +
530
- " 100%)"
531
- });
532
- }
533
- });
534
-
535
- // OVERLAY COLOR
536
- jQuery(".cmp-coming-soon-maintenance #niteoCS_overlay_color").wpColorPicker({
537
- change: function (event, ui) {
538
- jQuery(".thumbnail-overlay").css("background", ui.color.toString());
539
- }
540
- });
541
-
542
- // get overlay color and apply it to Background thumbnails
543
- jQuery(".cmp-coming-soon-maintenance .thumbnail-overlay").css(
544
- "background",
545
- jQuery("#niteoCS_overlay_color").val()
546
- );
547
-
548
- // OVERLAY GRADIENT
549
- jQuery(".cmp-coming-soon-maintenance select.overlay-gradient").on(
550
- "change",
551
- function () {
552
- var overlay_gradient = jQuery(
553
- "select.overlay-gradient option:selected"
554
- ).val();
555
-
556
- if (overlay_gradient == "custom") {
557
- jQuery(".cmp-coming-soon-maintenance .custom-overlay-gradient").css(
558
- "display",
559
- "block"
560
- );
561
-
562
- var gradient_one = jQuery("#niteoCS_overlay_gradient_one").val();
563
- var gradient_two = jQuery("#niteoCS_overlay_gradient_two").val();
564
-
565
- jQuery(".cmp-coming-soon-maintenance .thumbnail-overlay").css({
566
- background:
567
- "-moz-linear-gradient(-45deg, " +
568
- gradient_one +
569
- " 0%, " +
570
- gradient_two +
571
- " 100%)",
572
- background:
573
- "-webkit-linear-gradient(-45deg, " +
574
- gradient_one +
575
- " 0%, " +
576
- gradient_two +
577
- " 100%)",
578
- background:
579
- "linear-gradient(135deg, " +
580
- gradient_one +
581
- " 0%, " +
582
- gradient_two +
583
- " 100%)"
584
- });
585
- } else {
586
- colors = overlay_gradient.split(":");
587
- jQuery(".cmp-coming-soon-maintenance .custom-overlay-gradient").css(
588
- "display",
589
- "none"
590
- );
591
- jQuery(".cmp-coming-soon-maintenance .thumbnail-overlay").css({
592
- background:
593
- "-moz-linear-gradient(-45deg, " +
594
- colors[0] +
595
- " 0%, " +
596
- colors[1] +
597
- " 100%)",
598
- background:
599
- "-webkit-linear-gradient(-45deg, " +
600
- colors[0] +
601
- " 0%, " +
602
- colors[1] +
603
- " 100%)",
604
- background:
605
- "linear-gradient(135deg, " +
606
- colors[0] +
607
- " 0%, " +
608
- colors[1] +
609
- " 100%)"
610
- });
611
- }
612
- }
613
- );
614
-
615
- // Overlay gradient colorpicker one
616
- jQuery("#niteoCS_overlay_gradient_one").wpColorPicker({
617
- change: function (event, ui) {
618
- jQuery(".thumbnail-overlay").css({
619
- background:
620
- "-moz-linear-gradient(-45deg, " +
621
- ui.color.toString() +
622
- " 0%, " +
623
- jQuery("#niteoCS_overlay_gradient_two").val() +
624
- " 100%)",
625
- background:
626
- "-webkit-linear-gradient(-45deg, " +
627
- ui.color.toString() +
628
- " 0%, " +
629
- jQuery("#niteoCS_overlay_gradient_two").val() +
630
- " 100%)",
631
- background:
632
- "linear-gradient(135deg, " +
633
- ui.color.toString() +
634
- " 0%, " +
635
- jQuery("#niteoCS_overlay_gradient_two").val() +
636
- " 100%)"
637
- });
638
- }
639
- });
640
-
641
- // Overlay gradient colorpicker two
642
- jQuery("#niteoCS_overlay_gradient_two").wpColorPicker({
643
- change: function (event, ui) {
644
- jQuery(".thumbnail-overlay").css({
645
- background:
646
- "-moz-linear-gradient(-45deg, " +
647
- jQuery("#niteoCS_overlay_gradient_one").val() +
648
- " 0%, " +
649
- ui.color.toString() +
650
- " 100%)",
651
- background:
652
- "-webkit-linear-gradient(-45deg, " +
653
- jQuery("#niteoCS_overlay_gradient_one").val() +
654
- " 0%, " +
655
- ui.color.toString() +
656
- " 100%)",
657
- background:
658
- "linear-gradient(135deg, " +
659
- jQuery("#niteoCS_overlay_gradient_one").val() +
660
- " 0%, " +
661
- ui.color.toString() +
662
- " 100%)"
663
- });
664
- }
665
- });
666
-
667
- // OVERLAY OPACITY
668
- jQuery(".background-overlay-opacity")
669
- .on("input", function () {
670
- var value = jQuery(this).val();
671
- jQuery(".thumbnail-overlay").css("opacity", value);
672
- })
673
- .trigger("input");
674
-
675
- // OVERLAY SELECTION
676
- gradientIni(jQuery(".cmp-coming-soon-maintenance .background-overlay").val());
677
-
678
- jQuery(".cmp-coming-soon-maintenance .background-overlay").on(
679
- "change",
680
- function () {
681
- gradientIni(jQuery(this).val());
682
- }
683
- );
684
-
685
- function gradientIni(gradient_type) {
686
- switch (gradient_type) {
687
- case "solid-color":
688
- jQuery(".thumbnail-overlay").css(
689
- "background",
690
- jQuery("#niteoCS_overlay_color").val()
691
- );
692
- break;
693
-
694
- case "gradient":
695
- jQuery(".cmp-coming-soon-maintenance select.overlay-gradient").trigger(
696
- "change"
697
- );
698
- break;
699
-
700
- case "disabled":
701
- jQuery(".cmp-coming-soon-maintenance .thumbnail-overlay").css(
702
- "background",
703
- "none"
704
- );
705
- break;
706
-
707
- default:
708
- break;
709
- }
710
- }
711
-
712
- // BLUR PREVIEW
713
- jQuery(".cmp-coming-soon-maintenance .blur-range")
714
- .on("input", function () {
715
- var value = jQuery(this).val();
716
- jQuery(
717
- ".cmp-coming-soon-maintenance .background-thumb-wrapper img:not(.no-blur)"
718
- ).css("filter", "blur(" + value + "px)");
719
- })
720
- .trigger("input");
721
-
722
- // banner pattern on change image preview
723
- jQuery(
724
- '.cmp-coming-soon-maintenance select[name^="niteoCS_banner_pattern"]'
725
- ).on("change", function () {
726
- var pattern = jQuery(
727
- '.cmp-coming-soon-maintenance select[name^="niteoCS_banner_pattern"] option:selected'
728
- ).val();
729
-
730
- if (pattern != "custom") {
731
- var pattern_url = jQuery(this).data("url");
732
- jQuery(".cmp-coming-soon-maintenance #add-pattern").css(
733
- "display",
734
- "none"
735
- );
736
- jQuery(".cmp-coming-soon-maintenance .pattern-wrapper").css(
737
- "background-image",
738
- "url('" + pattern_url + pattern + ".png')"
739
- );
740
- } else {
741
- var pattern_url = jQuery(
742
- ".cmp-coming-soon-maintenance #niteoCS_banner_pattern_custom"
743
- ).val();
744
- jQuery(".cmp-coming-soon-maintenance #add-pattern").css(
745
- "display",
746
- "block"
747
- );
748
- jQuery(".cmp-coming-soon-maintenance .pattern-wrapper").css(
749
- "background-image",
750
- "url('" + pattern_url + "')"
751
- );
752
- }
753
- });
754
-
755
- // preview animation
756
- jQuery(".cmp-coming-soon-maintenance .heading-animation").on(
757
- "change",
758
- function () {
759
- heading_anim = jQuery(
760
- ".cmp-coming-soon-maintenance .heading-animation option:selected"
761
- ).val();
762
- jQuery(".cmp-coming-soon-maintenance #heading-example")
763
- .removeClass()
764
- .addClass("animated " + heading_anim);
765
- }
766
- );
767
-
768
- jQuery(".cmp-coming-soon-maintenance .content-animation").on(
769
- "change",
770
- function () {
771
- heading_anim = jQuery(
772
- ".cmp-coming-soon-maintenance .content-animation option:selected"
773
- ).val();
774
- jQuery(".cmp-coming-soon-maintenance #content-example")
775
- .removeClass()
776
- .addClass("animated " + heading_anim);
777
- }
778
- );
779
-
780
- // ----------------------- sortable social list -----------------------
781
- // function to update social list
782
- var update_social = function (name, key, val) {
783
- var socialmedia = jQuery(
784
- ".cmp-coming-soon-maintenance #niteoCS_socialmedia"
785
- ).attr("value");
786
- socialmedia = jQuery.parseJSON(socialmedia);
787
-
788
- jQuery.each(socialmedia, function (i, ele) {
789
- if (ele["name"] == name) {
790
- ele[key] = val;
791
- }
792
- });
793
-
794
- jQuery(".cmp-coming-soon-maintenance #niteoCS_socialmedia").attr(
795
- "value",
796
- JSON.stringify(socialmedia)
797
- );
798
- };
799
-
800
- // sortable UI - disabled on Mobile phones - input elements where not clickable...
801
- if (!/Mobi/.test(navigator.userAgent)) {
802
- var $sortableList = jQuery(".cmp-coming-soon-maintenance .social-inputs");
803
-
804
- var sortEventHandler = function (event, ui) {
805
- var inputs = $sortableList.find('input[type="text"]');
806
-
807
- var order = ui.item.index();
808
-
809
- inputs.each(function (i, ele) {
810
- var name = jQuery(ele).data("name");
811
- update_social(name, "order", i);
812
- });
813
- };
814
-
815
- $sortableList.sortable({
816
- stop: sortEventHandler
817
- });
818
-
819
- $sortableList.on("sortchange", sortEventHandler);
820
- }
821
-
822
- // social checkbox to enable/disable input
823
- (function ($) {
824
- jQuery.fn.toggleDisabled = function () {
825
- return this.each(function () {
826
- var $this = jQuery(this);
827
- var active;
828
- var name = $this.data("name");
829
- if ($this.attr("disabled")) {
830
- $this.prop("disabled", false);
831
- active = "1";
832
- } else {
833
- $this.prop("disabled", true);
834
- active = "0";
835
- }
836
- update_social(name, "active", active);
837
- });
838
- };
839
- })(jQuery);
840
-
841
- jQuery(
842
- '.cmp-coming-soon-maintenance .social-inputs input[type="text"]'
843
- ).focusout(function () {
844
- var name = jQuery(this).data("name");
845
- var socialurl = jQuery(this).val();
846
- update_social(name, "url", socialurl);
847
- });
848
-
849
- jQuery(
850
- '.cmp-coming-soon-maintenance .social-inputs input[type="checkbox"]'
851
- ).click(function (e) {
852
- var $this = jQuery(this).siblings('input[type="text"]');
853
- $this.toggleDisabled();
854
- });
855
-
856
- // social icons active/inactive
857
- jQuery(".cmp-coming-soon-maintenance .social-media i").click(function () {
858
- var name = jQuery(this).data("name");
859
- jQuery(this).toggleClass("active");
860
- jQuery(
861
- ".cmp-coming-soon-maintenance .social-inputs li." + name
862
- ).toggleClass("active");
863
- jQuery(
864
- ".cmp-coming-soon-maintenance .social-inputs li." + name + " input"
865
- ).trigger("change");
866
-
867
- if (jQuery(this).hasClass("active")) {
868
- update_social(name, "hidden", "0");
869
- } else {
870
- update_social(name, "hidden", "1");
871
- }
872
- // hide/show input labels
873
- if (jQuery(".cmp-coming-soon-maintenance .social-media i.active").length) {
874
- jQuery(".social-inputs .label").css("display", "block");
875
- } else {
876
- jQuery(".cmp-coming-soon-maintenance .social-inputs .label").css(
877
- "display",
878
- "none"
879
- );
880
- }
881
- });
882
-
883
- // hide/show input labels
884
- if (jQuery(".cmp-coming-soon-maintenance .social-media i.active").length) {
885
- jQuery(".cmp-coming-soon-maintenance .social-inputs .label").css(
886
- "display",
887
- "block"
888
- );
889
- }
890
-
891
-
892
- // theme update via admin notice
893
- jQuery(".cmp.update-theme").click(function (e) {
894
- e.preventDefault();
895
- var $this = jQuery(this),
896
- $parent = $this.parents(".notice"),
897
- security = $this.data("security"),
898
- slug = $this.data("slug"),
899
- themeName = $this.data("name"),
900
- remoteUrl = jQuery(this).data("remote_url");
901
- var update = {
902
- name: slug,
903
- tmp_name: "",
904
- url: remoteUrl + "?action=download&slug=" + slug
905
- };
906
-
907
- var data = {
908
- action: "cmp_theme_update_install",
909
- security: security,
910
- file: update
911
- };
912
-
913
- $parent
914
- .find(".message")
915
- .html(
916
- '<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span class="sr-only">Updating heme...</span><span> working hard on updating Theme...</span>'
917
- );
918
-
919
- jQuery.post(ajaxurl, data, function (response) {
920
- response = response.trim();
921
-
922
- if (response == "success") {
923
- setTimeout(function () {
924
- $parent.removeClass("notice-warning").addClass("notice-success");
925
- $parent
926
- .find(".message")
927
- .html(
928
- "<span> " +
929
- themeName +
930
- ' CMP theme was updated sucessfully! You can enjoy latest features now :) </span><i class="far fa-smile" aria-hidden="true"></i>'
931
- );
932
- }, 1500);
933
- } else {
934
- response = response.slice(0, -1);
935
- var error = jQuery("p", jQuery(response)).text();
936
- $parent.removeClass("notice-warning").addClass("notice-error");
937
- $parent
938
- .find(".message")
939
- .html(
940
- '<i class="far fa-frown" aria-hidden="true"></i><span> ' +
941
- error +
942
- "</span>"
943
- );
944
- }
945
- });
946
- });
947
-
948
- // theme update via theme button
949
- jQuery(".cmp-coming-soon-maintenance .theme-update.button").one(
950
- "click",
951
- function (e) {
952
- e.preventDefault();
953
- var $this = jQuery(this),
954
- $wrapper = $this.closest(".theme-wrapper"),
955
- security = $wrapper.data("security"),
956
- slug = $wrapper.data("slug"),
957
- remoteUrl = $wrapper.data("remote_url");
958
-
959
- var update = {
960
- name: slug,
961
- tmp_name: "",
962
- url: remoteUrl + "?action=download&slug=" + slug
963
- };
964
-
965
- var data = {
966
- action: "cmp_theme_update_install",
967
- security: security,
968
- file: update
969
- };
970
-
971
- $this.html(
972
- '<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span>Updating..</span>'
973
- );
974
-
975
- jQuery.post(ajaxurl, data, function (response) {
976
- if (response == "success") {
977
- setTimeout(function () {
978
- $this.html(
979
- '<i class="far fa-smile" aria-hidden="true"></i><span>Updated!</span>'
980
- );
981
- setTimeout(function () {
982
- $this.fadeOut();
983
- }, 1500);
984
- }, 1500);
985
- } else {
986
- response = response.slice(0, -1);
987
- $this.html(
988
- '<i class="far fa-frown" aria-hidden="true"></i><span>Update Failed!</span>'
989
- );
990
- }
991
- });
992
- }
993
- );
994
-
995
- // display theme details overlay
996
- jQuery(".cmp-coming-soon-maintenance .theme-details").click(function (e) {
997
- e.preventDefault();
998
- var $this = jQuery(this),
999
- $wrapper = $this.closest(".theme-wrapper"),
1000
- slug = $wrapper.data("slug"),
1001
- version = $wrapper.data("version"),
1002
- type = $wrapper.data("type"),
1003
- purchased = $wrapper.data("purchased"),
1004
- i = 0;
1005
-
1006
- var data = {
1007
- action: "niteo_themeinfo",
1008
- security: jQuery(".theme-wrapper").data("security"),
1009
- theme_slug: jQuery(this)
1010
- .parents(".theme-wrapper")
1011
- .data("slug")
1012
- };
1013
-
1014
- jQuery.post(ajaxurl, data, function (response) {
1015
- var buyButton = "";
1016
- var versionInfo = "";
1017
- var noticeHtml = "";
1018
- // parse JSON data to array
1019
- response = jQuery.parseJSON(response);
1020
-
1021
- if (response.result == "true") {
1022
- // overflow body hidden
1023
- jQuery("body").addClass("modal-open");
1024
-
1025
- // if installed display version info
1026
- if (purchased == "1") {
1027
- versionInfo = '<span class="theme-version">Installed version: ' + version + "</span>";
1028
- }
1029
-
1030
- // if premium and not installed, display buy button
1031
- if (purchased != "1" && type == "premium") {
1032
- var buyURL = $wrapper.find('.cmp-purchase-theme').attr("href");
1033
- var buyButton =
1034
- '<button type="button" class="theme-purchase button hide"><a href="' +
1035
- buyURL +
1036
- '" target="_blank"><i class="fas fa-cart-arrow-down" aria-hidden="true"></i>Get Theme</a></button>';
1037
- }
1038
-
1039
- // get screenshots
1040
- var screenshots = response.screenshots;
1041
- var arrows = "";
1042
- // if we have more screenshots, generate navigation arrows
1043
- if (Object.keys(screenshots).length > 1) {
1044
- arrows =
1045
- '<div class="screenshots-nav"><div class="left"><i class="fas fa-chevron-left" aria-hidden="true"></i></div><div class="right"><i class="fas fa-chevron-right" aria-hidden="true"></i></div></div>';
1046
- }
1047
-
1048
- // generate html to append to theme-overlay
1049
- var html = jQuery(
1050
- [
1051
- '<div class="theme-backdrop">',
1052
- ' <div class="theme-wrap">',
1053
- ' <div class="theme-header">',
1054
- ' <button class="close dashicons dashicons-no"><span class="screen-reader-text">Close details dialog</span></button>',
1055
- " </div>",
1056
- ' <div class="theme-about">',
1057
- ' <div class="theme-screenshots">',
1058
- ' <div class="screenshot" style="background-image:url(\'' +
1059
- screenshots["0"] +
1060
- "')\">" +
1061
- arrows +
1062
- "</div>",
1063
- " </div>",
1064
- ' <div class="theme-info">',
1065
- ' <h2 class="theme-name">' +
1066
- response["name"] +
1067
- versionInfo +
1068
- "</h2>",
1069
- ' <p class="theme-author">By <a href="' +
1070
- response["author_homepage"] +
1071
- '" target="_blank">' +
1072
- response["author"] +
1073
- "</a></p>",
1074
- noticeHtml,
1075
- buyButton,
1076
- ' <div class="theme-description">' +
1077
- response["description"] +
1078
- "</div>",
1079
- " </div>",
1080
- " </div>",
1081
- ' <div class="theme-actions">',
1082
- ' <a href="https://niteothemes.com/cmp-coming-soon-maintenance/?theme=' +
1083
- slug +
1084
- "&utm_source=cmp&utm_medium=referral&utm_campaign=" +
1085
- slug +
1086
- '" class="button cmp-preview" target="_blank" aria-label="Preview ' +
1087
- response["name"] +
1088
- '">Live Preview</a>',
1089
- " </div>",
1090
- " </div>",
1091
- "</div>"
1092
- ].join("\n")
1093
- );
1094
-
1095
- // append html to overlay
1096
- jQuery(".theme-overlay.cmp").append(html);
1097
-
1098
- // attach close button handler
1099
- jQuery(".theme-overlay.cmp .close").click(function (e) {
1100
- e.preventDefault();
1101
- // overflow body hidden
1102
- jQuery("body").removeClass("modal-open");
1103
- jQuery(".theme-overlay.cmp .theme-backdrop").fadeOut("fast");
1104
- });
1105
-
1106
- // attach arrows navigation handler
1107
- jQuery(".screenshots-nav .right").click(function () {
1108
- i++;
1109
-
1110
- if (i == Object.keys(screenshots).length) {
1111
- i = 0;
1112
- }
1113
-
1114
- if (i in screenshots) {
1115
- jQuery(".screenshot").css(
1116
- "background-image",
1117
- "url('" + screenshots[i] + "')"
1118
- );
1119
- }
1120
- });
1121
-
1122
- // attach arrows navigation handler
1123
- jQuery(".screenshots-nav .left").click(function () {
1124
- i--;
1125
-
1126
- if (i < 0) {
1127
- i = Object.keys(screenshots).length - 1;
1128
- }
1129
-
1130
- if (i in screenshots) {
1131
- jQuery(".screenshot").css(
1132
- "background-image",
1133
- "url('" + screenshots[i] + "')"
1134
- );
1135
- }
1136
- });
1137
- }
1138
- });
1139
- });
1140
-
1141
- function media_upload_button(name, multiple, type, element) {
1142
- // define var
1143
- var $container = jQuery("." + name + "-wrapper");
1144
- var $add_button = jQuery("#add-" + name);
1145
- var $delete_button = jQuery("#delete-" + name);
1146
- var image;
1147
- var imgID = "";
1148
- var title = name.replace("-", " ");
1149
- title = title[0].toUpperCase() + title.slice(1);
1150
-
1151
- if (jQuery("#niteoCS-" + name + "-id").val() != "") {
1152
- // Display Delete button
1153
- $delete_button.css("display", "block");
1154
- }
1155
-
1156
- $add_button.click(function (e) {
1157
- e.preventDefault();
1158
- // If the media frame already exists, reopen it.
1159
- if (media_uploader) {
1160
- media_uploader.open();
1161
- return;
1162
- }
1163
-
1164
- var media_uploader = wp
1165
- .media({
1166
- title: "Select " + title,
1167
- button: {
1168
- text: "Insert " + title
1169
- },
1170
- multiple: multiple, // Set this to true to allow multiple files to be selected
1171
- library: {
1172
- type: [type]
1173
- }
1174
- })
1175
- .on("select", function () {
1176
- // Get media attachment details from the frame state
1177
- var attachment = media_uploader
1178
- .state()
1179
- .get("selection")
1180
- .toJSON();
1181
-
1182
- if (attachment.length > 0) {
1183
- $container.find("img").remove();
1184
-
1185
- // remove and add gallery count class
1186
- $container.attr("class", name + "-wrapper custom-gallery");
1187
- $container.addClass("gallery-" + attachment.length);
1188
-
1189
- // get images ID, append thumbnail and store IDs in hidden input
1190
- jQuery(attachment).each(function (i) {
1191
- if (attachment[i].sizes && attachment[i].sizes.large) {
1192
- image = attachment[i].sizes.large.url;
1193
- } else {
1194
- image = attachment[i].url;
1195
- }
1196
-
1197
- // add image ID and url to comma-separated variable
1198
- var comma = i === 0 ? "" : ",";
1199
- imgID += comma + attachment[i].id;
1200
-
1201
- // Send the attachment URL to our custom image input field.
1202
- switch (element) {
1203
- case "video":
1204
- $container.append(
1205
- '<video width="600" height="400" controls><source src="' +
1206
- image +
1207
- '" type="video/mp4">Your browser does not support the video tag.</video>'
1208
- );
1209
- break;
1210
-
1211
- case "background":
1212
- $container.css("background-image", "url('" + image + "')");
1213
- break;
1214
-
1215
- case "img":
1216
- default:
1217
- // if gallery - more than one image, it must be a graphic background, attach the first image to big coontainer
1218
- if (attachment.length > 1 && i == 0 && jQuery("." + name + "-wrapper .big-thumb").length) {
1219
- jQuery("." + name + "-wrapper .big-thumb").append(
1220
- '<img src="' + image + '" alt=""/>'
1221
- );
1222
-
1223
- // if gallery - more than one image, it must be a graphic background, attach all others images to normal wrapper
1224
- } else if (attachment.length > 1 && i !== 0) {
1225
- $container.append(
1226
- '<img src="' + image + '" alt="" class="no-blur"/>'
1227
- );
1228
-
1229
- // if single image, and it is a background image, attach it to big container as well
1230
- } else if ($container.find(".big-thumb").length) {
1231
- jQuery("." + name + "-wrapper .big-thumb").append(
1232
- '<img src="' + image + '" alt=""/>'
1233
- );
1234
-
1235
- // all others images
1236
- } else {
1237
- $container.append('<img src="' + image + '" alt=""/>');
1238
- }
1239
-
1240
- jQuery(".blur-range").trigger("input");
1241
- break;
1242
- }
1243
- });
1244
-
1245
- // Display Delete button
1246
- $delete_button.css("display", "block");
1247
- }
1248
- // update hidden input with media id and trigger change
1249
- jQuery("#niteoCS-" + name + "-id")
1250
- .val(imgID)
1251
- .trigger("change");
1252
- })
1253
- .open();
1254
- });
1255
-
1256
- $delete_button.click(function (e) {
1257
- jQuery(this).css("display", "none");
1258
- $container.find("img").remove();
1259
- jQuery("#niteoCS-" + name + "-id").val("");
1260
- jQuery("#niteoCS-" + name + "-id").trigger("change");
1261
- });
1262
- }
1263
-
1264
- // Retrieve Mailchimp lists
1265
- jQuery(".cmp-coming-soon-maintenance #connect-mailchimp").click(function (e) {
1266
- e.preventDefault();
1267
-
1268
- var apikey = jQuery(
1269
- '.cmp-coming-soon-maintenance input[name="niteoCS_mailchimp_apikey"]'
1270
- ).val(),
1271
- security = jQuery(this).data("security"),
1272
- button = jQuery(this);
1273
-
1274
- if (apikey != "") {
1275
- var params = { apikey: apikey, security: security };
1276
-
1277
- jQuery(this).prop("disabled", true);
1278
-
1279
- jQuery(this).html(
1280
- '<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span> retrieving lists..</span>'
1281
- );
1282
-
1283
- var data = {
1284
- action: "cmp_mailchimp_list_ajax",
1285
- security: security,
1286
- params: params
1287
- };
1288
-
1289
- jQuery.post(ajaxurl, data, function (response) {
1290
- var lists = JSON.parse(response);
1291
-
1292
- if (lists.response == 200) {
1293
- jQuery("#niteoCS_mailchimp_list")
1294
- .empty()
1295
- .prop("disabled", false);
1296
- jQuery.each(lists.lists, function (i, val) {
1297
- jQuery("#niteoCS_mailchimp_list").append(
1298
- '<option value="' + val.id + '">' + val.name + "</option>"
1299
- );
1300
- });
1301
- } else {
1302
- jQuery("#niteoCS_mailchimp_list")
1303
- .empty()
1304
- .prop("disabled", true)
1305
- .html('<option value="error">' + lists.message + "</option>")
1306
- .trigger("change");
1307
- }
1308
-
1309
- button.html("Retrieve Lists");
1310
- button.prop("disabled", false);
1311
- }).fail(function () {
1312
- button.html("Retrieve Lists");
1313
- button.prop("disabled", false);
1314
- });
1315
- }
1316
- });
1317
-
1318
- function toggle_settings(classname) {
1319
- // Logo type inputs
1320
- jQuery(".cmp-coming-soon-maintenance ." + classname).change(function () {
1321
- var value = jQuery(
1322
- ".cmp-coming-soon-maintenance ." + classname + ":checked"
1323
- ).val();
1324
- value = jQuery.isNumeric(value) ? "x" + value : value;
1325
- value = value === undefined ? "off" : value;
1326
-
1327
- jQuery(
1328
- ".cmp-coming-soon-maintenance ." + classname + "-switch." + value
1329
- ).css("display", "block");
1330
- jQuery(
1331
- ".cmp-coming-soon-maintenance ." +
1332
- classname +
1333
- "-switch:not(." +
1334
- value +
1335
- ")"
1336
- ).css("display", "none");
1337
- });
1338
-
1339
- jQuery(".cmp-coming-soon-maintenance ." + classname)
1340
- .first()
1341
- .trigger("change");
1342
- }
1343
-
1344
- function toggle_select(classname) {
1345
- jQuery(".cmp-coming-soon-maintenance ." + classname).change(function () {
1346
- var value = jQuery("." + classname).val();
1347
- value = jQuery.isNumeric(value) ? "x" + value : value;
1348
-
1349
- jQuery(".cmp-coming-soon-maintenance ." + classname + "." + value).css(
1350
- "display",
1351
- "block"
1352
- );
1353
- jQuery(
1354
- ".cmp-coming-soon-maintenance ." + classname + ":not(." + value + ")"
1355
- ).css("display", "none");
1356
- });
1357
-
1358
- jQuery("." + classname)
1359
- .first()
1360
- .trigger("change");
1361
- }
1362
-
1363
- function update_range(selector, target, method) {
1364
- jQuery(selector).on("input", function () {
1365
- var value = jQuery(this).val();
1366
- // change label value
1367
- if (method === "html") {
1368
- jQuery(this)
1369
- .parent()
1370
- .find(target)
1371
- .html(value);
1372
- }
1373
-
1374
- if (method === "val") {
1375
- jQuery(this)
1376
- .parent()
1377
- .find(target)
1378
- .val(value);
1379
- }
1380
- });
1381
- }
1382
-
1383
- // delete overlay color from premium themes after update 2.8
1384
- jQuery(".cmp-coming-soon-maintenance .table-wrapper.theme-setup h4").each(
1385
- function () {
1386
- if (jQuery(this).html() == "Overlay Color") {
1387
- jQuery(this)
1388
- .parents("tr")
1389
- .remove();
1390
- return false;
1391
- }
1392
- }
1393
- );
1394
-
1395
- // warn users about unsaved changes for preview
1396
- jQuery(".nav-tab-wrapper").on("click", ".theme-preview", function (e) {
1397
- if (
1398
- jQuery("#csoptions fieldset:not(.skip-preview-validation *)").serialize() !=
1399
- settings
1400
- ) {
1401
- if (
1402
- !confirm(
1403
- "You have made changes that will not be visible in the preview until you save them. Please save changes first.\nContinue anyway?"
1404
- )
1405
- ) {
1406
- e.preventDefault();
1407
- return false;
1408
- }
1409
- }
1410
-
1411
- return true;
1412
- });
1413
  });
1
  jQuery(document).ready(function ($) {
2
+ var tab = document.location.hash.substring(1);
3
+ var action = jQuery('#csoptions').attr('action');
4
+ var settings = jQuery('#csoptions fieldset:not(.skip-preview-validation *)').serialize();
5
+
6
+ // ini custom css textarea to codeEditor
7
+ if (wp.codeEditor && jQuery('#niteoCS_custom_css').length) {
8
+ wp.codeEditor.initialize('niteoCS_custom_css');
9
+ }
10
+
11
+ // function to tab navigation
12
+ navtab = function (tab) {
13
+ jQuery('.cmp-coming-soon-maintenance .nav-tab-wrapper .nav-tab').removeClass('nav-tab-active');
14
+ jQuery('.nav-tab-wrapper .' + tab).addClass('nav-tab-active');
15
+
16
+ jQuery('.cmp-coming-soon-maintenance .table-wrapper.' + tab).css('display', 'block');
17
+ jQuery('.cmp-coming-soon-maintenance .table-wrapper-css.' + tab).css('display', 'block');
18
+ jQuery('.cmp-coming-soon-maintenance .comingsoon.' + tab).css('display', 'block');
19
+
20
+ jQuery('.cmp-coming-soon-maintenance .table-wrapper:not(.' + tab + ')').css('display', 'none');
21
+ jQuery('.cmp-coming-soon-maintenance .table-wrapper-css:not(.' + tab).css('display', 'none');
22
+ jQuery('.cmp-coming-soon-maintenance .comingsoon:not(.' + tab + ')').css('display', 'none');
23
+
24
+ if (tab == 'install') {
25
+ jQuery('.cmp-coming-soon-maintenance .submit').css('display', 'none');
26
+ jQuery('.cmp-coming-soon-maintenance #csoptions').attr('action', action);
27
+ } else {
28
+ jQuery('.cmp-coming-soon-maintenance .submit').css('display', 'block');
29
+ // change form action to display current tab after save
30
+ jQuery('.cmp-coming-soon-maintenance #csoptions').attr('action', action + '#' + tab);
31
+ }
32
+ };
33
+
34
+ if (tab != '') {
35
+ navtab(tab);
36
+ } else {
37
+ jQuery('.cmp-coming-soon-maintenance .table-wrapper-css').css('display', 'none');
38
+ }
39
+
40
+ window.onhashchange = function () {
41
+ tab = document.location.hash.substring(1);
42
+ navtab(tab);
43
+ };
44
+
45
+ jQuery('.cmp-coming-soon-maintenance .nav-tab:not(.theme-preview):not(.advanced)').click(function (e) {
46
+ e.preventDefault();
47
+ tab = jQuery(this).data('tab');
48
+ document.location.hash = tab;
49
+ });
50
+
51
+ // update range inputs on change
52
+ update_range('.cmp-coming-soon-maintenance .blur-range', 'span', 'html');
53
+ update_range('.cmp-coming-soon-maintenance .background-overlay-opacity', 'span', 'html');
54
+ update_range('#logo_size_slider', '#niteoCS_logo_size', 'val');
55
+ update_range('#niteoCS_logo_size', '#logo_size_slider', 'val');
56
+
57
+ // create media upload buttons
58
+ // selector, multipe, type, element to render
59
+ media_upload_button('logo', false, 'image', 'img');
60
+ media_upload_button('favicon', false, 'image', 'img');
61
+ media_upload_button('seo_img', false, 'image', 'img');
62
+ media_upload_button('images', true, 'image', 'img');
63
+ media_upload_button('mobile-images', true, 'image', 'img');
64
+ media_upload_button('pattern', false, 'image', 'background');
65
+ media_upload_button('video-thumb', false, 'image', 'img');
66
+ media_upload_button('video-local', false, 'video', 'video');
67
+ media_upload_button('subs-img', false, 'image', 'img');
68
+ media_upload_button('avatar', false, 'image', 'img');
69
+ media_upload_button('gallery', true, 'image', 'img');
70
+
71
+ // show / hide settings
72
+ toggle_settings('analytics');
73
+ toggle_settings('contact-form');
74
+ toggle_settings('subscribe');
75
+ toggle_settings('background-effect');
76
+ toggle_settings('special-effect');
77
+ toggle_settings('cmp-logo');
78
+ toggle_settings('background-type');
79
+ toggle_settings('counter');
80
+ toggle_settings('progress-bar');
81
+ toggle_settings('overlay-text');
82
+ toggle_settings('cmp-logo-size');
83
+ toggle_settings('recaptcha-toggle');
84
+ toggle_settings('login-icon');
85
+ toggle_settings('custom-mobile-imgs');
86
+ toggle_settings('lang-switcher');
87
+
88
+ toggle_select('counter-action');
89
+ toggle_select('subscribe-method');
90
+ toggle_select('background-overlay');
91
+ toggle_select('banner-video-source');
92
+ toggle_select('progress-bar-type');
93
+
94
+ // change all selects to select2
95
+ jQuery('.cmp-coming-soon-maintenance select:not(.headings-google-font):not(.content-google-font )').select2({
96
+ width: '100%',
97
+ minimumResultsForSearch: -1,
98
+ placeholder: 'Click to select..',
99
+ });
100
+
101
+ jQuery('.cmp-coming-soon-maintenance #cmp-status').click(function () {
102
+ jQuery('.cmp-coming-soon-maintenance .cmp-status input[type=radio]').prop('disabled', function (_, val) {
103
+ return !val;
104
+ });
105
+ jQuery('#cmp-toggle-adminbar').toggleClass('status-1');
106
+ jQuery('.cmp-status-pages').fadeToggle();
107
+ });
108
+
109
+ jQuery('.cmp-status-pages input[type=radio]').change(function () {
110
+ jQuery('.cmp-status-pages input[type=radio]').parent().removeClass('active');
111
+ jQuery(this).parent().addClass('active');
112
+ });
113
+
114
+ cmp_status_inputs();
115
+
116
+ function cmp_status_inputs() {
117
+ // Make clickable status radio buttons
118
+ jQuery('.cmp-coming-soon-maintenance .cmp-status.switch:not(.disabled)').click(function () {
119
+ if (jQuery('.cmp-coming-soon-maintenance #cmp-status').prop('checked') == false) {
120
+ return;
121
+ }
122
+ var $children = jQuery(this).children('input');
123
+ $children.prop('checked', true);
124
+ jQuery('.cmp-coming-soon-maintenance .cmp-status.switch').removeClass('active');
125
+ jQuery(this).addClass('active');
126
+
127
+ $children.trigger('change');
128
+
129
+ if ($children.val() == '3') {
130
+ jQuery('.cmp-coming-soon-maintenance .redirect-inputs').fadeIn('fast');
131
+ } else {
132
+ jQuery('.cmp-coming-soon-maintenance .redirect-inputs').fadeOut('fast');
133
+ }
134
+ });
135
+ }
136
+
137
+ // expandable tabs
138
+ jQuery('.cmp-coming-soon-maintenance .table-wrapper h3').click(function () {
139
+ jQuery(this).parent().toggleClass('closed');
140
+ });
141
+
142
+ // test unsplash image
143
+ jQuery('.cmp-coming-soon-maintenance #test-unsplash').click(function (e) {
144
+ e.preventDefault();
145
+
146
+ var media_wrapper = jQuery('.cmp-coming-soon-maintenance #unsplash-media'),
147
+ unsplash_feed = jQuery('.cmp-coming-soon-maintenance .unsplash_banner select[name^="unsplash_feed"] option:selected').val(),
148
+ unsp_url = '',
149
+ feat = '',
150
+ custom_str = '',
151
+ security = jQuery(this).data('security');
152
+
153
+ // return if not specific unsplash photo selected - throttling due too much requests
154
+ if (unsplash_feed != 0) return;
155
+
156
+ switch (unsplash_feed) {
157
+ // specific photo
158
+ case '0':
159
+ unsp_url = jQuery('.cmp-coming-soon-maintenance #niteoCS-unsplash-0').val();
160
+ break;
161
+
162
+ default:
163
+ break;
164
+ }
165
+
166
+ if (unsplash_feed == 3 || unsp_url != '' || custom_str != '') {
167
+ var params = {
168
+ feed: unsplash_feed,
169
+ url: unsp_url,
170
+ feat: feat,
171
+ custom_str: custom_str,
172
+ };
173
+
174
+ jQuery(this).prop('disabled', true);
175
+ jQuery(this).html('<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span> loading..</span>');
176
+ // media_wrapper.html('');
177
+
178
+ var data = {
179
+ action: 'niteo_unsplash',
180
+ security: security,
181
+ params: params,
182
+ };
183
+
184
+ jQuery.post(ajaxurl, data, function (response) {
185
+ var unsplash = JSON.parse(response);
186
+
187
+ jQuery('#unsplash_img').remove();
188
+
189
+ var loadingTimeout = setTimeout(function () {
190
+ jQuery('#test-unsplash').prop('disabled', false);
191
+ jQuery('#test-unsplash').text('Display Unsplash Photo');
192
+ jQuery('#unsplash-media').html('<p>It seems <a href="https://status.unsplash.com/" target="_blank">Unsplash API</a> is not responding. Please try again later.</p>');
193
+ }, 5000);
194
+
195
+ if (unsplash.response == '200') {
196
+ var unsplash = jQuery.parseJSON(unsplash.body);
197
+
198
+ if (unsplash[0]) {
199
+ var img = unsplash[0]['urls']['raw'] + '?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&fit=max&w=588';
200
+ var author = unsplash[0]['user']['name'];
201
+ var author_url = unsplash[0]['user']['links']['html'];
202
+ var img_url = unsplash[0]['links']['html'];
203
+ var img_id = unsplash[0]['id'];
204
+ } else {
205
+ var img = unsplash['urls']['raw'] + '?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&fit=max&w=588';
206
+ var author = unsplash['user']['name'];
207
+ var author_url = unsplash['user']['links']['html'];
208
+ var img_url = unsplash['links']['html'];
209
+ var img_id = unsplash['id'];
210
+ }
211
+
212
+ jQuery('<img />', { src: img, id: 'unsplash_img' }).one('load', function () {
213
+ //Set something to run when it finishes loading
214
+ jQuery(this).appendTo(media_wrapper);
215
+ jQuery(this).fadeIn();
216
+ jQuery('#test-unsplash').prop('disabled', false);
217
+ jQuery('#test-unsplash').text('Display Unsplash Photo');
218
+ jQuery('.unsplash-id').html('<a href="' + img_url + '" target="_blank">Photo</a> (ID: ' + img_id + ') by <a href="' + author_url + '" target="_blank">' + author + '</a> / <a href="https://unsplash.com/" target="_blank">Unsplash</a>');
219
+ jQuery('.blur-range').trigger('input');
220
+ clearTimeout(loadingTimeout);
221
+ });
222
+ } else {
223
+ jQuery('.cmp-coming-soon-maintenance #test-unsplash').prop('disabled', false);
224
+ jQuery('.cmp-coming-soon-maintenance #test-unsplash').text('Display Unsplash Photo');
225
+ jQuery('.cmp-coming-soon-maintenance #unsplash-media').html('<p>Error ' + unsplash.response + ': <span style="text-transform:lowercase;">' + JSON.parse(unsplash.body).errors + '</span></p>');
226
+ clearTimeout(loadingTimeout);
227
+ }
228
+ });
229
+ } else {
230
+ jQuery('.cmp-coming-soon-maintenance #unsplash_img').remove();
231
+ }
232
+ });
233
+
234
+ videoPreview = function () {
235
+ // return of video background is not selected
236
+ if (jQuery('.cmp-coming-soon-maintenance .background-type:checked').val() != '5') {
237
+ return;
238
+ }
239
+
240
+ var source = jQuery('.cmp-coming-soon-maintenance .banner-video-source').val();
241
+
242
+ if (source == 'youtube') {
243
+ var youtubeURL = jQuery('.cmp-coming-soon-maintenance #niteoCS-youtube-url').val();
244
+
245
+ // get YT thumbnail and append it to wrapper
246
+ if (youtubeURL != '') {
247
+ var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
248
+ var ytID = youtubeURL.match(regExp);
249
+
250
+ if (ytID && ytID[7].length == 11) {
251
+ jQuery('.cmp-coming-soon-maintenance .video-yt-wrapper .video-yt-thumb-wrapper').html('');
252
+ var ytThumb = 'https://img.youtube.com/vi/' + ytID[7] + '/maxresdefault.jpg';
253
+ jQuery('.cmp-coming-soon-maintenance .video-yt-wrapper .video-yt-thumb-wrapper').append('<img src="' + ytThumb + '" alt=""/>');
254
+ jQuery('.cmp-coming-soon-maintenance .blur-range').trigger('input');
255
+ } else {
256
+ jQuery('.cmp-coming-soon-maintenance .video-yt-wrapper .video-yt-thumb-wrapper').html('');
257
+ }
258
+ }
259
+ }
260
+
261
+ // append local video
262
+ if (source == 'local') {
263
+ var videoURL = jQuery('#niteoCS-video-local-id').data('url');
264
+
265
+ if (videoURL != '') {
266
+ jQuery('.cmp-coming-soon-maintenance .video-local-wrapper').html('<video width="600" height="400" controls><source src="' + videoURL + '" type="video/mp4">Your browser does not support the video tag.</video>');
267
+ }
268
+ }
269
+ };
270
+
271
+ // display video on load
272
+ videoPreview();
273
+
274
+ // display videos on background change to video type
275
+ jQuery('.cmp-coming-soon-maintenance .background-type').on('change', function () {
276
+ videoPreview();
277
+ });
278
+
279
+ // display YT video while inserting YT URL
280
+ jQuery('.cmp-coming-soon-maintenance #niteoCS-youtube-url').on('keyup', function () {
281
+ videoPreview();
282
+ });
283
+
284
+ jQuery('.cmp-coming-soon-maintenance .banner-video-source').on('change', function () {
285
+ videoPreview();
286
+ });
287
+
288
+ // display selected unsplash feed
289
+ var unsplashfeed = jQuery('.unsplash_banner select[name^="unsplash_feed"] option:selected').val();
290
+ jQuery('.unsplash-feed-' + unsplashfeed).css('display', 'block');
291
+
292
+ jQuery('.unsplash_banner select[name^="unsplash_feed"]').on('change', function () {
293
+ unsplashfeed = jQuery('.unsplash_banner select[name^="unsplash_feed"] option:selected').val();
294
+ jQuery('.unsplash-feed').css('display', 'none');
295
+ jQuery('.unsplash-feed-' + unsplashfeed).css('display', 'block');
296
+ jQuery('#test-unsplash').trigger('click');
297
+ });
298
+
299
+ // load unsplash upon load if unsplash is selected
300
+ if (jQuery('#csoptions .niteoCS_banner:checked').val() == 1) {
301
+ jQuery('#test-unsplash').trigger('click');
302
+ }
303
+
304
+ // preview gradient on select change
305
+ jQuery('.cmp-coming-soon-maintenance select.background-gradient')
306
+ .on('change', function () {
307
+ var gradient = jQuery('.cmp-coming-soon-maintenance select.background-gradient option:selected').val();
308
+
309
+ if (gradient == 'custom') {
310
+ jQuery('.cmp-coming-soon-maintenance .custom-gradient').css('display', 'block');
311
+ jQuery('.cmp-coming-soon-maintenance .gradient-preview').css({
312
+ background: '-moz-linear-gradient(-45deg, ' + jQuery('#niteoCS_gradient_one').val() + ' 0%, ' + jQuery('#niteoCS_gradient_two').val() + ' 100%)',
313
+ background: '-webkit-linear-gradient(-45deg, ' + jQuery('#niteoCS_gradient_one').val() + ' 0%, ' + jQuery('#niteoCS_gradient_two').val() + ' 100%)',
314
+ background: 'linear-gradient(135deg, ' + jQuery('#niteoCS_gradient_one').val() + ' 0%, ' + jQuery('#niteoCS_gradient_two').val() + ' 100%)',
315
+ });
316
+ } else {
317
+ colors = gradient.split(':');
318
+ jQuery('.cmp-coming-soon-maintenance .custom-gradient').css('display', 'none');
319
+ jQuery('.cmp-coming-soon-maintenance .gradient-preview').css({
320
+ background: '-moz-linear-gradient(-45deg, ' + colors[0] + ' 0%, ' + colors[1] + ' 100%)',
321
+ background: '-webkit-linear-gradient(-45deg, ' + colors[0] + ' 0%, ' + colors[1] + ' 100%)',
322
+ background: 'linear-gradient(135deg, ' + colors[0] + ' 0%, ' + colors[1] + ' 100%)',
323
+ });
324
+ }
325
+ })
326
+ .trigger('change');
327
+
328
+ // banner background colorpicker
329
+ jQuery('.cmp-coming-soon-maintenance #niteoCS_banner_color').wpColorPicker({
330
+ change: function (event, ui) {
331
+ jQuery('.color-preview').css('background-color', ui.color.toString());
332
+ },
333
+ });
334
+
335
+ // banner gradient background colorpicker one
336
+ jQuery('.cmp-coming-soon-maintenance #niteoCS_gradient_one').wpColorPicker({
337
+ change: function (event, ui) {
338
+ jQuery('.gradient-preview').css({
339
+ background: '-moz-linear-gradient(-45deg, ' + ui.color.toString() + ' 0%, ' + jQuery('#niteoCS_gradient_two').val() + ' 100%)',
340
+ background: '-webkit-linear-gradient(-45deg, ' + ui.color.toString() + ' 0%, ' + jQuery('#niteoCS_gradient_two').val() + ' 100%)',
341
+ background: 'linear-gradient(135deg, ' + ui.color.toString() + ' 0%, ' + jQuery('#niteoCS_gradient_two').val() + ' 100%)',
342
+ });
343
+ },
344
+ });
345
+
346
+ // banner gradient background colorpicker two
347
+ jQuery('.cmp-coming-soon-maintenance #niteoCS_gradient_two').wpColorPicker({
348
+ change: function (event, ui) {
349
+ jQuery('.gradient-preview').css({
350
+ background: '-moz-linear-gradient(-45deg, ' + jQuery('#niteoCS_gradient_one').val() + ' 0%, ' + ui.color.toString() + ' 100%)',
351
+ background: '-webkit-linear-gradient(-45deg, ' + jQuery('#niteoCS_gradient_one').val() + ' 0%, ' + ui.color.toString() + ' 100%)',
352
+ background: 'linear-gradient(135deg, ' + jQuery('#niteoCS_gradient_one').val() + ' 0%, ' + ui.color.toString() + ' 100%)',
353
+ });
354
+ },
355
+ });
356
+
357
+ // OVERLAY COLOR
358
+ jQuery('.cmp-coming-soon-maintenance #niteoCS_overlay_color').wpColorPicker({
359
+ change: function (event, ui) {
360
+ jQuery('.thumbnail-overlay').css('background', ui.color.toString());
361
+ },
362
+ });
363
+
364
+ // get overlay color and apply it to Background thumbnails
365
+ jQuery('.cmp-coming-soon-maintenance .thumbnail-overlay').css('background', jQuery('#niteoCS_overlay_color').val());
366
+
367
+ // OVERLAY GRADIENT
368
+ jQuery('.cmp-coming-soon-maintenance select.overlay-gradient').on('change', function () {
369
+ var overlay_gradient = jQuery('select.overlay-gradient option:selected').val();
370
+
371
+ if (overlay_gradient == 'custom') {
372
+ jQuery('.cmp-coming-soon-maintenance .custom-overlay-gradient').css('display', 'block');
373
+
374
+ var gradient_one = jQuery('#niteoCS_overlay_gradient_one').val();
375
+ var gradient_two = jQuery('#niteoCS_overlay_gradient_two').val();
376
+
377
+ jQuery('.cmp-coming-soon-maintenance .thumbnail-overlay').css({
378
+ background: '-moz-linear-gradient(-45deg, ' + gradient_one + ' 0%, ' + gradient_two + ' 100%)',
379
+ background: '-webkit-linear-gradient(-45deg, ' + gradient_one + ' 0%, ' + gradient_two + ' 100%)',
380
+ background: 'linear-gradient(135deg, ' + gradient_one + ' 0%, ' + gradient_two + ' 100%)',
381
+ });
382
+ } else {
383
+ colors = overlay_gradient.split(':');
384
+ jQuery('.cmp-coming-soon-maintenance .custom-overlay-gradient').css('display', 'none');
385
+ jQuery('.cmp-coming-soon-maintenance .thumbnail-overlay').css({
386
+ background: '-moz-linear-gradient(-45deg, ' + colors[0] + ' 0%, ' + colors[1] + ' 100%)',
387
+ background: '-webkit-linear-gradient(-45deg, ' + colors[0] + ' 0%, ' + colors[1] + ' 100%)',
388
+ background: 'linear-gradient(135deg, ' + colors[0] + ' 0%, ' + colors[1] + ' 100%)',
389
+ });
390
+ }
391
+ });
392
+
393
+ // Overlay gradient colorpicker one
394
+ jQuery('#niteoCS_overlay_gradient_one').wpColorPicker({
395
+ change: function (event, ui) {
396
+ jQuery('.thumbnail-overlay').css({
397
+ background: '-moz-linear-gradient(-45deg, ' + ui.color.toString() + ' 0%, ' + jQuery('#niteoCS_overlay_gradient_two').val() + ' 100%)',
398
+ background: '-webkit-linear-gradient(-45deg, ' + ui.color.toString() + ' 0%, ' + jQuery('#niteoCS_overlay_gradient_two').val() + ' 100%)',
399
+ background: 'linear-gradient(135deg, ' + ui.color.toString() + ' 0%, ' + jQuery('#niteoCS_overlay_gradient_two').val() + ' 100%)',
400
+ });
401
+ },
402
+ });
403
+
404
+ // Overlay gradient colorpicker two
405
+ jQuery('#niteoCS_overlay_gradient_two').wpColorPicker({
406
+ change: function (event, ui) {
407
+ jQuery('.thumbnail-overlay').css({
408
+ background: '-moz-linear-gradient(-45deg, ' + jQuery('#niteoCS_overlay_gradient_one').val() + ' 0%, ' + ui.color.toString() + ' 100%)',
409
+ background: '-webkit-linear-gradient(-45deg, ' + jQuery('#niteoCS_overlay_gradient_one').val() + ' 0%, ' + ui.color.toString() + ' 100%)',
410
+ background: 'linear-gradient(135deg, ' + jQuery('#niteoCS_overlay_gradient_one').val() + ' 0%, ' + ui.color.toString() + ' 100%)',
411
+ });
412
+ },
413
+ });
414
+
415
+ // OVERLAY OPACITY
416
+ jQuery('.background-overlay-opacity')
417
+ .on('input', function () {
418
+ var value = jQuery(this).val();
419
+ jQuery('.thumbnail-overlay').css('opacity', value);
420
+ })
421
+ .trigger('input');
422
+
423
+ // OVERLAY SELECTION
424
+ gradientIni(jQuery('.cmp-coming-soon-maintenance .background-overlay').val());
425
+
426
+ jQuery('.cmp-coming-soon-maintenance .background-overlay').on('change', function () {
427
+ gradientIni(jQuery(this).val());
428
+ });
429
+
430
+ function gradientIni(gradient_type) {
431
+ switch (gradient_type) {
432
+ case 'solid-color':
433
+ jQuery('.thumbnail-overlay').css('background', jQuery('#niteoCS_overlay_color').val());
434
+ break;
435
+
436
+ case 'gradient':
437
+ jQuery('.cmp-coming-soon-maintenance select.overlay-gradient').trigger('change');
438
+ break;
439
+
440
+ case 'disabled':
441
+ jQuery('.cmp-coming-soon-maintenance .thumbnail-overlay').css('background', 'none');
442
+ break;
443
+
444
+ default:
445
+ break;
446
+ }
447
+ }
448
+
449
+ // BLUR PREVIEW
450
+ jQuery('.cmp-coming-soon-maintenance .blur-range')
451
+ .on('input', function () {
452
+ var value = jQuery(this).val();
453
+ jQuery('.cmp-coming-soon-maintenance .background-thumb-wrapper img:not(.no-blur)').css('filter', 'blur(' + value + 'px)');
454
+ })
455
+ .trigger('input');
456
+
457
+ // banner pattern on change image preview
458
+ jQuery('.cmp-coming-soon-maintenance select[name^="niteoCS_banner_pattern"]').on('change', function () {
459
+ var pattern = jQuery('.cmp-coming-soon-maintenance select[name^="niteoCS_banner_pattern"] option:selected').val();
460
+
461
+ if (pattern != 'custom') {
462
+ var pattern_url = jQuery(this).data('url');
463
+ jQuery('.cmp-coming-soon-maintenance #add-pattern').css('display', 'none');
464
+ jQuery('.cmp-coming-soon-maintenance .pattern-wrapper').css('background-image', "url('" + pattern_url + pattern + ".png')");
465
+ } else {
466
+ var pattern_url = jQuery('.cmp-coming-soon-maintenance #niteoCS_banner_pattern_custom').val();
467
+ jQuery('.cmp-coming-soon-maintenance #add-pattern').css('display', 'block');
468
+ jQuery('.cmp-coming-soon-maintenance .pattern-wrapper').css('background-image', "url('" + pattern_url + "')");
469
+ }
470
+ });
471
+
472
+ // preview animation
473
+ jQuery('.cmp-coming-soon-maintenance .heading-animation').on('change', function () {
474
+ heading_anim = jQuery('.cmp-coming-soon-maintenance .heading-animation option:selected').val();
475
+ jQuery('.cmp-coming-soon-maintenance #heading-example')
476
+ .removeClass()
477
+ .addClass('animated ' + heading_anim);
478
+ });
479
+
480
+ jQuery('.cmp-coming-soon-maintenance .content-animation').on('change', function () {
481
+ heading_anim = jQuery('.cmp-coming-soon-maintenance .content-animation option:selected').val();
482
+ jQuery('.cmp-coming-soon-maintenance #content-example')
483
+ .removeClass()
484
+ .addClass('animated ' + heading_anim);
485
+ });
486
+
487
+ // ----------------------- sortable social list -----------------------
488
+ // function to update social list
489
+ var update_social = function (name, key, val) {
490
+ var socialmedia = jQuery('.cmp-coming-soon-maintenance #niteoCS_socialmedia').attr('value');
491
+ socialmedia = jQuery.parseJSON(socialmedia);
492
+
493
+ jQuery.each(socialmedia, function (i, ele) {
494
+ if (ele['name'] == name) {
495
+ ele[key] = val;
496
+ }
497
+ });
498
+
499
+ jQuery('.cmp-coming-soon-maintenance #niteoCS_socialmedia').attr('value', JSON.stringify(socialmedia));
500
+ };
501
+
502
+ // sortable UI - disabled on Mobile phones - input elements where not clickable...
503
+ if (!/Mobi/.test(navigator.userAgent)) {
504
+ var $sortableList = jQuery('.cmp-coming-soon-maintenance .social-inputs');
505
+
506
+ var sortEventHandler = function (event, ui) {
507
+ var inputs = $sortableList.find('input[type="text"]');
508
+
509
+ var order = ui.item.index();
510
+
511
+ inputs.each(function (i, ele) {
512
+ var name = jQuery(ele).data('name');
513
+ update_social(name, 'order', i);
514
+ });
515
+ };
516
+
517
+ $sortableList.sortable({
518
+ stop: sortEventHandler,
519
+ });
520
+
521
+ $sortableList.on('sortchange', sortEventHandler);
522
+ }
523
+
524
+ // social checkbox to enable/disable input
525
+ (function ($) {
526
+ jQuery.fn.toggleDisabled = function () {
527
+ return this.each(function () {
528
+ var $this = jQuery(this);
529
+ var active;
530
+ var name = $this.data('name');
531
+ if ($this.attr('disabled')) {
532
+ $this.prop('disabled', false);
533
+ active = '1';
534
+ } else {
535
+ $this.prop('disabled', true);
536
+ active = '0';
537
+ }
538
+ update_social(name, 'active', active);
539
+ });
540
+ };
541
+ })(jQuery);
542
+
543
+ jQuery('.cmp-coming-soon-maintenance .social-inputs input[type="text"]').focusout(function () {
544
+ var name = jQuery(this).data('name');
545
+ var socialurl = jQuery(this).val();
546
+ update_social(name, 'url', socialurl);
547
+ });
548
+
549
+ jQuery('.cmp-coming-soon-maintenance .social-inputs input[type="checkbox"]').click(function (e) {
550
+ var $this = jQuery(this).siblings('input[type="text"]');
551
+ $this.toggleDisabled();
552
+ });
553
+
554
+ // social icons active/inactive
555
+ jQuery('.cmp-coming-soon-maintenance .social-media i').click(function () {
556
+ var name = jQuery(this).data('name');
557
+ jQuery(this).toggleClass('active');
558
+ jQuery('.cmp-coming-soon-maintenance .social-inputs li.' + name).toggleClass('active');
559
+ jQuery('.cmp-coming-soon-maintenance .social-inputs li.' + name + ' input').trigger('change');
560
+
561
+ if (jQuery(this).hasClass('active')) {
562
+ update_social(name, 'hidden', '0');
563
+ } else {
564
+ update_social(name, 'hidden', '1');
565
+ }
566
+ // hide/show input labels
567
+ if (jQuery('.cmp-coming-soon-maintenance .social-media i.active').length) {
568
+ jQuery('.social-inputs .label').css('display', 'block');
569
+ } else {
570
+ jQuery('.cmp-coming-soon-maintenance .social-inputs .label').css('display', 'none');
571
+ }
572
+ });
573
+
574
+ // hide/show input labels
575
+ if (jQuery('.cmp-coming-soon-maintenance .social-media i.active').length) {
576
+ jQuery('.cmp-coming-soon-maintenance .social-inputs .label').css('display', 'block');
577
+ }
578
+
579
+ // theme update via admin notice
580
+ jQuery('.cmp.update-theme').click(function (e) {
581
+ e.preventDefault();
582
+ var $this = jQuery(this),
583
+ $parent = $this.parents('.notice'),
584
+ security = $this.data('security'),
585
+ slug = $this.data('slug'),
586
+ themeName = $this.data('name'),
587
+ remoteUrl = jQuery(this).data('remote_url');
588
+ var update = {
589
+ name: slug,
590
+ tmp_name: '',
591
+ url: remoteUrl + '?action=download&slug=' + slug,
592
+ };
593
+
594
+ var data = {
595
+ action: 'cmp_theme_update_install',
596
+ security: security,
597
+ file: update,
598
+ };
599
+
600
+ $parent.find('.message').html('<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span class="sr-only">Updating heme...</span><span> working hard on updating Theme...</span>');
601
+
602
+ jQuery.post(ajaxurl, data, function (response) {
603
+ response = response.trim();
604
+
605
+ if (response == 'success') {
606
+ setTimeout(function () {
607
+ $parent.removeClass('notice-warning').addClass('notice-success');
608
+ $parent.find('.message').html('<span> ' + themeName + ' CMP theme was updated sucessfully! You can enjoy latest features now :) </span><i class="far fa-smile" aria-hidden="true"></i>');
609
+ }, 1500);
610
+ } else {
611
+ response = response.slice(0, -1);
612
+ var error = jQuery('p', jQuery(response)).text();
613
+ $parent.removeClass('notice-warning').addClass('notice-error');
614
+ $parent.find('.message').html('<i class="far fa-frown" aria-hidden="true"></i><span> ' + error + '</span>');
615
+ }
616
+ });
617
+ });
618
+
619
+ // theme update via theme button
620
+ jQuery('.cmp-coming-soon-maintenance .theme-update.button').one('click', function (e) {
621
+ e.preventDefault();
622
+ var $this = jQuery(this),
623
+ $wrapper = $this.closest('.theme-wrapper'),
624
+ security = $wrapper.data('security'),
625
+ slug = $wrapper.data('slug'),
626
+ remoteUrl = $wrapper.data('remote_url');
627
+
628
+ var update = {
629
+ name: slug,
630
+ tmp_name: '',
631
+ url: remoteUrl + '?action=download&slug=' + slug,
632
+ };
633
+
634
+ var data = {
635
+ action: 'cmp_theme_update_install',
636
+ security: security,
637
+ file: update,
638
+ };
639
+
640
+ $this.html('<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span>Updating..</span>');
641
+
642
+ jQuery.post(ajaxurl, data, function (response) {
643
+ if (response == 'success') {
644
+ setTimeout(function () {
645
+ $this.html('<i class="far fa-smile" aria-hidden="true"></i><span>Updated!</span>');
646
+ setTimeout(function () {
647
+ $this.fadeOut();
648
+ }, 1500);
649
+ }, 1500);
650
+ } else {
651
+ response = response.slice(0, -1);
652
+ $this.html('<i class="far fa-frown" aria-hidden="true"></i><span>Update Failed!</span>');
653
+ }
654
+ });
655
+ });
656
+
657
+ // display theme details overlay
658
+ jQuery('.cmp-coming-soon-maintenance .theme-details').click(function (e) {
659
+ e.preventDefault();
660
+ var $this = jQuery(this),
661
+ $wrapper = $this.closest('.theme-wrapper'),
662
+ slug = $wrapper.data('slug'),
663
+ version = $wrapper.data('version'),
664
+ type = $wrapper.data('type'),
665
+ purchased = $wrapper.data('purchased'),
666
+ i = 0;
667
+
668
+ var data = {
669
+ action: 'niteo_themeinfo',
670
+ security: jQuery('.theme-wrapper').data('security'),
671
+ theme_slug: jQuery(this).parents('.theme-wrapper').data('slug'),
672
+ };
673
+
674
+ jQuery.post(ajaxurl, data, function (response) {
675
+ var buyButton = '';
676
+ var versionInfo = '';
677
+ var noticeHtml = '';
678
+ // parse JSON data to array
679
+ response = jQuery.parseJSON(response);
680
+
681
+ if (response.result == 'true') {
682
+ // overflow body hidden
683
+ jQuery('body').addClass('modal-open');
684
+
685
+ // if installed display version info
686
+ if (purchased == '1') {
687
+ versionInfo = '<span class="theme-version">Installed version: ' + version + '</span>';
688
+ }
689
+
690
+ // if premium and not installed, display buy button
691
+ if (purchased != '1' && type == 'premium') {
692
+ var buyURL = $wrapper.find('.cmp-purchase-theme').attr('href');
693
+ var buyButton = '<button type="button" class="theme-purchase button hide"><a href="' + buyURL + '" target="_blank"><i class="fas fa-cart-arrow-down" aria-hidden="true"></i>Get Theme</a></button>';
694
+ }
695
+
696
+ // get screenshots
697
+ var screenshots = response.screenshots;
698
+ var arrows = '';
699
+ // if we have more screenshots, generate navigation arrows
700
+ if (Object.keys(screenshots).length > 1) {
701
+ arrows = '<div class="screenshots-nav"><div class="left"><i class="fas fa-chevron-left" aria-hidden="true"></i></div><div class="right"><i class="fas fa-chevron-right" aria-hidden="true"></i></div></div>';
702
+ }
703
+
704
+ // generate html to append to theme-overlay
705
+ var html = jQuery(
706
+ [
707
+ '<div class="theme-backdrop">',
708
+ ' <div class="theme-wrap">',
709
+ ' <div class="theme-header">',
710
+ ' <button class="close dashicons dashicons-no"><span class="screen-reader-text">Close details dialog</span></button>',
711
+ ' </div>',
712
+ ' <div class="theme-about">',
713
+ ' <div class="theme-screenshots">',
714
+ ' <div class="screenshot" style="background-image:url(\'' + screenshots['0'] + '\')">' + arrows + '</div>',
715
+ ' </div>',
716
+ ' <div class="theme-info">',
717
+ ' <h2 class="theme-name">' + response['name'] + versionInfo + '</h2>',
718
+ ' <p class="theme-author">By <a href="' + response['author_homepage'] + '" target="_blank">' + response['author'] + '</a></p>',
719
+ noticeHtml,
720
+ buyButton,
721
+ ' <div class="theme-description">' + response['description'] + '</div>',
722
+ ' </div>',
723
+ ' </div>',
724
+ ' <div class="theme-actions">',
725
+ ' <a href="https://niteothemes.com/cmp-coming-soon-maintenance/?theme=' + slug + '&utm_source=cmp&utm_medium=referral&utm_campaign=' + slug + '" class="button cmp-preview" target="_blank" aria-label="Preview ' + response['name'] + '">Live Preview</a>',
726
+ ' </div>',
727
+ ' </div>',
728
+ '</div>',
729
+ ].join('\n')
730
+ );
731
+
732
+ // append html to overlay
733
+ jQuery('.theme-overlay.cmp').append(html);
734
+
735
+ // attach close button handler
736
+ jQuery('.theme-overlay.cmp .close').click(function (e) {
737
+ e.preventDefault();
738
+ // overflow body hidden
739
+ jQuery('body').removeClass('modal-open');
740
+ jQuery('.theme-overlay.cmp .theme-backdrop').fadeOut('fast');
741
+ });
742
+
743
+ // attach arrows navigation handler
744
+ jQuery('.screenshots-nav .right').click(function () {
745
+ i++;
746
+
747
+ if (i == Object.keys(screenshots).length) {
748
+ i = 0;
749
+ }
750
+
751
+ if (i in screenshots) {
752
+ jQuery('.screenshot').css('background-image', "url('" + screenshots[i] + "')");
753
+ }
754
+ });
755
+
756
+ // attach arrows navigation handler
757
+ jQuery('.screenshots-nav .left').click(function () {
758
+ i--;
759
+
760
+ if (i < 0) {
761
+ i = Object.keys(screenshots).length - 1;
762
+ }
763
+
764
+ if (i in screenshots) {
765
+ jQuery('.screenshot').css('background-image', "url('" + screenshots[i] + "')");
766
+ }
767
+ });
768
+ }
769
+ });
770
+ });
771
+
772
+ function media_upload_button(name, multiple, type, element) {
773
+ // define var
774
+ var $container = jQuery('.' + name + '-wrapper');
775
+ var $add_button = jQuery('#add-' + name);
776
+ var $delete_button = jQuery('#delete-' + name);
777
+ var image;
778
+ var imgID = '';
779
+ var title = name.replace('-', ' ');
780
+ title = title[0].toUpperCase() + title.slice(1);
781
+
782
+ if (jQuery('#niteoCS-' + name + '-id').val() != '') {
783
+ // Display Delete button
784
+ $delete_button.css('display', 'block');
785
+ }
786
+
787
+ $add_button.click(function (e) {
788
+ e.preventDefault();
789
+ // If the media frame already exists, reopen it.
790
+ if (media_uploader) {
791
+ media_uploader.open();
792
+ return;
793
+ }
794
+
795
+ var media_uploader = wp
796
+ .media({
797
+ title: 'Select ' + title,
798
+ button: {
799
+ text: 'Insert ' + title,
800
+ },
801
+ multiple: multiple, // Set this to true to allow multiple files to be selected
802
+ library: {
803
+ type: [type],
804
+ },
805
+ })
806
+ .on('select', function () {
807
+ // Get media attachment details from the frame state
808
+ var attachment = media_uploader.state().get('selection').toJSON();
809
+
810
+ if (attachment.length > 0) {
811
+ $container.find('img').remove();
812
+
813
+ // remove and add gallery count class
814
+ $container.attr('class', name + '-wrapper custom-gallery');
815
+ $container.addClass('gallery-' + attachment.length);
816
+
817
+ // get images ID, append thumbnail and store IDs in hidden input
818
+ jQuery(attachment).each(function (i) {
819
+ if (attachment[i].sizes && attachment[i].sizes.large) {
820
+ image = attachment[i].sizes.large.url;
821
+ } else {
822
+ image = attachment[i].url;
823
+ }
824
+
825
+ // add image ID and url to comma-separated variable
826
+ var comma = i === 0 ? '' : ',';
827
+ imgID += comma + attachment[i].id;
828
+
829
+ // Send the attachment URL to our custom image input field.
830
+ switch (element) {
831
+ case 'video':
832
+ $container.append('<video width="600" height="400" controls><source src="' + image + '" type="video/mp4">Your browser does not support the video tag.</video>');
833
+ break;
834
+
835
+ case 'background':
836
+ $container.css('background-image', "url('" + image + "')");
837
+ break;
838
+
839
+ case 'img':
840
+ default:
841
+ // if gallery - more than one image, it must be a graphic background, attach the first image to big coontainer
842
+ if (attachment.length > 1 && i == 0 && jQuery('.' + name + '-wrapper .big-thumb').length) {
843
+ jQuery('.' + name + '-wrapper .big-thumb').append('<img src="' + image + '" alt=""/>');
844
+
845
+ // if gallery - more than one image, it must be a graphic background, attach all others images to normal wrapper
846
+ } else if (attachment.length > 1 && i !== 0) {
847
+ $container.append('<img src="' + image + '" alt="" class="no-blur"/>');
848
+
849
+ // if single image, and it is a background image, attach it to big container as well
850
+ } else if ($container.find('.big-thumb').length) {
851
+ jQuery('.' + name + '-wrapper .big-thumb').append('<img src="' + image + '" alt=""/>');
852
+
853
+ // all others images
854
+ } else {
855
+ $container.append('<img src="' + image + '" alt=""/>');
856
+ }
857
+
858
+ jQuery('.blur-range').trigger('input');
859
+ break;
860
+ }
861
+ });
862
+
863
+ // Display Delete button
864
+ $delete_button.css('display', 'block');
865
+ }
866
+ // update hidden input with media id and trigger change
867
+ jQuery('#niteoCS-' + name + '-id')
868
+ .val(imgID)
869
+ .trigger('change');
870
+ })
871
+ .open();
872
+ });
873
+
874
+ $delete_button.click(function (e) {
875
+ jQuery(this).css('display', 'none');
876
+ $container.find('img').remove();
877
+ jQuery('#niteoCS-' + name + '-id').val('');
878
+ jQuery('#niteoCS-' + name + '-id').trigger('change');
879
+ });
880
+ }
881
+
882
+ // Retrieve Mailchimp lists
883
+ jQuery('.cmp-coming-soon-maintenance #connect-mailchimp').click(function (e) {
884
+ e.preventDefault();
885
+
886
+ var apikey = jQuery('.cmp-coming-soon-maintenance input[name="niteoCS_mailchimp_apikey"]').val(),
887
+ security = jQuery(this).data('security'),
888
+ button = jQuery(this);
889
+
890
+ if (apikey != '') {
891
+ var params = { apikey: apikey, security: security };
892
+
893
+ jQuery(this).prop('disabled', true);
894
+
895
+ jQuery(this).html('<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span> retrieving lists..</span>');
896
+
897
+ var data = {
898
+ action: 'cmp_mailchimp_list_ajax',
899
+ security: security,
900
+ params: params,
901
+ };
902
+
903
+ jQuery
904
+ .post(ajaxurl, data, function (response) {
905
+ var lists = JSON.parse(response);
906
+
907
+ if (lists.response == 200) {
908
+ jQuery('#niteoCS_mailchimp_list').empty().prop('disabled', false);
909
+ jQuery.each(lists.lists, function (i, val) {
910
+ jQuery('#niteoCS_mailchimp_list').append('<option value="' + val.id + '">' + val.name + '</option>');
911
+ });
912
+ } else {
913
+ jQuery('#niteoCS_mailchimp_list')
914
+ .empty()
915
+ .prop('disabled', true)
916
+ .html('<option value="error">' + lists.message + '</option>')
917
+ .trigger('change');
918
+ }
919
+
920
+ button.html('Retrieve Lists');
921
+ button.prop('disabled', false);
922
+ })
923
+ .fail(function () {
924
+ button.html('Retrieve Lists');
925
+ button.prop('disabled', false);
926
+ });
927
+ }
928
+ });
929
+
930
+ function toggle_settings(classname) {
931
+ // Logo type inputs
932
+ jQuery('.cmp-coming-soon-maintenance .' + classname).change(function () {
933
+ var value = jQuery('.cmp-coming-soon-maintenance .' + classname + ':checked').val();
934
+ value = jQuery.isNumeric(value) ? 'x' + value : value;
935
+ value = value === undefined ? 'off' : value;
936
+
937
+ jQuery('.cmp-coming-soon-maintenance .' + classname + '-switch.' + value).css('display', 'block');
938
+ jQuery('.cmp-coming-soon-maintenance .' + classname + '-switch:not(.' + value + ')').css('display', 'none');
939
+ });
940
+
941
+ jQuery('.cmp-coming-soon-maintenance .' + classname)
942
+ .first()
943
+ .trigger('change');
944
+ }
945
+
946
+ function toggle_select(classname) {
947
+ jQuery('.cmp-coming-soon-maintenance .' + classname).change(function () {
948
+ var value = jQuery('.' + classname).val();
949
+ value = jQuery.isNumeric(value) ? 'x' + value : value;
950
+
951
+ jQuery('.cmp-coming-soon-maintenance .' + classname + '.' + value).css('display', 'block');
952
+ jQuery('.cmp-coming-soon-maintenance .' + classname + ':not(.' + value + ')').css('display', 'none');
953
+ });
954
+
955
+ jQuery('.' + classname)
956
+ .first()
957
+ .trigger('change');
958
+ }
959
+
960
+ function update_range(selector, target, method) {
961
+ jQuery(selector).on('input', function () {
962
+ var value = jQuery(this).val();
963
+ // change label value
964
+ if (method === 'html') {
965
+ jQuery(this).parent().find(target).html(value);
966
+ }
967
+
968
+ if (method === 'val') {
969
+ jQuery(this).parent().find(target).val(value);
970
+ }
971
+ });
972
+ }
973
+
974
+ // delete overlay color from premium themes after update 2.8
975
+ jQuery('.cmp-coming-soon-maintenance .table-wrapper.theme-setup h4').each(function () {
976
+ if (jQuery(this).html() == 'Overlay Color') {
977
+ jQuery(this).parents('tr').remove();
978
+ return false;
979
+ }
980
+ });
981
+
982
+ // warn users about unsaved changes for preview
983
+ jQuery('.nav-tab-wrapper').on('click', '.theme-preview', function (e) {
984
+ if (jQuery('#csoptions fieldset:not(.skip-preview-validation *)').serialize() != settings) {
985
+ if (!confirm('You have made changes that will not be visible in the preview until you save them. Please save changes first.\nContinue anyway?')) {
986
+ e.preventDefault();
987
+ return false;
988
+ }
989
+ }
990
+
991
+ return true;
992
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
993
  });
js/settings.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function (e) { var n = document.location.hash.substring(1), a = jQuery("#csoptions").attr("action"), t = jQuery("#csoptions fieldset:not(.skip-preview-validation *)").serialize(); wp.codeEditor && jQuery("#niteoCS_custom_css").length && wp.codeEditor.initialize("niteoCS_custom_css"), navtab = function (e) { jQuery(".cmp-coming-soon-maintenance .nav-tab-wrapper .nav-tab").removeClass("nav-tab-active"), jQuery(".nav-tab-wrapper ." + e).addClass("nav-tab-active"), jQuery(".cmp-coming-soon-maintenance .table-wrapper." + e).css("display", "block"), jQuery(".cmp-coming-soon-maintenance .table-wrapper-css." + e).css("display", "block"), jQuery(".cmp-coming-soon-maintenance .comingsoon." + e).css("display", "block"), jQuery(".cmp-coming-soon-maintenance .table-wrapper:not(." + e + ")").css("display", "none"), jQuery(".cmp-coming-soon-maintenance .table-wrapper-css:not(." + e).css("display", "none"), jQuery(".cmp-coming-soon-maintenance .comingsoon:not(." + e + ")").css("display", "none"), "install" == e ? (jQuery(".cmp-coming-soon-maintenance .submit").css("display", "none"), jQuery(".cmp-coming-soon-maintenance #csoptions").attr("action", a)) : (jQuery(".cmp-coming-soon-maintenance .submit").css("display", "block"), jQuery(".cmp-coming-soon-maintenance #csoptions").attr("action", a + "#" + e)) }, "" != n ? navtab(n) : jQuery(".cmp-coming-soon-maintenance .table-wrapper-css").css("display", "none"), window.onhashchange = function () { n = document.location.hash.substring(1), navtab(n) }, jQuery(".cmp-coming-soon-maintenance .nav-tab:not(.theme-preview):not(.advanced)").click(function (e) { e.preventDefault(), n = jQuery(this).data("tab"), document.location.hash = n }), p(".cmp-coming-soon-maintenance .blur-range", "span", "html"), p(".cmp-coming-soon-maintenance .background-overlay-opacity", "span", "html"), p("#logo_size_slider", "#niteoCS_logo_size", "val"), p("#niteoCS_logo_size", "#logo_size_slider", "val"), l("logo", !1, "image", "img"), l("favicon", !1, "image", "img"), l("seo_img", !1, "image", "img"), l("images", !0, "image", "img"), l("mobile-images", !0, "image", "img"), l("pattern", !1, "image", "background"), l("video-thumb", !1, "image", "img"), l("video-local", !1, "video", "video"), l("subs-img", !1, "image", "img"), u("analytics"), u("contact-form"), u("subscribe"), u("background-effect"), u("special-effect"), u("cmp-logo"), u("background-type"), u("counter"), u("progress-bar"), u("overlay-text"), u("cmp-logo-size"), u("recaptcha-toggle"), u("login-icon"), u("custom-mobile-imgs"), u("lang-switcher"), m("counter-action"), m("subscribe-method"), m("background-overlay"), m("banner-video-source"), m("progress-bar-type"), jQuery(".cmp-coming-soon-maintenance select:not(.headings-google-font):not(.content-google-font )").select2({ width: "100%", minimumResultsForSearch: -1, placeholder: "Click to select.." }), jQuery(".cmp-coming-soon-maintenance #cmp-status").click(function () { jQuery(".cmp-coming-soon-maintenance .cmp-status input[type=radio]").prop("disabled", function (e, n) { return !n }), jQuery("#cmp-toggle-adminbar").toggleClass("status-1"), jQuery(".cmp-status-pages").fadeToggle() }), jQuery(".cmp-status-pages input[type=radio]").change(function () { jQuery(".cmp-status-pages input[type=radio]").parent().removeClass("active"), jQuery(this).parent().addClass("active") }), jQuery(".cmp-coming-soon-maintenance .cmp-status.switch:not(.disabled)").click(function () { if (0 != jQuery(".cmp-coming-soon-maintenance #cmp-status").prop("checked")) { var e = jQuery(this).children("input"); e.prop("checked", !0), jQuery(".cmp-coming-soon-maintenance .cmp-status.switch").removeClass("active"), jQuery(this).addClass("active"), e.trigger("change"), "3" == e.val() ? jQuery(".cmp-coming-soon-maintenance .redirect-inputs").fadeIn("fast") : jQuery(".cmp-coming-soon-maintenance .redirect-inputs").fadeOut("fast") } }), jQuery(".cmp-coming-soon-maintenance .table-wrapper h3").click(function () { jQuery(this).parent().toggleClass("closed") }), jQuery(".cmp-coming-soon-maintenance #test-unsplash").click(function (e) { e.preventDefault(); var n = jQuery(".cmp-coming-soon-maintenance #unsplash-media"), a = jQuery('.cmp-coming-soon-maintenance .unsplash_banner select[name^="unsplash_feed"] option:selected').val(), t = "", i = jQuery(this).data("security"); if (0 == a) { switch (a) { case "0": t = jQuery(".cmp-coming-soon-maintenance #niteoCS-unsplash-0").val() }if (3 == a || "" != t) { var o = { feed: a, url: t, feat: "", custom_str: "" }; jQuery(this).prop("disabled", !0), jQuery(this).html('<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span> loading..</span>'); var r = { action: "niteo_unsplash", security: i, params: o }; jQuery.post(ajaxurl, r, function (e) { var a = JSON.parse(e); jQuery("#unsplash_img").remove(); var t = setTimeout(function () { jQuery("#test-unsplash").prop("disabled", !1), jQuery("#test-unsplash").text("Display Unsplash Photo"), jQuery("#unsplash-media").html('<p>It seems <a href="https://status.unsplash.com/" target="_blank">Unsplash API</a> is not responding. Please try again later.</p>') }, 5e3); if ("200" == a.response) { if ((a = jQuery.parseJSON(a.body))[0]) var i = a[0].urls.raw + "?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&fit=max&w=588", o = a[0].user.name, r = a[0].user.links.html, s = a[0].links.html, c = a[0].id; else i = a.urls.raw + "?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&fit=max&w=588", o = a.user.name, r = a.user.links.html, s = a.links.html, c = a.id; jQuery("<img />", { src: i, id: "unsplash_img" }).one("load", function () { jQuery(this).appendTo(n), jQuery(this).fadeIn(), jQuery("#test-unsplash").prop("disabled", !1), jQuery("#test-unsplash").text("Display Unsplash Photo"), jQuery(".unsplash-id").html('<a href="' + s + '" target="_blank">Photo</a> (ID: ' + c + ') by <a href="' + r + '" target="_blank">' + o + '</a> / <a href="https://unsplash.com/" target="_blank">Unsplash</a>'), jQuery(".blur-range").trigger("input"), clearTimeout(t) }) } else jQuery(".cmp-coming-soon-maintenance #test-unsplash").prop("disabled", !1), jQuery(".cmp-coming-soon-maintenance #test-unsplash").text("Display Unsplash Photo"), jQuery(".cmp-coming-soon-maintenance #unsplash-media").html("<p>Error " + a.response + ': <span style="text-transform:lowercase;">' + JSON.parse(a.body).errors + "</span></p>"), clearTimeout(t) }) } else jQuery(".cmp-coming-soon-maintenance #unsplash_img").remove() } }), videoPreview = function () { if ("5" == jQuery(".cmp-coming-soon-maintenance .background-type:checked").val()) { var e = jQuery(".cmp-coming-soon-maintenance .banner-video-source").val(); if ("youtube" == e) { var n = jQuery(".cmp-coming-soon-maintenance #niteoCS-youtube-url").val(); if ("" != n) { var a = n.match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/); if (a && 11 == a[7].length) { jQuery(".cmp-coming-soon-maintenance .video-yt-wrapper .video-yt-thumb-wrapper").html(""); var t = "https://img.youtube.com/vi/" + a[7] + "/maxresdefault.jpg"; jQuery(".cmp-coming-soon-maintenance .video-yt-wrapper .video-yt-thumb-wrapper").append('<img src="' + t + '" alt=""/>'), jQuery(".cmp-coming-soon-maintenance .blur-range").trigger("input") } else jQuery(".cmp-coming-soon-maintenance .video-yt-wrapper .video-yt-thumb-wrapper").html("") } } if ("local" == e) { var i = jQuery("#niteoCS-video-local-id").data("url"); "" != i && jQuery(".cmp-coming-soon-maintenance .video-local-wrapper").html('<video width="600" height="400" controls><source src="' + i + '" type="video/mp4">Your browser does not support the video tag.</video>') } } }, videoPreview(), jQuery(".cmp-coming-soon-maintenance .background-type").on("change", function () { videoPreview() }), jQuery(".cmp-coming-soon-maintenance #niteoCS-youtube-url").on("keyup", function () { videoPreview() }), jQuery(".cmp-coming-soon-maintenance .banner-video-source").on("change", function () { videoPreview() }); var i = jQuery('.unsplash_banner select[name^="unsplash_feed"] option:selected').val(); function o(e) { switch (e) { case "solid-color": jQuery(".thumbnail-overlay").css("background", jQuery("#niteoCS_overlay_color").val()); break; case "gradient": jQuery(".cmp-coming-soon-maintenance select.overlay-gradient").trigger("change"); break; case "disabled": jQuery(".cmp-coming-soon-maintenance .thumbnail-overlay").css("background", "none") } } jQuery(".unsplash-feed-" + i).css("display", "block"), jQuery('.unsplash_banner select[name^="unsplash_feed"]').on("change", function () { i = jQuery('.unsplash_banner select[name^="unsplash_feed"] option:selected').val(), jQuery(".unsplash-feed").css("display", "none"), jQuery(".unsplash-feed-" + i).css("display", "block"), jQuery("#test-unsplash").trigger("click") }), 1 == jQuery("#csoptions .niteoCS_banner:checked").val() && jQuery("#test-unsplash").trigger("click"), jQuery(".cmp-coming-soon-maintenance select.background-gradient").on("change", function () { var e = jQuery(".cmp-coming-soon-maintenance select.background-gradient option:selected").val(); "custom" == e ? (jQuery(".cmp-coming-soon-maintenance .custom-gradient").css("display", "block"), jQuery(".cmp-coming-soon-maintenance .gradient-preview").css({ background: "-moz-linear-gradient(-45deg, " + jQuery("#niteoCS_gradient_one").val() + " 0%, " + jQuery("#niteoCS_gradient_two").val() + " 100%)", background: "-webkit-linear-gradient(-45deg, " + jQuery("#niteoCS_gradient_one").val() + " 0%, " + jQuery("#niteoCS_gradient_two").val() + " 100%)", background: "linear-gradient(135deg, " + jQuery("#niteoCS_gradient_one").val() + " 0%, " + jQuery("#niteoCS_gradient_two").val() + " 100%)" })) : (colors = e.split(":"), jQuery(".cmp-coming-soon-maintenance .custom-gradient").css("display", "none"), jQuery(".cmp-coming-soon-maintenance .gradient-preview").css({ background: "-moz-linear-gradient(-45deg, " + colors[0] + " 0%, " + colors[1] + " 100%)", background: "-webkit-linear-gradient(-45deg, " + colors[0] + " 0%, " + colors[1] + " 100%)", background: "linear-gradient(135deg, " + colors[0] + " 0%, " + colors[1] + " 100%)" })) }).trigger("change"), jQuery(".cmp-coming-soon-maintenance #niteoCS_banner_color").wpColorPicker({ change: function (e, n) { jQuery(".color-preview").css("background-color", n.color.toString()) } }), jQuery(".cmp-coming-soon-maintenance #niteoCS_gradient_one").wpColorPicker({ change: function (e, n) { jQuery(".gradient-preview").css({ background: "-moz-linear-gradient(-45deg, " + n.color.toString() + " 0%, " + jQuery("#niteoCS_gradient_two").val() + " 100%)", background: "-webkit-linear-gradient(-45deg, " + n.color.toString() + " 0%, " + jQuery("#niteoCS_gradient_two").val() + " 100%)", background: "linear-gradient(135deg, " + n.color.toString() + " 0%, " + jQuery("#niteoCS_gradient_two").val() + " 100%)" }) } }), jQuery(".cmp-coming-soon-maintenance #niteoCS_gradient_two").wpColorPicker({ change: function (e, n) { jQuery(".gradient-preview").css({ background: "-moz-linear-gradient(-45deg, " + jQuery("#niteoCS_gradient_one").val() + " 0%, " + n.color.toString() + " 100%)", background: "-webkit-linear-gradient(-45deg, " + jQuery("#niteoCS_gradient_one").val() + " 0%, " + n.color.toString() + " 100%)", background: "linear-gradient(135deg, " + jQuery("#niteoCS_gradient_one").val() + " 0%, " + n.color.toString() + " 100%)" }) } }), jQuery(".cmp-coming-soon-maintenance #niteoCS_overlay_color").wpColorPicker({ change: function (e, n) { jQuery(".thumbnail-overlay").css("background", n.color.toString()) } }), jQuery(".cmp-coming-soon-maintenance .thumbnail-overlay").css("background", jQuery("#niteoCS_overlay_color").val()), jQuery(".cmp-coming-soon-maintenance select.overlay-gradient").on("change", function () { var e = jQuery("select.overlay-gradient option:selected").val(); if ("custom" == e) { jQuery(".cmp-coming-soon-maintenance .custom-overlay-gradient").css("display", "block"); var n = jQuery("#niteoCS_overlay_gradient_one").val(), a = jQuery("#niteoCS_overlay_gradient_two").val(); jQuery(".cmp-coming-soon-maintenance .thumbnail-overlay").css({ background: "-moz-linear-gradient(-45deg, " + n + " 0%, " + a + " 100%)", background: "-webkit-linear-gradient(-45deg, " + n + " 0%, " + a + " 100%)", background: "linear-gradient(135deg, " + n + " 0%, " + a + " 100%)" }) } else colors = e.split(":"), jQuery(".cmp-coming-soon-maintenance .custom-overlay-gradient").css("display", "none"), jQuery(".cmp-coming-soon-maintenance .thumbnail-overlay").css({ background: "-moz-linear-gradient(-45deg, " + colors[0] + " 0%, " + colors[1] + " 100%)", background: "-webkit-linear-gradient(-45deg, " + colors[0] + " 0%, " + colors[1] + " 100%)", background: "linear-gradient(135deg, " + colors[0] + " 0%, " + colors[1] + " 100%)" }) }), jQuery("#niteoCS_overlay_gradient_one").wpColorPicker({ change: function (e, n) { jQuery(".thumbnail-overlay").css({ background: "-moz-linear-gradient(-45deg, " + n.color.toString() + " 0%, " + jQuery("#niteoCS_overlay_gradient_two").val() + " 100%)", background: "-webkit-linear-gradient(-45deg, " + n.color.toString() + " 0%, " + jQuery("#niteoCS_overlay_gradient_two").val() + " 100%)", background: "linear-gradient(135deg, " + n.color.toString() + " 0%, " + jQuery("#niteoCS_overlay_gradient_two").val() + " 100%)" }) } }), jQuery("#niteoCS_overlay_gradient_two").wpColorPicker({ change: function (e, n) { jQuery(".thumbnail-overlay").css({ background: "-moz-linear-gradient(-45deg, " + jQuery("#niteoCS_overlay_gradient_one").val() + " 0%, " + n.color.toString() + " 100%)", background: "-webkit-linear-gradient(-45deg, " + jQuery("#niteoCS_overlay_gradient_one").val() + " 0%, " + n.color.toString() + " 100%)", background: "linear-gradient(135deg, " + jQuery("#niteoCS_overlay_gradient_one").val() + " 0%, " + n.color.toString() + " 100%)" }) } }), jQuery(".background-overlay-opacity").on("input", function () { var e = jQuery(this).val(); jQuery(".thumbnail-overlay").css("opacity", e) }).trigger("input"), o(jQuery(".cmp-coming-soon-maintenance .background-overlay").val()), jQuery(".cmp-coming-soon-maintenance .background-overlay").on("change", function () { o(jQuery(this).val()) }), jQuery(".cmp-coming-soon-maintenance .blur-range").on("input", function () { var e = jQuery(this).val(); jQuery(".cmp-coming-soon-maintenance .background-thumb-wrapper img:not(.no-blur)").css("filter", "blur(" + e + "px)") }).trigger("input"), jQuery('.cmp-coming-soon-maintenance select[name^="niteoCS_banner_pattern"]').on("change", function () { var e = jQuery('.cmp-coming-soon-maintenance select[name^="niteoCS_banner_pattern"] option:selected').val(); if ("custom" != e) { var n = jQuery(this).data("url"); jQuery(".cmp-coming-soon-maintenance #add-pattern").css("display", "none"), jQuery(".cmp-coming-soon-maintenance .pattern-wrapper").css("background-image", "url('" + n + e + ".png')") } else { n = jQuery(".cmp-coming-soon-maintenance #niteoCS_banner_pattern_custom").val(); jQuery(".cmp-coming-soon-maintenance #add-pattern").css("display", "block"), jQuery(".cmp-coming-soon-maintenance .pattern-wrapper").css("background-image", "url('" + n + "')") } }), jQuery(".cmp-coming-soon-maintenance .heading-animation").on("change", function () { heading_anim = jQuery(".cmp-coming-soon-maintenance .heading-animation option:selected").val(), jQuery(".cmp-coming-soon-maintenance #heading-example").removeClass().addClass("animated " + heading_anim) }), jQuery(".cmp-coming-soon-maintenance .content-animation").on("change", function () { heading_anim = jQuery(".cmp-coming-soon-maintenance .content-animation option:selected").val(), jQuery(".cmp-coming-soon-maintenance #content-example").removeClass().addClass("animated " + heading_anim) }); var r = function (e, n, a) { var t = jQuery(".cmp-coming-soon-maintenance #niteoCS_socialmedia").attr("value"); t = jQuery.parseJSON(t), jQuery.each(t, function (t, i) { i.name == e && (i[n] = a) }), jQuery(".cmp-coming-soon-maintenance #niteoCS_socialmedia").attr("value", JSON.stringify(t)) }; if (!/Mobi/.test(navigator.userAgent)) { var s = jQuery(".cmp-coming-soon-maintenance .social-inputs"), c = function (e, n) { var a = s.find('input[type="text"]'); n.item.index(); a.each(function (e, n) { var a = jQuery(n).data("name"); r(a, "order", e) }) }; s.sortable({ stop: c }), s.on("sortchange", c) } function l(e, n, a, t) { var i, o = jQuery("." + e + "-wrapper"), r = jQuery("#add-" + e), s = jQuery("#delete-" + e), c = "", l = e.replace("-", " "); l = l[0].toUpperCase() + l.slice(1), "" != jQuery("#niteoCS-" + e + "-id").val() && s.css("display", "block"), r.click(function (r) { if (r.preventDefault(), u) u.open(); else var u = wp.media({ title: "Select " + l, button: { text: "Insert " + l }, multiple: n, library: { type: [a] } }).on("select", function () { var n = u.state().get("selection").toJSON(); n.length > 0 && (o.find("img").remove(), o.attr("class", e + "-wrapper custom-gallery"), o.addClass("gallery-" + n.length), jQuery(n).each(function (a) { switch (i = n[a].sizes && n[a].sizes.large ? n[a].sizes.large.url : n[a].url, c += (0 === a ? "" : ",") + n[a].id, t) { case "video": o.append('<video width="600" height="400" controls><source src="' + i + '" type="video/mp4">Your browser does not support the video tag.</video>'); break; case "background": o.css("background-image", "url('" + i + "')"); break; case "img": default: n.length > 1 && 0 == a && jQuery("." + e + "-wrapper .big-thumb").length ? jQuery("." + e + "-wrapper .big-thumb").append('<img src="' + i + '" alt=""/>') : n.length > 1 && 0 !== a ? o.append('<img src="' + i + '" alt="" class="no-blur"/>') : o.find(".big-thumb").length ? jQuery("." + e + "-wrapper .big-thumb").append('<img src="' + i + '" alt=""/>') : o.append('<img src="' + i + '" alt=""/>'), jQuery(".blur-range").trigger("input") } }), s.css("display", "block")), jQuery("#niteoCS-" + e + "-id").val(c).trigger("change") }).open() }), s.click(function (n) { jQuery(this).css("display", "none"), o.find("img").remove(), jQuery("#niteoCS-" + e + "-id").val(""), jQuery("#niteoCS-" + e + "-id").trigger("change") }) } function u(e) { jQuery(".cmp-coming-soon-maintenance ." + e).change(function () { var n = jQuery(".cmp-coming-soon-maintenance ." + e + ":checked").val(); n = void 0 === (n = jQuery.isNumeric(n) ? "x" + n : n) ? "off" : n, jQuery(".cmp-coming-soon-maintenance ." + e + "-switch." + n).css("display", "block"), jQuery(".cmp-coming-soon-maintenance ." + e + "-switch:not(." + n + ")").css("display", "none") }), jQuery(".cmp-coming-soon-maintenance ." + e).first().trigger("change") } function m(e) { jQuery(".cmp-coming-soon-maintenance ." + e).change(function () { var n = jQuery("." + e).val(); n = jQuery.isNumeric(n) ? "x" + n : n, jQuery(".cmp-coming-soon-maintenance ." + e + "." + n).css("display", "block"), jQuery(".cmp-coming-soon-maintenance ." + e + ":not(." + n + ")").css("display", "none") }), jQuery("." + e).first().trigger("change") } function p(e, n, a) { jQuery(e).on("input", function () { var e = jQuery(this).val(); "html" === a && jQuery(this).parent().find(n).html(e), "val" === a && jQuery(this).parent().find(n).val(e) }) } jQuery, jQuery.fn.toggleDisabled = function () { return this.each(function () { var e, n = jQuery(this), a = n.data("name"); n.attr("disabled") ? (n.prop("disabled", !1), e = "1") : (n.prop("disabled", !0), e = "0"), r(a, "active", e) }) }, jQuery('.cmp-coming-soon-maintenance .social-inputs input[type="text"]').focusout(function () { var e = jQuery(this).data("name"), n = jQuery(this).val(); r(e, "url", n) }), jQuery('.cmp-coming-soon-maintenance .social-inputs input[type="checkbox"]').click(function (e) { jQuery(this).siblings('input[type="text"]').toggleDisabled() }), jQuery(".cmp-coming-soon-maintenance .social-media i").click(function () { var e = jQuery(this).data("name"); jQuery(this).toggleClass("active"), jQuery(".cmp-coming-soon-maintenance .social-inputs li." + e).toggleClass("active"), jQuery(".cmp-coming-soon-maintenance .social-inputs li." + e + " input").trigger("change"), jQuery(this).hasClass("active") ? r(e, "hidden", "0") : r(e, "hidden", "1"), jQuery(".cmp-coming-soon-maintenance .social-media i.active").length ? jQuery(".social-inputs .label").css("display", "block") : jQuery(".cmp-coming-soon-maintenance .social-inputs .label").css("display", "none") }), jQuery(".cmp-coming-soon-maintenance .social-media i.active").length && jQuery(".cmp-coming-soon-maintenance .social-inputs .label").css("display", "block"), jQuery(".cmp.update-theme").click(function (e) { e.preventDefault(); var n = jQuery(this), a = n.parents(".notice"), t = n.data("security"), i = n.data("slug"), o = n.data("name"), r = { action: "cmp_theme_update_install", security: t, file: { name: i, tmp_name: "", url: jQuery(this).data("remote_url") + "?action=download&slug=" + i } }; a.find(".message").html('<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span class="sr-only">Updating heme...</span><span> working hard on updating Theme...</span>'), jQuery.post(ajaxurl, r, function (e) { if ("success" == (e = e.trim())) setTimeout(function () { a.removeClass("notice-warning").addClass("notice-success"), a.find(".message").html("<span> " + o + ' CMP theme was updated sucessfully! You can enjoy latest features now :) </span><i class="far fa-smile" aria-hidden="true"></i>') }, 1500); else { e = e.slice(0, -1); var n = jQuery("p", jQuery(e)).text(); a.removeClass("notice-warning").addClass("notice-error"), a.find(".message").html('<i class="far fa-frown" aria-hidden="true"></i><span> ' + n + "</span>") } }) }), jQuery(".cmp-coming-soon-maintenance .theme-update.button").one("click", function (e) { e.preventDefault(); var n = jQuery(this), a = n.closest(".theme-wrapper"), t = a.data("security"), i = a.data("slug"), o = { action: "cmp_theme_update_install", security: t, file: { name: i, tmp_name: "", url: a.data("remote_url") + "?action=download&slug=" + i } }; n.html('<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span>Updating..</span>'), jQuery.post(ajaxurl, o, function (e) { "success" == e ? setTimeout(function () { n.html('<i class="far fa-smile" aria-hidden="true"></i><span>Updated!</span>'), setTimeout(function () { n.fadeOut() }, 1500) }, 1500) : (e = e.slice(0, -1), n.html('<i class="far fa-frown" aria-hidden="true"></i><span>Update Failed!</span>')) }) }), jQuery(".cmp-coming-soon-maintenance .theme-details").click(function (e) { e.preventDefault(); var n = jQuery(this).closest(".theme-wrapper"), a = n.data("slug"), t = n.data("version"), i = n.data("type"), o = n.data("purchased"), r = 0, s = { action: "niteo_themeinfo", security: jQuery(".theme-wrapper").data("security"), theme_slug: jQuery(this).parents(".theme-wrapper").data("slug") }; jQuery.post(ajaxurl, s, function (e) { var s = "", c = ""; if ("true" == (e = jQuery.parseJSON(e)).result) { if (jQuery("body").addClass("modal-open"), "1" == o && (c = '<span class="theme-version">Installed version: ' + t + "</span>"), "1" != o && "premium" == i) s = '<button type="button" class="theme-purchase button hide"><a href="' + n.find(".cmp-purchase-theme").attr("href") + '" target="_blank"><i class="fas fa-cart-arrow-down" aria-hidden="true"></i>Get Theme</a></button>'; var l = e.screenshots, u = ""; Object.keys(l).length > 1 && (u = '<div class="screenshots-nav"><div class="left"><i class="fas fa-chevron-left" aria-hidden="true"></i></div><div class="right"><i class="fas fa-chevron-right" aria-hidden="true"></i></div></div>'); var m = jQuery(['<div class="theme-backdrop">', '\t<div class="theme-wrap">', '\t\t<div class="theme-header">', '\t\t\t<button class="close dashicons dashicons-no"><span class="screen-reader-text">Close details dialog</span></button>', "\t\t</div>", '\t\t<div class="theme-about">', '\t\t\t<div class="theme-screenshots">', '\t\t\t\t<div class="screenshot" style="background-image:url(\'' + l[0] + "')\">" + u + "</div>", "\t\t\t</div>", '\t\t\t<div class="theme-info">', '\t\t\t\t<h2 class="theme-name">' + e.name + c + "</h2>", '\t\t\t\t<p class="theme-author">By <a href="' + e.author_homepage + '" target="_blank">' + e.author + "</a></p>", "", s, '\t\t\t\t<div class="theme-description">' + e.description + "</div>", "\t\t\t</div>", "\t\t</div>", '\t\t<div class="theme-actions">', '\t\t\t<a href="https://niteothemes.com/cmp-coming-soon-maintenance/?theme=' + a + "&utm_source=cmp&utm_medium=referral&utm_campaign=" + a + '" class="button cmp-preview" target="_blank" aria-label="Preview ' + e.name + '">Live Preview</a>', "\t\t</div>", "\t</div>", "</div>"].join("\n")); jQuery(".theme-overlay.cmp").append(m), jQuery(".theme-overlay.cmp .close").click(function (e) { e.preventDefault(), jQuery("body").removeClass("modal-open"), jQuery(".theme-overlay.cmp .theme-backdrop").fadeOut("fast") }), jQuery(".screenshots-nav .right").click(function () { ++r == Object.keys(l).length && (r = 0), r in l && jQuery(".screenshot").css("background-image", "url('" + l[r] + "')") }), jQuery(".screenshots-nav .left").click(function () { --r < 0 && (r = Object.keys(l).length - 1), r in l && jQuery(".screenshot").css("background-image", "url('" + l[r] + "')") }) } }) }), jQuery(".cmp-coming-soon-maintenance #connect-mailchimp").click(function (e) { e.preventDefault(); var n = jQuery('.cmp-coming-soon-maintenance input[name="niteoCS_mailchimp_apikey"]').val(), a = jQuery(this).data("security"), t = jQuery(this); if ("" != n) { var i = { apikey: n, security: a }; jQuery(this).prop("disabled", !0), jQuery(this).html('<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span> retrieving lists..</span>'); var o = { action: "cmp_mailchimp_list_ajax", security: a, params: i }; jQuery.post(ajaxurl, o, function (e) { var n = JSON.parse(e); 200 == n.response ? (jQuery("#niteoCS_mailchimp_list").empty().prop("disabled", !1), jQuery.each(n.lists, function (e, n) { jQuery("#niteoCS_mailchimp_list").append('<option value="' + n.id + '">' + n.name + "</option>") })) : jQuery("#niteoCS_mailchimp_list").empty().prop("disabled", !0).html('<option value="error">' + n.message + "</option>").trigger("change"), t.html("Retrieve Lists"), t.prop("disabled", !1) }).fail(function () { t.html("Retrieve Lists"), t.prop("disabled", !1) }) } }), jQuery(".cmp-coming-soon-maintenance .table-wrapper.theme-setup h4").each(function () { if ("Overlay Color" == jQuery(this).html()) return jQuery(this).parents("tr").remove(), !1 }), jQuery(".nav-tab-wrapper").on("click", ".theme-preview", function (e) { return !(jQuery("#csoptions fieldset:not(.skip-preview-validation *)").serialize() != t && !confirm("You have made changes that will not be visible in the preview until you save them. Please save changes first.\nContinue anyway?")) || (e.preventDefault(), !1) }) });
1
+ jQuery(document).ready(function(e){var n=document.location.hash.substring(1),a=jQuery("#csoptions").attr("action"),t=jQuery("#csoptions fieldset:not(.skip-preview-validation *)").serialize();wp.codeEditor&&jQuery("#niteoCS_custom_css").length&&wp.codeEditor.initialize("niteoCS_custom_css"),navtab=function(e){jQuery(".cmp-coming-soon-maintenance .nav-tab-wrapper .nav-tab").removeClass("nav-tab-active"),jQuery(".nav-tab-wrapper ."+e).addClass("nav-tab-active"),jQuery(".cmp-coming-soon-maintenance .table-wrapper."+e).css("display","block"),jQuery(".cmp-coming-soon-maintenance .table-wrapper-css."+e).css("display","block"),jQuery(".cmp-coming-soon-maintenance .comingsoon."+e).css("display","block"),jQuery(".cmp-coming-soon-maintenance .table-wrapper:not(."+e+")").css("display","none"),jQuery(".cmp-coming-soon-maintenance .table-wrapper-css:not(."+e).css("display","none"),jQuery(".cmp-coming-soon-maintenance .comingsoon:not(."+e+")").css("display","none"),"install"==e?(jQuery(".cmp-coming-soon-maintenance .submit").css("display","none"),jQuery(".cmp-coming-soon-maintenance #csoptions").attr("action",a)):(jQuery(".cmp-coming-soon-maintenance .submit").css("display","block"),jQuery(".cmp-coming-soon-maintenance #csoptions").attr("action",a+"#"+e))},""!=n?navtab(n):jQuery(".cmp-coming-soon-maintenance .table-wrapper-css").css("display","none"),window.onhashchange=function(){n=document.location.hash.substring(1),navtab(n)},jQuery(".cmp-coming-soon-maintenance .nav-tab:not(.theme-preview):not(.advanced)").click(function(e){e.preventDefault(),n=jQuery(this).data("tab"),document.location.hash=n}),p(".cmp-coming-soon-maintenance .blur-range","span","html"),p(".cmp-coming-soon-maintenance .background-overlay-opacity","span","html"),p("#logo_size_slider","#niteoCS_logo_size","val"),p("#niteoCS_logo_size","#logo_size_slider","val"),l("logo",!1,"image","img"),l("favicon",!1,"image","img"),l("seo_img",!1,"image","img"),l("images",!0,"image","img"),l("mobile-images",!0,"image","img"),l("pattern",!1,"image","background"),l("video-thumb",!1,"image","img"),l("video-local",!1,"video","video"),l("subs-img",!1,"image","img"),l("avatar",!1,"image","img"),l("gallery",!0,"image","img"),u("analytics"),u("contact-form"),u("subscribe"),u("background-effect"),u("special-effect"),u("cmp-logo"),u("background-type"),u("counter"),u("progress-bar"),u("overlay-text"),u("cmp-logo-size"),u("recaptcha-toggle"),u("login-icon"),u("custom-mobile-imgs"),u("lang-switcher"),m("counter-action"),m("subscribe-method"),m("background-overlay"),m("banner-video-source"),m("progress-bar-type"),jQuery(".cmp-coming-soon-maintenance select:not(.headings-google-font):not(.content-google-font )").select2({width:"100%",minimumResultsForSearch:-1,placeholder:"Click to select.."}),jQuery(".cmp-coming-soon-maintenance #cmp-status").click(function(){jQuery(".cmp-coming-soon-maintenance .cmp-status input[type=radio]").prop("disabled",function(e,n){return!n}),jQuery("#cmp-toggle-adminbar").toggleClass("status-1"),jQuery(".cmp-status-pages").fadeToggle()}),jQuery(".cmp-status-pages input[type=radio]").change(function(){jQuery(".cmp-status-pages input[type=radio]").parent().removeClass("active"),jQuery(this).parent().addClass("active")}),jQuery(".cmp-coming-soon-maintenance .cmp-status.switch:not(.disabled)").click(function(){if(0!=jQuery(".cmp-coming-soon-maintenance #cmp-status").prop("checked")){var e=jQuery(this).children("input");e.prop("checked",!0),jQuery(".cmp-coming-soon-maintenance .cmp-status.switch").removeClass("active"),jQuery(this).addClass("active"),e.trigger("change"),"3"==e.val()?jQuery(".cmp-coming-soon-maintenance .redirect-inputs").fadeIn("fast"):jQuery(".cmp-coming-soon-maintenance .redirect-inputs").fadeOut("fast")}}),jQuery(".cmp-coming-soon-maintenance .table-wrapper h3").click(function(){jQuery(this).parent().toggleClass("closed")}),jQuery(".cmp-coming-soon-maintenance #test-unsplash").click(function(e){e.preventDefault();var n=jQuery(".cmp-coming-soon-maintenance #unsplash-media"),a=jQuery('.cmp-coming-soon-maintenance .unsplash_banner select[name^="unsplash_feed"] option:selected').val(),t="",i=jQuery(this).data("security");if(0==a){switch(a){case"0":t=jQuery(".cmp-coming-soon-maintenance #niteoCS-unsplash-0").val()}if(3==a||""!=t){var o={feed:a,url:t,feat:"",custom_str:""};jQuery(this).prop("disabled",!0),jQuery(this).html('<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span> loading..</span>');var r={action:"niteo_unsplash",security:i,params:o};jQuery.post(ajaxurl,r,function(e){var a=JSON.parse(e);jQuery("#unsplash_img").remove();var t=setTimeout(function(){jQuery("#test-unsplash").prop("disabled",!1),jQuery("#test-unsplash").text("Display Unsplash Photo"),jQuery("#unsplash-media").html('<p>It seems <a href="https://status.unsplash.com/" target="_blank">Unsplash API</a> is not responding. Please try again later.</p>')},5e3);if("200"==a.response){if((a=jQuery.parseJSON(a.body))[0])var i=a[0].urls.raw+"?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&fit=max&w=588",o=a[0].user.name,r=a[0].user.links.html,s=a[0].links.html,c=a[0].id;else i=a.urls.raw+"?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&fit=max&w=588",o=a.user.name,r=a.user.links.html,s=a.links.html,c=a.id;jQuery("<img />",{src:i,id:"unsplash_img"}).one("load",function(){jQuery(this).appendTo(n),jQuery(this).fadeIn(),jQuery("#test-unsplash").prop("disabled",!1),jQuery("#test-unsplash").text("Display Unsplash Photo"),jQuery(".unsplash-id").html('<a href="'+s+'" target="_blank">Photo</a> (ID: '+c+') by <a href="'+r+'" target="_blank">'+o+'</a> / <a href="https://unsplash.com/" target="_blank">Unsplash</a>'),jQuery(".blur-range").trigger("input"),clearTimeout(t)})}else jQuery(".cmp-coming-soon-maintenance #test-unsplash").prop("disabled",!1),jQuery(".cmp-coming-soon-maintenance #test-unsplash").text("Display Unsplash Photo"),jQuery(".cmp-coming-soon-maintenance #unsplash-media").html("<p>Error "+a.response+': <span style="text-transform:lowercase;">'+JSON.parse(a.body).errors+"</span></p>"),clearTimeout(t)})}else jQuery(".cmp-coming-soon-maintenance #unsplash_img").remove()}}),videoPreview=function(){if("5"==jQuery(".cmp-coming-soon-maintenance .background-type:checked").val()){var e=jQuery(".cmp-coming-soon-maintenance .banner-video-source").val();if("youtube"==e){var n=jQuery(".cmp-coming-soon-maintenance #niteoCS-youtube-url").val();if(""!=n){var a=n.match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/);if(a&&11==a[7].length){jQuery(".cmp-coming-soon-maintenance .video-yt-wrapper .video-yt-thumb-wrapper").html("");var t="https://img.youtube.com/vi/"+a[7]+"/maxresdefault.jpg";jQuery(".cmp-coming-soon-maintenance .video-yt-wrapper .video-yt-thumb-wrapper").append('<img src="'+t+'" alt=""/>'),jQuery(".cmp-coming-soon-maintenance .blur-range").trigger("input")}else jQuery(".cmp-coming-soon-maintenance .video-yt-wrapper .video-yt-thumb-wrapper").html("")}}if("local"==e){var i=jQuery("#niteoCS-video-local-id").data("url");""!=i&&jQuery(".cmp-coming-soon-maintenance .video-local-wrapper").html('<video width="600" height="400" controls><source src="'+i+'" type="video/mp4">Your browser does not support the video tag.</video>')}}},videoPreview(),jQuery(".cmp-coming-soon-maintenance .background-type").on("change",function(){videoPreview()}),jQuery(".cmp-coming-soon-maintenance #niteoCS-youtube-url").on("keyup",function(){videoPreview()}),jQuery(".cmp-coming-soon-maintenance .banner-video-source").on("change",function(){videoPreview()});var i=jQuery('.unsplash_banner select[name^="unsplash_feed"] option:selected').val();function o(e){switch(e){case"solid-color":jQuery(".thumbnail-overlay").css("background",jQuery("#niteoCS_overlay_color").val());break;case"gradient":jQuery(".cmp-coming-soon-maintenance select.overlay-gradient").trigger("change");break;case"disabled":jQuery(".cmp-coming-soon-maintenance .thumbnail-overlay").css("background","none")}}jQuery(".unsplash-feed-"+i).css("display","block"),jQuery('.unsplash_banner select[name^="unsplash_feed"]').on("change",function(){i=jQuery('.unsplash_banner select[name^="unsplash_feed"] option:selected').val(),jQuery(".unsplash-feed").css("display","none"),jQuery(".unsplash-feed-"+i).css("display","block"),jQuery("#test-unsplash").trigger("click")}),1==jQuery("#csoptions .niteoCS_banner:checked").val()&&jQuery("#test-unsplash").trigger("click"),jQuery(".cmp-coming-soon-maintenance select.background-gradient").on("change",function(){var e=jQuery(".cmp-coming-soon-maintenance select.background-gradient option:selected").val();"custom"==e?(jQuery(".cmp-coming-soon-maintenance .custom-gradient").css("display","block"),jQuery(".cmp-coming-soon-maintenance .gradient-preview").css({background:"-moz-linear-gradient(-45deg, "+jQuery("#niteoCS_gradient_one").val()+" 0%, "+jQuery("#niteoCS_gradient_two").val()+" 100%)",background:"-webkit-linear-gradient(-45deg, "+jQuery("#niteoCS_gradient_one").val()+" 0%, "+jQuery("#niteoCS_gradient_two").val()+" 100%)",background:"linear-gradient(135deg, "+jQuery("#niteoCS_gradient_one").val()+" 0%, "+jQuery("#niteoCS_gradient_two").val()+" 100%)"})):(colors=e.split(":"),jQuery(".cmp-coming-soon-maintenance .custom-gradient").css("display","none"),jQuery(".cmp-coming-soon-maintenance .gradient-preview").css({background:"-moz-linear-gradient(-45deg, "+colors[0]+" 0%, "+colors[1]+" 100%)",background:"-webkit-linear-gradient(-45deg, "+colors[0]+" 0%, "+colors[1]+" 100%)",background:"linear-gradient(135deg, "+colors[0]+" 0%, "+colors[1]+" 100%)"}))}).trigger("change"),jQuery(".cmp-coming-soon-maintenance #niteoCS_banner_color").wpColorPicker({change:function(e,n){jQuery(".color-preview").css("background-color",n.color.toString())}}),jQuery(".cmp-coming-soon-maintenance #niteoCS_gradient_one").wpColorPicker({change:function(e,n){jQuery(".gradient-preview").css({background:"-moz-linear-gradient(-45deg, "+n.color.toString()+" 0%, "+jQuery("#niteoCS_gradient_two").val()+" 100%)",background:"-webkit-linear-gradient(-45deg, "+n.color.toString()+" 0%, "+jQuery("#niteoCS_gradient_two").val()+" 100%)",background:"linear-gradient(135deg, "+n.color.toString()+" 0%, "+jQuery("#niteoCS_gradient_two").val()+" 100%)"})}}),jQuery(".cmp-coming-soon-maintenance #niteoCS_gradient_two").wpColorPicker({change:function(e,n){jQuery(".gradient-preview").css({background:"-moz-linear-gradient(-45deg, "+jQuery("#niteoCS_gradient_one").val()+" 0%, "+n.color.toString()+" 100%)",background:"-webkit-linear-gradient(-45deg, "+jQuery("#niteoCS_gradient_one").val()+" 0%, "+n.color.toString()+" 100%)",background:"linear-gradient(135deg, "+jQuery("#niteoCS_gradient_one").val()+" 0%, "+n.color.toString()+" 100%)"})}}),jQuery(".cmp-coming-soon-maintenance #niteoCS_overlay_color").wpColorPicker({change:function(e,n){jQuery(".thumbnail-overlay").css("background",n.color.toString())}}),jQuery(".cmp-coming-soon-maintenance .thumbnail-overlay").css("background",jQuery("#niteoCS_overlay_color").val()),jQuery(".cmp-coming-soon-maintenance select.overlay-gradient").on("change",function(){var e=jQuery("select.overlay-gradient option:selected").val();if("custom"==e){jQuery(".cmp-coming-soon-maintenance .custom-overlay-gradient").css("display","block");var n=jQuery("#niteoCS_overlay_gradient_one").val(),a=jQuery("#niteoCS_overlay_gradient_two").val();jQuery(".cmp-coming-soon-maintenance .thumbnail-overlay").css({background:"-moz-linear-gradient(-45deg, "+n+" 0%, "+a+" 100%)",background:"-webkit-linear-gradient(-45deg, "+n+" 0%, "+a+" 100%)",background:"linear-gradient(135deg, "+n+" 0%, "+a+" 100%)"})}else colors=e.split(":"),jQuery(".cmp-coming-soon-maintenance .custom-overlay-gradient").css("display","none"),jQuery(".cmp-coming-soon-maintenance .thumbnail-overlay").css({background:"-moz-linear-gradient(-45deg, "+colors[0]+" 0%, "+colors[1]+" 100%)",background:"-webkit-linear-gradient(-45deg, "+colors[0]+" 0%, "+colors[1]+" 100%)",background:"linear-gradient(135deg, "+colors[0]+" 0%, "+colors[1]+" 100%)"})}),jQuery("#niteoCS_overlay_gradient_one").wpColorPicker({change:function(e,n){jQuery(".thumbnail-overlay").css({background:"-moz-linear-gradient(-45deg, "+n.color.toString()+" 0%, "+jQuery("#niteoCS_overlay_gradient_two").val()+" 100%)",background:"-webkit-linear-gradient(-45deg, "+n.color.toString()+" 0%, "+jQuery("#niteoCS_overlay_gradient_two").val()+" 100%)",background:"linear-gradient(135deg, "+n.color.toString()+" 0%, "+jQuery("#niteoCS_overlay_gradient_two").val()+" 100%)"})}}),jQuery("#niteoCS_overlay_gradient_two").wpColorPicker({change:function(e,n){jQuery(".thumbnail-overlay").css({background:"-moz-linear-gradient(-45deg, "+jQuery("#niteoCS_overlay_gradient_one").val()+" 0%, "+n.color.toString()+" 100%)",background:"-webkit-linear-gradient(-45deg, "+jQuery("#niteoCS_overlay_gradient_one").val()+" 0%, "+n.color.toString()+" 100%)",background:"linear-gradient(135deg, "+jQuery("#niteoCS_overlay_gradient_one").val()+" 0%, "+n.color.toString()+" 100%)"})}}),jQuery(".background-overlay-opacity").on("input",function(){var e=jQuery(this).val();jQuery(".thumbnail-overlay").css("opacity",e)}).trigger("input"),o(jQuery(".cmp-coming-soon-maintenance .background-overlay").val()),jQuery(".cmp-coming-soon-maintenance .background-overlay").on("change",function(){o(jQuery(this).val())}),jQuery(".cmp-coming-soon-maintenance .blur-range").on("input",function(){var e=jQuery(this).val();jQuery(".cmp-coming-soon-maintenance .background-thumb-wrapper img:not(.no-blur)").css("filter","blur("+e+"px)")}).trigger("input"),jQuery('.cmp-coming-soon-maintenance select[name^="niteoCS_banner_pattern"]').on("change",function(){var e=jQuery('.cmp-coming-soon-maintenance select[name^="niteoCS_banner_pattern"] option:selected').val();if("custom"!=e){var n=jQuery(this).data("url");jQuery(".cmp-coming-soon-maintenance #add-pattern").css("display","none"),jQuery(".cmp-coming-soon-maintenance .pattern-wrapper").css("background-image","url('"+n+e+".png')")}else{n=jQuery(".cmp-coming-soon-maintenance #niteoCS_banner_pattern_custom").val();jQuery(".cmp-coming-soon-maintenance #add-pattern").css("display","block"),jQuery(".cmp-coming-soon-maintenance .pattern-wrapper").css("background-image","url('"+n+"')")}}),jQuery(".cmp-coming-soon-maintenance .heading-animation").on("change",function(){heading_anim=jQuery(".cmp-coming-soon-maintenance .heading-animation option:selected").val(),jQuery(".cmp-coming-soon-maintenance #heading-example").removeClass().addClass("animated "+heading_anim)}),jQuery(".cmp-coming-soon-maintenance .content-animation").on("change",function(){heading_anim=jQuery(".cmp-coming-soon-maintenance .content-animation option:selected").val(),jQuery(".cmp-coming-soon-maintenance #content-example").removeClass().addClass("animated "+heading_anim)});var r=function(e,n,a){var t=jQuery(".cmp-coming-soon-maintenance #niteoCS_socialmedia").attr("value");t=jQuery.parseJSON(t),jQuery.each(t,function(t,i){i.name==e&&(i[n]=a)}),jQuery(".cmp-coming-soon-maintenance #niteoCS_socialmedia").attr("value",JSON.stringify(t))};if(!/Mobi/.test(navigator.userAgent)){var s=jQuery(".cmp-coming-soon-maintenance .social-inputs"),c=function(e,n){var a=s.find('input[type="text"]');n.item.index();a.each(function(e,n){var a=jQuery(n).data("name");r(a,"order",e)})};s.sortable({stop:c}),s.on("sortchange",c)}function l(e,n,a,t){var i,o=jQuery("."+e+"-wrapper"),r=jQuery("#add-"+e),s=jQuery("#delete-"+e),c="",l=e.replace("-"," ");l=l[0].toUpperCase()+l.slice(1),""!=jQuery("#niteoCS-"+e+"-id").val()&&s.css("display","block"),r.click(function(r){if(r.preventDefault(),u)u.open();else var u=wp.media({title:"Select "+l,button:{text:"Insert "+l},multiple:n,library:{type:[a]}}).on("select",function(){var n=u.state().get("selection").toJSON();n.length>0&&(o.find("img").remove(),o.attr("class",e+"-wrapper custom-gallery"),o.addClass("gallery-"+n.length),jQuery(n).each(function(a){switch(i=n[a].sizes&&n[a].sizes.large?n[a].sizes.large.url:n[a].url,c+=(0===a?"":",")+n[a].id,t){case"video":o.append('<video width="600" height="400" controls><source src="'+i+'" type="video/mp4">Your browser does not support the video tag.</video>');break;case"background":o.css("background-image","url('"+i+"')");break;case"img":default:n.length>1&&0==a&&jQuery("."+e+"-wrapper .big-thumb").length?jQuery("."+e+"-wrapper .big-thumb").append('<img src="'+i+'" alt=""/>'):n.length>1&&0!==a?o.append('<img src="'+i+'" alt="" class="no-blur"/>'):o.find(".big-thumb").length?jQuery("."+e+"-wrapper .big-thumb").append('<img src="'+i+'" alt=""/>'):o.append('<img src="'+i+'" alt=""/>'),jQuery(".blur-range").trigger("input")}}),s.css("display","block")),jQuery("#niteoCS-"+e+"-id").val(c).trigger("change")}).open()}),s.click(function(n){jQuery(this).css("display","none"),o.find("img").remove(),jQuery("#niteoCS-"+e+"-id").val(""),jQuery("#niteoCS-"+e+"-id").trigger("change")})}function u(e){jQuery(".cmp-coming-soon-maintenance ."+e).change(function(){var n=jQuery(".cmp-coming-soon-maintenance ."+e+":checked").val();n=void 0===(n=jQuery.isNumeric(n)?"x"+n:n)?"off":n,jQuery(".cmp-coming-soon-maintenance ."+e+"-switch."+n).css("display","block"),jQuery(".cmp-coming-soon-maintenance ."+e+"-switch:not(."+n+")").css("display","none")}),jQuery(".cmp-coming-soon-maintenance ."+e).first().trigger("change")}function m(e){jQuery(".cmp-coming-soon-maintenance ."+e).change(function(){var n=jQuery("."+e).val();n=jQuery.isNumeric(n)?"x"+n:n,jQuery(".cmp-coming-soon-maintenance ."+e+"."+n).css("display","block"),jQuery(".cmp-coming-soon-maintenance ."+e+":not(."+n+")").css("display","none")}),jQuery("."+e).first().trigger("change")}function p(e,n,a){jQuery(e).on("input",function(){var e=jQuery(this).val();"html"===a&&jQuery(this).parent().find(n).html(e),"val"===a&&jQuery(this).parent().find(n).val(e)})}jQuery,jQuery.fn.toggleDisabled=function(){return this.each(function(){var e,n=jQuery(this),a=n.data("name");n.attr("disabled")?(n.prop("disabled",!1),e="1"):(n.prop("disabled",!0),e="0"),r(a,"active",e)})},jQuery('.cmp-coming-soon-maintenance .social-inputs input[type="text"]').focusout(function(){var e=jQuery(this).data("name"),n=jQuery(this).val();r(e,"url",n)}),jQuery('.cmp-coming-soon-maintenance .social-inputs input[type="checkbox"]').click(function(e){jQuery(this).siblings('input[type="text"]').toggleDisabled()}),jQuery(".cmp-coming-soon-maintenance .social-media i").click(function(){var e=jQuery(this).data("name");jQuery(this).toggleClass("active"),jQuery(".cmp-coming-soon-maintenance .social-inputs li."+e).toggleClass("active"),jQuery(".cmp-coming-soon-maintenance .social-inputs li."+e+" input").trigger("change"),jQuery(this).hasClass("active")?r(e,"hidden","0"):r(e,"hidden","1"),jQuery(".cmp-coming-soon-maintenance .social-media i.active").length?jQuery(".social-inputs .label").css("display","block"):jQuery(".cmp-coming-soon-maintenance .social-inputs .label").css("display","none")}),jQuery(".cmp-coming-soon-maintenance .social-media i.active").length&&jQuery(".cmp-coming-soon-maintenance .social-inputs .label").css("display","block"),jQuery(".cmp.update-theme").click(function(e){e.preventDefault();var n=jQuery(this),a=n.parents(".notice"),t=n.data("security"),i=n.data("slug"),o=n.data("name"),r={action:"cmp_theme_update_install",security:t,file:{name:i,tmp_name:"",url:jQuery(this).data("remote_url")+"?action=download&slug="+i}};a.find(".message").html('<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span class="sr-only">Updating heme...</span><span> working hard on updating Theme...</span>'),jQuery.post(ajaxurl,r,function(e){if("success"==(e=e.trim()))setTimeout(function(){a.removeClass("notice-warning").addClass("notice-success"),a.find(".message").html("<span> "+o+' CMP theme was updated sucessfully! You can enjoy latest features now :) </span><i class="far fa-smile" aria-hidden="true"></i>')},1500);else{e=e.slice(0,-1);var n=jQuery("p",jQuery(e)).text();a.removeClass("notice-warning").addClass("notice-error"),a.find(".message").html('<i class="far fa-frown" aria-hidden="true"></i><span> '+n+"</span>")}})}),jQuery(".cmp-coming-soon-maintenance .theme-update.button").one("click",function(e){e.preventDefault();var n=jQuery(this),a=n.closest(".theme-wrapper"),t=a.data("security"),i=a.data("slug"),o={action:"cmp_theme_update_install",security:t,file:{name:i,tmp_name:"",url:a.data("remote_url")+"?action=download&slug="+i}};n.html('<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span>Updating..</span>'),jQuery.post(ajaxurl,o,function(e){"success"==e?setTimeout(function(){n.html('<i class="far fa-smile" aria-hidden="true"></i><span>Updated!</span>'),setTimeout(function(){n.fadeOut()},1500)},1500):(e=e.slice(0,-1),n.html('<i class="far fa-frown" aria-hidden="true"></i><span>Update Failed!</span>'))})}),jQuery(".cmp-coming-soon-maintenance .theme-details").click(function(e){e.preventDefault();var n=jQuery(this).closest(".theme-wrapper"),a=n.data("slug"),t=n.data("version"),i=n.data("type"),o=n.data("purchased"),r=0,s={action:"niteo_themeinfo",security:jQuery(".theme-wrapper").data("security"),theme_slug:jQuery(this).parents(".theme-wrapper").data("slug")};jQuery.post(ajaxurl,s,function(e){var s="",c="";if("true"==(e=jQuery.parseJSON(e)).result){if(jQuery("body").addClass("modal-open"),"1"==o&&(c='<span class="theme-version">Installed version: '+t+"</span>"),"1"!=o&&"premium"==i)s='<button type="button" class="theme-purchase button hide"><a href="'+n.find(".cmp-purchase-theme").attr("href")+'" target="_blank"><i class="fas fa-cart-arrow-down" aria-hidden="true"></i>Get Theme</a></button>';var l=e.screenshots,u="";Object.keys(l).length>1&&(u='<div class="screenshots-nav"><div class="left"><i class="fas fa-chevron-left" aria-hidden="true"></i></div><div class="right"><i class="fas fa-chevron-right" aria-hidden="true"></i></div></div>');var m=jQuery(['<div class="theme-backdrop">','\t<div class="theme-wrap">','\t\t<div class="theme-header">','\t\t\t<button class="close dashicons dashicons-no"><span class="screen-reader-text">Close details dialog</span></button>',"\t\t</div>",'\t\t<div class="theme-about">','\t\t\t<div class="theme-screenshots">','\t\t\t\t<div class="screenshot" style="background-image:url(\''+l[0]+"')\">"+u+"</div>","\t\t\t</div>",'\t\t\t<div class="theme-info">','\t\t\t\t<h2 class="theme-name">'+e.name+c+"</h2>",'\t\t\t\t<p class="theme-author">By <a href="'+e.author_homepage+'" target="_blank">'+e.author+"</a></p>","",s,'\t\t\t\t<div class="theme-description">'+e.description+"</div>","\t\t\t</div>","\t\t</div>",'\t\t<div class="theme-actions">','\t\t\t<a href="https://niteothemes.com/cmp-coming-soon-maintenance/?theme='+a+"&utm_source=cmp&utm_medium=referral&utm_campaign="+a+'" class="button cmp-preview" target="_blank" aria-label="Preview '+e.name+'">Live Preview</a>',"\t\t</div>","\t</div>","</div>"].join("\n"));jQuery(".theme-overlay.cmp").append(m),jQuery(".theme-overlay.cmp .close").click(function(e){e.preventDefault(),jQuery("body").removeClass("modal-open"),jQuery(".theme-overlay.cmp .theme-backdrop").fadeOut("fast")}),jQuery(".screenshots-nav .right").click(function(){++r==Object.keys(l).length&&(r=0),r in l&&jQuery(".screenshot").css("background-image","url('"+l[r]+"')")}),jQuery(".screenshots-nav .left").click(function(){--r<0&&(r=Object.keys(l).length-1),r in l&&jQuery(".screenshot").css("background-image","url('"+l[r]+"')")})}})}),jQuery(".cmp-coming-soon-maintenance #connect-mailchimp").click(function(e){e.preventDefault();var n=jQuery('.cmp-coming-soon-maintenance input[name="niteoCS_mailchimp_apikey"]').val(),a=jQuery(this).data("security"),t=jQuery(this);if(""!=n){var i={apikey:n,security:a};jQuery(this).prop("disabled",!0),jQuery(this).html('<i class="fas fa-cog fa-spin fa-1x fa-fw"></i><span> retrieving lists..</span>');var o={action:"cmp_mailchimp_list_ajax",security:a,params:i};jQuery.post(ajaxurl,o,function(e){var n=JSON.parse(e);200==n.response?(jQuery("#niteoCS_mailchimp_list").empty().prop("disabled",!1),jQuery.each(n.lists,function(e,n){jQuery("#niteoCS_mailchimp_list").append('<option value="'+n.id+'">'+n.name+"</option>")})):jQuery("#niteoCS_mailchimp_list").empty().prop("disabled",!0).html('<option value="error">'+n.message+"</option>").trigger("change"),t.html("Retrieve Lists"),t.prop("disabled",!1)}).fail(function(){t.html("Retrieve Lists"),t.prop("disabled",!1)})}}),jQuery(".cmp-coming-soon-maintenance .table-wrapper.theme-setup h4").each(function(){if("Overlay Color"==jQuery(this).html())return jQuery(this).parents("tr").remove(),!1}),jQuery(".nav-tab-wrapper").on("click",".theme-preview",function(e){return!(jQuery("#csoptions fieldset:not(.skip-preview-validation *)").serialize()!=t&&!confirm("You have made changes that will not be visible in the preview until you save them. Please save changes first.\nContinue anyway?"))||(e.preventDefault(),!1)})});
niteo-cmp.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: CMP - Coming Soon & Maintenance Plugin
4
  Plugin URI: https://wordpress.org/plugins/cmp-coming-soon-maintenance/
5
  Description: Display customizable landing page for Coming Soon, Maintenance & Under Construction page.
6
- Version: 3.9.2
7
  Author: NiteoThemes
8
  Author URI: https://www.niteothemes.com
9
  Text Domain: cmp-coming-soon-maintenance
@@ -63,7 +63,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
63
 
64
  // define constants
65
  private function constants() {
66
- $this->define( 'CMP_VERSION', '3.9.2' );
67
  $this->define( 'CMP_DEBUG', FALSE );
68
  $this->define( 'CMP_AUTHOR', 'NiteoThemes' );
69
  $this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
@@ -455,6 +455,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
455
  public function cmp_premium_themes() {
456
 
457
  $premium_themes = array();
 
458
  array_push( $premium_themes, array('name' => 'scout', 'url' => 'https://niteothemes.com/downloads/cmp-scout-theme/?utm_source=cmp&utm_medium=referral&utm_campaign=scout', 'price' => '10') );
459
  array_push( $premium_themes, array('name' => 'atlas', 'url' => 'https://niteothemes.com/downloads/cmp-atlas-theme/?utm_source=cmp&utm_medium=referral&utm_campaign=atlas', 'price' => '12') );
460
  array_push( $premium_themes, array('name' => 'mosaic', 'url' => 'https://niteothemes.com/downloads/cmp-mosaic-theme/?utm_source=cmp&utm_medium=referral&utm_campaign=mosaic', 'price' => '10') );
3
  Plugin Name: CMP - Coming Soon & Maintenance Plugin
4
  Plugin URI: https://wordpress.org/plugins/cmp-coming-soon-maintenance/
5
  Description: Display customizable landing page for Coming Soon, Maintenance & Under Construction page.
6
+ Version: 3.9.3
7
  Author: NiteoThemes
8
  Author URI: https://www.niteothemes.com
9
  Text Domain: cmp-coming-soon-maintenance
63
 
64
  // define constants
65
  private function constants() {
66
+ $this->define( 'CMP_VERSION', '3.9.3' );
67
  $this->define( 'CMP_DEBUG', FALSE );
68
  $this->define( 'CMP_AUTHOR', 'NiteoThemes' );
69
  $this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
455
  public function cmp_premium_themes() {
456
 
457
  $premium_themes = array();
458
+ array_push( $premium_themes, array('name' => 'saturn', 'url' => 'https://niteothemes.com/downloads/cmp-saturn-theme/?utm_source=cmp&utm_medium=referral&utm_campaign=saturn', 'price' => '12') );
459
  array_push( $premium_themes, array('name' => 'scout', 'url' => 'https://niteothemes.com/downloads/cmp-scout-theme/?utm_source=cmp&utm_medium=referral&utm_campaign=scout', 'price' => '10') );
460
  array_push( $premium_themes, array('name' => 'atlas', 'url' => 'https://niteothemes.com/downloads/cmp-atlas-theme/?utm_source=cmp&utm_medium=referral&utm_campaign=atlas', 'price' => '12') );
461
  array_push( $premium_themes, array('name' => 'mosaic', 'url' => 'https://niteothemes.com/downloads/cmp-mosaic-theme/?utm_source=cmp&utm_medium=referral&utm_campaign=mosaic', 'price' => '10') );
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: coming soon, coming soon page, launch page, maintenance mode, under constr
5
  Requires at least: 3.0
6
  Requires PHP: 5.6
7
  Tested up to: 5.6
8
- Stable tag: 3.9.2
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -159,6 +159,12 @@ https://www.youtube.com/watch?v=uxuJfHzwdtE
159
  <h4>I really love your plugin and I want to support it!</h4>
160
  <p>Nothing is better than a good feedback! Please go to <a href="https://wordpress.org/support/plugin/cmp-coming-soon-maintenance/reviews/">Plugin reviews</a> and rate it! Alternatively you can click on a Donate button too!:)</p>
161
 
 
 
 
 
 
 
162
  == Changelog ==
163
  <h4>CMP 3.9.2 - 28-Nov-20</h4>
164
  <ul>
5
  Requires at least: 3.0
6
  Requires PHP: 5.6
7
  Tested up to: 5.6
8
+ Stable tag: 3.9.3
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
159
  <h4>I really love your plugin and I want to support it!</h4>
160
  <p>Nothing is better than a good feedback! Please go to <a href="https://wordpress.org/support/plugin/cmp-coming-soon-maintenance/reviews/">Plugin reviews</a> and rate it! Alternatively you can click on a Donate button too!:)</p>
161
 
162
+ == Changelog ==
163
+ <h4>CMP 3.9.3 - 17-Dec-20</h4>
164
+ <ul>
165
+ <li>New CMP Theme: Saturn</li>
166
+ </ul>
167
+
168
  == Changelog ==
169
  <h4>CMP 3.9.2 - 28-Nov-20</h4>
170
  <ul>
themes/saturn.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*
2
+ Theme Name: Saturn
3
+ Description: <p>CMP Saturn is designed as a coming soon and a maintenance page for your website. Main aspect of the template are the three photos floating thumbnails. If you are a manufacturer of products, you own an e-shop, you are a designer or a photographer, this template is exactly for you. Add a profile photo, your logo, title, information, social icons and a modern "floating" gallery.</p><h4>Main Features</h4><ul><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Avatar and custom Info</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Custom Floating Gallery</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Custom Logo</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Custom Content</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Graphic Background including videos</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Countdown Timer</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Subscribe Form</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Social Media</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Custom Colors</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Custom Fonts</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Background Blur Effect</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Fade in/out Text Effects</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Background Special Effects</li><li class="supported"><i class="far fa-check-square" aria-hidden="true"></i> Responsive Design</li><li class="not-supported"><i class="fas fa-times" aria-hidden="true"></i> Graphic Image Slider</li></ul>