Slider by WD – Responsive Slider - Version 1.2.14

Version Description

  • Fixed: Add shortcode functionality on Beaver, Elementor, SiteOrigin and Visual Composer builders.
  • Fixed: Set/Reset watermark functionality.
  • Fixed: Conflict with Fast Velocity Minify plugin with minified js.
Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 Slider by WD – Responsive Slider
Version 1.2.14
Comparing to
See all releases

Code changes from version 1.2.13 to 1.2.14

admin/controllers/Sliders.php CHANGED
@@ -74,7 +74,6 @@ class SlidersController_wds {
74
  */
75
  public function execute() {
76
  $task = WDW_S_Library::get('task');
77
- $action = WDW_S_Library::get('bulk_action', -1);
78
  $id = (int) WDW_S_Library::get('current_id', 0);
79
  if ( method_exists($this, $task) ) {
80
  if ( $task != 'edit' && $task != 'display' ) {
@@ -176,15 +175,12 @@ class SlidersController_wds {
176
  $this->view->display( $params );
177
  }
178
 
179
- /**
180
- * Edit.
181
- *
182
- * @param $id
183
- * @param bool $bulk
184
- * @param bool $all
185
- *
186
- * @return int
187
- */
188
  public function edit( $id = 0, $reset = FALSE ) {
189
  $row = $this->model->get_row_data($id, $reset);
190
  if ( $id != 0 && empty($row->id) ) {
@@ -224,11 +220,11 @@ class SlidersController_wds {
224
  $this->view->edit( $params );
225
  }
226
 
227
- /**
228
- * Apply.
229
- *
230
- * @param int $id
231
- */
232
  public function apply( $id = 0 ) {
233
  $save = $this->save_slider_db();
234
  $id = $save['id'];
@@ -238,15 +234,15 @@ class SlidersController_wds {
238
  $this->edit( $id );
239
  }
240
 
241
- /**
242
- * Publish.
243
- *
244
- * @param $id
245
- * @param bool $bulk
246
- * @param bool $all
247
- *
248
- * @return int
249
- */
250
  public function publish( $id = 0, $bulk = FALSE, $all = FALSE ) {
251
  $message = $this->model->publish($id, $all);
252
  if ( $bulk ) {
@@ -260,15 +256,15 @@ class SlidersController_wds {
260
  ), admin_url('admin.php')));
261
  }
262
 
263
- /**
264
- * Unpublish.
265
- *
266
- * @param $id
267
- * @param bool $bulk
268
- * @param bool $all
269
- *
270
- * @return int
271
- */
272
  public function unpublish( $id = 0, $bulk = FALSE, $all = FALSE ) {
273
  $message = $this->model->unpublish( $id, $all );
274
  if ( $bulk ) {
@@ -282,15 +278,15 @@ class SlidersController_wds {
282
  ), admin_url('admin.php')));
283
  }
284
 
285
- /**
286
- * Delete.
287
- *
288
- * @param $id
289
- * @param bool $bulk
290
- * @param bool $all
291
- *
292
- * @return int
293
- */
294
  public function delete( $id = 0, $bulk = FALSE, $all = FALSE ) {
295
  $message = $this->model->delete($id, $all);
296
  if ( $bulk ) {
@@ -304,15 +300,15 @@ class SlidersController_wds {
304
  ), admin_url('admin.php')));
305
  }
306
 
307
- /**
308
- * Duplicate.
309
- *
310
- * @param $id
311
- * @param bool $bulk
312
- * @param bool $all
313
- *
314
- * @return int
315
- */
316
  public function duplicate( $id = 0, $bulk = FALSE, $all = FALSE ) {
317
  $message = $this->model->duplicate($id, $all);
318
  if ( $bulk ) {
@@ -326,21 +322,21 @@ class SlidersController_wds {
326
  ), admin_url('admin.php')));
327
  }
328
 
329
- /**
330
- * Reset.
331
- *
332
- * @param int $id
333
- */
334
  public function reset( $id = 0 ) {
335
  echo WDW_S_Library::message('Changes must be saved.', 'wd_error');
336
  $this->edit( $id, TRUE);
337
  }
338
 
339
- /**
340
- * Merge sliders.
341
- *
342
- * @param int $id
343
- */
344
  public function merge( $id = 0 ) {
345
  $id = WDW_S_Library::get('select_slider_merge');
346
  $all = WDW_S_Library::get('check_all_items');
@@ -349,13 +345,13 @@ class SlidersController_wds {
349
  $this->display();
350
  }
351
 
352
- /**
353
- * Save slider DB.
354
- *
355
- * @param int $id
356
- *
357
- * @return array $data
358
- */
359
  public function save_slider_db( $id = 0) {
360
  global $wpdb;
361
  $allow = TRUE;
@@ -638,11 +634,11 @@ class SlidersController_wds {
638
  return $data;
639
  }
640
 
641
- /**
642
- * Save slide DB.
643
- *
644
- * @param int $id
645
- */
646
  public function save_slide_db( $id = 0 ) {
647
  global $wpdb;
648
  $allow = TRUE;
@@ -920,11 +916,12 @@ class SlidersController_wds {
920
  }
921
 
922
  public function set_watermark() {
 
 
 
 
 
923
  global $wpdb;
924
- $slider_id = WDW_S_Library::get('current_id', 0);
925
- if (!$slider_id) {
926
- $slider_id = $wpdb->get_var('SELECT MAX(id) FROM ' . $wpdb->prefix . 'wdsslider');
927
- }
928
 
929
  $slider_images = $wpdb->get_col($wpdb->prepare('SELECT image_url FROM ' . $wpdb->prefix . 'wdsslide WHERE `slider_id`="%d"', $slider_id));
930
  $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wdsslider WHERE `id`="%d"', $slider_id));
@@ -979,12 +976,15 @@ class SlidersController_wds {
979
  }
980
 
981
  public function reset_watermark() {
 
 
 
 
 
982
  global $wpdb;
983
- $slider_id = WDW_S_Library::get('current_id', 0);
984
- if (!$slider_id) {
985
- $slider_id = $wpdb->get_var('SELECT MAX(id) FROM ' . $wpdb->prefix . 'wdsslider');
986
- }
987
  $slider_images = $wpdb->get_col($wpdb->prepare('SELECT image_url FROM ' . $wpdb->prefix . 'wdsslide WHERE `slider_id`="%d"', $slider_id));
 
988
  foreach ($slider_images as $slider_image) {
989
  if ($slider_image) {
990
  $slider_image = str_replace('{site_url}', site_url(), $slider_image);
@@ -1043,6 +1043,7 @@ class SlidersController_wds {
1043
  $dest_filename = htmlspecialchars_decode($dest_filename, ENT_COMPAT | ENT_QUOTES);
1044
 
1045
  $watermark_transparency = 127 - ((100 - $watermark_transparency) * 1.27);
 
1046
  list($width, $height, $type) = getimagesize($original_filename);
1047
  $watermark_image = imagecreatetruecolor($width, $height);
1048
 
@@ -1071,7 +1072,6 @@ class SlidersController_wds {
1071
  $left = ($width - $watermark_sizes['width']) / 2;
1072
  break;
1073
  }
1074
- @ini_set('memory_limit', '-1');
1075
  if ($type == 2) {
1076
  $image = imagecreatefromjpeg($original_filename);
1077
  imagettftext($image, $watermark_font_size, 0, $left, $top, $watermark_color, $watermark_font, $watermark_text);
@@ -1183,23 +1183,24 @@ class SlidersController_wds {
1183
  @ini_restore('memory_limit');
1184
  }
1185
 
1186
- /**
1187
- * create frontend js file.
1188
- *
1189
- * @param int $id
1190
- * @retunr bool
1191
- */
 
1192
  private function create_frontend_js_file( $id = 0 ) {
1193
  require_once WDS()->plugin_dir . "/admin/models/WDSModelSliders_wds.php";
1194
  $model = new WDSModelSliders_wds();
1195
  return $model->create_frontend_js_file( $id = 0 );
1196
  }
1197
 
1198
- /**
1199
- * Remove frontend js file.
1200
- *
1201
- * @param int $id
1202
- */
1203
  private function remove_frontend_js_file( $id = 0 ) {
1204
  $wp_upload_dir = wp_upload_dir();
1205
  if ( is_file($wp_upload_dir['basedir'] . '/slider-wd-scripts/script-' . $id . '.js') ){
74
  */
75
  public function execute() {
76
  $task = WDW_S_Library::get('task');
 
77
  $id = (int) WDW_S_Library::get('current_id', 0);
78
  if ( method_exists($this, $task) ) {
79
  if ( $task != 'edit' && $task != 'display' ) {
175
  $this->view->display( $params );
176
  }
177
 
178
+ /**
179
+ * Edit.
180
+ *
181
+ * @param int $id
182
+ * @param bool $reset
183
+ */
 
 
 
184
  public function edit( $id = 0, $reset = FALSE ) {
185
  $row = $this->model->get_row_data($id, $reset);
186
  if ( $id != 0 && empty($row->id) ) {
220
  $this->view->edit( $params );
221
  }
222
 
223
+ /**
224
+ * Apply.
225
+ *
226
+ * @param int $id
227
+ */
228
  public function apply( $id = 0 ) {
229
  $save = $this->save_slider_db();
230
  $id = $save['id'];
234
  $this->edit( $id );
235
  }
236
 
237
+ /**
238
+ * Publish.
239
+ *
240
+ * @param $id
241
+ * @param bool $bulk
242
+ * @param bool $all
243
+ *
244
+ * @return int
245
+ */
246
  public function publish( $id = 0, $bulk = FALSE, $all = FALSE ) {
247
  $message = $this->model->publish($id, $all);
248
  if ( $bulk ) {
256
  ), admin_url('admin.php')));
257
  }
258
 
259
+ /**
260
+ * Unpublish.
261
+ *
262
+ * @param $id
263
+ * @param bool $bulk
264
+ * @param bool $all
265
+ *
266
+ * @return int
267
+ */
268
  public function unpublish( $id = 0, $bulk = FALSE, $all = FALSE ) {
269
  $message = $this->model->unpublish( $id, $all );
270
  if ( $bulk ) {
278
  ), admin_url('admin.php')));
279
  }
280
 
281
+ /**
282
+ * Delete.
283
+ *
284
+ * @param $id
285
+ * @param bool $bulk
286
+ * @param bool $all
287
+ *
288
+ * @return int
289
+ */
290
  public function delete( $id = 0, $bulk = FALSE, $all = FALSE ) {
291
  $message = $this->model->delete($id, $all);
292
  if ( $bulk ) {
300
  ), admin_url('admin.php')));
301
  }
302
 
303
+ /**
304
+ * Duplicate.
305
+ *
306
+ * @param $id
307
+ * @param bool $bulk
308
+ * @param bool $all
309
+ *
310
+ * @return int
311
+ */
312
  public function duplicate( $id = 0, $bulk = FALSE, $all = FALSE ) {
313
  $message = $this->model->duplicate($id, $all);
314
  if ( $bulk ) {
322
  ), admin_url('admin.php')));
323
  }
324
 
325
+ /**
326
+ * Reset.
327
+ *
328
+ * @param int $id
329
+ */
330
  public function reset( $id = 0 ) {
331
  echo WDW_S_Library::message('Changes must be saved.', 'wd_error');
332
  $this->edit( $id, TRUE);
333
  }
334
 
335
+ /**
336
+ * Merge sliders.
337
+ *
338
+ * @param int $id
339
+ */
340
  public function merge( $id = 0 ) {
341
  $id = WDW_S_Library::get('select_slider_merge');
342
  $all = WDW_S_Library::get('check_all_items');
345
  $this->display();
346
  }
347
 
348
+ /**
349
+ * Save slider DB.
350
+ *
351
+ * @param int $id
352
+ *
353
+ * @return array $data
354
+ */
355
  public function save_slider_db( $id = 0) {
356
  global $wpdb;
357
  $allow = TRUE;
634
  return $data;
635
  }
636
 
637
+ /**
638
+ * Save slide DB.
639
+ *
640
+ * @param int $id
641
+ */
642
  public function save_slide_db( $id = 0 ) {
643
  global $wpdb;
644
  $allow = TRUE;
916
  }
917
 
918
  public function set_watermark() {
919
+ // Save before set watermark.
920
+ $save = $this->save_slider_db();
921
+ $slider_id = $save['id'];
922
+ $this->save_slide_db( $slider_id );
923
+
924
  global $wpdb;
 
 
 
 
925
 
926
  $slider_images = $wpdb->get_col($wpdb->prepare('SELECT image_url FROM ' . $wpdb->prefix . 'wdsslide WHERE `slider_id`="%d"', $slider_id));
927
  $slider = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wdsslider WHERE `id`="%d"', $slider_id));
976
  }
977
 
978
  public function reset_watermark() {
979
+ // Save before reset watermark.
980
+ $save = $this->save_slider_db();
981
+ $slider_id = $save['id'];
982
+ $this->save_slide_db( $slider_id );
983
+
984
  global $wpdb;
985
+
 
 
 
986
  $slider_images = $wpdb->get_col($wpdb->prepare('SELECT image_url FROM ' . $wpdb->prefix . 'wdsslide WHERE `slider_id`="%d"', $slider_id));
987
+
988
  foreach ($slider_images as $slider_image) {
989
  if ($slider_image) {
990
  $slider_image = str_replace('{site_url}', site_url(), $slider_image);
1043
  $dest_filename = htmlspecialchars_decode($dest_filename, ENT_COMPAT | ENT_QUOTES);
1044
 
1045
  $watermark_transparency = 127 - ((100 - $watermark_transparency) * 1.27);
1046
+ @ini_set('memory_limit', '-1');
1047
  list($width, $height, $type) = getimagesize($original_filename);
1048
  $watermark_image = imagecreatetruecolor($width, $height);
1049
 
1072
  $left = ($width - $watermark_sizes['width']) / 2;
1073
  break;
1074
  }
 
1075
  if ($type == 2) {
1076
  $image = imagecreatefromjpeg($original_filename);
1077
  imagettftext($image, $watermark_font_size, 0, $left, $top, $watermark_color, $watermark_font, $watermark_text);
1183
  @ini_restore('memory_limit');
1184
  }
1185
 
1186
+ /**
1187
+ * Create frontend js file.
1188
+ *
1189
+ * @param int $id
1190
+ *
1191
+ * @return mixed
1192
+ */
1193
  private function create_frontend_js_file( $id = 0 ) {
1194
  require_once WDS()->plugin_dir . "/admin/models/WDSModelSliders_wds.php";
1195
  $model = new WDSModelSliders_wds();
1196
  return $model->create_frontend_js_file( $id = 0 );
1197
  }
1198
 
1199
+ /**
1200
+ * Remove frontend js file.
1201
+ *
1202
+ * @param int $id
1203
+ */
1204
  private function remove_frontend_js_file( $id = 0 ) {
1205
  $wp_upload_dir = wp_upload_dir();
1206
  if ( is_file($wp_upload_dir['basedir'] . '/slider-wd-scripts/script-' . $id . '.js') ){
admin/models/Sliders.php CHANGED
@@ -4,13 +4,13 @@
4
  * Class SlidersModel_wds
5
  */
6
  class SlidersModel_wds {
7
-
8
- /**
9
- * Get slides row data.
10
- *
11
- * @param $slider_id
12
- * @return array
13
- */
14
  public function get_slides_row_data($slider_id) {
15
  global $wpdb;
16
  $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "wdsslide WHERE slider_id='%d' ORDER BY `order` ASC", $slider_id));
@@ -38,12 +38,13 @@ class SlidersModel_wds {
38
  return $rows;
39
  }
40
 
41
- /**
42
- * Get layers row data.
43
- *
44
- * @param array $slide_ids
45
- * @return mixed
46
- */
 
47
  public function get_layers_row_data( $slide_ids = array() ) {
48
  global $wpdb;
49
  $rows = $wpdb->get_results('SELECT * FROM `' . $wpdb->prefix . 'wdslayer` WHERE `slide_id` IN (' . implode($slide_ids, ',') . ') ORDER BY `depth` ASC');
@@ -67,12 +68,13 @@ class SlidersModel_wds {
67
  return $data;
68
  }
69
 
70
- /**
71
- * Get rows data.
72
- *
73
- * @param array $params
74
- * @return array
75
- */
 
76
  public function get_rows_data( $params= array() ) {
77
  $order = $params['order'];
78
  $orderby = $params['orderby'];
@@ -95,13 +97,14 @@ class SlidersModel_wds {
95
  return $data;
96
  }
97
 
98
- /**
99
- * Get row data.
100
- *
101
- * @param $id
102
- * @param $reset
103
- * @return stdClass
104
- */
 
105
  public function get_row_data( $id, $reset) {
106
  global $wpdb;
107
  if ($id != 0 && !$reset) {
4
  * Class SlidersModel_wds
5
  */
6
  class SlidersModel_wds {
7
+ /**
8
+ * Get slides row data.
9
+ *
10
+ * @param $slider_id
11
+ *
12
+ * @return array
13
+ */
14
  public function get_slides_row_data($slider_id) {
15
  global $wpdb;
16
  $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "wdsslide WHERE slider_id='%d' ORDER BY `order` ASC", $slider_id));
38
  return $rows;
39
  }
40
 
41
+ /**
42
+ * Get layers row data.
43
+ *
44
+ * @param array $slide_ids
45
+ *
46
+ * @return mixed
47
+ */
48
  public function get_layers_row_data( $slide_ids = array() ) {
49
  global $wpdb;
50
  $rows = $wpdb->get_results('SELECT * FROM `' . $wpdb->prefix . 'wdslayer` WHERE `slide_id` IN (' . implode($slide_ids, ',') . ') ORDER BY `depth` ASC');
68
  return $data;
69
  }
70
 
71
+ /**
72
+ * Get rows data.
73
+ *
74
+ * @param array $params
75
+ *
76
+ * @return array
77
+ */
78
  public function get_rows_data( $params= array() ) {
79
  $order = $params['order'];
80
  $orderby = $params['orderby'];
97
  return $data;
98
  }
99
 
100
+ /**
101
+ * Get row data.
102
+ *
103
+ * @param $id
104
+ * @param $reset
105
+ *
106
+ * @return stdClass
107
+ */
108
  public function get_row_data( $id, $reset) {
109
  global $wpdb;
110
  if ($id != 0 && !$reset) {
admin/views/Sliders.php CHANGED
@@ -2399,7 +2399,7 @@ class SlidersView_wds extends AdminView_bwg {
2399
  </div>
2400
  </div>
2401
  <div class="wds_task_cont">
2402
- <input id="task" name="task" type="hidden" value="" />
2403
  <input id="current_id" name="current_id" type="hidden" value="<?php echo $row->id; ?>" />
2404
  <input id="save_as_copy" name="save_as_copy" type="hidden" value="" />
2405
  <input id="slide_ids_string" name="slide_ids_string" type="hidden" value="<?php echo $slide_ids_string; ?>" />
2399
  </div>
2400
  </div>
2401
  <div class="wds_task_cont">
2402
+ <input id="task" name="task" type="hidden" value="" />
2403
  <input id="current_id" name="current_id" type="hidden" value="<?php echo $row->id; ?>" />
2404
  <input id="save_as_copy" name="save_as_copy" type="hidden" value="" />
2405
  <input id="slide_ids_string" name="slide_ids_string" type="hidden" value="<?php echo $slide_ids_string; ?>" />
framework/WDW_S_Library.php CHANGED
@@ -1233,7 +1233,6 @@ class WDW_S_Library {
1233
  var curent_time_deggree_<?php echo $wds; ?> = 0;
1234
  var circle_timer_animate_<?php echo $wds; ?>;
1235
 
1236
-
1237
  /* Stop autoplay.*/
1238
  window.clearInterval(wds_playInterval_<?php echo $wds; ?>);
1239
  var wds_current_key_<?php echo $wds; ?> = '<?php echo (isset($current_key) ? $current_key : ''); ?>';
1233
  var curent_time_deggree_<?php echo $wds; ?> = 0;
1234
  var circle_timer_animate_<?php echo $wds; ?>;
1235
 
 
1236
  /* Stop autoplay.*/
1237
  window.clearInterval(wds_playInterval_<?php echo $wds; ?>);
1238
  var wds_current_key_<?php echo $wds; ?> = '<?php echo (isset($current_key) ? $current_key : ''); ?>';
frontend/views/WDSViewSlider.php CHANGED
@@ -693,15 +693,15 @@ class WDSViewSlider {
693
  </div>
694
  </div>
695
  <?php
696
- // Add incline scripts.
 
697
  $script = WDW_S_Library::create_js( $slider_row, $slide_rows, $layers_rows, $wds, $current_key );
698
- if ( function_exists('wp_add_inline_script') ) { // Since Wordpress 4.5.0
699
  wp_add_inline_script('wds_frontend', $script, 'before');
700
  }
701
  else {
702
  echo '<script id="wd-slider-' . $wds .'">' . $script . '</script>';
703
  }
704
-
705
  if ( $from_shortcode ) {
706
  return;
707
  }
693
  </div>
694
  </div>
695
  <?php
696
+ $minify_plugin = WDS()->check_minify_plugins();
697
+ // Add incline scripts.
698
  $script = WDW_S_Library::create_js( $slider_row, $slide_rows, $layers_rows, $wds, $current_key );
699
+ if ( function_exists('wp_add_inline_script') && ! $minify_plugin ) { // Since Wordpress 4.5.0
700
  wp_add_inline_script('wds_frontend', $script, 'before');
701
  }
702
  else {
703
  echo '<script id="wd-slider-' . $wds .'">' . $script . '</script>';
704
  }
 
705
  if ( $from_shortcode ) {
706
  return;
707
  }
js/wds.js CHANGED
@@ -13,7 +13,7 @@ jQuery(document).ready(function () {
13
  });
14
 
15
  jQuery(window).load(function () {
16
- // For "Add posts" iframe.
17
  jQuery(".wds_category_name").change(function () {
18
  jQuery("#page_number").val(1);
19
  jQuery("#search_or_not").val("search");
@@ -25,7 +25,7 @@ jQuery(window).load(function () {
25
  * Set attribute and class all form elements
26
  */
27
  function setDataFormElement() {
28
- jQuery(".wds-check-change_form :input:not([type=hidden])").each(function(){ // Set attr and class to each input of class
29
  jQuery(this).attr("data-initial-value",jQuery(this).val());
30
  jQuery(this).addClass('wds-check-change');
31
  });
@@ -36,10 +36,10 @@ function setDataFormElement() {
36
  */
37
  function setDataSlideElement() {
38
  jQuery(".tab_image").each(function() {
39
- jQuery(this).attr("data-initial-image",jQuery(this).attr("style")); // Set attribute all slides
40
  });
41
- slideSubtabCount = jQuery(".wds_tabs .wds_subtab_wrap").length; // Check slides count
42
- layerCount = jQuery(".wds_slides_box .wds_box table>tbody").length; // Check layers count
43
  }
44
 
45
  /**
@@ -71,14 +71,14 @@ function SlideManageChanges( wds_check_for_changes ) {
71
  slide_changed = true;
72
  }
73
  });
74
- if ( slideSubtabCount != jQuery(".wds_tabs .wds_subtab_wrap").length ){ // check count of slides
75
  slide_changed = true;
76
  }
77
- else if ( layerCount != jQuery(".wds_slides_box .wds_box table>tbody").length ) { // check count of layers
78
  slide_changed = true;
79
  }
80
  else {
81
- jQuery(".tab_image").each(function () { // Check slide image change
82
  if ( jQuery(this).attr("data-initial-image") != jQuery(this).attr("style") ) {
83
  slide_changed = true;
84
  }
@@ -102,8 +102,8 @@ function wds_spider_ajax_save(form_id, event) {
102
  set_ffamily_value();
103
  var post_data = {};
104
  post_data["task"] = "apply";
105
- if (task == "reset") {
106
- post_data["task"] = "reset";
107
  }
108
 
109
  /* Global.*/
@@ -450,7 +450,6 @@ function wds_spider_ajax_save(form_id, event) {
450
  }
451
  post_data["slides"].splice(post_data["slides"].length, 0, JSON.stringify(slide_data));
452
  }
453
-
454
  }
455
  }
456
  jQuery.post(
@@ -460,22 +459,28 @@ function wds_spider_ajax_save(form_id, event) {
460
  var content = jQuery(data).find(".wds_nav_global_box").parent();
461
  var str = content.html();
462
  jQuery(".wds_nav_global_box").parent().html(str);
463
- var str = jQuery(data).find(".wds_task_cont").html();
464
- jQuery(".wds_task_cont").html(str);
 
 
 
 
465
  var str = jQuery(data).find(".wds_buttons").html();
466
  jQuery(".wds_buttons").html(str);
 
467
  var content = jQuery(data).find(".wds_slides_box");
468
  var str = content.html();
469
  jQuery(".wds_slides_box").html(str);
 
470
  var post_btn_href = jQuery(data).find("#wds_posts_btn").attr("href");
471
  jQuery("#wds_posts_btn").attr("href", post_btn_href);
472
  }
473
  ).success(function (data, textStatus, errorThrown) {
474
- wds_success(form_id, 0);
475
  setDataSlideElement();
476
  setDataFormElement();
477
  hide_dimmension_ratio();
478
- showHowToTabBlock();
479
  });
480
  if (event.preventDefault) {
481
  event.preventDefault();
@@ -532,64 +537,33 @@ function wds_add_post(ids_string, single) {
532
  window.parent.tb_remove();
533
  }
534
 
535
- function wds_action_after_save(form_id) {
536
- var post_data = {};
537
- post_data["task"] = jQuery("#task").val();
538
- post_data["current_id"] = jQuery("#current_id").val();
539
- post_data["nonce_wd"] = jQuery("#nonce_wd").val();
540
- jQuery.post(
541
- jQuery("#" + form_id).attr("action"),
542
- post_data,
543
- function (data) {
544
- jQuery(".wds_preview").find("div[class^='wds_preview_image']").each(function() {
545
- var image = jQuery(this).css("background-image");
546
- jQuery(this).css({backgroundImage: image.replace('")', Math.floor((Math.random() * 100) + 1) + '")')});
547
- });
548
- }
549
- ).success(function (data, textStatus, errorThrown) {
550
- wds_success(form_id, 1);
551
- });
552
- }
553
-
554
- function wds_success(form_id, end) {
555
  jQuery("#" + form_id).parent().find(".spider_message").remove();
556
  var task = jQuery("#task").val();
557
  var message;
 
558
  switch (task) {
559
- case "save": {
560
- jQuery("#" + form_id).submit();
561
- break;
562
- }
563
  case "set_watermark": {
564
- if (end) {
565
- if (jQuery("input[name=built_in_watermark_type]:checked").val() == 'none') {
566
- message = "<div class='wd_error'><strong><p>"+ wds_object.translate.you_must_set_watermark_type +"</p></strong></div>";
567
- }
568
- else {
569
- message = "<div class='wd_updated'><strong><p>"+ wds_object.translate.watermark_succesfully_set +"</p></strong></div>";
570
- }
571
- }
572
- else {
573
- wds_action_after_save(form_id);
574
- }
575
- break;
576
- }
577
- case "export_on": {
578
- if (end) {
579
- window.location = jQuery("#wds_export_btn").attr("data-href") + '&current_id=' + jQuery('#current_id').val() + '&imagesexport=' + jQuery('#imagesexport').is(':checked');
580
  }
581
  else {
582
- wds_action_after_save(form_id);
583
  }
584
  break;
585
  }
586
  case "reset_watermark": {
587
- if (end) {
588
- message = "<div class='wd_updated'><strong><p>"+ wds_object.translate.watermark_succesfully_reset +"</p></strong></div>";
589
- }
590
- else {
591
- wds_action_after_save(form_id);
592
- }
593
  break;
594
  }
595
  case "reset": {
@@ -597,17 +571,12 @@ function wds_success(form_id, end) {
597
  window.scrollTo(0,0);
598
  break;
599
  }
600
- case "duplicate":
601
- case "export": {
602
- jQuery("#" + form_id).submit();
603
- message = "<div class='wd_updated'><strong><p>"+ wds_object.translate.items_succesfully_saved +"</p></strong></div>";
604
- break;
605
- }
606
  default: {
607
  message = "<div class='wd_updated'><strong><p>"+ wds_object.translate.items_succesfully_saved +"</p></strong></div>";
608
  break;
609
  }
610
  }
 
611
  /* Loading.*/
612
  jQuery(".spider_load").hide();
613
  if (message) {
@@ -733,7 +702,7 @@ function wds_onload() {
733
  wds_hotspot_position();
734
  }
735
 
736
- // Add events to slide tabs.
737
  jQuery(".tab_image").on("click", function () {
738
  var slide_id = jQuery(this).data("id");
739
  wds_change_sub_tab(this, "wds_slide" + slide_id);
@@ -747,14 +716,14 @@ function wds_onload() {
747
  wds_change_sub_tab_title(this, "wds_slide" + slide_id);
748
  });
749
 
750
- // Open/close section container on its header click.
751
  jQuery(".hndle, .handlediv").each(function () {
752
  jQuery(this).on("click", function () {
753
  wds_toggle_postbox(this);
754
  });
755
  });
756
 
757
- // Set preview container overflow width.
758
  jQuery(".wds-preview-overflow").width(jQuery(".wd-slides-title").width());
759
  }
760
 
@@ -820,14 +789,14 @@ function spider_run_checkbox() {
820
  });
821
  }
822
 
823
- // Set value by id.
824
  function spider_set_input_value(input_id, input_value) {
825
  if (document.getElementById(input_id)) {
826
  document.getElementById(input_id).value = input_value;
827
  }
828
  }
829
 
830
- // Submit form by id.
831
  function spider_form_submit(event, form_id) {
832
  if (document.getElementById(form_id)) {
833
  document.getElementById(form_id).submit();
@@ -840,7 +809,7 @@ function spider_form_submit(event, form_id) {
840
  }
841
  }
842
 
843
- // Check required fields.
844
  function wds_check_required() {
845
  var flag = true;
846
  jQuery(".wds_requried").each(function () {
@@ -859,7 +828,7 @@ function wds_check_required() {
859
  return flag;
860
  }
861
 
862
- // Check audio file.
863
  function ValidAudioExtantion(url) {
864
  var ext = url.split('.').pop();
865
  switch (ext.toLowerCase()) {
@@ -869,7 +838,6 @@ function ValidAudioExtantion(url) {
869
  case 'mp3':
870
  case 'ogg':
871
  case 'oga':
872
- // etc
873
  return true;
874
  }
875
  return false;
@@ -883,17 +851,17 @@ function ValidAudioURL(url) {
883
  function validate_audio() {
884
  var url = jQuery("#music_url").val();
885
  if (jQuery("#music1").is(":checked")) {
886
- if (url == "") { //check is url empty
887
  jQuery("#music0").prop('checked', true);
888
  wds_enable_disable('none', 'tr_music_url', 'music0');
889
  return true;
890
  }
891
- else if (!ValidAudioExtantion(url)) //check extention
892
  {
893
  alert(wds_object.translate.insert_valid_audio_file);
894
  return false;
895
  }
896
- else if (!ValidAudioURL(url)) { //check url
897
  alert(wds_object.translate.insert_valid_audio_file);
898
  return false;
899
  }
@@ -901,7 +869,7 @@ function validate_audio() {
901
  return true;
902
  }
903
 
904
- // Show/hide order column and drag and drop column.
905
  function spider_show_hide_weights() {
906
  if (jQuery("#show_hide_weights").val() == 'Show order column') {
907
  jQuery(".connectedSortable").css("cursor", "default");
@@ -935,7 +903,7 @@ function spider_show_hide_weights() {
935
  }
936
  });
937
  }
938
- });//.disableSelection();
939
  jQuery("#tbody_arr").sortable("enable");
940
  jQuery("#tbody_arr").find(".handle").show(0);
941
  jQuery("#tbody_arr").find(".handle").attr('class', 'handle connectedSortable');
@@ -945,12 +913,10 @@ function spider_show_hide_weights() {
945
  }
946
  }
947
 
948
- // Check all items.
949
  function spider_check_all_items() {
950
  spider_check_all_items_checkbox();
951
- // if (!jQuery('#check_all').attr('checked')) {
952
- jQuery('#check_all').trigger('click');
953
- // }
954
  }
955
 
956
  function spider_check_all_items_checkbox() {
@@ -977,7 +943,7 @@ function spider_check_all(current) {
977
  }
978
  }
979
 
980
- // Set uploader to button class.
981
  function spider_uploader(button_id, input_id, delete_id, img_id) {
982
  if (typeof img_id == 'undefined') {
983
  img_id = '';
@@ -1044,7 +1010,7 @@ function spider_uploader(button_id, input_id, delete_id, img_id) {
1044
  });
1045
  }
1046
 
1047
- // Remove uploaded file.
1048
  function spider_remove_url(input_id, img_id) {
1049
  var id = input_id.substr(9);
1050
  if (typeof img_id == 'undefined') {
@@ -1659,10 +1625,10 @@ function wds_media_uploader_add_slide(e, id, multiple) {
1659
  }
1660
  var custom_uploader;
1661
  e.preventDefault();
1662
- // If the uploader object has already been created, reopen the dialog.
1663
  if (custom_uploader) {
1664
  custom_uploader.open();
1665
- // return;
1666
  }
1667
 
1668
  type_ = jQuery("#type" + id).val();
@@ -1676,7 +1642,7 @@ function wds_media_uploader_add_slide(e, id, multiple) {
1676
  id: id
1677
  });
1678
 
1679
- // Insert files to slider.
1680
  custom_uploader.on('insert select', function() {
1681
  var attachment = [];
1682
  if ( custom_uploader.state().id == "embed" ) {
@@ -1684,7 +1650,7 @@ function wds_media_uploader_add_slide(e, id, multiple) {
1684
  alert(wds.file_not_supported);
1685
  return;
1686
  }
1687
- // Insert image from URL.
1688
  attachment.push({'url': custom_uploader.state().props.attributes.url, 'mime': 'image/jpeg'});
1689
  }
1690
  else {
@@ -1709,7 +1675,7 @@ function wds_media_uploader_add_slide(e, id, multiple) {
1709
  }
1710
  }
1711
  }
1712
- /* Delete active slide if it has no image.*/
1713
  jQuery(".wds_box input[id^='image_url']").each(function () {
1714
  var slide_id = jQuery(this).attr("id").replace("image_url", "");
1715
  if (!jQuery("#image_url" + slide_id).val() && !jQuery("#slide" + slide_id + "_layer_ids_string").val()) {
@@ -1724,7 +1690,7 @@ function wds_media_uploader_add_slide(e, id, multiple) {
1724
  else {
1725
  var new_slide_id = id;
1726
  }
1727
- if (jQuery.inArray(attachment[i].mime, supported_image_mime) != -1) { // image
1728
  var thumb_url = (attachment[i]['sizes'] && attachment[i]['sizes']['thumbnail']) ? attachment[i]['sizes']['thumbnail']['url'] : attachment[i]['url'];
1729
  jQuery("#wds_preview_image" + new_slide_id).css({
1730
  backgroundImage: 'url("' + attachment[i]['url'] + '")',
@@ -1740,7 +1706,7 @@ function wds_media_uploader_add_slide(e, id, multiple) {
1740
  jQuery("#autoplay" + new_slide_id).hide();
1741
  jQuery("#video_loop" + new_slide_id).hide();
1742
  }
1743
- else if (jQuery.inArray(attachment[i].mime, supported_video_mime) != -1) { // video
1744
  var thumb_url = WD_S_URL + '/images/no-video.png';
1745
  if (typeof attachment[i].image != "undefined") {
1746
  if (attachment[i].image.src.indexOf('media/video.png') == '-1') {
@@ -1776,10 +1742,10 @@ function wds_media_uploader_add_slide(e, id, multiple) {
1776
  jQuery("#youtube_rel_video" + new_slide_id).hide();
1777
  }
1778
  });
1779
- // Open the uploader dialog.
1780
  custom_uploader.open();
1781
 
1782
- // Remove the Media Library tab.
1783
  jQuery(".media-menu a:contains('" + wds_object.translate.media_library + "')").remove();
1784
  jQuery("#media-attachment-filters option[value='" + type_ + "']").attr('selected','selected');
1785
  }
@@ -1790,12 +1756,12 @@ function wds_media_uploader(id, e, multiple) {
1790
  }
1791
  var custom_uploader;
1792
  e.preventDefault();
1793
- // If the uploader object has already been created, reopen the dialog.
1794
  if (custom_uploader) {
1795
  custom_uploader.open();
1796
- // return;
1797
  }
1798
- // Extend the wp.media object.
1799
  if (id == 'music') {
1800
  var library_type = 'audio';
1801
  }
@@ -1822,7 +1788,7 @@ function wds_media_uploader(id, e, multiple) {
1822
  button: { text: wds_object.translate.insert },
1823
  multiple: multiple
1824
  });
1825
- // When a file is selected, grab the URL and set it as the text field's value
1826
  custom_uploader.on('select', function() {
1827
  if (multiple == false) {
1828
  attachment = custom_uploader.state().get('selection').first().toJSON();
@@ -1955,7 +1921,7 @@ function wds_media_uploader(id, e, multiple) {
1955
  }
1956
  case 'add_update_thumbnail' : {
1957
  if ( jQuery("#type" + slide_id).val() == "video" ) {
1958
- // For video slides.
1959
  jQuery("#wds_preview_image" + slide_id).css("background-image", 'url("' + image_url + '")');
1960
  }
1961
  jQuery("#thumb_url" + slide_id).val(image_url);
@@ -2013,7 +1979,7 @@ function wds_media_uploader(id, e, multiple) {
2013
  }
2014
  }
2015
  });
2016
- // Open the uploader dialog.
2017
  custom_uploader.open();
2018
  }
2019
 
@@ -2183,7 +2149,7 @@ function wds_change_sub_tab_title(that, box) {
2183
  wds_hotspot_position();
2184
  }
2185
 
2186
- // Open/close section container on its header click.
2187
  jQuery(".hndle, .handlediv").each(function () {
2188
  jQuery(this).on("click", function () {
2189
  wds_toggle_postbox(this);
@@ -2230,11 +2196,11 @@ function wds_change_tab(that, box) {
2230
  jQuery(".wds_box").removeClass("wds_active");
2231
  jQuery("." + box).addClass("wds_active");
2232
  if (box == "wds_settings_box") {
2233
- // Show "Reset all settings" button.
2234
  jQuery(".reset-all-settings").removeClass("wd-hidden");
2235
  }
2236
  else {
2237
- // Hide "Reset all settings" button.
2238
  jQuery(".reset-all-settings").addClass("wd-hidden");
2239
  }
2240
  jQuery(".tab_button_wrap").css('border-color','#ddd');
@@ -2245,7 +2211,7 @@ function wds_change_tab(that, box) {
2245
  jQuery(".slides_tab_button_wrap a").css('border-color','#00A0D4');
2246
  }
2247
 
2248
- // Set preview container overflow width.
2249
  jQuery(".wds-preview-overflow").width(jQuery(".wd-slides-title").width());
2250
  }
2251
 
@@ -2938,10 +2904,10 @@ function wds_add_layer(type, id, layerID, duplicate, files, edit) {
2938
  tbody_html = tbody + '<tr class="wds_layer_content">' + tbody_html.replace(/%%slideID%%/g, id) + '</tr>';
2939
  }
2940
  if (!duplicate) {
2941
- if (spider_uploader_) { // Add image layer by spider uploader.
2942
  wds_add_image_layer_by_spider_uploader(prefix, files, tbodyID, id, layerID, tbody_html);
2943
  }
2944
- else { // Add image layer by media uploader.
2945
  image_escape = wds_add_image_layer(prefix, tbodyID, id, layerID, tbody_html, edit);
2946
  }
2947
  }
@@ -3151,7 +3117,7 @@ function wds_drag_layer(id) {
3151
  }
3152
  jQuery("#" + prefix + "_top").val(parseInt(jQuery(this).offset().top - jQuery(".wds_preview_image" + id).offset().top));
3153
 
3154
- // Do not set layer width/height on drag.
3155
  if (jQuery("#" + prefix + "_image_width").val() == 0) {
3156
  jQuery("#" + prefix).css({'width': ''});
3157
  }
@@ -3205,8 +3171,11 @@ function wds_layer_weights(id) {
3205
  }
3206
  });
3207
  }
3208
- });//.disableSelection();
3209
- // jQuery(".ui-sortable").sortable("enable");
 
 
 
3210
  }
3211
 
3212
  function wds_slide_weights() {
@@ -3228,7 +3197,7 @@ function wds_slide_weights() {
3228
  function wds_add_video_layer(prefix, tbodyID, id, layerID, tbody_html, edit) {
3229
  var custom_uploader;
3230
  /*event.preventDefault();*/
3231
- // If the uploader object has already been created, reopen the dialog.
3232
  if (custom_uploader) {
3233
  custom_uploader.open();
3234
  return;
@@ -3237,14 +3206,14 @@ function wds_add_video_layer(prefix, tbodyID, id, layerID, tbody_html, edit) {
3237
  if (typeof edit == "undefined") {
3238
  var edit = 0;
3239
  }
3240
- // Extend the wp.media object.
3241
  custom_uploader = wp.media.frames.file_frame = wp.media({
3242
  title: wds_object.translate.choose_video,
3243
  library : { type : 'video'},
3244
  button: { text: wds_object.translate.insert },
3245
  multiple: false
3246
  });
3247
- // When a file is selected, grab the URL and set it as the text field's value
3248
  custom_uploader.on('select', function() {
3249
  jQuery("#" + tbodyID).append(tbody_html);
3250
  attachment = custom_uploader.state().get('selection').first().toJSON();
@@ -3288,14 +3257,14 @@ function wds_add_video_layer(prefix, tbodyID, id, layerID, tbody_html, edit) {
3288
 
3289
  });
3290
 
3291
- // Open the uploader dialog.
3292
  custom_uploader.open();
3293
  }
3294
 
3295
  function wds_add_image_layer(prefix, tbodyID, id, layerID, tbody_html, edit) {
3296
  var custom_uploader;
3297
  /*event.preventDefault();*/
3298
- // If the uploader object has already been created, reopen the dialog.
3299
  if (custom_uploader) {
3300
  custom_uploader.open();
3301
  return;
@@ -3303,14 +3272,14 @@ function wds_add_image_layer(prefix, tbodyID, id, layerID, tbody_html, edit) {
3303
  if (typeof edit == "undefined") {
3304
  var edit = 0;
3305
  }
3306
- // Extend the wp.media object.
3307
  custom_uploader = wp.media.frames.file_frame = wp.media({
3308
  title: wds_object.translate.choose_image,
3309
  library : { type : 'image'},
3310
  button: { text: wds_object.translate.insert },
3311
  multiple: false
3312
  });
3313
- // When a file is selected, grab the URL and set it as the text field's value
3314
  custom_uploader.on('select', function() {
3315
  jQuery("#" + tbodyID).append(tbody_html);
3316
  attachment = custom_uploader.state().get('selection').first().toJSON();
@@ -3347,7 +3316,7 @@ function wds_add_image_layer(prefix, tbodyID, id, layerID, tbody_html, edit) {
3347
  jscolor.bind();
3348
  });
3349
 
3350
- // Open the uploader dialog.
3351
  custom_uploader.open();
3352
  }
3353
 
@@ -3426,7 +3395,9 @@ function wds_add_slide() {
3426
  if (spider_uploader_) {
3427
  slide_upload_by = ' <a href="' + uploader_href_for_add_slide + '" class="action_buttons edit_slide thickbox thickbox-preview" title="'+ wds_object.translate.add_edit_image +'" onclick="return false;">'+ wds_object.translate.add_edit_image +'</a>';
3428
  update_thumb_by = ' <a href="' + upload_href_for_change_thumb + '" class="button button-secondary thickbox thickbox-preview" title="'+ wds_object.translate.edit_thumbnail +'" onclick="return false;">'+ wds_object.translate.edit_thumbnail +'</a>';
3429
- // edit_slide_by = ' <a href="' + uploader_href_for_add_slide + '" class="wds_change_thumbnail thickbox thickbox-preview" title="'+ wds_object.translate.add_edit_image +'" onclick="return false;"></a>';
 
 
3430
  img_layer_upload_by = ' <a onclick="' + (wds_object.is_free ? 'alert(\''+ wds_object.translate.disabled_in_free_version + '\')' : '') + '; return false;" ' + (wds_object.is_free ? '' : 'href="' + uploader_href_for_add_layer + '"') + ' class="action_buttons add_image_layer button-small' + (wds_object.is_free ? " wds_free_button" : " thickbox thickbox-preview") + '" title="'+ wds_object.translate.add_image_layer +'">'+ wds_object.translate.add_image_layer +'</a>';
3431
  }
3432
  else {
@@ -3601,7 +3572,7 @@ function wds_add_slide() {
3601
  wds_slide_weights();
3602
  wds_onkeypress();
3603
 
3604
- // Open/close section container on its header click.
3605
  jQuery(".wds_slide" + slideID + " .hndle, .wds_slide" + slideID + " .handlediv").each(function () {
3606
  jQuery(this).on("click", function () {
3607
  wds_toggle_postbox(this);
@@ -3930,8 +3901,10 @@ function wds_getfileextension(filename) {
3930
  var dot = filename.lastIndexOf(".");
3931
  var extension = filename.substr(dot + 1, filename.length);
3932
  var exten = 'zip';
3933
- // exten=exten.replace(/\./g,'');
3934
- // exten=exten.replace(/ /g,'');
 
 
3935
  if (extension.toLowerCase() == exten.toLowerCase()) {
3936
  return true;
3937
  }
@@ -4042,11 +4015,11 @@ function wds_insert_html() {
4042
  var content = "";
4043
  var editor = tinyMCE.get("template_text");
4044
  if (editor) {
4045
- // Active tab is Visual.
4046
  content = editor.getContent();
4047
  }
4048
  else {
4049
- // Active tab is HTML.
4050
  content = jQuery("#template_text").val();
4051
  }
4052
  var prefix = jQuery("#current_prefix").val();
@@ -4249,16 +4222,16 @@ function wds_toggle_postbox(that) {
4249
  }
4250
 
4251
  jQuery(window).resize(function () {
4252
- // Set preview container overflow width.
4253
  jQuery(".wds-preview-overflow").width(jQuery(".wd-slides-title").width());
4254
  });
4255
- // Set slide title on chnage.
4256
  function wds_set_slide_title( id ) {
4257
  var val = jQuery('.wds_tab_title_wrap #title'+ id).val();
4258
  jQuery( '.wds_slide'+ id +' .wds_slide-title-'+ id ).html(val);
4259
  }
4260
 
4261
- // Hide dimensions and ratio based on full width in settings
4262
  function hide_dimmension_ratio() {
4263
  jQuery(".full_width_desc").hide();
4264
  jQuery("#" + jQuery('.wds_settings_box [name=full_width]:checked').attr("id") + "_desc").show();
@@ -4279,7 +4252,7 @@ function hide_dimmension_ratio() {
4279
  }
4280
  }
4281
 
4282
- // Show How To block on tab.
4283
  function showHowToTabBlock(){
4284
  jQuery(".tab_conteiner .howto_tab_button_wrap.hide").removeClass('hide');
4285
  var id = jQuery("#current_id").val();
13
  });
14
 
15
  jQuery(window).load(function () {
16
+ /* For "Add posts" iframe. */
17
  jQuery(".wds_category_name").change(function () {
18
  jQuery("#page_number").val(1);
19
  jQuery("#search_or_not").val("search");
25
  * Set attribute and class all form elements
26
  */
27
  function setDataFormElement() {
28
+ jQuery(".wds-check-change_form :input:not([type=hidden])").each(function(){ /* Set attr and class to each input of class */
29
  jQuery(this).attr("data-initial-value",jQuery(this).val());
30
  jQuery(this).addClass('wds-check-change');
31
  });
36
  */
37
  function setDataSlideElement() {
38
  jQuery(".tab_image").each(function() {
39
+ jQuery(this).attr("data-initial-image",jQuery(this).attr("style")); /* Set attribute all slides */
40
  });
41
+ slideSubtabCount = jQuery(".wds_tabs .wds_subtab_wrap").length; /* Check slides count */
42
+ layerCount = jQuery(".wds_slides_box .wds_box table>tbody").length; /* Check layers count */
43
  }
44
 
45
  /**
71
  slide_changed = true;
72
  }
73
  });
74
+ if ( slideSubtabCount != jQuery(".wds_tabs .wds_subtab_wrap").length ){ /* check count of slides */
75
  slide_changed = true;
76
  }
77
+ else if ( layerCount != jQuery(".wds_slides_box .wds_box table>tbody").length ) { /* check count of layers */
78
  slide_changed = true;
79
  }
80
  else {
81
+ jQuery(".tab_image").each(function () { /* Check slide image change */
82
  if ( jQuery(this).attr("data-initial-image") != jQuery(this).attr("style") ) {
83
  slide_changed = true;
84
  }
102
  set_ffamily_value();
103
  var post_data = {};
104
  post_data["task"] = "apply";
105
+ if ( task == "reset" || task == "set_watermark" || task == "reset_watermark" ) {
106
+ post_data["task"] = task;
107
  }
108
 
109
  /* Global.*/
450
  }
451
  post_data["slides"].splice(post_data["slides"].length, 0, JSON.stringify(slide_data));
452
  }
 
453
  }
454
  }
455
  jQuery.post(
459
  var content = jQuery(data).find(".wds_nav_global_box").parent();
460
  var str = content.html();
461
  jQuery(".wds_nav_global_box").parent().html(str);
462
+
463
+ if ( task != "reset" ) {
464
+ var str = jQuery(data).find(".wds_task_cont").html();
465
+ jQuery(".wds_task_cont").html(str);
466
+ }
467
+
468
  var str = jQuery(data).find(".wds_buttons").html();
469
  jQuery(".wds_buttons").html(str);
470
+
471
  var content = jQuery(data).find(".wds_slides_box");
472
  var str = content.html();
473
  jQuery(".wds_slides_box").html(str);
474
+
475
  var post_btn_href = jQuery(data).find("#wds_posts_btn").attr("href");
476
  jQuery("#wds_posts_btn").attr("href", post_btn_href);
477
  }
478
  ).success(function (data, textStatus, errorThrown) {
479
+ wds_success(form_id);
480
  setDataSlideElement();
481
  setDataFormElement();
482
  hide_dimmension_ratio();
483
+ showHowToTabBlock();
484
  });
485
  if (event.preventDefault) {
486
  event.preventDefault();
537
  window.parent.tb_remove();
538
  }
539
 
540
+ function wds_success(form_id) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
  jQuery("#" + form_id).parent().find(".spider_message").remove();
542
  var task = jQuery("#task").val();
543
  var message;
544
+
545
  switch (task) {
 
 
 
 
546
  case "set_watermark": {
547
+ /* Reload images to prevent load from cache. */
548
+ jQuery(".wds_preview").find("div[class^='wds_preview_image']").each(function() {
549
+ var image = jQuery(this).css("background-image");
550
+ jQuery(this).css({backgroundImage: image.replace('")', (image.indexOf("?") === -1 ? '?' : '') + Math.floor((Math.random() * 100) + 1) + '")')});
551
+ });
552
+ if (jQuery("input[name=built_in_watermark_type]:checked").val() == 'none') {
553
+ message = "<div class='wd_error'><strong><p>"+ wds_object.translate.you_must_set_watermark_type +"</p></strong></div>";
 
 
 
 
 
 
 
 
 
554
  }
555
  else {
556
+ message = "<div class='wd_updated'><strong><p>"+ wds_object.translate.watermark_succesfully_set +"</p></strong></div>";
557
  }
558
  break;
559
  }
560
  case "reset_watermark": {
561
+ /* Reload images to prevent load from cache. */
562
+ jQuery(".wds_preview").find("div[class^='wds_preview_image']").each(function() {
563
+ var image = jQuery(this).css("background-image");
564
+ jQuery(this).css({backgroundImage: image.replace('")', (image.indexOf("?") === -1 ? '?' : '') + Math.floor((Math.random() * 100) + 1) + '")')});
565
+ });
566
+ message = "<div class='wd_updated'><strong><p>"+ wds_object.translate.watermark_succesfully_reset +"</p></strong></div>";
567
  break;
568
  }
569
  case "reset": {
571
  window.scrollTo(0,0);
572
  break;
573
  }
 
 
 
 
 
 
574
  default: {
575
  message = "<div class='wd_updated'><strong><p>"+ wds_object.translate.items_succesfully_saved +"</p></strong></div>";
576
  break;
577
  }
578
  }
579
+
580
  /* Loading.*/
581
  jQuery(".spider_load").hide();
582
  if (message) {
702
  wds_hotspot_position();
703
  }
704
 
705
+ /* Add events to slide tabs. */
706
  jQuery(".tab_image").on("click", function () {
707
  var slide_id = jQuery(this).data("id");
708
  wds_change_sub_tab(this, "wds_slide" + slide_id);
716
  wds_change_sub_tab_title(this, "wds_slide" + slide_id);
717
  });
718
 
719
+ /* Open/close section container on its header click. */
720
  jQuery(".hndle, .handlediv").each(function () {
721
  jQuery(this).on("click", function () {
722
  wds_toggle_postbox(this);
723
  });
724
  });
725
 
726
+ /* Set preview container overflow width. */
727
  jQuery(".wds-preview-overflow").width(jQuery(".wd-slides-title").width());
728
  }
729
 
789
  });
790
  }
791
 
792
+ /* Set value by id. */
793
  function spider_set_input_value(input_id, input_value) {
794
  if (document.getElementById(input_id)) {
795
  document.getElementById(input_id).value = input_value;
796
  }
797
  }
798
 
799
+ /* Submit form by id. */
800
  function spider_form_submit(event, form_id) {
801
  if (document.getElementById(form_id)) {
802
  document.getElementById(form_id).submit();
809
  }
810
  }
811
 
812
+ /* Check required fields. */
813
  function wds_check_required() {
814
  var flag = true;
815
  jQuery(".wds_requried").each(function () {
828
  return flag;
829
  }
830
 
831
+ /* Check audio file. */
832
  function ValidAudioExtantion(url) {
833
  var ext = url.split('.').pop();
834
  switch (ext.toLowerCase()) {
838
  case 'mp3':
839
  case 'ogg':
840
  case 'oga':
 
841
  return true;
842
  }
843
  return false;
851
  function validate_audio() {
852
  var url = jQuery("#music_url").val();
853
  if (jQuery("#music1").is(":checked")) {
854
+ if (url == "") { /* check is url empty */
855
  jQuery("#music0").prop('checked', true);
856
  wds_enable_disable('none', 'tr_music_url', 'music0');
857
  return true;
858
  }
859
+ else if (!ValidAudioExtantion(url)) /* check extention */
860
  {
861
  alert(wds_object.translate.insert_valid_audio_file);
862
  return false;
863
  }
864
+ else if (!ValidAudioURL(url)) { /* check url */
865
  alert(wds_object.translate.insert_valid_audio_file);
866
  return false;
867
  }
869
  return true;
870
  }
871
 
872
+ /* Show/hide order column and drag and drop column. */
873
  function spider_show_hide_weights() {
874
  if (jQuery("#show_hide_weights").val() == 'Show order column') {
875
  jQuery(".connectedSortable").css("cursor", "default");
903
  }
904
  });
905
  }
906
+ }); /* .disableSelection(); */
907
  jQuery("#tbody_arr").sortable("enable");
908
  jQuery("#tbody_arr").find(".handle").show(0);
909
  jQuery("#tbody_arr").find(".handle").attr('class', 'handle connectedSortable');
913
  }
914
  }
915
 
916
+ /* Check all items. */
917
  function spider_check_all_items() {
918
  spider_check_all_items_checkbox();
919
+ jQuery('#check_all').trigger('click');
 
 
920
  }
921
 
922
  function spider_check_all_items_checkbox() {
943
  }
944
  }
945
 
946
+ /* Set uploader to button class. */
947
  function spider_uploader(button_id, input_id, delete_id, img_id) {
948
  if (typeof img_id == 'undefined') {
949
  img_id = '';
1010
  });
1011
  }
1012
 
1013
+ /* Remove uploaded file. */
1014
  function spider_remove_url(input_id, img_id) {
1015
  var id = input_id.substr(9);
1016
  if (typeof img_id == 'undefined') {
1625
  }
1626
  var custom_uploader;
1627
  e.preventDefault();
1628
+ /* If the uploader object has already been created, reopen the dialog. */
1629
  if (custom_uploader) {
1630
  custom_uploader.open();
1631
+ /*TODO remove return; */
1632
  }
1633
 
1634
  type_ = jQuery("#type" + id).val();
1642
  id: id
1643
  });
1644
 
1645
+ /* Insert files to slider. */
1646
  custom_uploader.on('insert select', function() {
1647
  var attachment = [];
1648
  if ( custom_uploader.state().id == "embed" ) {
1650
  alert(wds.file_not_supported);
1651
  return;
1652
  }
1653
+ /* Insert image from URL. */
1654
  attachment.push({'url': custom_uploader.state().props.attributes.url, 'mime': 'image/jpeg'});
1655
  }
1656
  else {
1675
  }
1676
  }
1677
  }
1678
+ /* Delete active slide if it has no image. */
1679
  jQuery(".wds_box input[id^='image_url']").each(function () {
1680
  var slide_id = jQuery(this).attr("id").replace("image_url", "");
1681
  if (!jQuery("#image_url" + slide_id).val() && !jQuery("#slide" + slide_id + "_layer_ids_string").val()) {
1690
  else {
1691
  var new_slide_id = id;
1692
  }
1693
+ if (jQuery.inArray(attachment[i].mime, supported_image_mime) != -1) { /* image */
1694
  var thumb_url = (attachment[i]['sizes'] && attachment[i]['sizes']['thumbnail']) ? attachment[i]['sizes']['thumbnail']['url'] : attachment[i]['url'];
1695
  jQuery("#wds_preview_image" + new_slide_id).css({
1696
  backgroundImage: 'url("' + attachment[i]['url'] + '")',
1706
  jQuery("#autoplay" + new_slide_id).hide();
1707
  jQuery("#video_loop" + new_slide_id).hide();
1708
  }
1709
+ else if (jQuery.inArray(attachment[i].mime, supported_video_mime) != -1) { /* video */
1710
  var thumb_url = WD_S_URL + '/images/no-video.png';
1711
  if (typeof attachment[i].image != "undefined") {
1712
  if (attachment[i].image.src.indexOf('media/video.png') == '-1') {
1742
  jQuery("#youtube_rel_video" + new_slide_id).hide();
1743
  }
1744
  });
1745
+ /* Open the uploader dialog. */
1746
  custom_uploader.open();
1747
 
1748
+ /* Remove the Media Library tab. */
1749
  jQuery(".media-menu a:contains('" + wds_object.translate.media_library + "')").remove();
1750
  jQuery("#media-attachment-filters option[value='" + type_ + "']").attr('selected','selected');
1751
  }
1756
  }
1757
  var custom_uploader;
1758
  e.preventDefault();
1759
+ /* If the uploader object has already been created, reopen the dialog. */
1760
  if (custom_uploader) {
1761
  custom_uploader.open();
1762
+ /*TODO remove return; */
1763
  }
1764
+ /* Extend the wp.media object. */
1765
  if (id == 'music') {
1766
  var library_type = 'audio';
1767
  }
1788
  button: { text: wds_object.translate.insert },
1789
  multiple: multiple
1790
  });
1791
+ /* When a file is selected, grab the URL and set it as the text field's value */
1792
  custom_uploader.on('select', function() {
1793
  if (multiple == false) {
1794
  attachment = custom_uploader.state().get('selection').first().toJSON();
1921
  }
1922
  case 'add_update_thumbnail' : {
1923
  if ( jQuery("#type" + slide_id).val() == "video" ) {
1924
+ /* For video slides.*/
1925
  jQuery("#wds_preview_image" + slide_id).css("background-image", 'url("' + image_url + '")');
1926
  }
1927
  jQuery("#thumb_url" + slide_id).val(image_url);
1979
  }
1980
  }
1981
  });
1982
+ /* Open the uploader dialog. */
1983
  custom_uploader.open();
1984
  }
1985
 
2149
  wds_hotspot_position();
2150
  }
2151
 
2152
+ /* Open/close section container on its header click.*/
2153
  jQuery(".hndle, .handlediv").each(function () {
2154
  jQuery(this).on("click", function () {
2155
  wds_toggle_postbox(this);
2196
  jQuery(".wds_box").removeClass("wds_active");
2197
  jQuery("." + box).addClass("wds_active");
2198
  if (box == "wds_settings_box") {
2199
+ /* Show "Reset all settings" button.*/
2200
  jQuery(".reset-all-settings").removeClass("wd-hidden");
2201
  }
2202
  else {
2203
+ /* Hide "Reset all settings" button.*/
2204
  jQuery(".reset-all-settings").addClass("wd-hidden");
2205
  }
2206
  jQuery(".tab_button_wrap").css('border-color','#ddd');
2211
  jQuery(".slides_tab_button_wrap a").css('border-color','#00A0D4');
2212
  }
2213
 
2214
+ /* Set preview container overflow width.*/
2215
  jQuery(".wds-preview-overflow").width(jQuery(".wd-slides-title").width());
2216
  }
2217
 
2904
  tbody_html = tbody + '<tr class="wds_layer_content">' + tbody_html.replace(/%%slideID%%/g, id) + '</tr>';
2905
  }
2906
  if (!duplicate) {
2907
+ if (spider_uploader_) { /* Add image layer by spider uploader.*/
2908
  wds_add_image_layer_by_spider_uploader(prefix, files, tbodyID, id, layerID, tbody_html);
2909
  }
2910
+ else { /* Add image layer by media uploader.*/
2911
  image_escape = wds_add_image_layer(prefix, tbodyID, id, layerID, tbody_html, edit);
2912
  }
2913
  }
3117
  }
3118
  jQuery("#" + prefix + "_top").val(parseInt(jQuery(this).offset().top - jQuery(".wds_preview_image" + id).offset().top));
3119
 
3120
+ /* Do not set layer width/height on drag.*/
3121
  if (jQuery("#" + prefix + "_image_width").val() == 0) {
3122
  jQuery("#" + prefix).css({'width': ''});
3123
  }
3171
  }
3172
  });
3173
  }
3174
+ });
3175
+ /* TODO. remove
3176
+ .disableSelection();
3177
+ jQuery(".ui-sortable").sortable("enable");
3178
+ */
3179
  }
3180
 
3181
  function wds_slide_weights() {
3197
  function wds_add_video_layer(prefix, tbodyID, id, layerID, tbody_html, edit) {
3198
  var custom_uploader;
3199
  /*event.preventDefault();*/
3200
+ /* If the uploader object has already been created, reopen the dialog.*/
3201
  if (custom_uploader) {
3202
  custom_uploader.open();
3203
  return;
3206
  if (typeof edit == "undefined") {
3207
  var edit = 0;
3208
  }
3209
+ /* Extend the wp.media object. */
3210
  custom_uploader = wp.media.frames.file_frame = wp.media({
3211
  title: wds_object.translate.choose_video,
3212
  library : { type : 'video'},
3213
  button: { text: wds_object.translate.insert },
3214
  multiple: false
3215
  });
3216
+ /* When a file is selected, grab the URL and set it as the text field's value.*/
3217
  custom_uploader.on('select', function() {
3218
  jQuery("#" + tbodyID).append(tbody_html);
3219
  attachment = custom_uploader.state().get('selection').first().toJSON();
3257
 
3258
  });
3259
 
3260
+ /* Open the uploader dialog.*/
3261
  custom_uploader.open();
3262
  }
3263
 
3264
  function wds_add_image_layer(prefix, tbodyID, id, layerID, tbody_html, edit) {
3265
  var custom_uploader;
3266
  /*event.preventDefault();*/
3267
+ /* If the uploader object has already been created, reopen the dialog.*/
3268
  if (custom_uploader) {
3269
  custom_uploader.open();
3270
  return;
3272
  if (typeof edit == "undefined") {
3273
  var edit = 0;
3274
  }
3275
+ /* Extend the wp.media object.*/
3276
  custom_uploader = wp.media.frames.file_frame = wp.media({
3277
  title: wds_object.translate.choose_image,
3278
  library : { type : 'image'},
3279
  button: { text: wds_object.translate.insert },
3280
  multiple: false
3281
  });
3282
+ /* When a file is selected, grab the URL and set it as the text field's value*/
3283
  custom_uploader.on('select', function() {
3284
  jQuery("#" + tbodyID).append(tbody_html);
3285
  attachment = custom_uploader.state().get('selection').first().toJSON();
3316
  jscolor.bind();
3317
  });
3318
 
3319
+ /* Open the uploader dialog.*/
3320
  custom_uploader.open();
3321
  }
3322
 
3395
  if (spider_uploader_) {
3396
  slide_upload_by = ' <a href="' + uploader_href_for_add_slide + '" class="action_buttons edit_slide thickbox thickbox-preview" title="'+ wds_object.translate.add_edit_image +'" onclick="return false;">'+ wds_object.translate.add_edit_image +'</a>';
3397
  update_thumb_by = ' <a href="' + upload_href_for_change_thumb + '" class="button button-secondary thickbox thickbox-preview" title="'+ wds_object.translate.edit_thumbnail +'" onclick="return false;">'+ wds_object.translate.edit_thumbnail +'</a>';
3398
+ /* TODO remove
3399
+ edit_slide_by = ' <a href="' + uploader_href_for_add_slide + '" class="wds_change_thumbnail thickbox thickbox-preview" title="'+ wds_object.translate.add_edit_image +'" onclick="return false;"></a>';
3400
+ */
3401
  img_layer_upload_by = ' <a onclick="' + (wds_object.is_free ? 'alert(\''+ wds_object.translate.disabled_in_free_version + '\')' : '') + '; return false;" ' + (wds_object.is_free ? '' : 'href="' + uploader_href_for_add_layer + '"') + ' class="action_buttons add_image_layer button-small' + (wds_object.is_free ? " wds_free_button" : " thickbox thickbox-preview") + '" title="'+ wds_object.translate.add_image_layer +'">'+ wds_object.translate.add_image_layer +'</a>';
3402
  }
3403
  else {
3572
  wds_slide_weights();
3573
  wds_onkeypress();
3574
 
3575
+ /* Open/close section container on its header click.*/
3576
  jQuery(".wds_slide" + slideID + " .hndle, .wds_slide" + slideID + " .handlediv").each(function () {
3577
  jQuery(this).on("click", function () {
3578
  wds_toggle_postbox(this);
3901
  var dot = filename.lastIndexOf(".");
3902
  var extension = filename.substr(dot + 1, filename.length);
3903
  var exten = 'zip';
3904
+ /* TODO remove
3905
+ exten=exten.replace(/\./g,'');
3906
+ exten=exten.replace(/ /g,'');
3907
+ */
3908
  if (extension.toLowerCase() == exten.toLowerCase()) {
3909
  return true;
3910
  }
4015
  var content = "";
4016
  var editor = tinyMCE.get("template_text");
4017
  if (editor) {
4018
+ /* Active tab is Visual.*/
4019
  content = editor.getContent();
4020
  }
4021
  else {
4022
+ /* Active tab is HTML.*/
4023
  content = jQuery("#template_text").val();
4024
  }
4025
  var prefix = jQuery("#current_prefix").val();
4222
  }
4223
 
4224
  jQuery(window).resize(function () {
4225
+ /* Set preview container overflow width.*/
4226
  jQuery(".wds-preview-overflow").width(jQuery(".wd-slides-title").width());
4227
  });
4228
+ /* Set slide title on chnage.*/
4229
  function wds_set_slide_title( id ) {
4230
  var val = jQuery('.wds_tab_title_wrap #title'+ id).val();
4231
  jQuery( '.wds_slide'+ id +' .wds_slide-title-'+ id ).html(val);
4232
  }
4233
 
4234
+ /* Hide dimensions and ratio based on full width in settings. */
4235
  function hide_dimmension_ratio() {
4236
  jQuery(".full_width_desc").hide();
4237
  jQuery("#" + jQuery('.wds_settings_box [name=full_width]:checked').attr("id") + "_desc").show();
4252
  }
4253
  }
4254
 
4255
+ /* Show How To block on tab.*/
4256
  function showHowToTabBlock(){
4257
  jQuery(".tab_conteiner .howto_tab_button_wrap.hide").removeClass('hide');
4258
  var id = jQuery("#current_id").val();
js/wds_frontend.js CHANGED
@@ -108,7 +108,7 @@ jQuery(window).on('load', function () {
108
  })
109
  });
110
 
111
- // restart slideshow
112
  function wds_restart_slideshow_autoplay( wds ) {
113
  if (!jQuery(".wds_ctrl_btn_" + wds).hasClass("fa-play")) {
114
  if (wds_params[wds].enable_slideshow_autoplay) {
@@ -269,7 +269,6 @@ function wds_show_thumb(key, wds) {
269
  'z-index': '9999',
270
  'left': dot_position,
271
  'background-image': 'url("' + image_url + '")',
272
- // 'background-size' : bg_fit,
273
  'background-size': 'contain',
274
  'background-repeat': 'no-repeat',
275
  'background-position': 'center center'
@@ -819,7 +818,7 @@ function wds_change_image_when_loaded(wds, current_key, key, wds_data, from_effe
819
  }, 10);
820
  }
821
 
822
- if (wds_params[wds].layer_out_next) { //$slider->layer_out_next
823
  for (var m = 0; m < current_slide_layers_count; m++) {
824
  if (jQuery('#wds_' + wds + '_slide' + wds_data[current_key]["id"] + '_layer' + wds_data[current_key]["layer_" + m + "_id"]).prev().attr('id') != 'wds_' + wds + '_slide' + wds_data[current_key]["id"] + '_layer' + wds_data[current_key]["layer_" + i + "_id"] + '_round_effect') {
825
  if (jQuery('#wds_' + wds + '_slide' + wds_data[current_key]["id"] + '_layer' + wds_data[current_key]["layer_" + m + "_id"]).css('opacity') != 0) {
@@ -1528,7 +1527,7 @@ function wds_set_layer_effect_out_wds(wds, i, key) {
1528
 
1529
  if(wds_params[wds].wds_data[key]["layer_" + i + "_type"] == 'video') {
1530
  var curr_iframe = jQuery('#wds_' + wds + '_slide' + wds_params[wds].wds_data[key]["id"] + '_layer' + wds_params[wds].wds_data[key]["layer_" + i + "_id"]+" .wds_video_layer_frame_" + wds);
1531
- /!* Pause layer videos.*!/
1532
  jQuery(".wds_video_layer_frame_" + wds).each(function () {
1533
  if(jQuery(this).attr('id') == curr_iframe.attr('id')) {
1534
  if (typeof jQuery(this)[0].contentWindow != "undefined") {
@@ -1992,7 +1991,7 @@ function wds_resize_slider( wds ) {
1992
  slide_orig_height = jQuery(window).height();
1993
  }
1994
  else {
1995
- //slide_orig_height = wds_params[wds].image_height + wds_params[wds].filmstrip_height * slide_orig_width / wds_params[wds].image_width;
1996
  slide_orig_height = (wds_params[wds].filmstrip_height + wds_params[wds].image_height) * ratio;
1997
  }
1998
  slide_width = jQuery(window).width();
@@ -2001,7 +2000,7 @@ function wds_resize_slider( wds ) {
2001
  else if ( full_width == "2" ) {
2002
  slide_orig_width = wds_get_overall_parent(jQuery("#wds_container1_"+wds));
2003
  ratio = slide_orig_width / wds_params[wds].image_width;
2004
- // slide_orig_height = wds_params[wds].image_height + wds_params[wds].filmstrip_height * slide_orig_width / wds_params[wds].image_width;
2005
  slide_orig_height = (wds_params[wds].filmstrip_height + wds_params[wds].image_height) * ratio - (2 * wds_params[wds].wds_glb_margin);
2006
  }
2007
  else if ( parseInt(wds_params[wds].full_width_for_mobile) ) {
108
  })
109
  });
110
 
111
+ /* restart slideshow. */
112
  function wds_restart_slideshow_autoplay( wds ) {
113
  if (!jQuery(".wds_ctrl_btn_" + wds).hasClass("fa-play")) {
114
  if (wds_params[wds].enable_slideshow_autoplay) {
269
  'z-index': '9999',
270
  'left': dot_position,
271
  'background-image': 'url("' + image_url + '")',
 
272
  'background-size': 'contain',
273
  'background-repeat': 'no-repeat',
274
  'background-position': 'center center'
818
  }, 10);
819
  }
820
 
821
+ if (wds_params[wds].layer_out_next) {
822
  for (var m = 0; m < current_slide_layers_count; m++) {
823
  if (jQuery('#wds_' + wds + '_slide' + wds_data[current_key]["id"] + '_layer' + wds_data[current_key]["layer_" + m + "_id"]).prev().attr('id') != 'wds_' + wds + '_slide' + wds_data[current_key]["id"] + '_layer' + wds_data[current_key]["layer_" + i + "_id"] + '_round_effect') {
824
  if (jQuery('#wds_' + wds + '_slide' + wds_data[current_key]["id"] + '_layer' + wds_data[current_key]["layer_" + m + "_id"]).css('opacity') != 0) {
1527
 
1528
  if(wds_params[wds].wds_data[key]["layer_" + i + "_type"] == 'video') {
1529
  var curr_iframe = jQuery('#wds_' + wds + '_slide' + wds_params[wds].wds_data[key]["id"] + '_layer' + wds_params[wds].wds_data[key]["layer_" + i + "_id"]+" .wds_video_layer_frame_" + wds);
1530
+ /* Pause layer videos. */
1531
  jQuery(".wds_video_layer_frame_" + wds).each(function () {
1532
  if(jQuery(this).attr('id') == curr_iframe.attr('id')) {
1533
  if (typeof jQuery(this)[0].contentWindow != "undefined") {
1991
  slide_orig_height = jQuery(window).height();
1992
  }
1993
  else {
1994
+ /* slide_orig_height = wds_params[wds].image_height + wds_params[wds].filmstrip_height * slide_orig_width / wds_params[wds].image_width; */
1995
  slide_orig_height = (wds_params[wds].filmstrip_height + wds_params[wds].image_height) * ratio;
1996
  }
1997
  slide_width = jQuery(window).width();
2000
  else if ( full_width == "2" ) {
2001
  slide_orig_width = wds_get_overall_parent(jQuery("#wds_container1_"+wds));
2002
  ratio = slide_orig_width / wds_params[wds].image_width;
2003
+ /* slide_orig_height = wds_params[wds].image_height + wds_params[wds].filmstrip_height * slide_orig_width / wds_params[wds].image_width; */
2004
  slide_orig_height = (wds_params[wds].filmstrip_height + wds_params[wds].image_height) * ratio - (2 * wds_params[wds].wds_glb_margin);
2005
  }
2006
  else if ( parseInt(wds_params[wds].full_width_for_mobile) ) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: responsive slider, slider, slideshow, wordpress slider, image slider, gall
4
  Requires at least: 3.4
5
  Tested up to: 4.9
6
  Requires PHP: 5.2
7
- Stable tag: 1.2.13
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -443,6 +443,11 @@ The plugin takes the full width of the widget area if the **Boxed Layout** in **
443
 
444
  == Changelog ==
445
 
 
 
 
 
 
446
  = 1.2.13 =
447
  * Fixed: Text layer fixed step position.
448
  * Fixed: Bug on slider preview.
4
  Requires at least: 3.4
5
  Tested up to: 4.9
6
  Requires PHP: 5.2
7
+ Stable tag: 1.2.14
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
443
 
444
  == Changelog ==
445
 
446
+ = 1.2.14 =
447
+ * Fixed: Add shortcode functionality on Beaver, Elementor, SiteOrigin and Visual Composer builders.
448
+ * Fixed: Set/Reset watermark functionality.
449
+ * Fixed: Conflict with Fast Velocity Minify plugin with minified js.
450
+
451
  = 1.2.13 =
452
  * Fixed: Text layer fixed step position.
453
  * Fixed: Bug on slider preview.
slider-wd.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Slider WD
5
  * Plugin URI: https://web-dorado.com/products/wordpress-slider-plugin.html
6
  * Description: This is a responsive plugin, which allows adding sliders to your posts/pages and to custom location. It uses large number of transition effects and supports various types of layers.
7
- * Version: 1.2.13
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com/wordpress-plugins-bundle.html
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -79,8 +79,8 @@ final class WDS {
79
  $this->plugin_dir = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__));
80
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
81
  $this->main_file = plugin_basename(__FILE__);
82
- $this->plugin_version = '1.2.13';
83
- $this->db_version = '1.2.13';
84
  $this->prefix = 'wds';
85
  $this->nicename = __('Slider WD', $this->prefix);
86
  $this->use_home_url();
@@ -173,6 +173,7 @@ final class WDS {
173
  if ( $this->is_free) {
174
  add_filter('plugin_row_meta', array($this, 'add_plugin_meta_links'), 10, 2);
175
  }
 
176
 
177
  // Enqueue block editor assets for Gutenberg.
178
  add_filter('tw_get_block_editor_assets', array($this, 'register_block_editor_assets'));
@@ -182,6 +183,11 @@ final class WDS {
182
  add_action( 'admin_init', array($this, 'add_privacy_policy_content') );
183
  }
184
 
 
 
 
 
 
185
  function add_privacy_policy_content() {
186
  if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
187
  return;
@@ -429,14 +435,15 @@ final class WDS {
429
  }
430
 
431
  function media_button($context) {
432
- global $pagenow;
433
- if (in_array($pagenow, array('post.php', 'page.php', 'post-new.php', 'post-edit.php', 'admin-ajax.php'))) {
434
- $context .= '
435
- <a onclick="tb_click.call(this); wds_thickDims(); return false;" href="' . add_query_arg(array('action' => 'WDSShortcode', 'TB_iframe' => '1'), admin_url('admin-ajax.php')) . '" class="wds_thickbox button" style="padding-left: 0.4em;" title="Select slider">
436
- <span class="wp-media-buttons-icon wds_media_button_icon" style="vertical-align: text-bottom; background: url(' . $this->plugin_url . '/images/wd_slider.png) no-repeat scroll left top rgba(0, 0, 0, 0);"></span>
437
- Add Slider WD
438
- </a>';
439
- }
 
440
  return $context;
441
  }
442
 
@@ -816,7 +823,7 @@ final class WDS {
816
  if ($query != '') {
817
  wp_register_style('wds_googlefonts', $url, null, null);
818
  }
819
- wp_register_script('wds_jquery_mobile', $this->front_url . '/js/jquery.mobile.js', array('jquery'), $this->plugin_version);
820
  wp_register_script($this->prefix . '_frontend', $this->front_url . '/js/wds_frontend.js', array('jquery'), $this->plugin_version, TRUE);
821
  wp_localize_script( $this->prefix . '_frontend', 'wds_object', array(
822
  "is_free" => $this->is_free,
@@ -824,9 +831,9 @@ final class WDS {
824
  'play' => __('Play', $this->prefix),
825
  ));
826
  if ( !$this->is_free ) {
827
- wp_register_script('wds_jquery_featureCarouselslider', $this->front_url . '/js/jquery.featureCarouselslider.js', array( 'jquery' ), $this->plugin_version);
828
- wp_register_script('wds_hotspot', $this->front_url . '/js/wds_hotspot.js', array( 'jquery' ), $this->plugin_version);
829
- wp_register_script('wds_youtube', 'https://www.youtube.com/iframe_api');
830
  }
831
  }
832
 
@@ -1284,24 +1291,45 @@ final class WDS {
1284
  }
1285
  </script>
1286
  <?php
1287
- // Remove previously registered or enqueued versions
1288
- $wp_scripts = wp_scripts();
1289
- foreach ($wp_scripts->registered as $key => $value) {
1290
- // Check for an older versions with prefix.
1291
- if (strpos($key, 'tw-gb-block') > 0) {
1292
- wp_deregister_script( $key );
1293
- wp_deregister_style( $key );
1294
- }
1295
- }
1296
- // Get the last version from all 10Web plugins.
1297
- $assets = apply_filters('tw_get_block_editor_assets', array());
1298
- // Not performing unregister or unenqueue as in old versions all are with prefixes.
1299
- wp_enqueue_script('tw-gb-block', $assets['js_path'], array( 'wp-blocks', 'wp-element' ), $assets['version']);
1300
- wp_localize_script('tw-gb-block', 'tw_obj', array(
1301
- 'nothing_selected' => __('Nothing selected.', $this->prefix),
1302
- 'empty_item' => __('- Select -', $this->prefix),
1303
- ));
1304
- wp_enqueue_style('tw-gb-block', $assets['css_path'], array( 'wp-edit-blocks' ), $assets['version']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1305
  }
1306
  }
1307
 
4
  * Plugin Name: Slider WD
5
  * Plugin URI: https://web-dorado.com/products/wordpress-slider-plugin.html
6
  * Description: This is a responsive plugin, which allows adding sliders to your posts/pages and to custom location. It uses large number of transition effects and supports various types of layers.
7
+ * Version: 1.2.14
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com/wordpress-plugins-bundle.html
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
79
  $this->plugin_dir = WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__));
80
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
81
  $this->main_file = plugin_basename(__FILE__);
82
+ $this->plugin_version = '1.2.14';
83
+ $this->db_version = '1.2.14';
84
  $this->prefix = 'wds';
85
  $this->nicename = __('Slider WD', $this->prefix);
86
  $this->use_home_url();
173
  if ( $this->is_free) {
174
  add_filter('plugin_row_meta', array($this, 'add_plugin_meta_links'), 10, 2);
175
  }
176
+ add_action('plugins_loaded', array($this, 'plugins_loaded'), 9);
177
 
178
  // Enqueue block editor assets for Gutenberg.
179
  add_filter('tw_get_block_editor_assets', array($this, 'register_block_editor_assets'));
183
  add_action( 'admin_init', array($this, 'add_privacy_policy_content') );
184
  }
185
 
186
+ function plugins_loaded() {
187
+ // Prevent adding shortcode conflict with some builders.
188
+ $this->before_shortcode_add_builder_editor();
189
+ }
190
+
191
  function add_privacy_policy_content() {
192
  if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
193
  return;
435
  }
436
 
437
  function media_button($context) {
438
+ ob_start();
439
+ $href = add_query_arg(array('action' => 'WDSShortcode', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
440
+ ?>
441
+ <a onclick="tb_click.call(this); wds_thickDims(); return false;" href="<?php echo $href; ?>" class="wds_thickbox button" title="<?php _e('Select slider', $this->prefix); ?>">
442
+ <span class="wp-media-buttons-icon wds_media_button_icon" style="vertical-align: text-bottom; background: url(<?php echo $this->plugin_url; ?>/images/wd_slider.png) no-repeat scroll left top rgba(0, 0, 0, 0);"></span>
443
+ <?php _e('Add Slider WD', $this->prefix); ?>
444
+ </a>
445
+ <?php
446
+ $context .= ob_get_clean();
447
  return $context;
448
  }
449
 
823
  if ($query != '') {
824
  wp_register_style('wds_googlefonts', $url, null, null);
825
  }
826
+ wp_register_script('wds_jquery_mobile', $this->front_url . '/js/jquery.mobile.js', array('jquery'), $this->plugin_version, TRUE);
827
  wp_register_script($this->prefix . '_frontend', $this->front_url . '/js/wds_frontend.js', array('jquery'), $this->plugin_version, TRUE);
828
  wp_localize_script( $this->prefix . '_frontend', 'wds_object', array(
829
  "is_free" => $this->is_free,
831
  'play' => __('Play', $this->prefix),
832
  ));
833
  if ( !$this->is_free ) {
834
+ wp_register_script('wds_jquery_featureCarouselslider', $this->front_url . '/js/jquery.featureCarouselslider.js', array( 'jquery' ), $this->plugin_version, TRUE);
835
+ wp_register_script('wds_hotspot', $this->front_url . '/js/wds_hotspot.js', array( 'jquery' ), $this->plugin_version, TRUE);
836
+ wp_register_script('wds_youtube', 'https://www.youtube.com/iframe_api', TRUE);
837
  }
838
  }
839
 
1291
  }
1292
  </script>
1293
  <?php
1294
+ // Remove previously registered or enqueued versions
1295
+ $wp_scripts = wp_scripts();
1296
+ foreach ($wp_scripts->registered as $key => $value) {
1297
+ // Check for an older versions with prefix.
1298
+ if (strpos($key, 'tw-gb-block') > 0) {
1299
+ wp_deregister_script( $key );
1300
+ wp_deregister_style( $key );
1301
+ }
1302
+ }
1303
+ // Get the last version from all 10Web plugins.
1304
+ $assets = apply_filters('tw_get_block_editor_assets', array());
1305
+ // Not performing unregister or unenqueue as in old versions all are with prefixes.
1306
+ wp_enqueue_script('tw-gb-block', $assets['js_path'], array( 'wp-blocks', 'wp-element' ), $assets['version']);
1307
+ wp_localize_script('tw-gb-block', 'tw_obj', array(
1308
+ 'nothing_selected' => __('Nothing selected.', $this->prefix),
1309
+ 'empty_item' => __('- Select -', $this->prefix),
1310
+ ));
1311
+ wp_enqueue_style('tw-gb-block', $assets['css_path'], array( 'wp-edit-blocks' ), $assets['version']);
1312
+ }
1313
+
1314
+ public static function check_minify_plugins() {
1315
+ include_once(ABSPATH . 'wp-admin/includes/plugin.php');
1316
+ /* Fast Velocity Minify */
1317
+ if( is_plugin_active('fast-velocity-minify/fvm.php') ) {
1318
+ return TRUE;
1319
+ }
1320
+ return FALSE;
1321
+ }
1322
+
1323
+ /**
1324
+ * Prevent adding shortcode conflict with some builders.
1325
+ */
1326
+ private function before_shortcode_add_builder_editor() {
1327
+ if ( defined('ELEMENTOR_VERSION') ) {
1328
+ add_action('elementor/editor/before_enqueue_scripts', array( $this, 'admin_head' ));
1329
+ }
1330
+ if ( class_exists('FLBuilder') ) {
1331
+ add_action('wp_enqueue_scripts', array( $this, 'admin_head' ));
1332
+ }
1333
  }
1334
  }
1335
 
wd/assets/img/fmc_main_plugin.png ADDED
Binary file