Photo Gallery by WD – Responsive Photo Gallery - Version 1.5.61

Version Description

  • Fixed: Conflicts with WP5.5.
  • Fixed: Conflicts with PHP7.4.
  • Fixed: Bug on lightbox fading effect.
Download this release

Release Info

Developer 10web
Plugin Icon 128x128 Photo Gallery by WD – Responsive Photo Gallery
Version 1.5.61
Comparing to
See all releases

Code changes from version 1.5.60 to 1.5.61

Files changed (47) hide show
  1. admin/controllers/Albums.php +6 -4
  2. admin/controllers/Galleries.php +9 -5
  3. admin/controllers/Options.php +1 -1
  4. admin/controllers/Shortcode.php +1 -1
  5. admin/controllers/Themes.php +3 -2
  6. admin/models/AddTags.php +13 -6
  7. admin/models/Albums.php +81 -29
  8. admin/models/Albumsgalleries.php +18 -6
  9. admin/models/Galleries.php +314 -122
  10. admin/models/Themes.php +9 -5
  11. admin/views/AddTags.php +1 -1
  12. admin/views/AdminView.php +11 -17
  13. admin/views/Albumsgalleries.php +1 -1
  14. admin/views/Editimage.php +3 -3
  15. admin/views/Options.php +2 -2
  16. admin/views/Shortcode.php +315 -315
  17. css/bwg_tables.css +17 -2
  18. filemanager/UploadHandler.php +1 -1
  19. filemanager/controller.php +134 -47
  20. filemanager/js/default.js +1 -1
  21. filemanager/model.php +21 -12
  22. filemanager/view.php +1 -1
  23. framework/WDWLibrary.php +75 -22
  24. framework/WDWLibraryEmbed.php +38 -10
  25. framework/howto/howto.php +1 -1
  26. frontend/controllers/BWGControllerGalleryBox.php +2 -1
  27. frontend/models/BWGModelGalleryBox.php +20 -6
  28. frontend/models/BWGModelWidget.php +8 -2
  29. frontend/models/model.php +39 -21
  30. frontend/views/BWGViewAlbum_compact_preview.php +1 -1
  31. frontend/views/BWGViewAlbum_extended_preview.php +1 -1
  32. frontend/views/BWGViewImage_browser.php +1 -1
  33. frontend/views/BWGViewSlideshow.php +2 -2
  34. frontend/views/BWGViewThumbnails.php +1 -1
  35. frontend/views/view.php +3 -3
  36. js/bwg.js +1643 -1599
  37. js/bwg_editor_button.js +2 -2
  38. js/bwg_elementor_widget.js +1 -1
  39. js/bwg_embed.js +2 -2
  40. js/bwg_frontend.js +3 -2
  41. js/bwg_gallery_box.js +1 -1
  42. js/bwg_shortcode.js +5 -3
  43. js/scripts.min.js +1 -1
  44. photo-gallery.php +4 -4
  45. readme.txt +6 -1
  46. wd/assets/js/overview.js +1 -1
  47. wd/includes/deactivate.php +1 -1
admin/controllers/Albums.php CHANGED
@@ -264,8 +264,9 @@ class AlbumsController_bwg {
264
  */
265
  public function publish( $id, $bulk = FALSE, $all = FALSE ) {
266
  global $wpdb;
267
- $where = ($all ? '' : ' WHERE id=' . $id);
268
- $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_album` SET published=1' . $where);
 
269
  $message = 2;
270
  if ($updated) {
271
  $message = 9;
@@ -293,8 +294,9 @@ class AlbumsController_bwg {
293
  */
294
  public function unpublish( $id, $bulk = FALSE, $all = FALSE ) {
295
  global $wpdb;
296
- $where = ($all ? '' : ' WHERE id=' . $id);
297
- $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_album` SET published=0' . $where);
 
298
  $message = 2;
299
  if ($updated) {
300
  $message = 10;
264
  */
265
  public function publish( $id, $bulk = FALSE, $all = FALSE ) {
266
  global $wpdb;
267
+ $where = ($all ? '' : ' WHERE id=%d');
268
+ $format = ($all ? '' : $id);
269
+ $updated = $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_album` SET published=1' . $where, $format));
270
  $message = 2;
271
  if ($updated) {
272
  $message = 9;
294
  */
295
  public function unpublish( $id, $bulk = FALSE, $all = FALSE ) {
296
  global $wpdb;
297
+ $where = ($all ? '' : ' WHERE id=%d');
298
+ $format = ($all ? '' : $id);
299
+ $updated = $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_album` SET published=0' . $where, $format));
300
  $message = 2;
301
  if ($updated) {
302
  $message = 10;
admin/controllers/Galleries.php CHANGED
@@ -208,9 +208,11 @@ class GalleriesController_bwg {
208
  * @return int
209
  */
210
  public function publish( $id, $bulk = FALSE, $all = FALSE ) {
 
211
  global $wpdb;
212
- $where = ($all ? '' : ' WHERE id=' . $id);
213
- $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_gallery` SET published=1' . $where);
 
214
 
215
  if ( $updated !== FALSE ) {
216
  $message = 9;
@@ -242,8 +244,10 @@ class GalleriesController_bwg {
242
  */
243
  public function unpublish( $id, $bulk = FALSE, $all = FALSE ) {
244
  global $wpdb;
245
- $where = ($all ? '' : ' WHERE id=' . $id);
246
- $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_gallery` SET published=0' . $where);
 
 
247
 
248
  if ( $updated !== FALSE ) {
249
  $message = 10;
@@ -413,7 +417,7 @@ class GalleriesController_bwg {
413
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
414
  $not_set_items = array();
415
  if ( $gallery_id ) {
416
- $rows = $wpdb->get_results('SELECT T_IMAGES.thumb_url, T_PRICELISTS.item_longest_dimension, T_IMAGES.id FROM ' . $wpdb->prefix . 'bwg_image AS T_IMAGES LEFT JOIN ( SELECT MAX(item_longest_dimension) AS item_longest_dimension, pricelist_id FROM ' . $wpdb->prefix . 'wdpg_ecommerce_pricelist_items AS T_PRICELIST_ITEMS LEFT JOIN ' . $wpdb->prefix . 'wdpg_ecommerce_pricelists AS T_PRICELISTS ON T_PRICELIST_ITEMS.pricelist_id = T_PRICELISTS.id WHERE T_PRICELISTS.sections LIKE "%downloads%" GROUP BY pricelist_id) AS T_PRICELISTS ON T_IMAGES.pricelist_id = T_PRICELISTS.pricelist_id WHERE T_IMAGES.gallery_id="' . $gallery_id . '"');
417
  foreach ( $rows as $row ) {
418
  if ( $row->item_longest_dimension ) {
419
  $file_path = str_replace("thumb", ".original", htmlspecialchars_decode(BWG()->upload_dir . $row->thumb_url, ENT_COMPAT | ENT_QUOTES));
208
  * @return int
209
  */
210
  public function publish( $id, $bulk = FALSE, $all = FALSE ) {
211
+
212
  global $wpdb;
213
+ $where = ($all ? '' : ' WHERE id=%d');
214
+ $format = ($all ? '' : $id);
215
+ $updated = $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_gallery` SET published=1' . $where,$format));
216
 
217
  if ( $updated !== FALSE ) {
218
  $message = 9;
244
  */
245
  public function unpublish( $id, $bulk = FALSE, $all = FALSE ) {
246
  global $wpdb;
247
+ $where = ($all ? '' : ' WHERE id=%d');
248
+ $format = ($all ? '' : $id);
249
+
250
+ $updated = $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_gallery` SET published=0' . $where,$format));
251
 
252
  if ( $updated !== FALSE ) {
253
  $message = 10;
417
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
418
  $not_set_items = array();
419
  if ( $gallery_id ) {
420
+ $rows = $wpdb->get_results($wpdb->prepare('SELECT T_IMAGES.thumb_url, T_PRICELISTS.item_longest_dimension, T_IMAGES.id FROM ' . $wpdb->prefix . 'bwg_image AS T_IMAGES LEFT JOIN ( SELECT MAX(item_longest_dimension) AS item_longest_dimension, pricelist_id FROM ' . $wpdb->prefix . 'wdpg_ecommerce_pricelist_items AS T_PRICELIST_ITEMS LEFT JOIN ' . $wpdb->prefix . 'wdpg_ecommerce_pricelists AS T_PRICELISTS ON T_PRICELIST_ITEMS.pricelist_id = T_PRICELISTS.id WHERE T_PRICELISTS.sections LIKE "%downloads%" GROUP BY pricelist_id) AS T_PRICELISTS ON T_IMAGES.pricelist_id = T_PRICELISTS.pricelist_id WHERE T_IMAGES.gallery_id=%d',$gallery_id));
421
  foreach ( $rows as $row ) {
422
  if ( $row->item_longest_dimension ) {
423
  $file_path = str_replace("thumb", ".original", htmlspecialchars_decode(BWG()->upload_dir . $row->thumb_url, ENT_COMPAT | ENT_QUOTES));
admin/controllers/Options.php CHANGED
@@ -276,7 +276,7 @@ class OptionsController_bwg {
276
  if ( $limitstart == 0 ) {
277
  $this->model->update_options_by_key( array('upload_thumb_width' => $max_width,'upload_thumb_height' => $max_height ) );
278
  }
279
- $img_ids = $wpdb->get_results('SELECT id, thumb_url, filetype FROM ' . $wpdb->prefix . 'bwg_image LIMIT 50 OFFSET ' . $limitstart);
280
  foreach ($img_ids as $img_id) {
281
  if ( preg_match('/EMBED/', $img_id->filetype) == 1 ) {
282
  continue;
276
  if ( $limitstart == 0 ) {
277
  $this->model->update_options_by_key( array('upload_thumb_width' => $max_width,'upload_thumb_height' => $max_height ) );
278
  }
279
+ $img_ids = $wpdb->get_results($wpdb->prepare('SELECT id, thumb_url, filetype FROM ' . $wpdb->prefix . 'bwg_image LIMIT 50 OFFSET %d', $limitstart));
280
  foreach ($img_ids as $img_id) {
281
  if ( preg_match('/EMBED/', $img_id->filetype) == 1 ) {
282
  continue;
admin/controllers/Shortcode.php CHANGED
@@ -65,7 +65,7 @@ class ShortcodeController_bwg {
65
  if (!$insert) {
66
  $wpdb->update($wpdb->prefix . 'bwg_shortcode', array(
67
  'tagtext' => $tagtext
68
- ), array('id' => $id));
69
  }
70
  else {
71
  $wpdb->insert($wpdb->prefix . 'bwg_shortcode', array(
65
  if (!$insert) {
66
  $wpdb->update($wpdb->prefix . 'bwg_shortcode', array(
67
  'tagtext' => $tagtext
68
+ ), array('id' => $id), array('%s'), array('%d'));
69
  }
70
  else {
71
  $wpdb->insert($wpdb->prefix . 'bwg_shortcode', array(
admin/controllers/Themes.php CHANGED
@@ -155,8 +155,9 @@ class ThemesController_bwg {
155
  }
156
  else {
157
  global $wpdb;
158
- $where = ($all ? '' : ' WHERE id=' . $id);
159
- $delete = $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_theme`' . $where);
 
160
  if ( $delete ) {
161
  $message = 3;
162
  }
155
  }
156
  else {
157
  global $wpdb;
158
+ $where = ($all ? '' : ' WHERE id=%d');
159
+ $format = ($all ? '' : $id);
160
+ $delete = $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_theme`' . $where, $format));
161
  if ( $delete ) {
162
  $message = 3;
163
  }
admin/models/AddTags.php CHANGED
@@ -13,6 +13,7 @@ class AddTagsModel_bwg {
13
  * @return array|null|object|string
14
  */
15
  public function get_rows_data( $params, $total = FALSE ) {
 
16
  global $wpdb;
17
  $order = $params['order'];
18
  $orderby = $params['orderby'];
@@ -20,6 +21,8 @@ class AddTagsModel_bwg {
20
  $page_num = $params['page_num'];
21
  $search = $params['search'];
22
 
 
 
23
  if ( !$total ) {
24
  $query = 'SELECT table1.term_id as id, table1.name, table1.slug';
25
  }
@@ -27,23 +30,27 @@ class AddTagsModel_bwg {
27
  $query = 'SELECT COUNT(*)';
28
  }
29
 
 
30
  $query .= ' FROM `' . $wpdb->prefix . 'terms` AS table1';
31
  $query .= ' INNER JOIN `' . $wpdb->prefix . 'term_taxonomy` AS table2 ON table1.term_id = table2.term_id';
32
- $query .= ' WHERE table2.taxonomy="bwg_tag"';
33
 
34
  if ( $search ) {
35
- $query .= ' AND `name` LIKE "%' . $search . '%"';
 
36
  }
37
  if ( !$total ) {
38
- $query .= ' ORDER BY `' . $orderby . '` ' . $order;
39
- $query .= ' LIMIT ' . $page_num . ',' . $page_per;
 
 
40
  }
41
 
42
  if ( !$total ) {
43
- $rows = $wpdb->get_results($query);
44
  }
45
  else {
46
- $rows = $wpdb->get_var($query);
47
  }
48
 
49
  return $rows;
13
  * @return array|null|object|string
14
  */
15
  public function get_rows_data( $params, $total = FALSE ) {
16
+
17
  global $wpdb;
18
  $order = $params['order'];
19
  $orderby = $params['orderby'];
21
  $page_num = $params['page_num'];
22
  $search = $params['search'];
23
 
24
+ $prepareArgs = array("bwg_tag");
25
+
26
  if ( !$total ) {
27
  $query = 'SELECT table1.term_id as id, table1.name, table1.slug';
28
  }
30
  $query = 'SELECT COUNT(*)';
31
  }
32
 
33
+
34
  $query .= ' FROM `' . $wpdb->prefix . 'terms` AS table1';
35
  $query .= ' INNER JOIN `' . $wpdb->prefix . 'term_taxonomy` AS table2 ON table1.term_id = table2.term_id';
36
+ $query .= ' WHERE table2.taxonomy=%s';
37
 
38
  if ( $search ) {
39
+ $query .= ' AND `name` LIKE %s';
40
+ $prepareArgs[] = "%" . $wpdb->esc_like($search) . "%";
41
  }
42
  if ( !$total ) {
43
+ $query .= ' ORDER BY `' . $orderby . '` ' .$order;
44
+ $query .= ' LIMIT %d, %d';
45
+ $prepareArgs[] = $page_num;
46
+ $prepareArgs[] = $page_per;
47
  }
48
 
49
  if ( !$total ) {
50
+ $rows = $wpdb->get_results($wpdb->prepare($query, $prepareArgs));
51
  }
52
  else {
53
+ $rows = $wpdb->get_var($wpdb->prepare($query, $prepareArgs));
54
  }
55
 
56
  return $rows;
admin/models/Albums.php CHANGED
@@ -20,6 +20,8 @@ class AlbumsModel_bwg {
20
  $page_num = $params['page_num'];
21
  $search = $params['search'];
22
 
 
 
23
  if ( !$total ) {
24
  $query = 'SELECT *';
25
  }
@@ -29,26 +31,31 @@ class AlbumsModel_bwg {
29
 
30
  $query .= ' FROM `' . $wpdb->prefix . 'bwg_album`';
31
  if ( !current_user_can('manage_options') && BWG()->options->album_role ) {
32
- $query .= " WHERE author=" . get_current_user_id();
 
33
  }
34
  else {
35
- $query .= " WHERE author>=0";
 
36
  }
37
 
38
  if ( $search ) {
39
- $query .= ' AND `name` LIKE "%' . $search . '%"';
 
40
  }
41
  if ( !$total ) {
42
  $query .= ' ORDER BY `' . $orderby . '` ' . $order;
43
- $query .= ' LIMIT ' . $page_num . ',' . $page_per;
 
 
 
44
  }
45
  if ( !$total ) {
46
- $rows = $wpdb->get_results($query);
47
  }
48
  else {
49
- $rows = $wpdb->get_var($query);
50
  }
51
-
52
  return $rows;
53
  }
54
 
@@ -73,12 +80,16 @@ class AlbumsModel_bwg {
73
  */
74
  public function delete( $id, $all = FALSE ) {
75
  global $wpdb;
76
- $where = ($all ? '' : ' WHERE id=' . $id);
77
- $alb_gal_where = ($all ? '' : ' AND alb_gal_id=' . $id);
 
 
 
 
78
 
79
  // Remove custom post.
80
  if ( $all ) {
81
- $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'posts` WHERE `post_type`="bwg_album"');
82
  }
83
  else {
84
  $row = $wpdb->get_row( $wpdb->prepare('SELECT `slug` FROM `' . $wpdb->prefix . 'bwg_album` WHERE id="%d"', $id) );
@@ -87,8 +98,8 @@ class AlbumsModel_bwg {
87
  }
88
  }
89
 
90
- $delete = $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_album`' . $where);
91
- $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_album_gallery` WHERE is_album="1"' . $alb_gal_where);
92
 
93
  if ( $delete ) {
94
  if ( $all ) {
@@ -138,24 +149,38 @@ class AlbumsModel_bwg {
138
  $album_row['order'] = $row->order;
139
  $album_row['author'] = $row->author;
140
  $album_row['published'] = $row->published;
 
 
 
 
 
 
 
 
 
 
141
  // Insert bwg_album.
142
- $album_id = $this->insert_data_to_db('bwg_album', $album_row);
143
  if ( $album_id ) {
144
  $slug = $album_row['slug'] . '-' . $album_id;
145
  // Update bwg_album slug.
146
- $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_album` SET `slug`="' . $slug . '" WHERE id = ' . $album_id);
 
147
  $album_gallery_row['album_id'] = $album_id;
148
  if ( $row->alb_gal_id ) {
149
  $album_gallery_row['alb_gal_id'] = $row->alb_gal_id;
 
150
  }
151
  if ( $row->is_album ) {
152
  $album_gallery_row['is_album'] = $row->is_album;
 
153
  }
154
  if ( $row->ag_order ) {
155
  $album_gallery_row['order'] = $row->ag_order;
 
156
  }
157
  // Insert bwg_album_gallery.
158
- $album_gallery_id = $this->insert_data_to_db('bwg_album_gallery', $album_gallery_row);
159
  if ( $album_gallery_id ) {
160
  // Create custom post.
161
  $custom_post_params = array(
@@ -176,7 +201,7 @@ class AlbumsModel_bwg {
176
  }
177
  // Duplicate itme by id.
178
  else {
179
- $rows = $wpdb->get_results('SELECT
180
  `a`.*,
181
  `ag`.alb_gal_id,
182
  `ag`.is_album,
@@ -187,7 +212,7 @@ class AlbumsModel_bwg {
187
  ON
188
  (`a`.`id` = `ag`.`album_id`)
189
  WHERE
190
- `a`.`id` = ' . $id);
191
  if ( $rows ) {
192
  $row = $rows[0];
193
  $album_row['name'] = $row->name;
@@ -199,24 +224,38 @@ class AlbumsModel_bwg {
199
  $album_row['author'] = $row->author;
200
  $album_row['published'] = $row->published;
201
  // Insert bwg_album.
202
- $album_id = $this->insert_data_to_db('bwg_album', $album_row);
 
 
 
 
 
 
 
 
 
 
203
  if ( $album_id ) {
204
  $slug = $album_row['slug'] . '-' . $album_id;
205
  // Update bwg_album slug.
206
- $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_album` SET `slug`="' . $slug . '" WHERE id = ' . $album_id);
207
  $album_gallery_row['album_id'] = $album_id;
 
208
  foreach ( $rows as $row ) {
209
  if ( $row->alb_gal_id ) {
210
  $album_gallery_row['alb_gal_id'] = $row->alb_gal_id;
 
211
  }
212
  if ( $row->is_album ) {
213
  $album_gallery_row['is_album'] = $row->is_album;
 
214
  }
215
  if ( $row->ag_order ) {
216
  $album_gallery_row['order'] = $row->ag_order;
 
217
  }
218
  // Insert bwg_album_gallery.
219
- $album_gallery_id = $this->insert_data_to_db('bwg_album_gallery', $album_gallery_row);
220
  }
221
  $message_id = 11;
222
  // Create custom post.
@@ -245,15 +284,19 @@ class AlbumsModel_bwg {
245
  * @return array|null|object|stdClass|void
246
  */
247
  public function get_row_data( $id = 0 ) {
 
248
  global $wpdb;
 
249
  if ( $id != 0 ) {
250
  if ( !current_user_can('manage_options') && BWG()->options->album_role ) {
251
- $where = " WHERE author = " . get_current_user_id();
 
252
  }
253
  else {
254
  $where = " WHERE author >= 0 ";
255
  }
256
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_album`' . $where . ' AND id="%d"', $id));
 
257
  }
258
  else {
259
  $row = new stdClass();
@@ -303,8 +346,16 @@ class AlbumsModel_bwg {
303
  'published' => $published,
304
  'modified_date' => $modified_date
305
  );
 
 
 
 
 
 
 
 
306
  if ( $id ) {
307
- $save = $wpdb->update($wpdb->prefix . 'bwg_album', $data, array( 'id' => $id ));
308
  }
309
  else {
310
  $data['author'] = $author;
@@ -338,7 +389,7 @@ class AlbumsModel_bwg {
338
  $save = $this->save_album_gallery($id, $albumgallery_ids);
339
  // Set random image.
340
  $random_preview_image = (($preview_image == '') ? $this->get_image_for_album($id) : '');
341
- $wpdb->update($wpdb->prefix . 'bwg_album', array( 'random_preview_image' => $random_preview_image ), array( 'id' => $id ));
342
  if ( $save !== FALSE ) {
343
  $message_id = 1;
344
  }
@@ -351,12 +402,13 @@ class AlbumsModel_bwg {
351
  *
352
  * @param string $table
353
  * @param array $data
 
354
  *
355
  * @return array
356
  */
357
- private function insert_data_to_db( $table, $data ) {
358
  global $wpdb;
359
- $insert = $wpdb->insert($wpdb->prefix . $table, $data);
360
  if ( $insert ) {
361
  return $wpdb->insert_id;
362
  }
@@ -439,10 +491,10 @@ class AlbumsModel_bwg {
439
  */
440
  public function get_albums_galleries_data( $id = 0 ) {
441
  global $wpdb;
442
- $query = '(SELECT t1.id, t2.name, t2.slug, t1.is_album, t1.alb_gal_id, t1.order, t2.preview_image, t2.random_preview_image, t2.published FROM ' . $wpdb->prefix . 'bwg_album_gallery as t1 INNER JOIN ' . $wpdb->prefix . 'bwg_album as t2 on t1.alb_gal_id = t2.id where t1.is_album="1" AND t1.album_id="' . $id . '")
443
  UNION
444
- (SELECT t1.id, t2.name, t2.slug, t1.is_album, t1.alb_gal_id, t1.order, t2.preview_image, t2.random_preview_image, t2.published FROM ' . $wpdb->prefix . 'bwg_album_gallery as t1 INNER JOIN ' . $wpdb->prefix . 'bwg_gallery as t2 on t1.alb_gal_id = t2.id where t1.is_album="0" AND t1.album_id="' . $id . '") ORDER BY `order`';
445
- $results = $wpdb->get_results($query);
446
  if ( !empty($results) ) {
447
  foreach ( $results as $result ) {
448
  $preview_image = BWG()->plugin_url . '/images/no-image.png';
20
  $page_num = $params['page_num'];
21
  $search = $params['search'];
22
 
23
+ $prepareArgs = array();
24
+
25
  if ( !$total ) {
26
  $query = 'SELECT *';
27
  }
31
 
32
  $query .= ' FROM `' . $wpdb->prefix . 'bwg_album`';
33
  if ( !current_user_can('manage_options') && BWG()->options->album_role ) {
34
+ $query .= " WHERE author = %d";
35
+ $prepareArgs[] = get_current_user_id();
36
  }
37
  else {
38
+ $query .= " WHERE author>=%d";
39
+ $prepareArgs[] = 0;
40
  }
41
 
42
  if ( $search ) {
43
+ $query .= ' AND `name` LIKE %s';
44
+ $prepareArgs[] = "%" . $wpdb->esc_like($search) . "%";
45
  }
46
  if ( !$total ) {
47
  $query .= ' ORDER BY `' . $orderby . '` ' . $order;
48
+ $query .= ' LIMIT %d, %d';
49
+ $prepareArgs[] = $page_num;
50
+ $prepareArgs[] = $page_per;
51
+
52
  }
53
  if ( !$total ) {
54
+ $rows = $wpdb->get_results($wpdb->prepare($query, $prepareArgs));
55
  }
56
  else {
57
+ $rows = $wpdb->get_var($wpdb->prepare($query, $prepareArgs));
58
  }
 
59
  return $rows;
60
  }
61
 
80
  */
81
  public function delete( $id, $all = FALSE ) {
82
  global $wpdb;
83
+ $prepareArgs = array();
84
+ if( !$all ) {
85
+ $where = ' WHERE id = %d';
86
+ $alb_gal_where = ' AND alb_gal_id = %d';
87
+ $prepareArgs[] = $id;
88
+ }
89
 
90
  // Remove custom post.
91
  if ( $all ) {
92
+ $wpdb->query( $wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'posts` WHERE `post_type`=%s',"bwg_album") );
93
  }
94
  else {
95
  $row = $wpdb->get_row( $wpdb->prepare('SELECT `slug` FROM `' . $wpdb->prefix . 'bwg_album` WHERE id="%d"', $id) );
98
  }
99
  }
100
 
101
+ $delete = $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_album`' . $where, $prepareArgs));
102
+ $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_album_gallery` WHERE is_album="1"' . $alb_gal_where, $prepareArgs));
103
 
104
  if ( $delete ) {
105
  if ( $all ) {
149
  $album_row['order'] = $row->order;
150
  $album_row['author'] = $row->author;
151
  $album_row['published'] = $row->published;
152
+ $format = array(
153
+ '%s',
154
+ '%s',
155
+ '%s',
156
+ '%s',
157
+ '%s',
158
+ '%d',
159
+ '%d',
160
+ '%d',
161
+ );
162
  // Insert bwg_album.
163
+ $album_id = $this->insert_data_to_db('bwg_album', $album_row, $format);
164
  if ( $album_id ) {
165
  $slug = $album_row['slug'] . '-' . $album_id;
166
  // Update bwg_album slug.
167
+ $updated = $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_album` SET `slug`=%s WHERE id = %d', $slug, $album_id));
168
+ $format = array('%d');
169
  $album_gallery_row['album_id'] = $album_id;
170
  if ( $row->alb_gal_id ) {
171
  $album_gallery_row['alb_gal_id'] = $row->alb_gal_id;
172
+ $format[] = '%d';
173
  }
174
  if ( $row->is_album ) {
175
  $album_gallery_row['is_album'] = $row->is_album;
176
+ $format[] = '%d';
177
  }
178
  if ( $row->ag_order ) {
179
  $album_gallery_row['order'] = $row->ag_order;
180
+ $format[] = '%d';
181
  }
182
  // Insert bwg_album_gallery.
183
+ $album_gallery_id = $this->insert_data_to_db('bwg_album_gallery', $album_gallery_row, $format);
184
  if ( $album_gallery_id ) {
185
  // Create custom post.
186
  $custom_post_params = array(
201
  }
202
  // Duplicate itme by id.
203
  else {
204
+ $rows = $wpdb->get_results($wpdb->prepare('SELECT
205
  `a`.*,
206
  `ag`.alb_gal_id,
207
  `ag`.is_album,
212
  ON
213
  (`a`.`id` = `ag`.`album_id`)
214
  WHERE
215
+ `a`.`id` = %d',$id));
216
  if ( $rows ) {
217
  $row = $rows[0];
218
  $album_row['name'] = $row->name;
224
  $album_row['author'] = $row->author;
225
  $album_row['published'] = $row->published;
226
  // Insert bwg_album.
227
+ $format = array(
228
+ '%s',
229
+ '%s',
230
+ '%s',
231
+ '%s',
232
+ '%s',
233
+ '%d',
234
+ '%d',
235
+ '%d',
236
+ );
237
+ $album_id = $this->insert_data_to_db('bwg_album', $album_row, $format);
238
  if ( $album_id ) {
239
  $slug = $album_row['slug'] . '-' . $album_id;
240
  // Update bwg_album slug.
241
+ $updated = $wpdb->query( $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_album` SET `slug`=%s WHERE id = %d', $slug, $album_id) );
242
  $album_gallery_row['album_id'] = $album_id;
243
+ $format = array('%d');
244
  foreach ( $rows as $row ) {
245
  if ( $row->alb_gal_id ) {
246
  $album_gallery_row['alb_gal_id'] = $row->alb_gal_id;
247
+ $format[] = '%d';
248
  }
249
  if ( $row->is_album ) {
250
  $album_gallery_row['is_album'] = $row->is_album;
251
+ $format[] = '%d';
252
  }
253
  if ( $row->ag_order ) {
254
  $album_gallery_row['order'] = $row->ag_order;
255
+ $format[] = '%d';
256
  }
257
  // Insert bwg_album_gallery.
258
+ $album_gallery_id = $this->insert_data_to_db('bwg_album_gallery', $album_gallery_row, $format);
259
  }
260
  $message_id = 11;
261
  // Create custom post.
284
  * @return array|null|object|stdClass|void
285
  */
286
  public function get_row_data( $id = 0 ) {
287
+
288
  global $wpdb;
289
+ $prepareArgs = array();
290
  if ( $id != 0 ) {
291
  if ( !current_user_can('manage_options') && BWG()->options->album_role ) {
292
+ $where = " WHERE author = %d";
293
+ $prepareArgs[] = get_current_user_id();
294
  }
295
  else {
296
  $where = " WHERE author >= 0 ";
297
  }
298
+ $prepareArgs[] = $id;
299
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_album`' . $where . ' AND id="%d"', $prepareArgs));
300
  }
301
  else {
302
  $row = new stdClass();
346
  'published' => $published,
347
  'modified_date' => $modified_date
348
  );
349
+ $format = array(
350
+ '%s',
351
+ '%s',
352
+ '%s',
353
+ '%s',
354
+ '%d',
355
+ '%d'
356
+ );
357
  if ( $id ) {
358
+ $save = $wpdb->update($wpdb->prefix . 'bwg_album', $data, array( 'id' => intval($id) ), $format);
359
  }
360
  else {
361
  $data['author'] = $author;
389
  $save = $this->save_album_gallery($id, $albumgallery_ids);
390
  // Set random image.
391
  $random_preview_image = (($preview_image == '') ? $this->get_image_for_album($id) : '');
392
+ $wpdb->update($wpdb->prefix . 'bwg_album', array( 'random_preview_image' => $random_preview_image ), array( 'id' => $id ), array('%s'));
393
  if ( $save !== FALSE ) {
394
  $message_id = 1;
395
  }
402
  *
403
  * @param string $table
404
  * @param array $data
405
+ * @param array $format
406
  *
407
  * @return array
408
  */
409
+ private function insert_data_to_db( $table, $data, $format = array() ) {
410
  global $wpdb;
411
+ $insert = $wpdb->insert($wpdb->prefix . $table, $data, $format);
412
  if ( $insert ) {
413
  return $wpdb->insert_id;
414
  }
491
  */
492
  public function get_albums_galleries_data( $id = 0 ) {
493
  global $wpdb;
494
+ $query = '(SELECT t1.id, t2.name, t2.slug, t1.is_album, t1.alb_gal_id, t1.order, t2.preview_image, t2.random_preview_image, t2.published FROM ' . $wpdb->prefix . 'bwg_album_gallery as t1 INNER JOIN ' . $wpdb->prefix . 'bwg_album as t2 on t1.alb_gal_id = t2.id where t1.is_album="1" AND t1.album_id="%d")
495
  UNION
496
+ (SELECT t1.id, t2.name, t2.slug, t1.is_album, t1.alb_gal_id, t1.order, t2.preview_image, t2.random_preview_image, t2.published FROM ' . $wpdb->prefix . 'bwg_album_gallery as t1 INNER JOIN ' . $wpdb->prefix . 'bwg_gallery as t2 on t1.alb_gal_id = t2.id where t1.is_album="0" AND t1.album_id="%d") ORDER BY `order`';
497
+ $results = $wpdb->get_results( $wpdb->prepare($query, $id, $id) );
498
  if ( !empty($results) ) {
499
  foreach ( $results as $result ) {
500
  $preview_image = BWG()->plugin_url . '/images/no-image.png';
admin/models/Albumsgalleries.php CHANGED
@@ -14,18 +14,30 @@ class AlbumsgalleriesModel_bwg {
14
  */
15
  public function get_rows_data($params, $total = FALSE) {
16
  global $wpdb;
17
- $where = $params['search'] ? '`name` LIKE "%' . $params['search'] . '%"' : '';
 
 
 
 
 
 
 
18
  $order_by = $total ? '' : ' ORDER BY `' . $params['orderby'] . '` ' . $params['order'];
19
- $limit = $total ? '' : ' LIMIT ' . $params['page_num'] . ',' . $params['items_per_page'];
20
- $query = '(SELECT id, name, preview_image, random_preview_image, published, 1 as is_album FROM ' . $wpdb->prefix . 'bwg_album WHERE id <> ' . $params['album_id'] . ' ' . (($where) ? 'AND '. $where : '' ) . ')
 
 
 
 
 
 
21
  UNION ALL
22
  (SELECT id, name, preview_image, random_preview_image, published, 0 as is_album FROM ' . $wpdb->prefix . 'bwg_gallery ' . (($where) ? 'WHERE '. $where : '' ) . ')' . $order_by . $limit;
23
-
24
  if ($total) {
25
  $query = 'SELECT COUNT(*) FROM (' . $query . ') as temp';
26
- return $wpdb->get_var($query);
27
  }
28
- $rows = $wpdb->get_results($query);
29
 
30
  return $rows;
31
  }
14
  */
15
  public function get_rows_data($params, $total = FALSE) {
16
  global $wpdb;
17
+ $prepareArgs = array($params['album_id']);
18
+ $where = '';
19
+ $limit = '';
20
+ if($params['search']) {
21
+ $where = '`name` LIKE "%s"';
22
+ $prepareArgs[] = "%" . $params['search'] . "%";
23
+ $prepareArgs[] = "%" . $params['search'] . "%";
24
+ }
25
  $order_by = $total ? '' : ' ORDER BY `' . $params['orderby'] . '` ' . $params['order'];
26
+ if ( !$total ) {
27
+ $limit = ' LIMIT %d, %d';
28
+ $prepareArgs[] = $params['page_num'];
29
+ $prepareArgs[] = $params['items_per_page'];
30
+
31
+ }
32
+
33
+ $query = '(SELECT id, name, preview_image, random_preview_image, published, 1 as is_album FROM ' . $wpdb->prefix . 'bwg_album WHERE id <> %d ' . (($where) ? 'AND '. $where : '' ) . ')
34
  UNION ALL
35
  (SELECT id, name, preview_image, random_preview_image, published, 0 as is_album FROM ' . $wpdb->prefix . 'bwg_gallery ' . (($where) ? 'WHERE '. $where : '' ) . ')' . $order_by . $limit;
 
36
  if ($total) {
37
  $query = 'SELECT COUNT(*) FROM (' . $query . ') as temp';
38
+ return $wpdb->get_var( $wpdb->prepare($query, $prepareArgs) );
39
  }
40
+ $rows = $wpdb->get_results( $wpdb->prepare($query, $prepareArgs) );
41
 
42
  return $rows;
43
  }
admin/models/Galleries.php CHANGED
@@ -14,6 +14,7 @@ class GalleriesModel_bwg {
14
  */
15
  public function get_rows_data( $params, $total = FALSE ) {
16
  global $wpdb;
 
17
  $order = $params['order'];
18
  $orderby = $params['orderby'];
19
  $page_per = $params['items_per_page'];
@@ -28,17 +29,21 @@ class GalleriesModel_bwg {
28
  }
29
  $query .= ' FROM (SELECT * FROM `' . $wpdb->prefix . 'bwg_gallery`';
30
  if ( !current_user_can('manage_options') && BWG()->options->gallery_role ) {
31
- $query .= " WHERE author=" . get_current_user_id();
 
32
  }
33
  else {
34
  $query .= " WHERE author>=0";
35
  }
36
  if ( $search ) {
37
- $query .= ' AND `name` LIKE "%' . $search . '%"';
 
38
  }
39
  if ( !$total ) {
40
  $query .= ' ORDER BY `' . $orderby . '` ' . $order;
41
- $query .= ' LIMIT ' . $page_num . ',' . $page_per;
 
 
42
  }
43
  $query .= ') as t1';
44
  if ( !$total ) {
@@ -48,7 +53,7 @@ class GalleriesModel_bwg {
48
  $query .= " GROUP BY t1.id ORDER BY t1.`" . $orderby . "` " . $order;
49
  }
50
  if ( !$total ) {
51
- $rows = $wpdb->get_results($query);
52
  if ( !empty($rows) ) {
53
  foreach ( $rows as $row ) {
54
  $row->preview_image = WDWLibrary::image_url_version($row->preview_image, $row->modified_date);
@@ -57,7 +62,11 @@ class GalleriesModel_bwg {
57
  }
58
  }
59
  else {
60
- $rows = $wpdb->get_var($query);
 
 
 
 
61
  }
62
  return $rows;
63
  }
@@ -83,13 +92,22 @@ class GalleriesModel_bwg {
83
  */
84
  public function delete( $id, $all = FALSE ) {
85
  global $wpdb;
86
- $where = ($all ? '' : ' WHERE id=' . $id);
87
- $image_where = ($all ? '' : ' WHERE gallery_id=' . $id);
88
- $alb_gal_where = ($all ? '' : ' AND alb_gal_id=' . $id);
 
 
 
 
 
 
 
 
 
89
 
90
  // Remove custom post.
91
  if ( $all ) {
92
- $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'posts` WHERE `post_type`="bwg_gallery"');
93
  }
94
  else {
95
  $row = $wpdb->get_row( $wpdb->prepare('SELECT `slug` FROM `' . $wpdb->prefix . 'bwg_gallery` WHERE id="%d"', $id) );
@@ -98,9 +116,9 @@ class GalleriesModel_bwg {
98
  }
99
  }
100
 
101
- $delete = $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_gallery`' . $where);
102
- $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_image`' . $image_where);
103
- $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_album_gallery` WHERE is_album="0"' . $alb_gal_where);
104
  if ( $delete ) {
105
  if ( $all ) {
106
  $message = 5;
@@ -125,7 +143,6 @@ class GalleriesModel_bwg {
125
  * @return int
126
  */
127
  public function duplicate( $idtoget, $all = FALSE ) {
128
-
129
  global $wpdb;
130
 
131
  if (!$idtoget) {
@@ -153,29 +170,76 @@ class GalleriesModel_bwg {
153
  'modified_date' => time(),
154
  );
155
 
156
- $saved = $wpdb->insert($wpdb->prefix . 'bwg_gallery', $data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  if ($saved !== FALSE) {
158
  $new_gallery_id = $wpdb->insert_id;
159
 
160
- $query = "SELECT * FROM " . $wpdb->prefix . "bwg_image where gallery_id=" . $id;
161
- $images = $wpdb->get_results($query);
162
 
163
  foreach ($images as $key => $value) {
164
  $old_image_id = $value->id;
165
 
166
  $value->gallery_id = $new_gallery_id;
167
  $value->id = null;
168
- $wpdb->insert($wpdb->prefix . 'bwg_image', (array)$value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  $new_image_id = $wpdb->insert_id;
170
 
171
- $query = "SELECT * FROM " . $wpdb->prefix . "bwg_image_tag where gallery_id=" . $id . " and image_id=" . $old_image_id;
172
- $image_tags = $wpdb->get_results($query);
173
 
174
  foreach ($image_tags as $image_tag) {
175
  $image_tag->id = null;
176
  $image_tag->image_id = $new_image_id;
177
  $image_tag->gallery_id = $new_gallery_id;
178
- $wpdb->insert($wpdb->prefix . 'bwg_image_tag', (array)$image_tag);
 
 
 
 
 
179
  }
180
  }
181
  $slug = $this->bwg_get_unique_slug($row->name, $id);
@@ -208,7 +272,7 @@ class GalleriesModel_bwg {
208
  */
209
  public function delete_unknown_images() {
210
  global $wpdb;
211
- $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_image` WHERE gallery_id=0');
212
  }
213
 
214
  /**
@@ -228,6 +292,7 @@ class GalleriesModel_bwg {
228
  $page_per = $params['items_per_page'];
229
  $page_num = $params['page_num'];
230
  $search = $params['search'];
 
231
 
232
  $ecommerce_addon = function_exists('BWGEC');
233
 
@@ -246,12 +311,14 @@ class GalleriesModel_bwg {
246
  $query .= " LEFT JOIN ( SELECT MAX(item_longest_dimension) AS item_longest_dimension, pricelist_id FROM `" . $wpdb->prefix . "wdpg_ecommerce_pricelist_items` GROUP BY pricelist_id) AS T_PRICELIST_ITEMS ON T_PRICELIST_ITEMS.pricelist_id = T_PRICELISTS.id";
247
  }
248
  if ( !current_user_can('manage_options') && BWG()->options->image_role ) {
249
- $query .= " WHERE author=" . get_current_user_id();
 
250
  }
251
  else {
252
  $query .= " WHERE author>=0";
253
  }
254
- $query .= " AND `gallery_id`=" . $gallery_id;
 
255
  $search_where = '';
256
  if ( $search ) {
257
  $search_keys = explode(' ', trim($search));
@@ -259,9 +326,12 @@ class GalleriesModel_bwg {
259
  $filename_search = '(';
260
  $description_search = '(';
261
  foreach( $search_keys as $search_key) {
262
- $alt_search .= '`T_IMAGE`.`alt` LIKE "%' . trim($search_key) . '%" AND ';
263
- $filename_search .= '`T_IMAGE`.`filename` LIKE "%' . trim($search_key) . '%" AND ';
264
- $description_search .= '`T_IMAGE`.`description` LIKE "%' . trim($search_key) . '%" AND ';
 
 
 
265
  }
266
  $alt_search = rtrim($alt_search, 'AND ');
267
  $alt_search .= ')';
@@ -274,10 +344,12 @@ class GalleriesModel_bwg {
274
  $query .= $search_where;
275
  if ( !$total ) {
276
  $query .= ' ORDER BY `' . $orderby . '` ' . $order;
277
- $query .= ' LIMIT ' . $page_num . ',' . $page_per;
 
 
278
  }
279
  if ( !$total ) {
280
- $rows = $wpdb->get_results($query);
281
  if ( $ecommerce_addon ) {
282
  foreach ( $rows as $value ) {
283
  $value->not_set_items = 0;
@@ -333,7 +405,7 @@ class GalleriesModel_bwg {
333
  }
334
  }
335
  else {
336
- $rows = $wpdb->get_var($query);
337
  }
338
  return $rows;
339
  }
@@ -379,15 +451,18 @@ class GalleriesModel_bwg {
379
  * @return stdClass
380
  */
381
  public function get_row_data( $id ) {
 
382
  if ( $id != 0 ) {
383
  if ( !current_user_can('manage_options') && BWG()->options->gallery_role ) {
384
- $where = " WHERE author = " . get_current_user_id();
 
385
  }
386
  else {
387
  $where = " WHERE author >= 0 ";
388
  }
 
389
  global $wpdb;
390
- $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_gallery`' . $where . ' AND id="%d"', $id));
391
  }
392
  else {
393
  $row = new stdClass();
@@ -483,12 +558,28 @@ class GalleriesModel_bwg {
483
  'update_flag' => WDWLibrary::get('update_flag'),
484
  'modified_date' => WDWLibrary::get('modified_date', time(), 'intval')
485
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  if ( $id == 0 ) {
487
- $saved = $wpdb->insert($wpdb->prefix . 'bwg_gallery', $data);
488
  $id = $wpdb->insert_id;
489
  }
490
  else {
491
- $saved = $wpdb->update($wpdb->prefix . 'bwg_gallery', $data, array( 'id' => $id ));
492
  }
493
 
494
  if ( $saved !== FALSE ) {
@@ -587,16 +678,17 @@ class GalleriesModel_bwg {
587
  'pricelist_id' => 0,
588
  'modified_date' => time(),
589
  );
590
-
591
- $save = $wpdb->insert($wpdb->prefix . 'bwg_image', $data);
592
  $image_id = $wpdb->insert_id;
593
  }
594
  else {
595
-
596
  if( WDWLibrary::get('ajax_task') == 'image_rotate_right' || WDWLibrary::get('ajax_task') == 'image_rotate_left' || $data['resolution_thumb'] == '' ) {
597
  unset($data['resolution_thumb']);
 
598
  }
599
- $save = $wpdb->update($wpdb->prefix . 'bwg_image', $data, array( 'id' => $image_id ));
600
  }
601
 
602
  $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE image_id="%d" AND gallery_id="%d"', $image_id, $gallery_id));
@@ -631,7 +723,7 @@ class GalleriesModel_bwg {
631
  'tag_id' => $tag_id,
632
  'image_id' => $image_id,
633
  'gallery_id' => $gallery_id,
634
- ));
635
  // Increase tag count in term_taxonomy table.
636
  $wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'term_taxonomy SET count="%d" WHERE term_id="%d"', $wpdb->get_var($wpdb->prepare('SELECT COUNT(image_id) FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE tag_id="%d"', $tag_id)), $tag_id));
637
  }
@@ -739,22 +831,37 @@ class GalleriesModel_bwg {
739
  */
740
  public function image_delete( $id, $gallery_id = 0, $all = FALSE ) {
741
  global $wpdb;
 
742
  if ( $gallery_id == 0 ) {
743
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
744
  }
745
- $where = 'WHERE gallery_id=' . $gallery_id;
 
746
  $where .= ($all ? '' : ' AND id=' . $id);
 
 
 
 
747
  $search = WDWLibrary::get('s');
748
  if ( $search ) {
749
- $where .= ' AND `filename` LIKE "%' . $search . '%"';
 
 
 
 
 
 
 
 
 
 
 
750
  }
751
- $image_where = ($all ? 'WHERE gallery_id=' . $gallery_id : ' WHERE image_id=' . $id);
752
 
753
- $delete = $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_image`' . $where);
754
- $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_image_comment`' . $image_where);
755
- $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_image_rate`' . $image_where);
756
- $tag_ids = $wpdb->get_col('SELECT tag_id FROM `' . $wpdb->prefix . 'bwg_image_tag`' . $image_where);
757
- $wpdb->query('DELETE FROM `' . $wpdb->prefix . 'bwg_image_tag`' . $image_where);
758
  // Increase tag count in term_taxonomy table.
759
  if ( !empty($tag_ids) ) {
760
  foreach ( $tag_ids as $tag_id ) {
@@ -764,12 +871,12 @@ class GalleriesModel_bwg {
764
 
765
  if ( !empty($current_id) ) {
766
  // after deleted and empty image lists then update `preview_image` and `random_preview_image` colums.
767
- $row = $wpdb->get_row( 'SELECT * FROM `' . $wpdb->prefix . 'bwg_gallery` AS `g` INNER JOIN `' . $wpdb->prefix . 'bwg_image` AS `i` ON (`g`.`id` = `i`.`gallery_id`) WHERE `g`.`id` = ' . $current_id );
768
  if ( empty($row) ) {
769
  $wpdb->update($wpdb->prefix . 'bwg_gallery',
770
- array('preview_image' => '', 'random_preview_image' => ''),
771
- array('id' => $current_id)
772
- );
773
  }
774
  }
775
 
@@ -796,16 +903,24 @@ class GalleriesModel_bwg {
796
  */
797
  public function image_publish( $id, $gallery_id = 0, $all = FALSE ) {
798
  global $wpdb;
 
799
  if ( $gallery_id == 0 ) {
800
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
801
  }
802
- $where = ' WHERE gallery_id=' . $gallery_id;
803
- $where .= ($all ? '' : ' AND id=' . $id);
 
 
 
 
 
 
804
  $search = WDWLibrary::get('s');
805
  if ( $search ) {
806
- $where .= ' AND `filename` LIKE "%' . $search . '%"';
 
807
  }
808
- $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_image` SET published=1' . $where);
809
 
810
  $message = 2;
811
  if ( $updated !== FALSE ) {
@@ -825,16 +940,24 @@ class GalleriesModel_bwg {
825
  */
826
  public function image_unpublish( $id, $gallery_id = 0, $all = FALSE ) {
827
  global $wpdb;
 
828
  if ( $gallery_id == 0 ) {
829
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
830
  }
831
- $where = ' WHERE gallery_id=' . $gallery_id;
832
- $where .= ($all ? '' : ' AND id=' . $id);
 
 
 
 
 
 
833
  $search = WDWLibrary::get('s');
834
  if ( $search ) {
835
- $where .= ' AND `filename` LIKE "%' . $search . '%"';
 
836
  }
837
- $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_image` SET published=0' . $where);
838
 
839
  $message = 2;
840
  if ( $updated !== FALSE ) {
@@ -942,16 +1065,28 @@ class GalleriesModel_bwg {
942
  */
943
  public function rotate( $edit_type, $id = 0, $gallery_id = 0, $all = FALSE ) {
944
  global $wpdb;
 
945
  $image_id = ($all ? 0 : $id);
946
  if ( $gallery_id == 0 ) {
947
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
948
  }
949
- $where = ( ($gallery_id) ? ' `gallery_id` = ' . $gallery_id . ($image_id ? ' AND `id` = ' . $image_id : '' ) : 1 );
 
 
 
 
 
 
 
 
 
 
950
  $search = WDWLibrary::get('s');
951
  if ( $search ) {
952
- $where .= ' AND `filename` LIKE "%' . $search . '%"';
 
953
  }
954
- $images_data = $wpdb->get_results( 'SELECT id, image_url, thumb_url, resolution_thumb FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where );
955
 
956
  @ini_set('memory_limit', '-1');
957
  foreach ( $images_data as $image_data ) {
@@ -1044,11 +1179,24 @@ class GalleriesModel_bwg {
1044
  if ( $gallery_id == 0 ) {
1045
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1046
  }
1047
- $where = ( ($gallery_id) ? ' `gallery_id` = ' . $gallery_id . ( $image_id ? ' AND `id` = ' . $image_id : '' ) : 1 );
1048
- $img_ids = $wpdb->get_results( 'SELECT id, thumb_url FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where );
 
 
 
 
 
 
 
 
 
 
 
1049
  $search = WDWLibrary::get('s');
1050
  if ( $search ) {
1051
- $where .= ' AND `filename` LIKE "%' . $search . '%"';
 
 
1052
  }
1053
  foreach ( $img_ids as $img_id ) {
1054
  $file_path = str_replace("thumb", ".original", htmlspecialchars_decode(BWG()->upload_dir . $img_id->thumb_url, ENT_COMPAT | ENT_QUOTES));
@@ -1061,7 +1209,7 @@ class GalleriesModel_bwg {
1061
  }
1062
  }
1063
  }
1064
- WDWLibrary::update_image_modified_date( $where );
1065
 
1066
  return 23;
1067
  }
@@ -1083,13 +1231,19 @@ class GalleriesModel_bwg {
1083
  }
1084
  $image_width = WDWLibrary::get('image_width', 1600, 'intval');
1085
  $image_height = WDWLibrary::get('image_height', 1200, 'intval');
1086
- $where = ' gallery_id=' . $gallery_id;
1087
- $where .= ($all ? '' : ' AND id=' . $id);
 
 
 
 
 
1088
  $search = WDWLibrary::get('s');
1089
  if ( $search ) {
1090
- $where .= ' AND `filename` LIKE "%' . $search . '%"';
 
1091
  }
1092
- $images = $wpdb->get_results('SELECT * FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where );
1093
  if ( !empty($images) ) {
1094
  foreach ( $images as $image ) {
1095
  $file_path = BWG()->upload_dir . $image->image_url;
@@ -1115,25 +1269,29 @@ class GalleriesModel_bwg {
1115
  * @return int
1116
  */
1117
  public function image_edit($id, $gallery_id = 0, $all = FALSE) {
 
 
 
 
1118
  if ( $gallery_id == 0 ) {
1119
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1120
  }
1121
- $where = ' WHERE gallery_id=' . $gallery_id;
1122
- $where .= ($all ? '' : ' AND id=' . $id);
 
 
 
 
 
 
1123
  $search = WDWLibrary::get('s');
1124
  if ( $search ) {
1125
- $where .= ' AND `filename` LIKE "%' . $search . '%"';
 
1126
  }
1127
- $title = WDWLibrary::get('title');
1128
- $desc = WDWLibrary::get('desc');
1129
- $redirecturl = WDWLibrary::get('redirecturl', '', 'esc_url_raw');
1130
  global $wpdb;
1131
- $wpdb->update($wpdb->prefix . 'bwg_image', array(
1132
- 'alt' => $title,
1133
- 'description' => $desc,
1134
- 'redirect_url' => $redirecturl
1135
- ), $where);
1136
- $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `alt`="' . $title . '", `description`="' . $desc . '", `redirect_url`="' . $redirecturl . '"' . $where);
1137
  $message = 2;
1138
  if ( $updated !== FALSE ) {
1139
  $message = 25;
@@ -1151,21 +1309,26 @@ class GalleriesModel_bwg {
1151
  * @return int
1152
  */
1153
  public function image_edit_alt( $id, $gallery_id = 0, $all = FALSE ) {
 
 
1154
  if ( $gallery_id == 0 ) {
1155
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1156
  }
1157
- $where = ' WHERE gallery_id=' . $gallery_id;
1158
- $where .= ($all ? '' : ' AND id=' . $id);
 
 
 
 
 
1159
  $search = WDWLibrary::get('s');
1160
  if ( $search ) {
1161
- $where .= ' AND `filename` LIKE "%' . $search . '%"';
 
1162
  }
1163
- $title = WDWLibrary::get('title');
1164
  global $wpdb;
1165
- $wpdb->update($wpdb->prefix . 'bwg_image', array(
1166
- 'alt' => $title
1167
- ), $where);
1168
- $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `alt`="' . $title . '"' . $where);
1169
  $message = 2;
1170
  if ( $updated !== FALSE ) {
1171
  $message = 25;
@@ -1186,18 +1349,22 @@ class GalleriesModel_bwg {
1186
  if ( $gallery_id == 0 ) {
1187
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1188
  }
1189
- $where = ' WHERE gallery_id=' . $gallery_id;
1190
- $where .= ($all ? '' : ' AND id=' . $id);
 
 
 
 
 
 
1191
  $search = WDWLibrary::get('s');
1192
  if ( $search ) {
1193
- $where .= ' AND `filename` LIKE "%' . $search . '%"';
 
1194
  }
1195
- $desc = WDWLibrary::get('desc');
1196
  global $wpdb;
1197
- $wpdb->update($wpdb->prefix . 'bwg_image', array(
1198
- 'description' => $desc,
1199
- ), $where);
1200
- $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `description`="' . $desc . '"' . $where);
1201
  $message = 2;
1202
  if ( $updated !== FALSE ) {
1203
  $message = 25;
@@ -1218,18 +1385,22 @@ class GalleriesModel_bwg {
1218
  if ( $gallery_id == 0 ) {
1219
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1220
  }
1221
- $where = ' WHERE gallery_id=' . $gallery_id;
1222
- $where .= ($all ? '' : ' AND id=' . $id);
 
 
 
 
 
 
1223
  $search = WDWLibrary::get('s');
1224
  if ( $search ) {
1225
- $where .= ' AND `filename` LIKE "%' . $search . '%"';
 
1226
  }
1227
- $redirecturl = WDWLibrary::get('redirecturl', '', 'esc_url_raw');
1228
  global $wpdb;
1229
- $wpdb->update($wpdb->prefix . 'bwg_image', array(
1230
- 'redirect_url' => $redirecturl,
1231
- ), $where);
1232
- $updated = $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `redirect_url`="' . $redirecturl . '"' . $where);
1233
  $message = 2;
1234
  if ( $updated !== FALSE ) {
1235
  $message = 25;
@@ -1241,19 +1412,28 @@ class GalleriesModel_bwg {
1241
  if ( $gallery_id == 0 ) {
1242
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1243
  }
 
1244
  $tag_ids = WDWLibrary::get('added_tags_id');
1245
  $tag_act = WDWLibrary::get('added_tags_act');
1246
  $tag_ids_array = explode(',', $tag_ids);
1247
  global $wpdb;
1248
- $where = ' WHERE gallery_id=' . $gallery_id;
1249
- $where .= ($all ? '' : ' AND id=' . $id);
 
 
 
 
 
1250
  $search = WDWLibrary::get('s');
1251
  if ( $search ) {
1252
- $where .= ' AND (`alt` LIKE "%' . trim($search) . '%"';
1253
- $where .= ' OR `filename` LIKE "%' . trim($search) . '%"';
1254
- $where .= ' OR `description` LIKE "%' . trim($search) . '%")';
1255
- }
1256
- $images = $wpdb->get_results('SELECT * FROM `' . $wpdb->prefix . 'bwg_image`' . $where);
 
 
 
1257
  foreach ( $images as $image ) {
1258
  foreach ( $tag_ids_array as $tag_id ) {
1259
  if ( $tag_id ) {
@@ -1296,13 +1476,19 @@ class GalleriesModel_bwg {
1296
  if ( $gallery_id == 0 ) {
1297
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1298
  }
1299
- $where = ' WHERE gallery_id=' . $gallery_id;
1300
- $where .= ($all ? '' : ' AND id=' . $id);
 
 
 
 
 
1301
  $search = WDWLibrary::get('s');
1302
  if ( $search ) {
1303
- $where .= ' AND `filename` LIKE "%' . $search . '%"';
 
1304
  }
1305
- $image_ids_col = $wpdb->get_col('SELECT id FROM `' . $wpdb->prefix . 'bwg_image`' . $where);
1306
  foreach ($image_ids_col as $image_id) {
1307
  $thumb_url_image_id = WDWLibrary::get('thumb_url_' . $image_id, '', 'esc_url_raw');
1308
  $file_path = str_replace("thumb", ".original", htmlspecialchars_decode(BWG()->upload_dir . $thumb_url_image_id, ENT_COMPAT | ENT_QUOTES));
@@ -1311,7 +1497,7 @@ class GalleriesModel_bwg {
1311
  if ($item_longest_dimension > $img_width && $img_width) {
1312
  $not_set_items[] = $image_id . "-" . $item_longest_dimension;
1313
  }
1314
- $wpdb->update($wpdb->prefix . 'bwg_image', array('pricelist_id' => $pricelist_id), array('id' => $image_id));
1315
  }
1316
  }
1317
  if ( empty($not_set_items) === FALSE ) {
@@ -1334,12 +1520,18 @@ class GalleriesModel_bwg {
1334
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1335
  }
1336
  $where = ' WHERE gallery_id=' . $gallery_id;
1337
- $where .= ($all ? '' : ' AND id=' . $id);
 
 
 
 
 
1338
  $search = WDWLibrary::get('s');
1339
  if ( $search ) {
1340
- $where .= ' AND `filename` LIKE "%' . $search . '%"';
 
1341
  }
1342
- $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_image` SET pricelist_id=0' . $where);
1343
  }
1344
 
1345
  /**
@@ -1354,8 +1546,8 @@ class GalleriesModel_bwg {
1354
  $message_id = 2;
1355
  if ( !empty($orders) ) {
1356
  foreach ( $orders as $order => $id ) {
1357
- $upd_query = 'UPDATE ' . $wpdb->prefix . 'bwg_gallery SET `order` = ' . $order . ' WHERE `id` = ' . $id;
1358
- $update = $wpdb->query($upd_query);
1359
  if ( $update ) {
1360
  $message_id = 1;
1361
  }
14
  */
15
  public function get_rows_data( $params, $total = FALSE ) {
16
  global $wpdb;
17
+ $prepareArgs = array();
18
  $order = $params['order'];
19
  $orderby = $params['orderby'];
20
  $page_per = $params['items_per_page'];
29
  }
30
  $query .= ' FROM (SELECT * FROM `' . $wpdb->prefix . 'bwg_gallery`';
31
  if ( !current_user_can('manage_options') && BWG()->options->gallery_role ) {
32
+ $query .= " WHERE author=%d";
33
+ $prepareArgs[] = get_current_user_id();
34
  }
35
  else {
36
  $query .= " WHERE author>=0";
37
  }
38
  if ( $search ) {
39
+ $query .= ' AND `name` LIKE %s';
40
+ $prepareArgs[] = "%" . $wpdb->esc_like($search) . "%";
41
  }
42
  if ( !$total ) {
43
  $query .= ' ORDER BY `' . $orderby . '` ' . $order;
44
+ $query .= ' LIMIT %d, %d';
45
+ $prepareArgs[] = $page_num;
46
+ $prepareArgs[] = $page_per;
47
  }
48
  $query .= ') as t1';
49
  if ( !$total ) {
53
  $query .= " GROUP BY t1.id ORDER BY t1.`" . $orderby . "` " . $order;
54
  }
55
  if ( !$total ) {
56
+ $rows = $wpdb->get_results( $wpdb->prepare($query, $prepareArgs) );
57
  if ( !empty($rows) ) {
58
  foreach ( $rows as $row ) {
59
  $row->preview_image = WDWLibrary::image_url_version($row->preview_image, $row->modified_date);
62
  }
63
  }
64
  else {
65
+ if ( !empty( $prepareArgs ) ) {
66
+ $rows = $wpdb->get_var( $wpdb->prepare( $query, $prepareArgs ) );
67
+ } else {
68
+ $rows = $wpdb->get_var( $query );
69
+ }
70
  }
71
  return $rows;
72
  }
92
  */
93
  public function delete( $id, $all = FALSE ) {
94
  global $wpdb;
95
+
96
+ $where = '';
97
+ $image_where = '';
98
+ $alb_gal_where = '';
99
+ $prepareArgs = array();
100
+
101
+ if ( !$all ) {
102
+ $where = ' WHERE id=%d';
103
+ $image_where = ' WHERE gallery_id=%d';
104
+ $alb_gal_where = ' AND alb_gal_id=%d';
105
+ $prepareArgs[] = $id;
106
+ }
107
 
108
  // Remove custom post.
109
  if ( $all ) {
110
+ $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'posts` WHERE `post_type`="%s"', "bwg_gallery"));
111
  }
112
  else {
113
  $row = $wpdb->get_row( $wpdb->prepare('SELECT `slug` FROM `' . $wpdb->prefix . 'bwg_gallery` WHERE id="%d"', $id) );
116
  }
117
  }
118
 
119
+ $delete = $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_gallery`' . $where,$prepareArgs));
120
+ $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_image`' . $image_where,$prepareArgs));
121
+ $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_album_gallery` WHERE is_album="0"' . $alb_gal_where,$prepareArgs));
122
  if ( $delete ) {
123
  if ( $all ) {
124
  $message = 5;
143
  * @return int
144
  */
145
  public function duplicate( $idtoget, $all = FALSE ) {
 
146
  global $wpdb;
147
 
148
  if (!$idtoget) {
170
  'modified_date' => time(),
171
  );
172
 
173
+ $format = array(
174
+ '%s',
175
+ '%s',
176
+ '%s',
177
+ '%s',
178
+ '%s',
179
+ '%s',
180
+ '%d',
181
+ '%d',
182
+ '%d',
183
+ '%s',
184
+ '%s',
185
+ '%d',
186
+ '%s',
187
+ '%d',
188
+ );
189
+
190
+ $saved = $wpdb->insert($wpdb->prefix . 'bwg_gallery', $data, $format);
191
  if ($saved !== FALSE) {
192
  $new_gallery_id = $wpdb->insert_id;
193
 
194
+ $query = "SELECT * FROM " . $wpdb->prefix . "bwg_image where gallery_id=%d";
195
+ $images = $wpdb->get_results( $wpdb->prepare($query,$id) );
196
 
197
  foreach ($images as $key => $value) {
198
  $old_image_id = $value->id;
199
 
200
  $value->gallery_id = $new_gallery_id;
201
  $value->id = null;
202
+ $format = array(
203
+ '%d',
204
+ '%d',
205
+ '%s',
206
+ '%s',
207
+ '%s',
208
+ '%s',
209
+ '%s',
210
+ '%s',
211
+ '%s',
212
+ '%s',
213
+ '%s',
214
+ '%s',
215
+ '%s',
216
+ '%d',
217
+ '%d',
218
+ '%d',
219
+ '%d',
220
+ '%d',
221
+ '%d',
222
+ '%d',
223
+ '%s',
224
+ '%d',
225
+ '%d',
226
+ );
227
+ $wpdb->insert($wpdb->prefix . 'bwg_image', (array)$value, $format);
228
  $new_image_id = $wpdb->insert_id;
229
 
230
+ $query = "SELECT * FROM " . $wpdb->prefix . "bwg_image_tag where gallery_id=%d and image_id=%d";
231
+ $image_tags = $wpdb->get_results( $wpdb->prepare($query, array($id,$old_image_id)) );
232
 
233
  foreach ($image_tags as $image_tag) {
234
  $image_tag->id = null;
235
  $image_tag->image_id = $new_image_id;
236
  $image_tag->gallery_id = $new_gallery_id;
237
+ $format = array(
238
+ '%d',
239
+ '%d',
240
+ '%d',
241
+ );
242
+ $wpdb->insert($wpdb->prefix . 'bwg_image_tag', (array)$image_tag, $format);
243
  }
244
  }
245
  $slug = $this->bwg_get_unique_slug($row->name, $id);
272
  */
273
  public function delete_unknown_images() {
274
  global $wpdb;
275
+ $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_image` WHERE gallery_id=%d',0));
276
  }
277
 
278
  /**
292
  $page_per = $params['items_per_page'];
293
  $page_num = $params['page_num'];
294
  $search = $params['search'];
295
+ $prepareArgs = array();
296
 
297
  $ecommerce_addon = function_exists('BWGEC');
298
 
311
  $query .= " LEFT JOIN ( SELECT MAX(item_longest_dimension) AS item_longest_dimension, pricelist_id FROM `" . $wpdb->prefix . "wdpg_ecommerce_pricelist_items` GROUP BY pricelist_id) AS T_PRICELIST_ITEMS ON T_PRICELIST_ITEMS.pricelist_id = T_PRICELISTS.id";
312
  }
313
  if ( !current_user_can('manage_options') && BWG()->options->image_role ) {
314
+ $query .= " WHERE author=%d";
315
+ $prepareArgs[] = get_current_user_id();
316
  }
317
  else {
318
  $query .= " WHERE author>=0";
319
  }
320
+ $query .= " AND `gallery_id`=%d";
321
+ $prepareArgs[] = $gallery_id;
322
  $search_where = '';
323
  if ( $search ) {
324
  $search_keys = explode(' ', trim($search));
326
  $filename_search = '(';
327
  $description_search = '(';
328
  foreach( $search_keys as $search_key) {
329
+ $alt_search .= '`T_IMAGE`.`alt` LIKE %s AND ';
330
+ $filename_search .= '`T_IMAGE`.`filename` LIKE %s AND ';
331
+ $description_search .= '`T_IMAGE`.`description` LIKE %s AND ';
332
+ $prepareArgs[] = "%" . trim($search_key) . "%";
333
+ $prepareArgs[] = "%" . trim($search_key) . "%";
334
+ $prepareArgs[] = "%" . trim($search_key) . "%";
335
  }
336
  $alt_search = rtrim($alt_search, 'AND ');
337
  $alt_search .= ')';
344
  $query .= $search_where;
345
  if ( !$total ) {
346
  $query .= ' ORDER BY `' . $orderby . '` ' . $order;
347
+ $query .= ' LIMIT %d, %d';
348
+ $prepareArgs[] = $page_num;
349
+ $prepareArgs[] = $page_per;
350
  }
351
  if ( !$total ) {
352
+ $rows = $wpdb->get_results($wpdb->prepare($query, $prepareArgs));
353
  if ( $ecommerce_addon ) {
354
  foreach ( $rows as $value ) {
355
  $value->not_set_items = 0;
405
  }
406
  }
407
  else {
408
+ $rows = $wpdb->get_var($wpdb->prepare($query, $prepareArgs));
409
  }
410
  return $rows;
411
  }
451
  * @return stdClass
452
  */
453
  public function get_row_data( $id ) {
454
+ $prepareArgs = array();
455
  if ( $id != 0 ) {
456
  if ( !current_user_can('manage_options') && BWG()->options->gallery_role ) {
457
+ $where = " WHERE author = %d";
458
+ $prepareArgs[] = get_current_user_id();
459
  }
460
  else {
461
  $where = " WHERE author >= 0 ";
462
  }
463
+ $prepareArgs[] = $id;
464
  global $wpdb;
465
+ $row = $wpdb->get_row($wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_gallery`' . $where . ' AND id="%d"', $prepareArgs));
466
  }
467
  else {
468
  $row = new stdClass();
558
  'update_flag' => WDWLibrary::get('update_flag'),
559
  'modified_date' => WDWLibrary::get('modified_date', time(), 'intval')
560
  );
561
+ $format = array(
562
+ '%s',
563
+ '%s',
564
+ '%s',
565
+ '%s',
566
+ '%s',
567
+ '%s',
568
+ '%d',
569
+ '%d',
570
+ '%d',
571
+ '%s',
572
+ '%s',
573
+ '%d',
574
+ '%s',
575
+ '%d',
576
+ );
577
  if ( $id == 0 ) {
578
+ $saved = $wpdb->insert($wpdb->prefix . 'bwg_gallery', $data, $format);
579
  $id = $wpdb->insert_id;
580
  }
581
  else {
582
+ $saved = $wpdb->update($wpdb->prefix . 'bwg_gallery', $data, array( 'id' => $id ), $format);
583
  }
584
 
585
  if ( $saved !== FALSE ) {
678
  'pricelist_id' => 0,
679
  'modified_date' => time(),
680
  );
681
+ $format = array('%d','%s','%s','%s','%s','%s','%s','%s','%s','%s','%d','%s','%s','%s','%d','%d','%d','%d','%d','%d','%d','%d');
682
+ $save = $wpdb->insert($wpdb->prefix . 'bwg_image', $data, $format);
683
  $image_id = $wpdb->insert_id;
684
  }
685
  else {
686
+ $format = array('%d','%s','%s','%s','%s','%s','%s','%s','%s','%s','%d');
687
  if( WDWLibrary::get('ajax_task') == 'image_rotate_right' || WDWLibrary::get('ajax_task') == 'image_rotate_left' || $data['resolution_thumb'] == '' ) {
688
  unset($data['resolution_thumb']);
689
+ unset($format[9]);
690
  }
691
+ $save = $wpdb->update($wpdb->prefix . 'bwg_image', $data, array( 'id' => $image_id ), $format);
692
  }
693
 
694
  $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE image_id="%d" AND gallery_id="%d"', $image_id, $gallery_id));
723
  'tag_id' => $tag_id,
724
  'image_id' => $image_id,
725
  'gallery_id' => $gallery_id,
726
+ ), array('%d','%d','%d'));
727
  // Increase tag count in term_taxonomy table.
728
  $wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'term_taxonomy SET count="%d" WHERE term_id="%d"', $wpdb->get_var($wpdb->prepare('SELECT COUNT(image_id) FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE tag_id="%d"', $tag_id)), $tag_id));
729
  }
831
  */
832
  public function image_delete( $id, $gallery_id = 0, $all = FALSE ) {
833
  global $wpdb;
834
+ $prepareArgs = array();
835
  if ( $gallery_id == 0 ) {
836
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
837
  }
838
+ $where = 'WHERE gallery_id=%d';
839
+ $prepareArgs[] = $gallery_id;
840
  $where .= ($all ? '' : ' AND id=' . $id);
841
+ if ( !$all ) {
842
+ $where .= ' AND id=%d';
843
+ $prepareArgs[] = $id;
844
+ }
845
  $search = WDWLibrary::get('s');
846
  if ( $search ) {
847
+ $where .= ' AND `filename` LIKE %s';
848
+ $prepareArgs[] = "%" . $search . "%";
849
+ }
850
+ $delete = $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_image`' . $where, $prepareArgs));
851
+
852
+ $prepareArgs = array();
853
+ if ( $all ) {
854
+ $image_where = 'WHERE gallery_id=%d';
855
+ $prepareArgs[] = $gallery_id;
856
+ } else {
857
+ $image_where = ' WHERE image_id=%d';
858
+ $prepareArgs[] = $id;
859
  }
 
860
 
861
+ $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_image_comment`' . $image_where, $prepareArgs));
862
+ $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_image_rate`' . $image_where, $prepareArgs));
863
+ $tag_ids = $wpdb->get_col($wpdb->prepare('SELECT tag_id FROM `' . $wpdb->prefix . 'bwg_image_tag`' . $image_where, $prepareArgs));
864
+ $wpdb->query($wpdb->prepare('DELETE FROM `' . $wpdb->prefix . 'bwg_image_tag`' . $image_where, $prepareArgs));
 
865
  // Increase tag count in term_taxonomy table.
866
  if ( !empty($tag_ids) ) {
867
  foreach ( $tag_ids as $tag_id ) {
871
 
872
  if ( !empty($current_id) ) {
873
  // after deleted and empty image lists then update `preview_image` and `random_preview_image` colums.
874
+ $row = $wpdb->get_row( $wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_gallery` AS `g` INNER JOIN `' . $wpdb->prefix . 'bwg_image` AS `i` ON (`g`.`id` = `i`.`gallery_id`) WHERE `g`.`id` = %d', $current_id) );
875
  if ( empty($row) ) {
876
  $wpdb->update($wpdb->prefix . 'bwg_gallery',
877
+ array('preview_image' => '', 'random_preview_image' => ''),
878
+ array('id' => $current_id)
879
+ );
880
  }
881
  }
882
 
903
  */
904
  public function image_publish( $id, $gallery_id = 0, $all = FALSE ) {
905
  global $wpdb;
906
+ $prepareArgs = array();
907
  if ( $gallery_id == 0 ) {
908
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
909
  }
910
+ $where = ' WHERE gallery_id=%d';
911
+ $prepareArgs[] = $gallery_id;
912
+
913
+ if ( !$all ) {
914
+ $where .= ' AND id=%d';
915
+ $prepareArgs[] = $id;
916
+ }
917
+
918
  $search = WDWLibrary::get('s');
919
  if ( $search ) {
920
+ $where .= ' AND `filename` LIKE %s';
921
+ $prepareArgs[] = "%" . $search . "%";
922
  }
923
+ $updated = $wpdb->query( $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET published=1' . $where, $prepareArgs) );
924
 
925
  $message = 2;
926
  if ( $updated !== FALSE ) {
940
  */
941
  public function image_unpublish( $id, $gallery_id = 0, $all = FALSE ) {
942
  global $wpdb;
943
+ $prepareArgs = array();
944
  if ( $gallery_id == 0 ) {
945
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
946
  }
947
+ $where = ' WHERE gallery_id=%d';
948
+ $prepareArgs[] = $gallery_id;
949
+
950
+ if ( !$all ) {
951
+ $where .= ' AND id=%d';
952
+ $prepareArgs[] = $id;
953
+ }
954
+
955
  $search = WDWLibrary::get('s');
956
  if ( $search ) {
957
+ $where .= ' AND `filename` LIKE %s';
958
+ $prepareArgs[] = "%" . $search . "%";
959
  }
960
+ $updated = $wpdb->query( $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET published=0' . $where, $prepareArgs) );
961
 
962
  $message = 2;
963
  if ( $updated !== FALSE ) {
1065
  */
1066
  public function rotate( $edit_type, $id = 0, $gallery_id = 0, $all = FALSE ) {
1067
  global $wpdb;
1068
+ $prepareArgs = array();
1069
  $image_id = ($all ? 0 : $id);
1070
  if ( $gallery_id == 0 ) {
1071
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1072
  }
1073
+
1074
+ $where = 1;
1075
+ if ($gallery_id) {
1076
+ $where = ' `gallery_id` = %d';
1077
+ $prepareArgs[] = $gallery_id;
1078
+ if($image_id) {
1079
+ $where .= ' AND `id` = %d';
1080
+ $prepareArgs[] = $image_id;
1081
+ }
1082
+ }
1083
+ //$where = ( ($gallery_id) ? ' `gallery_id` = ' . $gallery_id . ($image_id ? ' AND `id` = ' . $image_id : '' ) : 1 );
1084
  $search = WDWLibrary::get('s');
1085
  if ( $search ) {
1086
+ $where .= ' AND `filename` LIKE %s';
1087
+ $prepareArgs[] = "%" . $search . "%";
1088
  }
1089
+ $images_data = $wpdb->get_results( $wpdb->prepare('SELECT id, image_url, thumb_url, resolution_thumb FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where, $prepareArgs) );
1090
 
1091
  @ini_set('memory_limit', '-1');
1092
  foreach ( $images_data as $image_data ) {
1179
  if ( $gallery_id == 0 ) {
1180
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1181
  }
1182
+ //$where = ( ($gallery_id) ? ' `gallery_id` = ' . $gallery_id . ( $image_id ? ' AND `id` = ' . $image_id : '' ) : 1 );
1183
+ $where = 1;
1184
+ $prepareArgs = array();
1185
+ if ($gallery_id) {
1186
+ $where = ' `gallery_id` = %d';
1187
+ $prepareArgs[] = $gallery_id;
1188
+ if($image_id) {
1189
+ $where .= ' AND `id` = %d';
1190
+ $prepareArgs[] = $image_id;
1191
+ }
1192
+ }
1193
+
1194
+ $img_ids = $wpdb->get_results( $wpdb->prepare('SELECT id, thumb_url FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where, $prepareArgs) );
1195
  $search = WDWLibrary::get('s');
1196
  if ( $search ) {
1197
+ $where .= ' AND `filename` LIKE %s';
1198
+ $prepareArgs[] = "%" . $search . "%";
1199
+
1200
  }
1201
  foreach ( $img_ids as $img_id ) {
1202
  $file_path = str_replace("thumb", ".original", htmlspecialchars_decode(BWG()->upload_dir . $img_id->thumb_url, ENT_COMPAT | ENT_QUOTES));
1209
  }
1210
  }
1211
  }
1212
+ WDWLibrary::update_image_modified_date( $where, $prepareArgs );
1213
 
1214
  return 23;
1215
  }
1231
  }
1232
  $image_width = WDWLibrary::get('image_width', 1600, 'intval');
1233
  $image_height = WDWLibrary::get('image_height', 1200, 'intval');
1234
+ $where = ' gallery_id=%d';
1235
+ $prepareArgs = array($gallery_id);
1236
+ if( !$all ) {
1237
+ $where .= ' AND id=%d';
1238
+ $prepareArgs[] = $id;
1239
+ }
1240
+
1241
  $search = WDWLibrary::get('s');
1242
  if ( $search ) {
1243
+ $where .= ' AND `filename` LIKE %s';
1244
+ $prepareArgs[] = "%" . $search . "%";
1245
  }
1246
+ $images = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where, $prepareArgs) );
1247
  if ( !empty($images) ) {
1248
  foreach ( $images as $image ) {
1249
  $file_path = BWG()->upload_dir . $image->image_url;
1269
  * @return int
1270
  */
1271
  public function image_edit($id, $gallery_id = 0, $all = FALSE) {
1272
+ $title = WDWLibrary::get('title');
1273
+ $desc = WDWLibrary::get('desc');
1274
+ $redirecturl = WDWLibrary::get('redirecturl', '', 'esc_url_raw');
1275
+ $prepareArgs = array($title,$desc,$redirecturl);
1276
  if ( $gallery_id == 0 ) {
1277
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1278
  }
1279
+ $where = ' WHERE gallery_id=%d';
1280
+ $prepareArgs[] = $gallery_id;
1281
+ $format = array('%d');
1282
+ if( !$all ) {
1283
+ $where .= ' AND id=%d';
1284
+ $prepareArgs[] = $id;
1285
+ }
1286
+
1287
  $search = WDWLibrary::get('s');
1288
  if ( $search ) {
1289
+ $where .= ' AND `filename` LIKE %s';
1290
+ $prepareArgs[] = "%" . $search . "%";
1291
  }
 
 
 
1292
  global $wpdb;
1293
+
1294
+ $updated = $wpdb->query( $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `alt`="%s", `description`="%s", `redirect_url`="%s"' . $where, $prepareArgs) );
 
 
 
 
1295
  $message = 2;
1296
  if ( $updated !== FALSE ) {
1297
  $message = 25;
1309
  * @return int
1310
  */
1311
  public function image_edit_alt( $id, $gallery_id = 0, $all = FALSE ) {
1312
+ $title = WDWLibrary::get('title');
1313
+
1314
  if ( $gallery_id == 0 ) {
1315
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1316
  }
1317
+ $where = ' WHERE gallery_id=%d';
1318
+ $prepareArgs = array( $title, $gallery_id );
1319
+
1320
+ if ( !$all ) {
1321
+ $where .= ' AND id=%d';
1322
+ $prepareArgs[] = $id;
1323
+ }
1324
  $search = WDWLibrary::get('s');
1325
  if ( $search ) {
1326
+ $where .= ' AND `filename` LIKE %s';
1327
+ $prepareArgs[] = "%" . $search . "%";
1328
  }
1329
+
1330
  global $wpdb;
1331
+ $updated = $wpdb->query( $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `alt`="%s"' . $where, $prepareArgs) );
 
 
 
1332
  $message = 2;
1333
  if ( $updated !== FALSE ) {
1334
  $message = 25;
1349
  if ( $gallery_id == 0 ) {
1350
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1351
  }
1352
+ $desc = WDWLibrary::get('desc');
1353
+ $where = ' WHERE gallery_id=%d';
1354
+ $prepareArgs = array( $desc, $gallery_id );
1355
+ if ( !$all ) {
1356
+ $where .= ' AND id=%d';
1357
+ $prepareArgs[] = $id;
1358
+ }
1359
+
1360
  $search = WDWLibrary::get('s');
1361
  if ( $search ) {
1362
+ $where .= ' AND `filename` LIKE %s';
1363
+ $prepareArgs[] = "%" . $search . "%";
1364
  }
1365
+
1366
  global $wpdb;
1367
+ $updated = $wpdb->query( $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `description`="%s"' . $where, $prepareArgs) );
 
 
 
1368
  $message = 2;
1369
  if ( $updated !== FALSE ) {
1370
  $message = 25;
1385
  if ( $gallery_id == 0 ) {
1386
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1387
  }
1388
+ $redirecturl = WDWLibrary::get('redirecturl', '', 'esc_url_raw');
1389
+ $prepareArgs = array( $redirecturl, $gallery_id );
1390
+ $where = ' WHERE gallery_id=%d';
1391
+ if ( !$all ) {
1392
+ $where .= ' AND id=%d';
1393
+ $prepareArgs[] = $id;
1394
+ }
1395
+
1396
  $search = WDWLibrary::get('s');
1397
  if ( $search ) {
1398
+ $where .= ' AND `filename` LIKE %s';
1399
+ $prepareArgs[] = "%" . $search . "%";
1400
  }
1401
+
1402
  global $wpdb;
1403
+ $updated = $wpdb->query( $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `redirect_url`="%s"' . $where, $prepareArgs) );
 
 
 
1404
  $message = 2;
1405
  if ( $updated !== FALSE ) {
1406
  $message = 25;
1412
  if ( $gallery_id == 0 ) {
1413
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1414
  }
1415
+
1416
  $tag_ids = WDWLibrary::get('added_tags_id');
1417
  $tag_act = WDWLibrary::get('added_tags_act');
1418
  $tag_ids_array = explode(',', $tag_ids);
1419
  global $wpdb;
1420
+ $where = ' WHERE gallery_id=%d';
1421
+ $prepareArgs = array($gallery_id);
1422
+ if ( !$all ) {
1423
+ $where .= ' AND id=%d';
1424
+ $prepareArgs[] = $id;
1425
+ }
1426
+
1427
  $search = WDWLibrary::get('s');
1428
  if ( $search ) {
1429
+ $where .= ' AND (`alt` LIKE %s';
1430
+ $where .= ' OR `filename` LIKE %s';
1431
+ $where .= ' OR `description` LIKE %s)';
1432
+ $prepareArgs[] = "%" . trim($search) . "%";
1433
+ $prepareArgs[] = "%" . trim($search) . "%";
1434
+ $prepareArgs[] = "%" . trim($search) . "%";
1435
+ }
1436
+ $images = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_image`' . $where, $prepareArgs));
1437
  foreach ( $images as $image ) {
1438
  foreach ( $tag_ids_array as $tag_id ) {
1439
  if ( $tag_id ) {
1476
  if ( $gallery_id == 0 ) {
1477
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1478
  }
1479
+ $where = ' WHERE gallery_id=%d';
1480
+ $prepareArgs = array($gallery_id);
1481
+ if ( !$all ) {
1482
+ $where .= ' AND id=%d';
1483
+ $prepareArgs[] = $id;
1484
+ }
1485
+
1486
  $search = WDWLibrary::get('s');
1487
  if ( $search ) {
1488
+ $where .= ' AND `filename` LIKE %s';
1489
+ $prepareArgs[] = "%" . $search . "%";
1490
  }
1491
+ $image_ids_col = $wpdb->get_col($wpdb->prepare('SELECT id FROM `' . $wpdb->prefix . 'bwg_image`' . $where, $prepareArgs) );
1492
  foreach ($image_ids_col as $image_id) {
1493
  $thumb_url_image_id = WDWLibrary::get('thumb_url_' . $image_id, '', 'esc_url_raw');
1494
  $file_path = str_replace("thumb", ".original", htmlspecialchars_decode(BWG()->upload_dir . $thumb_url_image_id, ENT_COMPAT | ENT_QUOTES));
1497
  if ($item_longest_dimension > $img_width && $img_width) {
1498
  $not_set_items[] = $image_id . "-" . $item_longest_dimension;
1499
  }
1500
+ $wpdb->update($wpdb->prefix . 'bwg_image', array('pricelist_id' => $pricelist_id), array('id' => $image_id), array('%d'));
1501
  }
1502
  }
1503
  if ( empty($not_set_items) === FALSE ) {
1520
  $gallery_id = WDWLibrary::get('current_id', 0, 'intval');
1521
  }
1522
  $where = ' WHERE gallery_id=' . $gallery_id;
1523
+ $prepareArgs = array($gallery_id);
1524
+ if ( !$all ) {
1525
+ $where .= ' AND id=%d';
1526
+ $prepareArgs[] = $id;
1527
+ }
1528
+
1529
  $search = WDWLibrary::get('s');
1530
  if ( $search ) {
1531
+ $where .= ' AND `filename` LIKE %s';
1532
+ $prepareArgs[] = "%" . $search . "%";
1533
  }
1534
+ $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET pricelist_id=0' . $where, $prepareArgs));
1535
  }
1536
 
1537
  /**
1546
  $message_id = 2;
1547
  if ( !empty($orders) ) {
1548
  foreach ( $orders as $order => $id ) {
1549
+ $upd_query = 'UPDATE ' . $wpdb->prefix . 'bwg_gallery SET `order` = %d WHERE `id` = %d';
1550
+ $update = $wpdb->query($wpdb->prepare($upd_query, array($order,$id)));
1551
  if ( $update ) {
1552
  $message_id = 1;
1553
  }
admin/models/Themes.php CHANGED
@@ -18,6 +18,7 @@ class ThemesModel_bwg {
18
  $page_num = $params['page_num'];
19
  $search = $params['search'];
20
 
 
21
  if ( !$total ) {
22
  $query = 'SELECT *';
23
  }
@@ -27,19 +28,22 @@ class ThemesModel_bwg {
27
  $query .= ' FROM `' . $wpdb->prefix . 'bwg_theme` AS `t`';
28
 
29
  if ( $search ) {
30
- $query .= ' WHERE `t`.`name` LIKE "%' . $search . '%"';
 
31
  }
32
 
33
  if ( !$total ) {
34
  $query .= ' ORDER BY `t`.`' . $orderby . '` ' . $order;
35
- $query .= ' LIMIT ' . $page_num . ',' . $page_per;
 
 
36
  }
37
 
38
  if ( !$total ) {
39
- $rows = $wpdb->get_results($query);
40
  }
41
  else {
42
- $rows = $wpdb->get_var($query);
43
  }
44
  return $rows;
45
  }
@@ -158,4 +162,4 @@ class ThemesModel_bwg {
158
 
159
  return $wpdb->update($wpdb->prefix . 'bwg_theme', $params, $where);
160
  }
161
- }
18
  $page_num = $params['page_num'];
19
  $search = $params['search'];
20
 
21
+ $prepareArgs = array();
22
  if ( !$total ) {
23
  $query = 'SELECT *';
24
  }
28
  $query .= ' FROM `' . $wpdb->prefix . 'bwg_theme` AS `t`';
29
 
30
  if ( $search ) {
31
+ $query .= ' WHERE `t`.`name` LIKE %s';
32
+ $prepareArgs[] = "%" . $search . "%";
33
  }
34
 
35
  if ( !$total ) {
36
  $query .= ' ORDER BY `t`.`' . $orderby . '` ' . $order;
37
+ $query .= ' LIMIT %d, %d';
38
+ $prepareArgs[] = $page_num;
39
+ $prepareArgs[] = $page_per;
40
  }
41
 
42
  if ( !$total ) {
43
+ $rows = $wpdb->get_results($wpdb->prepare($query, $prepareArgs));
44
  }
45
  else {
46
+ $rows = $wpdb->get_var($wpdb->prepare($query, $prepareArgs));
47
  }
48
  return $rows;
49
  }
162
 
163
  return $wpdb->update($wpdb->prefix . 'bwg_theme', $params, $where);
164
  }
165
+ }
admin/views/AddTags.php CHANGED
@@ -112,7 +112,7 @@ class AddTagsView_bwg extends AdminView_bwg {
112
  </div>
113
  </div>
114
  <script>
115
- jQuery(window).load(function() {
116
  jQuery("#loading_div", window.parent.document).hide();
117
  });
118
  </script>
112
  </div>
113
  </div>
114
  <script>
115
+ jQuery(window).on('load',function(){
116
  jQuery("#loading_div", window.parent.document).hide();
117
  });
118
  </script>
admin/views/AdminView.php CHANGED
@@ -329,27 +329,21 @@ class AdminView_bwg {
329
  ob_start();
330
  ?>
331
  <div class="alignleft actions bulkactions">
332
- <?php
333
- // ToDo not show according to design, not deleted-it can be used again.
334
- // if ( $select_all ) {
335
- // ?>
336
- <!-- <span class="button wd-check-all" onclick="spider_check_all_items(event)">-->
337
- <!-- <input type="checkbox" id="check_all_items" name="check_all_items" onclick="spider_check_all_items_checkbox(event)" />-->
338
- <!-- <span>--><?php //_e('Select All', BWG()->prefix); ?><!--</span>-->
339
- <!-- </span>-->
340
- <!-- --><?php
341
- // }
342
- ?>
343
  <label for="bulk-action-selector-top" class="screen-reader-text"><?php _e('Select bulk action', BWG()->prefix); ?></label>
344
  <select name="<?php echo $name; ?>" id="bulk-action-selector-top">
345
  <option value="-1"><?php _e('Bulk Actions', BWG()->prefix); ?></option>
346
- <?php
347
- foreach ( $actions as $key => $action ) {
348
- ?>
349
  <option value="<?php echo $key; ?>" <?php echo isset($action['disabled']) ? $action['disabled'] : ''; ?>><?php echo $action['title']; ?></option>
350
- <?php
351
- }
352
- ?>
353
  </select>
354
  <input type="button" id="doaction" class="button action" onclick="<?php echo (BWG()->is_demo ? 'alert(\'' . addslashes(__('This option is disabled in demo.', BWG()->prefix)) . '\')' : 'wd_bulk_action(this)'); ?>" value="<?php _e('Apply', BWG()->prefix); ?>" />
355
  </div>
329
  ob_start();
330
  ?>
331
  <div class="alignleft actions bulkactions">
332
+ <?php
333
+ // ToDo not show according to design, not deleted-it can be used again.
334
+ if ( $select_all ) { ?>
335
+ <span class="button wd-check-all" onclick="spider_check_all_items(event)">
336
+ <input type="checkbox" id="check_all_items" name="check_all_items" onclick="spider_check_all_items_checkbox(event)" />
337
+ <span><?php _e('Select All', BWG()->prefix); ?></span>
338
+ </span>
339
+ <?php } ?>
340
+
 
 
341
  <label for="bulk-action-selector-top" class="screen-reader-text"><?php _e('Select bulk action', BWG()->prefix); ?></label>
342
  <select name="<?php echo $name; ?>" id="bulk-action-selector-top">
343
  <option value="-1"><?php _e('Bulk Actions', BWG()->prefix); ?></option>
344
+ <?php foreach ( $actions as $key => $action ) { ?>
 
 
345
  <option value="<?php echo $key; ?>" <?php echo isset($action['disabled']) ? $action['disabled'] : ''; ?>><?php echo $action['title']; ?></option>
346
+ <?php } ?>
 
 
347
  </select>
348
  <input type="button" id="doaction" class="button action" onclick="<?php echo (BWG()->is_demo ? 'alert(\'' . addslashes(__('This option is disabled in demo.', BWG()->prefix)) . '\')' : 'wd_bulk_action(this)'); ?>" value="<?php _e('Apply', BWG()->prefix); ?>" />
349
  </div>
admin/views/Albumsgalleries.php CHANGED
@@ -140,7 +140,7 @@ class AlbumsgalleriesView_bwg extends AdminView_bwg {
140
  </div>
141
  </div>
142
  <script>
143
- jQuery(window).load(function() {
144
  jQuery("#loading_div", window.parent.document).hide();
145
  });
146
  </script>
140
  </div>
141
  </div>
142
  <script>
143
+ jQuery(window).on('load',function(){
144
  jQuery("#loading_div", window.parent.document).hide();
145
  });
146
  </script>
admin/views/Editimage.php CHANGED
@@ -87,7 +87,7 @@ class EditimageView_bwg {
87
  }
88
  }
89
  }
90
- jQuery(window).load(function() {
91
  jQuery('#loading_div', window.parent.document).hide();
92
  });
93
  </script>
@@ -327,7 +327,7 @@ class EditimageView_bwg {
327
  </div>
328
  </div>
329
  <script language="javascript">
330
- jQuery(window).load(function () {
331
  spider_crop_fix("<?php echo $thumb_width * 300 / $thumb_height; ?>", "<?php echo 300; ?>");
332
  });
333
  function spider_crop_ratio() {
@@ -953,7 +953,7 @@ class EditimageView_bwg {
953
  window.parent.document.getElementById("image_thumb_<?php echo $image_id; ?>").src = image_src + "<?php echo isset($updated_image['modified_date']) && $updated_image['modified_date'] ? '?bwg=' . $updated_image['modified_date'] : ''; ?>";
954
  }
955
 
956
- jQuery(document).ready(function () {
957
  jQuery(".bwg_opt_cont").click(function () {
958
  if (jQuery('#brightness_contrast').height() == 0) {
959
  jQuery('#brightness_contrast').animate({
87
  }
88
  }
89
  }
90
+ jQuery(window).on('load',function(){
91
  jQuery('#loading_div', window.parent.document).hide();
92
  });
93
  </script>
327
  </div>
328
  </div>
329
  <script language="javascript">
330
+ jQuery(window).on('load',function(){
331
  spider_crop_fix("<?php echo $thumb_width * 300 / $thumb_height; ?>", "<?php echo 300; ?>");
332
  });
333
  function spider_crop_ratio() {
953
  window.parent.document.getElementById("image_thumb_<?php echo $image_id; ?>").src = image_src + "<?php echo isset($updated_image['modified_date']) && $updated_image['modified_date'] ? '?bwg=' . $updated_image['modified_date'] : ''; ?>";
954
  }
955
 
956
+ jQuery(function() {
957
  jQuery(".bwg_opt_cont").click(function () {
958
  if (jQuery('#brightness_contrast').height() == 0) {
959
  jQuery('#brightness_contrast').animate({
admin/views/Options.php CHANGED
@@ -1110,7 +1110,7 @@ class OptionsView_bwg extends AdminView_bwg {
1110
  function bwg_add_watermark_image(files) {
1111
  document.getElementById("watermark_url").value = '<?php echo BWG()->upload_url; ?>' + files[0]['url'];
1112
  }
1113
- jQuery(document).ready(function() {
1114
  bwg_inputs();
1115
  bwg_watermark('watermark_type_<?php echo $row->watermark_type ?>');
1116
  bwg_built_in_watermark('watermark_type_<?php echo $row->built_in_watermark_type ?>');
@@ -1171,7 +1171,7 @@ class OptionsView_bwg extends AdminView_bwg {
1171
  bwg_pagination_description(jQuery('#album_extended_enable_page_<?php echo $row->album_extended_enable_page; ?>'));
1172
  });
1173
  <?php if ( WDWLibrary::get('instagram_token') || WDWLibrary::get('code') ) { ?>
1174
- jQuery(window).load(function() {
1175
  var advanced_tab_index = 4;
1176
  jQuery( ".bwg_tabs" ).tabs({ active: advanced_tab_index });
1177
  });
1110
  function bwg_add_watermark_image(files) {
1111
  document.getElementById("watermark_url").value = '<?php echo BWG()->upload_url; ?>' + files[0]['url'];
1112
  }
1113
+ jQuery(function () {
1114
  bwg_inputs();
1115
  bwg_watermark('watermark_type_<?php echo $row->watermark_type ?>');
1116
  bwg_built_in_watermark('watermark_type_<?php echo $row->built_in_watermark_type ?>');
1171
  bwg_pagination_description(jQuery('#album_extended_enable_page_<?php echo $row->album_extended_enable_page; ?>'));
1172
  });
1173
  <?php if ( WDWLibrary::get('instagram_token') || WDWLibrary::get('code') ) { ?>
1174
+ jQuery(window).on('load',function(){
1175
  var advanced_tab_index = 4;
1176
  jQuery( ".bwg_tabs" ).tabs({ active: advanced_tab_index });
1177
  });
admin/views/Shortcode.php CHANGED
@@ -661,8 +661,8 @@ class ShortcodeView_bwg extends AdminView_bwg {
661
  content = jQuery("#bwg_shortcode").val();
662
  <?php } ?>
663
  jQuery('#insert').attr('onclick', "jQuery('#loading_div').show(); bwg_insert_shortcode(content);");
664
- jQuery("select[id=theme] option[value='" + short_code['theme_id'] + "']").attr('selected', 'selected');
665
- jQuery("select[id=gallery_types_name] option[value='" + short_code['gallery_type'] + "']").attr('selected', 'selected');
666
  jQuery("#use_option_defaults").prop('checked', true).trigger('change');
667
  if (short_code['type'] == 'album' || short_code['gallery_type'] == 'album_compact_preview' || short_code['gallery_type'] == 'album_masonry_preview' || short_code['gallery_type'] == 'album_extended_preview') {
668
  short_code['type'] = 'album';
@@ -672,9 +672,9 @@ class ShortcodeView_bwg extends AdminView_bwg {
672
  short_code['type'] = 'gallery';
673
  jQuery(".bwg_tabs").tabs({active: 0});
674
  }
675
- jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").attr('selected', 'selected');
676
- jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").attr('selected', 'selected');
677
- jQuery("select[id=tag] option[value='" + short_code['tag'] + "']").attr('selected', 'selected');
678
  bwg_gallery_type(short_code['gallery_type']);
679
  if (short_code['use_option_defaults'] != 1) {
680
  jQuery("#use_option_defaults").prop('checked', false).trigger('change');
@@ -685,26 +685,26 @@ class ShortcodeView_bwg extends AdminView_bwg {
685
  jQuery("#thumb_height").val(short_code['thumb_height']);
686
  jQuery("#image_column_number").val(short_code['image_column_number']);
687
  if (short_code['image_enable_page'] == 1) {
688
- jQuery("#image_enable_page_1").attr('checked', 'checked');
689
  }
690
  else if (short_code['image_enable_page'] == 0) {
691
- jQuery("#image_enable_page_0").attr('checked', 'checked');
692
  }
693
  else if (short_code['image_enable_page'] == 2) {
694
- jQuery("#image_enable_page_2").attr('checked', 'checked');
695
  }
696
  else if (short_code['image_enable_page'] == 3) {
697
- jQuery("#image_enable_page_3").attr('checked', 'checked');
698
  }
699
  jQuery("#images_per_page").val(short_code['images_per_page']);
700
  jQuery("#load_more_image_count").val(short_code['load_more_image_count']);
701
- jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
702
- jQuery("select[id=order_by] option[value='" + short_code['order_by'] + "']").attr('selected', 'selected');
703
  if (short_code['show_search_box'] == 1) {
704
- jQuery("#show_search_box_1").attr('checked', 'checked');
705
  }
706
  else {
707
- jQuery("#show_search_box_0").attr('checked', 'checked');
708
  }
709
  if (short_code['placeholder']) {
710
  jQuery("#placeholder").val(short_code['placeholder']);
@@ -713,118 +713,118 @@ class ShortcodeView_bwg extends AdminView_bwg {
713
  jQuery("#search_box_width").val(short_code['search_box_width']);
714
  }
715
  if (short_code['show_sort_images'] == 1) {
716
- jQuery("#show_sort_images_1").attr('checked', 'checked');
717
  }
718
  else {
719
- jQuery("#show_sort_images_0").attr('checked', 'checked');
720
  }
721
  if (short_code['show_tag_box'] == 1) {
722
- jQuery("#show_tag_box_1").attr('checked', 'checked');
723
  }
724
  else {
725
- jQuery("#show_tag_box_0").attr('checked', 'checked');
726
  }
727
  if (short_code['showthumbs_name'] == 1) {
728
- jQuery("#thumb_name_yes").attr('checked', 'checked');
729
  }
730
  else {
731
- jQuery("#thumb_name_no").attr('checked', 'checked');
732
  }
733
  if (short_code['show_gallery_description'] == 1) {
734
- jQuery("#show_gallery_description_1").attr('checked', 'checked');
735
  }
736
  else {
737
- jQuery("#show_gallery_description_0").attr('checked', 'checked');
738
  }
739
  if (short_code['image_title'] == 'hover') {
740
- jQuery("#image_title_show_hover_1").attr('checked', 'checked');
741
  }
742
  else if (short_code['image_title'] == 'show') {
743
- jQuery("#image_title_show_hover_0").attr('checked', 'checked');
744
  }
745
  else {
746
- jQuery("#image_title_show_hover_2").attr('checked', 'checked');
747
  }
748
  if( short_code['show_thumb_description'] == 1 ) {
749
- jQuery("#thumb_desc_1").attr('checked', 'checked');
750
  }
751
  else {
752
- jQuery("#thumb_desc_0").attr('checked', 'checked');
753
  }
754
  if (short_code['play_icon'] == 1) {
755
- jQuery("#play_icon_yes").attr('checked', 'checked');
756
  }
757
  else {
758
- jQuery("#play_icon_no").attr('checked', 'checked');
759
  }
760
  if (short_code['gallery_download'] == 1) {
761
- jQuery("#gallery_download_1").attr('checked', 'checked');
762
  }
763
  else {
764
- jQuery("#gallery_download_0").attr('checked', 'checked');
765
  }
766
  if (short_code['ecommerce_icon'] == 'hover') {
767
- jQuery("#ecommerce_icon_show_hover_1").attr('checked', 'checked');
768
  }
769
  else if (short_code['ecommerce_icon'] == 'show') {
770
- jQuery("#ecommerce_icon_show_hover_0").attr('checked', 'checked');
771
  }
772
  else {
773
- jQuery("#ecommerce_icon_show_hover_2").attr('checked', 'checked');
774
  }
775
  break;
776
  }
777
  case 'thumbnails_masonry': {
778
  if (short_code['masonry_hor_ver'] == 'horizontal') {
779
  jQuery("#masonry_0").prop('checked', false).removeAttr('checked');
780
- jQuery("#masonry_1").attr('checked', 'checked');
781
  jQuery("#masonry_thumb_size").val(short_code['thumb_height']);
782
  jQuery('.masonry_col_num').hide();
783
  jQuery('.masonry_row_num').show();
784
  }
785
  else {
786
- jQuery("#masonry_0").attr('checked', 'checked');
787
  jQuery("#masonry_thumb_size").val(short_code['thumb_width']);
788
  jQuery('.masonry_row_num').hide();
789
  jQuery('.masonry_col_num').show();
790
  }
791
  if (short_code['image_title'] == 'hover') {
792
- jQuery("#masonry_image_title_0").attr('checked', 'checked');
793
  }
794
  else if (short_code['image_title'] == 'show') {
795
- jQuery("#masonry_image_title_1").attr('checked', 'checked');
796
  }
797
  else {
798
- jQuery("#masonry_image_title_2").attr('checked', 'checked');
799
  }
800
  if (short_code['show_masonry_thumb_description'] == 1) {
801
- jQuery("#masonry_thumb_desc_1").attr('checked', 'checked');
802
  }
803
  else {
804
- jQuery("#masonry_thumb_desc_0").attr('checked', 'checked');
805
  }
806
  jQuery("#masonry_image_column_number").val(short_code['image_column_number']);
807
  if (short_code['image_enable_page'] == 1) {
808
- jQuery("#masonry_image_enable_page_1").attr('checked', 'checked');
809
  }
810
  else if (short_code['image_enable_page'] == 0) {
811
- jQuery("#masonry_image_enable_page_0").attr('checked', 'checked');
812
  }
813
  else if (short_code['image_enable_page'] == 2) {
814
- jQuery("#masonry_image_enable_page_2").attr('checked', 'checked');
815
  }
816
  else if (short_code['image_enable_page'] == 3) {
817
- jQuery("#masonry_image_enable_page_3").attr('checked', 'checked');
818
  }
819
  jQuery("#masonry_images_per_page").val(short_code['images_per_page']);
820
  jQuery("#masonry_load_more_image_count").val(short_code['load_more_image_count']);
821
- jQuery("select[id=masonry_sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
822
- jQuery("select[id=masonry_order_by] option[value='" + short_code['order_by'] + "']").attr('selected', 'selected');
823
  if (short_code['show_search_box'] == 1) {
824
- jQuery("#masonry_show_search_box_1").attr('checked', 'checked');
825
  }
826
  else {
827
- jQuery("#masonry_show_search_box_0").attr('checked', 'checked');
828
  }
829
  if (short_code['placeholder']) {
830
  jQuery("#masonry_placeholder").val(short_code['placeholder']);
@@ -833,89 +833,89 @@ class ShortcodeView_bwg extends AdminView_bwg {
833
  jQuery("#masonry_search_box_width").val(short_code['search_box_width']);
834
  }
835
  else if (short_code['image_enable_page'] == 2) {
836
- jQuery("#masonry_image_page_loadmore").attr('checked', 'checked');
837
  }
838
  if (short_code['show_sort_images'] == 1) {
839
- jQuery("#masonry_show_sort_images_1").attr('checked', 'checked');
840
  }
841
  else {
842
- jQuery("#masonry_show_sort_images_0").attr('checked', 'checked');
843
  }
844
  if (short_code['show_tag_box'] == 1) {
845
- jQuery("#masonry_show_tag_box_1").attr('checked', 'checked');
846
  }
847
  else {
848
- jQuery("#masonry_show_tag_box_0").attr('checked', 'checked');
849
  }
850
  if (short_code['showthumbs_name'] == 1) {
851
- jQuery("#masonry_thumb_name_yes").attr('checked', 'checked');
852
  }
853
  else {
854
- jQuery("#masonry_thumb_name_no").attr('checked', 'checked');
855
  }
856
  if (short_code['show_gallery_description'] == 1) {
857
- jQuery("#masonry_show_gallery_description_1").attr('checked', 'checked');
858
  }
859
  else {
860
- jQuery("#masonry_show_gallery_description_0").attr('checked', 'checked');
861
  }
862
  if (short_code['play_icon'] == 1) {
863
- jQuery("#masonry_play_icon_yes").attr('checked', 'checked');
864
  }
865
  else {
866
- jQuery("#masonry_play_icon_no").attr('checked', 'checked');
867
  }
868
  if (short_code['gallery_download'] == 1) {
869
- jQuery("#masonry_gallery_download_1").attr('checked', 'checked');
870
  }
871
  else {
872
- jQuery("#masonry_gallery_download_0").attr('checked', 'checked');
873
  }
874
  if (short_code['ecommerce_icon'] == 'hover') {
875
- jQuery("#masonry_ecommerce_icon_show_hover_1").attr('checked', 'checked');
876
  }
877
  else {
878
- jQuery("#masonry_ecommerce_icon_show_hover_2").attr('checked', 'checked');
879
  }
880
  break;
881
  }
882
  case 'thumbnails_mosaic': {
883
  if (short_code['mosaic_hor_ver'] == 'horizontal') {
884
- jQuery("#mosaic_1").attr('checked', 'checked');
885
  jQuery("#mosaic_thumb_size").val(short_code['thumb_height']);
886
  }
887
  else {
888
- jQuery("#mosaic_0").attr('checked', 'checked');
889
  jQuery("#mosaic_thumb_size").val(short_code['thumb_width']);
890
  }
891
  if (short_code['resizable_mosaic'] == 1) {
892
- jQuery("#resizable_mosaic_1").attr('checked', 'checked');
893
  }
894
  else {
895
- jQuery("#resizable_mosaic_0").attr('checked', 'checked');
896
  }
897
  jQuery("#mosaic_total_width").val(short_code['mosaic_total_width']);
898
  if (short_code['image_enable_page'] == 1) {
899
- jQuery("#mosaic_image_enable_page_1").attr('checked', 'checked');
900
  }
901
  else if (short_code['image_enable_page'] == 0) {
902
- jQuery("#mosaic_image_enable_page_0").attr('checked', 'checked');
903
  }
904
  else if (short_code['image_enable_page'] == 2) {
905
- jQuery("#mosaic_image_enable_page_2").attr('checked', 'checked');
906
  }
907
  else if (short_code['image_enable_page'] == 3) {
908
- jQuery("#mosaic_image_enable_page_3").attr('checked', 'checked');
909
  }
910
  jQuery("#mosaic_images_per_page").val(short_code['images_per_page']);
911
  jQuery("#mosaic_load_more_image_count").val(short_code['load_more_image_count']);
912
- jQuery("select[id=mosaic_sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
913
- jQuery("select[id=mosaic_order_by] option[value='" + short_code['order_by'] + "']").attr('selected', 'selected');
914
  if (short_code['show_search_box'] == 1) {
915
- jQuery("#mosaic_show_search_box_1").attr('checked', 'checked');
916
  }
917
  else {
918
- jQuery("#mosaic_show_search_box_0").attr('checked', 'checked');
919
  }
920
  if (short_code['placeholder']) {
921
  jQuery("#mosaic_placeholder").val(short_code['placeholder']);
@@ -924,167 +924,167 @@ class ShortcodeView_bwg extends AdminView_bwg {
924
  jQuery("#mosaic_search_box_width").val(short_code['search_box_width']);
925
  }
926
  if (short_code['show_sort_images'] == 1) {
927
- jQuery("#mosaic_show_sort_images_1").attr('checked', 'checked');
928
  }
929
  else {
930
- jQuery("#mosaic_show_sort_images_0").attr('checked', 'checked');
931
  }
932
  if (short_code['show_tag_box'] == 1) {
933
- jQuery("#mosaic_show_tag_box_1").attr('checked', 'checked');
934
  }
935
  else {
936
- jQuery("#mosaic_show_tag_box_0").attr('checked', 'checked');
937
  }
938
  if (short_code['showthumbs_name'] == 1) {
939
- jQuery("#mosaic_thumb_name_yes").attr('checked', 'checked');
940
  }
941
  else {
942
- jQuery("#mosaic_thumb_name_no").attr('checked', 'checked');
943
  }
944
  if (short_code['show_gallery_description'] == 1) {
945
- jQuery("#mosaic_show_gallery_description_1").attr('checked', 'checked');
946
  }
947
  else {
948
- jQuery("#mosaic_show_gallery_description_0").attr('checked', 'checked');
949
  }
950
  if (short_code['image_title'] == 'hover') {
951
- jQuery("#mosaic_image_title_show_hover_1").attr('checked', 'checked');
952
  }
953
  else {
954
- jQuery("#mosaic_image_title_show_hover_0").attr('checked', 'checked');
955
  }
956
  if (short_code['play_icon'] == 1) {
957
- jQuery("#mosaic_play_icon_yes").attr('checked', 'checked');
958
  }
959
  else {
960
- jQuery("#mosaic_play_icon_no").attr('checked', 'checked');
961
  }
962
  if (short_code['gallery_download'] == 1) {
963
- jQuery("#mosaic_gallery_download_1").attr('checked', 'checked');
964
  }
965
  else {
966
- jQuery("#mosaic_gallery_download_0").attr('checked', 'checked');
967
  }
968
  if (short_code['ecommerce_icon'] == 'hover') {
969
- jQuery("#mosaic_ecommerce_icon_show_hover_1").attr('checked', 'checked');
970
  }
971
  else {
972
- jQuery("#mosaic_ecommerce_icon_show_hover_2").attr('checked', 'checked');
973
  }
974
  break;
975
  }
976
  case 'slideshow': {
977
- jQuery("select[id=slideshow_type] option[value='" + short_code['slideshow_effect'] + "']").attr('selected', 'selected');
978
  jQuery("#slideshow_interval").val(short_code['slideshow_interval']);
979
  jQuery("#slideshow_width").val(short_code['slideshow_width']);
980
  jQuery("#slideshow_height").val(short_code['slideshow_height']);
981
- jQuery("select[id=slideshow_sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
982
- jQuery("select[id=slideshow_order_by] option[value='" + short_code['order_by'] + "']").attr('selected', 'selected');
983
  if (short_code['enable_slideshow_autoplay'] == 1) {
984
- jQuery("#slideshow_enable_autoplay_yes").attr('checked', 'checked');
985
  }
986
  else {
987
- jQuery("#slideshow_enable_autoplay_no").attr('checked', 'checked');
988
  }
989
  if (short_code['enable_slideshow_shuffle'] == 1) {
990
- jQuery("#slideshow_enable_shuffle_yes").attr('checked', 'checked');
991
  }
992
  else {
993
- jQuery("#slideshow_enable_shuffle_no").attr('checked', 'checked');
994
  }
995
  if (short_code['enable_slideshow_ctrl'] == 1) {
996
- jQuery("#slideshow_enable_ctrl_yes").attr('checked', 'checked');
997
  }
998
  else {
999
- jQuery("#slideshow_enable_ctrl_no").attr('checked', 'checked');
1000
  }
1001
  if (short_code['autohide_slideshow_navigation'] == 1) {
1002
- jQuery("#autohide_slideshow_navigation_1").attr('checked', 'checked');
1003
  }
1004
  else {
1005
- jQuery("#autohide_slideshow_navigation_0").attr('checked', 'checked');
1006
  }
1007
  if (short_code['enable_slideshow_filmstrip'] == 1) {
1008
- jQuery("#slideshow_enable_filmstrip_yes").attr('checked', 'checked');
1009
  }
1010
  else {
1011
- jQuery("#slideshow_enable_filmstrip_no").attr('checked', 'checked');
1012
  }
1013
  if (short_code['slideshow_filmstrip_height']) {
1014
  jQuery( "#slideshow_filmstrip_height" ).val( short_code['slideshow_filmstrip_height'] );
1015
  }
1016
  if (short_code['slideshow_enable_title'] == 1) {
1017
- jQuery("#slideshow_enable_title_yes").attr('checked', 'checked');
1018
  }
1019
  else {
1020
- jQuery("#slideshow_enable_title_no").attr('checked', 'checked');
1021
  }
1022
  if (short_code['slideshow_title_position']) {
1023
  jQuery( "input[name=slideshow_title_position][value=" + short_code['slideshow_title_position'] + "]" ).attr( 'checked', 'checked' );
1024
  }
1025
  if (short_code['slideshow_title_full_width']) {
1026
- jQuery( "#slideshow_title_full_width_" + short_code['slideshow_title_full_width'] ).attr( 'checked', 'checked' );
1027
  }
1028
  if (short_code['slideshow_enable_description'] == 1) {
1029
- jQuery("#slideshow_enable_description_yes").attr('checked', 'checked');
1030
  }
1031
  else {
1032
- jQuery("#slideshow_enable_description_no").attr('checked', 'checked');
1033
  }
1034
  if (short_code['slideshow_description_position']) {
1035
- jQuery("input[name=slideshow_description_position][value=" + short_code['slideshow_description_position'] + "]").attr('checked', 'checked');
1036
  }
1037
  if (short_code['enable_slideshow_music'] == 1) {
1038
- jQuery("#slideshow_enable_music_yes").attr('checked', 'checked');
1039
  }
1040
  else {
1041
- jQuery("#slideshow_enable_music_no").attr('checked', 'checked');
1042
  }
1043
  if (short_code['slideshow_music_url']) {
1044
  jQuery("#slideshow_audio_url").val(short_code['slideshow_music_url']);
1045
  }
1046
  jQuery("#slideshow_effect_duration").val(short_code['slideshow_effect_duration']);
1047
  if (short_code['gallery_download'] == 1) {
1048
- jQuery("#slideshow_gallery_download_1").attr('checked', 'checked');
1049
  }
1050
  else {
1051
- jQuery("#slideshow_gallery_download_0").attr('checked', 'checked');
1052
  }
1053
  break;
1054
  }
1055
  case 'image_browser': {
1056
  jQuery("#image_browser_width").val(short_code['image_browser_width']);
1057
  if (short_code['image_browser_title_enable']) {
1058
- jQuery("#image_browser_title_enable_" + short_code['image_browser_title_enable']).attr('checked', 'checked');
1059
  }
1060
  if (short_code['image_browser_description_enable']) {
1061
- jQuery("#image_browser_description_enable_" + short_code['image_browser_description_enable']).attr('checked', 'checked');
1062
  }
1063
- jQuery("select[id=image_browser_sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
1064
- jQuery("select[id=image_browser_order_by] option[value='" + short_code['order_by'] + "']").attr('selected', 'selected');
1065
  if (short_code['showthumbs_name'] == 1) {
1066
- jQuery("#image_browser_thumb_name_yes").attr('checked', 'checked');
1067
  }
1068
  else {
1069
- jQuery("#image_browser_thumb_name_no").attr('checked', 'checked');
1070
  }
1071
  if (short_code['show_gallery_description']) {
1072
- jQuery("#image_browser_show_gallery_description_" + short_code['show_gallery_description']).attr('checked', 'checked');
1073
  }
1074
  if (short_code['show_search_box']) {
1075
- jQuery("#image_browser_show_search_box_" + short_code['show_search_box']).attr('checked', 'checked');
1076
  }
1077
  if (short_code['show_sort_images'] == 1) {
1078
- jQuery("#image_browser_show_sort_images_1").attr('checked', 'checked');
1079
  }
1080
  else {
1081
- jQuery("#image_browser_show_sort_images_0").attr('checked', 'checked');
1082
  }
1083
  if (short_code['show_tag_box'] == 1) {
1084
- jQuery("#image_browser_show_tag_box_1").attr('checked', 'checked');
1085
  }
1086
  else {
1087
- jQuery("#image_browser_show_tag_box_0").attr('checked', 'checked');
1088
  }
1089
 
1090
  if (short_code['placeholder']) {
@@ -1094,60 +1094,60 @@ class ShortcodeView_bwg extends AdminView_bwg {
1094
  jQuery("#image_browser_search_box_width").val(short_code['search_box_width']);
1095
  }
1096
  if (short_code['gallery_download'] == 1) {
1097
- jQuery("#image_browser_gallery_download_1").attr('checked', 'checked');
1098
  }
1099
  else {
1100
- jQuery("#image_browser_gallery_download_0").attr('checked', 'checked');
1101
  }
1102
  break;
1103
  }
1104
  case 'blog_style': {
1105
  jQuery("#blog_style_width").val(short_code['blog_style_width']);
1106
  if (short_code['blog_style_title_enable'] == 1) {
1107
- jQuery("#blog_style_title_enable_1").attr('checked', 'checked');
1108
  }
1109
  else {
1110
- jQuery("#blog_style_title_enable_0").attr('checked', 'checked');
1111
  }
1112
  jQuery("#blog_style_images_per_page").val(short_code['blog_style_images_per_page']);
1113
  jQuery("#blog_style_load_more_image_count").val(short_code['blog_style_load_more_image_count']);
1114
  if (short_code['blog_style_enable_page'] == 1) {
1115
- jQuery("#blog_style_enable_page_1").attr('checked', 'checked');
1116
  }
1117
  else if (short_code['blog_style_enable_page'] == 0) {
1118
- jQuery("#blog_style_enable_page_0").attr('checked', 'checked');
1119
  }
1120
  else if (short_code['blog_style_enable_page'] == 2) {
1121
- jQuery("#blog_style_enable_page_2").attr('checked', 'checked');
1122
  }
1123
  else if (short_code['blog_style_enable_page'] == 3) {
1124
- jQuery("#blog_style_enable_page_3").attr('checked', 'checked');
1125
  }
1126
  if (short_code['blog_style_description_enable'] == 1) {
1127
- jQuery("#blog_style_description_enable_1").attr('checked', 'checked');
1128
  }
1129
  else {
1130
- jQuery("#blog_style_description_enable_0").attr('checked', 'checked');
1131
  }
1132
- jQuery("select[id=blog_style_sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
1133
- jQuery("select[id=blog_style_order_by] option[value='" + short_code['order_by'] + "']").attr('selected', 'selected');
1134
  if (short_code['showthumbs_name'] == 1) {
1135
- jQuery("#blog_style_thumb_name_yes").attr('checked', 'checked');
1136
  }
1137
  else {
1138
- jQuery("#blog_style_thumb_name_no").attr('checked', 'checked');
1139
  }
1140
  if (short_code['show_gallery_description'] == 1) {
1141
- jQuery("#blog_style_show_gallery_description_1").attr('checked', 'checked');
1142
  }
1143
  else {
1144
- jQuery("#blog_style_show_gallery_description_0").attr('checked', 'checked');
1145
  }
1146
  if (short_code['show_search_box'] == 1) {
1147
- jQuery("#blog_style_show_search_box_1").attr('checked', 'checked');
1148
  }
1149
  else {
1150
- jQuery("#blog_style_show_search_box_0").attr('checked', 'checked');
1151
  }
1152
  if (short_code['placeholder']) {
1153
  jQuery("#blog_style_placeholder").val(short_code['placeholder']);
@@ -1156,22 +1156,22 @@ class ShortcodeView_bwg extends AdminView_bwg {
1156
  jQuery("#blog_style_search_box_width").val(short_code['search_box_width']);
1157
  }
1158
  if (short_code['show_sort_images'] == 1) {
1159
- jQuery("#blog_style_show_sort_images_1").attr('checked', 'checked');
1160
  }
1161
  else {
1162
- jQuery("#blog_style_show_sort_images_0").attr('checked', 'checked');
1163
  }
1164
  if (short_code['show_tag_box'] == 1) {
1165
- jQuery("#blog_style_show_tag_box_1").attr('checked', 'checked');
1166
  }
1167
  else {
1168
- jQuery("#blog_style_show_tag_box_0").attr('checked', 'checked');
1169
  }
1170
  if (short_code['gallery_download'] == 1) {
1171
- jQuery("#blog_style_gallery_download_1").attr('checked', 'checked');
1172
  }
1173
  else {
1174
- jQuery("#blog_style_gallery_download_0").attr('checked', 'checked');
1175
  }
1176
  break;
1177
  }
@@ -1182,55 +1182,55 @@ class ShortcodeView_bwg extends AdminView_bwg {
1182
  jQuery("#carousel_image_column_number").val(short_code['carousel_image_column_number']);
1183
  jQuery("#carousel_image_par").val(short_code['carousel_image_par']);
1184
  if (short_code['enable_carousel_title'] == 1) {
1185
- jQuery("#carousel_enable_title_yes").attr('checked', 'checked');
1186
  }
1187
  else {
1188
- jQuery("#carousel_enable_title_no").attr('checked', 'checked');
1189
  }
1190
  if (short_code['enable_carousel_autoplay'] == 1) {
1191
- jQuery("#carousel_enable_autoplay_yes").attr('checked', 'checked');
1192
  }
1193
  else {
1194
- jQuery("#carousel_enable_autoplay_no").attr('checked', 'checked');
1195
  }
1196
  jQuery("#carousel_r_width").val(short_code['carousel_r_width']);
1197
  if (short_code['carousel_fit_containerWidth'] == 1) {
1198
- jQuery("#carousel_fit_containerWidth_yes").attr('checked', 'checked');
1199
  }
1200
  else {
1201
- jQuery("#carousel_fit_containerWidth_no").attr('checked', 'checked');
1202
  }
1203
  if (short_code['carousel_prev_next_butt'] == 1) {
1204
- jQuery("#carousel_prev_next_butt_yes").attr('checked', 'checked');
1205
  }
1206
  else {
1207
- jQuery("#carousel_prev_next_butt_no").attr('checked', 'checked');
1208
  }
1209
  if (short_code['carousel_play_pause_butt'] == 1) {
1210
- jQuery("#carousel_play_pause_butt_yes").attr('checked', 'checked');
1211
  }
1212
  else {
1213
- jQuery("#carousel_play_pause_butt_no").attr('checked', 'checked');
1214
  }
1215
- jQuery("select[id=carousel_sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
1216
- jQuery("select[id=carousel_order_by] option[value='" + short_code['order_by'] + "']").attr('selected', 'selected');
1217
  if (short_code['gallery_download'] == 1) {
1218
- jQuery("#carousel_gallery_download_1").attr('checked', 'checked');
1219
  }
1220
  else {
1221
- jQuery("#carousel_gallery_download_0").attr('checked', 'checked');
1222
  }
1223
  if (short_code['showthumbs_name'] == 1) {
1224
- jQuery("#carousel_thumb_name_yes").attr('checked', 'checked');
1225
  }
1226
  else {
1227
- jQuery("#carousel_thumb_name_no").attr('checked', 'checked');
1228
  }
1229
  if (short_code['show_gallery_description'] == 1) {
1230
- jQuery("#carousel_show_gallery_description_1").attr('checked', 'checked');
1231
  }
1232
  else {
1233
- jQuery("#carousel_show_gallery_description_0").attr('checked', 'checked');
1234
  }
1235
  break;
1236
  }
@@ -1242,20 +1242,20 @@ class ShortcodeView_bwg extends AdminView_bwg {
1242
  jQuery("#album_image_thumb_width").val(short_code['compuct_album_image_thumb_width']);
1243
  jQuery("#album_image_thumb_height").val(short_code['compuct_album_image_thumb_height']);
1244
  if (short_code['compuct_album_enable_page']) {
1245
- jQuery("#album_enable_page_" + short_code['compuct_album_enable_page']).attr('checked', 'checked');
1246
  }
1247
  jQuery("#albums_per_page").val(short_code['compuct_albums_per_page']);
1248
  jQuery("#album_images_per_page").val(short_code['compuct_album_images_per_page']);
1249
- jQuery("select[id=compact_album_sort_by] option[value='" + short_code['all_album_sort_by'] + "']").attr('selected', 'selected');
1250
- jQuery("select[id=compact_album_order_by] option[value='" + short_code['all_album_order_by'] + "']").attr('selected', 'selected');
1251
- jQuery("select[id=album_sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
1252
- jQuery("select[id=album_order_by] option[value='" + short_code['order_by'] + "']").attr('selected', 'selected');
1253
 
1254
  if (short_code['show_search_box'] == 1) {
1255
- jQuery("#album_show_search_box_1").attr('checked', 'checked');
1256
  }
1257
  else {
1258
- jQuery("#album_show_search_box_0").attr('checked', 'checked');
1259
  }
1260
  if (short_code['placeholder']) {
1261
  jQuery("#album_placeholder").val(short_code['placeholder']);
@@ -1264,66 +1264,66 @@ class ShortcodeView_bwg extends AdminView_bwg {
1264
  jQuery("#album_search_box_width").val(short_code['search_box_width']);
1265
  }
1266
  if (short_code['show_sort_images'] == 1) {
1267
- jQuery("#album_show_sort_images_1").attr('checked', 'checked');
1268
  }
1269
  else {
1270
- jQuery("#album_show_sort_images_0").attr('checked', 'checked');
1271
  }
1272
  if (short_code['show_tag_box'] == 1) {
1273
- jQuery("#album_show_tag_box_1").attr('checked', 'checked');
1274
  }
1275
  else {
1276
- jQuery("#album_show_tag_box_0").attr('checked', 'checked');
1277
  }
1278
  if (short_code['show_album_name'] == 1) {
1279
- jQuery("#show_album_name_enable_1").attr('checked', 'checked');
1280
  }
1281
  else {
1282
- jQuery("#show_album_name_enable_0").attr('checked', 'checked');
1283
  }
1284
  if (short_code['show_gallery_description'] == 1) {
1285
- jQuery("#album_show_gallery_description_1").attr('checked', 'checked');
1286
  }
1287
  else {
1288
- jQuery("#album_show_gallery_description_0").attr('checked', 'checked');
1289
  }
1290
- jQuery("input[name=album_title_show_hover][value=" + short_code['compuct_album_title'] + "]").attr('checked', 'checked');
1291
  jQuery('#album_view_type').find('option').removeAttr("selected");
1292
- jQuery("#album_view_type option[value='"+ short_code['compuct_album_view_type'] +"']").attr('selected', 'selected');
1293
- jQuery("input[name='album_image_title_show_hover'][value='" + short_code['compuct_album_image_title'] + "']").attr('checked', 'checked');
1294
  if (short_code['compuct_album_mosaic_hor_ver'] == "vertical") {
1295
- jQuery("#album_mosaic_0").attr('checked', 'checked');
1296
  }
1297
  else {
1298
- jQuery("#album_mosaic_1").attr('checked', 'checked');
1299
  }
1300
  if (short_code['compuct_album_resizable_mosaic'] == 1) {
1301
- jQuery("#album_resizable_mosaic_1").attr('checked', 'checked');
1302
  }
1303
  else {
1304
- jQuery("#album_resizable_mosaic_0").attr('checked', 'checked');
1305
  }
1306
  jQuery("#album_mosaic_total_width").val(short_code['compuct_album_mosaic_total_width']);
1307
  if (short_code['play_icon'] == 1) {
1308
- jQuery("#album_play_icon_yes").attr('checked', 'checked');
1309
  }
1310
  else {
1311
- jQuery("#album_play_icon_no").attr('checked', 'checked');
1312
  }
1313
  if (short_code['gallery_download'] == 1) {
1314
- jQuery("#album_gallery_download_1").attr('checked', 'checked');
1315
  }
1316
  else {
1317
- jQuery("#album_gallery_download_0").attr('checked', 'checked');
1318
  }
1319
  if (short_code['ecommerce_icon'] == 'hover') {
1320
- jQuery("#album_ecommerce_icon_show_hover_1").attr('checked', 'checked');
1321
  }
1322
  else if (short_code['ecommerce_icon'] == 'show') {
1323
- jQuery("#album_ecommerce_icon_show_hover_0").attr('checked', 'checked');
1324
  }
1325
  else {
1326
- jQuery("#album_ecommerce_icon_show_hover_2").attr('checked', 'checked');
1327
  }
1328
  break;
1329
  }
@@ -1333,19 +1333,19 @@ class ShortcodeView_bwg extends AdminView_bwg {
1333
  jQuery("#album_masonry_image_column_number").val(short_code['masonry_album_image_column_number']);
1334
  jQuery("#album_masonry_image_thumb_width").val(short_code['masonry_album_image_thumb_width']);
1335
  if (short_code['masonry_album_enable_page']) {
1336
- jQuery("#album_masonry_enable_page_" + short_code['masonry_album_enable_page']).attr('checked', 'checked');
1337
  }
1338
  jQuery("#albums_masonry_per_page").val(short_code['masonry_albums_per_page']);
1339
  jQuery("#album_masonry_images_per_page").val(short_code['masonry_album_images_per_page']);
1340
- jQuery("select[id=masonry_album_sort_by] option[value='" + short_code['all_album_sort_by'] + "']").attr('selected', 'selected');
1341
- jQuery("select[id=masonry_album_order_by] option[value='" + short_code['all_album_order_by'] + "']").attr('selected', 'selected');
1342
- jQuery("select[id=album_masonry_sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
1343
- jQuery("select[id=album_masonry_order_by] option[value='" + short_code['order_by'] + "']").attr('selected', 'selected');
1344
  if (short_code['show_search_box'] == 1) {
1345
- jQuery("#album_masonry_show_search_box_1").attr('checked', 'checked');
1346
  }
1347
  else {
1348
- jQuery("#album_masonry_show_search_box_0").attr('checked', 'checked');
1349
  }
1350
  if (short_code['placeholder']) {
1351
  jQuery("#album_masonry_placeholder").val(short_code['placeholder']);
@@ -1354,66 +1354,66 @@ class ShortcodeView_bwg extends AdminView_bwg {
1354
  jQuery("#album_masonry_search_box_width").val(short_code['search_box_width']);
1355
  }
1356
  if (short_code['show_sort_images'] == 1) {
1357
- jQuery("#album_masonry_show_sort_images_1").attr('checked', 'checked');
1358
  }
1359
  else {
1360
- jQuery("#album_masonry_show_sort_images_0").attr('checked', 'checked');
1361
  }
1362
  if (short_code['show_tag_box'] == 1) {
1363
- jQuery("#album_masonry_show_tag_box_1").attr('checked', 'checked');
1364
  }
1365
  else {
1366
- jQuery("#album_masonry_show_tag_box_0").attr('checked', 'checked');
1367
  }
1368
  if (short_code['show_album_name'] == 1) {
1369
- jQuery("#show_album_masonry_name_enable_1").attr('checked', 'checked');
1370
  }
1371
  else {
1372
- jQuery("#show_album_masonry_name_enable_0").attr('checked', 'checked');
1373
  }
1374
  if (short_code['show_gallery_description'] == 1) {
1375
- jQuery("#album_masonry_show_gallery_description_1").attr('checked', 'checked');
1376
  }
1377
  else {
1378
- jQuery("#album_masonry_show_gallery_description_0").attr('checked', 'checked');
1379
  }
1380
- jQuery("input[name='album_masonry_image_title'][value='" + short_code['image_title'] + "']").attr('checked', 'checked');
1381
  if (short_code['gallery_download'] == 1) {
1382
- jQuery("#album_masonry_gallery_download_1").attr('checked', 'checked');
1383
  }
1384
  else {
1385
- jQuery("#album_masonry_gallery_download_0").attr('checked', 'checked');
1386
  }
1387
  if (short_code['ecommerce_icon'] == 'hover') {
1388
- jQuery("#album_masonry_ecommerce_icon_show_hover_1").attr('checked', 'checked');
1389
  }
1390
  else {
1391
- jQuery("#album_masonry_ecommerce_icon_show_hover_2").attr('checked', 'checked');
1392
  }
1393
  break;
1394
  }
1395
  case 'album_extended_preview': {
1396
  jQuery("#extended_album_height").val(short_code['extended_album_height']);
1397
- jQuery("#extended_album_column_number_" + short_code['extended_album_column_number']).attr('checked', 'checked');
1398
  jQuery("#album_extended_thumb_width").val(short_code['extended_album_thumb_width']);
1399
  jQuery("#album_extended_thumb_height").val(short_code['extended_album_thumb_height']);
1400
  jQuery("#album_extended_image_column_number").val(short_code['extended_album_image_column_number']);
1401
  jQuery("#album_extended_image_thumb_width").val(short_code['extended_album_image_thumb_width']);
1402
  jQuery("#album_extended_image_thumb_height").val(short_code['extended_album_image_thumb_height']);
1403
  if (short_code['extended_album_enable_page']) {
1404
- jQuery("#album_extended_enable_page_" + short_code['extended_album_enable_page']).attr('checked', 'checked');
1405
  }
1406
  jQuery("#albums_extended_per_page").val(short_code['extended_albums_per_page']);
1407
  jQuery("#album_extended_images_per_page").val(short_code['extended_album_images_per_page']);
1408
- jQuery("select[id=extended_album_sort_by] option[value='" + short_code['all_album_sort_by'] + "']").attr('selected', 'selected');
1409
- jQuery("select[id=extended_album_order_by] option[value='" + short_code['all_album_order_by'] + "']").attr('selected', 'selected');
1410
- jQuery("select[id=album_extended_sort_by] option[value='" + short_code['sort_by'] + "']").attr('selected', 'selected');
1411
- jQuery("select[id=album_extended_order_by] option[value='" + short_code['order_by'] + "']").attr('selected', 'selected');
1412
  if (short_code['show_search_box'] == 1) {
1413
- jQuery("#album_extended_show_search_box_1").attr('checked', 'checked');
1414
  }
1415
  else {
1416
- jQuery("#album_extended_show_search_box_0").attr('checked', 'checked');
1417
  }
1418
  if (short_code['placeholder']) {
1419
  jQuery("#album_extended_placeholder").val(short_code['placeholder']);
@@ -1422,97 +1422,97 @@ class ShortcodeView_bwg extends AdminView_bwg {
1422
  jQuery("#album_extended_search_box_width").val(short_code['search_box_width']);
1423
  }
1424
  if (short_code['show_sort_images'] == 1) {
1425
- jQuery("#album_extended_show_sort_images_1").attr('checked', 'checked');
1426
  }
1427
  else {
1428
- jQuery("#album_extended_show_sort_images_0").attr('checked', 'checked');
1429
  }
1430
  if (short_code['show_tag_box'] == 1) {
1431
- jQuery("#album_extended_show_tag_box_1").attr('checked', 'checked');
1432
  }
1433
  else {
1434
- jQuery("#album_extended_show_tag_box_0").attr('checked', 'checked');
1435
  }
1436
  if (short_code['show_album_name'] == 1) {
1437
- jQuery("#show_album_extended_name_enable_1").attr('checked', 'checked');
1438
  }
1439
  else {
1440
- jQuery("#show_album_extended_name_enable_0").attr('checked', 'checked');
1441
  }
1442
  if (short_code['extended_album_description_enable'] == 1) {
1443
- jQuery("#extended_album_description_enable_1").attr('checked', 'checked');
1444
  }
1445
  else {
1446
- jQuery("#extended_album_description_enable_0").attr('checked', 'checked');
1447
  }
1448
  if (short_code['show_gallery_description'] == 1) {
1449
- jQuery("#album_extended_show_gallery_description_1").attr('checked', 'checked');
1450
  }
1451
  else {
1452
- jQuery("#album_extended_show_gallery_description_0").attr('checked', 'checked');
1453
  }
1454
  jQuery('#album_extended_view_type').find('option').removeAttr("selected");
1455
- jQuery("#album_extended_view_type option[value='"+ short_code['extended_album_view_type'] +"']").attr('selected', 'selected');
1456
- jQuery("input[name='album_extended_image_title_show_hover'][value='" + short_code['extended_album_image_title'] + "']").attr('checked', 'checked');
1457
  if (short_code['extended_album_mosaic_hor_ver'] == "vertical") {
1458
- jQuery("#album_extended_mosaic_0").attr('checked', 'checked');
1459
  }
1460
  else {
1461
- jQuery("#album_extended_mosaic_1").attr('checked', 'checked');
1462
  }
1463
  if (short_code['extended_album_resizable_mosaic'] == 1) {
1464
- jQuery("#album_extended_resizable_mosaic_1").attr('checked', 'checked');
1465
  }
1466
  else {
1467
- jQuery("#album_extended_resizable_mosaic_0").attr('checked', 'checked');
1468
  }
1469
  jQuery("#album_extended_mosaic_total_width").val(short_code['extended_album_mosaic_total_width']);
1470
  if (short_code['play_icon'] == 1) {
1471
- jQuery("#album_extended_play_icon_yes").attr('checked', 'checked');
1472
  }
1473
  else {
1474
- jQuery("#album_extended_play_icon_no").attr('checked', 'checked');
1475
  }
1476
  if (short_code['gallery_download'] == 1) {
1477
- jQuery("#album_extended_gallery_download_1").attr('checked', 'checked');
1478
  }
1479
  else {
1480
- jQuery("#album_extended_gallery_download_0").attr('checked', 'checked');
1481
  }
1482
  if (short_code['ecommerce_icon'] == 'hover') {
1483
- jQuery("#album_extended_ecommerce_icon_show_hover_1").attr('checked', 'checked');
1484
  }
1485
  else if (short_code['ecommerce_icon'] == 'show') {
1486
- jQuery("#album_extended_ecommerce_icon_show_hover_0").attr('checked', 'checked');
1487
  }
1488
  else {
1489
- jQuery("#album_extended_ecommerce_icon_show_hover_2").attr('checked', 'checked');
1490
  }
1491
  break;
1492
  }
1493
  }
1494
  // Lightbox.
1495
  if (!short_code['thumb_click_action'] || short_code['thumb_click_action'] == 'undefined' || short_code['thumb_click_action'] == 'do_nothing') {
1496
- jQuery("#thumb_click_action_3").attr('checked', 'checked');
1497
  }
1498
  else if (short_code['thumb_click_action'] == 'redirect_to_url') {
1499
- jQuery("#thumb_click_action_2").attr('checked', 'checked');
1500
  }
1501
  else if (short_code['thumb_click_action'] == 'open_lightbox') {
1502
- jQuery("#thumb_click_action_1").attr('checked', 'checked');
1503
  }
1504
  if (short_code['thumb_link_target'] == 1 || !short_code['thumb_link_target'] || short_code['thumb_link_target'] == 'undefined') {
1505
- jQuery("#thumb_link_target_yes").attr('checked', 'checked');
1506
  }
1507
  else {
1508
- jQuery("#thumb_link_target_no").attr('checked', 'checked');
1509
  }
1510
  if (short_code['popup_fullscreen'] != undefined) {
1511
  if (short_code['popup_fullscreen'] == 1) {
1512
- jQuery("#popup_fullscreen_1").attr('checked', 'checked');
1513
  }
1514
  else {
1515
- jQuery("#popup_fullscreen_0").attr('checked', 'checked');
1516
  }
1517
  }
1518
  if (short_code['popup_width'] != undefined) {
@@ -1522,17 +1522,17 @@ class ShortcodeView_bwg extends AdminView_bwg {
1522
  jQuery("#popup_height").val(short_code['popup_height']);
1523
  }
1524
  if (short_code['popup_effect'] != undefined) {
1525
- jQuery("select[id=popup_type] option[value='" + short_code['popup_effect'] + "']").attr('selected', 'selected');
1526
  }
1527
  if (short_code['popup_effect_duration'] != undefined) {
1528
  jQuery("#popup_effect_duration").val(short_code['popup_effect_duration']);
1529
  }
1530
  if (short_code['popup_autoplay'] != undefined) {
1531
  if (short_code['popup_autoplay'] == 1) {
1532
- jQuery("#popup_autoplay_1").attr('checked', 'checked');
1533
  }
1534
  else {
1535
- jQuery("#popup_autoplay_0").attr('checked', 'checked');
1536
  }
1537
  }
1538
  if (short_code['popup_interval'] != undefined) {
@@ -1540,185 +1540,185 @@ class ShortcodeView_bwg extends AdminView_bwg {
1540
  }
1541
  if (short_code['popup_enable_filmstrip'] != undefined) {
1542
  if (short_code['popup_enable_filmstrip'] == 1) {
1543
- jQuery("#popup_enable_filmstrip_1").attr('checked', 'checked');
1544
  }
1545
  else {
1546
- jQuery("#popup_enable_filmstrip_0").attr('checked', 'checked');
1547
  }
1548
  jQuery("#popup_filmstrip_height").val(short_code['popup_filmstrip_height']);
1549
  }
1550
  if (short_code['popup_enable_ctrl_btn'] != undefined) {
1551
  if (short_code['popup_enable_ctrl_btn'] == 1) {
1552
- jQuery("#popup_enable_ctrl_btn_1").attr('checked', 'checked');
1553
  bwg_enable_disable('', 'tbody_popup_ctrl_btn1', 'popup_ctrl_btn_1');
1554
  bwg_enable_disable('', 'tbody_popup_ctrl_btn2', 'popup_ctrl_btn_1');
1555
  if (short_code['popup_enable_fullscreen'] == 1) {
1556
- jQuery("#popup_enable_fullscreen_1").attr('checked', 'checked');
1557
  }
1558
  else {
1559
- jQuery("#popup_enable_fullscreen_0").attr('checked', 'checked');
1560
  }
1561
  if (short_code['popup_enable_comment'] == 1) {
1562
- jQuery("#popup_enable_comment_1").attr('checked', 'checked');
1563
  }
1564
  else {
1565
- jQuery("#popup_enable_comment_0").attr('checked', 'checked');
1566
  }
1567
  if (short_code['popup_enable_email'] == 1) {
1568
- jQuery("#popup_enable_email_1").attr('checked', 'checked');
1569
  }
1570
  else {
1571
- jQuery("#popup_enable_email_0").attr('checked', 'checked');
1572
  }
1573
  if (short_code['popup_enable_captcha'] == 1) {
1574
- jQuery("#popup_enable_captcha_1").attr('checked', 'checked');
1575
  }
1576
  else {
1577
- jQuery("#popup_enable_captcha_0").attr('checked', 'checked');
1578
  }
1579
  if (short_code['comment_moderation'] == 1) {
1580
- jQuery("#comment_moderation_1").attr('checked', 'checked');
1581
  }
1582
  else {
1583
- jQuery("#comment_moderation_0").attr('checked', 'checked');
1584
  }
1585
  if (short_code['popup_enable_info'] == 1 || !short_code['popup_enable_info']) {
1586
- jQuery("#popup_enable_info_1").attr('checked', 'checked');
1587
  }
1588
  else {
1589
- jQuery("#popup_enable_info_0").attr('checked', 'checked');
1590
  }
1591
  if (short_code['popup_info_always_show'] == 1 && short_code['popup_info_always_show']) {
1592
- jQuery("#popup_info_always_show_1").attr('checked', 'checked');
1593
  }
1594
  else {
1595
- jQuery("#popup_info_always_show_0").attr('checked', 'checked');
1596
  }
1597
  if (short_code['popup_info_full_width'] == 1) {
1598
- jQuery("#popup_info_full_width_1").attr('checked', 'checked');
1599
  }
1600
  else {
1601
- jQuery("#popup_info_full_width_0").attr('checked', 'checked');
1602
  }
1603
  if (short_code['autohide_lightbox_navigation'] == 1) {
1604
- jQuery("#autohide_lightbox_navigation_1").attr('checked', 'checked');
1605
  }
1606
  else {
1607
- jQuery("#autohide_lightbox_navigation_0").attr('checked', 'checked');
1608
  }
1609
  if (short_code['popup_hit_counter'] == 1 && short_code['popup_hit_counter']) {
1610
- jQuery("#popup_hit_counter_1").attr('checked', 'checked');
1611
  }
1612
  else {
1613
- jQuery("#popup_hit_counter_0").attr('checked', 'checked');
1614
  }
1615
  if (short_code['popup_enable_rate'] == 1 && short_code['popup_enable_rate']) {
1616
- jQuery("#popup_enable_rate_1").attr('checked', 'checked');
1617
  }
1618
  else {
1619
- jQuery("#popup_enable_rate_0").attr('checked', 'checked');
1620
  }
1621
  if (short_code['popup_enable_fullsize_image'] == 1) {
1622
- jQuery("#popup_enable_fullsize_image_1").attr('checked', 'checked');
1623
  }
1624
  else {
1625
- jQuery("#popup_enable_fullsize_image_0").attr('checked', 'checked');
1626
  }
1627
  if (short_code['popup_enable_download'] == 1) {
1628
- jQuery("#popup_enable_download_1").attr('checked', 'checked');
1629
  }
1630
  else {
1631
- jQuery("#popup_enable_download_0").attr('checked', 'checked');
1632
  }
1633
  if (short_code['show_image_counts'] == 1) {
1634
- jQuery("#show_image_counts_current_image_number_1").attr('checked', 'checked');
1635
  }
1636
  else {
1637
- jQuery("#show_image_counts_current_image_number_0").attr('checked', 'checked');
1638
  }
1639
  if (short_code['enable_loop'] == 1) {
1640
- jQuery("#enable_loop_1").attr('checked', 'checked');
1641
  }
1642
  else {
1643
- jQuery("#enable_loop_0").attr('checked', 'checked');
1644
  }
1645
  if (short_code['enable_addthis'] == 1) {
1646
- jQuery("#enable_addthis_1").attr('checked', 'checked');
1647
  }
1648
  else {
1649
- jQuery("#enable_addthis_0").attr('checked', 'checked');
1650
  }
1651
  if (short_code['addthis_profile_id'] != 'undefined') {
1652
  jQuery("#addthis_profile_id").val(short_code['addthis_profile_id']);
1653
  }
1654
  if (short_code['popup_enable_facebook'] == 1) {
1655
- jQuery("#popup_enable_facebook_1").attr('checked', 'checked');
1656
  }
1657
  else {
1658
- jQuery("#popup_enable_facebook_0").attr('checked', 'checked');
1659
  }
1660
  if (short_code['popup_enable_twitter'] == 1) {
1661
- jQuery("#popup_enable_twitter_1").attr('checked', 'checked');
1662
  }
1663
  else {
1664
- jQuery("#popup_enable_twitter_0").attr('checked', 'checked');
1665
  }
1666
  if (short_code['popup_enable_pinterest'] == 1) {
1667
- jQuery("#popup_enable_pinterest_1").attr('checked', 'checked');
1668
  }
1669
  else {
1670
- jQuery("#popup_enable_pinterest_0").attr('checked', 'checked');
1671
  }
1672
  if (short_code['popup_enable_tumblr'] == 1) {
1673
- jQuery("#popup_enable_tumblr_1").attr('checked', 'checked');
1674
  }
1675
  else {
1676
- jQuery("#popup_enable_tumblr_0").attr('checked', 'checked');
1677
  }
1678
  if (short_code['popup_enable_ecommerce'] == 1) {
1679
- jQuery("#popup_ecommerce_1").attr('checked', 'checked');
1680
  }
1681
  else {
1682
- jQuery("#popup_ecommerce_0").attr('checked', 'checked');
1683
  }
1684
  }
1685
  else {
1686
- jQuery("#popup_enable_ctrl_btn_0").attr('checked', 'checked');
1687
  }
1688
  }
1689
  bwg_lightbox_hide_show_params();
1690
  // Watermark.
1691
  if (short_code['watermark_type'] == 'text') {
1692
- jQuery("#watermark_type_text").attr('checked', 'checked');
1693
  jQuery("#watermark_link").val(decodeURIComponent(short_code['watermark_link']));
1694
  jQuery("#watermark_text").val(short_code['watermark_text']);
1695
  jQuery("#watermark_font_size").val(short_code['watermark_font_size']);
1696
  if (in_array(short_code['watermark_font'], bwg_objectGGF)) {
1697
- jQuery("#watermark_google_fonts1").attr('checked', 'checked');
1698
  bwg_change_fonts('watermark_font', 'watermark_google_fonts1');
1699
  }
1700
  else {
1701
- jQuery("#watermark_google_fonts0").attr('checked', 'checked');
1702
  bwg_change_fonts('watermark_font', '');
1703
  }
1704
- jQuery("select[id=watermark_font] option[value='" + short_code['watermark_font'] + "']").attr('selected', 'selected');
1705
  jQuery("#watermark_color").val(short_code['watermark_color']);
1706
  jQuery("#watermark_opacity").val(short_code['watermark_opacity']);
1707
- jQuery("#watermark_type_text").attr('checked', 'checked');
1708
- jQuery("#watermark_" + short_code['watermark_position']).attr('checked', 'checked');
1709
  }
1710
  else if (short_code['watermark_type'] == 'image') {
1711
- jQuery("#watermark_type_image").attr('checked', 'checked');
1712
  jQuery("#watermark_link").val(decodeURIComponent(short_code['watermark_link']));
1713
  jQuery("#watermark_url").val(short_code['watermark_url']);
1714
  jQuery("#watermark_width").val(short_code['watermark_width']);
1715
  jQuery("#watermark_height").val(short_code['watermark_height']);
1716
  jQuery("#watermark_opacity").val(short_code['watermark_opacity']);
1717
- jQuery("#watermark_type_image").attr('checked', 'checked');
1718
- jQuery("#watermark_" + short_code['watermark_position']).attr('checked', 'checked');
1719
  }
1720
  else {
1721
- jQuery("#watermark_type_none").attr('checked', 'checked');
1722
  }
1723
  bwg_watermark('watermark_type_' + short_code['watermark_type']);
1724
  }
@@ -2241,7 +2241,7 @@ class ShortcodeView_bwg extends AdminView_bwg {
2241
  }
2242
  return false;
2243
  }
2244
- jQuery(document).ready(function () {
2245
  bwg_shortcode_hide_show_params();
2246
  bwg_change_tab();
2247
  });
661
  content = jQuery("#bwg_shortcode").val();
662
  <?php } ?>
663
  jQuery('#insert').attr('onclick', "jQuery('#loading_div').show(); bwg_insert_shortcode(content);");
664
+ jQuery("select[id=theme] option[value='" + short_code['theme_id'] + "']").prop('selected', true);
665
+ jQuery("select[id=gallery_types_name] option[value='" + short_code['gallery_type'] + "']").prop('selected', true);
666
  jQuery("#use_option_defaults").prop('checked', true).trigger('change');
667
  if (short_code['type'] == 'album' || short_code['gallery_type'] == 'album_compact_preview' || short_code['gallery_type'] == 'album_masonry_preview' || short_code['gallery_type'] == 'album_extended_preview') {
668
  short_code['type'] = 'album';
672
  short_code['type'] = 'gallery';
673
  jQuery(".bwg_tabs").tabs({active: 0});
674
  }
675
+ jQuery("select[id=gallery] option[value='" + short_code['gallery_id'] + "']").prop('selected', true);
676
+ jQuery("select[id=album] option[value='" + short_code['album_id'] + "']").prop('selected', true);
677
+ jQuery("select[id=tag] option[value='" + short_code['tag'] + "']").prop('selected', true);
678
  bwg_gallery_type(short_code['gallery_type']);
679
  if (short_code['use_option_defaults'] != 1) {
680
  jQuery("#use_option_defaults").prop('checked', false).trigger('change');
685
  jQuery("#thumb_height").val(short_code['thumb_height']);
686
  jQuery("#image_column_number").val(short_code['image_column_number']);
687
  if (short_code['image_enable_page'] == 1) {
688
+ jQuery("#image_enable_page_1").prop('checked', true);
689
  }
690
  else if (short_code['image_enable_page'] == 0) {
691
+ jQuery("#image_enable_page_0").prop('checked', true);
692
  }
693
  else if (short_code['image_enable_page'] == 2) {
694
+ jQuery("#image_enable_page_2").prop('checked', true);
695
  }
696
  else if (short_code['image_enable_page'] == 3) {
697
+ jQuery("#image_enable_page_3").prop('checked', true);
698
  }
699
  jQuery("#images_per_page").val(short_code['images_per_page']);
700
  jQuery("#load_more_image_count").val(short_code['load_more_image_count']);
701
+ jQuery("select[id=sort_by] option[value='" + short_code['sort_by'] + "']").prop('selected', true);
702
+ jQuery("select[id=order_by] option[value='" + short_code['order_by'] + "']").prop('selected', true);
703
  if (short_code['show_search_box'] == 1) {
704
+ jQuery("#show_search_box_1").prop('checked', true);
705
  }
706
  else {
707
+ jQuery("#show_search_box_0").prop('checked', true);
708
  }
709
  if (short_code['placeholder']) {
710
  jQuery("#placeholder").val(short_code['placeholder']);
713
  jQuery("#search_box_width").val(short_code['search_box_width']);
714
  }
715
  if (short_code['show_sort_images'] == 1) {
716
+ jQuery("#show_sort_images_1").prop('checked', true);
717
  }
718
  else {
719
+ jQuery("#show_sort_images_0").prop('checked', true);
720
  }
721
  if (short_code['show_tag_box'] == 1) {
722
+ jQuery("#show_tag_box_1").prop('checked', true);
723
  }
724
  else {
725
+ jQuery("#show_tag_box_0").prop('checked', true);
726
  }
727
  if (short_code['showthumbs_name'] == 1) {
728
+ jQuery("#thumb_name_yes").prop('checked', true);
729
  }
730
  else {
731
+ jQuery("#thumb_name_no").prop('checked', true);
732
  }
733
  if (short_code['show_gallery_description'] == 1) {
734
+ jQuery("#show_gallery_description_1").prop('checked', true);
735
  }
736
  else {
737
+ jQuery("#show_gallery_description_0").prop('checked', true);
738
  }
739
  if (short_code['image_title'] == 'hover') {
740
+ jQuery("#image_title_show_hover_1").prop('checked', true);
741
  }
742
  else if (short_code['image_title'] == 'show') {
743
+ jQuery("#image_title_show_hover_0").prop('checked', true);
744
  }
745
  else {
746
+ jQuery("#image_title_show_hover_2").prop('checked', true);
747
  }
748
  if( short_code['show_thumb_description'] == 1 ) {
749
+ jQuery("#thumb_desc_1").prop('checked', true);
750
  }
751
  else {
752
+ jQuery("#thumb_desc_0").prop('checked', true);
753
  }
754
  if (short_code['play_icon'] == 1) {
755
+ jQuery("#play_icon_yes").prop('checked', true);
756
  }
757
  else {
758
+ jQuery("#play_icon_no").prop('checked', true);
759
  }
760
  if (short_code['gallery_download'] == 1) {
761
+ jQuery("#gallery_download_1").prop('checked', true);
762
  }
763
  else {
764
+ jQuery("#gallery_download_0").prop('checked', true);
765
  }
766
  if (short_code['ecommerce_icon'] == 'hover') {
767
+ jQuery("#ecommerce_icon_show_hover_1").prop('checked', true);
768
  }
769
  else if (short_code['ecommerce_icon'] == 'show') {
770
+ jQuery("#ecommerce_icon_show_hover_0").prop('checked', true);
771
  }
772
  else {
773
+ jQuery("#ecommerce_icon_show_hover_2").prop('checked', true);
774
  }
775
  break;
776
  }
777
  case 'thumbnails_masonry': {
778
  if (short_code['masonry_hor_ver'] == 'horizontal') {
779
  jQuery("#masonry_0").prop('checked', false).removeAttr('checked');
780
+ jQuery("#masonry_1").prop('checked', true);
781
  jQuery("#masonry_thumb_size").val(short_code['thumb_height']);
782
  jQuery('.masonry_col_num').hide();
783
  jQuery('.masonry_row_num').show();
784
  }
785
  else {
786
+ jQuery("#masonry_0").prop('checked', true);
787
  jQuery("#masonry_thumb_size").val(short_code['thumb_width']);
788
  jQuery('.masonry_row_num').hide();
789
  jQuery('.masonry_col_num').show();
790
  }
791
  if (short_code['image_title'] == 'hover') {
792
+ jQuery("#masonry_image_title_0").prop('checked', true);
793
  }
794
  else if (short_code['image_title'] == 'show') {
795
+ jQuery("#masonry_image_title_1").prop('checked', true);
796
  }
797
  else {
798
+ jQuery("#masonry_image_title_2").prop('checked', true);
799
  }
800
  if (short_code['show_masonry_thumb_description'] == 1) {
801
+ jQuery("#masonry_thumb_desc_1").prop('checked', true);
802
  }
803
  else {
804
+ jQuery("#masonry_thumb_desc_0").prop('checked', true);
805
  }
806
  jQuery("#masonry_image_column_number").val(short_code['image_column_number']);
807
  if (short_code['image_enable_page'] == 1) {
808
+ jQuery("#masonry_image_enable_page_1").prop('checked', true);
809
  }
810
  else if (short_code['image_enable_page'] == 0) {
811
+ jQuery("#masonry_image_enable_page_0").prop('checked', true);
812
  }
813
  else if (short_code['image_enable_page'] == 2) {
814
+ jQuery("#masonry_image_enable_page_2").prop('checked', true);
815
  }
816
  else if (short_code['image_enable_page'] == 3) {
817
+ jQuery("#masonry_image_enable_page_3").prop('checked', true);
818
  }
819
  jQuery("#masonry_images_per_page").val(short_code['images_per_page']);
820
  jQuery("#masonry_load_more_image_count").val(short_code['load_more_image_count']);
821
+ jQuery("select[id=masonry_sort_by] option[value='" + short_code['sort_by'] + "']").prop('selected', true);
822
+ jQuery("select[id=masonry_order_by] option[value='" + short_code['order_by'] + "']").prop('selected', true);
823
  if (short_code['show_search_box'] == 1) {
824
+ jQuery("#masonry_show_search_box_1").prop('checked', true);
825
  }
826
  else {
827
+ jQuery("#masonry_show_search_box_0").prop('checked', true);
828
  }
829
  if (short_code['placeholder']) {
830
  jQuery("#masonry_placeholder").val(short_code['placeholder']);
833
  jQuery("#masonry_search_box_width").val(short_code['search_box_width']);
834
  }
835
  else if (short_code['image_enable_page'] == 2) {
836
+ jQuery("#masonry_image_page_loadmore").prop('checked', true);
837
  }
838
  if (short_code['show_sort_images'] == 1) {
839
+ jQuery("#masonry_show_sort_images_1").prop('checked', true);
840
  }
841
  else {
842
+ jQuery("#masonry_show_sort_images_0").prop('checked', true);
843
  }
844
  if (short_code['show_tag_box'] == 1) {
845
+ jQuery("#masonry_show_tag_box_1").prop('checked', true);
846
  }
847
  else {
848
+ jQuery("#masonry_show_tag_box_0").prop('checked', true);
849
  }
850
  if (short_code['showthumbs_name'] == 1) {
851
+ jQuery("#masonry_thumb_name_yes").prop('checked', true);
852
  }
853
  else {
854
+ jQuery("#masonry_thumb_name_no").prop('checked', true);
855
  }
856
  if (short_code['show_gallery_description'] == 1) {
857
+ jQuery("#masonry_show_gallery_description_1").prop('checked', true);
858
  }
859
  else {
860
+ jQuery("#masonry_show_gallery_description_0").prop('checked', true);
861
  }
862
  if (short_code['play_icon'] == 1) {
863
+ jQuery("#masonry_play_icon_yes").prop('checked', true);
864
  }
865
  else {
866
+ jQuery("#masonry_play_icon_no").prop('checked', true);
867
  }
868
  if (short_code['gallery_download'] == 1) {
869
+ jQuery("#masonry_gallery_download_1").prop('checked', true);
870
  }
871
  else {
872
+ jQuery("#masonry_gallery_download_0").prop('checked', true);
873
  }
874
  if (short_code['ecommerce_icon'] == 'hover') {
875
+ jQuery("#masonry_ecommerce_icon_show_hover_1").prop('checked', true);
876
  }
877
  else {
878
+ jQuery("#masonry_ecommerce_icon_show_hover_2").prop('checked', true);
879
  }
880
  break;
881
  }
882
  case 'thumbnails_mosaic': {
883
  if (short_code['mosaic_hor_ver'] == 'horizontal') {
884
+ jQuery("#mosaic_1").prop('checked', true);
885
  jQuery("#mosaic_thumb_size").val(short_code['thumb_height']);
886
  }
887
  else {
888
+ jQuery("#mosaic_0").prop('checked', true);
889
  jQuery("#mosaic_thumb_size").val(short_code['thumb_width']);
890
  }
891
  if (short_code['resizable_mosaic'] == 1) {
892
+ jQuery("#resizable_mosaic_1").prop('checked', true);
893
  }
894
  else {
895
+ jQuery("#resizable_mosaic_0").prop('checked', true);
896
  }
897
  jQuery("#mosaic_total_width").val(short_code['mosaic_total_width']);
898
  if (short_code['image_enable_page'] == 1) {
899
+ jQuery("#mosaic_image_enable_page_1").prop('checked', true);
900
  }
901
  else if (short_code['image_enable_page'] == 0) {
902
+ jQuery("#mosaic_image_enable_page_0").prop('checked', true);
903
  }
904
  else if (short_code['image_enable_page'] == 2) {
905
+ jQuery("#mosaic_image_enable_page_2").prop('checked', true);
906
  }
907
  else if (short_code['image_enable_page'] == 3) {
908
+ jQuery("#mosaic_image_enable_page_3").prop('checked', true);
909
  }
910
  jQuery("#mosaic_images_per_page").val(short_code['images_per_page']);
911
  jQuery("#mosaic_load_more_image_count").val(short_code['load_more_image_count']);
912
+ jQuery("select[id=mosaic_sort_by] option[value='" + short_code['sort_by'] + "']").prop('selected', true);
913
+ jQuery("select[id=mosaic_order_by] option[value='" + short_code['order_by'] + "']").prop('selected', true);
914
  if (short_code['show_search_box'] == 1) {
915
+ jQuery("#mosaic_show_search_box_1").prop('checked', true);
916
  }
917
  else {
918
+ jQuery("#mosaic_show_search_box_0").prop('checked', true);
919
  }
920
  if (short_code['placeholder']) {
921
  jQuery("#mosaic_placeholder").val(short_code['placeholder']);
924
  jQuery("#mosaic_search_box_width").val(short_code['search_box_width']);
925
  }
926
  if (short_code['show_sort_images'] == 1) {
927
+ jQuery("#mosaic_show_sort_images_1").prop('checked', true);
928
  }
929
  else {
930
+ jQuery("#mosaic_show_sort_images_0").prop('checked', true);
931
  }
932
  if (short_code['show_tag_box'] == 1) {
933
+ jQuery("#mosaic_show_tag_box_1").prop('checked', true);
934
  }
935
  else {
936
+ jQuery("#mosaic_show_tag_box_0").prop('checked', true);
937
  }
938
  if (short_code['showthumbs_name'] == 1) {
939
+ jQuery("#mosaic_thumb_name_yes").prop('checked', true);
940
  }
941
  else {
942
+ jQuery("#mosaic_thumb_name_no").prop('checked', true);
943
  }
944
  if (short_code['show_gallery_description'] == 1) {
945
+ jQuery("#mosaic_show_gallery_description_1").prop('checked', true);
946
  }
947
  else {
948
+ jQuery("#mosaic_show_gallery_description_0").prop('checked', true);
949
  }
950
  if (short_code['image_title'] == 'hover') {
951
+ jQuery("#mosaic_image_title_show_hover_1").prop('checked', true);
952
  }
953
  else {
954
+ jQuery("#mosaic_image_title_show_hover_0").prop('checked', true);
955
  }
956
  if (short_code['play_icon'] == 1) {
957
+ jQuery("#mosaic_play_icon_yes").prop('checked', true);
958
  }
959
  else {
960
+ jQuery("#mosaic_play_icon_no").prop('checked', true);
961
  }
962
  if (short_code['gallery_download'] == 1) {
963
+ jQuery("#mosaic_gallery_download_1").prop('checked', true);
964
  }
965
  else {
966
+ jQuery("#mosaic_gallery_download_0").prop('checked', true);
967
  }
968
  if (short_code['ecommerce_icon'] == 'hover') {
969
+ jQuery("#mosaic_ecommerce_icon_show_hover_1").prop('checked', true);
970
  }
971
  else {
972
+ jQuery("#mosaic_ecommerce_icon_show_hover_2").prop('checked', true);
973
  }
974
  break;
975
  }
976
  case 'slideshow': {
977
+ jQuery("select[id=slideshow_type] option[value='" + short_code['slideshow_effect'] + "']").prop('selected', true);
978
  jQuery("#slideshow_interval").val(short_code['slideshow_interval']);
979
  jQuery("#slideshow_width").val(short_code['slideshow_width']);
980
  jQuery("#slideshow_height").val(short_code['slideshow_height']);
981
+ jQuery("select[id=slideshow_sort_by] option[value='" + short_code['sort_by'] + "']").prop('selected', true);
982
+ jQuery("select[id=slideshow_order_by] option[value='" + short_code['order_by'] + "']").prop('selected', true);
983
  if (short_code['enable_slideshow_autoplay'] == 1) {
984
+ jQuery("#slideshow_enable_autoplay_yes").prop('checked', true);
985
  }
986
  else {
987
+ jQuery("#slideshow_enable_autoplay_no").prop('checked', true);
988
  }
989
  if (short_code['enable_slideshow_shuffle'] == 1) {
990
+ jQuery("#slideshow_enable_shuffle_yes").prop('checked', true);
991
  }
992
  else {
993
+ jQuery("#slideshow_enable_shuffle_no").prop('checked', true);
994
  }
995
  if (short_code['enable_slideshow_ctrl'] == 1) {
996
+ jQuery("#slideshow_enable_ctrl_yes").prop('checked', true);
997
  }
998
  else {
999
+ jQuery("#slideshow_enable_ctrl_no").prop('checked', true);
1000
  }
1001
  if (short_code['autohide_slideshow_navigation'] == 1) {
1002
+ jQuery("#autohide_slideshow_navigation_1").prop('checked', true);
1003
  }
1004
  else {
1005
+ jQuery("#autohide_slideshow_navigation_0").prop('checked', true);
1006
  }
1007
  if (short_code['enable_slideshow_filmstrip'] == 1) {
1008
+ jQuery("#slideshow_enable_filmstrip_yes").prop('checked', true);
1009
  }
1010
  else {
1011
+ jQuery("#slideshow_enable_filmstrip_no").prop('checked', true);
1012
  }
1013
  if (short_code['slideshow_filmstrip_height']) {
1014
  jQuery( "#slideshow_filmstrip_height" ).val( short_code['slideshow_filmstrip_height'] );
1015
  }
1016
  if (short_code['slideshow_enable_title'] == 1) {
1017
+ jQuery("#slideshow_enable_title_yes").prop('checked', true);
1018
  }
1019
  else {
1020
+ jQuery("#slideshow_enable_title_no").prop('checked', true);
1021
  }
1022
  if (short_code['slideshow_title_position']) {
1023
  jQuery( "input[name=slideshow_title_position][value=" + short_code['slideshow_title_position'] + "]" ).attr( 'checked', 'checked' );
1024
  }
1025
  if (short_code['slideshow_title_full_width']) {
1026
+ jQuery( "#slideshow_title_full_width_" + short_code['slideshow_title_full_width'] ).prop('checked', true);
1027
  }
1028
  if (short_code['slideshow_enable_description'] == 1) {
1029
+ jQuery("#slideshow_enable_description_yes").prop('checked', true);
1030
  }
1031
  else {
1032
+ jQuery("#slideshow_enable_description_no").prop('checked', true);
1033
  }
1034
  if (short_code['slideshow_description_position']) {
1035
+ jQuery("input[name=slideshow_description_position][value=" + short_code['slideshow_description_position'] + "]").prop('checked', true);
1036
  }
1037
  if (short_code['enable_slideshow_music'] == 1) {
1038
+ jQuery("#slideshow_enable_music_yes").prop('checked', true);
1039
  }
1040
  else {
1041
+ jQuery("#slideshow_enable_music_no").prop('checked', true);
1042
  }
1043
  if (short_code['slideshow_music_url']) {
1044
  jQuery("#slideshow_audio_url").val(short_code['slideshow_music_url']);
1045
  }
1046
  jQuery("#slideshow_effect_duration").val(short_code['slideshow_effect_duration']);
1047
  if (short_code['gallery_download'] == 1) {
1048
+ jQuery("#slideshow_gallery_download_1").prop('checked', true);
1049
  }
1050
  else {
1051
+ jQuery("#slideshow_gallery_download_0").prop('checked', true);
1052
  }
1053
  break;
1054
  }
1055
  case 'image_browser': {
1056
  jQuery("#image_browser_width").val(short_code['image_browser_width']);
1057
  if (short_code['image_browser_title_enable']) {
1058
+ jQuery("#image_browser_title_enable_" + short_code['image_browser_title_enable']).prop('checked', true);
1059
  }
1060
  if (short_code['image_browser_description_enable']) {
1061
+ jQuery("#image_browser_description_enable_" + short_code['image_browser_description_enable']).prop('checked', true);
1062
  }
1063
+ jQuery("select[id=image_browser_sort_by] option[value='" + short_code['sort_by'] + "']").prop('selected', true);
1064
+ jQuery("select[id=image_browser_order_by] option[value='" + short_code['order_by'] + "']").prop('selected', true);
1065
  if (short_code['showthumbs_name'] == 1) {
1066
+ jQuery("#image_browser_thumb_name_yes").prop('checked', true);
1067
  }
1068
  else {
1069
+ jQuery("#image_browser_thumb_name_no").prop('checked', true);
1070
  }
1071
  if (short_code['show_gallery_description']) {
1072
+ jQuery("#image_browser_show_gallery_description_" + short_code['show_gallery_description']).prop('checked', true);
1073
  }
1074
  if (short_code['show_search_box']) {
1075
+ jQuery("#image_browser_show_search_box_" + short_code['show_search_box']).prop('checked', true);
1076
  }
1077
  if (short_code['show_sort_images'] == 1) {
1078
+ jQuery("#image_browser_show_sort_images_1").prop('checked', true);
1079
  }
1080
  else {
1081
+ jQuery("#image_browser_show_sort_images_0").prop('checked', true);
1082
  }
1083
  if (short_code['show_tag_box'] == 1) {
1084
+ jQuery("#image_browser_show_tag_box_1").prop('checked', true);
1085
  }
1086
  else {
1087
+ jQuery("#image_browser_show_tag_box_0").prop('checked', true);
1088
  }
1089
 
1090
  if (short_code['placeholder']) {
1094
  jQuery("#image_browser_search_box_width").val(short_code['search_box_width']);
1095
  }
1096
  if (short_code['gallery_download'] == 1) {
1097
+ jQuery("#image_browser_gallery_download_1").prop('checked', true);
1098
  }
1099
  else {
1100
+ jQuery("#image_browser_gallery_download_0").prop('checked', true);
1101
  }
1102
  break;
1103
  }
1104
  case 'blog_style': {
1105
  jQuery("#blog_style_width").val(short_code['blog_style_width']);
1106
  if (short_code['blog_style_title_enable'] == 1) {
1107
+ jQuery("#blog_style_title_enable_1").prop('checked', true);
1108
  }
1109
  else {
1110
+ jQuery("#blog_style_title_enable_0").prop('checked', true);
1111
  }
1112
  jQuery("#blog_style_images_per_page").val(short_code['blog_style_images_per_page']);
1113
  jQuery("#blog_style_load_more_image_count").val(short_code['blog_style_load_more_image_count']);
1114
  if (short_code['blog_style_enable_page'] == 1) {
1115
+ jQuery("#blog_style_enable_page_1").prop('checked', true);
1116
  }
1117
  else if (short_code['blog_style_enable_page'] == 0) {
1118
+ jQuery("#blog_style_enable_page_0").prop('checked', true);
1119
  }
1120
  else if (short_code['blog_style_enable_page'] == 2) {
1121
+ jQuery("#blog_style_enable_page_2").prop('checked', true);
1122
  }
1123
  else if (short_code['blog_style_enable_page'] == 3) {
1124
+ jQuery("#blog_style_enable_page_3").prop('checked', true);
1125
  }
1126
  if (short_code['blog_style_description_enable'] == 1) {
1127
+ jQuery("#blog_style_description_enable_1").prop('checked', true);
1128
  }
1129
  else {
1130
+ jQuery("#blog_style_description_enable_0").prop('checked', true);
1131
  }
1132
+ jQuery("select[id=blog_style_sort_by] option[value='" + short_code['sort_by'] + "']").prop('selected', true);
1133
+ jQuery("select[id=blog_style_order_by] option[value='" + short_code['order_by'] + "']").prop('selected', true);
1134
  if (short_code['showthumbs_name'] == 1) {
1135
+ jQuery("#blog_style_thumb_name_yes").prop('checked', true);
1136
  }
1137
  else {
1138
+ jQuery("#blog_style_thumb_name_no").prop('checked', true);
1139
  }
1140
  if (short_code['show_gallery_description'] == 1) {
1141
+ jQuery("#blog_style_show_gallery_description_1").prop('checked', true);
1142
  }
1143
  else {
1144
+ jQuery("#blog_style_show_gallery_description_0").prop('checked', true);
1145
  }
1146
  if (short_code['show_search_box'] == 1) {
1147
+ jQuery("#blog_style_show_search_box_1").prop('checked', true);
1148
  }
1149
  else {
1150
+ jQuery("#blog_style_show_search_box_0").prop('checked', true);
1151
  }
1152
  if (short_code['placeholder']) {
1153
  jQuery("#blog_style_placeholder").val(short_code['placeholder']);
1156
  jQuery("#blog_style_search_box_width").val(short_code['search_box_width']);
1157
  }
1158
  if (short_code['show_sort_images'] == 1) {
1159
+ jQuery("#blog_style_show_sort_images_1").prop('checked', true);
1160
  }
1161
  else {
1162
+ jQuery("#blog_style_show_sort_images_0").prop('checked', true);
1163
  }
1164
  if (short_code['show_tag_box'] == 1) {
1165
+ jQuery("#blog_style_show_tag_box_1").prop('checked', true);
1166
  }
1167
  else {
1168
+ jQuery("#blog_style_show_tag_box_0").prop('checked', true);
1169
  }
1170
  if (short_code['gallery_download'] == 1) {
1171
+ jQuery("#blog_style_gallery_download_1").prop('checked', true);
1172
  }
1173
  else {
1174
+ jQuery("#blog_style_gallery_download_0").prop('checked', true);
1175
  }
1176
  break;
1177
  }
1182
  jQuery("#carousel_image_column_number").val(short_code['carousel_image_column_number']);
1183
  jQuery("#carousel_image_par").val(short_code['carousel_image_par']);
1184
  if (short_code['enable_carousel_title'] == 1) {
1185
+ jQuery("#carousel_enable_title_yes").prop('checked', true);
1186
  }
1187
  else {
1188
+ jQuery("#carousel_enable_title_no").prop('checked', true);
1189
  }
1190
  if (short_code['enable_carousel_autoplay'] == 1) {
1191
+ jQuery("#carousel_enable_autoplay_yes").prop('checked', true);
1192
  }
1193
  else {
1194
+ jQuery("#carousel_enable_autoplay_no").prop('checked', true);
1195
  }
1196
  jQuery("#carousel_r_width").val(short_code['carousel_r_width']);
1197
  if (short_code['carousel_fit_containerWidth'] == 1) {
1198
+ jQuery("#carousel_fit_containerWidth_yes").prop('checked', true);
1199
  }
1200
  else {
1201
+ jQuery("#carousel_fit_containerWidth_no").prop('checked', true);
1202
  }
1203
  if (short_code['carousel_prev_next_butt'] == 1) {
1204
+ jQuery("#carousel_prev_next_butt_yes").prop('checked', true);
1205
  }
1206
  else {
1207
+ jQuery("#carousel_prev_next_butt_no").prop('checked', true);
1208
  }
1209
  if (short_code['carousel_play_pause_butt'] == 1) {
1210
+ jQuery("#carousel_play_pause_butt_yes").prop('checked', true);
1211
  }
1212
  else {
1213
+ jQuery("#carousel_play_pause_butt_no").prop('checked', true);
1214
  }
1215
+ jQuery("select[id=carousel_sort_by] option[value='" + short_code['sort_by'] + "']").prop('selected', true);
1216
+ jQuery("select[id=carousel_order_by] option[value='" + short_code['order_by'] + "']").prop('selected', true);
1217
  if (short_code['gallery_download'] == 1) {
1218
+ jQuery("#carousel_gallery_download_1").prop('checked', true);
1219
  }
1220
  else {
1221
+ jQuery("#carousel_gallery_download_0").prop('checked', true);
1222
  }
1223
  if (short_code['showthumbs_name'] == 1) {
1224
+ jQuery("#carousel_thumb_name_yes").prop('checked', true);
1225
  }
1226
  else {
1227
+ jQuery("#carousel_thumb_name_no").prop('checked', true);
1228
  }
1229
  if (short_code['show_gallery_description'] == 1) {
1230
+ jQuery("#carousel_show_gallery_description_1").prop('checked', true);
1231
  }
1232
  else {
1233
+ jQuery("#carousel_show_gallery_description_0").prop('checked', true);
1234
  }
1235
  break;
1236
  }
1242
  jQuery("#album_image_thumb_width").val(short_code['compuct_album_image_thumb_width']);
1243
  jQuery("#album_image_thumb_height").val(short_code['compuct_album_image_thumb_height']);
1244
  if (short_code['compuct_album_enable_page']) {
1245
+ jQuery("#album_enable_page_" + short_code['compuct_album_enable_page']).prop('checked', true);
1246
  }
1247
  jQuery("#albums_per_page").val(short_code['compuct_albums_per_page']);
1248
  jQuery("#album_images_per_page").val(short_code['compuct_album_images_per_page']);
1249
+ jQuery("select[id=compact_album_sort_by] option[value='" + short_code['all_album_sort_by'] + "']").prop('selected', true);
1250
+ jQuery("select[id=compact_album_order_by] option[value='" + short_code['all_album_order_by'] + "']").prop('selected', true);
1251
+ jQuery("select[id=album_sort_by] option[value='" + short_code['sort_by'] + "']").prop('selected', true);
1252
+ jQuery("select[id=album_order_by] option[value='" + short_code['order_by'] + "']").prop('selected', true);
1253
 
1254
  if (short_code['show_search_box'] == 1) {
1255
+ jQuery("#album_show_search_box_1").prop('checked', true);
1256
  }
1257
  else {
1258
+ jQuery("#album_show_search_box_0").prop('checked', true);
1259
  }
1260
  if (short_code['placeholder']) {
1261
  jQuery("#album_placeholder").val(short_code['placeholder']);
1264
  jQuery("#album_search_box_width").val(short_code['search_box_width']);
1265
  }
1266
  if (short_code['show_sort_images'] == 1) {
1267
+ jQuery("#album_show_sort_images_1").prop('checked', true);
1268
  }
1269
  else {
1270
+ jQuery("#album_show_sort_images_0").prop('checked', true);
1271
  }
1272
  if (short_code['show_tag_box'] == 1) {
1273
+ jQuery("#album_show_tag_box_1").prop('checked', true);
1274
  }
1275
  else {
1276
+ jQuery("#album_show_tag_box_0").prop('checked', true);
1277
  }
1278
  if (short_code['show_album_name'] == 1) {
1279
+ jQuery("#show_album_name_enable_1").prop('checked', true);
1280
  }
1281
  else {
1282
+ jQuery("#show_album_name_enable_0").prop('checked', true);
1283
  }
1284
  if (short_code['show_gallery_description'] == 1) {
1285
+ jQuery("#album_show_gallery_description_1").prop('checked', true);
1286
  }
1287
  else {
1288
+ jQuery("#album_show_gallery_description_0").prop('checked', true);
1289
  }
1290
+ jQuery("input[name=album_title_show_hover][value=" + short_code['compuct_album_title'] + "]").prop('checked', true);
1291
  jQuery('#album_view_type').find('option').removeAttr("selected");
1292
+ jQuery("#album_view_type option[value='"+ short_code['compuct_album_view_type'] +"']").prop('selected', true);
1293
+ jQuery("input[name='album_image_title_show_hover'][value='" + short_code['compuct_album_image_title'] + "']").prop('checked', true);
1294
  if (short_code['compuct_album_mosaic_hor_ver'] == "vertical") {
1295
+ jQuery("#album_mosaic_0").prop('checked', true);
1296
  }
1297
  else {
1298
+ jQuery("#album_mosaic_1").prop('checked', true);
1299
  }
1300
  if (short_code['compuct_album_resizable_mosaic'] == 1) {
1301
+ jQuery("#album_resizable_mosaic_1").prop('checked', true);
1302
  }
1303
  else {
1304
+ jQuery("#album_resizable_mosaic_0").prop('checked', true);
1305
  }
1306
  jQuery("#album_mosaic_total_width").val(short_code['compuct_album_mosaic_total_width']);
1307
  if (short_code['play_icon'] == 1) {
1308
+ jQuery("#album_play_icon_yes").prop('checked', true);
1309
  }
1310
  else {
1311
+ jQuery("#album_play_icon_no").prop('checked', true);
1312
  }
1313
  if (short_code['gallery_download'] == 1) {
1314
+ jQuery("#album_gallery_download_1").prop('checked', true);
1315
  }
1316
  else {
1317
+ jQuery("#album_gallery_download_0").prop('checked', true);
1318
  }
1319
  if (short_code['ecommerce_icon'] == 'hover') {
1320
+ jQuery("#album_ecommerce_icon_show_hover_1").prop('checked', true);
1321
  }
1322
  else if (short_code['ecommerce_icon'] == 'show') {
1323
+ jQuery("#album_ecommerce_icon_show_hover_0").prop('checked', true);
1324
  }
1325
  else {
1326
+ jQuery("#album_ecommerce_icon_show_hover_2").prop('checked', true);
1327
  }
1328
  break;
1329
  }
1333
  jQuery("#album_masonry_image_column_number").val(short_code['masonry_album_image_column_number']);
1334
  jQuery("#album_masonry_image_thumb_width").val(short_code['masonry_album_image_thumb_width']);
1335
  if (short_code['masonry_album_enable_page']) {
1336
+ jQuery("#album_masonry_enable_page_" + short_code['masonry_album_enable_page']).prop('checked', true);
1337
  }
1338
  jQuery("#albums_masonry_per_page").val(short_code['masonry_albums_per_page']);
1339
  jQuery("#album_masonry_images_per_page").val(short_code['masonry_album_images_per_page']);
1340
+ jQuery("select[id=masonry_album_sort_by] option[value='" + short_code['all_album_sort_by'] + "']").prop('selected', true);
1341
+ jQuery("select[id=masonry_album_order_by] option[value='" + short_code['all_album_order_by'] + "']").prop('selected', true);
1342
+ jQuery("select[id=album_masonry_sort_by] option[value='" + short_code['sort_by'] + "']").prop('selected', true);
1343
+ jQuery("select[id=album_masonry_order_by] option[value='" + short_code['order_by'] + "']").prop('selected', true);
1344
  if (short_code['show_search_box'] == 1) {
1345
+ jQuery("#album_masonry_show_search_box_1").prop('checked', true);
1346
  }
1347
  else {
1348
+ jQuery("#album_masonry_show_search_box_0").prop('checked', true);
1349
  }
1350
  if (short_code['placeholder']) {
1351
  jQuery("#album_masonry_placeholder").val(short_code['placeholder']);
1354
  jQuery("#album_masonry_search_box_width").val(short_code['search_box_width']);
1355
  }
1356
  if (short_code['show_sort_images'] == 1) {
1357
+ jQuery("#album_masonry_show_sort_images_1").prop('checked', true);
1358
  }
1359
  else {
1360
+ jQuery("#album_masonry_show_sort_images_0").prop('checked', true);
1361
  }
1362
  if (short_code['show_tag_box'] == 1) {
1363
+ jQuery("#album_masonry_show_tag_box_1").prop('checked', true);
1364
  }
1365
  else {
1366
+ jQuery("#album_masonry_show_tag_box_0").prop('checked', true);
1367
  }
1368
  if (short_code['show_album_name'] == 1) {
1369
+ jQuery("#show_album_masonry_name_enable_1").prop('checked', true);
1370
  }
1371
  else {
1372
+ jQuery("#show_album_masonry_name_enable_0").prop('checked', true);
1373
  }
1374
  if (short_code['show_gallery_description'] == 1) {
1375
+ jQuery("#album_masonry_show_gallery_description_1").prop('checked', true);
1376
  }
1377
  else {
1378
+ jQuery("#album_masonry_show_gallery_description_0").prop('checked', true);
1379
  }
1380
+ jQuery("input[name='album_masonry_image_title'][value='" + short_code['image_title'] + "']").prop('checked', true);
1381
  if (short_code['gallery_download'] == 1) {
1382
+ jQuery("#album_masonry_gallery_download_1").prop('checked', true);
1383
  }
1384
  else {
1385
+ jQuery("#album_masonry_gallery_download_0").prop('checked', true);
1386
  }
1387
  if (short_code['ecommerce_icon'] == 'hover') {
1388
+ jQuery("#album_masonry_ecommerce_icon_show_hover_1").prop('checked', true);
1389
  }
1390
  else {
1391
+ jQuery("#album_masonry_ecommerce_icon_show_hover_2").prop('checked', true);
1392
  }
1393
  break;
1394
  }
1395
  case 'album_extended_preview': {
1396
  jQuery("#extended_album_height").val(short_code['extended_album_height']);
1397
+ jQuery("#extended_album_column_number_" + short_code['extended_album_column_number']).prop('checked', true);
1398
  jQuery("#album_extended_thumb_width").val(short_code['extended_album_thumb_width']);
1399
  jQuery("#album_extended_thumb_height").val(short_code['extended_album_thumb_height']);
1400
  jQuery("#album_extended_image_column_number").val(short_code['extended_album_image_column_number']);
1401
  jQuery("#album_extended_image_thumb_width").val(short_code['extended_album_image_thumb_width']);
1402
  jQuery("#album_extended_image_thumb_height").val(short_code['extended_album_image_thumb_height']);
1403
  if (short_code['extended_album_enable_page']) {
1404
+ jQuery("#album_extended_enable_page_" + short_code['extended_album_enable_page']).prop('checked', true);
1405
  }
1406
  jQuery("#albums_extended_per_page").val(short_code['extended_albums_per_page']);
1407
  jQuery("#album_extended_images_per_page").val(short_code['extended_album_images_per_page']);
1408
+ jQuery("select[id=extended_album_sort_by] option[value='" + short_code['all_album_sort_by'] + "']").prop('selected', true);
1409
+ jQuery("select[id=extended_album_order_by] option[value='" + short_code['all_album_order_by'] + "']").prop('selected', true);
1410
+ jQuery("select[id=album_extended_sort_by] option[value='" + short_code['sort_by'] + "']").prop('selected', true);
1411
+ jQuery("select[id=album_extended_order_by] option[value='" + short_code['order_by'] + "']").prop('selected', true);
1412
  if (short_code['show_search_box'] == 1) {
1413
+ jQuery("#album_extended_show_search_box_1").prop('checked', true);
1414
  }
1415
  else {
1416
+ jQuery("#album_extended_show_search_box_0").prop('checked', true);
1417
  }
1418
  if (short_code['placeholder']) {
1419
  jQuery("#album_extended_placeholder").val(short_code['placeholder']);
1422
  jQuery("#album_extended_search_box_width").val(short_code['search_box_width']);
1423
  }
1424
  if (short_code['show_sort_images'] == 1) {
1425
+ jQuery("#album_extended_show_sort_images_1").prop('checked', true);
1426
  }
1427
  else {
1428
+ jQuery("#album_extended_show_sort_images_0").prop('checked', true);
1429
  }
1430
  if (short_code['show_tag_box'] == 1) {
1431
+ jQuery("#album_extended_show_tag_box_1").prop('checked', true);
1432
  }
1433
  else {
1434
+ jQuery("#album_extended_show_tag_box_0").prop('checked', true);
1435
  }
1436
  if (short_code['show_album_name'] == 1) {
1437
+ jQuery("#show_album_extended_name_enable_1").prop('checked', true);
1438
  }
1439
  else {
1440
+ jQuery("#show_album_extended_name_enable_0").prop('checked', true);
1441
  }
1442
  if (short_code['extended_album_description_enable'] == 1) {
1443
+ jQuery("#extended_album_description_enable_1").prop('checked', true);
1444
  }
1445
  else {
1446
+ jQuery("#extended_album_description_enable_0").prop('checked', true);
1447
  }
1448
  if (short_code['show_gallery_description'] == 1) {
1449
+ jQuery("#album_extended_show_gallery_description_1").prop('checked', true);
1450
  }
1451
  else {
1452
+ jQuery("#album_extended_show_gallery_description_0").prop('checked', true);
1453
  }
1454
  jQuery('#album_extended_view_type').find('option').removeAttr("selected");
1455
+ jQuery("#album_extended_view_type option[value='"+ short_code['extended_album_view_type'] +"']").prop('selected', true);
1456
+ jQuery("input[name='album_extended_image_title_show_hover'][value='" + short_code['extended_album_image_title'] + "']").prop('checked', true);
1457
  if (short_code['extended_album_mosaic_hor_ver'] == "vertical") {
1458
+ jQuery("#album_extended_mosaic_0").prop('checked', true);
1459
  }
1460
  else {
1461
+ jQuery("#album_extended_mosaic_1").prop('checked', true);
1462
  }
1463
  if (short_code['extended_album_resizable_mosaic'] == 1) {
1464
+ jQuery("#album_extended_resizable_mosaic_1").prop('checked', true);
1465
  }
1466
  else {
1467
+ jQuery("#album_extended_resizable_mosaic_0").prop('checked', true);
1468
  }
1469
  jQuery("#album_extended_mosaic_total_width").val(short_code['extended_album_mosaic_total_width']);
1470
  if (short_code['play_icon'] == 1) {
1471
+ jQuery("#album_extended_play_icon_yes").prop('checked', true);
1472
  }
1473
  else {
1474
+ jQuery("#album_extended_play_icon_no").prop('checked', true);
1475
  }
1476
  if (short_code['gallery_download'] == 1) {
1477
+ jQuery("#album_extended_gallery_download_1").prop('checked', true);
1478
  }
1479
  else {
1480
+ jQuery("#album_extended_gallery_download_0").prop('checked', true);
1481
  }
1482
  if (short_code['ecommerce_icon'] == 'hover') {
1483
+ jQuery("#album_extended_ecommerce_icon_show_hover_1").prop('checked', true);
1484
  }
1485
  else if (short_code['ecommerce_icon'] == 'show') {
1486
+ jQuery("#album_extended_ecommerce_icon_show_hover_0").prop('checked', true);
1487
  }
1488
  else {
1489
+ jQuery("#album_extended_ecommerce_icon_show_hover_2").prop('checked', true);
1490
  }
1491
  break;
1492
  }
1493
  }
1494
  // Lightbox.
1495
  if (!short_code['thumb_click_action'] || short_code['thumb_click_action'] == 'undefined' || short_code['thumb_click_action'] == 'do_nothing') {
1496
+ jQuery("#thumb_click_action_3").prop('checked', true);
1497
  }
1498
  else if (short_code['thumb_click_action'] == 'redirect_to_url') {
1499
+ jQuery("#thumb_click_action_2").prop('checked', true);
1500
  }
1501
  else if (short_code['thumb_click_action'] == 'open_lightbox') {
1502
+ jQuery("#thumb_click_action_1").prop('checked', true);
1503
  }
1504
  if (short_code['thumb_link_target'] == 1 || !short_code['thumb_link_target'] || short_code['thumb_link_target'] == 'undefined') {
1505
+ jQuery("#thumb_link_target_yes").prop('checked', true);
1506
  }
1507
  else {
1508
+ jQuery("#thumb_link_target_no").prop('checked', true);
1509
  }
1510
  if (short_code['popup_fullscreen'] != undefined) {
1511
  if (short_code['popup_fullscreen'] == 1) {
1512
+ jQuery("#popup_fullscreen_1").prop('checked', true);
1513
  }
1514
  else {
1515
+ jQuery("#popup_fullscreen_0").prop('checked', true);
1516
  }
1517
  }
1518
  if (short_code['popup_width'] != undefined) {
1522
  jQuery("#popup_height").val(short_code['popup_height']);
1523
  }
1524
  if (short_code['popup_effect'] != undefined) {
1525
+ jQuery("select[id=popup_type] option[value='" + short_code['popup_effect'] + "']").prop('selected', true);
1526
  }
1527
  if (short_code['popup_effect_duration'] != undefined) {
1528
  jQuery("#popup_effect_duration").val(short_code['popup_effect_duration']);
1529
  }
1530
  if (short_code['popup_autoplay'] != undefined) {
1531
  if (short_code['popup_autoplay'] == 1) {
1532
+ jQuery("#popup_autoplay_1").prop('checked', true);
1533
  }
1534
  else {
1535
+ jQuery("#popup_autoplay_0").prop('checked', true);
1536
  }
1537
  }
1538
  if (short_code['popup_interval'] != undefined) {
1540
  }
1541
  if (short_code['popup_enable_filmstrip'] != undefined) {
1542
  if (short_code['popup_enable_filmstrip'] == 1) {
1543
+ jQuery("#popup_enable_filmstrip_1").prop('checked', true);
1544
  }
1545
  else {
1546
+ jQuery("#popup_enable_filmstrip_0").prop('checked', true);
1547
  }
1548
  jQuery("#popup_filmstrip_height").val(short_code['popup_filmstrip_height']);
1549
  }
1550
  if (short_code['popup_enable_ctrl_btn'] != undefined) {
1551
  if (short_code['popup_enable_ctrl_btn'] == 1) {
1552
+ jQuery("#popup_enable_ctrl_btn_1").prop('checked', true);
1553
  bwg_enable_disable('', 'tbody_popup_ctrl_btn1', 'popup_ctrl_btn_1');
1554
  bwg_enable_disable('', 'tbody_popup_ctrl_btn2', 'popup_ctrl_btn_1');
1555
  if (short_code['popup_enable_fullscreen'] == 1) {
1556
+ jQuery("#popup_enable_fullscreen_1").prop('checked', true);
1557
  }
1558
  else {
1559
+ jQuery("#popup_enable_fullscreen_0").prop('checked', true);
1560
  }
1561
  if (short_code['popup_enable_comment'] == 1) {
1562
+ jQuery("#popup_enable_comment_1").prop('checked', true);
1563
  }
1564
  else {
1565
+ jQuery("#popup_enable_comment_0").prop('checked', true);
1566
  }
1567
  if (short_code['popup_enable_email'] == 1) {
1568
+ jQuery("#popup_enable_email_1").prop('checked', true);
1569
  }
1570
  else {
1571
+ jQuery("#popup_enable_email_0").prop('checked', true);
1572
  }
1573
  if (short_code['popup_enable_captcha'] == 1) {
1574
+ jQuery("#popup_enable_captcha_1").prop('checked', true);
1575
  }
1576
  else {
1577
+ jQuery("#popup_enable_captcha_0").prop('checked', true);
1578
  }
1579
  if (short_code['comment_moderation'] == 1) {
1580
+ jQuery("#comment_moderation_1").prop('checked', true);
1581
  }
1582
  else {
1583
+ jQuery("#comment_moderation_0").prop('checked', true);
1584
  }
1585
  if (short_code['popup_enable_info'] == 1 || !short_code['popup_enable_info']) {
1586
+ jQuery("#popup_enable_info_1").prop('checked', true);
1587
  }
1588
  else {
1589
+ jQuery("#popup_enable_info_0").prop('checked', true);
1590
  }
1591
  if (short_code['popup_info_always_show'] == 1 && short_code['popup_info_always_show']) {
1592
+ jQuery("#popup_info_always_show_1").prop('checked', true);
1593
  }
1594
  else {
1595
+ jQuery("#popup_info_always_show_0").prop('checked', true);
1596
  }
1597
  if (short_code['popup_info_full_width'] == 1) {
1598
+ jQuery("#popup_info_full_width_1").prop('checked', true);
1599
  }
1600
  else {
1601
+ jQuery("#popup_info_full_width_0").prop('checked', true);
1602
  }
1603
  if (short_code['autohide_lightbox_navigation'] == 1) {
1604
+ jQuery("#autohide_lightbox_navigation_1").prop('checked', true);
1605
  }
1606
  else {
1607
+ jQuery("#autohide_lightbox_navigation_0").prop('checked', true);
1608
  }
1609
  if (short_code['popup_hit_counter'] == 1 && short_code['popup_hit_counter']) {
1610
+ jQuery("#popup_hit_counter_1").prop('checked', true);
1611
  }
1612
  else {
1613
+ jQuery("#popup_hit_counter_0").prop('checked', true);
1614
  }
1615
  if (short_code['popup_enable_rate'] == 1 && short_code['popup_enable_rate']) {
1616
+ jQuery("#popup_enable_rate_1").prop('checked', true);
1617
  }
1618
  else {
1619
+ jQuery("#popup_enable_rate_0").prop('checked', true);
1620
  }
1621
  if (short_code['popup_enable_fullsize_image'] == 1) {
1622
+ jQuery("#popup_enable_fullsize_image_1").prop('checked', true);
1623
  }
1624
  else {
1625
+ jQuery("#popup_enable_fullsize_image_0").prop('checked', true);
1626
  }
1627
  if (short_code['popup_enable_download'] == 1) {
1628
+ jQuery("#popup_enable_download_1").prop('checked', true);
1629
  }
1630
  else {
1631
+ jQuery("#popup_enable_download_0").prop('checked', true);
1632
  }
1633
  if (short_code['show_image_counts'] == 1) {
1634
+ jQuery("#show_image_counts_current_image_number_1").prop('checked', true);
1635
  }
1636
  else {
1637
+ jQuery("#show_image_counts_current_image_number_0").prop('checked', true);
1638
  }
1639
  if (short_code['enable_loop'] == 1) {
1640
+ jQuery("#enable_loop_1").prop('checked', true);
1641
  }
1642
  else {
1643
+ jQuery("#enable_loop_0").prop('checked', true);
1644
  }
1645
  if (short_code['enable_addthis'] == 1) {
1646
+ jQuery("#enable_addthis_1").prop('checked', true);
1647
  }
1648
  else {
1649
+ jQuery("#enable_addthis_0").prop('checked', true);
1650
  }
1651
  if (short_code['addthis_profile_id'] != 'undefined') {
1652
  jQuery("#addthis_profile_id").val(short_code['addthis_profile_id']);
1653
  }
1654
  if (short_code['popup_enable_facebook'] == 1) {
1655
+ jQuery("#popup_enable_facebook_1").prop('checked', true);
1656
  }
1657
  else {
1658
+ jQuery("#popup_enable_facebook_0").prop('checked', true);
1659
  }
1660
  if (short_code['popup_enable_twitter'] == 1) {
1661
+ jQuery("#popup_enable_twitter_1").prop('checked', true);
1662
  }
1663
  else {
1664
+ jQuery("#popup_enable_twitter_0").prop('checked', true);
1665
  }
1666
  if (short_code['popup_enable_pinterest'] == 1) {
1667
+ jQuery("#popup_enable_pinterest_1").prop('checked', true);
1668
  }
1669
  else {
1670
+ jQuery("#popup_enable_pinterest_0").prop('checked', true);
1671
  }
1672
  if (short_code['popup_enable_tumblr'] == 1) {
1673
+ jQuery("#popup_enable_tumblr_1").prop('checked', true);
1674
  }
1675
  else {
1676
+ jQuery("#popup_enable_tumblr_0").prop('checked', true);
1677
  }
1678
  if (short_code['popup_enable_ecommerce'] == 1) {
1679
+ jQuery("#popup_ecommerce_1").prop('checked', true);
1680
  }
1681
  else {
1682
+ jQuery("#popup_ecommerce_0").prop('checked', true);
1683
  }
1684
  }
1685
  else {
1686
+ jQuery("#popup_enable_ctrl_btn_0").prop('checked', true);
1687
  }
1688
  }
1689
  bwg_lightbox_hide_show_params();
1690
  // Watermark.
1691
  if (short_code['watermark_type'] == 'text') {
1692
+ jQuery("#watermark_type_text").prop('checked', true);
1693
  jQuery("#watermark_link").val(decodeURIComponent(short_code['watermark_link']));
1694
  jQuery("#watermark_text").val(short_code['watermark_text']);
1695
  jQuery("#watermark_font_size").val(short_code['watermark_font_size']);
1696
  if (in_array(short_code['watermark_font'], bwg_objectGGF)) {
1697
+ jQuery("#watermark_google_fonts1").prop('checked', true);
1698
  bwg_change_fonts('watermark_font', 'watermark_google_fonts1');
1699
  }
1700
  else {
1701
+ jQuery("#watermark_google_fonts0").prop('checked', true);
1702
  bwg_change_fonts('watermark_font', '');
1703
  }
1704
+ jQuery("select[id=watermark_font] option[value='" + short_code['watermark_font'] + "']").prop('selected', true);
1705
  jQuery("#watermark_color").val(short_code['watermark_color']);
1706
  jQuery("#watermark_opacity").val(short_code['watermark_opacity']);
1707
+ jQuery("#watermark_type_text").prop('checked', true);
1708
+ jQuery("#watermark_" + short_code['watermark_position']).prop('checked', true);
1709
  }
1710
  else if (short_code['watermark_type'] == 'image') {
1711
+ jQuery("#watermark_type_image").prop('checked', true);
1712
  jQuery("#watermark_link").val(decodeURIComponent(short_code['watermark_link']));
1713
  jQuery("#watermark_url").val(short_code['watermark_url']);
1714
  jQuery("#watermark_width").val(short_code['watermark_width']);
1715
  jQuery("#watermark_height").val(short_code['watermark_height']);
1716
  jQuery("#watermark_opacity").val(short_code['watermark_opacity']);
1717
+ jQuery("#watermark_type_image").prop('checked', true);
1718
+ jQuery("#watermark_" + short_code['watermark_position']).prop('checked', true);
1719
  }
1720
  else {
1721
+ jQuery("#watermark_type_none").prop('checked', true);
1722
  }
1723
  bwg_watermark('watermark_type_' + short_code['watermark_type']);
1724
  }
2241
  }
2242
  return false;
2243
  }
2244
+ jQuery(function() {
2245
  bwg_shortcode_hide_show_params();
2246
  bwg_change_tab();
2247
  });
css/bwg_tables.css CHANGED
@@ -107,6 +107,11 @@ a.tw-button-secondary {
107
  margin: 5px 0;
108
  }
109
 
 
 
 
 
 
110
  .wd-box-title {
111
  border-bottom: 1px solid #eaeaea;
112
  height: inherit;
@@ -192,6 +197,14 @@ a.tw-button-secondary {
192
  .js .postbox .hndle {
193
  cursor: pointer;
194
  }
 
 
 
 
 
 
 
 
195
  .bwg_form h2 {
196
  font-size: 23px;
197
  font-weight: normal;
@@ -410,7 +423,7 @@ a.tw-button-secondary {
410
  }
411
 
412
  .handle {
413
- border: none;
414
  height: 18px;
415
  margin: 0 auto;
416
  width: 18px;
@@ -1187,7 +1200,7 @@ textarea.bwg_popup_input {
1187
  }
1188
 
1189
  .wd-form .wd-check-all input {
1190
- vertical-align: middle;
1191
  margin: 0;
1192
  }
1193
 
@@ -1275,6 +1288,8 @@ textarea.bwg_popup_input {
1275
 
1276
  .wd-form .postbox {
1277
  margin-bottom: 0;
 
 
1278
  }
1279
 
1280
  .wrap.wd-wrap-ajax {
107
  margin: 5px 0;
108
  }
109
 
110
+ .wd-box-section .inside .wd-box-section{
111
+ border:none;
112
+ margin-right: 5%;
113
+ }
114
+
115
  .wd-box-title {
116
  border-bottom: 1px solid #eaeaea;
117
  height: inherit;
197
  .js .postbox .hndle {
198
  cursor: pointer;
199
  }
200
+
201
+ .postbox .handlediv {
202
+ float:right;
203
+ }
204
+ .form-wrap p, p.description, p.help, span.description {
205
+ font-style:italic;
206
+ }
207
+
208
  .bwg_form h2 {
209
  font-size: 23px;
210
  font-weight: normal;
423
  }
424
 
425
  .handle {
426
+ /*border: none;*/
427
  height: 18px;
428
  margin: 0 auto;
429
  width: 18px;
1200
  }
1201
 
1202
  .wd-form .wd-check-all input {
1203
+ vertical-align: text-bottom;
1204
  margin: 0;
1205
  }
1206
 
1288
 
1289
  .wd-form .postbox {
1290
  margin-bottom: 0;
1291
+ border: 1px solid #ccd0d4;
1292
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
1293
  }
1294
 
1295
  .wrap.wd-wrap-ajax {
filemanager/UploadHandler.php CHANGED
@@ -527,7 +527,7 @@ class bwg_UploadHandler {
527
  $file->error = 'Failed to create scaled version: ' . $failed_versions[0];
528
  break;
529
  default:
530
- $file->error = 'Failed to create scaled versions: ' . implode($failed_versions, ', ');
531
  }
532
 
533
  if ( !$file->error ) {
527
  $file->error = 'Failed to create scaled version: ' . $failed_versions[0];
528
  break;
529
  default:
530
+ $file->error = 'Failed to create scaled versions: ' . implode(', ', $failed_versions);
531
  }
532
 
533
  if ( !$file->error ) {
filemanager/controller.php CHANGED
@@ -189,7 +189,16 @@ class FilemanagerController {
189
  'thumb' => '/filemanager/images/dir.png',
190
  'date_modified' => date("Y-m-d H:i:s")
191
  );
192
- $wpdb->insert($wpdb->prefix . 'bwg_file_paths', $data);
 
 
 
 
 
 
 
 
 
193
  mkdir($new_dir_path);
194
  }
195
  $args = array(
@@ -269,11 +278,33 @@ class FilemanagerController {
269
  $msg = __("Can't rename the file.", BWG()->prefix);
270
  }
271
  else {
272
- $wpdb->query('UPDATE ' . $wpdb->prefix . 'bwg_image SET
273
- image_url = INSERT(image_url, LOCATE("' . $input_dir . '/' . $file_name . '", image_url), CHAR_LENGTH("' . $input_dir . '/' . $file_name . '"), "' . $input_dir . '/' . $file_new_name . '"),
274
- thumb_url = INSERT(thumb_url, LOCATE("' . $input_dir . '/' . $file_name . '", thumb_url), CHAR_LENGTH("' . $input_dir . '/' . $file_name . '"), "' . $input_dir . '/' . $file_new_name . '")');
275
- $wpdb->query('UPDATE ' . $wpdb->prefix . 'bwg_gallery SET
276
- preview_image = INSERT(preview_image, LOCATE("' . $input_dir . '/' . $file_name . '", preview_image), CHAR_LENGTH("' . $input_dir . '/' . $file_name . '"), "' . $input_dir . '/' . $file_new_name . '")');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
 
278
  // Update all paths.
279
  $path_where = (empty($input_dir) ? '/' : $input_dir .'/');
@@ -284,14 +315,18 @@ class FilemanagerController {
284
  'filename' => $file_new_name,
285
  'alt' => $file_new_name
286
  ),
287
- array('path' => $path_where, 'name' => $file_name)
 
 
288
  );
289
  if ( !empty($paths) ) {
290
  foreach( $paths as $val) {
291
  $wpdb->update($wpdb->prefix . 'bwg_file_paths',
292
  array('path' => str_replace($file_name, $file_new_name, $val)),
293
- array('path' => $val)
294
- );
 
 
295
  }
296
  }
297
  }
@@ -306,13 +341,18 @@ class FilemanagerController {
306
  'filename' => $file_new_name,
307
  'image_url' => $input_dir . '/' . $file_new_name . '.' . $file_extension,
308
  'thumb_url' => $input_dir . '/thumb/' . $file_new_name . '.' . $file_extension,
309
- ), array(
310
- 'thumb_url' => $input_dir . '/thumb/' . $file_name,
311
- ));
 
 
312
  $wpdb->update($wpdb->prefix . 'bwg_gallery',
313
- array('preview_image' => $input_dir . '/thumb/' . $file_new_name . '.' . $file_extension),
314
- array('preview_image' => $input_dir . '/thumb/' . $file_name)
315
- );
 
 
 
316
 
317
  $path = $input_dir .'/';
318
  $wpdb->update($wpdb->prefix . 'bwg_file_paths',
@@ -323,8 +363,11 @@ class FilemanagerController {
323
  'alt' => $file_new_name,
324
  'date_modified' => date('Y-m-d H:i:s')
325
  ),
326
- array('path' => $path, 'name' => $file_name)
327
- );
 
 
 
328
 
329
  rename($thumb_file_path, $cur_dir_path . '/thumb/' . $file_new_name . '.' . $file_extension);
330
  rename($original_file_path, $cur_dir_path . '/.original/' . $file_new_name . '.' . $file_extension);
@@ -376,14 +419,14 @@ class FilemanagerController {
376
  if ( is_dir($file_path) == true ) {
377
  $paths = $this->getRecursivePathLists($path, $file_name);
378
  if ( !empty($paths) ) {
379
- $wpdb->delete( $file_path_tbl, array('path' => $path, 'name' => $file_name) );
380
  foreach( $paths as $val ) {
381
- $wpdb->delete( $file_path_tbl, array('path' => $val) );
382
  }
383
  }
384
  }
385
  else {
386
- $wpdb->delete( $file_path_tbl, array('path' => $path, 'name' => $file_name) );
387
  }
388
  $this->remove_file_dir($file_path, $input_dir, $file_name);
389
  if (file_exists($thumb_file_path)) {
@@ -441,7 +484,7 @@ class FilemanagerController {
441
  switch ((isset($_REQUEST['clipboard_task']) ? stripslashes(WDWLibrary::get('clipboard_task','','sanitize_text_field','REQUEST')) : '')) {
442
  case 'copy': {
443
  foreach ($file_names as $file_name) {
444
- $file = $wpdb->get_row( 'SELECT * FROM `' . $file_path_tbl . '` WHERE `path` ="' . $path_old . '" AND `name`="' . $file_name . '"', 'ARRAY_A' );
445
  unset($file['id']);
446
  $file_name = htmlspecialchars_decode($file_name, ENT_COMPAT | ENT_QUOTES);
447
  $file_name = str_replace('../', '', $file_name);
@@ -505,7 +548,7 @@ class FilemanagerController {
505
  $file['alt'] = !empty($new_file_title) ? $new_file_title : $file['alt'];
506
  $wpdb->insert( $file_path_tbl, $file );
507
 
508
- $files = $wpdb->get_results( 'SELECT * FROM `' . $file_path_tbl . '` WHERE `path` ="' . $path_where . '"', 'ARRAY_A' );
509
  foreach( $files as $file ) {
510
  unset($file['id']);
511
  $file['path'] = $path_file . (!empty($new_file_title) ? $new_file_title .'/' : $file_name .'/');
@@ -532,19 +575,46 @@ class FilemanagerController {
532
  }
533
  else {
534
  if ( is_dir($dest_dir . '/' . $file_name) ) {
535
- $wpdb->query('UPDATE ' . $wpdb->prefix . 'bwg_image SET
536
- image_url = INSERT(image_url, LOCATE("' . str_replace($this->uploads_dir . '/', '', $src) . '", image_url), CHAR_LENGTH("' . str_replace($this->uploads_dir . '/', '', $src) . '"), "' . str_replace(str_replace($input_dir, '', $dest_dir), '', $dest) . '"),
537
- thumb_url = INSERT(thumb_url, LOCATE("' . str_replace($this->uploads_dir . '/', '', $src) . '", thumb_url), CHAR_LENGTH("' . str_replace($this->uploads_dir . '/', '', $src) . '"), "' . str_replace(str_replace($input_dir, '', $dest_dir), '', $dest) . '")');
538
-
539
- $wpdb->query('UPDATE ' . $wpdb->prefix . 'bwg_gallery SET preview_image =
540
- INSERT(preview_image, LOCATE("' . str_replace($this->uploads_dir . '/', '', $src) . '", preview_image), CHAR_LENGTH("' . str_replace($this->uploads_dir . '/', '', $src) . '"), "' . str_replace(str_replace($input_dir, '', $dest_dir), '', $dest) . '")');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
 
542
  $paths = $this->getRecursivePathLists($path_old, $file_name);
543
- $wpdb->update( $file_path_tbl, array('path' => $path_new), array('path' => $path_old, 'name' => $file_name) );
 
 
 
 
 
 
544
  $path_where = $path_old . $file_name .'/';
545
  foreach ( $paths as $val ) {
546
  $path_update = $path_new . str_replace($path_old, '', $val);
547
- $wpdb->update( $file_path_tbl, array('path' => $path_update), array('path' => $val) );
 
 
 
 
 
 
548
  }
549
  }
550
  else {
@@ -567,18 +637,24 @@ class FilemanagerController {
567
  'image_url' => str_replace(str_replace($input_dir, '', $dest_dir), '', $dest),
568
  'thumb_url' => $input_dir . '/thumb/' . $file_name,
569
  ),
570
- array(
571
- 'thumb_url' => $relative_source_dir . '/thumb/' . $file_name,
572
- ));
 
573
  $wpdb->update($wpdb->prefix . 'bwg_gallery',
574
- array(
575
- 'preview_image' => $input_dir . '/thumb/' . $file_name,
576
- ),
577
- array(
578
- 'preview_image' => $relative_source_dir . '/thumb/' . $file_name,
579
- ));
580
-
581
- $wpdb->update( $file_path_tbl, array('path' => $path_new), array('path' => $path_old, 'name' => $file_name) );
 
 
 
 
 
582
  }
583
  }
584
  }
@@ -641,9 +717,9 @@ class FilemanagerController {
641
  global $wpdb;
642
  $deleted_image_dir = $input_dir . '/thumb/' . $file_name;
643
  // delete image by preview_image.
644
- $wpdb->delete($wpdb->prefix . 'bwg_image', array( 'thumb_url' => $deleted_image_dir ));
645
  // Get gallery by preview_image or random_preview_image.
646
- $galleries = $wpdb->get_results('SELECT `id` FROM `' . $wpdb->prefix . 'bwg_gallery` WHERE `preview_image` = "' . $deleted_image_dir . '" OR `random_preview_image` = "' . $deleted_image_dir . '"');
647
  // Update random preview image on bwg_gallery.
648
  if ( !empty($galleries) ) {
649
  $gallerIds = array();
@@ -652,7 +728,8 @@ class FilemanagerController {
652
  }
653
  // Get thumb images by gallery id.
654
  $thumbIds = array();
655
- $thumbs = $wpdb->get_results('SELECT `gallery_id`, `thumb_url` FROM `' . $wpdb->prefix . 'bwg_image` WHERE `gallery_id` IN (' . implode(',', $gallerIds) . ')');
 
656
  if ( !empty($thumbs) ) {
657
  foreach ( $thumbs as $item ) {
658
  $thumbIds[$item->gallery_id][] = $item->thumb_url;
@@ -670,7 +747,11 @@ class FilemanagerController {
670
  $wpdb->update($wpdb->prefix . 'bwg_gallery', array(
671
  'preview_image' => '',
672
  'random_preview_image' => $random_preview_image,
673
- ), array( 'id' => $gid ));
 
 
 
 
674
  }
675
  }
676
  }
@@ -713,9 +794,15 @@ class FilemanagerController {
713
  */
714
  private function getRecursivePathLists( $path = '/', $name = '', $level = 0 ) {
715
  global $wpdb;
 
716
  static $parents = array();
717
- $where = ($level == 0) ? ' AND `name`="' . $name . '"' : '';
718
- $items = $wpdb->get_results( 'SELECT * FROM `' . $wpdb->prefix . 'bwg_file_paths` WHERE `is_dir` = 1 AND `path` ="' . $path . '"' . $where );
 
 
 
 
 
719
  if( !empty($items) ) {
720
  foreach( $items as $item) {
721
  $path = $item->path . $item->name .'/';
189
  'thumb' => '/filemanager/images/dir.png',
190
  'date_modified' => date("Y-m-d H:i:s")
191
  );
192
+ $format = array(
193
+ '%d',
194
+ '%s',
195
+ '%s',
196
+ '%s',
197
+ '%s',
198
+ '%s',
199
+ '%s'
200
+ );
201
+ $wpdb->insert($wpdb->prefix . 'bwg_file_paths', $data, $format);
202
  mkdir($new_dir_path);
203
  }
204
  $args = array(
278
  $msg = __("Can't rename the file.", BWG()->prefix);
279
  }
280
  else {
281
+ $args = array(
282
+ $input_dir,
283
+ $file_name,
284
+ $input_dir,
285
+ $file_name,
286
+ $input_dir,
287
+ $file_name,
288
+ $input_dir,
289
+ $file_name,
290
+ $input_dir,
291
+ $file_name,
292
+ $input_dir,
293
+ $file_name
294
+ );
295
+ $wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'bwg_image SET
296
+ image_url = INSERT(image_url, LOCATE("%s/%s", image_url), CHAR_LENGTH("%s/%s"), "%s/%s"),
297
+ thumb_url = INSERT(thumb_url, LOCATE("%s/%s", thumb_url), CHAR_LENGTH("%s/%s"), "%s/%s")', $args));
298
+ $args = array(
299
+ $input_dir,
300
+ $file_name,
301
+ $input_dir,
302
+ $file_name,
303
+ $input_dir,
304
+ $file_name
305
+ );
306
+ $wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'bwg_gallery SET
307
+ preview_image = INSERT(preview_image, LOCATE("%s/%s", preview_image), CHAR_LENGTH("%s/%s"), "%s/%s")', $args));
308
 
309
  // Update all paths.
310
  $path_where = (empty($input_dir) ? '/' : $input_dir .'/');
315
  'filename' => $file_new_name,
316
  'alt' => $file_new_name
317
  ),
318
+ array('path' => $path_where, 'name' => $file_name),
319
+ array('%s','%s','%s'),
320
+ array('%s','%s')
321
  );
322
  if ( !empty($paths) ) {
323
  foreach( $paths as $val) {
324
  $wpdb->update($wpdb->prefix . 'bwg_file_paths',
325
  array('path' => str_replace($file_name, $file_new_name, $val)),
326
+ array('path' => $val),
327
+ array('%s'),
328
+ array('%s')
329
+ );
330
  }
331
  }
332
  }
341
  'filename' => $file_new_name,
342
  'image_url' => $input_dir . '/' . $file_new_name . '.' . $file_extension,
343
  'thumb_url' => $input_dir . '/thumb/' . $file_new_name . '.' . $file_extension,
344
+ ),
345
+ array('thumb_url' => $input_dir . '/thumb/' . $file_name),
346
+ array('%s','%s','%s'),
347
+ array('%s')
348
+ );
349
  $wpdb->update($wpdb->prefix . 'bwg_gallery',
350
+ array('preview_image' => $input_dir . '/thumb/' . $file_new_name . '.' . $file_extension),
351
+ array('preview_image' => $input_dir . '/thumb/' . $file_name),
352
+ array('%s'),
353
+ array('%s')
354
+
355
+ );
356
 
357
  $path = $input_dir .'/';
358
  $wpdb->update($wpdb->prefix . 'bwg_file_paths',
363
  'alt' => $file_new_name,
364
  'date_modified' => date('Y-m-d H:i:s')
365
  ),
366
+ array('path' => $path, 'name' => $file_name),
367
+ array('%s','%s','%s','%s','%s'),
368
+ array('%s','%s')
369
+
370
+ );
371
 
372
  rename($thumb_file_path, $cur_dir_path . '/thumb/' . $file_new_name . '.' . $file_extension);
373
  rename($original_file_path, $cur_dir_path . '/.original/' . $file_new_name . '.' . $file_extension);
419
  if ( is_dir($file_path) == true ) {
420
  $paths = $this->getRecursivePathLists($path, $file_name);
421
  if ( !empty($paths) ) {
422
+ $wpdb->delete( $file_path_tbl, array('path' => $path, 'name' => $file_name), array('%s','%s'));
423
  foreach( $paths as $val ) {
424
+ $wpdb->delete( $file_path_tbl, array('path' => $val), array('%s') );
425
  }
426
  }
427
  }
428
  else {
429
+ $wpdb->delete( $file_path_tbl, array('path' => $path, 'name' => $file_name), array('%s','%s') );
430
  }
431
  $this->remove_file_dir($file_path, $input_dir, $file_name);
432
  if (file_exists($thumb_file_path)) {
484
  switch ((isset($_REQUEST['clipboard_task']) ? stripslashes(WDWLibrary::get('clipboard_task','','sanitize_text_field','REQUEST')) : '')) {
485
  case 'copy': {
486
  foreach ($file_names as $file_name) {
487
+ $file = $wpdb->get_row( $wpdb->prepare('SELECT * FROM `' . $file_path_tbl . '` WHERE `path` ="%s" AND `name`="%s"', array($path_old, $file_name)), 'ARRAY_A' );
488
  unset($file['id']);
489
  $file_name = htmlspecialchars_decode($file_name, ENT_COMPAT | ENT_QUOTES);
490
  $file_name = str_replace('../', '', $file_name);
548
  $file['alt'] = !empty($new_file_title) ? $new_file_title : $file['alt'];
549
  $wpdb->insert( $file_path_tbl, $file );
550
 
551
+ $files = $wpdb->get_results( $wpdb->prepare('SELECT * FROM `' . $file_path_tbl . '` WHERE `path` ="%s"',array($path_where)), 'ARRAY_A' );
552
  foreach( $files as $file ) {
553
  unset($file['id']);
554
  $file['path'] = $path_file . (!empty($new_file_title) ? $new_file_title .'/' : $file_name .'/');
575
  }
576
  else {
577
  if ( is_dir($dest_dir . '/' . $file_name) ) {
578
+ $temp_dir = str_replace($this->uploads_dir . '/', '', $src);
579
+ $temp_inputdir = str_replace(str_replace($input_dir, '', $dest_dir), '', $dest);
580
+ $prepareArgs = array(
581
+ $temp_dir,
582
+ $temp_dir,
583
+ $temp_inputdir,
584
+ $temp_dir,
585
+ $temp_dir,
586
+ $temp_inputdir
587
+ );
588
+ $wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'bwg_image SET
589
+ image_url = INSERT(image_url, LOCATE("%s", image_url), CHAR_LENGTH("%s"), "%s"),
590
+ thumb_url = INSERT(thumb_url, LOCATE("%s", thumb_url), CHAR_LENGTH("%s"), "%s")', $prepareArgs));
591
+
592
+ $prepareArgs = array(
593
+ $temp_dir,
594
+ $temp_dir,
595
+ $temp_inputdir
596
+ );
597
+ $wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'bwg_gallery SET preview_image =
598
+ INSERT(preview_image, LOCATE("%s", preview_image), CHAR_LENGTH("%s"), "%s")', $prepareArgs));
599
 
600
  $paths = $this->getRecursivePathLists($path_old, $file_name);
601
+ $wpdb->update(
602
+ $file_path_tbl,
603
+ array('path' => $path_new),
604
+ array('path' => $path_old, 'name' => $file_name),
605
+ array('%s'),
606
+ array('%s','%s')
607
+ );
608
  $path_where = $path_old . $file_name .'/';
609
  foreach ( $paths as $val ) {
610
  $path_update = $path_new . str_replace($path_old, '', $val);
611
+ $wpdb->update(
612
+ $file_path_tbl,
613
+ array('path' => $path_update),
614
+ array('path' => $val),
615
+ array('%s'),
616
+ array('%s')
617
+ );
618
  }
619
  }
620
  else {
637
  'image_url' => str_replace(str_replace($input_dir, '', $dest_dir), '', $dest),
638
  'thumb_url' => $input_dir . '/thumb/' . $file_name,
639
  ),
640
+ array('thumb_url' => $relative_source_dir . '/thumb/' . $file_name),
641
+ array('%s','%s','%s'),
642
+ array('%s')
643
+ );
644
  $wpdb->update($wpdb->prefix . 'bwg_gallery',
645
+ array('preview_image' => $input_dir . '/thumb/' . $file_name),
646
+ array('preview_image' => $relative_source_dir . '/thumb/' . $file_name),
647
+ array('%s'),
648
+ array('%s')
649
+ );
650
+
651
+ $wpdb->update(
652
+ $file_path_tbl,
653
+ array('path' => $path_new),
654
+ array('path' => $path_old, 'name' => $file_name) ,
655
+ array('%s'),
656
+ array('%s','%s')
657
+ );
658
  }
659
  }
660
  }
717
  global $wpdb;
718
  $deleted_image_dir = $input_dir . '/thumb/' . $file_name;
719
  // delete image by preview_image.
720
+ $wpdb->delete($wpdb->prefix . 'bwg_image', array( 'thumb_url' => $deleted_image_dir ), array('%s'));
721
  // Get gallery by preview_image or random_preview_image.
722
+ $galleries = $wpdb->get_results($wpdb->prepare('SELECT `id` FROM `' . $wpdb->prefix . 'bwg_gallery` WHERE `preview_image` = "%s" OR `random_preview_image` = "%s"', array($deleted_image_dir,$deleted_image_dir)));
723
  // Update random preview image on bwg_gallery.
724
  if ( !empty($galleries) ) {
725
  $gallerIds = array();
728
  }
729
  // Get thumb images by gallery id.
730
  $thumbIds = array();
731
+ $implodeGalIds = implode(',', $gallerIds);
732
+ $thumbs = $wpdb->get_results($wpdb->prepare('SELECT `gallery_id`, `thumb_url` FROM `' . $wpdb->prefix . 'bwg_image` WHERE `gallery_id` IN (%s)', array($implodeGalIds)));
733
  if ( !empty($thumbs) ) {
734
  foreach ( $thumbs as $item ) {
735
  $thumbIds[$item->gallery_id][] = $item->thumb_url;
747
  $wpdb->update($wpdb->prefix . 'bwg_gallery', array(
748
  'preview_image' => '',
749
  'random_preview_image' => $random_preview_image,
750
+ ),
751
+ array( 'id' => $gid ),
752
+ array('%s','%s'),
753
+ array('%d')
754
+ );
755
  }
756
  }
757
  }
794
  */
795
  private function getRecursivePathLists( $path = '/', $name = '', $level = 0 ) {
796
  global $wpdb;
797
+ $prepareArgs = array($path);
798
  static $parents = array();
799
+ $where = '';
800
+ if( $level == 0 ) {
801
+ $where = ' AND `name`="%s"';
802
+ $prepareArgs[] = $name;
803
+ }
804
+
805
+ $items = $wpdb->get_results( $wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_file_paths` WHERE `is_dir` = 1 AND `path` ="%s"' . $where, $prepareArgs) );
806
  if( !empty($items) ) {
807
  foreach( $items as $item) {
808
  $path = $item->path . $item->name .'/';
filemanager/js/default.js CHANGED
@@ -8,7 +8,7 @@ var params = [];
8
  var no_selected_files = [];
9
  var wdb_all_files_filtered = [];
10
 
11
- jQuery(document).ready(function () {
12
  var page = 1;
13
  var page_per = jQuery("#explorer_body").data('page_per');
14
  jQuery("#explorer_body_container").scroll(function () {
8
  var no_selected_files = [];
9
  var wdb_all_files_filtered = [];
10
 
11
+ jQuery(function() {
12
  var page = 1;
13
  var page_per = jQuery("#explorer_body").data('page_per');
14
  jQuery("#explorer_body_container").scroll(function () {
filemanager/model.php CHANGED
@@ -60,9 +60,12 @@ class FilemanagerModel {
60
  $page_per = $params['page_per'];
61
 
62
  $query = ' SELECT * FROM `' . $wpdb->prefix . 'bwg_file_paths`';
63
- $query .= ' WHERE `path` = "' . $dir . '"';
 
64
  if ( $search ) {
65
- $query .= ' AND ((filename LIKE "%' . $search . '%") OR (alt LIKE "%' . $search . '%")) ';
 
 
66
  }
67
  if ( $orderby == 'size') {
68
  $orderby = 'CAST('. $orderby .' AS unsigned)';
@@ -70,15 +73,18 @@ class FilemanagerModel {
70
  $query .= ' ORDER BY `is_dir` DESC, '. $orderby . ' ' . $order;
71
  // Get total num rows.
72
  $results['page_per'] = $page_per;
73
- $results['num_rows'] = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(*)', $query) );
74
- $query .= ' LIMIT ' . ($page_num * $page_per) . ',' . $page_per;
75
- $items = $wpdb->get_results($query, 'ARRAY_A');
 
 
 
76
  if ( empty($items) && empty($search) ) {
77
  $params['dir'] = BWG()->upload_dir . $dir;
78
  $params['path'] = $dir;
79
  $this->files_parsing_db( $params );
80
  $items = $wpdb->get_results($query, 'ARRAY_A');
81
- $results['num_rows'] = $wpdb->get_var( str_replace('SELECT *', 'SELECT COUNT(*)', $query) );
82
  }
83
  if ( !empty($items) ) {
84
  foreach( $items as $item ) {
@@ -163,12 +169,15 @@ class FilemanagerModel {
163
  }
164
 
165
  $query = ' SELECT * FROM `' . $wpdb->prefix . 'bwg_file_paths`';
166
- $query .= ' WHERE `path` = "' . $dir . '"';
 
167
  if ( $search ) {
168
- $query .= ' AND ((filename LIKE "%' . $search . '%") OR (alt LIKE "%' . $search . '%")) ';
169
- }
 
 
170
  $query .= ' ORDER BY `is_dir` DESC, `' . $orderby . '` ' . $order;
171
- $items = $wpdb->get_results($query, 'ARRAY_A');
172
  $results = array();
173
  if ( !empty($items) ) {
174
  foreach( $items as $item ) {
@@ -208,7 +217,7 @@ class FilemanagerModel {
208
  /*
209
  $paths = $value;
210
  array_pop($paths);
211
- $implode_path = implode($paths,'/');
212
  $path = !empty($implode_path) ? '/'. $implode_path . '/' : '/';
213
  */
214
  if ( is_dir($item) == TRUE ) {
@@ -257,7 +266,7 @@ class FilemanagerModel {
257
  $insert = 0;
258
  $tbl = $wpdb->prefix . 'bwg_file_paths';
259
  if( !empty($params['refresh']) ) {
260
- $wpdb->delete($tbl, array('path' => $path ) );
261
  }
262
  foreach( $data as $val ) {
263
  $insert = $wpdb->insert($tbl, $val );
60
  $page_per = $params['page_per'];
61
 
62
  $query = ' SELECT * FROM `' . $wpdb->prefix . 'bwg_file_paths`';
63
+ $query .= ' WHERE `path` = %s';
64
+ $prepareArgs = array($dir);
65
  if ( $search ) {
66
+ $query .= ' AND ((filename LIKE %s) OR (alt LIKE %s)) ';
67
+ $prepareArgs[] = "%" . $search . "%";
68
+ $prepareArgs[] = "%" . $search . "%";
69
  }
70
  if ( $orderby == 'size') {
71
  $orderby = 'CAST('. $orderby .' AS unsigned)';
73
  $query .= ' ORDER BY `is_dir` DESC, '. $orderby . ' ' . $order;
74
  // Get total num rows.
75
  $results['page_per'] = $page_per;
76
+ $results['num_rows'] = $wpdb->get_var( $wpdb->prepare(str_replace('SELECT *', 'SELECT COUNT(*)', $query), $prepareArgs) );
77
+ $page_mix = $page_num * $page_per;
78
+ $query .= ' LIMIT %d, %d';
79
+ $prepareArgs[] = $page_mix;
80
+ $prepareArgs[] = $page_per;
81
+ $items = $wpdb->get_results($wpdb->prepare($query, $prepareArgs), 'ARRAY_A');
82
  if ( empty($items) && empty($search) ) {
83
  $params['dir'] = BWG()->upload_dir . $dir;
84
  $params['path'] = $dir;
85
  $this->files_parsing_db( $params );
86
  $items = $wpdb->get_results($query, 'ARRAY_A');
87
+ $results['num_rows'] = $wpdb->get_var( $wpdb->prepare(str_replace('SELECT *', 'SELECT COUNT(*)', $query),$prepareArgs) );
88
  }
89
  if ( !empty($items) ) {
90
  foreach( $items as $item ) {
169
  }
170
 
171
  $query = ' SELECT * FROM `' . $wpdb->prefix . 'bwg_file_paths`';
172
+ $query .= ' WHERE `path` = %s';
173
+ $prepareArgs = array($dir);
174
  if ( $search ) {
175
+ $query .= ' AND ((filename LIKE %s) OR (alt LIKE %s)) ';
176
+ $prepareArgs[] = "%" . $search . "%";
177
+ $prepareArgs[] = "%" . $search . "%";
178
+ }
179
  $query .= ' ORDER BY `is_dir` DESC, `' . $orderby . '` ' . $order;
180
+ $items = $wpdb->get_results($wpdb->prepare($query, $prepareArgs), 'ARRAY_A');
181
  $results = array();
182
  if ( !empty($items) ) {
183
  foreach( $items as $item ) {
217
  /*
218
  $paths = $value;
219
  array_pop($paths);
220
+ $implode_path = implode('/', $paths);
221
  $path = !empty($implode_path) ? '/'. $implode_path . '/' : '/';
222
  */
223
  if ( is_dir($item) == TRUE ) {
266
  $insert = 0;
267
  $tbl = $wpdb->prefix . 'bwg_file_paths';
268
  if( !empty($params['refresh']) ) {
269
+ $wpdb->delete($tbl, array('path' => $path ), array('%s') );
270
  }
271
  foreach( $data as $val ) {
272
  $insert = $wpdb->insert($tbl, $val );
filemanager/view.php CHANGED
@@ -298,7 +298,7 @@ class FilemanagerView {
298
  'allowed_upload_types' : '<?php _e('Allowed upload types JPG, JPEG, GIF, PNG, SVG.', BWG()->prefix); ?>'
299
  };
300
  last_uploaded = [];
301
- jQuery(document).ready(function () {
302
  jQuery("#loading_div", window.parent.document).hide();
303
  if (localStorage.getItem("bwg_selected_images")) {
304
  var bwg_selected_images = localStorage.getItem("bwg_selected_images").split(",");
298
  'allowed_upload_types' : '<?php _e('Allowed upload types JPG, JPEG, GIF, PNG, SVG.', BWG()->prefix); ?>'
299
  };
300
  last_uploaded = [];
301
+ jQuery(function() {
302
  jQuery("#loading_div", window.parent.document).hide();
303
  if (localStorage.getItem("bwg_selected_images")) {
304
  var bwg_selected_images = localStorage.getItem("bwg_selected_images").split(",");
framework/WDWLibrary.php CHANGED
@@ -1051,7 +1051,13 @@ class WDWLibrary {
1051
  $post = get_post($post_id);
1052
  if ( !is_null($post) && $post->post_name != $slug ) {
1053
  global $wpdb;
1054
- $wpdb->update($wpdb->prefix . 'bwg_gallery', array('slug' => $post->post_name), array('id' => $params['id']));
 
 
 
 
 
 
1055
  }
1056
  }
1057
  }
@@ -1217,10 +1223,12 @@ class WDWLibrary {
1217
  }
1218
 
1219
  public static function get_image_rows_data( $gallery_id, $bwg, $type, $tag_input_name, $tag, $images_per_page, $load_more_image_count, $sort_by, $sort_direction = 'ASC' ) {
 
1220
  $gallery_id = (int) $gallery_id;
1221
  $tag = (int) $tag;
1222
  global $wpdb;
1223
  $bwg_search = trim(self::get('bwg_search_' . $bwg));
 
1224
 
1225
  $join = '';
1226
  $where = '';
@@ -1229,8 +1237,10 @@ class WDWLibrary {
1229
  $alt_search = '(';
1230
  $description_search = '(';
1231
  foreach( $bwg_search_keys as $search_key) {
1232
- $alt_search .= $wpdb->prepare( '`image`.`alt` LIKE "%s" AND ', '%' . trim( $search_key ) . '%' );
1233
- $description_search .= $wpdb->prepare( '`image`.`description` LIKE "%s" AND ', '%' . trim( $search_key ) . '%' );
 
 
1234
  }
1235
  $alt_search = rtrim($alt_search, 'AND ');
1236
  $alt_search .= ')';
@@ -1266,10 +1276,25 @@ class WDWLibrary {
1266
  $_SESSION['bwg_random_seed_' . $bwg] = $bwg_random_seed;
1267
  }
1268
  $limit_str = '';
 
 
 
 
 
 
 
 
 
 
 
 
1269
  if ( $images_per_page ) {
1270
- $limit_str = 'LIMIT ' . $limit . ',' . $items_in_page;
 
 
1271
  }
1272
- $where .= ($gallery_id ? ' AND image.gallery_id = "' . $gallery_id . '" ' : '') . ($tag ? ' AND tag.tag_id = "' . $tag . '" ' : '');
 
1273
  $join = $tag ? 'LEFT JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id' : '';
1274
  if ( self::get($tag_input_name) ) {
1275
  $join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag' . ($gallery_id ? ' WHERE gallery_id="' . $gallery_id . '"' : '') . ' GROUP BY image_id) AS tags ON image.id=tags.image_id';
@@ -1277,9 +1302,11 @@ class WDWLibrary {
1277
  }
1278
  $join .= ' LEFT JOIN '. $wpdb->prefix .'bwg_gallery as gallery ON gallery.id = image.gallery_id';
1279
  $where .= ' AND gallery.published = 1 ';
1280
-
1281
- $rows = $wpdb->get_results('SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where . ' ORDER BY ' . str_replace('RAND()', 'RAND(' . $bwg_random_seed . ')', $sort_by) . ' ' . $sort_direction . ' ' . $limit_str);
1282
- $total = $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where);
 
 
1283
  $page_nav['total'] = $total;
1284
  $page_nav['limit'] = self::get('page_number_' . $bwg, 1, 'intval');
1285
  $images = array();
@@ -1310,16 +1337,29 @@ class WDWLibrary {
1310
  $message_id = 21;
1311
  $options = new WD_BWG_Options();
1312
  if ( $options->built_in_watermark_type != 'none' ) {
1313
- $limitstart = '';
1314
- if ( !$limit ) {
1315
- $limitstart = ' LIMIT 50 OFFSET ' . $limit;
 
 
 
 
 
 
 
1316
  }
1317
- $where = (($gallery_id) ? ' `gallery_id`=' . $gallery_id . ($image_id ? ' AND `id`=' . $image_id : '') : 1);
1318
  $search = WDWLibrary::get( 's', '' );
1319
  if ( $search ) {
1320
- $where .= $wpdb->prepare(' AND `filename` LIKE "%s"', '%' . $search . '%');
 
 
 
 
 
 
1321
  }
1322
- $images = $wpdb->get_results( 'SELECT * FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where . $limitstart );
1323
 
1324
  if ( !empty( $images ) ) {
1325
  switch ( $options->built_in_watermark_type ) {
@@ -1503,16 +1543,25 @@ class WDWLibrary {
1503
  $thumb_width = BWG()->options->upload_thumb_width;
1504
  $width = BWG()->options->upload_img_width;
1505
  global $wpdb;
 
1506
  $where = ($gallery_id) ? ' `gallery_id` = ' . $gallery_id : 1;
 
 
 
 
 
 
1507
  $search = WDWLibrary::get('s', '');
1508
  if ( $search ) {
1509
- $where .= $wpdb->prepare(' AND `filename` LIKE "%s"', '%' . $search . '%');
 
1510
  }
1511
  $limitstart = '';
1512
  if ( !$limit ) {
1513
- $limitstart = ' LIMIT 50 OFFSET ' . $limit;
 
1514
  }
1515
- $images = $wpdb->get_results('SELECT * FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where . $limitstart);
1516
  if ( !empty( $images ) ) {
1517
  foreach ( $images as $image ) {
1518
  if ( preg_match( '/EMBED/', $image->filetype ) == 1 ) {
@@ -2365,23 +2414,27 @@ class WDWLibrary {
2365
  * @param string $where
2366
  * @return array
2367
  */
2368
- public static function update_image_modified_date( $where = '' ) {
2369
  if ( strpos($where, 'pr_' ) !== FALSE ) {
2370
  // Newly added image.
2371
  return;
2372
  }
2373
  global $wpdb;
 
2374
  $time = time();
2375
- $update = $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `modified_date` = "%d" WHERE ' . $where, $time));
2376
- $items = $wpdb->get_results( 'SELECT `gallery_id`, `thumb_url` FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where );
 
 
2377
  if ( !empty($items) ) {
2378
  $thumbs_str = '';
2379
  foreach ( $items as $item ) {
2380
  $thumbs_str = "'" . $item->thumb_url . "',";
2381
  }
2382
  $thumbs_str = rtrim($thumbs_str,',');
2383
- $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_gallery` SET `modified_date` = "' . time() . '" WHERE `preview_image` IN (' . $thumbs_str . ') OR `random_preview_image` IN (' . $thumbs_str . ')');
2384
- $wpdb->query('UPDATE `' . $wpdb->prefix . 'bwg_album` SET `modified_date` = "' . time() . '" WHERE `preview_image` IN (' . $thumbs_str . ') OR `random_preview_image` IN (' . $thumbs_str . ')');
 
2385
  }
2386
 
2387
  return array('status' => $update, 'modified_date' => $time );
1051
  $post = get_post($post_id);
1052
  if ( !is_null($post) && $post->post_name != $slug ) {
1053
  global $wpdb;
1054
+ $wpdb->update(
1055
+ $wpdb->prefix . 'bwg_gallery',
1056
+ array('slug' => $post->post_name),
1057
+ array('id' => $params['id']),
1058
+ array('%s'),
1059
+ array('%d')
1060
+ );
1061
  }
1062
  }
1063
  }
1223
  }
1224
 
1225
  public static function get_image_rows_data( $gallery_id, $bwg, $type, $tag_input_name, $tag, $images_per_page, $load_more_image_count, $sort_by, $sort_direction = 'ASC' ) {
1226
+
1227
  $gallery_id = (int) $gallery_id;
1228
  $tag = (int) $tag;
1229
  global $wpdb;
1230
  $bwg_search = trim(self::get('bwg_search_' . $bwg));
1231
+ $prepareArgs = array();
1232
 
1233
  $join = '';
1234
  $where = '';
1237
  $alt_search = '(';
1238
  $description_search = '(';
1239
  foreach( $bwg_search_keys as $search_key) {
1240
+ $alt_search .= '`image`.`alt` LIKE %s AND ';
1241
+ $description_search .= '`image`.`description` LIKE %s AND ';
1242
+ $prepareArgs[] = "%" . trim($search_key) . "%";
1243
+ $prepareArgs[] = "%" . trim($search_key) . "%";
1244
  }
1245
  $alt_search = rtrim($alt_search, 'AND ');
1246
  $alt_search .= ')';
1276
  $_SESSION['bwg_random_seed_' . $bwg] = $bwg_random_seed;
1277
  }
1278
  $limit_str = '';
1279
+
1280
+ //$where .= ($gallery_id ? ' AND image.gallery_id = "' . $gallery_id . '" ' : '') . ($tag ? ' AND tag.tag_id = "' . $tag . '" ' : '');
1281
+ if($gallery_id) {
1282
+ $where .= ' AND image.gallery_id = %d ';
1283
+ $prepareArgs[] = $gallery_id;
1284
+ }
1285
+ if($tag) {
1286
+ $where .= ' AND tag.tag_id = %d ';
1287
+ $prepareArgs[] = $tag;
1288
+ }
1289
+
1290
+
1291
  if ( $images_per_page ) {
1292
+ $limit_str .= 'LIMIT %d, %d';
1293
+ $prepareArgs[] = $limit;
1294
+ $prepareArgs[] = $items_in_page;
1295
  }
1296
+
1297
+
1298
  $join = $tag ? 'LEFT JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id' : '';
1299
  if ( self::get($tag_input_name) ) {
1300
  $join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag' . ($gallery_id ? ' WHERE gallery_id="' . $gallery_id . '"' : '') . ' GROUP BY image_id) AS tags ON image.id=tags.image_id';
1302
  }
1303
  $join .= ' LEFT JOIN '. $wpdb->prefix .'bwg_gallery as gallery ON gallery.id = image.gallery_id';
1304
  $where .= ' AND gallery.published = 1 ';
1305
+ $rows = $wpdb->get_results($wpdb->prepare('SELECT image.* FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where . ' ORDER BY ' . str_replace('RAND()', 'RAND(' . $bwg_random_seed . ')', $sort_by) . ' ' . $sort_direction . ' ' . $limit_str, $prepareArgs));
1306
+ if ( $images_per_page ) {
1307
+ array_splice($prepareArgs, -2);
1308
+ }
1309
+ $total = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $wpdb->prefix . 'bwg_image as image ' . $join . ' WHERE image.published=1 ' . $where, $prepareArgs));
1310
  $page_nav['total'] = $total;
1311
  $page_nav['limit'] = self::get('page_number_' . $bwg, 1, 'intval');
1312
  $images = array();
1337
  $message_id = 21;
1338
  $options = new WD_BWG_Options();
1339
  if ( $options->built_in_watermark_type != 'none' ) {
1340
+ $prepareArgs = array();
1341
+ if ( $gallery_id ) {
1342
+ $where = ' `gallery_id`=%d';
1343
+ $prepareArgs[] = $gallery_id;
1344
+ if ( $image_id ) {
1345
+ $where .= ' AND `id`=%d';
1346
+ $prepareArgs[] = $image_id;
1347
+ }
1348
+ } else {
1349
+ $where = 1;
1350
  }
1351
+ //$where = (($gallery_id) ? ' `gallery_id`=' . $gallery_id . ($image_id ? ' AND `id`=' . $image_id : '') : 1);
1352
  $search = WDWLibrary::get( 's', '' );
1353
  if ( $search ) {
1354
+ $where .= ' AND `filename` LIKE "%s"';
1355
+ $prepareArgs[] = "%" . $search . "%";
1356
+ }
1357
+ $limitstart = '';
1358
+ if ( !$limit ) {
1359
+ $limitstart = ' LIMIT 50 OFFSET %d';
1360
+ $prepareArgs[] = $limit;
1361
  }
1362
+ $images = $wpdb->get_results( $wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where . $limitstart, $prepareArgs) );
1363
 
1364
  if ( !empty( $images ) ) {
1365
  switch ( $options->built_in_watermark_type ) {
1543
  $thumb_width = BWG()->options->upload_thumb_width;
1544
  $width = BWG()->options->upload_img_width;
1545
  global $wpdb;
1546
+ $prepareArgs = array();
1547
  $where = ($gallery_id) ? ' `gallery_id` = ' . $gallery_id : 1;
1548
+ if ( $gallery_id ) {
1549
+ $where = ' `gallery_id` = %d';
1550
+ $prepareArgs[] = $gallery_id;
1551
+ } else {
1552
+ $where = 1;
1553
+ }
1554
  $search = WDWLibrary::get('s', '');
1555
  if ( $search ) {
1556
+ $where .= ' AND `filename` LIKE %s';
1557
+ $prepareArgs[] = "%" . $search . "%";
1558
  }
1559
  $limitstart = '';
1560
  if ( !$limit ) {
1561
+ $limitstart = ' LIMIT 50 OFFSET %d';
1562
+ $prepareArgs[] = $limit;
1563
  }
1564
+ $images = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where . $limitstart, $prepareArgs));
1565
  if ( !empty( $images ) ) {
1566
  foreach ( $images as $image ) {
1567
  if ( preg_match( '/EMBED/', $image->filetype ) == 1 ) {
2414
  * @param string $where
2415
  * @return array
2416
  */
2417
+ public static function update_image_modified_date( $where = '', $prepareArgs = array() ) {
2418
  if ( strpos($where, 'pr_' ) !== FALSE ) {
2419
  // Newly added image.
2420
  return;
2421
  }
2422
  global $wpdb;
2423
+
2424
  $time = time();
2425
+ $newPrepareArgs = $prepareArgs;
2426
+ array_unshift($newPrepareArgs , $time);
2427
+ $update = $wpdb->query( $wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_image` SET `modified_date` = "%d" WHERE ' . $where, $newPrepareArgs) );
2428
+ $items = $wpdb->get_results( $wpdb->prepare('SELECT `gallery_id`, `thumb_url` FROM `' . $wpdb->prefix . 'bwg_image` WHERE ' . $where, $prepareArgs) );
2429
  if ( !empty($items) ) {
2430
  $thumbs_str = '';
2431
  foreach ( $items as $item ) {
2432
  $thumbs_str = "'" . $item->thumb_url . "',";
2433
  }
2434
  $thumbs_str = rtrim($thumbs_str,',');
2435
+
2436
+ $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_gallery` SET `modified_date` = "' . time() . '" WHERE `preview_image` IN (' . $thumbs_str . ') OR `random_preview_image` IN (' . $thumbs_str . ')', array('%d','%s','%s')));
2437
+ $wpdb->query($wpdb->prepare('UPDATE `' . $wpdb->prefix . 'bwg_album` SET `modified_date` = "' . time() . '" WHERE `preview_image` IN (' . $thumbs_str . ') OR `random_preview_image` IN (' . $thumbs_str . ')', array('%d','%s','%s')));
2438
  }
2439
 
2440
  return array('status' => $update, 'modified_date' => $time );
framework/WDWLibraryEmbed.php CHANGED
@@ -800,7 +800,7 @@ class WDWLibraryEmbed {
800
  if ( empty($images_new) ) {
801
  return array(false, "Cannot get social data");
802
  }
803
- $images = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "bwg_image WHERE gallery_id = '" . $id . "' ", OBJECT);
804
  $images_count = sizeof($images);
805
 
806
  $images_update = array(); /*ids and orders of images existing in both arrays*/
@@ -894,25 +894,30 @@ class WDWLibraryEmbed {
894
  if($images_count != 0){
895
  if($to_unpublish){
896
  foreach ($images_dated as $image) {
897
- $q = 'UPDATE ' . $wpdb->prefix . 'bwg_image SET published=0, `order` ='.$image['order'].' WHERE `id`='.$image['id'];
898
- $wpdb->query($q);
899
  }
900
  }
901
  else {
902
  foreach ($images_dated as $image) {
903
- $q = 'UPDATE ' . $wpdb->prefix . 'bwg_image SET `order` ='.$image['order'].' WHERE `id`='.$image['id'];
904
- $wpdb->query($q);
905
  }
906
  }
907
 
908
  foreach ($images_update as $image) {
909
- $save = $wpdb->update($wpdb->prefix . 'bwg_image', array(
 
910
  'order' => $image['order'],
911
  'slug' => self::spider_replace4byte($image['slug']),
912
  'description' => self::spider_replace4byte($image['description']),
913
  'alt' => self::spider_replace4byte($image['alt']),
914
  'date' => $image['date']
915
- ), array('id' => $image['id']));
 
 
 
 
916
  }
917
  }
918
  /*add new images*/
@@ -936,9 +941,32 @@ class WDWLibraryEmbed {
936
  'comment_count' => $image['comment_count'],
937
  'avg_rating' => $image['avg_rating'],
938
  'rate_count' => $image['rate_count'],
939
- 'hit_count' => $image['hit_count'],
940
- 'redirect_url' => $image['redirect_url'],
941
- ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
942
  }
943
 
944
  $time = date('d F Y, H:i');
800
  if ( empty($images_new) ) {
801
  return array(false, "Cannot get social data");
802
  }
803
+ $images = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "bwg_image WHERE gallery_id = %d", $id), OBJECT);
804
  $images_count = sizeof($images);
805
 
806
  $images_update = array(); /*ids and orders of images existing in both arrays*/
894
  if($images_count != 0){
895
  if($to_unpublish){
896
  foreach ($images_dated as $image) {
897
+ $q = 'UPDATE ' . $wpdb->prefix . 'bwg_image SET published=0, `order` =%s WHERE `id`=%d';
898
+ $wpdb->query( $wpdb->prepare($q, array($image['order'], $image['id'])) );
899
  }
900
  }
901
  else {
902
  foreach ($images_dated as $image) {
903
+ $q = 'UPDATE ' . $wpdb->prefix . 'bwg_image SET `order` =%s WHERE `id`=%d';
904
+ $wpdb->query( $wpdb->prepare($q, array($image['order'], $image['id'])) );
905
  }
906
  }
907
 
908
  foreach ($images_update as $image) {
909
+ $save = $wpdb->update($wpdb->prefix . 'bwg_image',
910
+ array(
911
  'order' => $image['order'],
912
  'slug' => self::spider_replace4byte($image['slug']),
913
  'description' => self::spider_replace4byte($image['description']),
914
  'alt' => self::spider_replace4byte($image['alt']),
915
  'date' => $image['date']
916
+ ),
917
+ array('id' => $image['id']),
918
+ array('%s','%s','%s','%s','%s'),
919
+ array('%d')
920
+ );
921
  }
922
  }
923
  /*add new images*/
941
  'comment_count' => $image['comment_count'],
942
  'avg_rating' => $image['avg_rating'],
943
  'rate_count' => $image['rate_count'],
944
+ ),
945
+ array(
946
+ '%d',
947
+ '%s',
948
+ '%s',
949
+ '%s',
950
+ '%s',
951
+ '%s',
952
+ '%s',
953
+ '%s',
954
+ '%s',
955
+ '%s',
956
+ '%s',
957
+ '%s',
958
+ '%d',
959
+ '%d',
960
+ '%d',
961
+ '%d',
962
+ '%f',
963
+ '%d',
964
+ '%d',
965
+ '%s',
966
+ '%d',
967
+ '%d',
968
+ )
969
+ );
970
  }
971
 
972
  $time = date('d F Y, H:i');
framework/howto/howto.php CHANGED
@@ -12,7 +12,7 @@ wp_print_scripts('jquery-ui-tabs');
12
  jQuery('.wd-howto-menu').toggleClass('wd-howto-menu-opened');
13
  jQuery('.wd-howto-menu-overlay').toggleClass('hidden');
14
  }
15
- jQuery(document).ready(function () {
16
  jQuery('#wd_howto_wrap').tabs({
17
  activate: function() {
18
  if (jQuery('#wd_howto_wrap .wd-howto-menu').hasClass('wd-howto-menu-opened')) {
12
  jQuery('.wd-howto-menu').toggleClass('wd-howto-menu-opened');
13
  jQuery('.wd-howto-menu-overlay').toggleClass('hidden');
14
  }
15
+ jQuery(function() {
16
  jQuery('#wd_howto_wrap').tabs({
17
  activate: function() {
18
  if (jQuery('#wd_howto_wrap .wd-howto-menu').hasClass('wd-howto-menu-opened')) {
frontend/controllers/BWGControllerGalleryBox.php CHANGED
@@ -42,7 +42,8 @@ class BWGControllerGalleryBox {
42
  $wpdb->update($wpdb->prefix . 'bwg_image', array(
43
  'avg_rating' => $rates->average,
44
  'rate_count' => $rates->rate_count
45
- ), array( 'id' => $image_id ));
 
46
  $this->display();
47
  }
48
 
42
  $wpdb->update($wpdb->prefix . 'bwg_image', array(
43
  'avg_rating' => $rates->average,
44
  'rate_count' => $rates->rate_count
45
+ ), array( 'id' => $image_id ),
46
+ array('%f','%d'),array('%d'));
47
  $this->display();
48
  }
49
 
frontend/models/BWGModelGalleryBox.php CHANGED
@@ -8,7 +8,6 @@ class BWGModelGalleryBox {
8
 
9
  public function get_image_rows_data($gallery_id, $bwg, $sort_by, $order_by = 'asc', $tag = 0) {
10
  global $wpdb;
11
-
12
  $bwg_sort_by_temp = WDWLibrary::get('filtersortby', '');
13
  if ( $bwg_sort_by_temp == '' ) { /* for thumbnail view */
14
  $bwg_sort_by_temp = WDWLibrary::get('filtersortby_' . $bwg, ''); /* for other views */
@@ -68,8 +67,10 @@ class BWGModelGalleryBox {
68
  $alt_search = '(';
69
  $description_search = '(';
70
  foreach( $bwg_search_keys as $search_key) {
71
- $alt_search .= $wpdb->prepare('`image`.`alt` LIKE "%s" AND ', '%' . trim($search_key) . '%');
72
- $description_search .= $wpdb->prepare('`image`.`description` LIKE "%s" AND ', '%' . trim($search_key) . '%');
 
 
73
  }
74
  $alt_search = rtrim($alt_search, 'AND ');
75
  $alt_search .= ')';
@@ -77,7 +78,15 @@ class BWGModelGalleryBox {
77
  $description_search .= ')';
78
  $where = 'AND (' . $alt_search . ' OR ' . $description_search . ')';
79
  }
80
- $where .= ($gallery_id ? ' AND image.gallery_id = "' . $gallery_id . '" ' : '') . ($tag ? ' AND tag.tag_id = "' . $tag . '" ' : '');
 
 
 
 
 
 
 
 
81
  $join = $tag ? 'LEFT JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id' : '';
82
 
83
  $join .= ' LEFT JOIN '. $wpdb->prefix .'bwg_gallery as gallery ON image.gallery_id = gallery.id ';
@@ -94,13 +103,18 @@ class BWGModelGalleryBox {
94
  sort($filter_tags);
95
  $compare_sign = ",";
96
  }
97
- $join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id order by tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag' . ($gallery_id ? ' WHERE gallery_id="' . $gallery_id . '"' : '') . ' GROUP BY image_id) AS tags ON image.id=tags.image_id';
 
 
 
 
 
98
  $where .= ' AND CONCAT(",", tags.tags_combined, ",") REGEXP ",(' . implode($compare_sign, $filter_tags) . ')," ';
99
  }
100
 
101
  $query = 'SELECT image.*, rates.rate FROM ' . $wpdb->prefix . 'bwg_image as image LEFT JOIN (SELECT rate, image_id FROM ' . $wpdb->prefix . 'bwg_image_rate WHERE ip="' . $_SERVER['REMOTE_ADDR'] . '") as rates ON image.id=rates.image_id ' . $join . ' WHERE image.published=1 ' . $where;
102
  $query .= ' ORDER BY ' . str_replace('RAND()', 'RAND(' . $bwg_random_seed . ')', $sort_by) . ' ' . $order_by . ', image.id asc';
103
- $rows = $wpdb->get_results($query);
104
 
105
  $images = array();
106
  if ( !empty($rows) ) {
8
 
9
  public function get_image_rows_data($gallery_id, $bwg, $sort_by, $order_by = 'asc', $tag = 0) {
10
  global $wpdb;
 
11
  $bwg_sort_by_temp = WDWLibrary::get('filtersortby', '');
12
  if ( $bwg_sort_by_temp == '' ) { /* for thumbnail view */
13
  $bwg_sort_by_temp = WDWLibrary::get('filtersortby_' . $bwg, ''); /* for other views */
67
  $alt_search = '(';
68
  $description_search = '(';
69
  foreach( $bwg_search_keys as $search_key) {
70
+ $alt_search .= '`image`.`alt` LIKE %s AND ';
71
+ $description_search .= '`image`.`description` LIKE %s AND ';
72
+ $prepareArgs[] = "%" . trim($search_key) . "%";
73
+ $prepareArgs[] = "%" . trim($search_key) . "%";
74
  }
75
  $alt_search = rtrim($alt_search, 'AND ');
76
  $alt_search .= ')';
78
  $description_search .= ')';
79
  $where = 'AND (' . $alt_search . ' OR ' . $description_search . ')';
80
  }
81
+ if( $gallery_id ) {
82
+ $where .= ' AND image.gallery_id = %d ';
83
+ $prepareArgs[] = $gallery_id;
84
+ }
85
+ if( $tag ) {
86
+ $where .= ' AND tag.tag_id = %d ';
87
+ $prepareArgs[] = $tag;
88
+ }
89
+
90
  $join = $tag ? 'LEFT JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id' : '';
91
 
92
  $join .= ' LEFT JOIN '. $wpdb->prefix .'bwg_gallery as gallery ON image.gallery_id = gallery.id ';
103
  sort($filter_tags);
104
  $compare_sign = ",";
105
  }
106
+ if( $gallery_id ) {
107
+ $join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id order by tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag WHERE gallery_id=%d GROUP BY image_id) AS tags ON image.id=tags.image_id';
108
+ array_unshift($prepareArgs , $gallery_id);
109
+ } else {
110
+ $join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id order by tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag GROUP BY image_id) AS tags ON image.id=tags.image_id';
111
+ }
112
  $where .= ' AND CONCAT(",", tags.tags_combined, ",") REGEXP ",(' . implode($compare_sign, $filter_tags) . ')," ';
113
  }
114
 
115
  $query = 'SELECT image.*, rates.rate FROM ' . $wpdb->prefix . 'bwg_image as image LEFT JOIN (SELECT rate, image_id FROM ' . $wpdb->prefix . 'bwg_image_rate WHERE ip="' . $_SERVER['REMOTE_ADDR'] . '") as rates ON image.id=rates.image_id ' . $join . ' WHERE image.published=1 ' . $where;
116
  $query .= ' ORDER BY ' . str_replace('RAND()', 'RAND(' . $bwg_random_seed . ')', $sort_by) . ' ' . $order_by . ', image.id asc';
117
+ $rows = $wpdb->get_results( $wpdb->prepare($query, $prepareArgs) );
118
 
119
  $images = array();
120
  if ( !empty($rows) ) {
frontend/models/BWGModelWidget.php CHANGED
@@ -3,7 +3,13 @@ class BWGModelWidgetFrontEnd {
3
  public function get_tags_data($count = 0) {
4
  global $wpdb;
5
  $count = abs(intval($count));
6
- $rows = $wpdb->get_results('SELECT
 
 
 
 
 
 
7
  `image`.`thumb_url` AS `thumb_url`,
8
  `image`.`id` AS `image_id`,
9
  `tags`.`name`,
@@ -14,7 +20,7 @@ class BWGModelWidgetFrontEnd {
14
  INNER JOIN ' . $wpdb->prefix . 'term_taxonomy AS taxonomy ON taxonomy.term_id=tags.term_id
15
  INNER JOIN
16
  (SELECT `image`.`thumb_url`, `tag`.`tag_id`, `image`.`id`, `image`.`filetype` FROM ' . $wpdb->prefix . 'bwg_image AS image
17
- INNER JOIN ' . $wpdb->prefix . 'bwg_image_tag AS tag ON image.id=tag.image_id ORDER BY RAND()) AS image ON image.tag_id=tags.term_id WHERE taxonomy.taxonomy="bwg_tag" GROUP BY tags.term_id' . ($count ? ' LIMIT ' . $count : ""));
18
  foreach ( $rows as $row ) {
19
  $row->permalink = WDWLibrary::get_custom_post_permalink(array( 'slug' => $row->slug, 'post_type' => 'tag' ));
20
  }
3
  public function get_tags_data($count = 0) {
4
  global $wpdb;
5
  $count = abs(intval($count));
6
+ $limit = '';
7
+ $format = '';
8
+ if($count) {
9
+ $limit = ' LIMIT %';
10
+ $format = $count;
11
+ }
12
+ $rows = $wpdb->get_results($wpdb->prepare('SELECT
13
  `image`.`thumb_url` AS `thumb_url`,
14
  `image`.`id` AS `image_id`,
15
  `tags`.`name`,
20
  INNER JOIN ' . $wpdb->prefix . 'term_taxonomy AS taxonomy ON taxonomy.term_id=tags.term_id
21
  INNER JOIN
22
  (SELECT `image`.`thumb_url`, `tag`.`tag_id`, `image`.`id`, `image`.`filetype` FROM ' . $wpdb->prefix . 'bwg_image AS image
23
+ INNER JOIN ' . $wpdb->prefix . 'bwg_image_tag AS tag ON image.id=tag.image_id ORDER BY RAND()) AS image ON image.tag_id=tags.term_id WHERE taxonomy.taxonomy="bwg_tag" GROUP BY tags.term_id' . $limit, $format));
24
  foreach ( $rows as $row ) {
25
  $row->permalink = WDWLibrary::get_custom_post_permalink(array( 'slug' => $row->slug, 'post_type' => 'tag' ));
26
  }
frontend/models/model.php CHANGED
@@ -72,10 +72,11 @@ class BWGModelSite {
72
  global $wpdb;
73
  $gallery_id = (int) $gallery_id;
74
  $tag = (int) $tag;
75
- $bwg_search = trim( WDWLibrary::get('bwg_search_' . $bwg) );
76
  if ( BWG()->options->front_ajax == "1" ) {
77
  $sort_by = trim( WDWLibrary::get('sort_by_' . $bwg, $sort_by ) );
78
  $filter_teg = trim( WDWLibrary::get('filter_tag_' . $bwg) );
 
79
  if ( !empty($filter_teg) ) {
80
  $filter_teg_arr = explode(',', trim($filter_teg));
81
  $_REQUEST[$tag_input_name] = $filter_teg_arr;
@@ -87,8 +88,8 @@ class BWGModelSite {
87
  $alt_search = '(';
88
  $description_search = '(';
89
  foreach( $bwg_search_keys as $search_key) {
90
- $alt_search .= $wpdb->prepare('`image`.`alt` LIKE "%s" AND ', '%' . trim($search_key) . '%');
91
- $description_search .= $wpdb->prepare('`image`.`description` LIKE "%s" AND ', '%' . trim($search_key) . '%');
92
  }
93
  $alt_search = rtrim($alt_search, 'AND ');
94
  $alt_search .= ')';
@@ -111,7 +112,7 @@ class BWGModelSite {
111
  $items_in_page = $images_per_page;
112
  $limit = 0;
113
  WDWLibrary::bwg_session_start();
114
- $page_number = WDWLibrary::get('page_number_' . $bwg, 0, 'intval');
115
  if ( $page_number ) {
116
  if ( $page_number > 1 ) {
117
  $items_in_page = $load_more_image_count;
@@ -127,7 +128,7 @@ class BWGModelSite {
127
  if ( $images_per_page ) {
128
  $limit_str = 'LIMIT ' . $limit . ',' . $items_in_page;
129
  }
130
- $where .= ($gallery_id ? ' AND image.gallery_id = "' . $gallery_id . '" ' : '') . ($tag ? ' AND tag.tag_id = "' . $tag . '" ' : '');
131
  $join = $tag ? 'LEFT JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id' : '';
132
 
133
  $filter_tags_name = WDWLibrary::get($tag_input_name, '', 'sanitize_text_field', 'REQUEST');
@@ -142,8 +143,8 @@ class BWGModelSite {
142
  sort( $filter_tags_name );
143
  $compare_sign = ",";
144
  }
145
- $join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id order by tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag' . ($gallery_id ? ' WHERE gallery_id="' . $gallery_id . '"' : '') . ' GROUP BY image_id) AS tags ON image.id=tags.image_id';
146
- $where .= $wpdb->prepare(' AND CONCAT(",", tags.tags_combined, ",") REGEXP "%s" ', ',(' . implode( $compare_sign, $filter_tags_name ) . '),');
147
  }
148
  $join .= ' LEFT JOIN '. $wpdb->prefix .'bwg_gallery as gallery ON gallery.id = image.gallery_id';
149
  $where .= ' AND gallery.published = 1 ';
@@ -165,7 +166,7 @@ class BWGModelSite {
165
  $row->image_url = WDWLibrary::image_url_version($row->image_url, $row->modified_date);
166
  $row->thumb_url = WDWLibrary::image_url_version($row->thumb_url, $row->modified_date);
167
  // To disable Jetpack Photon module.
168
- $thumb_urls[] = BWG()->upload_url . $row->thumb_url;
169
  }
170
  else {
171
  // To disable Jetpack Photon module.
@@ -183,19 +184,32 @@ class BWGModelSite {
183
  * Inner Gallery Groups data will not be included in sitemap.
184
  */
185
  public function get_image_rows_data_from_album($album_id) {
 
186
  global $wpdb;
187
- $where = $album_id ? 'image.gallery_id IN (SELECT alb_gal_id FROM `' . $wpdb->prefix . 'bwg_album_gallery` as albgal WHERE albgal.album_id=' . ((int)$album_id) . ' AND (SELECT gal.published from `' . $wpdb->prefix . 'bwg_gallery` as gal WHERE gal.id=albgal.alb_gal_id))' : '(SELECT gal.published from `' . $wpdb->prefix . 'bwg_gallery` as gal WHERE gal.id=image.gallery_id)=1';
 
 
 
 
 
 
 
188
  $query = 'SELECT image.* FROM `' . $wpdb->prefix . 'bwg_image` as image WHERE image.published=1 AND ' . $where;
189
- return $wpdb->get_results($query);
190
  }
191
 
192
  public function get_tags_rows_data($gallery_id) {
193
  global $wpdb;
194
- $row = $wpdb->get_results('Select t1.* FROM ' . $wpdb->prefix . 'terms AS t1 LEFT JOIN ' . $wpdb->prefix . 'term_taxonomy AS t2 ON t1.term_id = t2.term_id' . ($gallery_id ? ' LEFT JOIN (SELECT DISTINCT tag_id , gallery_id FROM ' . $wpdb->prefix . 'bwg_image_tag) AS t3 ON t1.term_id=t3.tag_id' : '') . ' WHERE taxonomy="bwg_tag"' . ($gallery_id ? ' AND t3.gallery_id="' . $gallery_id . '"' : '') . ' ORDER BY t1.name ASC');
 
 
 
 
195
  return $row;
196
  }
197
 
198
  public function get_alb_gals_row( $bwg, $id, $albums_per_page, $sort_by, $order_by, $pagination_type = 0, $from = '' ) {
 
199
  if ( $albums_per_page < 0 ) {
200
  $albums_per_page = 0;
201
  }
@@ -210,15 +224,18 @@ class BWGModelSite {
210
  $search_keys = explode( ' ', $search_value );
211
  $alt_search = '(';
212
  $description_search = '(';
213
- foreach ( $search_keys as $search_key ) {
214
- $alt_search .= $wpdb->prepare( '`{{table}}`.`name` LIKE "%s" AND ', '%' . trim( $search_key ) . '%' );
215
- $description_search .= $wpdb->prepare( '`{{table}}`.`description` LIKE "%s" AND ', '%' . trim( $search_key ) . '%' );
 
 
216
  }
217
  $alt_search = rtrim( $alt_search, 'AND ' );
218
  $alt_search .= ')';
219
  $description_search = rtrim( $description_search, 'AND ' );
220
  $description_search .= ')';
221
  $search_where = ' AND (' . $alt_search . ' OR ' . $description_search . ')';
 
222
  }
223
  $limit = 0;
224
  $page_number = WDWLibrary::get( 'page_number_' . $bwg, 0, 'intval' );
@@ -239,14 +256,15 @@ class BWGModelSite {
239
  }
240
  // Select all galleries.
241
  if ( $id == 0 ) {
242
- $query = 'SELECT * FROM `' . $wpdb->prefix . 'bwg_gallery` WHERE `published`=1' . str_replace( '{{table}}', $wpdb->prefix . 'bwg_gallery', $search_where );
243
  $limitation = ' ' . $order_by . ' ' . $limit_str;
244
  $sql = $query . $limitation;
245
- $rows = $wpdb->get_results( $sql );
246
- $total = $wpdb->get_var( 'SELECT count(*) FROM `' . $wpdb->prefix . 'bwg_gallery` WHERE `published`=1' . str_replace( '{{table}}', $wpdb->prefix . 'bwg_gallery', $search_where ) );
247
  }
248
  else {
249
- $query = '( SELECT t.*, t1.preview_image, t1.random_preview_image, t1.name, t1.description, t1.slug, t1.modified_date FROM `' . $wpdb->prefix . 'bwg_album_gallery` as t';
 
250
  $query .= ' LEFT JOIN `' . $wpdb->prefix . 'bwg_album` as t1 ON (t.is_album=1 AND t.alb_gal_id = t1.id)';
251
  $query .= ' WHERE t.album_id="' . $id . '"';
252
  $query .= ' AND t1.published=1' . str_replace( '{{table}}', 't1', $search_where );
@@ -259,8 +277,8 @@ class BWGModelSite {
259
  $query .= ')';
260
  $limitation = ' ' . $order_by . ' ' . $limit_str;
261
  $sql = $query . $limitation;
262
- $rows = $wpdb->get_results( $sql );
263
- $total = count( $wpdb->get_results( $query ) );
264
  }
265
  if ( $rows ) {
266
  foreach ( $rows as $row ) {
@@ -330,7 +348,7 @@ class BWGModelSite {
330
  */
331
  public function get_album_preview_thumb_dimensions( $thumb_url ) {
332
  global $wpdb;
333
- $resolution = $wpdb->get_var('SELECT resolution_thumb FROM ' . $wpdb->prefix . 'bwg_image WHERE thumb_url = "' . $thumb_url . '"');
334
  return $resolution;
335
  }
336
  }
72
  global $wpdb;
73
  $gallery_id = (int) $gallery_id;
74
  $tag = (int) $tag;
75
+ $bwg_search = trim( WDWLibrary::get('bwg_search_' . $bwg) );
76
  if ( BWG()->options->front_ajax == "1" ) {
77
  $sort_by = trim( WDWLibrary::get('sort_by_' . $bwg, $sort_by ) );
78
  $filter_teg = trim( WDWLibrary::get('filter_tag_' . $bwg) );
79
+
80
  if ( !empty($filter_teg) ) {
81
  $filter_teg_arr = explode(',', trim($filter_teg));
82
  $_REQUEST[$tag_input_name] = $filter_teg_arr;
88
  $alt_search = '(';
89
  $description_search = '(';
90
  foreach( $bwg_search_keys as $search_key) {
91
+ $alt_search .= $wpdb->prepare('`image`.`alt` LIKE %s', "%" . trim($search_key) . "%");
92
+ $description_search .= $wpdb->prepare('`image`.`description` LIKE %s AND ', "%" . trim($search_key) . "%");
93
  }
94
  $alt_search = rtrim($alt_search, 'AND ');
95
  $alt_search .= ')';
112
  $items_in_page = $images_per_page;
113
  $limit = 0;
114
  WDWLibrary::bwg_session_start();
115
+ $page_number = WDWLibrary::get('page_number_' . $bwg, 0, 'intval');
116
  if ( $page_number ) {
117
  if ( $page_number > 1 ) {
118
  $items_in_page = $load_more_image_count;
128
  if ( $images_per_page ) {
129
  $limit_str = 'LIMIT ' . $limit . ',' . $items_in_page;
130
  }
131
+ $where .= ($gallery_id ? $wpdb->prepare(' AND image.gallery_id = %d ', $gallery_id) : '') . ($tag ? $wpdb->prepare(' AND tag.tag_id = %d ', $tag) : '');
132
  $join = $tag ? 'LEFT JOIN ' . $wpdb->prefix . 'bwg_image_tag as tag ON image.id=tag.image_id' : '';
133
 
134
  $filter_tags_name = WDWLibrary::get($tag_input_name, '', 'sanitize_text_field', 'REQUEST');
143
  sort( $filter_tags_name );
144
  $compare_sign = ",";
145
  }
146
+ $join .= ' LEFT JOIN (SELECT GROUP_CONCAT(tag_id order by tag_id SEPARATOR ",") AS tags_combined, image_id FROM ' . $wpdb->prefix . 'bwg_image_tag' . ($gallery_id ? $wpdb->prepare(' WHERE gallery_id=%d', $gallery_id) : '') . ' GROUP BY image_id) AS tags ON image.id=tags.image_id';
147
+ $where .= ' AND CONCAT(",", tags.tags_combined, ",") REGEXP ",(' . implode( $compare_sign, $filter_tags_name ) . ')," ';
148
  }
149
  $join .= ' LEFT JOIN '. $wpdb->prefix .'bwg_gallery as gallery ON gallery.id = image.gallery_id';
150
  $where .= ' AND gallery.published = 1 ';
166
  $row->image_url = WDWLibrary::image_url_version($row->image_url, $row->modified_date);
167
  $row->thumb_url = WDWLibrary::image_url_version($row->thumb_url, $row->modified_date);
168
  // To disable Jetpack Photon module.
169
+ $thumb_urls[] = BWG()->upload_url . $row->thumb_url;
170
  }
171
  else {
172
  // To disable Jetpack Photon module.
184
  * Inner Gallery Groups data will not be included in sitemap.
185
  */
186
  public function get_image_rows_data_from_album($album_id) {
187
+
188
  global $wpdb;
189
+ $format = '';
190
+ if( $album_id ) {
191
+ $where = 'image.gallery_id IN (SELECT alb_gal_id FROM `' . $wpdb->prefix . 'bwg_album_gallery` as albgal WHERE albgal.album_id=%d AND (SELECT gal.published from `' . $wpdb->prefix . 'bwg_gallery` as gal WHERE gal.id=albgal.alb_gal_id))';
192
+ $format = intval( $album_id );
193
+ } else {
194
+ $where = '(SELECT gal.published from `' . $wpdb->prefix . 'bwg_gallery` as gal WHERE gal.id=image.gallery_id)=1';
195
+ }
196
+
197
  $query = 'SELECT image.* FROM `' . $wpdb->prefix . 'bwg_image` as image WHERE image.published=1 AND ' . $where;
198
+ return $wpdb->get_results($wpdb->prepare($query, $format));
199
  }
200
 
201
  public function get_tags_rows_data($gallery_id) {
202
  global $wpdb;
203
+ $format = '';
204
+ if( $gallery_id ) {
205
+ $format = $gallery_id;
206
+ }
207
+ $row = $wpdb->get_results($wpdb->prepare('Select t1.* FROM ' . $wpdb->prefix . 'terms AS t1 LEFT JOIN ' . $wpdb->prefix . 'term_taxonomy AS t2 ON t1.term_id = t2.term_id' . ($gallery_id ? ' LEFT JOIN (SELECT DISTINCT tag_id , gallery_id FROM ' . $wpdb->prefix . 'bwg_image_tag) AS t3 ON t1.term_id=t3.tag_id' : '') . ' WHERE taxonomy="bwg_tag"' . ($gallery_id ? ' AND t3.gallery_id="%d"' : '') . ' ORDER BY t1.name ASC', $format));
208
  return $row;
209
  }
210
 
211
  public function get_alb_gals_row( $bwg, $id, $albums_per_page, $sort_by, $order_by, $pagination_type = 0, $from = '' ) {
212
+ $prepareArgs = array();
213
  if ( $albums_per_page < 0 ) {
214
  $albums_per_page = 0;
215
  }
224
  $search_keys = explode( ' ', $search_value );
225
  $alt_search = '(';
226
  $description_search = '(';
227
+ foreach( $search_keys as $search_key) {
228
+ $alt_search .= '`{{table}}`.`name` LIKE %s AND ';
229
+ $description_search .= '`{{table}}`.`description` LIKE %s AND ';
230
+ $prepareArgs[] = "%" . trim($search_key) . "%";
231
+ $prepareArgs[] = "%" . trim($search_key) . "%";
232
  }
233
  $alt_search = rtrim( $alt_search, 'AND ' );
234
  $alt_search .= ')';
235
  $description_search = rtrim( $description_search, 'AND ' );
236
  $description_search .= ')';
237
  $search_where = ' AND (' . $alt_search . ' OR ' . $description_search . ')';
238
+
239
  }
240
  $limit = 0;
241
  $page_number = WDWLibrary::get( 'page_number_' . $bwg, 0, 'intval' );
256
  }
257
  // Select all galleries.
258
  if ( $id == 0 ) {
259
+ $query = 'SELECT * FROM `' . $wpdb->prefix . 'bwg_gallery` WHERE `published`=1' . str_replace('{{table}}', $wpdb->prefix . 'bwg_gallery', $search_where);
260
  $limitation = ' ' . $order_by . ' ' . $limit_str;
261
  $sql = $query . $limitation;
262
+ $rows = $wpdb->get_results( $wpdb->prepare($sql,$prepareArgs) );
263
+ $total = $wpdb->get_var($wpdb->prepare('SELECT count(*) FROM `' . $wpdb->prefix . 'bwg_gallery` WHERE `published`=1' . str_replace('{{table}}', $wpdb->prefix . 'bwg_gallery', $search_where),$prepareArgs) );
264
  }
265
  else {
266
+ $prepareArgsnew = array_merge($prepareArgs, $prepareArgs);
267
+ $query = '( SELECT t.*, t1.preview_image, t1.random_preview_image, t1.name, t1.description, t1.slug, t1.modified_date FROM `' . $wpdb->prefix . 'bwg_album_gallery` as t';
268
  $query .= ' LEFT JOIN `' . $wpdb->prefix . 'bwg_album` as t1 ON (t.is_album=1 AND t.alb_gal_id = t1.id)';
269
  $query .= ' WHERE t.album_id="' . $id . '"';
270
  $query .= ' AND t1.published=1' . str_replace( '{{table}}', 't1', $search_where );
277
  $query .= ')';
278
  $limitation = ' ' . $order_by . ' ' . $limit_str;
279
  $sql = $query . $limitation;
280
+ $rows = $wpdb->get_results($wpdb->prepare($sql, $prepareArgs));
281
+ $total = count($wpdb->get_results($wpdb->prepare($query, $prepareArgsnew)));
282
  }
283
  if ( $rows ) {
284
  foreach ( $rows as $row ) {
348
  */
349
  public function get_album_preview_thumb_dimensions( $thumb_url ) {
350
  global $wpdb;
351
+ $resolution = $wpdb->get_var($wpdb->prepare('SELECT resolution_thumb FROM ' . $wpdb->prefix . 'bwg_image WHERE thumb_url = "%s"', $thumb_url));
352
  return $resolution;
353
  }
354
  }
frontend/views/BWGViewAlbum_compact_preview.php CHANGED
@@ -63,7 +63,7 @@ class BWGViewAlbum_compact_preview extends BWGViewSite {
63
  else {
64
  echo '<style id="bwg-style-' . $bwg . '">' . $inline_style . '</style>';
65
  echo '<script id="bwg-script-' . $bwg .'">
66
- jQuery(document).ready(function () {
67
  bwg_main_ready();
68
  });
69
  </script>';
63
  else {
64
  echo '<style id="bwg-style-' . $bwg . '">' . $inline_style . '</style>';
65
  echo '<script id="bwg-script-' . $bwg .'">
66
+ jQuery(function() {
67
  bwg_main_ready();
68
  });
69
  </script>';
frontend/views/BWGViewAlbum_extended_preview.php CHANGED
@@ -69,7 +69,7 @@ class BWGViewAlbum_extended_preview extends BWGViewSite {
69
  else {
70
  echo '<style id="bwg-style-' . $bwg . '">' . $inline_style . '</style>';
71
  echo '<script id="bwg-script-' . $bwg .'">
72
- jQuery(document).ready(function () {
73
  bwg_main_ready();
74
  });
75
  </script>';
69
  else {
70
  echo '<style id="bwg-style-' . $bwg . '">' . $inline_style . '</style>';
71
  echo '<script id="bwg-script-' . $bwg .'">
72
+ jQuery(function() {
73
  bwg_main_ready();
74
  });
75
  </script>';
frontend/views/BWGViewImage_browser.php CHANGED
@@ -64,7 +64,7 @@ class BWGViewImage_browser extends BWGViewSite {
64
  else {
65
  echo '<style id="bwg-style-' . $bwg . '">' . $inline_style . '</style>';
66
  echo '<script id="bwg-script-' . $bwg .'">
67
- jQuery(document).ready(function () {
68
  bwg_main_ready();
69
  });
70
  </script>';
64
  else {
65
  echo '<style id="bwg-style-' . $bwg . '">' . $inline_style . '</style>';
66
  echo '<script id="bwg-script-' . $bwg .'">
67
+ jQuery(function() {
68
  bwg_main_ready();
69
  });
70
  </script>';
frontend/views/BWGViewSlideshow.php CHANGED
@@ -111,7 +111,7 @@ public function display($params = array(), $bwg = 0) {
111
  else {
112
  echo '<style id="bwg-style-' . $bwg . '">' . $inline_style . '</style>';
113
  echo '<script id="bwg-script-' . $bwg .'">
114
- jQuery(document).ready(function () {
115
  bwg_main_ready();
116
  });
117
  </script>';
@@ -141,7 +141,7 @@ public function display($params = array(), $bwg = 0) {
141
  $data[$bwg][$key]["is_embed_video"] = (((preg_match('/EMBED/', $image_row->filetype) == 1) && (preg_match('/_VIDEO/', $image_row->filetype) == 1)) ? TRUE : FALSE);
142
  }
143
  ob_start();
144
- $trans_dur = (($params['slideshow_interval'] < 4) && ($params['slideshow_interval'] != 0)) ? ($params['slideshow_interval'] * 1000) / 4 : ($params['slideshow_effect_duration'] * 1000);
145
  $bwg_param = array(
146
  'bwg_source' => 'slider',
147
  'bwg_current_key' => isset($current_key) ? $current_key : '',
111
  else {
112
  echo '<style id="bwg-style-' . $bwg . '">' . $inline_style . '</style>';
113
  echo '<script id="bwg-script-' . $bwg .'">
114
+ jQuery(function() {
115
  bwg_main_ready();
116
  });
117
  </script>';
141
  $data[$bwg][$key]["is_embed_video"] = (((preg_match('/EMBED/', $image_row->filetype) == 1) && (preg_match('/_VIDEO/', $image_row->filetype) == 1)) ? TRUE : FALSE);
142
  }
143
  ob_start();
144
+ $trans_dur = ((floatval($params['slideshow_interval'] ) < 4) && (floatval($params['slideshow_interval']) != 0)) ? (floatval($params['slideshow_interval']) * 1000) / 4 : (floatval($params['slideshow_effect_duration']) * 1000);
145
  $bwg_param = array(
146
  'bwg_source' => 'slider',
147
  'bwg_current_key' => isset($current_key) ? $current_key : '',
frontend/views/BWGViewThumbnails.php CHANGED
@@ -19,7 +19,7 @@ class BWGViewThumbnails extends BWGViewSite {
19
  else {
20
  echo '<style id="bwg-style-' . $bwg . '">' . $inline_style . '</style>';
21
  echo '<script id="bwg-script-' . $bwg .'">
22
- jQuery(document).ready(function () {
23
  bwg_main_ready();
24
  });
25
  </script>';
19
  else {
20
  echo '<style id="bwg-style-' . $bwg . '">' . $inline_style . '</style>';
21
  echo '<script id="bwg-script-' . $bwg .'">
22
+ jQuery(function() {
23
  bwg_main_ready();
24
  });
25
  </script>';
frontend/views/view.php CHANGED
@@ -137,7 +137,7 @@ class BWGViewSite {
137
  </div>
138
  </div>
139
  <script>
140
- jQuery(document).ready(function () {
141
  bwg_main_ready();
142
  });
143
  </script>
@@ -719,9 +719,9 @@ class BWGViewSite {
719
  return false;
720
  }
721
  }
722
- jQuery(document).ready(function () {
723
  jQuery(window).off("scroll").on("scroll", bwg_scroll_load_action );
724
- });
725
  </script>
726
  <?php
727
  }
137
  </div>
138
  </div>
139
  <script>
140
+ jQuery(function() {
141
  bwg_main_ready();
142
  });
143
  </script>
719
  return false;
720
  }
721
  }
722
+ jQuery(function() {
723
  jQuery(window).off("scroll").on("scroll", bwg_scroll_load_action );
724
+ });
725
  </script>
726
  <?php
727
  }
js/bwg.js CHANGED
@@ -1,119 +1,119 @@
1
- jQuery(document).ready(function () {
2
  /* Change google font for <select>. */
3
- if( jQuery('.google_font').length ) {
4
- jQuery('.google_font').each(function() {
5
- var bwg_google_font = jQuery(this);
6
  bwg_google_font.fontselect();
7
- input_name = jQuery(this).closest('td').find('.radio_google_fonts').children('input').attr('name');
8
  data_view = input_name + '0';
9
- if (jQuery("#" + data_view).is(":checked")) {
10
- bwg_google_font.next('.font-select').hide();
11
- jQuery('#' + input_name).show();
12
  }
13
  else {
14
- bwg_google_font.next('.font-select').show();
15
- jQuery('#' + input_name).hide();
16
  }
17
- })
18
  }
19
- jQuery('.default-font').on( 'change', function() {
20
- jQuery(this).css({'font-family':jQuery(this).val()});
21
  } );
22
 
23
  /* press ESC hide loading. */
24
- jQuery(document).keyup(function(e) {
25
- if ( e.keyCode == 27 ) {
26
- jQuery('#loading_div').hide();
27
  }
28
- });
29
  /* Galleries form. */
30
- if ( jQuery("form").hasClass("bwg_galleries") ) {
31
- if ( jQuery("#tbody_arr").hasClass("bwg-ordering") ) {
32
- wd_showhide_weights();
33
- }
34
  wd_pagination();
35
- if ( jQuery("#bwg-table-sortable").hasClass("bwg-ordering") ) {
36
- bwg_galleries_ordering();
37
- }
38
  }
39
 
40
- jQuery("#check_all").on("click", function () {
41
- spider_check_all("#check_all");
42
- });
43
 
44
  /* Add tooltip to elements with "wd-info" class. */
45
- if ( typeof jQuery(document).tooltip != "undefined" ) {
46
- jQuery(document).tooltip({
47
  show: null,
48
  items: ".wd-info",
49
  content: function () {
50
- var element = jQuery(this);
51
- if (element.is(".wd-info")) {
52
- var html = jQuery('#' + jQuery(this).data("id")).html();
53
  return html;
54
  }
55
  },
56
- open: function (event, ui) {
57
- if (typeof(event.originalEvent) === 'undefined') {
58
  return false;
59
  }
60
- var $id = jQuery(ui.tooltip).attr('id');
61
  /* close any lingering tooltips. */
62
- jQuery('div.ui-tooltip').not('#' + $id).remove();
63
  },
64
- close: function (event, ui) {
65
- ui.tooltip.hover(function () {
66
- jQuery(this).stop(true).fadeTo(400, 1);
67
  },
68
  function () {
69
- jQuery(this).fadeOut('400', function () {
70
- jQuery(this).remove();
71
- });
72
- });
73
  },
74
  position: {
75
  my: "center top+30",
76
  at: "center top",
77
- using: function (position, feedback) {
78
- jQuery(this).css(position);
79
- jQuery("<div>")
80
- .addClass("tooltip-arrow")
81
- .addClass(feedback.vertical)
82
- .addClass(feedback.horizontal)
83
- .appendTo(this);
84
  }
85
  }
86
- });
87
  }
88
 
89
- bwg_change_theme_tab_item();
90
- bwg_filters();
91
- bwg_toggle_postbox();
92
 
93
- jQuery(".bwg_requried").on("keypress", function () {
94
- jQuery(".bwg_requried").removeAttr("style");
95
- });
96
 
97
- jQuery(".wd-filter").on("change", function () {
98
- var form = jQuery(this).parents("form");
99
 
100
- var action = form.attr("action");
101
  action += "&paged=1";
102
- action += "&s=" + jQuery("input[name='s']").val();
103
- action += "&filter-by-gallery=" + jQuery("select[name='filter[filter-by-gallery]']").val();
104
- action += "&filter-by-image=" + jQuery("select[name='filter[filter-by-image]']").val();
105
- form.attr("action", action);
106
 
107
  form.submit();
108
- });
109
 
110
  /* Options form. */
111
- if (jQuery("form#bwg_options_form").length > 0) {
112
- jQuery(".bwg_tabs").each(function () {
113
- jQuery(this).tabs({
114
- active: jQuery('#active_tab').val(),
115
- activate: function( event, ui ) {
116
- jQuery('#active_tab').val(ui.newTab.index());
117
  if ( ui.newTab.index() == 1 ) {
118
  bwg_gallery_type_options();
119
  }
@@ -121,121 +121,127 @@ jQuery(document).ready(function () {
121
  bwg_album_type_options();
122
  }
123
  }
124
- });
125
- });
126
  bwg_gallery_type_options();
127
  bwg_album_type_options();
128
  }
129
 
130
  /* Changing label Number of image rows to columns in masonry view. */
131
- jQuery('input[name=masonry]').on('click', function(){
132
- if(jQuery(this).val() == 'horizontal') {
133
- jQuery('.masonry_col_num').hide();
134
- jQuery('.masonry_row_num').show();
135
- } else {
136
- jQuery('.masonry_row_num').hide();
137
- jQuery('.masonry_col_num').show();
138
- }
139
- });
140
-
141
- jQuery( '#bwg_image_editor_notice .notice-dismiss' ).on( 'click', function() {
142
- var dismiss_url = bwg_ajax_url + '=' + jQuery('#bwg_image_editor_notice').data('action');
143
- jQuery.ajax({
 
144
  method: "POST",
145
  url: dismiss_url,
146
- });
147
- });
148
 
149
  /* Change the popup dimensions. */
150
  bwg_tb_window();
151
 
152
  /* Hide loading */
153
- jQuery('#loading_div.bwg_show').hide();
154
 
155
  bwg_lazy_load_gallery();
156
 
157
  /* Albums form. */
158
- if (jQuery("form").hasClass("bwg_albums")) {
159
- jQuery("#bwg_tabs").sortable({
160
  items: ".connectedSortable",
161
- update: function (event, tr) {
162
  bwg_albums_galleries();
163
  }
164
- });
165
  bwg_albums_galleries();
166
 
167
- setTimeout(function () {
168
- if (!jQuery('#loading_div').is(':visible')) {
169
- jQuery('#bwg_albums #bwg_tabs').removeClass('hidden');
170
- }
171
- }, 500);
172
- }
173
- show_hide_compact_album_view( jQuery('#album_view_type option:selected').val() );
174
- jQuery(document).on('change', '#album_view_type', function() {
175
- var value = jQuery(this).val();
176
- show_hide_compact_album_view( value );
177
- });
178
- show_hide_extended_album_view( jQuery('#album_extended_view_type option:selected').val() );
179
- jQuery(document).on('change', '#album_extended_view_type', function() {
180
- var value = jQuery(this).val();
181
- show_hide_extended_album_view( value );
182
- });
183
-
184
- jQuery('#bwg_ask_question').parent().attr('target', '_blank');
185
- if(jQuery( '#search_in_options_container' ).length) {
186
- jQuery(window).scroll(function () {
187
- if (jQuery(window).scrollTop() >= jQuery('div.wd-list-view-header').offset().top+150 ) {
188
- jQuery('#search_in_tablet').addClass('fixed');
189
- jQuery('#search_in_options_container').addClass('fixed');
190
- jQuery('#search_in_options_container').css("width", +jQuery('#search_in_options_container').parent().width() - jQuery('#search_in_options_container').css('marginLeft').replace('px', '') - jQuery('#search_in_options_container').css('marginRight').replace('px', ''));
191
- jQuery('#search_in_tablet').css("width", +jQuery('#search_in_tablet').parent().width() - jQuery('#search_in_tablet').css('marginLeft').replace('px', '') - jQuery('#search_in_tablet').css('marginRight').replace('px', ''));
192
  }
193
  else {
194
- jQuery('#search_in_options_container').removeClass('fixed');
195
- jQuery('#search_in_tablet').removeClass('fixed');
196
  }
197
- });
198
  }
199
- jQuery( '.tabs' ).click(function(){
200
  search_options();
201
- });
202
- jQuery( '.search_in_options:visible' ).keydown(function(e){
203
  var shifted = false;
204
- if( e.keyCode == 37 ){
205
  jQuery( '.search_prev:visible' ).click();
206
- } else if( e.keyCode == 39 ){
 
207
  jQuery( '.search_next:visible' ).click();
208
- } else if( e.keyCode == 13 ){
 
209
  e.preventDefault();
210
  return;
211
  }
212
- });
213
- jQuery( '.search_in_options:visible' ).keyup(function(e){
214
- if( e.keyCode > 64 && e.keyCode < 96 || !e.keyCode || e.keyCode == 8 ) {
215
- search_options();
216
- } else if( e.keyCode == 13 ){
217
- if(e.shiftKey){
 
218
  jQuery( '.search_prev:visible' ).click();
219
- } else {
 
220
  jQuery( '.search_next:visible' ).click();
221
  }
222
- } else {
 
223
  return;
224
  }
225
- });
226
- jQuery( '.search_next' ).click( function() {
227
- search_get_current('search_next');
228
- })
229
- jQuery( '.search_prev' ).click( function() {
230
- search_get_current('search_prev');
231
- })
232
- jQuery( '.search_close' ).on('click',function(){
233
- jQuery( '.search_in_options:visible' ).val('');
234
  search_options();
235
- })
236
  jQuery( '.search_prev' ).hide();
237
  jQuery( '.search_next' ).hide();
238
- jQuery( '.search_in_options' ).val('');
239
  jQuery( '.total_matches' ).hide();
240
  jQuery( '.current_match' ).empty();
241
  jQuery( '.search_close' ).hide();
@@ -244,128 +250,131 @@ jQuery(document).ready(function () {
244
  /* images in select list */
245
 
246
  /* change selected view*/
247
- jQuery('#bwg_options_form .bwg-gallery-ul li').click(function(){
248
- if( jQuery(this).hasClass('gallery-type-li')) {
249
- jQuery('.type-selected').removeClass('type-selected');
250
- jQuery(this).addClass('type-selected');
251
- var value = jQuery(this).data('value');
252
- var item = jQuery(this).clone();
253
- var parent_el = jQuery(this).parent().parent().prev('.bwg-btn-gallery-type-select').attr('id');
254
- jQuery('#' + parent_el ).html(item);
255
- jQuery('#' + parent_el ).attr('value', value);
256
- if( parent_el == 'album-view-type' ) {
257
- bwg_album_type_options(value);
258
- jQuery('#album_types_name').val(value);
259
-
260
- } else {
261
- bwg_gallery_type_options(value);
262
- jQuery('#gallery_types_name').val(value);
263
- }
264
- change(parent_el);
265
- }
266
- });
267
-
268
- jQuery('body').click(function(){
269
- jQuery("#bwg_options_form .bwg-btn-gallery-type-select").each(function(){
270
- if( jQuery(this).hasClass("type-opened") ) {
271
- jQuery(this).removeClass("type-opened");
272
- jQuery(this).addClass("type-closed");
273
- jQuery(this).next(".bwg-gallery-ul-div").toggle();
274
- }
275
- })
276
- });
 
277
 
278
  /* functions to view div as select box */
279
- jQuery('#bwg_options_form .bwg-btn-gallery-type-select').click(function() {
280
- var id = jQuery(this).attr('id');
281
- if( !jQuery(this).next().find('.bwg-gallery-ul .type-selected').length ) {
282
- jQuery(this).next().find('.bwg-gallery-ul li:first-child').addClass('type-selected');
283
- }
284
- change(id);
285
- });
286
-
287
- });
288
-
289
- function change(view_type){
290
- var view_type_div = jQuery('#' + view_type ).closest('.bwg-btn-gallery-type-select');
291
- if( view_type_div.hasClass('type-closed') ) {
292
- view_type_div.removeClass('type-closed');
293
- view_type_div.addClass('type-opened');
294
- } else {
295
- view_type_div.removeClass('type-opened');
296
- view_type_div.addClass('type-closed');
297
- }
298
- jQuery('#' + view_type ).next('.bwg-gallery-ul-div').toggle();
 
299
  event.stopPropagation();
300
  }
301
 
302
  /* Load gallery images */
303
  function bwg_lazy_load_gallery() {
304
- jQuery(".gallery_image_thumb").each(function () {
305
- var currImg = jQuery(this);
306
- var src = currImg.attr("data-src");
307
- if( typeof src != "undefined" && src.length > 0) {
308
- currImg.attr("src", src);
309
- currImg.removeAttr("data-src");
310
- currImg.load(function() {
311
- currImg.removeClass("bwg_no_border");
312
- });
313
  }
314
- });
315
  }
316
 
317
  function bwg_albums_galleries() {
318
  var str = '';
319
- jQuery("#bwg_tabs>.connectedSortable").each(function () {
320
- str += jQuery(this).data('id') + ':' + jQuery(this).data('is-album') + ',';
321
- });
322
- jQuery("#albums_galleries").val(str);
323
  }
324
 
325
- function bwg_remove_album_gallery(obj) {
326
- jQuery(obj).closest(".connectedSortable").remove();
327
  bwg_albums_galleries();
328
  }
329
 
330
- function bwg_add_album_gallery(alb_gal_id, is_album, preview_image, name, status, tb_remove) {
331
- var html = jQuery('#bwg_template').html()
332
- .replace(/%%alb_gal_id%%/g, alb_gal_id)
333
- .replace(/%%is_album%%/g, is_album)
334
- .replace(/%%preview_image%%=""/g, 'style="background-image:url(&quot;' + preview_image + '&quot;)"')
335
- .replace(/%%name%%/g, name)
336
- .replace(/%%status%%/g, status);
337
- jQuery('#bwg_tabs').children('#bwg_template').last().before(html);
338
  bwg_albums_galleries();
339
- if (tb_remove != false) {
340
  window.parent.tb_remove();
341
  }
342
  }
343
 
344
  function spider_get_items() {
345
- jQuery('#tbody_albums_galleries input[type=checkbox]').each(function () {
346
- obj = jQuery(this);
347
- if (obj.attr('checked')) {
348
- window.parent.bwg_add_album_gallery(obj.attr('data-id'), obj.attr('data-is-album'), obj.attr('data-preview-image'), obj.attr('data-name'), obj.attr('data-status'), false);
349
  }
350
- });
351
  window.parent.tb_remove();
352
  }
353
 
354
- function addPricelist(pricelist) {
355
- jQuery('#image_pricelist_id', window.parent.document).val(pricelist.id);
356
- window.parent.spider_set_input_value('ajax_task', 'set_image_pricelist');
357
- window.parent.spider_ajax_save('bwg_gallery');
358
  window.parent.tb_remove();
359
  }
360
 
361
- function bwg_remove_pricelist(obj) {
362
- jQuery("#remove_pricelist").val(jQuery(obj).attr("data-image-id"));
363
- jQuery("#pricelist_id_" + jQuery(obj).attr("data-pricelist-id") ).val("");
364
- spider_set_input_value('ajax_task', 'remove_image_pricelist');
365
- spider_ajax_save('bwg_gallery');
366
  }
367
 
368
  var bwg_save_count = 50;
 
369
  /**
370
  * Save gallery and images.
371
  *
@@ -373,229 +382,229 @@ var bwg_save_count = 50;
373
  * @param tr_group Save counter.
374
  * @returns {boolean}
375
  */
376
- function spider_ajax_save(form_id, tr_group) {
377
- if (spider_check_required('name', 'Name')) {
378
  return false;
379
  }
380
  var post_data = {};
381
- post_data["task"] = "save";
382
- var ajax_task = jQuery("#ajax_task").val();/* Images list action task.*/
383
- post_data["current_id"] = jQuery("#current_id").val();/* Current gallery id.*/
384
- post_data["image_current_id"] = jQuery("#image_current_id").val();/* Current image id.*/
385
- var ids_string = jQuery("#ids_string").val();/* Images ids separated by comma.*/
386
- ids_string = ids_string.replace(/,\s*$/, "");;
387
- post_data["image_bulk_action"] = jQuery("[name=image_bulk_action]").val(); /* Bulk action for images.*/
388
- post_data["order_by"] = jQuery("select[name='order_by']").val();/* Images sorting.*/
389
- post_data["s"] = jQuery("input[name='s']").val();/* Images filter.*/
390
- post_data["paged"] = jQuery("#paged").val();/* Images page number.*/
391
- post_data["bwg_nonce"] = jQuery("#bwg_nonce").val();/* Nonce*/
392
- post_data["image_pricelist_id"] = jQuery("#image_pricelist_id").val();
393
- post_data["remove_pricelist"] = jQuery("#remove_pricelist").val();
394
 
395
  /* Images ids array. */
396
- var ids_array = ids_string.split(",");
397
  /* Images count on page. */
398
  var tr_count = ids_array.length;
399
 
400
- if (!tr_group) {
401
  var tr_group = 1;
402
  }
403
 
404
  /* Selected images count for message.*/
405
- post_data["checked_items_count"] = jQuery("[name^=check]:not([id=check_all_items]):checked").length;
406
  /* Select all.*/
407
- post_data["check_all_items"] = jQuery("[name=check_all_items]").is(":checked") ? 1 : 0;
408
- var limit = (ajax_task == 'image_set_watermark' || ajax_task == 'image_reset') && (post_data["check_all_items"] || tr_count > bwg_save_count) ? bwg_save_count * (tr_group - 1) : false;
409
- post_data["limit"] = limit;
410
  /* Gallery paramters. */
411
- post_data["name"] = jQuery("#name").val();
412
- post_data["slug"] = jQuery("#slug").val();
413
- post_data["old_slug"] = jQuery("#old_slug").val();
414
- post_data["preview_image"] = jQuery("#preview_image").val();
415
- post_data["published"] = jQuery("input[name=published]:checked").val();
416
- if ( (typeof tinyMCE != "undefined")
417
- && tinyMCE.activeEditor
418
- && !tinyMCE.activeEditor.isHidden()
419
- && tinyMCE.activeEditor.getContent ) {
420
- post_data["description"] = tinyMCE.activeEditor.getContent();
421
  }
422
  else {
423
- post_data["description"] = jQuery("#description").val();
424
- }
425
- var gallery_type_input = jQuery("#gallery_type").val();
426
- post_data["gallery_source"] = (gallery_type_input == 'facebook') ? jQuery("#facebook_gallery_source").val() : jQuery("#gallery_source").val();
427
- post_data["autogallery_image_number"] = (gallery_type_input == 'facebook') ? jQuery("#facebook_gallery_image_limit").val() : jQuery("#autogallery_image_number").val();
428
- post_data["update_flag"] = (gallery_type_input == 'facebook') ? jQuery("input[name=facebook_update]:checked").val() : jQuery("input[name=update_flag]:checked").val();
429
- var gallery_content_type = (gallery_type_input == 'facebook') ? jQuery("input[name=facebook_content_type]:checked").val() : jQuery("input[name=instagram_post_gallery]:checked").val();
430
- post_data["gallery_type"] = gallery_type_input + (gallery_content_type == 1 ? "_post" : "");
431
- post_data["gallery_type_old"] = jQuery("#gallery_type_old").val();
432
- post_data["instagram_post_gallery"] = gallery_content_type;
433
- post_data["modified_date"] = jQuery("#modified_date").val();
434
 
435
  /* Remove images ids from begin and end of array. */
436
- if (tr_count > bwg_save_count) {
437
- ids_array.splice(tr_group * bwg_save_count, ids_array.length);
438
- ids_array.splice(0, (tr_group - 1) * bwg_save_count);
439
- ids_string = ids_array.join(",");
440
  }
441
 
442
- post_data["ajax_task"] = ajax_task;
443
- post_data["ids_string"] = ids_string;
444
 
445
  /* Images dimensions to resize. */
446
- post_data["image_width"] = jQuery("#image_width").val();
447
- post_data["image_height"] = jQuery("#image_height").val();
448
  /* Images bulk edit values. */
449
- post_data["title"] = jQuery("#title").val();
450
- post_data["desc"] = jQuery("#desc").val();
451
- post_data["redirecturl"] = jQuery("#redirecturl").val();
452
  /* Images bulk add tags ids. */
453
- post_data["added_tags_id"] = jQuery("#added_tags_id").val();
454
  /* Images bulk add tags act. */
455
- post_data["added_tags_act"] = jQuery("#added_tags_act").val();
456
  /* Images data. */
457
- for (var i in ids_array) {
458
- if (ids_array.hasOwnProperty(i) && ids_array[i]) {
459
- if ( jQuery("#check_" + ids_array[i]).attr('checked') == 'checked' ) {
460
- post_data["check_" + ids_array[i]] = true; /* jQuery("#check_" + ids_array[i]).val(); */
461
- }
462
- post_data["input_filename_" + ids_array[i]] = jQuery("#input_filename_" + ids_array[i]).val();
463
- post_data["image_url_" + ids_array[i]] = decodeURIComponent(jQuery("#image_url_" + ids_array[i]).val());
464
- post_data["thumb_url_" + ids_array[i]] = decodeURIComponent(jQuery("#thumb_url_" + ids_array[i]).val());
465
- post_data["image_description_" + ids_array[i]] = ( typeof jQuery("#image_description_" + ids_array[i]).val() !== 'undefined' && jQuery("#image_description_" + ids_array[i]).val() ) ? jQuery("#image_description_" + ids_array[i]).val() : '';
466
- post_data["image_alt_text_" + ids_array[i]] = ( typeof jQuery("#image_alt_text_" + ids_array[i]).val() !== 'undefined' && jQuery("#image_alt_text_" + ids_array[i]).val() ) ? jQuery("#image_alt_text_" + ids_array[i]).val() : '';
467
- post_data["redirect_url_" + ids_array[i]] = jQuery("#redirect_url_" + ids_array[i]).val();
468
- post_data["input_date_modified_" + ids_array[i]] = jQuery("#input_date_modified_" + ids_array[i]).val();
469
- post_data["input_size_" + ids_array[i]] = jQuery("#input_size_" + ids_array[i]).val();
470
- post_data["input_filetype_" + ids_array[i]] = jQuery("#input_filetype_" + ids_array[i]).val();
471
- post_data["input_resolution_" + ids_array[i]] = jQuery("#input_resolution_" + ids_array[i]).val();
472
- post_data["input_resolution_thumb_" + ids_array[i]] = jQuery("#input_resolution_thumb_" + ids_array[i]).val();
473
- post_data["input_crop_" + ids_array[i]] = jQuery("#input_crop_" + ids_array[i]).val();
474
- post_data["order_input_" + ids_array[i]] = jQuery("#order_input_" + ids_array[i]).val();
475
- post_data["tags_" + ids_array[i]] = jQuery("#tags_" + ids_array[i]).val();
476
  }
477
  }
478
  /* Filter data before passing to ajax from add-ons. */
479
- jQuery(document).trigger('bwg_before_gallery_save_ajax', post_data);
480
 
481
  /* Loading. */
482
- jQuery("#loading_div").show();
483
 
484
  jQuery.post(
485
- jQuery('#' + form_id).attr('action'),
486
  post_data,
487
- function (data) {
488
- var str = jQuery(data).find("#current_id").val();
489
  if ( typeof str != "undefined" ) {
490
- jQuery("#current_id").val(str);
491
  }
492
  }
493
- ).success(function (data, textStatus, errorThrown) {
494
- if ( tr_count > bwg_save_count * tr_group || (limit !== false && limit < jQuery("#total").val() ) ) {
495
- spider_ajax_save(form_id, ++tr_group);
496
  return;
497
  }
498
  else {
499
- var form_action = jQuery(data).find('#bwg_gallery').attr("action");
500
  /* Something went wrong.*/
501
  if ( typeof form_action == "undefined" ) {
502
- jQuery("#loading_div").hide();
503
  return;
504
  }
505
- jQuery('#bwg_gallery').attr("action", form_action);
506
  /*
507
  var str = jQuery(data).find('#bwg_gallery').html();
508
  jQuery('#bwg_gallery').html(str);
509
  var current_id = jQuery(data).find("#current_id").val();
510
  window.history.pushState(null, null, window.location.href + '&current_id=' + current_id);
511
  */
512
- var str = jQuery(data).find('.bwg-page-header').html();
513
- jQuery('.bwg-page-header').html(str);
514
- var str = jQuery(data).find('.ajax-msg').html();
515
- jQuery('.ajax-msg').html(str);
516
- jQuery(".ajax-msg").addClass("wd-hide");
517
- var str = jQuery(data).find('.gal-msg').html();
518
- jQuery('.gal-msg').html(str);
519
- var str = jQuery(data).find('.tablenav.top').html();
520
- jQuery('.tablenav.top').html(str);
521
- var str = jQuery(data).find('#images_table').html();
522
- jQuery('#images_table').html(str);
523
- var str = jQuery(data).find('.tablenav.bottom').html();
524
- jQuery('.tablenav.bottom').html(str);
525
- var str = jQuery(data).find('.wd-hidden-values').html();
526
- jQuery('.wd-hidden-values').html(str);
527
- var str = jQuery(data).find('#task').html();
528
- jQuery('#task').html(str);
529
- var str = jQuery(data).find('#current_id').html();
530
- jQuery('#current_id').html(str);
531
 
532
  if ( ajax_task != '' ) {
533
- jQuery(".ajax-msg").removeClass("wd-hide");
534
  }
535
- jQuery(".gal-msg").removeClass("wd-hide");
536
 
537
- jQuery(".unsaved-msg").addClass("wd-hide");
538
- if ( jQuery("#tbody_arr").hasClass("bwg-ordering") ) {
539
  wd_showhide_weights();
540
  }
541
  wd_pagination();
542
  /* bwg_toggle_postbox();*/
543
 
544
- jQuery("#check_all").on("click", function () {
545
- spider_check_all("#check_all");
546
- });
547
- jQuery("#loading_div").hide();
548
  bwg_lazy_load_gallery();
549
  wd_howto_src_change();
550
 
551
  /* Add click event to toggle button to expand columns.*/
552
- jQuery( "tbody" ).on( "click", ".toggle-row", function() {
553
  jQuery( this ).closest( "tr" ).toggleClass( "is-expanded" );
554
- });
555
 
556
  /* Change the popup dimensions. */
557
- bwg_tb_window("#images_table");
558
 
559
  /* Show popup for install manager if first gallery inserted */
560
- var popup_status = jQuery(data).find('#twbb_layout').attr("data-status");
561
- if(popup_status == 1) {
562
  var win_height = jQuery( window ).height();
563
- if( win_height < 500 ) {
564
- jQuery("#twbb_layout_container").css('height', (win_height-35));
565
  }
566
- jQuery("#twbb_layout").removeClass("hide");
567
  }
568
  }
569
- });
570
 
571
  return false;
572
  }
573
 
574
- function bwg_sort_images(sorting) {
575
- var msg = jQuery('.sorting-msg');
576
- if (sorting != 'order_asc') {
577
- msg.removeClass('wd-hide');
578
  }
579
  else {
580
- msg.addClass('wd-hide');
581
  }
582
- spider_set_input_value('task', 'save');
583
- spider_ajax_save('bwg_gallery');
584
  }
585
 
586
  /* Set value by id. */
587
- function spider_set_input_value(input_id, input_value) {
588
- if (document.getElementById(input_id)) {
589
- document.getElementById(input_id).value = input_value;
590
  }
591
  }
592
 
593
  /* Submit form by id. */
594
- function spider_form_submit(event, form_id) {
595
- if (document.getElementById(form_id)) {
596
- document.getElementById(form_id).submit();
597
  }
598
- if (event.preventDefault) {
599
  event.preventDefault();
600
  }
601
  else {
@@ -604,14 +613,14 @@ function spider_form_submit(event, form_id) {
604
  }
605
 
606
  /* Check if required field is empty. */
607
- function spider_check_required(id, name) {
608
- if (jQuery('#' + id).val() == '') {
609
- alert(name + ' ' + bwg_objectL10B.bwg_field_required);
610
- jQuery('#' + id).attr('style', 'border-color: #FF0000;');
611
- jQuery('#' + id).focus();
612
- jQuery('html, body').animate({
613
- scrollTop:jQuery('#' + id).offset().top - 200
614
- }, 500);
615
  return true;
616
  }
617
  else {
@@ -624,11 +633,11 @@ function spider_check_required(id, name) {
624
  *
625
  * @param click
626
  */
627
- function wd_showhide_weights(click) {
628
  if ( typeof click == "undefined" ) {
629
  var click = false;
630
  }
631
- if (jQuery("select[name='order_by']").val() == 'order_asc') {
632
  if ( click ) {
633
  jQuery( ".wd-order" ).toggleClass( "wd-hide" );
634
  jQuery( ".wd-drag" ).toggleClass( "wd-hide" );
@@ -639,23 +648,23 @@ function wd_showhide_weights(click) {
639
  jQuery( ".wd-drag" ).addClass( "wd-hide" );
640
  }
641
 
642
- if ( !jQuery(".wd-drag").hasClass("wd-hide") ) { /* Drag and drop. */
643
- jQuery(".wd-order-thead").attr("title", bwg_objectL10B.bwg_show_order);
644
- jQuery("#tbody_arr").sortable({
645
  handle: ".connectedSortable",
646
  connectWith: ".connectedSortable",
647
- update: function (event, tr) {
648
- jQuery(".unsaved-msg").removeClass("wd-hide");
649
- jQuery(".ajax-msg").addClass("wd-hide");
650
- var i = jQuery("td.col_drag").data("page-number");
651
- jQuery(".wd-order").each(function () {
652
- jQuery(this).val(++i);
653
- });
654
  }
655
- });
656
  }
657
  else { /* Order inputs. */
658
- jQuery(".wd-order-thead").attr("title", bwg_objectL10B.bwg_hide_order);
659
  }
660
  }
661
 
@@ -671,193 +680,193 @@ function wd_showhide_weights(click) {
671
  });*/
672
 
673
  /* Check all items. */
674
- function spider_check_all_items(event) {
675
- if (jQuery("#check_all_items").is(':checked')) {
676
- jQuery("#check_all_items").prop('checked', false);
677
  }
678
  else {
679
- jQuery("#check_all_items").prop('checked', true);
680
  }
681
- spider_check_all_items_checkbox(event);
682
  }
683
 
684
- function spider_check_all_items_checkbox(event) {
685
- if (jQuery("#check_all_items").is(':checked')) {
686
  /* Generate message about how many images are selected. */
687
- var saved_items = (parseInt(jQuery(".displaying-num").html()) ? parseInt(jQuery(".displaying-num").html()) : 0);
688
- var added_items = (jQuery('input[id^="check_pr_"]').length ? parseInt(jQuery('input[id^="check_pr_"]').length) : 0);
689
  var items_count = added_items + saved_items;
690
  if ( items_count ) {
691
- jQuery(".ajax-msg")
692
- .html("<div class='notice notice-warning wd-notice'><p><strong>" + (items_count == 1 ? bwg_objectL10B.selected_item : bwg_objectL10B.selected_items).replace("%d", items_count) + "</strong></p></div>")
693
- .removeClass("wd-hide");
694
  }
695
 
696
- if (!jQuery("#check_all").is(':checked')) {
697
- jQuery('#check_all').trigger('click');
698
  }
699
  }
700
  else {
701
- if (jQuery("#check_all").is(':checked')) {
702
- jQuery('#check_all').trigger('click');
703
  }
704
  }
705
  event.stopPropagation();
706
  }
707
 
708
- function spider_check_all(current) {
709
- if (!jQuery(current).is(':checked')) {
710
- jQuery('#check_all_items').attr('checked', false);
711
- jQuery(".ajax-msg").addClass("wd-hide");
712
  }
713
  }
714
 
715
  /* Set uploader to button class. */
716
- function spider_uploader(button_id, input_id, delete_id, img_id) {
717
- if (typeof img_id == 'undefined') {
718
  img_id = '';
719
  }
720
- jQuery(function () {
721
  var formfield = null;
722
  window.original_send_to_editor = window.send_to_editor;
723
- window.send_to_editor = function (html) {
724
- if (formfield) {
725
- var fileurl = jQuery('img', html).attr('src');
726
- if (!fileurl) {
727
  var exploded_html;
728
  var exploded_html_askofen;
729
- exploded_html = html.split('"');
730
- for (i = 0; i < exploded_html.length; i++) {
731
- exploded_html_askofen = exploded_html[i].split("'");
732
  }
733
- for (i = 0; i < exploded_html.length; i++) {
734
- for (j = 0; j < exploded_html_askofen.length; j++) {
735
- if (exploded_html_askofen[j].search("href")) {
736
- fileurl = exploded_html_askofen[i + 1];
737
  break;
738
  }
739
  }
740
  }
741
- if (img_id != '') {
742
- alert(bwg_objectL10B.bwg_select_image);
743
  tb_remove();
744
  return;
745
  }
746
- window.parent.document.getElementById(input_id).value = fileurl;
747
- window.parent.document.getElementById(button_id).style.display = "none";
748
- window.parent.document.getElementById(input_id).style.display = "inline-block";
749
- window.parent.document.getElementById(delete_id).style.display = "inline-block";
750
  }
751
  else {
752
- if (img_id == '') {
753
- alert(bwg_objectL10B.bwg_field_required);
754
  tb_remove();
755
  return;
756
  }
757
- window.parent.document.getElementById(input_id).value = fileurl;
758
- window.parent.document.getElementById(button_id).style.display = "none";
759
- window.parent.document.getElementById(delete_id).style.display = "inline-block";
760
- if ((img_id != '') && window.parent.document.getElementById(img_id)) {
761
- window.parent.document.getElementById(img_id).src = fileurl;
762
- window.parent.document.getElementById(img_id).style.display = "inline-block";
763
  }
764
  }
765
- formfield.val(fileurl);
766
  tb_remove();
767
  }
768
  else {
769
- window.original_send_to_editor(html);
770
  }
771
  formfield = null;
772
  };
773
- formfield = jQuery(this).parent().parent().find(".url_input");
774
- tb_show('', 'media-upload.php?type=image&TB_iframe=true');
775
- jQuery('#TB_overlay,#TB_closeWindowButton').bind("click", function () {
776
  formfield = null;
777
- });
778
  return false;
779
- });
780
  }
781
 
782
  /* Remove uploaded file. */
783
- function spider_remove_url(button_id, input_id, delete_id, img_id) {
784
- if (typeof img_id == 'undefined') {
785
  img_id = '';
786
  }
787
- if (document.getElementById(button_id)) {
788
- document.getElementById(button_id).style.display = '';
789
  }
790
- if (document.getElementById(input_id)) {
791
- document.getElementById(input_id).value = '';
792
- document.getElementById(input_id).style.display = 'none';
793
  }
794
- if (document.getElementById(delete_id)) {
795
- document.getElementById(delete_id).style.display = 'none';
796
  }
797
- if ((img_id != '') && window.parent.document.getElementById(img_id)) {
798
- document.getElementById(img_id).src = '';
799
- document.getElementById(img_id).style.display = 'none';
800
  }
801
  }
802
 
803
  /* Add album preview image. */
804
- function bwg_add_preview_image(files) {
805
- document.getElementById("preview_image").value = files[0]['thumb_url'];
806
- document.getElementById("button_preview_image").style.display = "none";
807
- document.getElementById("delete_preview_image").style.display = "inline-block";
808
- if (document.getElementById("img_preview_image")) {
809
- document.getElementById("img_preview_image").src = files[0]['reliative_url'];
810
- document.getElementById("img_preview_image").style.display = "inline-block";
811
  }
812
  }
813
 
814
- function spider_reorder_items(tbody_id) {
815
- jQuery("#" + tbody_id).sortable({
816
- handle:".connectedSortable",
817
- connectWith:".connectedSortable",
818
- update:function (event, tr) {
819
- spider_sortt(tbody_id);
820
  }
821
- });
822
  }
823
 
824
- function spider_sortt(tbody_id) {
825
  var str = "";
826
  var counter = 0;
827
- jQuery("#" + tbody_id).children().each(function () {
828
- str += ((jQuery(this).attr("id")).substr(3) + ",");
829
  counter++;
830
- });
831
- jQuery("#albums_galleries").val(str);
832
- if (!counter) {
833
- document.getElementById("table_albums_galleries").style.display = "none";
834
  }
835
  }
836
 
837
- function spider_remove_row(tbody_id, event, obj) {
838
  var span = obj;
839
- var tr = jQuery(span).closest("tr");
840
- jQuery(tr).remove();
841
- spider_sortt(tbody_id);
842
  }
843
 
844
- function spider_jslider(idtaginp) {
845
- jQuery(function () {
846
- var inpvalue = jQuery("#" + idtaginp).val();
847
- if (inpvalue == "") {
848
  inpvalue = 50;
849
  }
850
- jQuery("#slider-" + idtaginp).slider({
851
- range:"min",
852
- value:inpvalue,
853
- min:1,
854
- max:100,
855
- slide:function (event, ui) {
856
- jQuery("#" + idtaginp).val("" + ui.value);
857
  }
858
- });
859
- jQuery("#" + idtaginp).val("" + jQuery("#slider-" + idtaginp).slider("value"));
860
- });
861
  }
862
 
863
  /**
@@ -865,20 +874,20 @@ function spider_jslider(idtaginp) {
865
  *
866
  * @param image_id
867
  */
868
- function bwg_bulk_add_tags(tag_id, act) {
869
  var tagIds = "";
870
  if ( tag_id == "" ) {
871
- jQuery(".tags:checked").each(function () {
872
- tagIds += jQuery(this).data("id").toString() + ",";
873
- });
874
  }
875
  else {
876
  tagIds = tag_id;
877
  }
878
- jQuery('#added_tags_id', window.parent.document).val(tagIds);
879
- jQuery('#added_tags_act', window.parent.document).val(act);
880
- window.parent.spider_set_input_value('ajax_task', 'image_add_tag');
881
- window.parent.spider_ajax_save('bwg_gallery');
882
  window.parent.tb_remove();
883
  }
884
 
@@ -887,14 +896,14 @@ function bwg_bulk_add_tags(tag_id, act) {
887
  *
888
  * @param image_id
889
  */
890
- function bwg_add_tags(image_id) {
891
  var tagIds = [];
892
  var titles = [];
893
- jQuery(".tags:checked").each(function () {
894
- tagIds.push(jQuery(this).data("id").toString());
895
- titles.push(jQuery(this).data("name"));
896
- });
897
- window.parent.bwg_add_tag(image_id, tagIds, titles);
898
  }
899
 
900
  /**
@@ -904,124 +913,124 @@ function bwg_add_tags(image_id) {
904
  * @param tagIds
905
  * @param titles
906
  */
907
- function bwg_add_tag(image_id, tagIds, titles) {
908
  window.parent.bwg_create_loading_block();
909
- /* Images ids array. */
910
  var ids_array;
911
- if (image_id == '0') {
912
  var flag = false;
913
- var ids_string = jQuery("#ids_string").val();
914
- ids_array = ids_string.split(",");
915
- if (jQuery("#check_all_items").attr("checked")) {
916
  var added_tags = '';
917
- for (i = 0; i < tagIds.length; i++) {
918
- added_tags = added_tags + tagIds[i] + ',';
919
  }
920
- jQuery("#added_tags_id").val(added_tags);
921
  }
922
  }
923
  else {
924
  image_id = image_id + ',';
925
 
926
- ids_array = image_id.split(",");
927
  var flag = true;
928
  }
929
- for (var i in ids_array) {
930
- if (ids_array.hasOwnProperty(i) && ids_array[i]) {
931
- if (jQuery("#check_" + ids_array[i]).attr('checked') == 'checked' || flag) {
932
- image_id = ids_array[i];
933
- var tag_ids = document.getElementById('tags_' + image_id).value;
934
- tags_array = tag_ids.split(',');
935
  var counter = 0;
936
- for (i = 0; i < tagIds.length; i++) {
937
- if (tags_array.indexOf(tagIds[i]) == -1) { /* To prevent add same tag multiple times. */
938
- tag_ids = tag_ids + tagIds[i] + ',';
939
- var html = jQuery("#" + image_id + "_tag_temptagid").clone().html();
940
  /* Remove white spaces from keywords to set as id and remove prefix.*/
941
- var id = tagIds[i].replace(/\s+/g, '_').replace('bwg_', '').replace(/\//g, "").replace(/&amp;/g, "").replace(/&/g, "").replace(/@/g, "").replace(/'/g, "39").replace(/"/g, "34").replace(/!/g, "");
942
- html = html.replace(/temptagid/g, id)
943
- .replace(/temptagname/g, titles[i]);
944
- jQuery("#tags_div_" + image_id).append("<div class='tag_div' id='" + image_id + "_tag_" + id + "'>");
945
- jQuery("#" + image_id + "_tag_" + id).html(html);
946
 
947
  counter++;
948
  }
949
  }
950
- document.getElementById('tags_' + image_id).value = tag_ids;
951
- if (counter) {
952
- jQuery("#tags_div_" + image_id).parent().removeClass("tags_div_empty");
953
  }
954
  else {
955
- jQuery("#tags_div_" + image_id).parent().addClass("tags_div_empty");
956
  }
957
  }
958
- }
959
  }
960
- jQuery(".unsaved-msg", window.parent.document).removeClass("wd-hide");
961
- jQuery(".ajax-msg", window.parent.document).addClass("wd-hide");
962
  tb_remove();
963
  window.parent.bwg_remove_loading_block();
964
  }
965
 
966
- function bwg_remove_tag(tag_id, image_id) {
967
- if (jQuery('#' + image_id + '_tag_' + tag_id)) {
968
- jQuery('#' + image_id + '_tag_' + tag_id).remove();
969
- var tag_ids_string = jQuery("#tags_" + image_id).val();
970
- tag_ids_string = tag_ids_string.replace(tag_id + ',', '');
971
- jQuery("#tags_" + image_id).val(tag_ids_string);
972
- if (jQuery("#tags_" + image_id).val() == '') {
973
- jQuery("#tags_div_" + image_id).parent().addClass("tags_div_empty");
974
  }
975
- jQuery(".unsaved-msg").removeClass("wd-hide");
976
- jQuery(".ajax-msg").addClass("wd-hide");
977
  }
978
  }
979
 
980
- function bwg_remove_tags(image_id) {
981
  var tagIds = [];
982
- jQuery(".tags:checked").each(function () {
983
- tagIds.push(jQuery(this).data("id").toString());
984
- });
985
- tagIds.forEach(function(item) {
986
- window.parent.bwg_remove_tag(item.toString(), image_id);
987
- })
988
  window.parent.tb_remove();
989
  }
990
 
991
  function preview_watermark() {
992
- setTimeout(function() {
993
- watermark_type = window.parent.document.getElementById('watermark_type_text').checked;
994
- if (watermark_type) {
995
- watermark_text = document.getElementById('watermark_text').value;
996
- watermark_link = document.getElementById('watermark_link').value;
997
- watermark_font_size = document.getElementById('watermark_font_size').value;
998
- watermark_font = document.getElementById('watermark_font').value;
999
- watermark_color = document.getElementById('watermark_color').value;
1000
- watermark_opacity = document.getElementById('watermark_opacity').value;
1001
- watermark_position = jQuery("input[name=watermark_position]:checked").val().split('-');
1002
- document.getElementById("preview_watermark").style.verticalAlign = watermark_position[0];
1003
- document.getElementById("preview_watermark").style.textAlign = watermark_position[1];
1004
- stringHTML = (watermark_link ? '<a href="' + watermark_link + '" target="_blank" style="text-decoration: none;' : '<span style="cursor:default;') + 'margin:4px;font-size:' + watermark_font_size + 'px;font-family:' + watermark_font + ';color:#' + watermark_color + ';opacity:' + (watermark_opacity / 100) + ';" class="non_selectable">' + watermark_text + (watermark_link ? '</a>' : '</span>');
1005
- document.getElementById("preview_watermark").innerHTML = stringHTML;
1006
- }
1007
- watermark_type = window.parent.document.getElementById('watermark_type_image').checked;
1008
- if (watermark_type) {
1009
- watermark_url = document.getElementById('watermark_url').value;
1010
- watermark_link = document.getElementById('watermark_link').value;
1011
- watermark_width = document.getElementById('watermark_width').value;
1012
- watermark_height = document.getElementById('watermark_height').value;
1013
- watermark_opacity = document.getElementById('watermark_opacity').value;
1014
- watermark_position = jQuery("input[name=watermark_position]:checked").val().split('-');
1015
- document.getElementById("preview_watermark").style.verticalAlign = watermark_position[0];
1016
- document.getElementById("preview_watermark").style.textAlign = watermark_position[1];
1017
- stringHTML = (watermark_link ? '<a href="' + watermark_link + '" target="_blank">' : '') + '<img class="non_selectable" src="' + watermark_url + '" style="margin:0 4px 0 4px;max-width:' + watermark_width + 'px;max-height:' + watermark_height + 'px;opacity:' + (watermark_opacity / 100) + ';" />' + (watermark_link ? '</a>' : '');
1018
- document.getElementById("preview_watermark").innerHTML = stringHTML;
1019
- }
1020
- }, 50);
1021
  }
1022
 
1023
  /* Escape a string for HTML.*/
1024
- function tw_escape(string) {
1025
  /* List of HTML entities for escaping.*/
1026
  var htmlEscapes = {
1027
  '&': '&amp;',
@@ -1034,113 +1043,109 @@ function tw_escape(string) {
1034
  /* Regex containing the keys.*/
1035
  var htmlEscaper = /[&<>"'\/]/g;
1036
 
1037
- return ('' + string).replace(htmlEscaper, function(match) {
1038
- return htmlEscapes[match];
1039
- });
1040
  };
1041
 
1042
  function preview_built_in_watermark() {
1043
- setTimeout(function(){
1044
- watermark_type = window.parent.document.getElementById('built_in_watermark_type_text').checked;
1045
- if (watermark_type) {
1046
- watermark_text = tw_escape(document.getElementById('built_in_watermark_text').value);
1047
- watermark_font_size = document.getElementById('built_in_watermark_font_size').value * 400 / 500;
1048
- watermark_font = 'bwg_' + document.getElementById('built_in_watermark_font').value.replace('.TTF', '').replace('.ttf', '');
1049
- watermark_color = document.getElementById('built_in_watermark_color').value;
1050
- watermark_opacity = document.getElementById('built_in_watermark_opacity').value;
1051
- watermark_position = jQuery("input[name=built_in_watermark_position]:checked").val().split('-');
1052
- document.getElementById("preview_built_in_watermark").style.verticalAlign = watermark_position[0];
1053
- document.getElementById("preview_built_in_watermark").style.textAlign = watermark_position[1];
1054
- stringHTML = '<span style="cursor:default;margin:4px;font-size:' + watermark_font_size + 'px;font-family:' + watermark_font + ';color:#' + watermark_color + ';opacity:' + (watermark_opacity / 100) + ';" class="non_selectable">' + watermark_text + '</span>';
1055
- document.getElementById("preview_built_in_watermark").innerHTML = stringHTML;
1056
- }
1057
- watermark_type = window.parent.document.getElementById('built_in_watermark_type_image').checked;
1058
- if (watermark_type) {
1059
- watermark_url = document.getElementById('built_in_watermark_url').value;
1060
- watermark_size = document.getElementById('built_in_watermark_size').value;
1061
- watermark_position = jQuery("input[name=built_in_watermark_position]:checked").val().split('-');
1062
- document.getElementById("preview_built_in_watermark").style.verticalAlign = watermark_position[0];
1063
- document.getElementById("preview_built_in_watermark").style.textAlign = watermark_position[1];
1064
- stringHTML = '<img class="non_selectable" src="' + watermark_url + '" style="margin:0 4px 0 4px;max-width:95%;width:' + watermark_size + '%;" />';
1065
- document.getElementById("preview_built_in_watermark").innerHTML = stringHTML;
1066
- }
1067
- }, 50);
1068
  search_options();
1069
  }
1070
 
1071
- function bwg_watermark(watermark_type) {
1072
- jQuery("#" + watermark_type).attr('checked', 'checked');
1073
- jQuery("#tr_watermark_url").css('display', 'none');
1074
- jQuery("#tr_watermark_width_height").css('display', 'none');
1075
- jQuery("#tr_watermark_opacity").css('display', 'none');
1076
- jQuery("#tr_watermark_text").css('display', 'none');
1077
- jQuery("#tr_watermark_link").css('display', 'none');
1078
- jQuery("#tr_watermark_font_size").css('display', 'none');
1079
- jQuery("#tr_watermark_font").css('display', 'none');
1080
- jQuery("#tr_watermark_color").css('display', 'none');
1081
- jQuery("#tr_watermark_position").css('display', 'none');
1082
- jQuery("#tr_watermark_preview").css('display', 'none');
1083
- jQuery("#preview_watermark").css('display', 'none');
1084
- switch (watermark_type) {
1085
- case 'watermark_type_text':
1086
- {
1087
- jQuery("#tr_watermark_opacity").css('display', '');
1088
- jQuery("#tr_watermark_text").css('display', '');
1089
- jQuery("#tr_watermark_link").css('display', '');
1090
- jQuery("#tr_watermark_font_size").css('display', '');
1091
- jQuery("#tr_watermark_font").css('display', '');
1092
- jQuery("#tr_watermark_color").css('display', '');
1093
- jQuery("#tr_watermark_position").css('display', '');
1094
- jQuery("#tr_watermark_preview").css('display', '');
1095
- jQuery("#preview_watermark").css('display', 'table-cell');
1096
  break;
1097
  }
1098
- case 'watermark_type_image':
1099
- {
1100
- jQuery("#tr_watermark_url").css('display', '');
1101
- jQuery("#tr_watermark_link").css('display', '');
1102
- jQuery("#tr_watermark_width_height").css('display', '');
1103
- jQuery("#tr_watermark_opacity").css('display', '');
1104
- jQuery("#tr_watermark_position").css('display', '');
1105
- jQuery("#tr_watermark_preview").css('display', '');
1106
- jQuery("#preview_watermark").css('display', 'table-cell');
1107
  break;
1108
  }
1109
  }
1110
  }
1111
 
1112
- function bwg_built_in_watermark(watermark_type) {
1113
- jQuery("#built_in_" + watermark_type).attr('checked', 'checked');
1114
- jQuery("#tr_built_in_watermark_url").css('display', 'none');
1115
- jQuery("#tr_built_in_watermark_size").css('display', 'none');
1116
- jQuery("#tr_built_in_watermark_opacity").css('display', 'none');
1117
- jQuery("#tr_built_in_watermark_text").css('display', 'none');
1118
- jQuery("#tr_built_in_watermark_font_size").css('display', 'none');
1119
- jQuery("#tr_built_in_watermark_font").css('display', 'none');
1120
- jQuery("#tr_built_in_watermark_color").css('display', 'none');
1121
- jQuery("#tr_built_in_watermark_position").css('display', 'none');
1122
- jQuery("#tr_built_in_watermark_preview").css('display', 'none');
1123
- jQuery("#preview_built_in_watermark").css('display', 'none');
1124
- switch (watermark_type) {
1125
- case 'watermark_type_text':
1126
- {
1127
- jQuery("#tr_built_in_watermark_opacity").css('display', '');
1128
- jQuery("#tr_built_in_watermark_text").css('display', '');
1129
- jQuery("#tr_built_in_watermark_font_size").css('display', '');
1130
- jQuery("#tr_built_in_watermark_font").css('display', '');
1131
- jQuery("#tr_built_in_watermark_color").css('display', '');
1132
- jQuery("#tr_built_in_watermark_position").css('display', '');
1133
- jQuery("#tr_built_in_watermark_preview").css('display', '');
1134
- jQuery("#preview_built_in_watermark").css('display', 'table-cell');
1135
  break;
1136
  }
1137
- case 'watermark_type_image':
1138
- {
1139
- jQuery("#tr_built_in_watermark_url").css('display', '');
1140
- jQuery("#tr_built_in_watermark_size").css('display', '');
1141
- jQuery("#tr_built_in_watermark_position").css('display', '');
1142
- jQuery("#tr_built_in_watermark_preview").css('display', '');
1143
- jQuery("#preview_built_in_watermark").css('display', 'table-cell');
1144
  break;
1145
  }
1146
  }
@@ -1148,71 +1153,72 @@ function bwg_built_in_watermark(watermark_type) {
1148
  }
1149
 
1150
  function bwg_inputs() {
1151
- jQuery(".spider_int_input").keypress(function (event) {
1152
  var chCode1 = event.which || event.paramlist_keyCode;
1153
- if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57) && (chCode1 != 46) && (chCode1 != 45)) {
1154
  return false;
1155
  }
1156
  return true;
1157
- });
1158
  }
1159
 
1160
  function bwg_show_hide_roles() {
1161
- if(jQuery("select[name='permissions']").val() == "Administrator"){
1162
- jQuery(".bwg_roles").hide();
1163
  }
1164
- else{
1165
- jQuery(".bwg_roles").show();
1166
  }
1167
  }
1168
 
1169
- function bwg_enable_disable(display, id, current) {
1170
- jQuery("#" + current).attr('checked', 'checked');
1171
- jQuery("#" + id).css('display', display);
1172
- if(id == 'tr_slideshow_title_position') {
1173
- jQuery("#tr_slideshow_full_width_title").css('display', display);
1174
  }
1175
  }
1176
 
1177
- function bwg_change_album_view_type(type) {
1178
- if (type == 'thumbnail') {
1179
- jQuery("#album_thumb_dimensions").html('Album thumb dimensions: ');
1180
- jQuery("#album_thumb_dimensions_x").css('display', '');
1181
- jQuery("#album_thumb_height").css('display', '');
1182
  }
1183
  else {
1184
- jQuery("#album_thumb_dimensions").html('Album thumb width: ');
1185
- jQuery("#album_thumb_dimensions_x").css('display', 'none');
1186
- jQuery("#album_thumb_height").css('display', 'none');
1187
  }
1188
  }
1189
 
1190
- function spider_check_isnum(e) {
1191
  var chCode1 = e.which || e.paramlist_keyCode;
1192
- if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57) && (chCode1 != 46) && (chCode1 != 45)) {
1193
  return false;
1194
  }
1195
  return true;
1196
  }
1197
 
1198
- function bwg_gallery_type(instagram_client_id) {
1199
  var response = true;
1200
- var value = jQuery('#gallery_type').val();
1201
- response = bwg_change_gallery_type(value, 'change', instagram_client_id);
1202
  return response;
1203
  }
1204
- function bwg_gallery_update_flag(){
1205
- var update_flag = jQuery('#tr_update_flag input[name=update_flag]:checked').val();
1206
- if(update_flag == ''){
1207
- jQuery('.spider_delete_button').show();
 
1208
  /*
1209
  jQuery("[id^=image_alt_text_]").prop("readonly",false);
1210
  jQuery("[id^=image_description_]").prop("readonly",false);
1211
  jQuery("[id^=redirect_url_]").prop("readonly",false);
1212
  */
1213
  }
1214
- else{
1215
- jQuery('.spider_delete_button').hide();
1216
  /*
1217
  jQuery("[id^=image_alt_text_]").prop("readonly", true);
1218
  jQuery("[id^=image_description_]").prop("readonly", true);
@@ -1221,219 +1227,221 @@ function bwg_gallery_update_flag(){
1221
  }
1222
  }
1223
 
1224
- bwg_gallery_change_update_flag = jQuery(function () {
1225
- jQuery('#tr_update_flag input[name=update_flag]').change(function(){
1226
- bwg_gallery_update_flag();
1227
- /*var update_flag = jQuery(this).val(); */
1228
- });
1229
- });
1230
 
1231
  /*returns false if user cancels or impossible to do.*/
 
1232
  /*
1233
  type_to_set:'' or 'instagram'
1234
  */
1235
- function bwg_change_gallery_type(type_to_set, warning_type, instagram_client_id) {
1236
- warning_type = (typeof warning_type === "undefined") ? "default" : warning_type;
1237
- jQuery('.bwg-gallery-type-options').hide();
1238
- if (type_to_set == 'instagram') {
1239
- if (instagram_client_id == '') {
1240
- alert(bwg_objectL10B.bwg_access_token);
1241
- jQuery('#gallery_type').val('');
1242
- return false;
1243
  }
1244
- if (!bwg_check_gallery_empty(true, true)) {
1245
  return false;
1246
  }
1247
 
1248
- jQuery("#add_instagram_gallery").show();
1249
 
1250
- jQuery('#gallery_type').val('instagram');
1251
- jQuery('#tr_instagram_post_gallery').show();
1252
 
1253
  /*hide features of only mixed gallery*/
1254
- jQuery('.spider_delete_button').hide();
1255
- jQuery('#spider_resize_button').hide();
1256
- jQuery('#content-add_media').hide();
1257
- jQuery('#add_image_bwg').hide();
1258
- jQuery('#import_image_bwg').hide();
1259
- jQuery('#show_add_embed').hide();
1260
- jQuery('#show_bulk_embed').hide();
1261
 
1262
  /*hide unused bulk action options */
1263
- jQuery("#bulk-action-selector-top option[value='image_resize']").hide();
1264
- jQuery("#bulk-action-selector-top option[value='image_recreate_thumbnail']").hide();
1265
- jQuery("#bulk-action-selector-top option[value='image_rotate_left']").hide();
1266
- jQuery("#bulk-action-selector-top option[value='image_rotate_right']").hide();
1267
- jQuery("#bulk-action-selector-top option[value='image_set_watermark']").hide();
1268
- jQuery("#bulk-action-selector-top option[value='image_reset']").hide();
1269
- }
1270
- else if(type_to_set == 'facebook') {
1271
- if (!bwg_check_gallery_empty(true, true)) {
1272
  return false;
1273
  }
1274
- jQuery('#add_facebook_gallery').show();
1275
 
1276
- jQuery('#gallery_type').val('facebook');
1277
- jQuery('#tr_instagram_post_gallery').hide();
1278
 
1279
  /*hide features of only mixed gallery*/
1280
- jQuery('.spider_delete_button').hide();
1281
- jQuery('#spider_resize_button').hide();
1282
- jQuery('#content-add_media').hide();
1283
- jQuery('#add_image_bwg').hide();
1284
- jQuery('#import_image_bwg').hide();
1285
- jQuery('#show_add_embed').hide();
1286
- jQuery('#show_bulk_embed').hide();
1287
 
1288
  /*reset update_flag radio button*/
1289
- jQuery("#update_flag_0").attr('checked', 'checked');
1290
  bwg_gallery_update_flag();
1291
- jQuery('#tr_update_flag').hide();
1292
- jQuery('#tr_autogallery_image_number').hide();
1293
- jQuery('#tr_instagram_gallery_add_button').hide();
1294
  /* default limit 20 */
1295
- jQuery("#facebook_gallery_image_limit").val(20);
1296
  }
1297
- else if (type_to_set == 'google_photos') {
1298
- var auth_google_status = jQuery("#auth_google_status").val();
1299
- if(auth_google_status == '0') {
1300
- jQuery("#auth_google_photos_gallery").show();
1301
- } else {
 
1302
  /*hide features of only mixed gallery*/
1303
- jQuery('.spider_delete_button').hide();
1304
- jQuery('#spider_resize_button').hide();
1305
- jQuery('#content-add_media').hide();
1306
- jQuery('#add_image_bwg').hide();
1307
- jQuery('#import_image_bwg').hide();
1308
- jQuery('#show_add_embed').hide();
1309
- jQuery('#show_bulk_embed').hide();
1310
  /*hide unused bulk action options */
1311
- jQuery("#bulk-action-selector-top option[value='image_resize']").hide();
1312
- jQuery("#bulk-action-selector-top option[value='image_recreate_thumbnail']").hide();
1313
- jQuery("#bulk-action-selector-top option[value='image_rotate_left']").hide();
1314
- jQuery("#bulk-action-selector-top option[value='image_rotate_right']").hide();
1315
- jQuery("#bulk-action-selector-top option[value='image_set_watermark']").hide();
1316
- jQuery("#bulk-action-selector-top option[value='image_reset']").hide();
1317
- jQuery(document).trigger('bwg_gallery_type_changed', type_to_set);
1318
  }
1319
  }
1320
- else if(type_to_set != '') {
1321
- jQuery(document).trigger('bwg_gallery_type_changed', type_to_set);
1322
  }
1323
  else {
1324
- var ids_string = jQuery("#ids_string").val();
1325
- ids_array = ids_string.split(",");
1326
- var tr_count = ids_array[0]=='' ? 0: ids_array.length;
1327
- if(tr_count != 0){
1328
- switch(warning_type) {
1329
  case 'default':
1330
- var allowed = confirm(bwg_objectL10B.default_warning);
1331
  break;
1332
  case 'change':
1333
- var allowed = confirm(bwg_objectL10B.change_warning);
1334
  break;
1335
  default:
1336
- var allowed = confirm(bwg_objectL10B.other_warning);
1337
  }
1338
 
1339
- if (allowed == false) {
1340
- jQuery('#gallery_type').val('instagram');
1341
  return false;
1342
  }
1343
  }
1344
 
1345
- jQuery('#gallery_type').val('');
1346
- jQuery('#tr_instagram_post_gallery').hide();
1347
 
1348
  /*reset update_flag radio button*/
1349
- jQuery("#update_flag_0").attr('checked', 'checked');
1350
  bwg_gallery_update_flag();
1351
 
1352
  /*show features of only mixed gallery*/
1353
- jQuery('.spider_delete_button').show();
1354
- jQuery('#spider_resize_button').show();
1355
- jQuery('#content-add_media').show();
1356
- jQuery('#add_image_bwg').show();
1357
- jQuery('#import_image_bwg').show();
1358
- jQuery('#show_add_embed').show();
1359
- jQuery('#show_bulk_embed').show();
1360
 
1361
  /* Show all bulk action options*/
1362
- jQuery("#bulk-action-selector-top option[value='image_resize']").hide();
1363
- jQuery("#bulk-action-selector-top option[value='image_recreate_thumbnail']").hide();
1364
- jQuery("#bulk-action-selector-top option[value='image_rotate_left']").hide();
1365
- jQuery("#bulk-action-selector-top option[value='image_rotate_right']").hide();
1366
- jQuery("#bulk-action-selector-top option[value='image_set_watermark']").hide();
1367
- jQuery("#bulk-action-selector-top option[value='image_reset']").hide();
1368
  }
1369
  return true;
1370
  }
1371
 
1372
  /*bulk embed handling*/
1373
- function bwg_bulk_embed(from, key){
1374
- switch (from) {
1375
- case 'instagram' : {
1376
- bwg_add_instagram_gallery(key, true);
1377
- break;
1378
- }
1379
- case 'facebook' : {
1380
- var appkey = key.split('|');
1381
- bwg_add_facebook_gallery(true, appkey[0], appkey[1]);
1382
- break;
1383
- }
1384
  }
1385
- return "";
 
1386
  }
1387
 
1388
- function bwg_check_instagram_gallery_input(instagram_client_id, from_popup){
1389
  from_popup = typeof from_popup !== 'undefined' ? from_popup : false;
1390
  var is_error = false;
1391
- if(from_popup){
1392
- if(instagram_client_id == ''){
1393
- alert(bwg_objectL10B.bwg_access_token);
1394
  is_error = true;
1395
  }
1396
- if( spider_check_required('popup_instagram_gallery_source', 'Instagram user URL')){
1397
  is_error = true;
1398
  }
1399
- if (jQuery('#popup_instagram_image_number').val() > 33 ||jQuery('#popup_instagram_image_number').val() < 1 ) {
1400
- alert(bwg_objectL10B.bwg_post_number);
1401
- jQuery('#popup_instagram_image_number').attr('style', 'border-color: #FF0000;');
1402
- jQuery('#popup_instagram_image_number').focus();
1403
- jQuery('html, body').animate({
1404
- scrollTop:jQuery('#popup_instagram_image_number').offset().top - 200
1405
- }, 500);
1406
  is_error = true;
1407
  }
1408
  }
1409
- else{
1410
- if (bwg_is_instagram_gallery()){
1411
- if(instagram_client_id == ''){
1412
- alert(bwg_objectL10B.bwg_access_token);
1413
- is_error = true;
1414
- }
1415
 
1416
- if(jQuery('#autogallery_image_number').val() > 33 || jQuery('#autogallery_image_number').val() < 1 ){
1417
 
1418
- alert(bwg_objectL10B.bwg_post_number);
1419
- jQuery('#autogallery_image_number').attr('style', 'border-color: #FF0000;');
1420
- jQuery('#autogallery_image_number').focus();
1421
- jQuery('html, body').animate({
1422
- scrollTop:jQuery('#autogallery_image_number').offset().top - 200
1423
- }, 500);
1424
  is_error = true;
1425
  }
1426
- }
1427
  }
1428
  return is_error;
1429
  }
1430
 
1431
  function bwg_is_instagram_gallery() {
1432
- var value = jQuery('#gallery_type').val();
1433
- if(value == 'instagram'){
1434
  return true;
1435
  }
1436
- else{
1437
  return false;
1438
  }
1439
  }
@@ -1444,25 +1452,25 @@ function bwg_is_instagram_gallery() {
1444
  * @param message:bool true if to alert that not empty
1445
  * @return true if empty, false if not empty
1446
  */
1447
- function bwg_check_gallery_empty(reset, message) {
1448
- var ids_string = jQuery("#ids_string").val();
1449
- var ids_array = ids_string.split(",");
1450
- var tr_count = ids_array[0]=='' ? 0: ids_array.length;
1451
- if(tr_count != 0){
1452
- if(reset){
1453
- if(message){
1454
- alert(bwg_objectL10B.bwg_not_empty);
1455
- }
1456
- jQuery('#gallery_type').val('');
1457
- jQuery('#tr_instagram_post_gallery').hide();
1458
- jQuery('#tr_gallery_source').hide();
1459
- jQuery('#tr_update_flag').hide();
1460
- jQuery('#tr_autogallery_image_number').hide();
1461
- jQuery('#tr_instagram_gallery_add_button').hide();
1462
- }
1463
- else{
1464
- if(message) {
1465
- alert(bwg_objectL10B.bwg_not_empty);
1466
  }
1467
  }
1468
  return false;
@@ -1472,90 +1480,94 @@ function bwg_check_gallery_empty(reset, message) {
1472
  }
1473
  }
1474
 
1475
- function bwg_convert_seconds(seconds) {
1476
- var sec_num = parseInt(seconds, 10);
1477
- var hours = Math.floor(sec_num / 3600);
1478
- var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
1479
- var seconds = sec_num - (hours * 3600) - (minutes * 60);
1480
 
1481
- if (minutes < 10 && hours != 0) {minutes = "0" + minutes;}
1482
- if (seconds < 10) {seconds = "0" + seconds;}
1483
- var time = (hours != 0 ? hours + ':' : '') + minutes + ':' + seconds;
 
 
 
 
1484
  return time;
1485
  }
1486
 
1487
- function bwg_convert_date(date, separator) {
1488
- var m_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
1489
- date = date.split(separator);
1490
- var dateArray = date[0].split("-");
1491
- return dateArray[2] + " " + m_names[dateArray[1] - 1] + " " + dateArray[0] + ", " + date[1].substring(0, 5);
1492
  }
1493
 
1494
  /* EMBED handling */
1495
- function bwg_get_embed_info(input_id) {
1496
- jQuery('#loading_div').show();
1497
- var url = encodeURI(jQuery("#" + input_id).val());
1498
  if ( !url ) {
1499
- alert(bwg_objectL10B.bwg_enter_url);
1500
- jQuery('#loading_div').hide();
1501
  return '';
1502
  }
1503
  var filesValid = [];
1504
  var data = {
1505
  'action': 'addEmbed',
1506
  'URL_to_embed': url,
1507
- 'async':true
1508
  };
1509
- /* get from the server data for the url. Here we use the server as a proxy, since Cross-Origin Resource Sharing AJAX is forbidden. */
1510
- jQuery.post(ajax_url, data, function(response) {
1511
- if(response == false){
1512
- alert(bwg_objectL10B.bwg_cannot_response);
1513
- jQuery('#loading_div').hide();
1514
  return '';
1515
  }
1516
  else {
1517
- var index_start = response.indexOf("WD_delimiter_start");
1518
- var index_end = response.indexOf("WD_delimiter_end");
1519
- if(index_start == -1 || index_end == -1){
1520
- alert(bwg_objectL10B.bwg_something_wrong);
1521
- jQuery('#loading_div').hide();
1522
  return '';
1523
  }
1524
 
1525
  /*filter out other echoed characters*/
1526
  /*18 is the length of "wd_delimiter_start"*/
1527
- response = response.substring(index_start+18,index_end);
1528
 
1529
- response_JSON = jQuery.parseJSON(response);
1530
- /*if indexed array, it means there is error*/
1531
- if(typeof response_JSON[0] !== 'undefined'){
1532
- alert( jQuery.parseJSON(response)[1] );
1533
- jQuery('#loading_div').hide();
1534
  return '';
1535
  }
1536
- else{
1537
  fileData = response_JSON;
1538
- filesValid.push(fileData);
1539
- bwg_add_image(filesValid);
1540
- document.getElementById(input_id).value = '';
1541
- jQuery('#loading_div').hide();
1542
  return 'ok';
1543
  }
1544
  }
1545
  return '';
1546
- });
1547
  return 'ok';
1548
  }
1549
 
1550
- function bwg_change_fonts(cont, google_fonts) {
1551
- if (jQuery("#" + google_fonts ).val() == 1 ) {
1552
- jQuery('#' + cont).next('.font-select').show();
1553
- jQuery('#' + cont + '_default').hide();
1554
  }
1555
  else {
1556
- jQuery('#' + cont).next('.font-select').hide();
1557
- jQuery('#' + cont + '_default').show();
1558
- jQuery('#' + cont + '_default').css({'font-family':jQuery('#' + cont + '_default').val()});
1559
  }
1560
  }
1561
 
@@ -1565,7 +1577,7 @@ function bwg_change_fonts(cont, google_fonts) {
1565
  * @param e
1566
  * @param multiple
1567
  */
1568
- function spider_media_uploader(e, multiple) {
1569
  if ( typeof multiple == "undefined" ) {
1570
  var multiple = false;
1571
  }
@@ -1593,41 +1605,41 @@ function spider_media_uploader(e, multiple) {
1593
 
1594
  var filesSelectedML = [];
1595
  for ( var image in attachment ) {
1596
- var image_url = attachment[image].url;
1597
  image_url = image_url.replace( bwg_objectL10B.wp_upload_dir.baseurl + '/', '' );
1598
  filesSelectedML.push( image_url );
1599
  }
1600
  jQuery( '#loading_div' ).show();
1601
 
1602
- postImageUrls(filesSelectedML, function (success, result) {
1603
  jQuery( '#loading_div' ).hide();
1604
- if (success) {
1605
- jQuery(".bwg-type-allowed").remove();
1606
  for ( var i in result ) {
1607
- if ( result[i].error ) {
1608
  add_ajax_msg( bwg_objectL10B.only_the_following_types_are_allowed, 'error' );
1609
  }
1610
- result[i].alt = attachment[i].alt ? attachment[i].alt : attachment[i].title;
1611
- result[i].description = attachment[i].description;
1612
  }
1613
  bwg_add_image( result );
1614
  }
1615
  else {
1616
  alert( bwg_objectL10B.import_failed );
1617
  }
1618
- });
1619
 
1620
- function postImageUrls(imageUrls, callback, index, results) {
1621
  var imagesChunkLength = 50;
1622
 
1623
- if (!index) {
1624
  index = 0;
1625
  }
1626
- if (!results) {
1627
  results = [];
1628
  }
1629
 
1630
- var imageUrlsChunk = imageUrls.slice(index, index + imagesChunkLength);
1631
  index += imagesChunkLength;
1632
  jQuery.ajax( {
1633
  url: bwg_objectL10B.ajax_url,
@@ -1635,21 +1647,21 @@ function spider_media_uploader(e, multiple) {
1635
  dataType: "json",
1636
  data: {
1637
  action: "bwg_UploadHandler",
1638
- file_namesML: JSON.stringify(imageUrlsChunk),
1639
  import: 1
1640
  },
1641
  success: function ( result ) {
1642
- results = results.concat(result);
1643
 
1644
- if (index < imageUrls.length) {
1645
- postImageUrls(imageUrls, callback, index, results);
1646
  }
1647
  else {
1648
- callback(true, results);
1649
  }
1650
  },
1651
  error: function ( xhr ) {
1652
- callback(false);
1653
  }
1654
  } );
1655
  }
@@ -1660,14 +1672,14 @@ function spider_media_uploader(e, multiple) {
1660
  }
1661
 
1662
  function add_ajax_msg( msg, status ) {
1663
- if ( !jQuery('.ajax-msg').hasClass('bwg-type-allowed') ) {
1664
- var html = '<div class="ajax-msg bwg-type-allowed">' +
1665
- '<div class="' + status + ' inline">' +
1666
- '<p><strong>' + msg + '</strong></p>' +
1667
- '</div>' +
1668
- '</div>';
1669
- jQuery( html ).insertAfter( "#add_desc" );
1670
- }
1671
  }
1672
 
1673
  /**
@@ -1675,17 +1687,17 @@ function add_ajax_msg( msg, status ) {
1675
  *
1676
  * @param that
1677
  */
1678
- function search(that) {
1679
- var form = jQuery(that).parents("form");
1680
 
1681
- if ( form.attr("id") == "bwg_gallery" ) { /* Gallery edit page. */
1682
- jQuery("#paged").val(1);
1683
- jQuery("#ajax_task").val('ajax_apply');
1684
- spider_ajax_save(form.attr("id"));
1685
  }
1686
  else {
1687
- var action = form.attr("action");
1688
- form.attr("action", action + "&paged=1&s=" + jQuery("input[name='s']").val());
1689
  form.submit();
1690
  }
1691
  }
@@ -1697,10 +1709,10 @@ function search(that) {
1697
  * @param that
1698
  * @returns {boolean}
1699
  */
1700
- function input_search(e, that) {
1701
- var key_code = (e.keyCode ? e.keyCode : e.which);
1702
- if (key_code == 13) { /*Enter keycode*/
1703
- search(that);
1704
  return false;
1705
  }
1706
  }
@@ -1712,28 +1724,28 @@ function input_search(e, that) {
1712
  * @param that
1713
  * @returns {boolean}
1714
  */
1715
- function input_pagination(e, that) {
1716
- var key_code = (e.keyCode ? e.keyCode : e.which);
1717
- if (key_code == 13) { /*Enter keycode*/
1718
- var to_page = jQuery(that).val();
1719
- var pages_count = jQuery(that).parents(".pagination-links").data("pages-count");
1720
- var form = jQuery(that).parents("form");
1721
- if ( form.attr("id") == "bwg_gallery" ) { /* Gallery edit page. */
1722
- if (to_page > pages_count) {
1723
  to_page = 1;
1724
  }
1725
- jQuery("#paged").val(to_page);
1726
- jQuery("#ajax_task").val('ajax_apply');
1727
- spider_ajax_save(form.attr("id"));
1728
  return false;
1729
  }
1730
  else {
1731
  if ( to_page > 0 && to_page <= pages_count ) {
1732
- var search = jQuery("input[name='s']").val() ? ("&s=" + jQuery("input[name='s']").val()) : "";
1733
- var action = form.attr("action");
1734
- form.attr("action", action + "&paged=" + to_page + search);
1735
  }
1736
- form.submit();
1737
  }
1738
  }
1739
  return true;
@@ -1744,91 +1756,91 @@ function input_pagination(e, that) {
1744
  *
1745
  * @param that
1746
  */
1747
- function wd_bulk_action(that) {
1748
- var form = jQuery(that).parents("form");
1749
- var action = jQuery("select[name='" + ( form.attr("id") == "bwg_gallery" ? 'image_' : '' ) + "bulk_action']").val();
1750
- if (action != -1) {
1751
- if (!jQuery("input[name^='check']").is(':checked')) {
1752
- alert(bwg.select_at_least_one_item);
1753
  return;
1754
  }
1755
- if (action == 'delete') {
1756
- if (!confirm(bwg.delete_confirmation)) {
1757
  return false;
1758
  }
1759
  }
1760
- else if (action == 'image_resize') {
1761
- jQuery(".opacity_resize_image").show();
1762
  return false;
1763
  }
1764
- else if (action == 'image_edit') {
1765
- jQuery(".opacity_image_desc").show();
1766
  return false;
1767
  }
1768
- else if (action == 'image_edit_alt') {
1769
- jQuery(".opacity_image_alt").show();
1770
  return false;
1771
  }
1772
- else if (action == 'image_edit_redirect') {
1773
- jQuery(".opacity_image_redirect").show();
1774
  return false;
1775
  }
1776
- else if (action == 'image_edit_description') {
1777
- jQuery(".opacity_image_description").show();
1778
  return false;
1779
  }
1780
- else if (action == 'image_add_tag') {
1781
- jQuery(".wd-add-tags").trigger("click");
1782
  return;
1783
  }
1784
- else if (action == 'set_image_pricelist') {
1785
- jQuery(".wd-add-pricelist").trigger("click");
1786
  return;
1787
  }
1788
- else if (action == 'remove_pricelist_all') {
1789
- if (!confirm(bwg.remove_pricelist_confirmation)) {
1790
  return false;
1791
  }
1792
  }
1793
- if ( form.attr("id") == "bwg_gallery" ) { /* Gallery edit page. */
1794
- jQuery("input[name='task']").val("save");
1795
- jQuery("input[name='ajax_task']").val(action);
1796
- spider_ajax_save(form.attr("id"));
1797
  }
1798
  else {
1799
- jQuery("input[name='task']").val(action);
1800
  form.submit();
1801
  }
1802
  }
1803
  }
1804
 
1805
  function bwg_change_theme_tab_item() {
1806
- var id = jQuery('.bwg-tabs .bwg-tab-item.active').attr('data-id');
1807
- jQuery('fieldset#'+ id).show();
1808
-
1809
- jQuery(document).on('click', '.bwg-tabs .bwg-tab-item', function () {
1810
- jQuery('.bwg-tabs .bwg-tab-item').removeClass('active');
1811
- jQuery(this).addClass('active');
1812
- var id = jQuery(this).attr('data-id');
1813
- jQuery('.spider_type_fieldset').hide();
1814
- jQuery('#'+ id ).show();
1815
- jQuery('#active_tab').val(jQuery(this).attr('data-id'));
1816
- });
1817
  }
1818
 
1819
  function bwg_filters() {
1820
- jQuery(document).on('change','select[id^=filter-by]', function(){
1821
- var val = jQuery(this).val();
1822
- var id = jQuery(this).attr('id');
1823
- window.location.href = bwg_updateQueryStringParameter(window.location.href, id, val);
1824
- });
1825
  }
1826
 
1827
- function bwg_updateQueryStringParameter(uri, key, value) {
1828
- var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
1829
- var separator = uri.indexOf('?') !== -1 ? "&" : "?";
1830
- if (uri.match(re)) {
1831
- return uri.replace(re, '$1' + key + "=" + value + '$2');
1832
  }
1833
  else {
1834
  return uri + separator + key + "=" + value;
@@ -1837,14 +1849,14 @@ function bwg_updateQueryStringParameter(uri, key, value) {
1837
 
1838
  /* Open/close section container on its header click. */
1839
  function bwg_toggle_postbox() {
1840
- jQuery(".hndle, .handlediv").each(function () {
1841
- jQuery(this).on("click", function () {
1842
- jQuery(this).parent(".postbox").toggleClass("closed");
1843
- });
1844
- });
1845
  }
1846
 
1847
- function spider_select_value(obj) {
1848
  obj.focus();
1849
  obj.select();
1850
  }
@@ -1857,101 +1869,101 @@ var bwg_j = 'pr_' + j_int;
1857
  *
1858
  * @param files
1859
  */
1860
- function bwg_add_image(files) {
1861
- var gallery_type = jQuery('#gallery_type option:selected').val();
1862
- jQuery('#check_all_items, #check_all').attr('checked', false);
1863
  for ( var i in files ) {
1864
- if ( files[i]['error'] == true ) {
1865
  continue;
1866
  }
1867
- var is_embed = files[i]['filetype'].indexOf("EMBED_") > -1 ? true : false;
1868
- var is_direct_url = files[i]['filetype'].indexOf("DIRECT_URL_") > -1 ? true : false;
1869
- var is_facebook_post = files[i]['filetype'].indexOf("_FACEBOOK_POST") > -1 ? 1 : 0;
1870
- var fb_post_url = (is_facebook_post) ? files[i]['filename'] : '';
1871
- if ( typeof files[i]['resolution'] != "undefined" ) {
1872
- var instagram_post_width = files[i]['resolution'].split('x')[0].trim();
1873
- var instagram_post_height = files[i]['resolution'].split('x')[1].trim();
1874
  }
1875
  else {
1876
  var instagram_post_width = "";
1877
  var instagram_post_height = "";
1878
  }
1879
- var html = jQuery(".wd-template").clone().html();
1880
  // Google Photos add-on is active.
1881
  if ( gallery_type == 'google_photos' ) {
1882
- jQuery('.bulkactions').remove();
1883
- jQuery('#images_table').find('.col_drag').remove();
1884
- jQuery('#images_table').find('.check-column').remove();
1885
- jQuery('.wd-template').find('.col_drag').remove();
1886
- jQuery('.wd-template').find('.check-column').remove();
1887
- jQuery('.wd-template').find('.bwg-td-item-redirect-url').remove();
1888
- jQuery('.wd-template').find('.bwg-td-item-tags').remove();
1889
- jQuery('.wd-template').find('#image_alt_text_tempid').prop("disabled", true);
1890
- jQuery('.wd-template').find('#image_description_tempid').prop("disabled", true);
1891
- html = jQuery(".wd-template").clone().html();
1892
- }
1893
-
1894
- if ( files[i]['filetype'] == 'SVG' ) {
1895
- jQuery('#images_table').find('.wd-image-actions').remove();
1896
- html = jQuery(".wd-template").clone().html();
1897
- }
1898
- var name = files[i]['name'].substr(0, files[i]['name'].lastIndexOf('.')) || files[i]['name'];
1899
- var filename = files[i]['filename'];
1900
  if ( name != "" ) {
1901
  filename = name;
1902
  }
1903
- html = html.replace(/tempid/g, bwg_j)
1904
- .replace(/tempnum/g, 1)
1905
- .replace(/tempimage_url/g, encodeURIComponent(files[i]['url']))
1906
- .replace(/tempthumb_url/g, encodeURIComponent(files[i]['thumb_url']))
1907
- .replace(/tempthumb_src=""/g, 'src="' + files[i]['thumb'] + '"')
1908
- .replace(/tempfilename/g, filename)
1909
- .replace(/tempdate/g, files[i]['date_modified'])
1910
- .replace(/tempresolution/g, files[i]['resolution'])
1911
- .replace(/tempthumbresolution/g, files[i]['resolution_thumb'])
1912
- .replace(/temp_instagram_post_width/g, instagram_post_width)
1913
- .replace(/temp_instagram_post_height/g, instagram_post_height)
1914
- .replace(/tempsize/g, files[i]['size'])
1915
- .replace(/tempfiletype/g, files[i]['filetype'])
1916
- .replace(/tempis_facebook_post/g, (is_facebook_post ? files[i]['is_facebook_post'] : 0))
1917
- .replace(/tempfb_post_url/g, (is_facebook_post ? files[i]['fb_post_url'] : 0));
1918
  if ( is_embed ) {
1919
- html = html.replace(/tempalt/g, name);
1920
- html = html.replace(/wd-image-actions/g, 'wd-image-actions wd-hide');
1921
  }
1922
  else {
1923
- html = html.replace(/tempalt/g, files[i]['alt']);
1924
  }
1925
- var description = files[i]['description'] ? files[i]['description'] : '';
1926
- if ( jQuery("#tbody_arr").data("meta") == 1 && !is_embed ) {
1927
- description += files[i]['description'] ? '\n' : '';
1928
- description += files[i]['credit'] ? 'Author: ' + files[i]['credit'] + '\n' : '';
1929
- description += ((files[i]['aperture'] != 0 && files[i]['aperture'] != '') ? 'Aperture: ' + files[i]['aperture'] + '\n' : '');
1930
- description += ((files[i]['camera'] != 0 && files[i]['camera'] != '') ? 'Camera: ' + files[i]['camera'] + '\n' : '');
1931
- description += ((files[i]['caption'] != 0 && files[i]['caption'] != '') ? 'Caption: ' + files[i]['caption'] + '\n' : '');
1932
- description += ((files[i]['iso'] != 0 && files[i]['iso'] != '') ? 'Iso: ' + files[i]['iso'] + '\n' : '');
1933
- description += ((files[i]['copyright'] != 0 && files[i]['copyright'] != '') ? 'Copyright: ' + files[i]['copyright'] + '\n' : '');
1934
- description += ((files[i]['orientation'] != 0 && files[i]['orientation'] != '') ? 'Orientation: ' + files[i]['orientation'] + '\n' : '');
1935
  }
1936
- html = html.replace(/tempdescription/g, description);
1937
 
1938
- jQuery("#tbody_arr").prepend("<tr id='tr_" + bwg_j + "'>");
1939
- jQuery("#tr_" + bwg_j).html(html);
1940
 
1941
  /* Change the popup dimensions. */
1942
- bwg_tb_window("#tr_" + bwg_j);
1943
 
1944
- jQuery("#ids_string").val(jQuery("#ids_string").val() + bwg_j + ',');
1945
- if ( jQuery("#tbody_arr").data("meta") == 1 && files[i]['tags'] ) {
1946
  /* If tags added to image from image file meta keywords.*/
1947
- var tagsTitles = jQuery.parseJSON(files[i]['tags']);
1948
  /* Add prefix to keywords to differ from other tags on save.*/
1949
  var tagsIds = [];
1950
  for ( var i in tagsTitles ) {
1951
- tagsIds[i] = 'bwg_' + tagsTitles[i];
1952
  }
1953
  /* Add titles instead of ids.*/
1954
- bwg_add_tag(bwg_j, tagsIds, tagsTitles);
1955
  }
1956
 
1957
  j_int++;
@@ -1960,175 +1972,176 @@ function bwg_add_image(files) {
1960
  /* Add drag and drop to new rows. */
1961
  wd_showhide_weights();
1962
  /* Set order input values after adding rows. */
1963
- var i = jQuery("td.col_drag").data("page-number");
1964
- jQuery(".wd-order").each(function () {
1965
- jQuery(this).val(++i);
1966
- });
1967
  /* Set number column values after adding rows. */
1968
  var i = 0;
1969
- jQuery("#tbody_arr .col_num").each(function () {
1970
- jQuery(this).html(++i);
1971
- });
1972
- window.parent.jQuery(".no-items").remove();
1973
- jQuery(".unsaved-msg", window.parent.document).removeClass("wd-hide");
1974
- jQuery(".ajax-msg", window.parent.document).addClass("wd-hide");
1975
- jQuery(".bwg-type-allowed", window.parent.document).removeClass("wd-hide");
1976
  }
1977
 
1978
  /**
1979
  * Change pagination to ajax pagination.
1980
  */
1981
  function wd_pagination() {
1982
- jQuery("#bwg_gallery a.wd-page ").each(function () {
1983
- jQuery(this).removeAttr("href");
1984
- jQuery(this).on("click", function() {
1985
- var paged = jQuery(this).data("paged");
1986
- jQuery("#paged").val(paged);
1987
- jQuery("#ajax_task").val('ajax_apply');
1988
- spider_ajax_save('bwg_gallery');
1989
- });
1990
- });
1991
- }
1992
-
1993
- function bwg_tb_window(cont_id) {
1994
- if (typeof cont_id === 'undefined') {
1995
  var cont_id = '';
1996
  }
1997
  var thickDims, tbWidth, tbHeight;
1998
  thickDims = function () {
1999
- var tbWindow = jQuery('#TB_window'), H = jQuery(window).height(), W = jQuery(window).width(), w, h;
2000
- w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 40;
2001
- h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 40;
2002
- if (tbWindow.size()) {
2003
- tbWindow.width(w).height(h);
2004
- jQuery('#TB_iframeContent').width(w).height(h - 30);
2005
- tbWindow.css({'margin-left': '-' + parseInt((w / 2), 10) + 'px'});
2006
- if (typeof document.body.style.maxWidth != 'undefined') {
2007
- tbWindow.css({'top': (H - h) / 2, 'margin-top': '0'});
2008
  }
2009
  }
2010
  };
2011
  thickDims();
2012
- jQuery(window).resize(function () {
2013
  thickDims()
2014
- });
2015
- jQuery(cont_id + ' a.thickbox-preview').click(function () {
2016
- tb_click.call(this);
2017
- var alink = jQuery(this).parents('.available-theme').find('.activatelink'), link = '', href = jQuery(this).attr('href'), url, text;
2018
- if (tbWidth = href.match(/&bwg_width=[0-9]+/)) {
2019
- tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
 
2020
  }
2021
  else {
2022
- tbWidth = jQuery(window).width() - 120;
2023
  }
2024
 
2025
- if (tbHeight = href.match(/&bwg_height=[0-9]+/)) {
2026
- tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
2027
  }
2028
  else {
2029
- tbHeight = jQuery(window).height() - 120;
2030
  }
2031
- if (alink.length) {
2032
- url = alink.attr('href') || '';
2033
- text = alink.attr('title') || '';
2034
  link = '&nbsp; <a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>';
2035
  }
2036
  else {
2037
- text = jQuery(this).attr('title') || '';
2038
  link = '&nbsp; <span class="tb-theme-preview-link">' + text + '</span>';
2039
  }
2040
  /* jQuery('#TB_title').css({'background-color': '#222', 'color': '#dfdfdf'}); */
2041
- jQuery('#TB_closeAjaxWindow').css({'float': 'right'});
2042
- jQuery('#TB_ajaxWindowTitle').css({'float': 'left'}).html(link);
2043
- jQuery('#TB_iframeContent').width('100%');
2044
  thickDims();
2045
  return false;
2046
- });
2047
  /* Theme details*/
2048
- jQuery('.theme-detail').click(function () {
2049
- jQuery(this).siblings('.themedetaildiv').toggle();
2050
  return false;
2051
- });
2052
  }
2053
 
2054
  /* Prevent new line. */
2055
- function prevent_new_line(e) {
2056
  if ( e.keyCode == 13 ) {
2057
  e.preventDefault();
2058
  return false;
2059
  }
2060
  }
2061
 
2062
- function bwg_gallery_type_options(gallery_type) {
2063
- if (gallery_type === undefined) {
2064
- gallery_type = jQuery('#gallery_type').val();
2065
- }
2066
- gallery_type_name = jQuery('.bwg-' + gallery_type).data('title');
2067
- pro_img_url = jQuery('.bwg-' + gallery_type).data('img-url');
2068
- pro_demo_link = jQuery('.bwg-' + gallery_type).data('demo-link');
2069
- jQuery('.gallery_options').hide();
2070
- jQuery('#' + gallery_type + '_options').show();
2071
- jQuery('#gallery_type').val(gallery_type);
2072
- if ( jQuery(".wd-free-msg").length != 0 ) {
2073
- jQuery(".wd-free-msg").hide();
2074
- jQuery(".bwg-pro-views").hide();
2075
- if ( jQuery('#' + gallery_type + '_options').hasClass("bwg-pro-views") ) {
2076
- jQuery(".wd-free-msg").show();
2077
- jQuery(".upgrade-to-pro-title").html( gallery_type_name + ' view is<br>available in Premium Version');
2078
- jQuery(".pro-views-img").attr('src',pro_img_url);
2079
- jQuery(".button-demo").attr('href', pro_demo_link );
2080
- }
2081
- }
2082
- jQuery('#bwg_tab_galleries_content .gallery_type').find('.view_type_img_active').css('display','none');
2083
- jQuery('#bwg_tab_galleries_content .gallery_type').find('.view_type_img').css('display','inline');
2084
- jQuery('#bwg_tab_galleries_content .gallery_type').removeClass('gallery_type_active');
2085
- jQuery('input[name=gallery_type][id=' + gallery_type + ']').attr('checked', 'checked').closest('.gallery_type').addClass('gallery_type_active');
2086
- jQuery('#bwg_tab_galleries_content .gallery_type_active').find('.view_type_img_active').css('display','inline');
2087
- jQuery('#bwg_tab_galleries_content .gallery_type_active').find('.view_type_img').css('display','none');
2088
  search_options();
2089
  }
2090
 
2091
- function bwg_album_type_options(album_type) {
2092
- if (album_type === undefined) {
2093
- album_type = jQuery('#album_type').val();
2094
- }
2095
- gallery_type_name = jQuery('.bwg-' + album_type).data('title');
2096
- pro_img_url = jQuery('.bwg-' + album_type).data('img-url');
2097
- pro_demo_link = jQuery('.bwg-' + album_type).data('demo-link');
2098
- jQuery('.album_options').hide();
2099
- jQuery('#' + album_type + '_options').show();
2100
- jQuery('#album_type').val(album_type);
2101
- if ( jQuery(".wd-free-msg").length != 0 ) {
2102
- jQuery(".wd-free-msg").hide();
2103
- jQuery(".bwg-pro-views").hide();
2104
- if (jQuery('#' + album_type + '_options').hasClass("bwg-pro-views")) {
2105
- jQuery(".wd-free-msg").show();
2106
- jQuery(".upgrade-to-pro-title").html( gallery_type_name + bwg.bwg_premium_text);
2107
- jQuery(".pro-views-img").attr('src', pro_img_url );
2108
- jQuery(".button-demo").attr('href', pro_demo_link );
2109
- }
2110
- }
2111
- jQuery('#bwg_tab_albums_content .gallery_type').find('.view_type_img_active').css('display','none');
2112
- jQuery('#bwg_tab_albums_content .gallery_type').find('.view_type_img').css('display','inline');
2113
- jQuery('#bwg_tab_albums_content .gallery_type').removeClass('gallery_type_active');
2114
- jQuery('input[name=album_type][id=' + album_type + ']').attr('checked', 'checked').closest('.gallery_type').addClass('gallery_type_active');
2115
- jQuery('#bwg_tab_albums_content .gallery_type_active').find('.view_type_img_active').css('display','inline');
2116
- jQuery('#bwg_tab_albums_content .gallery_type_active').find('.view_type_img').css('display','none');
2117
  search_options();
2118
  }
2119
 
2120
- function bwg_pagination_description(that) {
2121
- obj = jQuery(that);
2122
- obj.closest('.wd-group').find('.description').hide();
2123
- jQuery('#' + obj.attr('name') + '_' + obj.val() + '_description').show();
2124
  }
2125
 
2126
- function bwg_thumb_click_action( ) {
2127
- if (jQuery("#thumb_click_action_2").is(':checked')) {
2128
- jQuery('.bwg-lightbox-redirect').show();
2129
  }
2130
  else {
2131
- jQuery('.bwg-lightbox-redirect').hide();
2132
  }
2133
  }
2134
 
@@ -2139,10 +2152,10 @@ function bwg_thumb_click_action( ) {
2139
  * @returns {boolean}
2140
  */
2141
  function bwg_recreate_thumb( limit ) {
2142
- var img_option_width = jQuery("#upload_thumb_width").val();
2143
- var img_option_height = jQuery("#upload_thumb_height").val();
2144
 
2145
- var imgcount = jQuery('#bwg_imgcount').val();
2146
  var post_data = {
2147
  'task': 'resize_image_thumb',
2148
  'img_option_width': img_option_width,
@@ -2150,27 +2163,27 @@ function bwg_recreate_thumb( limit ) {
2150
  'limitstart': limit,
2151
  };
2152
 
2153
- if( limit == 0 ) {
2154
  jQuery( '#loading_div' ).show();
2155
  jQuery( '.updated' ).remove();
2156
  }
2157
- jQuery.ajax({
2158
  type: "POST",
2159
  url: bwg_options_url_ajax,
2160
  data: post_data,
2161
  success: function () {
2162
- if ( limit < imgcount ) {
2163
- limit += 50;
2164
- bwg_recreate_thumb( limit );
2165
- }
2166
- else {
2167
- jQuery( '#loading_div' ).hide();
2168
- jQuery( "<div class=\"updated inline\">\n" +
2169
- " <p><strong>"+bwg_objectL10B.recreate_success+"</strong></p>" +
2170
- " </div>" ).insertBefore( jQuery("#bwg_options_form").parent() );
2171
- }
2172
  }
2173
- });
2174
  return false;
2175
  }
2176
 
@@ -2180,31 +2193,31 @@ function bwg_recreate_thumb( limit ) {
2180
  * @param limit
2181
  * @returns {boolean}
2182
  */
2183
- function bwg_set_watermark( limit ){
2184
- var built_in_watermark_type = jQuery('input[name=built_in_watermark_type]:checked').val();
2185
- var imgcount = jQuery('#bwg_imgcount').val();
2186
  var post_data = {
2187
- 'task': 'image_set_watermark',
2188
  'built_in_watermark_type': built_in_watermark_type,
2189
- 'built_in_watermark_position': jQuery('input[name=built_in_watermark_position]:checked').val(),
2190
- 'limitstart': limit
2191
  };
2192
  if ( built_in_watermark_type == 'text' ) {
2193
- post_data.built_in_watermark_text = jQuery('#built_in_watermark_text').val();
2194
- post_data.built_in_watermark_font_size = jQuery('#built_in_watermark_font_size').val();
2195
- post_data.built_in_watermark_font = jQuery('#built_in_watermark_font').val();
2196
- post_data.built_in_watermark_color = jQuery('#built_in_watermark_color').val();
2197
  }
2198
  else {
2199
- post_data.built_in_watermark_size = jQuery('#built_in_watermark_size').val();
2200
- post_data.built_in_watermark_url = jQuery('#built_in_watermark_url').val();
2201
  }
2202
 
2203
  if ( limit == 0 ) {
2204
- jQuery('#loading_div').show();
2205
- jQuery('.updated').remove();
2206
  }
2207
- jQuery.ajax({
2208
  type: "POST",
2209
  url: bwg_options_url_ajax,
2210
  data: post_data,
@@ -2215,12 +2228,12 @@ function bwg_set_watermark( limit ){
2215
  bwg_set_watermark( limit );
2216
  }
2217
  else {
2218
- jQuery('#loading_div').hide();
2219
- jQuery('.bwg_error').remove();
2220
- jQuery('<div class="bwg_error">' + response.message + '</div>' ).insertBefore( jQuery("#bwg_options_form").parent() );
2221
  }
2222
  }
2223
- });
2224
 
2225
  return false;
2226
  }
@@ -2232,7 +2245,7 @@ function bwg_set_watermark( limit ){
2232
  * @returns {boolean}
2233
  */
2234
  function bwg_reset_watermark_all( limit ) {
2235
- var imgcount = jQuery('#bwg_imgcount').val();
2236
  var post_data = {
2237
  'task': 'image_recover_all',
2238
  'limitstart': limit,
@@ -2241,7 +2254,7 @@ function bwg_reset_watermark_all( limit ) {
2241
  jQuery( '#loading_div' ).show();
2242
  jQuery( '.updated' ).remove();
2243
  }
2244
- jQuery.ajax({
2245
  type: "POST",
2246
  url: bwg_options_url_ajax,
2247
  data: post_data,
@@ -2253,367 +2266,388 @@ function bwg_reset_watermark_all( limit ) {
2253
  else {
2254
  jQuery( '#loading_div' ).hide();
2255
  jQuery( "<div class=\"updated inline\">\n" +
2256
- " <p><strong>"+bwg_objectL10B.watermark_option_reset+"</strong></p>" +
2257
- " </div>" ).insertBefore( jQuery("#bwg_options_form").parent() );
2258
  }
2259
  }
2260
- });
2261
 
2262
  return false;
2263
  }
2264
 
2265
  /*galleries sortable */
2266
- function bwg_galleries_ordering () {
2267
- jQuery("#bwg-table-sortable").sortable({
2268
- handle: ".connectedSortable",
2269
- connectWith: ".connectedSortable",
2270
- update: function () {
2271
- var ids = [];
2272
- var ordering_ajax_url = jQuery("td.col_drag").data("ordering-url");
2273
- jQuery(".wd-id").each(function () {
2274
- ids.push( jQuery(this).val() );
2275
- });
2276
- jQuery.ajax({
2277
- type: "POST",
2278
- dataType: "json",
2279
- url: ordering_ajax_url,
2280
- data: { 'orders': ids },
2281
- success: function ( response ) {
2282
- jQuery(".ajax-msg").remove();
2283
- if ( response.message ) {
2284
- jQuery('<div class="ajax-msg">' + response.message + '</div>').insertAfter('.wrap .bwg-head-notice');
2285
- }
2286
- }
2287
- });
2288
- }
2289
- });
2290
- }
2291
-
2292
- function show_hide_compact_album_view ( val ) {
2293
- switch(val) {
2294
- case 'thumbnail': {
2295
- bwg_show_hide('tr_album_mosaic', 'none');
2296
- bwg_show_hide('tr_album_resizable_mosaic', 'none');
2297
- bwg_show_hide('tr_album_mosaic_total_width', 'none');
2298
- bwg_show_hide('for_album_image_title_show_hover_0', '');
2299
- bwg_show_hide('album_image_title_show_hover_0', '');
2300
- bwg_show_hide('for_album_ecommerce_icon_show_hover_0', '');
2301
- bwg_show_hide('tr_album_thumbnail_dimensions', '');
2302
- bwg_show_hide('tr_album_images_per_page', '');
2303
- }
2304
- break;
2305
- case 'masonry': {
2306
- bwg_show_hide('tr_album_mosaic', 'none');
2307
- bwg_show_hide('tr_album_resizable_mosaic', 'none');
2308
- bwg_show_hide('tr_album_mosaic_total_width', 'none');
2309
- bwg_show_hide('for_album_image_title_show_hover_0', '');
2310
- bwg_show_hide('album_image_title_show_hover_0', '');
2311
- bwg_show_hide('for_album_ecommerce_icon_show_hover_0', '');
2312
- bwg_show_hide('tr_album_thumbnail_dimensions', '');
2313
- bwg_show_hide('tr_album_images_per_page', '');
2314
- }
2315
- break;
2316
- case 'mosaic': {
2317
- bwg_show_hide('tr_album_mosaic', '');
2318
- bwg_show_hide('tr_album_resizable_mosaic', '');
2319
- bwg_show_hide('tr_album_mosaic_total_width', '');;
2320
- bwg_show_hide('for_album_image_title_show_hover_0', 'none');
2321
- bwg_show_hide('album_image_title_show_hover_0', 'none');
2322
- bwg_show_hide('for_album_ecommerce_icon_show_hover_0', 'none');
2323
- bwg_show_hide('tr_album_thumbnail_dimensions', '');
2324
- bwg_show_hide('tr_album_images_per_page', '');
2325
- }
2326
- break;
2327
- case 'slideshow': {
2328
- bwg_show_hide('tr_album_mosaic', 'none');
2329
- bwg_show_hide('tr_album_resizable_mosaic', 'none');
2330
- bwg_show_hide('tr_album_mosaic_total_width', 'none');
2331
- bwg_show_hide('for_album_image_title_show_hover_0', '');
2332
- bwg_show_hide('album_image_title_show_hover_0', '');
2333
- bwg_show_hide('for_album_ecommerce_icon_show_hover_0', '');
2334
- bwg_show_hide('tr_album_thumbnail_dimensions', 'none');
2335
- bwg_show_hide('tr_album_images_per_page', 'none');
2336
- }
2337
- case 'image_browser': {
2338
- bwg_show_hide('tr_album_mosaic', 'none');
2339
- bwg_show_hide('tr_album_resizable_mosaic', 'none');
2340
- bwg_show_hide('tr_album_mosaic_total_width', 'none');
2341
- bwg_show_hide('for_album_image_title_show_hover_0', '');
2342
- bwg_show_hide('album_image_title_show_hover_0', '');
2343
- bwg_show_hide('for_album_ecommerce_icon_show_hover_0', '');
2344
- bwg_show_hide('tr_album_thumbnail_dimensions', 'none');
2345
- bwg_show_hide('tr_album_images_per_page', 'none');
2346
- }
2347
- break;
2348
- case 'blog_style': {
2349
- bwg_show_hide('tr_album_mosaic', 'none');
2350
- bwg_show_hide('tr_album_resizable_mosaic', 'none');
2351
- bwg_show_hide('tr_album_mosaic_total_width', 'none');
2352
- bwg_show_hide('for_album_image_title_show_hover_0', '');
2353
- bwg_show_hide('album_image_title_show_hover_0', '');
2354
- bwg_show_hide('for_album_ecommerce_icon_show_hover_0', '');
2355
- bwg_show_hide('tr_album_thumbnail_dimensions', 'none');
2356
- bwg_show_hide('tr_album_images_per_page', '');
2357
- }
2358
- break;
2359
- case 'carousel': {
2360
- bwg_show_hide('tr_album_mosaic', 'none');
2361
- bwg_show_hide('tr_album_resizable_mosaic', 'none');
2362
- bwg_show_hide('tr_album_mosaic_total_width', 'none');
2363
- bwg_show_hide('for_album_image_title_show_hover_0', '');
2364
- bwg_show_hide('album_image_title_show_hover_0', '');
2365
- bwg_show_hide('for_album_ecommerce_icon_show_hover_0', '');
2366
- bwg_show_hide('tr_album_thumbnail_dimensions', 'none');
2367
- bwg_show_hide('tr_album_images_per_page', 'none');
2368
- }
2369
- break;
2370
- }
2371
- }
2372
-
2373
- function show_hide_extended_album_view ( val ) {
2374
- switch(val) {
2375
- case 'thumbnail': {
2376
- bwg_show_hide('tr_album_extended_mosaic', 'none');
2377
- bwg_show_hide('tr_album_extended_resizable_mosaic', 'none');
2378
- bwg_show_hide('tr_album_extended_mosaic_total_width', 'none');
2379
- bwg_show_hide('for_album_extended_image_title_show_hover_0', '');
2380
- bwg_show_hide('album_extended_image_title_show_hover_0', '');
2381
- bwg_show_hide('for_album_extended_ecommerce_icon_show_hover_0', '');
2382
- bwg_show_hide('tr_album_extended_thumbnail_dimensions', '');
2383
- bwg_show_hide('tr_album_extended_images_per_page', '');
2384
- }
2385
- break;
2386
- case 'masonry': {
2387
- bwg_show_hide('tr_album_extended_mosaic', 'none');
2388
- bwg_show_hide('tr_album_extended_resizable_mosaic', 'none');
2389
- bwg_show_hide('tr_album_extended_mosaic_total_width', 'none');
2390
- bwg_show_hide('for_album_extended_image_title_show_hover_0', '');
2391
- bwg_show_hide('album_extended_image_title_show_hover_0', '');
2392
- bwg_show_hide('for_album_extended_ecommerce_icon_show_hover_0', '');
2393
- bwg_show_hide('tr_album_extended_thumbnail_dimensions', '');
2394
- bwg_show_hide('tr_album_extended_images_per_page', '');
2395
- }
2396
- break;
2397
- case 'mosaic': {
2398
- bwg_show_hide('tr_album_extended_mosaic', '');
2399
- bwg_show_hide('tr_album_extended_resizable_mosaic', '');
2400
- bwg_show_hide('tr_album_extended_mosaic_total_width', '');
2401
- bwg_show_hide('for_album_extended_image_title_show_hover_0', 'none');
2402
- bwg_show_hide('album_extended_image_title_show_hover_0', 'none');
2403
- bwg_show_hide('for_album_extended_ecommerce_icon_show_hover_0', 'none');
2404
- bwg_show_hide('tr_album_extended_thumbnail_dimensions', '');
2405
- bwg_show_hide('tr_album_extended_images_per_page', '');
2406
- }
2407
- break;
2408
- case 'slideshow': {
2409
- bwg_show_hide('tr_album_extended_mosaic', 'none');
2410
- bwg_show_hide('tr_album_extended_resizable_mosaic', 'none');
2411
- bwg_show_hide('tr_album_extended_mosaic_total_width', 'none');
2412
- bwg_show_hide('for_album_extended_image_title_show_hover_0', '');
2413
- bwg_show_hide('album_extended_image_title_show_hover_0', '');
2414
- bwg_show_hide('for_album_extended_ecommerce_icon_show_hover_0', '');
2415
- bwg_show_hide('tr_album_extended_thumbnail_dimensions', 'none');
2416
- bwg_show_hide('tr_album_extended_images_per_page', 'none');
2417
- }
2418
- case 'image_browser': {
2419
- bwg_show_hide('tr_album_extended_mosaic', 'none');
2420
- bwg_show_hide('tr_album_extended_resizable_mosaic', 'none');
2421
- bwg_show_hide('tr_album_extended_mosaic_total_width', 'none');
2422
- bwg_show_hide('for_album_extended_image_title_show_hover_0', '');
2423
- bwg_show_hide('album_extended_image_title_show_hover_0', '');
2424
- bwg_show_hide('for_album_extended_ecommerce_icon_show_hover_0', '');
2425
- bwg_show_hide('tr_album_extended_thumbnail_dimensions', 'none');
2426
- bwg_show_hide('tr_album_extended_images_per_page', 'none');
2427
- }
2428
- break;
2429
- case 'blog_style': {
2430
- bwg_show_hide('tr_album_extended_mosaic', 'none');
2431
- bwg_show_hide('tr_album_extended_resizable_mosaic', 'none');
2432
- bwg_show_hide('tr_album_extended_mosaic_total_width', 'none');
2433
- bwg_show_hide('for_album_extended_image_title_show_hover_0', '');
2434
- bwg_show_hide('album_extended_image_title_show_hover_0', '');
2435
- bwg_show_hide('for_album_extended_ecommerce_icon_show_hover_0', '');
2436
- bwg_show_hide('tr_album_extended_thumbnail_dimensions', 'none');
2437
- bwg_show_hide('tr_album_extended_images_per_page', '');
2438
- }
2439
- break;
2440
- case 'carousel': {
2441
- bwg_show_hide('tr_album_extended_mosaic', 'none');
2442
- bwg_show_hide('tr_album_extended_resizable_mosaic', 'none');
2443
- bwg_show_hide('tr_album_extended_mosaic_total_width', 'none');
2444
- bwg_show_hide('for_album_extended_image_title_show_hover_0', '');
2445
- bwg_show_hide('album_extended_image_title_show_hover_0', '');
2446
- bwg_show_hide('for_album_extended_ecommerce_icon_show_hover_0', '');
2447
- bwg_show_hide('tr_album_extended_thumbnail_dimensions', 'none');
2448
- bwg_show_hide('tr_album_extended_images_per_page', 'none');
2449
- }
2450
- break;
2451
- }
2452
- }
2453
-
2454
- function bwg_show_hide(id, display) {
2455
- jQuery("#" + id).css('display', display);
2456
- }
2457
-
2458
- function search_get_current(sort) {
2459
  var current, div, div_id;
2460
  current = jQuery( '#search_current_match' ).attr( 'class' );
2461
  div = jQuery( '.search-div:visible' );
2462
  div_id = div.attr( 'id' );
2463
- if( sort == 'search_next' ){
2464
- if( !current ) {
2465
- if( jQuery( '.search-div' ).last().attr('id') == div_id ){
2466
- jQuery( 'a[href$=' + jQuery( '.search-div' ).first().attr('id') + ']' ).click();
2467
- } else if( div.is( ':has(div.bwg_change_gallery_type)' ) && !div.find( '.bwg_change_gallery_type span:last-child' ).hasClass( 'gallery_type_active' ) ){
2468
- var i=0, j;
2469
- div.find( '.gallery_type' ).each(function(){
2470
- if( jQuery( this ).hasClass( 'gallery_type_active' ) ){
 
 
2471
  jQuery( this ).removeClass( 'gallery_type_active' );
2472
- j=i;
2473
  }
2474
  i++;
2475
- })
2476
- div.find( '.bwg_change_gallery_type' ).children().eq( j+1 ).addClass( 'gallery_type_active' );
2477
- div.find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' ).next( 'option' ).attr( 'selected', 'selected' );
2478
- jQuery( '.gallery_type_active:visible' ).trigger('click');
2479
- } else if( div.next().is( ':has(div.bwg_change_gallery_type)' ) ){
2480
- jQuery( 'a[href$=' + div.next().attr('id') + ']' ).click();
 
2481
  div.next().find( '.bwg_change_gallery_type' ).children().removeClass( 'gallery_type_active' );
2482
  div.next().find( '.bwg_change_gallery_type' ).children().eq( 0 ).addClass( 'gallery_type_active' );
2483
- jQuery( '#' + div.next().find( '#gallery_types_name > option:selected' ).val() ).css({'display':'none'});
2484
  div.next().find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' );
2485
- div.next().find( '#gallery_types_name > option:first' ).attr( 'selected', 'selected' );
2486
- jQuery( '#' + div.next().find( '#gallery_types_name > option:selected' ).val() ).css({'display':'flex'});
2487
  jQuery( '.gallery_type_active:visible' ).click();
2488
- bwg_gallery_type_options(div.next().find( '#gallery_types_name > option:selected' ).val());
2489
 
2490
- } else{
2491
- jQuery( 'a[href$=' + div.next().attr('id') + ']' ).click();
2492
  }
2493
- } else {
2494
- ind = +current.indexOf(' search_highlight');
2495
- var next = +current.substring( 9, ind ) + 1;
 
 
 
 
2496
  var total = +jQuery( '.total_matches:visible' ).text();
2497
- if( next <= total ) {
2498
  jQuery( '#search_current_match' ).removeAttr( 'id' );
2499
  jQuery( '.' + next.toString() ).attr( 'id', 'search_current_match' );
2500
  jQuery( '.current_match' ).empty();
2501
  jQuery( '.current_match' ).append( next + '/' );
2502
- } else {
2503
- if( div.is( ':has(div.bwg_change_gallery_type)' ) && !div.find( '.bwg_change_gallery_type span:last-child' ).hasClass( 'gallery_type_active' ) ){
2504
- var i=0, j;
2505
- div.find( '.gallery_type' ).each(function(){
2506
- if( jQuery( this ).hasClass( 'gallery_type_active' ) ){
 
 
2507
  jQuery( this ).removeClass( 'gallery_type_active' );
2508
- j=i;
2509
  }
2510
  i++;
2511
- })
2512
- div.find( '.bwg_change_gallery_type' ).children().eq( j+1 ).addClass( 'gallery_type_active' );
2513
- div.find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' ).next( 'option' ).attr( 'selected', 'selected' );
2514
  jQuery( '.gallery_type_active:visible' ).click();
2515
- bwg_gallery_type_options(div.find( '#gallery_types_name > option:selected' ).val());
2516
- } else if( div.next().is( ':has(div.bwg_change_gallery_type)' ) ){
2517
- jQuery( 'a[href$=' + div.next().attr('id') + ']' ).click();
 
2518
  div.next().find( '.bwg_change_gallery_type' ).children().removeClass( 'gallery_type_active' );
2519
  div.next().find( '.bwg_change_gallery_type span:first-child' ).addClass( 'gallery_type_active' );
2520
- jQuery( '#' + div.next().find( '#gallery_types_name > option:selected' ).val() ).css({'display':'none'});
2521
  div.next().find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' );
2522
- div.next().find( '#gallery_types_name > option:first' ).attr( 'selected', 'selected' );
2523
- jQuery( '#' + div.next().find( '#gallery_types_name > option:selected' ).val() ).css({'display':'flex'});
2524
  div.next().find( '.gallery_type_active:visible' ).click();
2525
- bwg_gallery_type_options(div.next().find( '#gallery_types_name > option:selected' ).val());
2526
- } else if( jQuery( '.search-div' ).last().attr('id') == div_id ){
2527
- jQuery( 'a[href$=' + jQuery( '.search-div' ).first().attr('id') + ']' ).click();
2528
- } else {
2529
- jQuery( 'a[href$=' + div.next().attr('id') + ']' ).click();
2530
- }
2531
- }
2532
- }
2533
- } else if( sort == 'search_prev' ){
2534
- if( !current ) {
2535
- if( jQuery( '.search-div' ).first().attr('id') == div_id ){
2536
- jQuery( 'a[href$=' + jQuery( '.search-div' ).last().attr('id') + ']' ).click();
 
 
 
2537
  jQuery( '.1' ).attr( 'id', '' );
2538
- jQuery( '.' + jQuery( '.total_matches:visible' ).text()).attr( 'id', 'search_current_match' );
2539
- } else if( div.is( ':has(div.bwg_change_gallery_type)' ) && !div.find( '.bwg_change_gallery_type span:first-child' ).hasClass( 'gallery_type_active' ) ){
2540
- var i=0, j=0;
2541
- div.find( '.gallery_type:visible' ).each(function(){
2542
- if( jQuery( this ).hasClass( 'gallery_type_active' ) ){
 
 
2543
  jQuery( this ).removeClass( 'gallery_type_active' );
2544
- j=i;
2545
  }
2546
  i++;
2547
- })
2548
- div.find( '.bwg_change_gallery_type' ).children().eq( j-1 ).addClass( 'gallery_type_active' );
2549
- div.find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' ).prev( 'option' ).attr( 'selected', 'selected' );
2550
  jQuery( '.gallery_type_active:visible' ).click();
2551
- bwg_gallery_type_options(div.find( '#gallery_types_name > option:selected' ).val());
2552
  jQuery( '.1' ).removeAttr( 'id' );
2553
  var total_matches = jQuery( '.total_matches:visible' ).text();
2554
  jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2555
- } else if( div.prev().is( ':has(div.bwg_change_gallery_type)' ) ){
2556
- jQuery( 'a[href$=' + div.prev().attr('id') + ']' ).click();
 
2557
  div.prev().find( '.bwg_change_gallery_type' ).children().removeClass( 'gallery_type_active' );
2558
  div.prev().find( '.bwg_change_gallery_type span:last-child' ).addClass( 'gallery_type_active' );
2559
  div.prev().find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' );
2560
- div.prev().find( '#gallery_types_name > option:last' ).attr( 'selected', 'selected' );
2561
  jQuery( '.gallery_type_active:visible' ).click();
2562
- bwg_gallery_type_options(div.prev().find( '#gallery_types_name > option:selected' ).val());
2563
  jQuery( '.1' ).removeAttr( 'id' );
2564
  var total_matches = jQuery( '.total_matches:visible' ).text();
2565
  jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2566
- } else{
2567
- jQuery( 'a[href$=' + div.prev().attr('id') + ']' ).click();
 
2568
  jQuery( '.1' ).removeAttr( 'id' );
2569
  var total_matches = jQuery( '.total_matches:visible' ).text();
2570
- jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2571
  }
2572
- } else {
 
2573
  var total = +jQuery( '.total_matches:visible' ).text();
2574
- ind = +current.indexOf(' search_highlight');
2575
  var back = +current.substring( 9, ind ) - 1;
2576
- if( back > 0 ) {
2577
  jQuery( '#search_current_match' ).removeAttr( 'id' );
2578
  jQuery( '#search_current_color' ).removeAttr( 'id' );
2579
  jQuery( '.' + back.toString() ).attr( 'id', 'search_current_match' );
2580
  jQuery( '.current_match' ).empty();
2581
  jQuery( '.current_match' ).append( back + '/' );
2582
- } else if ( back == 0 ) {
2583
- if( div.is( ':has(div.bwg_change_gallery_type)' ) && !div.find( '.bwg_change_gallery_type span:first-child' ).hasClass( 'gallery_type_active' ) ){
2584
- var i=0, j=0;
2585
- div.find( '.gallery_type' ).each(function(){
2586
- if( jQuery( this ).hasClass( 'gallery_type_active' ) ){
 
 
2587
  jQuery( this ).removeClass( 'gallery_type_active' );
2588
- j=i;
2589
  }
2590
  i++;
2591
- })
2592
- div.find( '.bwg_change_gallery_type' ).children().eq( j-1 ).addClass( 'gallery_type_active' );
2593
- div.find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' ).prev( 'option' ).attr( 'selected', 'selected' );
2594
  jQuery( '.gallery_type_active:visible' ).click();
2595
- bwg_gallery_type_options(div.find( '#gallery_types_name > option:selected' ).val());
2596
  jQuery( '.1' ).removeAttr( 'id' );
2597
  var total_matches = jQuery( '.total_matches:visible' ).text();
2598
  jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2599
- } else if( div.prev().is( ':has(div.bwg_change_gallery_type)' ) ){
2600
- jQuery( 'a[href$=' + div.prev().attr('id') + ']' ).click();
 
2601
  div.prev().find( '.bwg_change_gallery_type' ).children().removeClass( 'gallery_type_active' );
2602
  div.prev().find( '.bwg_change_gallery_type span:last-child' ).addClass( 'gallery_type_active' );
2603
  div.prev().find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' );
2604
- div.prev().find( '#gallery_types_name > option:last' ).attr( 'selected', 'selected' );
2605
  jQuery( '.gallery_type_active:visible' ).click();
2606
- bwg_gallery_type_options(div.prev().find( '#gallery_types_name > option:selected' ).val());
2607
  jQuery( '.1' ).removeAttr( 'id' );
2608
  var total_matches = jQuery( '.total_matches:visible' ).text();
2609
  jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2610
- } else if( jQuery( '.search-div' ).first().attr('id') == div_id ){
2611
- jQuery( 'a[href$=' + jQuery( '.search-div' ).last().attr('id') + ']' ).click();
 
2612
  jQuery( '.1' ).removeAttr( 'id' );
2613
  var total_matches = jQuery( '.total_matches:visible' ).text();
2614
  jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2615
- } else {
2616
- jQuery( 'a[href$=' + div.prev().attr('id') + ']' ).click();
 
2617
  jQuery( '.1' ).removeAttr( 'id' );
2618
  var total_matches = jQuery( '.total_matches:visible' ).text();
2619
  jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
@@ -2621,23 +2655,25 @@ function search_get_current(sort) {
2621
  }
2622
  }
2623
  }
2624
- if( jQuery( '#search_current_match' ).length ){
2625
- if( jQuery( '#search_current_match' ).offset().top > jQuery( window ).height()-50 ) {
2626
- jQuery('html, body').animate({
2627
- scrollTop: jQuery("#search_current_match").offset().top-300}, 5);
2628
- } else{
2629
- jQuery(window).scrollTop(0);
 
 
2630
  }
2631
  }
2632
  }
2633
 
2634
- function search_options(){
2635
  var val, tab_id, div;
2636
  val = jQuery( '.search_in_options:visible' ).val();
2637
- jQuery( '.search_in_options').val(val);
2638
  div = jQuery( '.search-div:visible' );
2639
  tab_id = div.attr( 'id' );
2640
- if( val ){
2641
  val = val.toLowerCase().trim();
2642
  }
2643
  jQuery( '.total_matches' ).empty();
@@ -2646,60 +2682,67 @@ function search_options(){
2646
  jQuery( '.search_next' ).hide();
2647
  jQuery( '.search_close' ).hide();
2648
  jQuery( '.search_count' ).hide();
2649
- jQuery('.wd-group').each(function(){
2650
- jQuery(this).removeClass();
2651
- jQuery(this).addClass('wd-group');
2652
- })
2653
- jQuery('#search_current_match').removeAttr('id');
2654
- if( val != '' ) {
2655
  //css({'padding': '20px 5px 20px 5px','margin': '0 0 0 15px'});
2656
- if( div.has( '.postbox' ) ){
2657
  jQuery( '.postbox' ).removeClass( 'closed' );
2658
  }
2659
  jQuery( '.search_prev' ).show();
2660
  jQuery( '.search_next' ).show();
2661
  jQuery( '.search_close' ).show();
2662
- val = val.replace(/\s{2,}/g, ' ');
2663
  var matchcount = 0;
2664
  jQuery( '#' + tab_id ).find( '.wd-group' ).each( function () {
2665
- if( jQuery( this ).is ( ':visible' ) ) {
2666
  var label, description;
2667
  label = jQuery( this ).find( '.wd-label' ).text().toLowerCase();
2668
  description = jQuery( this ).find( 'p.description' ).text().toLowerCase();
2669
- if( label.match( val, 'gi' ) || description.match( val, 'gi' ) ) {
2670
- matchcount= matchcount+1;
2671
- if( matchcount == 1) {
2672
- jQuery(this).addClass( matchcount + ' search_highlight');
2673
- jQuery(this).attr('id','search_current_match');
2674
- } else {
2675
- jQuery(this).addClass( matchcount + ' search_highlight');
 
2676
  }
2677
  }
2678
- }
2679
- })
2680
- if( jQuery( '#search_current_match' ).length ){
2681
- if( jQuery( '#search_current_match' ).offset().top > jQuery( window ).height()-50 ) {
2682
- jQuery('html, body').animate({
2683
- scrollTop: jQuery("#search_current_match").offset().top-100}, 5);
2684
- } else{
2685
- jQuery(window).scrollTop(0);
2686
- }
2687
- }
2688
- jQuery('.total_matches').show();
2689
- jQuery('.total_matches').append(matchcount);
2690
- if( matchcount != 0 ){
2691
- jQuery( '.current_match' ).append( 1 +'/' );
2692
- if( jQuery( '#search_current_match' ).offset().top > jQuery( window ).height()-50 ) {
2693
- jQuery('html, body').animate({
2694
- scrollTop: jQuery("#search_current_match").offset().top-100}, 5);
2695
- } else{
2696
- jQuery(window).scrollTop(0);
2697
- }
2698
- } else if( matchcount == 0 ){
 
 
 
 
 
2699
  jQuery( '.current_match' ).append( 0 + '/' );
2700
  }
2701
- } else {
2702
- jQuery('.total_matches').empty();
 
2703
  jQuery( '.current_match' ).empty();
2704
  jQuery( '.postbox' ).removeClass( 'closed' );
2705
  jQuery( '.postbox' ).addClass( 'closed' );
@@ -2707,33 +2750,34 @@ function search_options(){
2707
  search_options_for_count();
2708
  }
2709
 
2710
- function search_options_for_count(){
2711
  var val, tab_id, div;
2712
  val = jQuery( '.search_in_options:visible' ).val();
2713
- jQuery( '.search_in_options').val(val);
2714
- if( val != '' ) {
2715
- jQuery( '.search-div' ).each(function(){
2716
- div=jQuery(this);
2717
  tab_id = div.attr( 'id' );
2718
  val = val.toLowerCase().trim();
2719
- jQuery('#' + tab_id + '_bage').empty();
2720
- if( div.has( '.postbox' ) ){
2721
  jQuery( '.postbox' ).removeClass( 'closed' );
2722
  }
2723
- val = val.replace(/\s{2,}/g, ' ');
2724
  var matchcount = 0;
2725
  jQuery( '#' + tab_id ).find( '.wd-group' ).each( function () {
2726
  var label, description;
2727
  label = jQuery( this ).find( '.wd-label' ).text().toLowerCase();
2728
  description = jQuery( this ).find( 'p.description' ).text().toLowerCase();
2729
- if( label.match( val, 'gi' ) || description.match( val, 'gi' ) ) {
2730
- matchcount= matchcount+1;
2731
  }
2732
- })
2733
- if( matchcount > 0 ) {
2734
- jQuery('#' + tab_id + '_bage').html(matchcount).show();
2735
  }
2736
- })
2737
- } else {
2738
  }
2739
- }
 
 
1
+ jQuery( function () {
2
  /* Change google font for <select>. */
3
+ if ( jQuery( '.google_font' ).length ) {
4
+ jQuery( '.google_font' ).each( function () {
5
+ var bwg_google_font = jQuery( this );
6
  bwg_google_font.fontselect();
7
+ input_name = jQuery( this ).closest( 'td' ).find( '.radio_google_fonts' ).children( 'input' ).attr( 'name' );
8
  data_view = input_name + '0';
9
+ if ( jQuery( "#" + data_view ).is( ":checked" ) ) {
10
+ bwg_google_font.next( '.font-select' ).hide();
11
+ jQuery( '#' + input_name ).show();
12
  }
13
  else {
14
+ bwg_google_font.next( '.font-select' ).show();
15
+ jQuery( '#' + input_name ).hide();
16
  }
17
+ } )
18
  }
19
+ jQuery( '.default-font' ).on( 'change', function () {
20
+ jQuery( this ).css( { 'font-family': jQuery( this ).val() } );
21
  } );
22
 
23
  /* press ESC hide loading. */
24
+ jQuery( document ).keyup( function ( e ) {
25
+ if ( e.keyCode == 27 ) {
26
+ jQuery( '#loading_div' ).hide();
27
  }
28
+ } );
29
  /* Galleries form. */
30
+ if ( jQuery( "form" ).hasClass( "bwg_galleries" ) ) {
31
+ if ( jQuery( "#tbody_arr" ).hasClass( "bwg-ordering" ) ) {
32
+ wd_showhide_weights();
33
+ }
34
  wd_pagination();
35
+ if ( jQuery( "#bwg-table-sortable" ).hasClass( "bwg-ordering" ) ) {
36
+ bwg_galleries_ordering();
37
+ }
38
  }
39
 
40
+ jQuery( "#check_all" ).on( "click", function () {
41
+ spider_check_all( "#check_all" );
42
+ } );
43
 
44
  /* Add tooltip to elements with "wd-info" class. */
45
+ if ( typeof jQuery( document ).tooltip != "undefined" ) {
46
+ jQuery( document ).tooltip( {
47
  show: null,
48
  items: ".wd-info",
49
  content: function () {
50
+ var element = jQuery( this );
51
+ if ( element.is( ".wd-info" ) ) {
52
+ var html = jQuery( '#' + jQuery( this ).data( "id" ) ).html();
53
  return html;
54
  }
55
  },
56
+ open: function ( event, ui ) {
57
+ if ( typeof ( event.originalEvent ) === 'undefined' ) {
58
  return false;
59
  }
60
+ var $id = jQuery( ui.tooltip ).attr( 'id' );
61
  /* close any lingering tooltips. */
62
+ jQuery( 'div.ui-tooltip' ).not( '#' + $id ).remove();
63
  },
64
+ close: function ( event, ui ) {
65
+ ui.tooltip.hover( function () {
66
+ jQuery( this ).stop( true ).fadeTo( 400, 1 );
67
  },
68
  function () {
69
+ jQuery( this ).fadeOut( '400', function () {
70
+ jQuery( this ).remove();
71
+ } );
72
+ } );
73
  },
74
  position: {
75
  my: "center top+30",
76
  at: "center top",
77
+ using: function ( position, feedback ) {
78
+ jQuery( this ).css( position );
79
+ jQuery( "<div>" )
80
+ .addClass( "tooltip-arrow" )
81
+ .addClass( feedback.vertical )
82
+ .addClass( feedback.horizontal )
83
+ .appendTo( this );
84
  }
85
  }
86
+ } );
87
  }
88
 
89
+ bwg_change_theme_tab_item();
90
+ bwg_filters();
91
+ bwg_toggle_postbox();
92
 
93
+ jQuery( ".bwg_requried" ).on( "keypress", function () {
94
+ jQuery( ".bwg_requried" ).removeAttr( "style" );
95
+ } );
96
 
97
+ jQuery( ".wd-filter" ).on( "change", function () {
98
+ var form = jQuery( this ).parents( "form" );
99
 
100
+ var action = form.attr( "action" );
101
  action += "&paged=1";
102
+ action += "&s=" + jQuery( "input[name='s']" ).val();
103
+ action += "&filter-by-gallery=" + jQuery( "select[name='filter[filter-by-gallery]']" ).val();
104
+ action += "&filter-by-image=" + jQuery( "select[name='filter[filter-by-image]']" ).val();
105
+ form.attr( "action", action );
106
 
107
  form.submit();
108
+ } );
109
 
110
  /* Options form. */
111
+ if ( jQuery( "form#bwg_options_form" ).length > 0 ) {
112
+ jQuery( ".bwg_tabs" ).each( function () {
113
+ jQuery( this ).tabs( {
114
+ active: jQuery( '#active_tab' ).val(),
115
+ activate: function ( event, ui ) {
116
+ jQuery( '#active_tab' ).val( ui.newTab.index() );
117
  if ( ui.newTab.index() == 1 ) {
118
  bwg_gallery_type_options();
119
  }
121
  bwg_album_type_options();
122
  }
123
  }
124
+ } );
125
+ } );
126
  bwg_gallery_type_options();
127
  bwg_album_type_options();
128
  }
129
 
130
  /* Changing label Number of image rows to columns in masonry view. */
131
+ jQuery( 'input[name=masonry]' ).on( 'click', function () {
132
+ if ( jQuery( this ).val() == 'horizontal' ) {
133
+ jQuery( '.masonry_col_num' ).hide();
134
+ jQuery( '.masonry_row_num' ).show();
135
+ }
136
+ else {
137
+ jQuery( '.masonry_row_num' ).hide();
138
+ jQuery( '.masonry_col_num' ).show();
139
+ }
140
+ } );
141
+
142
+ jQuery( '#bwg_image_editor_notice .notice-dismiss' ).on( 'click', function () {
143
+ var dismiss_url = bwg_ajax_url + '=' + jQuery( '#bwg_image_editor_notice' ).data( 'action' );
144
+ jQuery.ajax( {
145
  method: "POST",
146
  url: dismiss_url,
147
+ } );
148
+ } );
149
 
150
  /* Change the popup dimensions. */
151
  bwg_tb_window();
152
 
153
  /* Hide loading */
154
+ jQuery( '#loading_div.bwg_show' ).hide();
155
 
156
  bwg_lazy_load_gallery();
157
 
158
  /* Albums form. */
159
+ if ( jQuery( "form" ).hasClass( "bwg_albums" ) ) {
160
+ jQuery( "#bwg_tabs" ).sortable( {
161
  items: ".connectedSortable",
162
+ update: function ( event, tr ) {
163
  bwg_albums_galleries();
164
  }
165
+ } );
166
  bwg_albums_galleries();
167
 
168
+ setTimeout( function () {
169
+ if ( !jQuery( '#loading_div' ).is( ':visible' ) ) {
170
+ jQuery( '#bwg_albums #bwg_tabs' ).removeClass( 'hidden' );
171
+ }
172
+ }, 500 );
173
+ }
174
+ show_hide_compact_album_view( jQuery( '#album_view_type option:selected' ).val() );
175
+ jQuery( document ).on( 'change', '#album_view_type', function () {
176
+ var value = jQuery( this ).val();
177
+ show_hide_compact_album_view( value );
178
+ } );
179
+ show_hide_extended_album_view( jQuery( '#album_extended_view_type option:selected' ).val() );
180
+ jQuery( document ).on( 'change', '#album_extended_view_type', function () {
181
+ var value = jQuery( this ).val();
182
+ show_hide_extended_album_view( value );
183
+ } );
184
+
185
+ jQuery( '#bwg_ask_question' ).parent().attr( 'target', '_blank' );
186
+ if ( jQuery( '#search_in_options_container' ).length ) {
187
+ jQuery( window ).scroll( function () {
188
+ if ( jQuery( window ).scrollTop() >= jQuery( 'div.wd-list-view-header' ).offset().top + 150 ) {
189
+ jQuery( '#search_in_tablet' ).addClass( 'fixed' );
190
+ jQuery( '#search_in_options_container' ).addClass( 'fixed' );
191
+ jQuery( '#search_in_options_container' ).css( "width", +jQuery( '#search_in_options_container' ).parent().width() - jQuery( '#search_in_options_container' ).css( 'marginLeft' ).replace( 'px', '' ) - jQuery( '#search_in_options_container' ).css( 'marginRight' ).replace( 'px', '' ) );
192
+ jQuery( '#search_in_tablet' ).css( "width", +jQuery( '#search_in_tablet' ).parent().width() - jQuery( '#search_in_tablet' ).css( 'marginLeft' ).replace( 'px', '' ) - jQuery( '#search_in_tablet' ).css( 'marginRight' ).replace( 'px', '' ) );
193
  }
194
  else {
195
+ jQuery( '#search_in_options_container' ).removeClass( 'fixed' );
196
+ jQuery( '#search_in_tablet' ).removeClass( 'fixed' );
197
  }
198
+ } );
199
  }
200
+ jQuery( '.tabs' ).click( function () {
201
  search_options();
202
+ } );
203
+ jQuery( '.search_in_options:visible' ).keydown( function ( e ) {
204
  var shifted = false;
205
+ if ( e.keyCode == 37 ) {
206
  jQuery( '.search_prev:visible' ).click();
207
+ }
208
+ else if ( e.keyCode == 39 ) {
209
  jQuery( '.search_next:visible' ).click();
210
+ }
211
+ else if ( e.keyCode == 13 ) {
212
  e.preventDefault();
213
  return;
214
  }
215
+ } );
216
+ jQuery( '.search_in_options:visible' ).keyup( function ( e ) {
217
+ if ( e.keyCode > 64 && e.keyCode < 96 || !e.keyCode || e.keyCode == 8 ) {
218
+ search_options();
219
+ }
220
+ else if ( e.keyCode == 13 ) {
221
+ if ( e.shiftKey ) {
222
  jQuery( '.search_prev:visible' ).click();
223
+ }
224
+ else {
225
  jQuery( '.search_next:visible' ).click();
226
  }
227
+ }
228
+ else {
229
  return;
230
  }
231
+ } );
232
+ jQuery( '.search_next' ).click( function () {
233
+ search_get_current( 'search_next' );
234
+ } )
235
+ jQuery( '.search_prev' ).click( function () {
236
+ search_get_current( 'search_prev' );
237
+ } )
238
+ jQuery( '.search_close' ).on( 'click', function () {
239
+ jQuery( '.search_in_options:visible' ).val( '' );
240
  search_options();
241
+ } )
242
  jQuery( '.search_prev' ).hide();
243
  jQuery( '.search_next' ).hide();
244
+ jQuery( '.search_in_options' ).val( '' );
245
  jQuery( '.total_matches' ).hide();
246
  jQuery( '.current_match' ).empty();
247
  jQuery( '.search_close' ).hide();
250
  /* images in select list */
251
 
252
  /* change selected view*/
253
+ jQuery( '#bwg_options_form .bwg-gallery-ul li' ).click( function () {
254
+ if ( jQuery( this ).hasClass( 'gallery-type-li' ) ) {
255
+ jQuery( '.type-selected' ).removeClass( 'type-selected' );
256
+ jQuery( this ).addClass( 'type-selected' );
257
+ var value = jQuery( this ).data( 'value' );
258
+ var item = jQuery( this ).clone();
259
+ var parent_el = jQuery( this ).parent().parent().prev( '.bwg-btn-gallery-type-select' ).attr( 'id' );
260
+ jQuery( '#' + parent_el ).html( item );
261
+ jQuery( '#' + parent_el ).attr( 'value', value );
262
+ if ( parent_el == 'album-view-type' ) {
263
+ bwg_album_type_options( value );
264
+ jQuery( '#album_types_name' ).val( value );
265
+
266
+ }
267
+ else {
268
+ bwg_gallery_type_options( value );
269
+ jQuery( '#gallery_types_name' ).val( value );
270
+ }
271
+ change( parent_el );
272
+ }
273
+ } );
274
+
275
+ jQuery( 'body' ).click( function () {
276
+ jQuery( "#bwg_options_form .bwg-btn-gallery-type-select" ).each( function () {
277
+ if ( jQuery( this ).hasClass( "type-opened" ) ) {
278
+ jQuery( this ).removeClass( "type-opened" );
279
+ jQuery( this ).addClass( "type-closed" );
280
+ jQuery( this ).next( ".bwg-gallery-ul-div" ).toggle();
281
+ }
282
+ } )
283
+ } );
284
 
285
  /* functions to view div as select box */
286
+ jQuery( '#bwg_options_form .bwg-btn-gallery-type-select' ).click( function () {
287
+ var id = jQuery( this ).attr( 'id' );
288
+ if ( !jQuery( this ).next().find( '.bwg-gallery-ul .type-selected' ).length ) {
289
+ jQuery( this ).next().find( '.bwg-gallery-ul li:first-child' ).addClass( 'type-selected' );
290
+ }
291
+ change( id );
292
+ } );
293
+
294
+ } );
295
+
296
+ function change( view_type ) {
297
+ var view_type_div = jQuery( '#' + view_type ).closest( '.bwg-btn-gallery-type-select' );
298
+ if ( view_type_div.hasClass( 'type-closed' ) ) {
299
+ view_type_div.removeClass( 'type-closed' );
300
+ view_type_div.addClass( 'type-opened' );
301
+ }
302
+ else {
303
+ view_type_div.removeClass( 'type-opened' );
304
+ view_type_div.addClass( 'type-closed' );
305
+ }
306
+ jQuery( '#' + view_type ).next( '.bwg-gallery-ul-div' ).toggle();
307
  event.stopPropagation();
308
  }
309
 
310
  /* Load gallery images */
311
  function bwg_lazy_load_gallery() {
312
+ jQuery( ".gallery_image_thumb" ).each( function () {
313
+ var currImg = jQuery( this );
314
+ var src = currImg.attr( "data-src" );
315
+ if ( typeof src != "undefined" && src.length > 0 ) {
316
+ currImg.attr( "src", src );
317
+ currImg.removeAttr( "data-src" );
318
+ currImg.on( "load", function () {
319
+ currImg.removeClass( "bwg_no_border" );
320
+ } );
321
  }
322
+ } );
323
  }
324
 
325
  function bwg_albums_galleries() {
326
  var str = '';
327
+ jQuery( "#bwg_tabs>.connectedSortable" ).each( function () {
328
+ str += jQuery( this ).data( 'id' ) + ':' + jQuery( this ).data( 'is-album' ) + ',';
329
+ } );
330
+ jQuery( "#albums_galleries" ).val( str );
331
  }
332
 
333
+ function bwg_remove_album_gallery( obj ) {
334
+ jQuery( obj ).closest( ".connectedSortable" ).remove();
335
  bwg_albums_galleries();
336
  }
337
 
338
+ function bwg_add_album_gallery( alb_gal_id, is_album, preview_image, name, status, tb_remove ) {
339
+ var html = jQuery( '#bwg_template' ).html()
340
+ .replace( /%%alb_gal_id%%/g, alb_gal_id )
341
+ .replace( /%%is_album%%/g, is_album )
342
+ .replace( /%%preview_image%%=""/g, 'style="background-image:url(&quot;' + preview_image + '&quot;)"' )
343
+ .replace( /%%name%%/g, name )
344
+ .replace( /%%status%%/g, status );
345
+ jQuery( '#bwg_tabs' ).children( '#bwg_template' ).last().before( html );
346
  bwg_albums_galleries();
347
+ if ( tb_remove != false ) {
348
  window.parent.tb_remove();
349
  }
350
  }
351
 
352
  function spider_get_items() {
353
+ jQuery( '#tbody_albums_galleries input[type=checkbox]' ).each( function () {
354
+ obj = jQuery( this );
355
+ if ( obj.prop( 'checked' ) ) {
356
+ window.parent.bwg_add_album_gallery( obj.attr( 'data-id' ), obj.attr( 'data-is-album' ), obj.attr( 'data-preview-image' ), obj.attr( 'data-name' ), obj.attr( 'data-status' ), false );
357
  }
358
+ } );
359
  window.parent.tb_remove();
360
  }
361
 
362
+ function addPricelist( pricelist ) {
363
+ jQuery( '#image_pricelist_id', window.parent.document ).val( pricelist.id );
364
+ window.parent.spider_set_input_value( 'ajax_task', 'set_image_pricelist' );
365
+ window.parent.spider_ajax_save( 'bwg_gallery' );
366
  window.parent.tb_remove();
367
  }
368
 
369
+ function bwg_remove_pricelist( obj ) {
370
+ jQuery( "#remove_pricelist" ).val( jQuery( obj ).attr( "data-image-id" ) );
371
+ jQuery( "#pricelist_id_" + jQuery( obj ).attr( "data-pricelist-id" ) ).val( "" );
372
+ spider_set_input_value( 'ajax_task', 'remove_image_pricelist' );
373
+ spider_ajax_save( 'bwg_gallery' );
374
  }
375
 
376
  var bwg_save_count = 50;
377
+
378
  /**
379
  * Save gallery and images.
380
  *
382
  * @param tr_group Save counter.
383
  * @returns {boolean}
384
  */
385
+ function spider_ajax_save( form_id, tr_group ) {
386
+ if ( spider_check_required( 'name', 'Name' ) ) {
387
  return false;
388
  }
389
  var post_data = {};
390
+ post_data[ "task" ] = "save";
391
+ var ajax_task = jQuery( "#ajax_task" ).val(); /* Images list action task.*/
392
+ post_data[ "current_id" ] = jQuery( "#current_id" ).val(); /* Current gallery id.*/
393
+ post_data[ "image_current_id" ] = jQuery( "#image_current_id" ).val(); /* Current image id.*/
394
+ var ids_string = jQuery( "#ids_string" ).val(); /* Images ids separated by comma.*/
395
+ ids_string = ids_string.replace( /,\s*$/, "" );
396
+ post_data[ "image_bulk_action" ] = jQuery( "[name=image_bulk_action]" ).val(); /* Bulk action for images.*/
397
+ post_data[ "order_by" ] = jQuery( "select[name='order_by']" ).val(); /* Images sorting.*/
398
+ post_data[ "s" ] = jQuery( "input[name='s']" ).val(); /* Images filter.*/
399
+ post_data[ "paged" ] = jQuery( "#paged" ).val(); /* Images page number.*/
400
+ post_data[ "bwg_nonce" ] = jQuery( "#bwg_nonce" ).val(); /* Nonce*/
401
+ post_data[ "image_pricelist_id" ] = jQuery( "#image_pricelist_id" ).val();
402
+ post_data[ "remove_pricelist" ] = jQuery( "#remove_pricelist" ).val();
403
 
404
  /* Images ids array. */
405
+ var ids_array = ids_string.split( "," );
406
  /* Images count on page. */
407
  var tr_count = ids_array.length;
408
 
409
+ if ( !tr_group ) {
410
  var tr_group = 1;
411
  }
412
 
413
  /* Selected images count for message.*/
414
+ post_data[ "checked_items_count" ] = jQuery( "[name^=check]:not([id=check_all_items]):checked" ).length;
415
  /* Select all.*/
416
+ post_data[ "check_all_items" ] = jQuery( "[name=check_all_items]" ).is( ":checked" ) ? 1 : 0;
417
+ var limit = ( ajax_task == 'image_set_watermark' || ajax_task == 'image_reset' ) && ( post_data[ "check_all_items" ] || tr_count > bwg_save_count ) ? bwg_save_count * ( tr_group - 1 ) : false;
418
+ post_data[ "limit" ] = limit;
419
  /* Gallery paramters. */
420
+ post_data[ "name" ] = jQuery( "#name" ).val();
421
+ post_data[ "slug" ] = jQuery( "#slug" ).val();
422
+ post_data[ "old_slug" ] = jQuery( "#old_slug" ).val();
423
+ post_data[ "preview_image" ] = jQuery( "#preview_image" ).val();
424
+ post_data[ "published" ] = jQuery( "input[name=published]:checked" ).val();
425
+ if ( ( typeof tinyMCE != "undefined" ) &&
426
+ tinyMCE.activeEditor &&
427
+ !tinyMCE.activeEditor.isHidden() &&
428
+ tinyMCE.activeEditor.getContent ) {
429
+ post_data[ "description" ] = tinyMCE.activeEditor.getContent();
430
  }
431
  else {
432
+ post_data[ "description" ] = jQuery( "#description" ).val();
433
+ }
434
+ var gallery_type_input = jQuery( "#gallery_type" ).val();
435
+ post_data[ "gallery_source" ] = ( gallery_type_input == 'facebook' ) ? jQuery( "#facebook_gallery_source" ).val() : jQuery( "#gallery_source" ).val();
436
+ post_data[ "autogallery_image_number" ] = ( gallery_type_input == 'facebook' ) ? jQuery( "#facebook_gallery_image_limit" ).val() : jQuery( "#autogallery_image_number" ).val();
437
+ post_data[ "update_flag" ] = ( gallery_type_input == 'facebook' ) ? jQuery( "input[name=facebook_update]:checked" ).val() : jQuery( "input[name=update_flag]:checked" ).val();
438
+ var gallery_content_type = ( gallery_type_input == 'facebook' ) ? jQuery( "input[name=facebook_content_type]:checked" ).val() : jQuery( "input[name=instagram_post_gallery]:checked" ).val();
439
+ post_data[ "gallery_type" ] = gallery_type_input + ( gallery_content_type == 1 ? "_post" : "" );
440
+ post_data[ "gallery_type_old" ] = jQuery( "#gallery_type_old" ).val();
441
+ post_data[ "instagram_post_gallery" ] = gallery_content_type;
442
+ post_data[ "modified_date" ] = jQuery( "#modified_date" ).val();
443
 
444
  /* Remove images ids from begin and end of array. */
445
+ if ( tr_count > bwg_save_count ) {
446
+ ids_array.splice( tr_group * bwg_save_count, ids_array.length );
447
+ ids_array.splice( 0, ( tr_group - 1 ) * bwg_save_count );
448
+ ids_string = ids_array.join( "," );
449
  }
450
 
451
+ post_data[ "ajax_task" ] = ajax_task;
452
+ post_data[ "ids_string" ] = ids_string;
453
 
454
  /* Images dimensions to resize. */
455
+ post_data[ "image_width" ] = jQuery( "#image_width" ).val();
456
+ post_data[ "image_height" ] = jQuery( "#image_height" ).val();
457
  /* Images bulk edit values. */
458
+ post_data[ "title" ] = jQuery( "#title" ).val();
459
+ post_data[ "desc" ] = jQuery( "#desc" ).val();
460
+ post_data[ "redirecturl" ] = jQuery( "#redirecturl" ).val();
461
  /* Images bulk add tags ids. */
462
+ post_data[ "added_tags_id" ] = jQuery( "#added_tags_id" ).val();
463
  /* Images bulk add tags act. */
464
+ post_data[ "added_tags_act" ] = jQuery( "#added_tags_act" ).val();
465
  /* Images data. */
466
+ for ( var i in ids_array ) {
467
+ if ( ids_array.hasOwnProperty( i ) && ids_array[ i ] ) {
468
+ if ( jQuery( "#check_" + ids_array[ i ] ).prop( 'checked' ) == true ) {
469
+ post_data[ "check_" + ids_array[ i ] ] = true; /* jQuery("#check_" + ids_array[i]).val(); */
470
+ }
471
+ post_data[ "input_filename_" + ids_array[ i ] ] = jQuery( "#input_filename_" + ids_array[ i ] ).val();
472
+ post_data[ "image_url_" + ids_array[ i ] ] = decodeURIComponent( jQuery( "#image_url_" + ids_array[ i ] ).val() );
473
+ post_data[ "thumb_url_" + ids_array[ i ] ] = decodeURIComponent( jQuery( "#thumb_url_" + ids_array[ i ] ).val() );
474
+ post_data[ "image_description_" + ids_array[ i ] ] = ( typeof jQuery( "#image_description_" + ids_array[ i ] ).val() !== 'undefined' && jQuery( "#image_description_" + ids_array[ i ] ).val() ) ? jQuery( "#image_description_" + ids_array[ i ] ).val() : '';
475
+ post_data[ "image_alt_text_" + ids_array[ i ] ] = ( typeof jQuery( "#image_alt_text_" + ids_array[ i ] ).val() !== 'undefined' && jQuery( "#image_alt_text_" + ids_array[ i ] ).val() ) ? jQuery( "#image_alt_text_" + ids_array[ i ] ).val() : '';
476
+ post_data[ "redirect_url_" + ids_array[ i ] ] = jQuery( "#redirect_url_" + ids_array[ i ] ).val();
477
+ post_data[ "input_date_modified_" + ids_array[ i ] ] = jQuery( "#input_date_modified_" + ids_array[ i ] ).val();
478
+ post_data[ "input_size_" + ids_array[ i ] ] = jQuery( "#input_size_" + ids_array[ i ] ).val();
479
+ post_data[ "input_filetype_" + ids_array[ i ] ] = jQuery( "#input_filetype_" + ids_array[ i ] ).val();
480
+ post_data[ "input_resolution_" + ids_array[ i ] ] = jQuery( "#input_resolution_" + ids_array[ i ] ).val();
481
+ post_data[ "input_resolution_thumb_" + ids_array[ i ] ] = jQuery( "#input_resolution_thumb_" + ids_array[ i ] ).val();
482
+ post_data[ "input_crop_" + ids_array[ i ] ] = jQuery( "#input_crop_" + ids_array[ i ] ).val();
483
+ post_data[ "order_input_" + ids_array[ i ] ] = jQuery( "#order_input_" + ids_array[ i ] ).val();
484
+ post_data[ "tags_" + ids_array[ i ] ] = jQuery( "#tags_" + ids_array[ i ] ).val();
485
  }
486
  }
487
  /* Filter data before passing to ajax from add-ons. */
488
+ jQuery( document ).trigger( 'bwg_before_gallery_save_ajax', post_data );
489
 
490
  /* Loading. */
491
+ jQuery( "#loading_div" ).show();
492
 
493
  jQuery.post(
494
+ jQuery( '#' + form_id ).attr( 'action' ),
495
  post_data,
496
+ function ( data ) {
497
+ var str = jQuery( data ).find( "#current_id" ).val();
498
  if ( typeof str != "undefined" ) {
499
+ jQuery( "#current_id" ).val( str );
500
  }
501
  }
502
+ ).success( function ( data, textStatus, errorThrown ) {
503
+ if ( tr_count > bwg_save_count * tr_group || ( limit !== false && limit < jQuery( "#total" ).val() ) ) {
504
+ spider_ajax_save( form_id, ++tr_group );
505
  return;
506
  }
507
  else {
508
+ var form_action = jQuery( data ).find( '#bwg_gallery' ).attr( "action" );
509
  /* Something went wrong.*/
510
  if ( typeof form_action == "undefined" ) {
511
+ jQuery( "#loading_div" ).hide();
512
  return;
513
  }
514
+ jQuery( '#bwg_gallery' ).attr( "action", form_action );
515
  /*
516
  var str = jQuery(data).find('#bwg_gallery').html();
517
  jQuery('#bwg_gallery').html(str);
518
  var current_id = jQuery(data).find("#current_id").val();
519
  window.history.pushState(null, null, window.location.href + '&current_id=' + current_id);
520
  */
521
+ var str = jQuery( data ).find( '.bwg-page-header' ).html();
522
+ jQuery( '.bwg-page-header' ).html( str );
523
+ var str = jQuery( data ).find( '.ajax-msg' ).html();
524
+ jQuery( '.ajax-msg' ).html( str );
525
+ jQuery( ".ajax-msg" ).addClass( "wd-hide" );
526
+ var str = jQuery( data ).find( '.gal-msg' ).html();
527
+ jQuery( '.gal-msg' ).html( str );
528
+ var str = jQuery( data ).find( '.tablenav.top' ).html();
529
+ jQuery( '.tablenav.top' ).html( str );
530
+ var str = jQuery( data ).find( '#images_table' ).html();
531
+ jQuery( '#images_table' ).html( str );
532
+ var str = jQuery( data ).find( '.tablenav.bottom' ).html();
533
+ jQuery( '.tablenav.bottom' ).html( str );
534
+ var str = jQuery( data ).find( '.wd-hidden-values' ).html();
535
+ jQuery( '.wd-hidden-values' ).html( str );
536
+ var str = jQuery( data ).find( '#task' ).html();
537
+ jQuery( '#task' ).html( str );
538
+ var str = jQuery( data ).find( '#current_id' ).html();
539
+ jQuery( '#current_id' ).html( str );
540
 
541
  if ( ajax_task != '' ) {
542
+ jQuery( ".ajax-msg" ).removeClass( "wd-hide" );
543
  }
544
+ jQuery( ".gal-msg" ).removeClass( "wd-hide" );
545
 
546
+ jQuery( ".unsaved-msg" ).addClass( "wd-hide" );
547
+ if ( jQuery( "#tbody_arr" ).hasClass( "bwg-ordering" ) ) {
548
  wd_showhide_weights();
549
  }
550
  wd_pagination();
551
  /* bwg_toggle_postbox();*/
552
 
553
+ jQuery( "#check_all" ).on( "click", function () {
554
+ spider_check_all( "#check_all" );
555
+ } );
556
+ jQuery( "#loading_div" ).hide();
557
  bwg_lazy_load_gallery();
558
  wd_howto_src_change();
559
 
560
  /* Add click event to toggle button to expand columns.*/
561
+ jQuery( "tbody" ).on( "click", ".toggle-row", function () {
562
  jQuery( this ).closest( "tr" ).toggleClass( "is-expanded" );
563
+ } );
564
 
565
  /* Change the popup dimensions. */
566
+ bwg_tb_window( "#images_table" );
567
 
568
  /* Show popup for install manager if first gallery inserted */
569
+ var popup_status = jQuery( data ).find( '#twbb_layout' ).attr( "data-status" );
570
+ if ( popup_status == 1 ) {
571
  var win_height = jQuery( window ).height();
572
+ if ( win_height < 500 ) {
573
+ jQuery( "#twbb_layout_container" ).css( 'height', ( win_height - 35 ) );
574
  }
575
+ jQuery( "#twbb_layout" ).removeClass( "hide" );
576
  }
577
  }
578
+ } );
579
 
580
  return false;
581
  }
582
 
583
+ function bwg_sort_images( sorting ) {
584
+ var msg = jQuery( '.sorting-msg' );
585
+ if ( sorting != 'order_asc' ) {
586
+ msg.removeClass( 'wd-hide' );
587
  }
588
  else {
589
+ msg.addClass( 'wd-hide' );
590
  }
591
+ spider_set_input_value( 'task', 'save' );
592
+ spider_ajax_save( 'bwg_gallery' );
593
  }
594
 
595
  /* Set value by id. */
596
+ function spider_set_input_value( input_id, input_value ) {
597
+ if ( document.getElementById( input_id ) ) {
598
+ document.getElementById( input_id ).value = input_value;
599
  }
600
  }
601
 
602
  /* Submit form by id. */
603
+ function spider_form_submit( event, form_id ) {
604
+ if ( document.getElementById( form_id ) ) {
605
+ document.getElementById( form_id ).submit();
606
  }
607
+ if ( event.preventDefault ) {
608
  event.preventDefault();
609
  }
610
  else {
613
  }
614
 
615
  /* Check if required field is empty. */
616
+ function spider_check_required( id, name ) {
617
+ if ( jQuery( '#' + id ).val() == '' ) {
618
+ alert( name + ' ' + bwg_objectL10B.bwg_field_required );
619
+ jQuery( '#' + id ).attr( 'style', 'border-color: #FF0000;' );
620
+ jQuery( '#' + id ).focus();
621
+ jQuery( 'html, body' ).animate( {
622
+ scrollTop: jQuery( '#' + id ).offset().top - 200
623
+ }, 500 );
624
  return true;
625
  }
626
  else {
633
  *
634
  * @param click
635
  */
636
+ function wd_showhide_weights( click ) {
637
  if ( typeof click == "undefined" ) {
638
  var click = false;
639
  }
640
+ if ( jQuery( "select[name='order_by']" ).val() == 'order_asc' ) {
641
  if ( click ) {
642
  jQuery( ".wd-order" ).toggleClass( "wd-hide" );
643
  jQuery( ".wd-drag" ).toggleClass( "wd-hide" );
648
  jQuery( ".wd-drag" ).addClass( "wd-hide" );
649
  }
650
 
651
+ if ( !jQuery( ".wd-drag" ).hasClass( "wd-hide" ) ) { /* Drag and drop. */
652
+ jQuery( ".wd-order-thead" ).attr( "title", bwg_objectL10B.bwg_show_order );
653
+ jQuery( "#tbody_arr" ).sortable( {
654
  handle: ".connectedSortable",
655
  connectWith: ".connectedSortable",
656
+ update: function ( event, tr ) {
657
+ jQuery( ".unsaved-msg" ).removeClass( "wd-hide" );
658
+ jQuery( ".ajax-msg" ).addClass( "wd-hide" );
659
+ var i = jQuery( "td.col_drag" ).data( "page-number" );
660
+ jQuery( ".wd-order" ).each( function () {
661
+ jQuery( this ).val( ++i );
662
+ } );
663
  }
664
+ } );
665
  }
666
  else { /* Order inputs. */
667
+ jQuery( ".wd-order-thead" ).attr( "title", bwg_objectL10B.bwg_hide_order );
668
  }
669
  }
670
 
680
  });*/
681
 
682
  /* Check all items. */
683
+ function spider_check_all_items( event ) {
684
+ if ( jQuery( "#check_all_items" ).is( ':checked' ) ) {
685
+ jQuery( "#check_all_items" ).prop( 'checked', false );
686
  }
687
  else {
688
+ jQuery( "#check_all_items" ).prop( 'checked', true );
689
  }
690
+ spider_check_all_items_checkbox( event );
691
  }
692
 
693
+ function spider_check_all_items_checkbox( event ) {
694
+ if ( jQuery( "#check_all_items" ).is( ':checked' ) ) {
695
  /* Generate message about how many images are selected. */
696
+ var saved_items = ( parseInt( jQuery( ".displaying-num" ).html() ) ? parseInt( jQuery( ".displaying-num" ).html() ) : 0 );
697
+ var added_items = ( jQuery( 'input[id^="check_pr_"]' ).length ? parseInt( jQuery( 'input[id^="check_pr_"]' ).length ) : 0 );
698
  var items_count = added_items + saved_items;
699
  if ( items_count ) {
700
+ jQuery( ".ajax-msg" )
701
+ .html( "<div class='notice notice-warning wd-notice'><p><strong>" + ( items_count == 1 ? bwg_objectL10B.selected_item : bwg_objectL10B.selected_items ).replace( "%d", items_count ) + "</strong></p></div>" )
702
+ .removeClass( "wd-hide" );
703
  }
704
 
705
+ if ( !jQuery( "#check_all" ).is( ':checked' ) ) {
706
+ jQuery( '#check_all' ).trigger( 'click' );
707
  }
708
  }
709
  else {
710
+ if ( jQuery( "#check_all" ).is( ':checked' ) ) {
711
+ jQuery( '#check_all' ).trigger( 'click' );
712
  }
713
  }
714
  event.stopPropagation();
715
  }
716
 
717
+ function spider_check_all( current ) {
718
+ if ( !jQuery( current ).is( ':checked' ) ) {
719
+ jQuery( '#check_all_items' ).prop( 'checked', false );
720
+ jQuery( ".ajax-msg" ).addClass( "wd-hide" );
721
  }
722
  }
723
 
724
  /* Set uploader to button class. */
725
+ function spider_uploader( button_id, input_id, delete_id, img_id ) {
726
+ if ( typeof img_id == 'undefined' ) {
727
  img_id = '';
728
  }
729
+ jQuery( function () {
730
  var formfield = null;
731
  window.original_send_to_editor = window.send_to_editor;
732
+ window.send_to_editor = function ( html ) {
733
+ if ( formfield ) {
734
+ var fileurl = jQuery( 'img', html ).attr( 'src' );
735
+ if ( !fileurl ) {
736
  var exploded_html;
737
  var exploded_html_askofen;
738
+ exploded_html = html.split( '"' );
739
+ for ( i = 0; i < exploded_html.length; i++ ) {
740
+ exploded_html_askofen = exploded_html[ i ].split( "'" );
741
  }
742
+ for ( i = 0; i < exploded_html.length; i++ ) {
743
+ for ( j = 0; j < exploded_html_askofen.length; j++ ) {
744
+ if ( exploded_html_askofen[ j ].search( "href" ) ) {
745
+ fileurl = exploded_html_askofen[ i + 1 ];
746
  break;
747
  }
748
  }
749
  }
750
+ if ( img_id != '' ) {
751
+ alert( bwg_objectL10B.bwg_select_image );
752
  tb_remove();
753
  return;
754
  }
755
+ window.parent.document.getElementById( input_id ).value = fileurl;
756
+ window.parent.document.getElementById( button_id ).style.display = "none";
757
+ window.parent.document.getElementById( input_id ).style.display = "inline-block";
758
+ window.parent.document.getElementById( delete_id ).style.display = "inline-block";
759
  }
760
  else {
761
+ if ( img_id == '' ) {
762
+ alert( bwg_objectL10B.bwg_field_required );
763
  tb_remove();
764
  return;
765
  }
766
+ window.parent.document.getElementById( input_id ).value = fileurl;
767
+ window.parent.document.getElementById( button_id ).style.display = "none";
768
+ window.parent.document.getElementById( delete_id ).style.display = "inline-block";
769
+ if ( ( img_id != '' ) && window.parent.document.getElementById( img_id ) ) {
770
+ window.parent.document.getElementById( img_id ).src = fileurl;
771
+ window.parent.document.getElementById( img_id ).style.display = "inline-block";
772
  }
773
  }
774
+ formfield.val( fileurl );
775
  tb_remove();
776
  }
777
  else {
778
+ window.original_send_to_editor( html );
779
  }
780
  formfield = null;
781
  };
782
+ formfield = jQuery( this ).parent().parent().find( ".url_input" );
783
+ tb_show( '', 'media-upload.php?type=image&TB_iframe=true' );
784
+ jQuery( '#TB_overlay,#TB_closeWindowButton' ).bind( "click", function () {
785
  formfield = null;
786
+ } );
787
  return false;
788
+ } );
789
  }
790
 
791
  /* Remove uploaded file. */
792
+ function spider_remove_url( button_id, input_id, delete_id, img_id ) {
793
+ if ( typeof img_id == 'undefined' ) {
794
  img_id = '';
795
  }
796
+ if ( document.getElementById( button_id ) ) {
797
+ document.getElementById( button_id ).style.display = '';
798
  }
799
+ if ( document.getElementById( input_id ) ) {
800
+ document.getElementById( input_id ).value = '';
801
+ document.getElementById( input_id ).style.display = 'none';
802
  }
803
+ if ( document.getElementById( delete_id ) ) {
804
+ document.getElementById( delete_id ).style.display = 'none';
805
  }
806
+ if ( ( img_id != '' ) && window.parent.document.getElementById( img_id ) ) {
807
+ document.getElementById( img_id ).src = '';
808
+ document.getElementById( img_id ).style.display = 'none';
809
  }
810
  }
811
 
812
  /* Add album preview image. */
813
+ function bwg_add_preview_image( files ) {
814
+ document.getElementById( "preview_image" ).value = files[ 0 ][ 'thumb_url' ];
815
+ document.getElementById( "button_preview_image" ).style.display = "none";
816
+ document.getElementById( "delete_preview_image" ).style.display = "inline-block";
817
+ if ( document.getElementById( "img_preview_image" ) ) {
818
+ document.getElementById( "img_preview_image" ).src = files[ 0 ][ 'reliative_url' ];
819
+ document.getElementById( "img_preview_image" ).style.display = "inline-block";
820
  }
821
  }
822
 
823
+ function spider_reorder_items( tbody_id ) {
824
+ jQuery( "#" + tbody_id ).sortable( {
825
+ handle: ".connectedSortable",
826
+ connectWith: ".connectedSortable",
827
+ update: function ( event, tr ) {
828
+ spider_sortt( tbody_id );
829
  }
830
+ } );
831
  }
832
 
833
+ function spider_sortt( tbody_id ) {
834
  var str = "";
835
  var counter = 0;
836
+ jQuery( "#" + tbody_id ).children().each( function () {
837
+ str += ( ( jQuery( this ).attr( "id" ) ).substr( 3 ) + "," );
838
  counter++;
839
+ } );
840
+ jQuery( "#albums_galleries" ).val( str );
841
+ if ( !counter ) {
842
+ document.getElementById( "table_albums_galleries" ).style.display = "none";
843
  }
844
  }
845
 
846
+ function spider_remove_row( tbody_id, event, obj ) {
847
  var span = obj;
848
+ var tr = jQuery( span ).closest( "tr" );
849
+ jQuery( tr ).remove();
850
+ spider_sortt( tbody_id );
851
  }
852
 
853
+ function spider_jslider( idtaginp ) {
854
+ jQuery( function () {
855
+ var inpvalue = jQuery( "#" + idtaginp ).val();
856
+ if ( inpvalue == "" ) {
857
  inpvalue = 50;
858
  }
859
+ jQuery( "#slider-" + idtaginp ).slider( {
860
+ range: "min",
861
+ value: inpvalue,
862
+ min: 1,
863
+ max: 100,
864
+ slide: function ( event, ui ) {
865
+ jQuery( "#" + idtaginp ).val( "" + ui.value );
866
  }
867
+ } );
868
+ jQuery( "#" + idtaginp ).val( "" + jQuery( "#slider-" + idtaginp ).slider( "value" ) );
869
+ } );
870
  }
871
 
872
  /**
874
  *
875
  * @param image_id
876
  */
877
+ function bwg_bulk_add_tags( tag_id, act ) {
878
  var tagIds = "";
879
  if ( tag_id == "" ) {
880
+ jQuery( ".tags:checked" ).each( function () {
881
+ tagIds += jQuery( this ).data( "id" ).toString() + ",";
882
+ } );
883
  }
884
  else {
885
  tagIds = tag_id;
886
  }
887
+ jQuery( '#added_tags_id', window.parent.document ).val( tagIds );
888
+ jQuery( '#added_tags_act', window.parent.document ).val( act );
889
+ window.parent.spider_set_input_value( 'ajax_task', 'image_add_tag' );
890
+ window.parent.spider_ajax_save( 'bwg_gallery' );
891
  window.parent.tb_remove();
892
  }
893
 
896
  *
897
  * @param image_id
898
  */
899
+ function bwg_add_tags( image_id ) {
900
  var tagIds = [];
901
  var titles = [];
902
+ jQuery( ".tags:checked" ).each( function () {
903
+ tagIds.push( jQuery( this ).data( "id" ).toString() );
904
+ titles.push( jQuery( this ).data( "name" ) );
905
+ } );
906
+ window.parent.bwg_add_tag( image_id, tagIds, titles );
907
  }
908
 
909
  /**
913
  * @param tagIds
914
  * @param titles
915
  */
916
+ function bwg_add_tag( image_id, tagIds, titles ) {
917
  window.parent.bwg_create_loading_block();
918
+ /* Images ids array. */
919
  var ids_array;
920
+ if ( image_id == '0' ) {
921
  var flag = false;
922
+ var ids_string = jQuery( "#ids_string" ).val();
923
+ ids_array = ids_string.split( "," );
924
+ if ( jQuery( "#check_all_items" ).attr( "checked" ) ) {
925
  var added_tags = '';
926
+ for ( i = 0; i < tagIds.length; i++ ) {
927
+ added_tags = added_tags + tagIds[ i ] + ',';
928
  }
929
+ jQuery( "#added_tags_id" ).val( added_tags );
930
  }
931
  }
932
  else {
933
  image_id = image_id + ',';
934
 
935
+ ids_array = image_id.split( "," );
936
  var flag = true;
937
  }
938
+ for ( var i in ids_array ) {
939
+ if ( ids_array.hasOwnProperty( i ) && ids_array[ i ] ) {
940
+ if ( jQuery( "#check_" + ids_array[ i ] ).prop( 'checked' ) || flag ) {
941
+ image_id = ids_array[ i ];
942
+ var tag_ids = document.getElementById( 'tags_' + image_id ).value;
943
+ tags_array = tag_ids.split( ',' );
944
  var counter = 0;
945
+ for ( i = 0; i < tagIds.length; i++ ) {
946
+ if ( tags_array.indexOf( tagIds[ i ] ) == -1 ) { /* To prevent add same tag multiple times. */
947
+ tag_ids = tag_ids + tagIds[ i ] + ',';
948
+ var html = jQuery( "#" + image_id + "_tag_temptagid" ).clone().html();
949
  /* Remove white spaces from keywords to set as id and remove prefix.*/
950
+ var id = tagIds[ i ].replace( /\s+/g, '_' ).replace( 'bwg_', '' ).replace( /\//g, "" ).replace( /&amp;/g, "" ).replace( /&/g, "" ).replace( /@/g, "" ).replace( /'/g, "39" ).replace( /"/g, "34" ).replace( /!/g, "" ).replace(".", "");
951
+ html = html.replace( /temptagid/g, id )
952
+ .replace( /temptagname/g, titles[ i ] );
953
+ jQuery( "#tags_div_" + image_id ).append( "<div class='tag_div' id='" + image_id + "_tag_" + id + "'>" );
954
+ jQuery( "#" + image_id + "_tag_" + id ).html( html );
955
 
956
  counter++;
957
  }
958
  }
959
+ document.getElementById( 'tags_' + image_id ).value = tag_ids;
960
+ if ( counter ) {
961
+ jQuery( "#tags_div_" + image_id ).parent().removeClass( "tags_div_empty" );
962
  }
963
  else {
964
+ jQuery( "#tags_div_" + image_id ).parent().addClass( "tags_div_empty" );
965
  }
966
  }
967
+ }
968
  }
969
+ jQuery( ".unsaved-msg", window.parent.document ).removeClass( "wd-hide" );
970
+ jQuery( ".ajax-msg", window.parent.document ).addClass( "wd-hide" );
971
  tb_remove();
972
  window.parent.bwg_remove_loading_block();
973
  }
974
 
975
+ function bwg_remove_tag( tag_id, image_id ) {
976
+ if ( jQuery( '#' + image_id + '_tag_' + tag_id ) ) {
977
+ jQuery( '#' + image_id + '_tag_' + tag_id ).remove();
978
+ var tag_ids_string = jQuery( "#tags_" + image_id ).val();
979
+ tag_ids_string = tag_ids_string.replace( tag_id + ',', '' );
980
+ jQuery( "#tags_" + image_id ).val( tag_ids_string );
981
+ if ( jQuery( "#tags_" + image_id ).val() == '' ) {
982
+ jQuery( "#tags_div_" + image_id ).parent().addClass( "tags_div_empty" );
983
  }
984
+ jQuery( ".unsaved-msg" ).removeClass( "wd-hide" );
985
+ jQuery( ".ajax-msg" ).addClass( "wd-hide" );
986
  }
987
  }
988
 
989
+ function bwg_remove_tags( image_id ) {
990
  var tagIds = [];
991
+ jQuery( ".tags:checked" ).each( function () {
992
+ tagIds.push( jQuery( this ).data( "id" ).toString() );
993
+ } );
994
+ tagIds.forEach( function ( item ) {
995
+ window.parent.bwg_remove_tag( item.toString(), image_id );
996
+ } )
997
  window.parent.tb_remove();
998
  }
999
 
1000
  function preview_watermark() {
1001
+ setTimeout( function () {
1002
+ watermark_type = window.parent.document.getElementById( 'watermark_type_text' ).checked;
1003
+ if ( watermark_type ) {
1004
+ watermark_text = document.getElementById( 'watermark_text' ).value;
1005
+ watermark_link = document.getElementById( 'watermark_link' ).value;
1006
+ watermark_font_size = document.getElementById( 'watermark_font_size' ).value;
1007
+ watermark_font = document.getElementById( 'watermark_font' ).value;
1008
+ watermark_color = document.getElementById( 'watermark_color' ).value;
1009
+ watermark_opacity = document.getElementById( 'watermark_opacity' ).value;
1010
+ watermark_position = jQuery( "input[name=watermark_position]:checked" ).val().split( '-' );
1011
+ document.getElementById( "preview_watermark" ).style.verticalAlign = watermark_position[ 0 ];
1012
+ document.getElementById( "preview_watermark" ).style.textAlign = watermark_position[ 1 ];
1013
+ stringHTML = ( watermark_link ? '<a href="' + watermark_link + '" target="_blank" style="text-decoration: none;' : '<span style="cursor:default;' ) + 'margin:4px;font-size:' + watermark_font_size + 'px;font-family:' + watermark_font + ';color:#' + watermark_color + ';opacity:' + ( watermark_opacity / 100 ) + ';" class="non_selectable">' + watermark_text + ( watermark_link ? '</a>' : '</span>' );
1014
+ document.getElementById( "preview_watermark" ).innerHTML = stringHTML;
1015
+ }
1016
+ watermark_type = window.parent.document.getElementById( 'watermark_type_image' ).checked;
1017
+ if ( watermark_type ) {
1018
+ watermark_url = document.getElementById( 'watermark_url' ).value;
1019
+ watermark_link = document.getElementById( 'watermark_link' ).value;
1020
+ watermark_width = document.getElementById( 'watermark_width' ).value;
1021
+ watermark_height = document.getElementById( 'watermark_height' ).value;
1022
+ watermark_opacity = document.getElementById( 'watermark_opacity' ).value;
1023
+ watermark_position = jQuery( "input[name=watermark_position]:checked" ).val().split( '-' );
1024
+ document.getElementById( "preview_watermark" ).style.verticalAlign = watermark_position[ 0 ];
1025
+ document.getElementById( "preview_watermark" ).style.textAlign = watermark_position[ 1 ];
1026
+ stringHTML = ( watermark_link ? '<a href="' + watermark_link + '" target="_blank">' : '' ) + '<img class="non_selectable" src="' + watermark_url + '" style="margin:0 4px 0 4px;max-width:' + watermark_width + 'px;max-height:' + watermark_height + 'px;opacity:' + ( watermark_opacity / 100 ) + ';" />' + ( watermark_link ? '</a>' : '' );
1027
+ document.getElementById( "preview_watermark" ).innerHTML = stringHTML;
1028
+ }
1029
+ }, 50 );
1030
  }
1031
 
1032
  /* Escape a string for HTML.*/
1033
+ function tw_escape( string ) {
1034
  /* List of HTML entities for escaping.*/
1035
  var htmlEscapes = {
1036
  '&': '&amp;',
1043
  /* Regex containing the keys.*/
1044
  var htmlEscaper = /[&<>"'\/]/g;
1045
 
1046
+ return ( '' + string ).replace( htmlEscaper, function ( match ) {
1047
+ return htmlEscapes[ match ];
1048
+ } );
1049
  };
1050
 
1051
  function preview_built_in_watermark() {
1052
+ setTimeout( function () {
1053
+ watermark_type = window.parent.document.getElementById( 'built_in_watermark_type_text' ).checked;
1054
+ if ( watermark_type ) {
1055
+ watermark_text = tw_escape( document.getElementById( 'built_in_watermark_text' ).value );
1056
+ watermark_font_size = document.getElementById( 'built_in_watermark_font_size' ).value * 400 / 500;
1057
+ watermark_font = 'bwg_' + document.getElementById( 'built_in_watermark_font' ).value.replace( '.TTF', '' ).replace( '.ttf', '' );
1058
+ watermark_color = document.getElementById( 'built_in_watermark_color' ).value;
1059
+ watermark_opacity = document.getElementById( 'built_in_watermark_opacity' ).value;
1060
+ watermark_position = jQuery( "input[name=built_in_watermark_position]:checked" ).val().split( '-' );
1061
+ document.getElementById( "preview_built_in_watermark" ).style.verticalAlign = watermark_position[ 0 ];
1062
+ document.getElementById( "preview_built_in_watermark" ).style.textAlign = watermark_position[ 1 ];
1063
+ stringHTML = '<span style="cursor:default;margin:4px;font-size:' + watermark_font_size + 'px;font-family:' + watermark_font + ';color:#' + watermark_color + ';opacity:' + ( watermark_opacity / 100 ) + ';" class="non_selectable">' + watermark_text + '</span>';
1064
+ document.getElementById( "preview_built_in_watermark" ).innerHTML = stringHTML;
1065
+ }
1066
+ watermark_type = window.parent.document.getElementById( 'built_in_watermark_type_image' ).checked;
1067
+ if ( watermark_type ) {
1068
+ watermark_url = document.getElementById( 'built_in_watermark_url' ).value;
1069
+ watermark_size = document.getElementById( 'built_in_watermark_size' ).value;
1070
+ watermark_position = jQuery( "input[name=built_in_watermark_position]:checked" ).val().split( '-' );
1071
+ document.getElementById( "preview_built_in_watermark" ).style.verticalAlign = watermark_position[ 0 ];
1072
+ document.getElementById( "preview_built_in_watermark" ).style.textAlign = watermark_position[ 1 ];
1073
+ stringHTML = '<img class="non_selectable" src="' + watermark_url + '" style="margin:0 4px 0 4px;max-width:95%;width:' + watermark_size + '%;" />';
1074
+ document.getElementById( "preview_built_in_watermark" ).innerHTML = stringHTML;
1075
+ }
1076
+ }, 50 );
1077
  search_options();
1078
  }
1079
 
1080
+ function bwg_watermark( watermark_type ) {
1081
+ jQuery( "#" + watermark_type ).prop( 'checked', true );
1082
+ jQuery( "#tr_watermark_url" ).css( 'display', 'none' );
1083
+ jQuery( "#tr_watermark_width_height" ).css( 'display', 'none' );
1084
+ jQuery( "#tr_watermark_opacity" ).css( 'display', 'none' );
1085
+ jQuery( "#tr_watermark_text" ).css( 'display', 'none' );
1086
+ jQuery( "#tr_watermark_link" ).css( 'display', 'none' );
1087
+ jQuery( "#tr_watermark_font_size" ).css( 'display', 'none' );
1088
+ jQuery( "#tr_watermark_font" ).css( 'display', 'none' );
1089
+ jQuery( "#tr_watermark_color" ).css( 'display', 'none' );
1090
+ jQuery( "#tr_watermark_position" ).css( 'display', 'none' );
1091
+ jQuery( "#tr_watermark_preview" ).css( 'display', 'none' );
1092
+ jQuery( "#preview_watermark" ).css( 'display', 'none' );
1093
+ switch ( watermark_type ) {
1094
+ case 'watermark_type_text': {
1095
+ jQuery( "#tr_watermark_opacity" ).css( 'display', '' );
1096
+ jQuery( "#tr_watermark_text" ).css( 'display', '' );
1097
+ jQuery( "#tr_watermark_link" ).css( 'display', '' );
1098
+ jQuery( "#tr_watermark_font_size" ).css( 'display', '' );
1099
+ jQuery( "#tr_watermark_font" ).css( 'display', '' );
1100
+ jQuery( "#tr_watermark_color" ).css( 'display', '' );
1101
+ jQuery( "#tr_watermark_position" ).css( 'display', '' );
1102
+ jQuery( "#tr_watermark_preview" ).css( 'display', '' );
1103
+ jQuery( "#preview_watermark" ).css( 'display', 'table-cell' );
 
1104
  break;
1105
  }
1106
+ case 'watermark_type_image': {
1107
+ jQuery( "#tr_watermark_url" ).css( 'display', '' );
1108
+ jQuery( "#tr_watermark_link" ).css( 'display', '' );
1109
+ jQuery( "#tr_watermark_width_height" ).css( 'display', '' );
1110
+ jQuery( "#tr_watermark_opacity" ).css( 'display', '' );
1111
+ jQuery( "#tr_watermark_position" ).css( 'display', '' );
1112
+ jQuery( "#tr_watermark_preview" ).css( 'display', '' );
1113
+ jQuery( "#preview_watermark" ).css( 'display', 'table-cell' );
 
1114
  break;
1115
  }
1116
  }
1117
  }
1118
 
1119
+ function bwg_built_in_watermark( watermark_type ) {
1120
+ jQuery( "#built_in_" + watermark_type ).prop( 'checked', true );
1121
+ jQuery( "#tr_built_in_watermark_url" ).css( 'display', 'none' );
1122
+ jQuery( "#tr_built_in_watermark_size" ).css( 'display', 'none' );
1123
+ jQuery( "#tr_built_in_watermark_opacity" ).css( 'display', 'none' );
1124
+ jQuery( "#tr_built_in_watermark_text" ).css( 'display', 'none' );
1125
+ jQuery( "#tr_built_in_watermark_font_size" ).css( 'display', 'none' );
1126
+ jQuery( "#tr_built_in_watermark_font" ).css( 'display', 'none' );
1127
+ jQuery( "#tr_built_in_watermark_color" ).css( 'display', 'none' );
1128
+ jQuery( "#tr_built_in_watermark_position" ).css( 'display', 'none' );
1129
+ jQuery( "#tr_built_in_watermark_preview" ).css( 'display', 'none' );
1130
+ jQuery( "#preview_built_in_watermark" ).css( 'display', 'none' );
1131
+ switch ( watermark_type ) {
1132
+ case 'watermark_type_text': {
1133
+ jQuery( "#tr_built_in_watermark_opacity" ).css( 'display', '' );
1134
+ jQuery( "#tr_built_in_watermark_text" ).css( 'display', '' );
1135
+ jQuery( "#tr_built_in_watermark_font_size" ).css( 'display', '' );
1136
+ jQuery( "#tr_built_in_watermark_font" ).css( 'display', '' );
1137
+ jQuery( "#tr_built_in_watermark_color" ).css( 'display', '' );
1138
+ jQuery( "#tr_built_in_watermark_position" ).css( 'display', '' );
1139
+ jQuery( "#tr_built_in_watermark_preview" ).css( 'display', '' );
1140
+ jQuery( "#preview_built_in_watermark" ).css( 'display', 'table-cell' );
 
1141
  break;
1142
  }
1143
+ case 'watermark_type_image': {
1144
+ jQuery( "#tr_built_in_watermark_url" ).css( 'display', '' );
1145
+ jQuery( "#tr_built_in_watermark_size" ).css( 'display', '' );
1146
+ jQuery( "#tr_built_in_watermark_position" ).css( 'display', '' );
1147
+ jQuery( "#tr_built_in_watermark_preview" ).css( 'display', '' );
1148
+ jQuery( "#preview_built_in_watermark" ).css( 'display', 'table-cell' );
 
1149
  break;
1150
  }
1151
  }
1153
  }
1154
 
1155
  function bwg_inputs() {
1156
+ jQuery( ".spider_int_input" ).keypress( function ( event ) {
1157
  var chCode1 = event.which || event.paramlist_keyCode;
1158
+ if ( chCode1 > 31 && ( chCode1 < 48 || chCode1 > 57 ) && ( chCode1 != 46 ) && ( chCode1 != 45 ) ) {
1159
  return false;
1160
  }
1161
  return true;
1162
+ } );
1163
  }
1164
 
1165
  function bwg_show_hide_roles() {
1166
+ if ( jQuery( "select[name='permissions']" ).val() == "Administrator" ) {
1167
+ jQuery( ".bwg_roles" ).hide();
1168
  }
1169
+ else {
1170
+ jQuery( ".bwg_roles" ).show();
1171
  }
1172
  }
1173
 
1174
+ function bwg_enable_disable( display, id, current ) {
1175
+ jQuery( "#" + current ).prop( 'checked', true );
1176
+ jQuery( "#" + id ).css( 'display', display );
1177
+ if ( id == 'tr_slideshow_title_position' ) {
1178
+ jQuery( "#tr_slideshow_full_width_title" ).css( 'display', display );
1179
  }
1180
  }
1181
 
1182
+ function bwg_change_album_view_type( type ) {
1183
+ if ( type == 'thumbnail' ) {
1184
+ jQuery( "#album_thumb_dimensions" ).html( 'Album thumb dimensions: ' );
1185
+ jQuery( "#album_thumb_dimensions_x" ).css( 'display', '' );
1186
+ jQuery( "#album_thumb_height" ).css( 'display', '' );
1187
  }
1188
  else {
1189
+ jQuery( "#album_thumb_dimensions" ).html( 'Album thumb width: ' );
1190
+ jQuery( "#album_thumb_dimensions_x" ).css( 'display', 'none' );
1191
+ jQuery( "#album_thumb_height" ).css( 'display', 'none' );
1192
  }
1193
  }
1194
 
1195
+ function spider_check_isnum( e ) {
1196
  var chCode1 = e.which || e.paramlist_keyCode;
1197
+ if ( chCode1 > 31 && ( chCode1 < 48 || chCode1 > 57 ) && ( chCode1 != 46 ) && ( chCode1 != 45 ) ) {
1198
  return false;
1199
  }
1200
  return true;
1201
  }
1202
 
1203
+ function bwg_gallery_type( instagram_client_id ) {
1204
  var response = true;
1205
+ var value = jQuery( '#gallery_type' ).val();
1206
+ response = bwg_change_gallery_type( value, 'change', instagram_client_id );
1207
  return response;
1208
  }
1209
+
1210
+ function bwg_gallery_update_flag() {
1211
+ var update_flag = jQuery( '#tr_update_flag input[name=update_flag]:checked' ).val();
1212
+ if ( update_flag == '' ) {
1213
+ jQuery( '.spider_delete_button' ).show();
1214
  /*
1215
  jQuery("[id^=image_alt_text_]").prop("readonly",false);
1216
  jQuery("[id^=image_description_]").prop("readonly",false);
1217
  jQuery("[id^=redirect_url_]").prop("readonly",false);
1218
  */
1219
  }
1220
+ else {
1221
+ jQuery( '.spider_delete_button' ).hide();
1222
  /*
1223
  jQuery("[id^=image_alt_text_]").prop("readonly", true);
1224
  jQuery("[id^=image_description_]").prop("readonly", true);
1227
  }
1228
  }
1229
 
1230
+ bwg_gallery_change_update_flag = jQuery( function () {
1231
+ jQuery( '#tr_update_flag input[name=update_flag]' ).change( function () {
1232
+ bwg_gallery_update_flag();
1233
+ /*var update_flag = jQuery(this).val(); */
1234
+ } );
1235
+ } );
1236
 
1237
  /*returns false if user cancels or impossible to do.*/
1238
+
1239
  /*
1240
  type_to_set:'' or 'instagram'
1241
  */
1242
+ function bwg_change_gallery_type( type_to_set, warning_type, instagram_client_id ) {
1243
+ warning_type = ( typeof warning_type === "undefined" ) ? "default" : warning_type;
1244
+ jQuery( '.bwg-gallery-type-options' ).hide();
1245
+ if ( type_to_set == 'instagram' ) {
1246
+ if ( instagram_client_id == '' ) {
1247
+ alert( bwg_objectL10B.bwg_access_token );
1248
+ jQuery( '#gallery_type' ).val( '' );
1249
+ return false;
1250
  }
1251
+ if ( !bwg_check_gallery_empty( true, true ) ) {
1252
  return false;
1253
  }
1254
 
1255
+ jQuery( "#add_instagram_gallery" ).show();
1256
 
1257
+ jQuery( '#gallery_type' ).val( 'instagram' );
1258
+ jQuery( '#tr_instagram_post_gallery' ).show();
1259
 
1260
  /*hide features of only mixed gallery*/
1261
+ jQuery( '.spider_delete_button' ).hide();
1262
+ jQuery( '#spider_resize_button' ).hide();
1263
+ jQuery( '#content-add_media' ).hide();
1264
+ jQuery( '#add_image_bwg' ).hide();
1265
+ jQuery( '#import_image_bwg' ).hide();
1266
+ jQuery( '#show_add_embed' ).hide();
1267
+ jQuery( '#show_bulk_embed' ).hide();
1268
 
1269
  /*hide unused bulk action options */
1270
+ jQuery( "#bulk-action-selector-top option[value='image_resize']" ).hide();
1271
+ jQuery( "#bulk-action-selector-top option[value='image_recreate_thumbnail']" ).hide();
1272
+ jQuery( "#bulk-action-selector-top option[value='image_rotate_left']" ).hide();
1273
+ jQuery( "#bulk-action-selector-top option[value='image_rotate_right']" ).hide();
1274
+ jQuery( "#bulk-action-selector-top option[value='image_set_watermark']" ).hide();
1275
+ jQuery( "#bulk-action-selector-top option[value='image_reset']" ).hide();
1276
+ }
1277
+ else if ( type_to_set == 'facebook' ) {
1278
+ if ( !bwg_check_gallery_empty( true, true ) ) {
1279
  return false;
1280
  }
1281
+ jQuery( '#add_facebook_gallery' ).show();
1282
 
1283
+ jQuery( '#gallery_type' ).val( 'facebook' );
1284
+ jQuery( '#tr_instagram_post_gallery' ).hide();
1285
 
1286
  /*hide features of only mixed gallery*/
1287
+ jQuery( '.spider_delete_button' ).hide();
1288
+ jQuery( '#spider_resize_button' ).hide();
1289
+ jQuery( '#content-add_media' ).hide();
1290
+ jQuery( '#add_image_bwg' ).hide();
1291
+ jQuery( '#import_image_bwg' ).hide();
1292
+ jQuery( '#show_add_embed' ).hide();
1293
+ jQuery( '#show_bulk_embed' ).hide();
1294
 
1295
  /*reset update_flag radio button*/
1296
+ jQuery( "#update_flag_0" ).prop( 'checked', true );
1297
  bwg_gallery_update_flag();
1298
+ jQuery( '#tr_update_flag' ).hide();
1299
+ jQuery( '#tr_autogallery_image_number' ).hide();
1300
+ jQuery( '#tr_instagram_gallery_add_button' ).hide();
1301
  /* default limit 20 */
1302
+ jQuery( "#facebook_gallery_image_limit" ).val( 20 );
1303
  }
1304
+ else if ( type_to_set == 'google_photos' ) {
1305
+ var auth_google_status = jQuery( "#auth_google_status" ).val();
1306
+ if ( auth_google_status == '0' ) {
1307
+ jQuery( "#auth_google_photos_gallery" ).show();
1308
+ }
1309
+ else {
1310
  /*hide features of only mixed gallery*/
1311
+ jQuery( '.spider_delete_button' ).hide();
1312
+ jQuery( '#spider_resize_button' ).hide();
1313
+ jQuery( '#content-add_media' ).hide();
1314
+ jQuery( '#add_image_bwg' ).hide();
1315
+ jQuery( '#import_image_bwg' ).hide();
1316
+ jQuery( '#show_add_embed' ).hide();
1317
+ jQuery( '#show_bulk_embed' ).hide();
1318
  /*hide unused bulk action options */
1319
+ jQuery( "#bulk-action-selector-top option[value='image_resize']" ).hide();
1320
+ jQuery( "#bulk-action-selector-top option[value='image_recreate_thumbnail']" ).hide();
1321
+ jQuery( "#bulk-action-selector-top option[value='image_rotate_left']" ).hide();
1322
+ jQuery( "#bulk-action-selector-top option[value='image_rotate_right']" ).hide();
1323
+ jQuery( "#bulk-action-selector-top option[value='image_set_watermark']" ).hide();
1324
+ jQuery( "#bulk-action-selector-top option[value='image_reset']" ).hide();
1325
+ jQuery( document ).trigger( 'bwg_gallery_type_changed', type_to_set );
1326
  }
1327
  }
1328
+ else if ( type_to_set != '' ) {
1329
+ jQuery( document ).trigger( 'bwg_gallery_type_changed', type_to_set );
1330
  }
1331
  else {
1332
+ var ids_string = jQuery( "#ids_string" ).val();
1333
+ ids_array = ids_string.split( "," );
1334
+ var tr_count = ids_array[ 0 ] == '' ? 0 : ids_array.length;
1335
+ if ( tr_count != 0 ) {
1336
+ switch ( warning_type ) {
1337
  case 'default':
1338
+ var allowed = confirm( bwg_objectL10B.default_warning );
1339
  break;
1340
  case 'change':
1341
+ var allowed = confirm( bwg_objectL10B.change_warning );
1342
  break;
1343
  default:
1344
+ var allowed = confirm( bwg_objectL10B.other_warning );
1345
  }
1346
 
1347
+ if ( allowed == false ) {
1348
+ jQuery( '#gallery_type' ).val( 'instagram' );
1349
  return false;
1350
  }
1351
  }
1352
 
1353
+ jQuery( '#gallery_type' ).val( '' );
1354
+ jQuery( '#tr_instagram_post_gallery' ).hide();
1355
 
1356
  /*reset update_flag radio button*/
1357
+ jQuery( "#update_flag_0" ).prop( 'checked', true );
1358
  bwg_gallery_update_flag();
1359
 
1360
  /*show features of only mixed gallery*/
1361
+ jQuery( '.spider_delete_button' ).show();
1362
+ jQuery( '#spider_resize_button' ).show();
1363
+ jQuery( '#content-add_media' ).show();
1364
+ jQuery( '#add_image_bwg' ).show();
1365
+ jQuery( '#import_image_bwg' ).show();
1366
+ jQuery( '#show_add_embed' ).show();
1367
+ jQuery( '#show_bulk_embed' ).show();
1368
 
1369
  /* Show all bulk action options*/
1370
+ jQuery( "#bulk-action-selector-top option[value='image_resize']" ).hide();
1371
+ jQuery( "#bulk-action-selector-top option[value='image_recreate_thumbnail']" ).hide();
1372
+ jQuery( "#bulk-action-selector-top option[value='image_rotate_left']" ).hide();
1373
+ jQuery( "#bulk-action-selector-top option[value='image_rotate_right']" ).hide();
1374
+ jQuery( "#bulk-action-selector-top option[value='image_set_watermark']" ).hide();
1375
+ jQuery( "#bulk-action-selector-top option[value='image_reset']" ).hide();
1376
  }
1377
  return true;
1378
  }
1379
 
1380
  /*bulk embed handling*/
1381
+ function bwg_bulk_embed( from, key ) {
1382
+ switch ( from ) {
1383
+ case 'instagram': {
1384
+ bwg_add_instagram_gallery( key, true );
1385
+ break;
1386
+ }
1387
+ case 'facebook': {
1388
+ var appkey = key.split( '|' );
1389
+ bwg_add_facebook_gallery( true, appkey[ 0 ], appkey[ 1 ] );
1390
+ break;
 
1391
  }
1392
+ }
1393
+ return "";
1394
  }
1395
 
1396
+ function bwg_check_instagram_gallery_input( instagram_client_id, from_popup ) {
1397
  from_popup = typeof from_popup !== 'undefined' ? from_popup : false;
1398
  var is_error = false;
1399
+ if ( from_popup ) {
1400
+ if ( instagram_client_id == '' ) {
1401
+ alert( bwg_objectL10B.bwg_access_token );
1402
  is_error = true;
1403
  }
1404
+ if ( spider_check_required( 'popup_instagram_gallery_source', 'Instagram user URL' ) ) {
1405
  is_error = true;
1406
  }
1407
+ if ( jQuery( '#popup_instagram_image_number' ).val() > 33 || jQuery( '#popup_instagram_image_number' ).val() < 1 ) {
1408
+ alert( bwg_objectL10B.bwg_post_number );
1409
+ jQuery( '#popup_instagram_image_number' ).attr( 'style', 'border-color: #FF0000;' );
1410
+ jQuery( '#popup_instagram_image_number' ).focus();
1411
+ jQuery( 'html, body' ).animate( {
1412
+ scrollTop: jQuery( '#popup_instagram_image_number' ).offset().top - 200
1413
+ }, 500 );
1414
  is_error = true;
1415
  }
1416
  }
1417
+ else {
1418
+ if ( bwg_is_instagram_gallery() ) {
1419
+ if ( instagram_client_id == '' ) {
1420
+ alert( bwg_objectL10B.bwg_access_token );
1421
+ is_error = true;
1422
+ }
1423
 
1424
+ if ( jQuery( '#autogallery_image_number' ).val() > 33 || jQuery( '#autogallery_image_number' ).val() < 1 ) {
1425
 
1426
+ alert( bwg_objectL10B.bwg_post_number );
1427
+ jQuery( '#autogallery_image_number' ).attr( 'style', 'border-color: #FF0000;' );
1428
+ jQuery( '#autogallery_image_number' ).focus();
1429
+ jQuery( 'html, body' ).animate( {
1430
+ scrollTop: jQuery( '#autogallery_image_number' ).offset().top - 200
1431
+ }, 500 );
1432
  is_error = true;
1433
  }
1434
+ }
1435
  }
1436
  return is_error;
1437
  }
1438
 
1439
  function bwg_is_instagram_gallery() {
1440
+ var value = jQuery( '#gallery_type' ).val();
1441
+ if ( value == 'instagram' ) {
1442
  return true;
1443
  }
1444
+ else {
1445
  return false;
1446
  }
1447
  }
1452
  * @param message:bool true if to alert that not empty
1453
  * @return true if empty, false if not empty
1454
  */
1455
+ function bwg_check_gallery_empty( reset, message ) {
1456
+ var ids_string = jQuery( "#ids_string" ).val();
1457
+ var ids_array = ids_string.split( "," );
1458
+ var tr_count = ids_array[ 0 ] == '' ? 0 : ids_array.length;
1459
+ if ( tr_count != 0 ) {
1460
+ if ( reset ) {
1461
+ if ( message ) {
1462
+ alert( bwg_objectL10B.bwg_not_empty );
1463
+ }
1464
+ jQuery( '#gallery_type' ).val( '' );
1465
+ jQuery( '#tr_instagram_post_gallery' ).hide();
1466
+ jQuery( '#tr_gallery_source' ).hide();
1467
+ jQuery( '#tr_update_flag' ).hide();
1468
+ jQuery( '#tr_autogallery_image_number' ).hide();
1469
+ jQuery( '#tr_instagram_gallery_add_button' ).hide();
1470
+ }
1471
+ else {
1472
+ if ( message ) {
1473
+ alert( bwg_objectL10B.bwg_not_empty );
1474
  }
1475
  }
1476
  return false;
1480
  }
1481
  }
1482
 
1483
+ function bwg_convert_seconds( seconds ) {
1484
+ var sec_num = parseInt( seconds, 10 );
1485
+ var hours = Math.floor( sec_num / 3600 );
1486
+ var minutes = Math.floor( ( sec_num - ( hours * 3600 ) ) / 60 );
1487
+ var seconds = sec_num - ( hours * 3600 ) - ( minutes * 60 );
1488
 
1489
+ if ( minutes < 10 && hours != 0 ) {
1490
+ minutes = "0" + minutes;
1491
+ }
1492
+ if ( seconds < 10 ) {
1493
+ seconds = "0" + seconds;
1494
+ }
1495
+ var time = ( hours != 0 ? hours + ':' : '' ) + minutes + ':' + seconds;
1496
  return time;
1497
  }
1498
 
1499
+ function bwg_convert_date( date, separator ) {
1500
+ var m_names = new Array( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" );
1501
+ date = date.split( separator );
1502
+ var dateArray = date[ 0 ].split( "-" );
1503
+ return dateArray[ 2 ] + " " + m_names[ dateArray[ 1 ] - 1 ] + " " + dateArray[ 0 ] + ", " + date[ 1 ].substring( 0, 5 );
1504
  }
1505
 
1506
  /* EMBED handling */
1507
+ function bwg_get_embed_info( input_id ) {
1508
+ jQuery( '#loading_div' ).show();
1509
+ var url = encodeURI( jQuery( "#" + input_id ).val() );
1510
  if ( !url ) {
1511
+ alert( bwg_objectL10B.bwg_enter_url );
1512
+ jQuery( '#loading_div' ).hide();
1513
  return '';
1514
  }
1515
  var filesValid = [];
1516
  var data = {
1517
  'action': 'addEmbed',
1518
  'URL_to_embed': url,
1519
+ 'async': true
1520
  };
1521
+ /* get from the server data for the url. Here we use the server as a proxy, since Cross-Origin Resource Sharing AJAX is forbidden. */
1522
+ jQuery.post( ajax_url, data, function ( response ) {
1523
+ if ( response == false ) {
1524
+ alert( bwg_objectL10B.bwg_cannot_response );
1525
+ jQuery( '#loading_div' ).hide();
1526
  return '';
1527
  }
1528
  else {
1529
+ var index_start = response.indexOf( "WD_delimiter_start" );
1530
+ var index_end = response.indexOf( "WD_delimiter_end" );
1531
+ if ( index_start == -1 || index_end == -1 ) {
1532
+ alert( bwg_objectL10B.bwg_something_wrong );
1533
+ jQuery( '#loading_div' ).hide();
1534
  return '';
1535
  }
1536
 
1537
  /*filter out other echoed characters*/
1538
  /*18 is the length of "wd_delimiter_start"*/
1539
+ response = response.substring( index_start + 18, index_end );
1540
 
1541
+ response_JSON = JSON.parse( response );
1542
+ /*if indexed array, it means there is error*/
1543
+ if ( typeof response_JSON[ 0 ] !== 'undefined' ) {
1544
+ alert( JSON.parse( response )[ 1 ] );
1545
+ jQuery( '#loading_div' ).hide();
1546
  return '';
1547
  }
1548
+ else {
1549
  fileData = response_JSON;
1550
+ filesValid.push( fileData );
1551
+ bwg_add_image( filesValid );
1552
+ document.getElementById( input_id ).value = '';
1553
+ jQuery( '#loading_div' ).hide();
1554
  return 'ok';
1555
  }
1556
  }
1557
  return '';
1558
+ } );
1559
  return 'ok';
1560
  }
1561
 
1562
+ function bwg_change_fonts( cont, google_fonts ) {
1563
+ if ( jQuery( "#" + google_fonts ).val() == 1 ) {
1564
+ jQuery( '#' + cont ).next( '.font-select' ).show();
1565
+ jQuery( '#' + cont + '_default' ).hide();
1566
  }
1567
  else {
1568
+ jQuery( '#' + cont ).next( '.font-select' ).hide();
1569
+ jQuery( '#' + cont + '_default' ).show();
1570
+ jQuery( '#' + cont + '_default' ).css( { 'font-family': jQuery( '#' + cont + '_default' ).val() } );
1571
  }
1572
  }
1573
 
1577
  * @param e
1578
  * @param multiple
1579
  */
1580
+ function spider_media_uploader( e, multiple ) {
1581
  if ( typeof multiple == "undefined" ) {
1582
  var multiple = false;
1583
  }
1605
 
1606
  var filesSelectedML = [];
1607
  for ( var image in attachment ) {
1608
+ var image_url = attachment[ image ].url;
1609
  image_url = image_url.replace( bwg_objectL10B.wp_upload_dir.baseurl + '/', '' );
1610
  filesSelectedML.push( image_url );
1611
  }
1612
  jQuery( '#loading_div' ).show();
1613
 
1614
+ postImageUrls( filesSelectedML, function ( success, result ) {
1615
  jQuery( '#loading_div' ).hide();
1616
+ if ( success ) {
1617
+ jQuery( ".bwg-type-allowed" ).remove();
1618
  for ( var i in result ) {
1619
+ if ( result[ i ].error ) {
1620
  add_ajax_msg( bwg_objectL10B.only_the_following_types_are_allowed, 'error' );
1621
  }
1622
+ result[ i ].alt = attachment[ i ].alt ? attachment[ i ].alt : attachment[ i ].title;
1623
+ result[ i ].description = attachment[ i ].description;
1624
  }
1625
  bwg_add_image( result );
1626
  }
1627
  else {
1628
  alert( bwg_objectL10B.import_failed );
1629
  }
1630
+ } );
1631
 
1632
+ function postImageUrls( imageUrls, callback, index, results ) {
1633
  var imagesChunkLength = 50;
1634
 
1635
+ if ( !index ) {
1636
  index = 0;
1637
  }
1638
+ if ( !results ) {
1639
  results = [];
1640
  }
1641
 
1642
+ var imageUrlsChunk = imageUrls.slice( index, index + imagesChunkLength );
1643
  index += imagesChunkLength;
1644
  jQuery.ajax( {
1645
  url: bwg_objectL10B.ajax_url,
1647
  dataType: "json",
1648
  data: {
1649
  action: "bwg_UploadHandler",
1650
+ file_namesML: JSON.stringify( imageUrlsChunk ),
1651
  import: 1
1652
  },
1653
  success: function ( result ) {
1654
+ results = results.concat( result );
1655
 
1656
+ if ( index < imageUrls.length ) {
1657
+ postImageUrls( imageUrls, callback, index, results );
1658
  }
1659
  else {
1660
+ callback( true, results );
1661
  }
1662
  },
1663
  error: function ( xhr ) {
1664
+ callback( false );
1665
  }
1666
  } );
1667
  }
1672
  }
1673
 
1674
  function add_ajax_msg( msg, status ) {
1675
+ if ( !jQuery( '.ajax-msg' ).hasClass( 'bwg-type-allowed' ) ) {
1676
+ var html = '<div class="ajax-msg bwg-type-allowed">' +
1677
+ '<div class="' + status + ' inline">' +
1678
+ '<p><strong>' + msg + '</strong></p>' +
1679
+ '</div>' +
1680
+ '</div>';
1681
+ jQuery( html ).insertAfter( "#add_desc" );
1682
+ }
1683
  }
1684
 
1685
  /**
1687
  *
1688
  * @param that
1689
  */
1690
+ function search( that ) {
1691
+ var form = jQuery( that ).parents( "form" );
1692
 
1693
+ if ( form.attr( "id" ) == "bwg_gallery" ) { /* Gallery edit page. */
1694
+ jQuery( "#paged" ).val( 1 );
1695
+ jQuery( "#ajax_task" ).val( 'ajax_apply' );
1696
+ spider_ajax_save( form.attr( "id" ) );
1697
  }
1698
  else {
1699
+ var action = form.attr( "action" );
1700
+ form.attr( "action", action + "&paged=1&s=" + jQuery( "input[name='s']" ).val() );
1701
  form.submit();
1702
  }
1703
  }
1709
  * @param that
1710
  * @returns {boolean}
1711
  */
1712
+ function input_search( e, that ) {
1713
+ var key_code = ( e.keyCode ? e.keyCode : e.which );
1714
+ if ( key_code == 13 ) { /*Enter keycode*/
1715
+ search( that );
1716
  return false;
1717
  }
1718
  }
1724
  * @param that
1725
  * @returns {boolean}
1726
  */
1727
+ function input_pagination( e, that ) {
1728
+ var key_code = ( e.keyCode ? e.keyCode : e.which );
1729
+ if ( key_code == 13 ) { /*Enter keycode*/
1730
+ var to_page = jQuery( that ).val();
1731
+ var pages_count = jQuery( that ).parents( ".pagination-links" ).data( "pages-count" );
1732
+ var form = jQuery( that ).parents( "form" );
1733
+ if ( form.attr( "id" ) == "bwg_gallery" ) { /* Gallery edit page. */
1734
+ if ( to_page > pages_count ) {
1735
  to_page = 1;
1736
  }
1737
+ jQuery( "#paged" ).val( to_page );
1738
+ jQuery( "#ajax_task" ).val( 'ajax_apply' );
1739
+ spider_ajax_save( form.attr( "id" ) );
1740
  return false;
1741
  }
1742
  else {
1743
  if ( to_page > 0 && to_page <= pages_count ) {
1744
+ var search = jQuery( "input[name='s']" ).val() ? ( "&s=" + jQuery( "input[name='s']" ).val() ) : "";
1745
+ var action = form.attr( "action" );
1746
+ form.attr( "action", action + "&paged=" + to_page + search );
1747
  }
1748
+ form.submit();
1749
  }
1750
  }
1751
  return true;
1756
  *
1757
  * @param that
1758
  */
1759
+ function wd_bulk_action( that ) {
1760
+ var form = jQuery( that ).parents( "form" );
1761
+ var action = jQuery( "select[name='" + ( form.attr( "id" ) == "bwg_gallery" ? 'image_' : '' ) + "bulk_action']" ).val();
1762
+ if ( action != -1 ) {
1763
+ if ( !jQuery( "input[name^='check']" ).is( ':checked' ) ) {
1764
+ alert( bwg.select_at_least_one_item );
1765
  return;
1766
  }
1767
+ if ( action == 'delete' ) {
1768
+ if ( !confirm( bwg.delete_confirmation ) ) {
1769
  return false;
1770
  }
1771
  }
1772
+ else if ( action == 'image_resize' ) {
1773
+ jQuery( ".opacity_resize_image" ).show();
1774
  return false;
1775
  }
1776
+ else if ( action == 'image_edit' ) {
1777
+ jQuery( ".opacity_image_desc" ).show();
1778
  return false;
1779
  }
1780
+ else if ( action == 'image_edit_alt' ) {
1781
+ jQuery( ".opacity_image_alt" ).show();
1782
  return false;
1783
  }
1784
+ else if ( action == 'image_edit_redirect' ) {
1785
+ jQuery( ".opacity_image_redirect" ).show();
1786
  return false;
1787
  }
1788
+ else if ( action == 'image_edit_description' ) {
1789
+ jQuery( ".opacity_image_description" ).show();
1790
  return false;
1791
  }
1792
+ else if ( action == 'image_add_tag' ) {
1793
+ jQuery( ".wd-add-tags" ).trigger( "click" );
1794
  return;
1795
  }
1796
+ else if ( action == 'set_image_pricelist' ) {
1797
+ jQuery( ".wd-add-pricelist" ).trigger( "click" );
1798
  return;
1799
  }
1800
+ else if ( action == 'remove_pricelist_all' ) {
1801
+ if ( !confirm( bwg.remove_pricelist_confirmation ) ) {
1802
  return false;
1803
  }
1804
  }
1805
+ if ( form.attr( "id" ) == "bwg_gallery" ) { /* Gallery edit page. */
1806
+ jQuery( "input[name='task']" ).val( "save" );
1807
+ jQuery( "input[name='ajax_task']" ).val( action );
1808
+ spider_ajax_save( form.attr( "id" ) );
1809
  }
1810
  else {
1811
+ jQuery( "input[name='task']" ).val( action );
1812
  form.submit();
1813
  }
1814
  }
1815
  }
1816
 
1817
  function bwg_change_theme_tab_item() {
1818
+ var id = jQuery( '.bwg-tabs .bwg-tab-item.active' ).attr( 'data-id' );
1819
+ jQuery( 'fieldset#' + id ).show();
1820
+
1821
+ jQuery( document ).on( 'click', '.bwg-tabs .bwg-tab-item', function () {
1822
+ jQuery( '.bwg-tabs .bwg-tab-item' ).removeClass( 'active' );
1823
+ jQuery( this ).addClass( 'active' );
1824
+ var id = jQuery( this ).attr( 'data-id' );
1825
+ jQuery( '.spider_type_fieldset' ).hide();
1826
+ jQuery( '#' + id ).show();
1827
+ jQuery( '#active_tab' ).val( jQuery( this ).attr( 'data-id' ) );
1828
+ } );
1829
  }
1830
 
1831
  function bwg_filters() {
1832
+ jQuery( document ).on( 'change', 'select[id^=filter-by]', function () {
1833
+ var val = jQuery( this ).val();
1834
+ var id = jQuery( this ).attr( 'id' );
1835
+ window.location.href = bwg_updateQueryStringParameter( window.location.href, id, val );
1836
+ } );
1837
  }
1838
 
1839
+ function bwg_updateQueryStringParameter( uri, key, value ) {
1840
+ var re = new RegExp( "([?&])" + key + "=.*?(&|$)", "i" );
1841
+ var separator = uri.indexOf( '?' ) !== -1 ? "&" : "?";
1842
+ if ( uri.match( re ) ) {
1843
+ return uri.replace( re, '$1' + key + "=" + value + '$2' );
1844
  }
1845
  else {
1846
  return uri + separator + key + "=" + value;
1849
 
1850
  /* Open/close section container on its header click. */
1851
  function bwg_toggle_postbox() {
1852
+ jQuery( ".hndle, .handlediv" ).each( function () {
1853
+ jQuery( this ).on( "click", function () {
1854
+ jQuery( this ).parent( ".postbox" ).toggleClass( "closed" );
1855
+ } );
1856
+ } );
1857
  }
1858
 
1859
+ function spider_select_value( obj ) {
1860
  obj.focus();
1861
  obj.select();
1862
  }
1869
  *
1870
  * @param files
1871
  */
1872
+ function bwg_add_image( files ) {
1873
+ var gallery_type = jQuery( '#gallery_type option:selected' ).val();
1874
+ jQuery( '#check_all_items, #check_all' ).prop( 'checked', false );
1875
  for ( var i in files ) {
1876
+ if ( files[ i ][ 'error' ] == true ) {
1877
  continue;
1878
  }
1879
+ var is_embed = files[ i ][ 'filetype' ].indexOf( "EMBED_" ) > -1 ? true : false;
1880
+ var is_direct_url = files[ i ][ 'filetype' ].indexOf( "DIRECT_URL_" ) > -1 ? true : false;
1881
+ var is_facebook_post = files[ i ][ 'filetype' ].indexOf( "_FACEBOOK_POST" ) > -1 ? 1 : 0;
1882
+ var fb_post_url = ( is_facebook_post ) ? files[ i ][ 'filename' ] : '';
1883
+ if ( typeof files[ i ][ 'resolution' ] != "undefined" ) {
1884
+ var instagram_post_width = files[ i ][ 'resolution' ].split( 'x' )[ 0 ].trim();
1885
+ var instagram_post_height = files[ i ][ 'resolution' ].split( 'x' )[ 1 ].trim();
1886
  }
1887
  else {
1888
  var instagram_post_width = "";
1889
  var instagram_post_height = "";
1890
  }
1891
+ var html = jQuery( ".wd-template" ).clone().html();
1892
  // Google Photos add-on is active.
1893
  if ( gallery_type == 'google_photos' ) {
1894
+ jQuery( '.bulkactions' ).remove();
1895
+ jQuery( '#images_table' ).find( '.col_drag' ).remove();
1896
+ jQuery( '#images_table' ).find( '.check-column' ).remove();
1897
+ jQuery( '.wd-template' ).find( '.col_drag' ).remove();
1898
+ jQuery( '.wd-template' ).find( '.check-column' ).remove();
1899
+ jQuery( '.wd-template' ).find( '.bwg-td-item-redirect-url' ).remove();
1900
+ jQuery( '.wd-template' ).find( '.bwg-td-item-tags' ).remove();
1901
+ jQuery( '.wd-template' ).find( '#image_alt_text_tempid' ).prop( "disabled", true );
1902
+ jQuery( '.wd-template' ).find( '#image_description_tempid' ).prop( "disabled", true );
1903
+ html = jQuery( ".wd-template" ).clone().html();
1904
+ }
1905
+
1906
+ if ( files[ i ][ 'filetype' ] == 'SVG' ) {
1907
+ jQuery( '#images_table' ).find( '.wd-image-actions' ).remove();
1908
+ html = jQuery( ".wd-template" ).clone().html();
1909
+ }
1910
+ var name = files[ i ][ 'name' ].substr( 0, files[ i ][ 'name' ].lastIndexOf( '.' ) ) || files[ i ][ 'name' ];
1911
+ var filename = files[ i ][ 'filename' ];
1912
  if ( name != "" ) {
1913
  filename = name;
1914
  }
1915
+ html = html.replace( /tempid/g, bwg_j )
1916
+ .replace( /tempnum/g, 1 )
1917
+ .replace( /tempimage_url/g, encodeURIComponent( files[ i ][ 'url' ] ) )
1918
+ .replace( /tempthumb_url/g, encodeURIComponent( files[ i ][ 'thumb_url' ] ) )
1919
+ .replace( /tempthumb_src=""/g, 'src="' + files[ i ][ 'thumb' ] + '"' )
1920
+ .replace( /tempfilename/g, filename )
1921
+ .replace( /tempdate/g, files[ i ][ 'date_modified' ] )
1922
+ .replace( /tempresolution/g, files[ i ][ 'resolution' ] )
1923
+ .replace( /tempthumbresolution/g, files[ i ][ 'resolution_thumb' ] )
1924
+ .replace( /temp_instagram_post_width/g, instagram_post_width )
1925
+ .replace( /temp_instagram_post_height/g, instagram_post_height )
1926
+ .replace( /tempsize/g, files[ i ][ 'size' ] )
1927
+ .replace( /tempfiletype/g, files[ i ][ 'filetype' ] )
1928
+ .replace( /tempis_facebook_post/g, ( is_facebook_post ? files[ i ][ 'is_facebook_post' ] : 0 ) )
1929
+ .replace( /tempfb_post_url/g, ( is_facebook_post ? files[ i ][ 'fb_post_url' ] : 0 ) );
1930
  if ( is_embed ) {
1931
+ html = html.replace( /tempalt/g, name );
1932
+ html = html.replace( /wd-image-actions/g, 'wd-image-actions wd-hide' );
1933
  }
1934
  else {
1935
+ html = html.replace( /tempalt/g, files[ i ][ 'alt' ] );
1936
  }
1937
+ var description = files[ i ][ 'description' ] ? files[ i ][ 'description' ] : '';
1938
+ if ( jQuery( "#tbody_arr" ).data( "meta" ) == 1 && !is_embed ) {
1939
+ description += files[ i ][ 'description' ] ? '\n' : '';
1940
+ description += files[ i ][ 'credit' ] ? 'Author: ' + files[ i ][ 'credit' ] + '\n' : '';
1941
+ description += ( ( files[ i ][ 'aperture' ] != 0 && files[ i ][ 'aperture' ] != '' ) ? 'Aperture: ' + files[ i ][ 'aperture' ] + '\n' : '' );
1942
+ description += ( ( files[ i ][ 'camera' ] != 0 && files[ i ][ 'camera' ] != '' ) ? 'Camera: ' + files[ i ][ 'camera' ] + '\n' : '' );
1943
+ description += ( ( files[ i ][ 'caption' ] != 0 && files[ i ][ 'caption' ] != '' ) ? 'Caption: ' + files[ i ][ 'caption' ] + '\n' : '' );
1944
+ description += ( ( files[ i ][ 'iso' ] != 0 && files[ i ][ 'iso' ] != '' ) ? 'Iso: ' + files[ i ][ 'iso' ] + '\n' : '' );
1945
+ description += ( ( files[ i ][ 'copyright' ] != 0 && files[ i ][ 'copyright' ] != '' ) ? 'Copyright: ' + files[ i ][ 'copyright' ] + '\n' : '' );
1946
+ description += ( ( files[ i ][ 'orientation' ] != 0 && files[ i ][ 'orientation' ] != '' ) ? 'Orientation: ' + files[ i ][ 'orientation' ] + '\n' : '' );
1947
  }
1948
+ html = html.replace( /tempdescription/g, description );
1949
 
1950
+ jQuery( "#tbody_arr" ).prepend( "<tr id='tr_" + bwg_j + "'>" );
1951
+ jQuery( "#tr_" + bwg_j ).html( html );
1952
 
1953
  /* Change the popup dimensions. */
1954
+ bwg_tb_window( "#tr_" + bwg_j );
1955
 
1956
+ jQuery( "#ids_string" ).val( jQuery( "#ids_string" ).val() + bwg_j + ',' );
1957
+ if ( jQuery( "#tbody_arr" ).data( "meta" ) == 1 && files[ i ][ 'tags' ] ) {
1958
  /* If tags added to image from image file meta keywords.*/
1959
+ var tagsTitles = JSON.parse( files[ i ][ 'tags' ] );
1960
  /* Add prefix to keywords to differ from other tags on save.*/
1961
  var tagsIds = [];
1962
  for ( var i in tagsTitles ) {
1963
+ tagsIds[ i ] = 'bwg_' + tagsTitles[ i ];
1964
  }
1965
  /* Add titles instead of ids.*/
1966
+ bwg_add_tag( bwg_j, tagsIds, tagsTitles );
1967
  }
1968
 
1969
  j_int++;
1972
  /* Add drag and drop to new rows. */
1973
  wd_showhide_weights();
1974
  /* Set order input values after adding rows. */
1975
+ var i = jQuery( "td.col_drag" ).data( "page-number" );
1976
+ jQuery( ".wd-order" ).each( function () {
1977
+ jQuery( this ).val( ++i );
1978
+ } );
1979
  /* Set number column values after adding rows. */
1980
  var i = 0;
1981
+ jQuery( "#tbody_arr .col_num" ).each( function () {
1982
+ jQuery( this ).html( ++i );
1983
+ } );
1984
+ window.parent.jQuery( ".no-items" ).remove();
1985
+ jQuery( ".unsaved-msg", window.parent.document ).removeClass( "wd-hide" );
1986
+ jQuery( ".ajax-msg", window.parent.document ).addClass( "wd-hide" );
1987
+ jQuery( ".bwg-type-allowed", window.parent.document ).removeClass( "wd-hide" );
1988
  }
1989
 
1990
  /**
1991
  * Change pagination to ajax pagination.
1992
  */
1993
  function wd_pagination() {
1994
+ jQuery( "#bwg_gallery a.wd-page " ).each( function () {
1995
+ jQuery( this ).removeAttr( "href" );
1996
+ jQuery( this ).on( "click", function () {
1997
+ var paged = jQuery( this ).data( "paged" );
1998
+ jQuery( "#paged" ).val( paged );
1999
+ jQuery( "#ajax_task" ).val( 'ajax_apply' );
2000
+ spider_ajax_save( 'bwg_gallery' );
2001
+ } );
2002
+ } );
2003
+ }
2004
+
2005
+ function bwg_tb_window( cont_id ) {
2006
+ if ( typeof cont_id === 'undefined' ) {
2007
  var cont_id = '';
2008
  }
2009
  var thickDims, tbWidth, tbHeight;
2010
  thickDims = function () {
2011
+ var tbWindow = jQuery( '#TB_window' ), H = jQuery( window ).height(), W = jQuery( window ).width(), w, h;
2012
+ w = ( tbWidth && tbWidth < W - 90 ) ? tbWidth : W - 40;
2013
+ h = ( tbHeight && tbHeight < H - 60 ) ? tbHeight : H - 40;
2014
+ if ( tbWindow.length ) {
2015
+ tbWindow.width( w ).height( h );
2016
+ jQuery( '#TB_iframeContent' ).width( w ).height( h - 30 );
2017
+ tbWindow.css( { 'margin-left': '-' + parseInt( ( w / 2 ), 10 ) + 'px' } );
2018
+ if ( typeof document.body.style.maxWidth != 'undefined' ) {
2019
+ tbWindow.css( { 'top': ( H - h ) / 2, 'margin-top': '0' } );
2020
  }
2021
  }
2022
  };
2023
  thickDims();
2024
+ jQuery( window ).resize( function () {
2025
  thickDims()
2026
+ } );
2027
+ jQuery( cont_id + ' a.thickbox-preview' ).click( function () {
2028
+ tb_click.call( this );
2029
+ var alink = jQuery( this ).parents( '.available-theme' ).find( '.activatelink' ), link = '',
2030
+ href = jQuery( this ).attr( 'href' ), url, text;
2031
+ if ( tbWidth = href.match( /&bwg_width=[0-9]+/ ) ) {
2032
+ tbWidth = parseInt( tbWidth[ 0 ].replace( /[^0-9]+/g, '' ), 10 );
2033
  }
2034
  else {
2035
+ tbWidth = jQuery( window ).width() - 120;
2036
  }
2037
 
2038
+ if ( tbHeight = href.match( /&bwg_height=[0-9]+/ ) ) {
2039
+ tbHeight = parseInt( tbHeight[ 0 ].replace( /[^0-9]+/g, '' ), 10 );
2040
  }
2041
  else {
2042
+ tbHeight = jQuery( window ).height() - 120;
2043
  }
2044
+ if ( alink.length ) {
2045
+ url = alink.attr( 'href' ) || '';
2046
+ text = alink.attr( 'title' ) || '';
2047
  link = '&nbsp; <a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>';
2048
  }
2049
  else {
2050
+ text = jQuery( this ).attr( 'title' ) || '';
2051
  link = '&nbsp; <span class="tb-theme-preview-link">' + text + '</span>';
2052
  }
2053
  /* jQuery('#TB_title').css({'background-color': '#222', 'color': '#dfdfdf'}); */
2054
+ jQuery( '#TB_closeAjaxWindow' ).css( { 'float': 'right' } );
2055
+ jQuery( '#TB_ajaxWindowTitle' ).css( { 'float': 'left' } ).html( link );
2056
+ jQuery( '#TB_iframeContent' ).width( '100%' );
2057
  thickDims();
2058
  return false;
2059
+ } );
2060
  /* Theme details*/
2061
+ jQuery( '.theme-detail' ).click( function () {
2062
+ jQuery( this ).siblings( '.themedetaildiv' ).toggle();
2063
  return false;
2064
+ } );
2065
  }
2066
 
2067
  /* Prevent new line. */
2068
+ function prevent_new_line( e ) {
2069
  if ( e.keyCode == 13 ) {
2070
  e.preventDefault();
2071
  return false;
2072
  }
2073
  }
2074
 
2075
+ function bwg_gallery_type_options( gallery_type ) {
2076
+ if ( gallery_type === undefined ) {
2077
+ gallery_type = jQuery( '#gallery_type' ).val();
2078
+ }
2079
+ gallery_type_name = jQuery( '.bwg-' + gallery_type ).data( 'title' );
2080
+ pro_img_url = jQuery( '.bwg-' + gallery_type ).data( 'img-url' );
2081
+ pro_demo_link = jQuery( '.bwg-' + gallery_type ).data( 'demo-link' );
2082
+ jQuery( '.gallery_options' ).hide();
2083
+ jQuery( '#' + gallery_type + '_options' ).show();
2084
+ jQuery( '#gallery_type' ).val( gallery_type );
2085
+ if ( jQuery( ".wd-free-msg" ).length != 0 ) {
2086
+ jQuery( ".wd-free-msg" ).hide();
2087
+ jQuery( ".bwg-pro-views" ).hide();
2088
+ if ( jQuery( '#' + gallery_type + '_options' ).hasClass( "bwg-pro-views" ) ) {
2089
+ jQuery( ".wd-free-msg" ).show();
2090
+ jQuery( ".upgrade-to-pro-title" ).html( gallery_type_name + ' view is<br>available in Premium Version' );
2091
+ jQuery( ".pro-views-img" ).attr( 'src', pro_img_url );
2092
+ jQuery( ".button-demo" ).attr( 'href', pro_demo_link );
2093
+ }
2094
+ }
2095
+ jQuery( '#bwg_tab_galleries_content .gallery_type' ).find( '.view_type_img_active' ).css( 'display', 'none' );
2096
+ jQuery( '#bwg_tab_galleries_content .gallery_type' ).find( '.view_type_img' ).css( 'display', 'inline' );
2097
+ jQuery( '#bwg_tab_galleries_content .gallery_type' ).removeClass( 'gallery_type_active' );
2098
+ jQuery( 'input[name=gallery_type][id=' + gallery_type + ']' ).prop( 'checked', true ).closest( '.gallery_type' ).addClass( 'gallery_type_active' );
2099
+ jQuery( '#bwg_tab_galleries_content .gallery_type_active' ).find( '.view_type_img_active' ).css( 'display', 'inline' );
2100
+ jQuery( '#bwg_tab_galleries_content .gallery_type_active' ).find( '.view_type_img' ).css( 'display', 'none' );
2101
  search_options();
2102
  }
2103
 
2104
+ function bwg_album_type_options( album_type ) {
2105
+ if ( album_type === undefined ) {
2106
+ album_type = jQuery( '#album_type' ).val();
2107
+ }
2108
+ gallery_type_name = jQuery( '.bwg-' + album_type ).data( 'title' );
2109
+ pro_img_url = jQuery( '.bwg-' + album_type ).data( 'img-url' );
2110
+ pro_demo_link = jQuery( '.bwg-' + album_type ).data( 'demo-link' );
2111
+ jQuery( '.album_options' ).hide();
2112
+ jQuery( '#' + album_type + '_options' ).show();
2113
+ jQuery( '#album_type' ).val( album_type );
2114
+ if ( jQuery( ".wd-free-msg" ).length != 0 ) {
2115
+ jQuery( ".wd-free-msg" ).hide();
2116
+ jQuery( ".bwg-pro-views" ).hide();
2117
+ if ( jQuery( '#' + album_type + '_options' ).hasClass( "bwg-pro-views" ) ) {
2118
+ jQuery( ".wd-free-msg" ).show();
2119
+ jQuery( ".upgrade-to-pro-title" ).html( gallery_type_name + bwg.bwg_premium_text );
2120
+ jQuery( ".pro-views-img" ).attr( 'src', pro_img_url );
2121
+ jQuery( ".button-demo" ).attr( 'href', pro_demo_link );
2122
+ }
2123
+ }
2124
+ jQuery( '#bwg_tab_albums_content .gallery_type' ).find( '.view_type_img_active' ).css( 'display', 'none' );
2125
+ jQuery( '#bwg_tab_albums_content .gallery_type' ).find( '.view_type_img' ).css( 'display', 'inline' );
2126
+ jQuery( '#bwg_tab_albums_content .gallery_type' ).removeClass( 'gallery_type_active' );
2127
+ jQuery( 'input[name=album_type][id=' + album_type + ']' ).prop( 'checked', true ).closest( '.gallery_type' ).addClass( 'gallery_type_active' );
2128
+ jQuery( '#bwg_tab_albums_content .gallery_type_active' ).find( '.view_type_img_active' ).css( 'display', 'inline' );
2129
+ jQuery( '#bwg_tab_albums_content .gallery_type_active' ).find( '.view_type_img' ).css( 'display', 'none' );
2130
  search_options();
2131
  }
2132
 
2133
+ function bwg_pagination_description( that ) {
2134
+ obj = jQuery( that );
2135
+ obj.closest( '.wd-group' ).find( '.description' ).hide();
2136
+ jQuery( '#' + obj.attr( 'name' ) + '_' + obj.val() + '_description' ).show();
2137
  }
2138
 
2139
+ function bwg_thumb_click_action() {
2140
+ if ( jQuery( "#thumb_click_action_2" ).is( ':checked' ) ) {
2141
+ jQuery( '.bwg-lightbox-redirect' ).show();
2142
  }
2143
  else {
2144
+ jQuery( '.bwg-lightbox-redirect' ).hide();
2145
  }
2146
  }
2147
 
2152
  * @returns {boolean}
2153
  */
2154
  function bwg_recreate_thumb( limit ) {
2155
+ var img_option_width = jQuery( "#upload_thumb_width" ).val();
2156
+ var img_option_height = jQuery( "#upload_thumb_height" ).val();
2157
 
2158
+ var imgcount = jQuery( '#bwg_imgcount' ).val();
2159
  var post_data = {
2160
  'task': 'resize_image_thumb',
2161
  'img_option_width': img_option_width,
2163
  'limitstart': limit,
2164
  };
2165
 
2166
+ if ( limit == 0 ) {
2167
  jQuery( '#loading_div' ).show();
2168
  jQuery( '.updated' ).remove();
2169
  }
2170
+ jQuery.ajax( {
2171
  type: "POST",
2172
  url: bwg_options_url_ajax,
2173
  data: post_data,
2174
  success: function () {
2175
+ if ( limit < imgcount ) {
2176
+ limit += 50;
2177
+ bwg_recreate_thumb( limit );
2178
+ }
2179
+ else {
2180
+ jQuery( '#loading_div' ).hide();
2181
+ jQuery( "<div class=\"updated inline\">\n" +
2182
+ " <p><strong>" + bwg_objectL10B.recreate_success + "</strong></p>" +
2183
+ " </div>" ).insertBefore( jQuery( "#bwg_options_form" ).parent() );
2184
+ }
2185
  }
2186
+ } );
2187
  return false;
2188
  }
2189
 
2193
  * @param limit
2194
  * @returns {boolean}
2195
  */
2196
+ function bwg_set_watermark( limit ) {
2197
+ var built_in_watermark_type = jQuery( 'input[name=built_in_watermark_type]:checked' ).val();
2198
+ var imgcount = jQuery( '#bwg_imgcount' ).val();
2199
  var post_data = {
2200
+ 'task': 'image_set_watermark',
2201
  'built_in_watermark_type': built_in_watermark_type,
2202
+ 'built_in_watermark_position': jQuery( 'input[name=built_in_watermark_position]:checked' ).val(),
2203
+ 'limitstart': limit
2204
  };
2205
  if ( built_in_watermark_type == 'text' ) {
2206
+ post_data.built_in_watermark_text = jQuery( '#built_in_watermark_text' ).val();
2207
+ post_data.built_in_watermark_font_size = jQuery( '#built_in_watermark_font_size' ).val();
2208
+ post_data.built_in_watermark_font = jQuery( '#built_in_watermark_font' ).val();
2209
+ post_data.built_in_watermark_color = jQuery( '#built_in_watermark_color' ).val();
2210
  }
2211
  else {
2212
+ post_data.built_in_watermark_size = jQuery( '#built_in_watermark_size' ).val();
2213
+ post_data.built_in_watermark_url = jQuery( '#built_in_watermark_url' ).val();
2214
  }
2215
 
2216
  if ( limit == 0 ) {
2217
+ jQuery( '#loading_div' ).show();
2218
+ jQuery( '.updated' ).remove();
2219
  }
2220
+ jQuery.ajax( {
2221
  type: "POST",
2222
  url: bwg_options_url_ajax,
2223
  data: post_data,
2228
  bwg_set_watermark( limit );
2229
  }
2230
  else {
2231
+ jQuery( '#loading_div' ).hide();
2232
+ jQuery( '.bwg_error' ).remove();
2233
+ jQuery( '<div class="bwg_error">' + response.message + '</div>' ).insertBefore( jQuery( "#bwg_options_form" ).parent() );
2234
  }
2235
  }
2236
+ } );
2237
 
2238
  return false;
2239
  }
2245
  * @returns {boolean}
2246
  */
2247
  function bwg_reset_watermark_all( limit ) {
2248
+ var imgcount = jQuery( '#bwg_imgcount' ).val();
2249
  var post_data = {
2250
  'task': 'image_recover_all',
2251
  'limitstart': limit,
2254
  jQuery( '#loading_div' ).show();
2255
  jQuery( '.updated' ).remove();
2256
  }
2257
+ jQuery.ajax( {
2258
  type: "POST",
2259
  url: bwg_options_url_ajax,
2260
  data: post_data,
2266
  else {
2267
  jQuery( '#loading_div' ).hide();
2268
  jQuery( "<div class=\"updated inline\">\n" +
2269
+ " <p><strong>" + bwg_objectL10B.watermark_option_reset + "</strong></p>" +
2270
+ " </div>" ).insertBefore( jQuery( "#bwg_options_form" ).parent() );
2271
  }
2272
  }
2273
+ } );
2274
 
2275
  return false;
2276
  }
2277
 
2278
  /*galleries sortable */
2279
+ function bwg_galleries_ordering() {
2280
+ jQuery( "#bwg-table-sortable" ).sortable( {
2281
+ handle: ".connectedSortable",
2282
+ connectWith: ".connectedSortable",
2283
+ update: function () {
2284
+ var ids = [];
2285
+ var ordering_ajax_url = jQuery( "td.col_drag" ).data( "ordering-url" );
2286
+ jQuery( ".wd-id" ).each( function () {
2287
+ ids.push( jQuery( this ).val() );
2288
+ } );
2289
+ jQuery.ajax( {
2290
+ type: "POST",
2291
+ dataType: "json",
2292
+ url: ordering_ajax_url,
2293
+ data: { 'orders': ids },
2294
+ success: function ( response ) {
2295
+ jQuery( ".ajax-msg" ).remove();
2296
+ if ( response.message ) {
2297
+ jQuery( '<div class="ajax-msg">' + response.message + '</div>' ).insertAfter( '.wrap .bwg-head-notice' );
2298
+ }
2299
+ }
2300
+ } );
2301
+ }
2302
+ } );
2303
+ }
2304
+
2305
+ function show_hide_compact_album_view( val ) {
2306
+ switch ( val ) {
2307
+ case 'thumbnail': {
2308
+ bwg_show_hide( 'tr_album_mosaic', 'none' );
2309
+ bwg_show_hide( 'tr_album_resizable_mosaic', 'none' );
2310
+ bwg_show_hide( 'tr_album_mosaic_total_width', 'none' );
2311
+ bwg_show_hide( 'for_album_image_title_show_hover_0', '' );
2312
+ bwg_show_hide( 'album_image_title_show_hover_0', '' );
2313
+ bwg_show_hide( 'for_album_ecommerce_icon_show_hover_0', '' );
2314
+ bwg_show_hide( 'tr_album_thumbnail_dimensions', '' );
2315
+ bwg_show_hide( 'tr_album_images_per_page', '' );
2316
+ }
2317
+ break;
2318
+ case 'masonry': {
2319
+ bwg_show_hide( 'tr_album_mosaic', 'none' );
2320
+ bwg_show_hide( 'tr_album_resizable_mosaic', 'none' );
2321
+ bwg_show_hide( 'tr_album_mosaic_total_width', 'none' );
2322
+ bwg_show_hide( 'for_album_image_title_show_hover_0', '' );
2323
+ bwg_show_hide( 'album_image_title_show_hover_0', '' );
2324
+ bwg_show_hide( 'for_album_ecommerce_icon_show_hover_0', '' );
2325
+ bwg_show_hide( 'tr_album_thumbnail_dimensions', '' );
2326
+ bwg_show_hide( 'tr_album_images_per_page', '' );
2327
+ }
2328
+ break;
2329
+ case 'mosaic': {
2330
+ bwg_show_hide( 'tr_album_mosaic', '' );
2331
+ bwg_show_hide( 'tr_album_resizable_mosaic', '' );
2332
+ bwg_show_hide( 'tr_album_mosaic_total_width', '' );
2333
+ bwg_show_hide( 'for_album_image_title_show_hover_0', 'none' );
2334
+ bwg_show_hide( 'album_image_title_show_hover_0', 'none' );
2335
+ bwg_show_hide( 'for_album_ecommerce_icon_show_hover_0', 'none' );
2336
+ bwg_show_hide( 'tr_album_thumbnail_dimensions', '' );
2337
+ bwg_show_hide( 'tr_album_images_per_page', '' );
2338
+ }
2339
+ break;
2340
+ case 'slideshow': {
2341
+ bwg_show_hide( 'tr_album_mosaic', 'none' );
2342
+ bwg_show_hide( 'tr_album_resizable_mosaic', 'none' );
2343
+ bwg_show_hide( 'tr_album_mosaic_total_width', 'none' );
2344
+ bwg_show_hide( 'for_album_image_title_show_hover_0', '' );
2345
+ bwg_show_hide( 'album_image_title_show_hover_0', '' );
2346
+ bwg_show_hide( 'for_album_ecommerce_icon_show_hover_0', '' );
2347
+ bwg_show_hide( 'tr_album_thumbnail_dimensions', 'none' );
2348
+ bwg_show_hide( 'tr_album_images_per_page', 'none' );
2349
+ }
2350
+ case 'image_browser': {
2351
+ bwg_show_hide( 'tr_album_mosaic', 'none' );
2352
+ bwg_show_hide( 'tr_album_resizable_mosaic', 'none' );
2353
+ bwg_show_hide( 'tr_album_mosaic_total_width', 'none' );
2354
+ bwg_show_hide( 'for_album_image_title_show_hover_0', '' );
2355
+ bwg_show_hide( 'album_image_title_show_hover_0', '' );
2356
+ bwg_show_hide( 'for_album_ecommerce_icon_show_hover_0', '' );
2357
+ bwg_show_hide( 'tr_album_thumbnail_dimensions', 'none' );
2358
+ bwg_show_hide( 'tr_album_images_per_page', 'none' );
2359
+ }
2360
+ break;
2361
+ case 'blog_style': {
2362
+ bwg_show_hide( 'tr_album_mosaic', 'none' );
2363
+ bwg_show_hide( 'tr_album_resizable_mosaic', 'none' );
2364
+ bwg_show_hide( 'tr_album_mosaic_total_width', 'none' );
2365
+ bwg_show_hide( 'for_album_image_title_show_hover_0', '' );
2366
+ bwg_show_hide( 'album_image_title_show_hover_0', '' );
2367
+ bwg_show_hide( 'for_album_ecommerce_icon_show_hover_0', '' );
2368
+ bwg_show_hide( 'tr_album_thumbnail_dimensions', 'none' );
2369
+ bwg_show_hide( 'tr_album_images_per_page', '' );
2370
+ }
2371
+ break;
2372
+ case 'carousel': {
2373
+ bwg_show_hide( 'tr_album_mosaic', 'none' );
2374
+ bwg_show_hide( 'tr_album_resizable_mosaic', 'none' );
2375
+ bwg_show_hide( 'tr_album_mosaic_total_width', 'none' );
2376
+ bwg_show_hide( 'for_album_image_title_show_hover_0', '' );
2377
+ bwg_show_hide( 'album_image_title_show_hover_0', '' );
2378
+ bwg_show_hide( 'for_album_ecommerce_icon_show_hover_0', '' );
2379
+ bwg_show_hide( 'tr_album_thumbnail_dimensions', 'none' );
2380
+ bwg_show_hide( 'tr_album_images_per_page', 'none' );
2381
+ }
2382
+ break;
2383
+ }
2384
+ }
2385
+
2386
+ function show_hide_extended_album_view( val ) {
2387
+ switch ( val ) {
2388
+ case 'thumbnail': {
2389
+ bwg_show_hide( 'tr_album_extended_mosaic', 'none' );
2390
+ bwg_show_hide( 'tr_album_extended_resizable_mosaic', 'none' );
2391
+ bwg_show_hide( 'tr_album_extended_mosaic_total_width', 'none' );
2392
+ bwg_show_hide( 'for_album_extended_image_title_show_hover_0', '' );
2393
+ bwg_show_hide( 'album_extended_image_title_show_hover_0', '' );
2394
+ bwg_show_hide( 'for_album_extended_ecommerce_icon_show_hover_0', '' );
2395
+ bwg_show_hide( 'tr_album_extended_thumbnail_dimensions', '' );
2396
+ bwg_show_hide( 'tr_album_extended_images_per_page', '' );
2397
+ }
2398
+ break;
2399
+ case 'masonry': {
2400
+ bwg_show_hide( 'tr_album_extended_mosaic', 'none' );
2401
+ bwg_show_hide( 'tr_album_extended_resizable_mosaic', 'none' );
2402
+ bwg_show_hide( 'tr_album_extended_mosaic_total_width', 'none' );
2403
+ bwg_show_hide( 'for_album_extended_image_title_show_hover_0', '' );
2404
+ bwg_show_hide( 'album_extended_image_title_show_hover_0', '' );
2405
+ bwg_show_hide( 'for_album_extended_ecommerce_icon_show_hover_0', '' );
2406
+ bwg_show_hide( 'tr_album_extended_thumbnail_dimensions', '' );
2407
+ bwg_show_hide( 'tr_album_extended_images_per_page', '' );
2408
+ }
2409
+ break;
2410
+ case 'mosaic': {
2411
+ bwg_show_hide( 'tr_album_extended_mosaic', '' );
2412
+ bwg_show_hide( 'tr_album_extended_resizable_mosaic', '' );
2413
+ bwg_show_hide( 'tr_album_extended_mosaic_total_width', '' );
2414
+ bwg_show_hide( 'for_album_extended_image_title_show_hover_0', 'none' );
2415
+ bwg_show_hide( 'album_extended_image_title_show_hover_0', 'none' );
2416
+ bwg_show_hide( 'for_album_extended_ecommerce_icon_show_hover_0', 'none' );
2417
+ bwg_show_hide( 'tr_album_extended_thumbnail_dimensions', '' );
2418
+ bwg_show_hide( 'tr_album_extended_images_per_page', '' );
2419
+ }
2420
+ break;
2421
+ case 'slideshow': {
2422
+ bwg_show_hide( 'tr_album_extended_mosaic', 'none' );
2423
+ bwg_show_hide( 'tr_album_extended_resizable_mosaic', 'none' );
2424
+ bwg_show_hide( 'tr_album_extended_mosaic_total_width', 'none' );
2425
+ bwg_show_hide( 'for_album_extended_image_title_show_hover_0', '' );
2426
+ bwg_show_hide( 'album_extended_image_title_show_hover_0', '' );
2427
+ bwg_show_hide( 'for_album_extended_ecommerce_icon_show_hover_0', '' );
2428
+ bwg_show_hide( 'tr_album_extended_thumbnail_dimensions', 'none' );
2429
+ bwg_show_hide( 'tr_album_extended_images_per_page', 'none' );
2430
+ }
2431
+ case 'image_browser': {
2432
+ bwg_show_hide( 'tr_album_extended_mosaic', 'none' );
2433
+ bwg_show_hide( 'tr_album_extended_resizable_mosaic', 'none' );
2434
+ bwg_show_hide( 'tr_album_extended_mosaic_total_width', 'none' );
2435
+ bwg_show_hide( 'for_album_extended_image_title_show_hover_0', '' );
2436
+ bwg_show_hide( 'album_extended_image_title_show_hover_0', '' );
2437
+ bwg_show_hide( 'for_album_extended_ecommerce_icon_show_hover_0', '' );
2438
+ bwg_show_hide( 'tr_album_extended_thumbnail_dimensions', 'none' );
2439
+ bwg_show_hide( 'tr_album_extended_images_per_page', 'none' );
2440
+ }
2441
+ break;
2442
+ case 'blog_style': {
2443
+ bwg_show_hide( 'tr_album_extended_mosaic', 'none' );
2444
+ bwg_show_hide( 'tr_album_extended_resizable_mosaic', 'none' );
2445
+ bwg_show_hide( 'tr_album_extended_mosaic_total_width', 'none' );
2446
+ bwg_show_hide( 'for_album_extended_image_title_show_hover_0', '' );
2447
+ bwg_show_hide( 'album_extended_image_title_show_hover_0', '' );
2448
+ bwg_show_hide( 'for_album_extended_ecommerce_icon_show_hover_0', '' );
2449
+ bwg_show_hide( 'tr_album_extended_thumbnail_dimensions', 'none' );
2450
+ bwg_show_hide( 'tr_album_extended_images_per_page', '' );
2451
+ }
2452
+ break;
2453
+ case 'carousel': {
2454
+ bwg_show_hide( 'tr_album_extended_mosaic', 'none' );
2455
+ bwg_show_hide( 'tr_album_extended_resizable_mosaic', 'none' );
2456
+ bwg_show_hide( 'tr_album_extended_mosaic_total_width', 'none' );
2457
+ bwg_show_hide( 'for_album_extended_image_title_show_hover_0', '' );
2458
+ bwg_show_hide( 'album_extended_image_title_show_hover_0', '' );
2459
+ bwg_show_hide( 'for_album_extended_ecommerce_icon_show_hover_0', '' );
2460
+ bwg_show_hide( 'tr_album_extended_thumbnail_dimensions', 'none' );
2461
+ bwg_show_hide( 'tr_album_extended_images_per_page', 'none' );
2462
+ }
2463
+ break;
2464
+ }
2465
+ }
2466
+
2467
+ function bwg_show_hide( id, display ) {
2468
+ jQuery( "#" + id ).css( 'display', display );
2469
+ }
2470
+
2471
+ function search_get_current( sort ) {
2472
  var current, div, div_id;
2473
  current = jQuery( '#search_current_match' ).attr( 'class' );
2474
  div = jQuery( '.search-div:visible' );
2475
  div_id = div.attr( 'id' );
2476
+ if ( sort == 'search_next' ) {
2477
+ if ( !current ) {
2478
+ if ( jQuery( '.search-div' ).last().attr( 'id' ) == div_id ) {
2479
+ jQuery( 'a[href$=' + jQuery( '.search-div' ).first().attr( 'id' ) + ']' ).click();
2480
+ }
2481
+ else if ( div.is( ':has(div.bwg_change_gallery_type)' ) && !div.find( '.bwg_change_gallery_type span:last-child' ).hasClass( 'gallery_type_active' ) ) {
2482
+ var i = 0,
2483
+ j;
2484
+ div.find( '.gallery_type' ).each( function () {
2485
+ if ( jQuery( this ).hasClass( 'gallery_type_active' ) ) {
2486
  jQuery( this ).removeClass( 'gallery_type_active' );
2487
+ j = i;
2488
  }
2489
  i++;
2490
+ } )
2491
+ div.find( '.bwg_change_gallery_type' ).children().eq( j + 1 ).addClass( 'gallery_type_active' );
2492
+ div.find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' ).next( 'option' ).prop( 'selected', true );
2493
+ jQuery( '.gallery_type_active:visible' ).trigger( 'click' );
2494
+ }
2495
+ else if ( div.next().is( ':has(div.bwg_change_gallery_type)' ) ) {
2496
+ jQuery( 'a[href$=' + div.next().attr( 'id' ) + ']' ).click();
2497
  div.next().find( '.bwg_change_gallery_type' ).children().removeClass( 'gallery_type_active' );
2498
  div.next().find( '.bwg_change_gallery_type' ).children().eq( 0 ).addClass( 'gallery_type_active' );
2499
+ jQuery( '#' + div.next().find( '#gallery_types_name > option:selected' ).val() ).css( { 'display': 'none' } );
2500
  div.next().find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' );
2501
+ div.next().find( '#gallery_types_name > option:first' ).prop( 'selected', true );
2502
+ jQuery( '#' + div.next().find( '#gallery_types_name > option:selected' ).val() ).css( { 'display': 'flex' } );
2503
  jQuery( '.gallery_type_active:visible' ).click();
2504
+ bwg_gallery_type_options( div.next().find( '#gallery_types_name > option:selected' ).val() );
2505
 
 
 
2506
  }
2507
+ else {
2508
+ jQuery( 'a[href$=' + div.next().attr( 'id' ) + ']' ).click();
2509
+ }
2510
+ }
2511
+ else {
2512
+ ind = +current.indexOf( ' search_highlight' );
2513
+ var next = +current.substring( 9, ind ) + 1;
2514
  var total = +jQuery( '.total_matches:visible' ).text();
2515
+ if ( next <= total ) {
2516
  jQuery( '#search_current_match' ).removeAttr( 'id' );
2517
  jQuery( '.' + next.toString() ).attr( 'id', 'search_current_match' );
2518
  jQuery( '.current_match' ).empty();
2519
  jQuery( '.current_match' ).append( next + '/' );
2520
+ }
2521
+ else {
2522
+ if ( div.is( ':has(div.bwg_change_gallery_type)' ) && !div.find( '.bwg_change_gallery_type span:last-child' ).hasClass( 'gallery_type_active' ) ) {
2523
+ var i = 0,
2524
+ j;
2525
+ div.find( '.gallery_type' ).each( function () {
2526
+ if ( jQuery( this ).hasClass( 'gallery_type_active' ) ) {
2527
  jQuery( this ).removeClass( 'gallery_type_active' );
2528
+ j = i;
2529
  }
2530
  i++;
2531
+ } )
2532
+ div.find( '.bwg_change_gallery_type' ).children().eq( j + 1 ).addClass( 'gallery_type_active' );
2533
+ div.find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' ).next( 'option' ).prop( 'selected', true );
2534
  jQuery( '.gallery_type_active:visible' ).click();
2535
+ bwg_gallery_type_options( div.find( '#gallery_types_name > option:selected' ).val() );
2536
+ }
2537
+ else if ( div.next().is( ':has(div.bwg_change_gallery_type)' ) ) {
2538
+ jQuery( 'a[href$=' + div.next().attr( 'id' ) + ']' ).click();
2539
  div.next().find( '.bwg_change_gallery_type' ).children().removeClass( 'gallery_type_active' );
2540
  div.next().find( '.bwg_change_gallery_type span:first-child' ).addClass( 'gallery_type_active' );
2541
+ jQuery( '#' + div.next().find( '#gallery_types_name > option:selected' ).val() ).css( { 'display': 'none' } );
2542
  div.next().find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' );
2543
+ div.next().find( '#gallery_types_name > option:first' ).prop( 'selected', true );
2544
+ jQuery( '#' + div.next().find( '#gallery_types_name > option:selected' ).val() ).css( { 'display': 'flex' } );
2545
  div.next().find( '.gallery_type_active:visible' ).click();
2546
+ bwg_gallery_type_options( div.next().find( '#gallery_types_name > option:selected' ).val() );
2547
+ }
2548
+ else if ( jQuery( '.search-div' ).last().attr( 'id' ) == div_id ) {
2549
+ jQuery( 'a[href$=' + jQuery( '.search-div' ).first().attr( 'id' ) + ']' ).click();
2550
+ }
2551
+ else {
2552
+ jQuery( 'a[href$=' + div.next().attr( 'id' ) + ']' ).click();
2553
+ }
2554
+ }
2555
+ }
2556
+ }
2557
+ else if ( sort == 'search_prev' ) {
2558
+ if ( !current ) {
2559
+ if ( jQuery( '.search-div' ).first().attr( 'id' ) == div_id ) {
2560
+ jQuery( 'a[href$=' + jQuery( '.search-div' ).last().attr( 'id' ) + ']' ).click();
2561
  jQuery( '.1' ).attr( 'id', '' );
2562
+ jQuery( '.' + jQuery( '.total_matches:visible' ).text() ).attr( 'id', 'search_current_match' );
2563
+ }
2564
+ else if ( div.is( ':has(div.bwg_change_gallery_type)' ) && !div.find( '.bwg_change_gallery_type span:first-child' ).hasClass( 'gallery_type_active' ) ) {
2565
+ var i = 0,
2566
+ j = 0;
2567
+ div.find( '.gallery_type:visible' ).each( function () {
2568
+ if ( jQuery( this ).hasClass( 'gallery_type_active' ) ) {
2569
  jQuery( this ).removeClass( 'gallery_type_active' );
2570
+ j = i;
2571
  }
2572
  i++;
2573
+ } )
2574
+ div.find( '.bwg_change_gallery_type' ).children().eq( j - 1 ).addClass( 'gallery_type_active' );
2575
+ div.find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' ).prev( 'option' ).prop( 'selected', true );
2576
  jQuery( '.gallery_type_active:visible' ).click();
2577
+ bwg_gallery_type_options( div.find( '#gallery_types_name > option:selected' ).val() );
2578
  jQuery( '.1' ).removeAttr( 'id' );
2579
  var total_matches = jQuery( '.total_matches:visible' ).text();
2580
  jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2581
+ }
2582
+ else if ( div.prev().is( ':has(div.bwg_change_gallery_type)' ) ) {
2583
+ jQuery( 'a[href$=' + div.prev().attr( 'id' ) + ']' ).click();
2584
  div.prev().find( '.bwg_change_gallery_type' ).children().removeClass( 'gallery_type_active' );
2585
  div.prev().find( '.bwg_change_gallery_type span:last-child' ).addClass( 'gallery_type_active' );
2586
  div.prev().find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' );
2587
+ div.prev().find( '#gallery_types_name > option:last' ).prop( 'selected', true );
2588
  jQuery( '.gallery_type_active:visible' ).click();
2589
+ bwg_gallery_type_options( div.prev().find( '#gallery_types_name > option:selected' ).val() );
2590
  jQuery( '.1' ).removeAttr( 'id' );
2591
  var total_matches = jQuery( '.total_matches:visible' ).text();
2592
  jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2593
+ }
2594
+ else {
2595
+ jQuery( 'a[href$=' + div.prev().attr( 'id' ) + ']' ).click();
2596
  jQuery( '.1' ).removeAttr( 'id' );
2597
  var total_matches = jQuery( '.total_matches:visible' ).text();
2598
+ jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2599
  }
2600
+ }
2601
+ else {
2602
  var total = +jQuery( '.total_matches:visible' ).text();
2603
+ ind = +current.indexOf( ' search_highlight' );
2604
  var back = +current.substring( 9, ind ) - 1;
2605
+ if ( back > 0 ) {
2606
  jQuery( '#search_current_match' ).removeAttr( 'id' );
2607
  jQuery( '#search_current_color' ).removeAttr( 'id' );
2608
  jQuery( '.' + back.toString() ).attr( 'id', 'search_current_match' );
2609
  jQuery( '.current_match' ).empty();
2610
  jQuery( '.current_match' ).append( back + '/' );
2611
+ }
2612
+ else if ( back == 0 ) {
2613
+ if ( div.is( ':has(div.bwg_change_gallery_type)' ) && !div.find( '.bwg_change_gallery_type span:first-child' ).hasClass( 'gallery_type_active' ) ) {
2614
+ var i = 0,
2615
+ j = 0;
2616
+ div.find( '.gallery_type' ).each( function () {
2617
+ if ( jQuery( this ).hasClass( 'gallery_type_active' ) ) {
2618
  jQuery( this ).removeClass( 'gallery_type_active' );
2619
+ j = i;
2620
  }
2621
  i++;
2622
+ } )
2623
+ div.find( '.bwg_change_gallery_type' ).children().eq( j - 1 ).addClass( 'gallery_type_active' );
2624
+ div.find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' ).prev( 'option' ).prop( 'selected', true );
2625
  jQuery( '.gallery_type_active:visible' ).click();
2626
+ bwg_gallery_type_options( div.find( '#gallery_types_name > option:selected' ).val() );
2627
  jQuery( '.1' ).removeAttr( 'id' );
2628
  var total_matches = jQuery( '.total_matches:visible' ).text();
2629
  jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2630
+ }
2631
+ else if ( div.prev().is( ':has(div.bwg_change_gallery_type)' ) ) {
2632
+ jQuery( 'a[href$=' + div.prev().attr( 'id' ) + ']' ).click();
2633
  div.prev().find( '.bwg_change_gallery_type' ).children().removeClass( 'gallery_type_active' );
2634
  div.prev().find( '.bwg_change_gallery_type span:last-child' ).addClass( 'gallery_type_active' );
2635
  div.prev().find( '#gallery_types_name > option:selected' ).removeAttr( 'selected' );
2636
+ div.prev().find( '#gallery_types_name > option:last' ).prop( 'selected', true );
2637
  jQuery( '.gallery_type_active:visible' ).click();
2638
+ bwg_gallery_type_options( div.prev().find( '#gallery_types_name > option:selected' ).val() );
2639
  jQuery( '.1' ).removeAttr( 'id' );
2640
  var total_matches = jQuery( '.total_matches:visible' ).text();
2641
  jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2642
+ }
2643
+ else if ( jQuery( '.search-div' ).first().attr( 'id' ) == div_id ) {
2644
+ jQuery( 'a[href$=' + jQuery( '.search-div' ).last().attr( 'id' ) + ']' ).click();
2645
  jQuery( '.1' ).removeAttr( 'id' );
2646
  var total_matches = jQuery( '.total_matches:visible' ).text();
2647
  jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2648
+ }
2649
+ else {
2650
+ jQuery( 'a[href$=' + div.prev().attr( 'id' ) + ']' ).click();
2651
  jQuery( '.1' ).removeAttr( 'id' );
2652
  var total_matches = jQuery( '.total_matches:visible' ).text();
2653
  jQuery( '.' + total_matches ).attr( 'id', 'search_current_match' );
2655
  }
2656
  }
2657
  }
2658
+ if ( jQuery( '#search_current_match' ).length ) {
2659
+ if ( jQuery( '#search_current_match' ).offset().top > jQuery( window ).height() - 50 ) {
2660
+ jQuery( 'html, body' ).animate( {
2661
+ scrollTop: jQuery( "#search_current_match" ).offset().top - 300
2662
+ }, 5 );
2663
+ }
2664
+ else {
2665
+ jQuery( window ).scrollTop( 0 );
2666
  }
2667
  }
2668
  }
2669
 
2670
+ function search_options() {
2671
  var val, tab_id, div;
2672
  val = jQuery( '.search_in_options:visible' ).val();
2673
+ jQuery( '.search_in_options' ).val( val );
2674
  div = jQuery( '.search-div:visible' );
2675
  tab_id = div.attr( 'id' );
2676
+ if ( val ) {
2677
  val = val.toLowerCase().trim();
2678
  }
2679
  jQuery( '.total_matches' ).empty();
2682
  jQuery( '.search_next' ).hide();
2683
  jQuery( '.search_close' ).hide();
2684
  jQuery( '.search_count' ).hide();
2685
+ jQuery( '.wd-group' ).each( function () {
2686
+ jQuery( this ).removeClass();
2687
+ jQuery( this ).addClass( 'wd-group' );
2688
+ } )
2689
+ jQuery( '#search_current_match' ).removeAttr( 'id' );
2690
+ if ( val != '' ) {
2691
  //css({'padding': '20px 5px 20px 5px','margin': '0 0 0 15px'});
2692
+ if ( div.has( '.postbox' ) ) {
2693
  jQuery( '.postbox' ).removeClass( 'closed' );
2694
  }
2695
  jQuery( '.search_prev' ).show();
2696
  jQuery( '.search_next' ).show();
2697
  jQuery( '.search_close' ).show();
2698
+ val = val.replace( /\s{2,}/g, ' ' );
2699
  var matchcount = 0;
2700
  jQuery( '#' + tab_id ).find( '.wd-group' ).each( function () {
2701
+ if ( jQuery( this ).is( ':visible' ) ) {
2702
  var label, description;
2703
  label = jQuery( this ).find( '.wd-label' ).text().toLowerCase();
2704
  description = jQuery( this ).find( 'p.description' ).text().toLowerCase();
2705
+ if ( label.match( val, 'gi' ) || description.match( val, 'gi' ) ) {
2706
+ matchcount = matchcount + 1;
2707
+ if ( matchcount == 1 ) {
2708
+ jQuery( this ).addClass( matchcount + ' search_highlight' );
2709
+ jQuery( this ).attr( 'id', 'search_current_match' );
2710
+ }
2711
+ else {
2712
+ jQuery( this ).addClass( matchcount + ' search_highlight' );
2713
  }
2714
  }
2715
+ }
2716
+ } )
2717
+ if ( jQuery( '#search_current_match' ).length ) {
2718
+ if ( jQuery( '#search_current_match' ).offset().top > jQuery( window ).height() - 50 ) {
2719
+ jQuery( 'html, body' ).animate( {
2720
+ scrollTop: jQuery( "#search_current_match" ).offset().top - 100
2721
+ }, 5 );
2722
+ }
2723
+ else {
2724
+ jQuery( window ).scrollTop( 0 );
2725
+ }
2726
+ }
2727
+ jQuery( '.total_matches' ).show();
2728
+ jQuery( '.total_matches' ).append( matchcount );
2729
+ if ( matchcount != 0 ) {
2730
+ jQuery( '.current_match' ).append( 1 + '/' );
2731
+ if ( jQuery( '#search_current_match' ).offset().top > jQuery( window ).height() - 50 ) {
2732
+ jQuery( 'html, body' ).animate( {
2733
+ scrollTop: jQuery( "#search_current_match" ).offset().top - 100
2734
+ }, 5 );
2735
+ }
2736
+ else {
2737
+ jQuery( window ).scrollTop( 0 );
2738
+ }
2739
+ }
2740
+ else if ( matchcount == 0 ) {
2741
  jQuery( '.current_match' ).append( 0 + '/' );
2742
  }
2743
+ }
2744
+ else {
2745
+ jQuery( '.total_matches' ).empty();
2746
  jQuery( '.current_match' ).empty();
2747
  jQuery( '.postbox' ).removeClass( 'closed' );
2748
  jQuery( '.postbox' ).addClass( 'closed' );
2750
  search_options_for_count();
2751
  }
2752
 
2753
+ function search_options_for_count() {
2754
  var val, tab_id, div;
2755
  val = jQuery( '.search_in_options:visible' ).val();
2756
+ jQuery( '.search_in_options' ).val( val );
2757
+ if ( val != '' ) {
2758
+ jQuery( '.search-div' ).each( function () {
2759
+ div = jQuery( this );
2760
  tab_id = div.attr( 'id' );
2761
  val = val.toLowerCase().trim();
2762
+ jQuery( '#' + tab_id + '_bage' ).empty();
2763
+ if ( div.has( '.postbox' ) ) {
2764
  jQuery( '.postbox' ).removeClass( 'closed' );
2765
  }
2766
+ val = val.replace( /\s{2,}/g, ' ' );
2767
  var matchcount = 0;
2768
  jQuery( '#' + tab_id ).find( '.wd-group' ).each( function () {
2769
  var label, description;
2770
  label = jQuery( this ).find( '.wd-label' ).text().toLowerCase();
2771
  description = jQuery( this ).find( 'p.description' ).text().toLowerCase();
2772
+ if ( label.match( val, 'gi' ) || description.match( val, 'gi' ) ) {
2773
+ matchcount = matchcount + 1;
2774
  }
2775
+ } )
2776
+ if ( matchcount > 0 ) {
2777
+ jQuery( '#' + tab_id + '_bage' ).html( matchcount ).show();
2778
  }
2779
+ } )
 
2780
  }
2781
+ else {
2782
+ }
2783
+ }
js/bwg_editor_button.js CHANGED
@@ -1,11 +1,11 @@
1
- jQuery(window).load(function(){
2
  window.bwgDocumentReady = true;
3
  if (window.bwgTinymceRendered) {
4
  jQuery(document).trigger("onUploadImg");
5
  }
6
  });
7
 
8
- jQuery(document).ready(function() {
9
  bwg_shortcode_ready();
10
  });
11
  jQuery(window).resize(function() {
1
+ jQuery(window).on('load',function(){
2
  window.bwgDocumentReady = true;
3
  if (window.bwgTinymceRendered) {
4
  jQuery(document).trigger("onUploadImg");
5
  }
6
  });
7
 
8
+ jQuery(function() {
9
  bwg_shortcode_ready();
10
  });
11
  jQuery(window).resize(function() {
js/bwg_elementor_widget.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery("document").ready(function () {
2
  elementor.hooks.addAction( 'panel/open_editor/widget/bwg-elementor', function( panel, model, view ) {
3
  var bwg_view_type = jQuery('select[data-setting="bwg_gallery_view_type"]',window.parent.document);
4
  var bwg_group_view_type = jQuery('select[data-setting="bwg_gallery_group_view_type"]',window.parent.document);
1
+ jQuery(function() {
2
  elementor.hooks.addAction( 'panel/open_editor/widget/bwg-elementor', function( panel, model, view ) {
3
  var bwg_view_type = jQuery('select[data-setting="bwg_gallery_view_type"]',window.parent.document);
4
  var bwg_group_view_type = jQuery('select[data-setting="bwg_gallery_group_view_type"]',window.parent.document);
js/bwg_embed.js CHANGED
@@ -357,7 +357,7 @@ function bwg_add_instagram_gallery(instagram_access_token, from_popup){
357
  /*filter out other echoed characters*/
358
  /*18 is the length of "wd_delimiter_start"*/
359
  response = response.substring(index_start+18,index_end);
360
- response_JSON = jQuery.parseJSON(response);
361
 
362
  if(!response_JSON ){
363
  alert('There is some error. Cannot add Instagram gallery.');
@@ -369,7 +369,7 @@ function bwg_add_instagram_gallery(instagram_access_token, from_popup){
369
  }
370
  else{
371
  if(response_JSON[0] == 'error'){
372
- alert('Error: ' + jQuery.parseJSON(response)[1]);
373
  jQuery('#loading_div').hide();
374
  if(from_popup){
375
  jQuery('#bulk_embed').show();
357
  /*filter out other echoed characters*/
358
  /*18 is the length of "wd_delimiter_start"*/
359
  response = response.substring(index_start+18,index_end);
360
+ response_JSON = JSON.parse(response);
361
 
362
  if(!response_JSON ){
363
  alert('There is some error. Cannot add Instagram gallery.');
369
  }
370
  else{
371
  if(response_JSON[0] == 'error'){
372
+ alert('Error: ' + JSON.parse(response)[1]);
373
  jQuery('#loading_div').hide();
374
  if(from_popup){
375
  jQuery('#bulk_embed').show();
js/bwg_frontend.js CHANGED
@@ -9,7 +9,7 @@ var bwg_params_ib = [];
9
  /* Carousel params */
10
  var bwg_params_carousel = [];
11
 
12
- jQuery(document).ready(function () {
13
  bwg_main_ready();
14
 
15
  function bwg_hiddenFunction() {
@@ -1777,7 +1777,7 @@ function bwg_ajax(form_id, current_view, id, album_gallery_id, cur_album_id, typ
1777
  }
1778
 
1779
  if ( typeof post_data["bwg_album_breadcrumb_" + current_view] != "undefined" ) {
1780
- var breadcrumbObj = jQuery.parseJSON(post_data["bwg_album_breadcrumb_" + current_view]);
1781
  jQuery.each(breadcrumbObj, function (index, value) {
1782
  post_data["bwg_search_" + current_view] = '';
1783
  if (album_gallery_id == value.id) {
@@ -2056,6 +2056,7 @@ function bwg_fade(current_image_class, next_image_class, direction, bwg) {
2056
  }
2057
  if (bwg_testBrowser_cssTransitions()) {
2058
  jQuery(next_image_class).css('transition', 'opacity ' + bwg_transition_dur + 'ms linear');
 
2059
  jQuery(current_image_class).css({'opacity' : 0, 'z-index': 1});
2060
  jQuery(next_image_class).css({'opacity' : 1, 'z-index' : 2});
2061
  jQuery(next_image_class).one('webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend', jQuery.proxy(bwg_after_trans));
9
  /* Carousel params */
10
  var bwg_params_carousel = [];
11
 
12
+ jQuery(function() {
13
  bwg_main_ready();
14
 
15
  function bwg_hiddenFunction() {
1777
  }
1778
 
1779
  if ( typeof post_data["bwg_album_breadcrumb_" + current_view] != "undefined" ) {
1780
+ var breadcrumbObj = JSON.parse(post_data["bwg_album_breadcrumb_" + current_view]);
1781
  jQuery.each(breadcrumbObj, function (index, value) {
1782
  post_data["bwg_search_" + current_view] = '';
1783
  if (album_gallery_id == value.id) {
2056
  }
2057
  if (bwg_testBrowser_cssTransitions()) {
2058
  jQuery(next_image_class).css('transition', 'opacity ' + bwg_transition_dur + 'ms linear');
2059
+ jQuery(current_image_class).css('transition', 'opacity ' + bwg_transition_dur + 'ms linear');
2060
  jQuery(current_image_class).css({'opacity' : 0, 'z-index': 1});
2061
  jQuery(next_image_class).css({'opacity' : 1, 'z-index' : 2});
2062
  jQuery(next_image_class).one('webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend', jQuery.proxy(bwg_after_trans));
js/bwg_gallery_box.js CHANGED
@@ -41,7 +41,7 @@ function gallery_box_ready() {
41
  startPoint = 0;
42
  endPoint = key+preloadCount;
43
 
44
- jQuery(document).ready(function () {
45
  bwg_load_visible_images( key, preloadCount, total_thumbnail_count );
46
  jQuery(".pge_tabs li a").on("click", function(){
47
  jQuery(".pge_tabs_container > div").hide();
41
  startPoint = 0;
42
  endPoint = key+preloadCount;
43
 
44
+ jQuery(function() {
45
  bwg_load_visible_images( key, preloadCount, total_thumbnail_count );
46
  jQuery(".pge_tabs li a").on("click", function(){
47
  jQuery(".pge_tabs_container > div").hide();
js/bwg_shortcode.js CHANGED
@@ -1,6 +1,6 @@
1
  var bwg_shortcode_type;
2
 
3
- jQuery(document).ready(function () {
4
  jQuery(".bwg_tw-container").parents().find(".wrap.wd-wrap-ajax").css({
5
  'height': 'calc(100% - 55px)'
6
  });
@@ -100,7 +100,9 @@ jQuery(document).ready(function () {
100
 
101
  });
102
 
103
- jQuery(window).load(function() {
 
 
104
  bwg_shortcode_load();
105
  });
106
 
@@ -426,7 +428,7 @@ function bwg_gallery_type(gallery_type) {
426
  jQuery('.gallery_type').find('.view_type_img').css('display','inline');
427
  jQuery('.gallery_type').removeClass('gallery_type_active');
428
  jQuery("#" + gallery_type).prop('checked', true);
429
- jQuery('input[name=gallery_type][id=' + gallery_type + ']').attr('checked', 'checked').closest('.gallery_type').addClass('gallery_type_active');
430
  jQuery('.gallery_type_active').find('.view_type_img').css('display','none');
431
  jQuery('.gallery_type_active').find('.view_type_img_active').css('display','inline');
432
 
1
  var bwg_shortcode_type;
2
 
3
+ jQuery(function() {
4
  jQuery(".bwg_tw-container").parents().find(".wrap.wd-wrap-ajax").css({
5
  'height': 'calc(100% - 55px)'
6
  });
100
 
101
  });
102
 
103
+
104
+
105
+ jQuery(window).on("load", function() {
106
  bwg_shortcode_load();
107
  });
108
 
428
  jQuery('.gallery_type').find('.view_type_img').css('display','inline');
429
  jQuery('.gallery_type').removeClass('gallery_type_active');
430
  jQuery("#" + gallery_type).prop('checked', true);
431
+ jQuery('input[name=gallery_type][id=' + gallery_type + ']').prop('checked', 'checked').closest('.gallery_type').addClass('gallery_type_active');
432
  jQuery('.gallery_type_active').find('.view_type_img').css('display','none');
433
  jQuery('.gallery_type_active').find('.view_type_img_active').css('display','inline');
434
 
js/scripts.min.js CHANGED
@@ -1 +1 @@
1
- var bwg_current_filmstrip_pos,total_thumbnail_count,key,startPoint,endPoint,bwg_image_info_pos,filmstrip_width,preloadCount,filmstrip_thumbnail_width,filmstrip_thumbnail_height,addthis_share,lightbox_comment_pos,bwg_transition_duration,bwg_playInterval,isPopUpOpened=!1,bwg_overflow_initial_value=!1,bwg_overflow_x_initial_value=!1,bwg_overflow_y_initial_value=!1;function gallery_box_ready(){filmstrip_thumbnail_width=jQuery(".bwg_filmstrip_thumbnail").width(),filmstrip_thumbnail_height=jQuery(".bwg_filmstrip_thumbnail").height(),1==gallery_box_data.open_with_fullscreen?(filmstrip_width=jQuery(window).width(),filmstrip_height=jQuery(window).height()):(filmstrip_width=jQuery(".bwg_filmstrip_container").width(),filmstrip_height=jQuery(".bwg_filmstrip_container").height()),preloadCount="horizontal"==gallery_box_data.filmstrip_direction?parseInt(filmstrip_width/filmstrip_thumbnail_width)+gallery_box_data.preload_images_count:parseInt(filmstrip_height/filmstrip_thumbnail_height)+gallery_box_data.preload_images_count,total_thumbnail_count=jQuery(".bwg_filmstrip_thumbnail").length,key=parseInt(jQuery("#bwg_current_image_key").val()),startPoint=0,endPoint=key+preloadCount,jQuery(document).ready(function(){bwg_load_visible_images(key,preloadCount,total_thumbnail_count),jQuery(".pge_tabs li a").on("click",function(){return jQuery(".pge_tabs_container > div").hide(),jQuery(".pge_tabs li").removeClass("pge_active"),jQuery(jQuery(this).attr("href")).show(),jQuery(this).closest("li").addClass("pge_active"),jQuery("[name=type]").val(jQuery(this).attr("href").substr(1)),!1});var e=jQuery("#bwg_rated").attr("data-params");bwg_rating((e=JSON.parse(e)).current_rate,e.current_rate_count,e.current_avg_rating,e.current_image_key)}),1==gallery_box_data.is_pro&&1==gallery_box_data.enable_addthis&&gallery_box_data.addthis_profile_id&&(addthis_share={url:gallery_box_data.share_url}),lightbox_comment_pos=gallery_box_data.lightbox_comment_pos,bwg_image_info_pos=jQuery(".bwg_ctrl_btn_container").length?jQuery(".bwg_ctrl_btn_container").height():0,bwg_transition_duration=gallery_box_data.slideshow_interval<4*gallery_box_data.slideshow_effect_duration&&0!=gallery_box_data.slideshow_interval?1e3*gallery_box_data.slideshow_interval/4:1e3*gallery_box_data.slideshow_effect_duration,gallery_box_data.bwg_transition_duration=bwg_transition_duration,gallery_box_data.bwg_trans_in_progress=!1,(jQuery("#spider_popup_wrap").width()>=jQuery(window).width()||jQuery("#spider_popup_wrap").height()>=jQuery(window).height())&&jQuery(".spider_popup_close").attr("class","bwg_ctrl_btn spider_popup_close_fullscreen"),window.clearInterval(bwg_playInterval),bwg_current_filmstrip_pos=gallery_box_data.current_pos,jQuery(document).on("keydown",function(e){jQuery("#bwg_name").is(":focus")||jQuery("#bwg_email").is(":focus")||jQuery("#bwg_comment").is(":focus")||jQuery("#bwg_captcha_input").is(":focus")||(39===e.keyCode?bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),parseInt(jQuery("#bwg_current_image_key").val())+1):37===e.keyCode?bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),parseInt(jQuery("#bwg_current_image_key").val())-1):27===e.keyCode?spider_destroypopup(1e3):32===e.keyCode&&jQuery(".bwg_play_pause").trigger("click"))}),jQuery(window).resize(function(){void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&(jQuery.fullscreen.isFullScreen()||bwg_popup_resize())});var r=gallery_box_data.image_width,_=gallery_box_data.image_height;if(1==gallery_box_data.is_pro){1==gallery_box_data.enable_addthis&&gallery_box_data.addthis_profile_id&&jQuery(".at4-share-outer").show(),spider_set_input_value("rate_ajax_task","save_hit_count"),spider_rate_ajax_save("bwg_rate_form");var e=gallery_box_data.data,t=gallery_box_data.current_image_key;jQuery(".bwg_image_hits span").html(++e[t].hit_count);var i=window.location.hash;i&&"-1"!=i.indexOf("bwg")||(location.replace("#bwg"+gallery_box_data.gallery_id+"/"+gallery_box_data.current_image_id),history.replaceState(void 0,void 0,"#bwg"+gallery_box_data.gallery_id+"/"+gallery_box_data.current_image_id))}1==gallery_box_data.image_right_click&&(jQuery(".bwg_image_wrap").bind("contextmenu",function(e){return!1}),jQuery(".bwg_image_wrap").css("webkitTouchCallout","none")),jQuery("#spider_popup_wrap").bind("touchmove",function(e){e.preventDefault()}),void 0!==jQuery().swiperight&&jQuery.isFunction(jQuery().swiperight)&&jQuery("#spider_popup_wrap .bwg_image_wrap").swiperight(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+gallery_box_data.data.length-1)%gallery_box_data.data.length),!1}),void 0!==jQuery().swipeleft&&jQuery.isFunction(jQuery().swipeleft)&&jQuery("#spider_popup_wrap .bwg_image_wrap").swipeleft(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+1)%gallery_box_data.data.length),!1}),bwg_reset_zoom();var a=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click";jQuery("#spider_popup_left").on(a,function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+gallery_box_data.data.length-1)%gallery_box_data.data.length),!1}),jQuery("#spider_popup_right").on(a,function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+1)%gallery_box_data.data.length),!1}),-1!=navigator.appVersion.indexOf("MSIE 10")||-1!=navigator.appVersion.indexOf("MSIE 9")?setTimeout(function(){bwg_popup_resize()},1):bwg_popup_resize(),jQuery(".bwg_watermark").css({display:"none"}),setTimeout(function(){bwg_change_watermark_container()},500),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&(jQuery.fullscreen.isNativelySupported()||jQuery(".bwg_fullscreen").hide()),"horizontal"==gallery_box_data.filmstrip_direction?(jQuery(".bwg_image_container").height(jQuery(".bwg_image_wrap").height()-gallery_box_data.image_filmstrip_height),jQuery(".bwg_image_container").width(jQuery(".bwg_image_wrap").width())):(jQuery(".bwg_image_container").height(jQuery(".bwg_image_wrap").height()),jQuery(".bwg_image_container").width(jQuery(".bwg_image_wrap").width()-gallery_box_data.image_filmstrip_width)),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".bwg_comments,.bwg_ecommerce_panel, .bwg_image_info").mCustomScrollbar({scrollInertia:150,advanced:{updateOnContentResize:!0}});var s=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";jQuery(".bwg_filmstrip").on(s,function(e){var t=window.event||e,i=(t=t.originalEvent?t.originalEvent:t).detail?-40*t.detail:t.wheelDelta,a=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase());0<i?jQuery(".bwg_filmstrip_left").trigger(a?"touchend":"click"):jQuery(".bwg_filmstrip_right").trigger(a?"touchend":"click")}),jQuery(".bwg_filmstrip_right").on(a,function(){jQuery(".bwg_filmstrip_thumbnails").stop(!0,!1),"left"==gallery_box_data.left_or_top?"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_thumbnails").position().left>=-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().left<-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({left:-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().left-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500)):(jQuery(".bwg_filmstrip_thumbnails").position().left>=-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().left<-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({left:-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().left-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500)):"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_thumbnails").position().top>=-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().top<-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({left:-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().top-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500)):(jQuery(".bwg_filmstrip_thumbnails").position().top>=-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().top<-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({top:-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({top:jQuery(".bwg_filmstrip_thumbnails").position().top-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500))}),"left"==gallery_box_data.left_or_top?jQuery(".bwg_filmstrip_left").on(a,function(){jQuery(".bwg_filmstrip_thumbnails").stop(!0,!1),jQuery(".bwg_filmstrip_thumbnails").position().left<0&&(jQuery(".bwg_filmstrip_right").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().left>-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)?jQuery(".bwg_filmstrip_thumbnails").animate({left:0},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().left+gallery_box_data.image_filmstrip_width+gallery_box_data.filmstrip_thumb_right_left_space},500,"linear")),window.setTimeout(function(){0==jQuery(".bwg_filmstrip_thumbnails").position().left&&jQuery(".bwg_filmstrip_left").css({opacity:.3})},500)}):jQuery(".bwg_filmstrip_left").on(a,function(){jQuery(".bwg_filmstrip_thumbnails").stop(!0,!1),jQuery(".bwg_filmstrip_thumbnails").position().top<0&&(jQuery(".bwg_filmstrip_right").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().top>-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)?jQuery(".bwg_filmstrip_thumbnails").animate({top:0},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({top:jQuery(".bwg_filmstrip_thumbnails").position().top+gallery_box_data.image_filmstrip_width+gallery_box_data.filmstrip_thumb_right_left_space},500,"linear")),window.setTimeout(function(){0==jQuery(".bwg_filmstrip_thumbnails").position().top&&jQuery(".bwg_filmstrip_left").css({opacity:.3})},500)}),"width"==gallery_box_data.width_or_height?bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip").width(),"",gallery_box_data):bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip").height(),"",gallery_box_data),jQuery(".bwg_info").on(a,function(){if("none"==jQuery(".bwg_image_info_container1").css("display")){jQuery(".bwg_image_info_container1").css("display","table-cell"),jQuery(".bwg_info").attr("title",bwg_objectsL10n.bwg_hide_info);jQuery(".bwg_ctrl_btn_container").length&&jQuery(".bwg_ctrl_btn_container").height();jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set()}else jQuery(".bwg_image_info_container1").css("display","none"),jQuery(".bwg_info").attr("title",bwg_objectsL10n.bwg_show_info)}),jQuery(".bwg_rate").on(a,function(){"none"==jQuery(".bwg_image_rate_container1").css("display")?(jQuery(".bwg_image_rate_container1").css("display","table-cell"),jQuery(".bwg_rate").attr("title",bwg_objectsL10n.bwg_hide_rating)):(jQuery(".bwg_image_rate_container1").css("display","none"),jQuery(".bwg_rate").attr("title",bwg_objectsL10n.bwg_show_rating))}),jQuery(".bwg_comment, .bwg_comments_close_btn").on(a,function(){bwg_comment()}),jQuery(".bwg_ecommerce, .bwg_ecommerce_close_btn").on(a,function(){bwg_ecommerce()}),jQuery(".bwg_toggle_container").on(a,function(){var e="top"==gallery_box_data.lightbox_ctrl_btn_pos?"bwg-icon-caret-up":"bwg-icon-caret-down",t="top"==gallery_box_data.lightbox_ctrl_btn_pos?"bwg-icon-caret-down":"bwg-icon-caret-up";jQuery(".bwg_toggle_container i").hasClass(e)?(gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_rate_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_rate_pos||jQuery(".bwg_image_rate").animate({top:0},500):jQuery(".bwg_image_rate").animate({bottom:0},500),gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_hit_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_hit_pos||jQuery(".bwg_image_hit").animate({top:0},500):jQuery(".bwg_image_hit").animate({bottom:0},500),"bottom"==gallery_box_data.lightbox_ctrl_btn_pos?(jQuery(".bwg_ctrl_btn_container").animate({bottom:"-"+jQuery(".bwg_ctrl_btn_container").height()},500).addClass("closed"),jQuery(".bwg_toggle_container").animate({bottom:0},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+t)}})):(jQuery(".bwg_ctrl_btn_container").animate({top:"-"+jQuery(".bwg_ctrl_btn_container").height()},500).addClass("closed"),jQuery(".bwg_toggle_container").animate({top:0},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+t)}}))):(gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_rate_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_rate_pos||jQuery(".bwg_image_rate").animate({top:jQuery(".bwg_ctrl_btn_container").height()},500):jQuery(".bwg_image_rate").animate({bottom:jQuery(".bwg_ctrl_btn_container").height()},500),gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_hit_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_hit_pos||jQuery(".bwg_image_hit").animate({top:jQuery(".bwg_ctrl_btn_container").height()},500):jQuery(".bwg_image_hit").animate({bottom:jQuery(".bwg_ctrl_btn_container").height()},500),"bottom"==gallery_box_data.lightbox_ctrl_btn_pos?(jQuery(".bwg_ctrl_btn_container").animate({bottom:0},500).removeClass("closed"),jQuery(".bwg_toggle_container").animate({bottom:jQuery(".bwg_ctrl_btn_container").height()},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+e)}})):(jQuery(".bwg_ctrl_btn_container").animate({top:0},500).removeClass("closed"),jQuery(".bwg_toggle_container").animate({top:jQuery(".bwg_ctrl_btn_container").height()},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+e)}}))),bwg_info_position(!0)});var o=window.innerHeight;jQuery(".bwg_resize-full").on(a,function(){bwg_resize_full()}),jQuery(".bwg_fullscreen").on(a,function(){jQuery(".bwg_watermark").css({display:"none"});var e,t=0;if((jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(t=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width()),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen))if(jQuery.fullscreen.isFullScreen())jQuery.fullscreen.exit(),e=o,jQuery(window).width()>gallery_box_data.image_width&&(r=gallery_box_data.image_width),window.innerHeight>gallery_box_data.image_height&&(_=gallery_box_data.image_height),gallery_box_data.open_with_fullscreen&&(r=jQuery(window).width(),_=e),jQuery("#spider_popup_wrap").on("fscreenclose",function(){jQuery("#spider_popup_wrap").css({width:r,height:_,left:"50%",top:"50%",marginLeft:-r/2,marginTop:-_/2,zIndex:1e5}),jQuery(".bwg_image_wrap").css({width:r-t}),jQuery(".bwg_image_container").css({height:_-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:r-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxWidth:r-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:_-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:r-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:_-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),bwg_resize_instagram_post(),bwg_change_watermark_container(),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").css({width:r-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({width:r-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(r-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").css({height:_-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({height:_-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(_-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:_-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").show(),jQuery(".bwg_resize-full").attr("class","bwg-icon-expand bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_maximize),jQuery(".bwg_fullscreen").attr("class","bwg-icon-arrows-out bwg_ctrl_btn bwg_fullscreen"),jQuery(".bwg_fullscreen").attr("title",bwg_objectsL10n.bwg_fullscreen),jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<window.innerHeight&&jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close")});else{jQuery("#spider_popup_wrap").fullscreen();var i=screen.width,a=screen.height;jQuery("#spider_popup_wrap").css({width:i,height:a,left:0,top:0,margin:0,zIndex:1e5}),jQuery(".bwg_image_wrap").css({width:i-t}),jQuery(".bwg_image_container").css({height:a-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:i-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxWidth:i-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:a-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:i-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:a-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),bwg_resize_instagram_post(),bwg_change_watermark_container(),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").css({width:i-("horizontal"==gallery_box_data.filmstrip_direction?t:0)},500),jQuery(".bwg_filmstrip").css({width:i-("horizontal"==gallery_box_data.filmstrip_direction?t:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(i-("horizontal"==gallery_box_data.filmstrip_direction?t:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").css({height:a-("horizontal"==gallery_box_data.filmstrip_direction)?"comment_container_width":0}),jQuery(".bwg_filmstrip").css({height:a-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(a-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:a-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").hide(),jQuery(".bwg_fullscreen").attr("class","bwg-icon-compress bwg_ctrl_btn bwg_fullscreen"),jQuery(".bwg_fullscreen").attr("title",bwg_objectsL10n.bwg_exit_fullscreen),jQuery(".spider_popup_close").attr("class","bwg_ctrl_btn spider_popup_close_fullscreen")}return!1}),jQuery(".bwg_play_pause, .bwg_popup_image").on(a,function(){jQuery(".bwg_play_pause").length&&jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&!jQuery(".bwg_comment_container").hasClass("bwg_open")?(bwg_play(gallery_box_data.data),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_pause),jQuery(".bwg_play_pause").attr("class","bwg-icon-pause bwg_ctrl_btn bwg_play_pause")):(window.clearInterval(bwg_playInterval),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_play),jQuery(".bwg_play_pause").attr("class","bwg-icon-play bwg_ctrl_btn bwg_play_pause"))}),gallery_box_data.open_with_autoplay&&(bwg_play(gallery_box_data.data),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_pause),jQuery(".bwg_play_pause").attr("class","bwg-icon-pause bwg_ctrl_btn bwg_play_pause")),gallery_box_data.open_with_fullscreen&&bwg_open_with_fullscreen(),jQuery(".bwg_popup_image").removeAttr("width"),jQuery(".bwg_popup_image").removeAttr("height"),jQuery(window).focus(function(){jQuery(".bwg_play_pause").length&&!jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&bwg_play(gallery_box_data.data)}),jQuery(window).blur(function(){event_stack=[],window.clearInterval(bwg_playInterval)});gallery_box_data.lightbox_ctrl_btn_pos;1==gallery_box_data.open_ecommerce&&setTimeout(function(){bwg_ecommerce()},400),1==gallery_box_data.open_comment&&bwg_comment()}function spider_createpopup(e,t,i,a,r,_,s,o){e=e.replace(/&#038;/g,"&"),isPopUpOpened||(isPopUpOpened=!0,spider_hasalreadyreceivedpopup(_)||spider_isunsupporteduseragent()||(bwg_overflow_initial_value=jQuery("html").css("overflow"),bwg_overflow_x_initial_value=jQuery("html").css("overflow-x"),bwg_overflow_y_initial_value=jQuery("html").css("overflow-y"),jQuery("html").attr("style","overflow:hidden !important;"),jQuery("#bwg_spider_popup_loading_"+t).show(),jQuery("#spider_popup_overlay_"+t).css({display:"block"}),jQuery.ajax({type:"GET",url:e,success:function(e){var t=jQuery('<div id="spider_popup_wrap" class="spider_popup_wrap" style=" width:'+i+"px; height:"+a+"px; margin-top:-"+a/2+"px; margin-left: -"+i/2+'px; ">'+e+"</div>").hide().appendTo("body");gallery_box_ready(),spider_showpopup(_,s,t,r,o)},beforeSend:function(){},complete:function(){}})))}function spider_showpopup(e,t,i,a,r){var _=gallery_box_data.data,s=parseInt(jQuery("#bwg_current_image_key").val());void 0!==_[s]&&(isPopUpOpened=!0,-1<_[s].filetype.indexOf("EMBED_")?bwg_first_image_load(i,r):jQuery("#spider_popup_wrap .bwg_popup_image_spun img").prop("complete")?bwg_first_image_load(i,r):jQuery("#spider_popup_wrap .bwg_popup_image_spun img").on("load error",function(){bwg_first_image_load(i,r)}),spider_receivedpopup(e,t))}function bwg_first_image_load(e,t){e.show();var i=jQuery(".bwg_ctrl_btn_container").height();"bottom"==t?jQuery(".bwg_toggle_container").css("bottom",i+"px"):"top"==t&&jQuery(".bwg_toggle_container").css("top",i+"px"),jQuery(".bwg_spider_popup_loading").hide(),1==gallery_box_data.preload_images&&bwg_preload_images(parseInt(jQuery("#bwg_current_image_key").val())),bwg_load_filmstrip(),bwg_info_height_set()}function spider_hasalreadyreceivedpopup(e){return-1<document.cookie.indexOf(e)&&delete document.cookie[document.cookie.indexOf(e)],!1}function spider_receivedpopup(e,t){var i=new Date;i.setDate(i.getDate()+t),document.cookie=e+"=true;expires="+i.toUTCString()+";path=/"}function spider_isunsupporteduseragent(){return!window.XMLHttpRequest}function spider_destroypopup(e){null!=document.getElementById("spider_popup_wrap")&&(void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&jQuery.fullscreen.isFullScreen()&&jQuery.fullscreen.exit(),"undefined"!=typeof enable_addthis&&enable_addthis&&jQuery(".at4-share-outer").hide(),setTimeout(function(){jQuery(".spider_popup_wrap").remove(),jQuery(".bwg_spider_popup_loading").css({display:"none"}),jQuery(".spider_popup_overlay").css({display:"none"}),jQuery(document).off("keydown"),!1!==bwg_overflow_initial_value&&jQuery("html").css("overflow",bwg_overflow_initial_value),!1!==bwg_overflow_x_initial_value&&jQuery("html").css("overflow-x",bwg_overflow_x_initial_value),!1!==bwg_overflow_y_initial_value&&jQuery("html").css("overflow-y",bwg_overflow_y_initial_value)},20)),isPopUpOpened=!1;var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),i=document.querySelector('meta[name="viewport"]');t&&i&&(i.content="width=device-width, initial-scale=1");var a=jQuery(document).scrollTop();bwg_objectsL10n.is_pro&&location.replace("#"),jQuery(document).scrollTop(a),void 0!==gallery_box_data.bwg_playInterval&&clearInterval(gallery_box_data.bwg_playInterval)}function get_ajax_pricelist(){var e={};return jQuery(".add_to_cart_msg").html(""),e.ajax_task="display",e.image_id=jQuery("#bwg_popup_image").attr("image_id"),jQuery("#ecommerce_ajax_loading").css("height",jQuery(".bwg_ecommerce_panel").css("height")),jQuery("#ecommerce_opacity_div").css("width",jQuery(".bwg_ecommerce_panel").css("width")),jQuery("#ecommerce_opacity_div").css("height",jQuery(".bwg_ecommerce_panel").css("height")),jQuery("#ecommerce_loading_div").css("width",jQuery(".bwg_ecommerce_panel").css("width")),jQuery("#ecommerce_loading_div").css("height",jQuery(".bwg_ecommerce_panel").css("height")),jQuery("#ecommerce_opacity_div").css("display","block"),jQuery("#ecommerce_loading_div").css("display","table-cell"),jQuery.ajax({type:"POST",url:jQuery("#bwg_ecommerce_form").attr("action"),data:e,success:function(e){jQuery(".pge_tabs li a").on("click",function(){return jQuery(".pge_tabs_container > div").hide(),jQuery(".pge_tabs li").removeClass("pge_active"),jQuery(jQuery(this).attr("href")).show(),jQuery(this).closest("li").addClass("pge_active"),jQuery("[name=type]").val(jQuery(this).attr("href").substr(1)),!1});var t=jQuery(e).find(".manual").html();jQuery(".manual").html(t);var i=jQuery(e).find(".downloads").html();jQuery(".downloads").html(i);var a=jQuery(e).find(".pge_options").html();jQuery(".pge_options").html(a);var r=jQuery(e).find(".pge_add_to_cart").html();jQuery(".pge_add_to_cart").html(r)},beforeSend:function(){},complete:function(){jQuery("#ecommerce_opacity_div").css("display","none"),jQuery("#ecommerce_loading_div").css("display","none")}}),!1}function spider_ajax_save(e){var t={};return t.bwg_name=jQuery("#bwg_name").val(),t.bwg_comment=jQuery("#bwg_comment").val(),t.bwg_email=jQuery("#bwg_email").val(),t.bwg_captcha_input=jQuery("#bwg_captcha_input").val(),t.ajax_task=jQuery("#ajax_task").val(),t.image_id=jQuery("#image_id").val(),t.comment_id=jQuery("#comment_id").val(),jQuery("#ajax_loading").css("height",jQuery(".bwg_comments").css("height")),jQuery("#opacity_div").css("width",jQuery(".bwg_comments").css("width")),jQuery("#opacity_div").css("height",jQuery(".bwg_comments").css("height")),jQuery("#loading_div").css("width",jQuery(".bwg_comments").css("width")),jQuery("#loading_div").css("height",jQuery(".bwg_comments").css("height")),document.getElementById("opacity_div").style.display="",document.getElementById("loading_div").style.display="table-cell",jQuery.ajax({type:"POST",url:jQuery("#"+e).attr("action"),data:t,success:function(e){var t=jQuery(e).find(".bwg_comments").html();jQuery(".bwg_comments").html(t)},beforeSend:function(){},complete:function(){document.getElementById("opacity_div").style.display="none",document.getElementById("loading_div").style.display="none",jQuery(".bwg_comments").mCustomScrollbar({scrollInertia:150,advanced:{updateOnContentResize:!0}}),jQuery(".bwg_comments_close_btn").click(bwg_comment),bwg_captcha_refresh("bwg_captcha")}}),!1}function spider_rate_ajax_save(i){var e={};return e.image_id=jQuery("#"+i+" input[name='image_id']").val(),e.rate=jQuery("#"+i+" input[name='score']").val(),e.ajax_task=jQuery("#rate_ajax_task").val(),jQuery.ajax({type:"POST",url:jQuery("#"+i).attr("action"),data:e,success:function(e){var t=jQuery(e).find("#"+i).html();jQuery("#"+i).html(t)},beforeSend:function(){},complete:function(){}})}function spider_set_input_value(e,t){document.getElementById(e)&&(document.getElementById(e).value=t)}function spider_form_submit(e,t){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function spider_check_required(e,t){return""==jQuery("#"+e).val()&&(alert(t+" "+bwg_objectsL10n.bwg_field_required),jQuery("#"+e).attr("style","border-color: #FF0000;"),jQuery("#"+e).focus(),!0)}function comment_check_privacy_policy(){var e=jQuery("#bwg_submit");e.removeClass("bwg-submit-disabled"),e.removeAttr("disabled"),jQuery("#bwg_comment_privacy_policy").is(":checked")||(e.addClass("bwg-submit-disabled"),e.attr("disabled","disabled"))}function spider_check_email(e){if(""!=jQuery("#"+e).val())return-1==jQuery("#"+e).val().replace(/^\s+|\s+$/g,"").search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)&&(alert(bwg_objectsL10n.bwg_mail_validation),!0)}function bwg_captcha_refresh(e){document.getElementById(e+"_img")&&document.getElementById(e+"_input")&&(srcArr=document.getElementById(e+"_img").src.split("&r="),document.getElementById(e+"_img").src=srcArr[0]+"&r="+Math.floor(100*Math.random()),document.getElementById(e+"_img").style.display="inline-block",document.getElementById(e+"_input").value="")}function bwg_play_instagram_video(e,t){jQuery(e).parent().find("video").each(function(){jQuery(this).get(0).paused?(jQuery(this).get(0).play(),jQuery(e).children().hide()):(jQuery(this).get(0).pause(),jQuery(e).children().show())})}function bwg_add_comment(){var t=jQuery("#bwg_comment_form"),e=t.attr("action"),i={ajax_task:"add_comment"};return i.comment_name=t.find("#bwg_name").val(),i.comment_email=t.find("#bwg_email").val(),i.comment_text=t.find("#bwg_comment").val(),i.comment_captcha=t.find("#bwg_captcha_input").val(),i.privacy_policy=t.find("#bwg_comment_privacy_policy").is(":checked")?1:0,i.comment_image_id=jQuery("#bwg_popup_image").attr("image_id"),i.comment_moderation=t.find("#bwg_comment_moderation").val(),jQuery(".bwg_spider_ajax_loading").hide(),jQuery.ajax({url:e,type:"POST",dataType:"json",data:i,success:function(e){jQuery(".bwg_comment_error").text(""),1==e.error?jQuery.each(e.error_messages,function(e,t){t&&jQuery(".bwg_comment_"+e+"_error").text(t)}):(t.find("#bwg_comment").val(""),jQuery(".bwg_comment_waiting_message").hide(),0==e.published&&jQuery(".bwg_comment_waiting_message").show(),""!=e.html_comments_block&&jQuery("#bwg_added_comments").html(e.html_comments_block).show())},beforeSend:function(){jQuery(".bwg_spider_ajax_loading").show()},complete:function(){0<t.find("#bwg_comment_privacy_policy").length&&(t.find("#bwg_comment_privacy_policy").prop("checked",!1),comment_check_privacy_policy()),bwg_captcha_refresh("bwg_captcha"),jQuery(".bwg_spider_ajax_loading").hide()},error:function(){}}),!1}function bwg_remove_comment(t){var e=jQuery("#bwg_comment_form").attr("action"),i={ajax_task:"delete_comment"};return i.id_image=jQuery("#bwg_popup_image").attr("image_id"),i.id_comment=t,jQuery.ajax({url:e,type:"POST",dataType:"json",data:i,success:function(e){0==e.error&&jQuery("#bwg_comment_block_"+t).fadeOut("slow").remove()},beforeSend:function(){},complete:function(){},error:function(){}}),!1}function bwg_gallery_box(e,t,i,a){jQuery(".bwg-validate").each(function(){jQuery(this).on("keypress change",function(){jQuery(this).parent().next().find(".bwg_comment_error").html("")})}),void 0===i&&(i=!1);var r,_=t.data("bwg");r=t.find(".bwg-container").data("lightbox-url")?t.find(".bwg-container").data("lightbox-url"):t.data("lightbox-url");var s=t.find(".cur_gal_id").val(),o=jQuery("#bwg_tag_id_"+s).val();o=o||0;var l=1==i?"&open_ecommerce=1":"",n=jQuery("#bwg_search_input_"+_).val(),g=jQuery("#bwg_order_"+_).val()?"&filtersortby="+jQuery("#bwg_order_"+_).val():"";n=n||"",void 0!==a&&(r+="&gallery_id="+a);var w="",b=jQuery("#bwg_blog_style_share_buttons_"+e).attr("data-open-comment");void 0!==b&&!1!==b&&(w="&open_comment=1"),spider_createpopup(r+"&bwg_random_seed="+jQuery("#bwg_random_seed_"+_).val()+"&image_id="+e+"&filter_tag="+o+l+w+"&filter_search_name="+n+g,_,t.data("popup-width"),t.data("popup-height"),1,"testpopup",5,t.data("buttons-position"))}function bwg_change_image_lightbox(e,a,r,t){if(jQuery("#bwg_rate_form input[name='image_id']").val(r[a].id),bwg_current_key=gallery_box_data.bwg_current_key,jQuery(".bwg_image_info").css("height","auto"),setTimeout(function(){bwg_info_height_set(),jQuery(".bwg_image_description").height()>jQuery(".bwg_image_info").height()&&jQuery(".mCSB_container").hasClass("mCS_no_scrollbar")&&jQuery(".bwg_image_info").mCustomScrollbar("destroy"),jQuery(".bwg_image_info").hasClass("mCustomScrollbar")||void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".bwg_image_info").mCustomScrollbar({scrollInertia:150,advanced:{updateOnContentResize:!0}})},200),jQuery("#spider_popup_left").show(),jQuery("#spider_popup_right").show(),jQuery(".bwg_image_info").hide(),0==gallery_box_data.enable_loop&&(a==parseInt(r.length)-1&&jQuery("#spider_popup_right").hide(),0==a&&jQuery("#spider_popup_left").hide()),1==gallery_box_data.ecommerceACtive&&1==gallery_box_data.enable_image_ecommerce)if(0==gallery_box_data.data[a].pricelist)jQuery(".bwg_ecommerce").hide();else{jQuery(".bwg_ecommerce").show(),jQuery(".pge_tabs li").hide(),jQuery("#downloads").hide(),jQuery("#manual").hide();var i=gallery_box_data.data[a].pricelist_sections.split(",");if(i)if(jQuery("#"+i[0]).show(),jQuery("[name=type]").val(i[0]),1<i.length)for(jQuery(".pge_tabs").show(),k=0;k<i.length;k++)jQuery("#"+i[k]+"_li").show();else jQuery(".pge_tabs").hide();else jQuery("[name=type]").val("")}if(jQuery("#bwg_image_container").find("iframe").each(function(){jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*"),jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }',"*"),jQuery(this)[0].contentWindow.postMessage("pause","*")}),jQuery("#bwg_image_container").find("video").each(function(){jQuery(this).trigger("pause")}),void 0===r&&(r=gallery_box_data.data),void 0!==r[a]&&void 0!==r[e]){if(jQuery(".bwg_play_pause").length&&!jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&bwg_play(r),t||jQuery("#bwg_current_image_key").val(a),gallery_box_data.bwg_trans_in_progress)return void gallery_box_data.event_stack.push(e+"-"+a);var _="right";if(bwg_current_key>a)_="left";else if(bwg_current_key==a)return;jQuery(".bwg_image_count").html(r[a].number),jQuery(".bwg_watermark").css({display:"none"}),"width"==gallery_box_data.width_or_height?bwg_current_filmstrip_pos=a*(jQuery(".bwg_filmstrip_thumbnail").width()+2+2*gallery_box_data.lightbox_filmstrip_thumb_border_width):"height"==gallery_box_data.width_or_height&&(bwg_current_filmstrip_pos=a*(jQuery(".bwg_filmstrip_thumbnail").height()+2+2*gallery_box_data.lightbox_filmstrip_thumb_border_width)),gallery_box_data.bwg_current_key=a,bwg_objectsL10n.is_pro&&(location.replace("#bwg"+gallery_box_data.gallery_id+"/"+r[a].id),history.replaceState(void 0,void 0,"#bwg"+gallery_box_data.gallery_id+"/"+r[a].id)),jQuery("#bwg_rate_form input[name='image_id']").val(r[a].id),gallery_box_data.popup_enable_rate&&(jQuery("#bwg_star").attr("data-score",r[a].avg_rating),jQuery("#bwg_star").removeAttr("title"),r[a].cur_key=a,bwg_rating(r[a].rate,r[a].rate_count,r[a].avg_rating,a)),spider_set_input_value("rate_ajax_task","save_hit_count"),spider_rate_ajax_save("bwg_rate_form"),jQuery(".bwg_image_hits span").html(++r[a].hit_count),jQuery("#bwg_popup_image").attr("image_id",r[a].id),jQuery(".bwg_image_title").html(jQuery("<span />").html(r[a].alt).text()),jQuery(".bwg_image_description").html(jQuery("<span />").html(r[a].description).text()),jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+a).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active"),jQuery(".bwg_image_info").css("opacity",1),""==r[a].alt.trim()&&""==r[a].description.trim()&&jQuery(".bwg_image_info").css("opacity",0),"none"!=jQuery(".bwg_image_info_container1").css("display")?jQuery(".bwg_image_info_container1").css("display","table-cell"):jQuery(".bwg_image_info_container1").css("display","none"),"none"!=jQuery(".bwg_image_rate_container1").css("display")?jQuery(".bwg_image_rate_container1").css("display","table-cell"):jQuery(".bwg_image_rate_container1").css("display","none");var s=2==jQuery(".bwg_popup_image_spun").css("zIndex")?".bwg_popup_image_spun":".bwg_popup_image_second_spun",o=".bwg_popup_image_second_spun"==s?".bwg_popup_image_spun":".bwg_popup_image_second_spun",l=-1<r[a].filetype.indexOf("EMBED_"),n=-1<r[a].filetype.indexOf("INSTAGRAM_POST"),g=-1<r[a].filetype.indexOf("INSTAGRAM_VIDEO"),w=-1!==jQuery.inArray(r[a].filetype,["EMBED_OEMBED_YOUTUBE_VIDEO","EMBED_OEMBED_VIMEO_VIDEO","EMBED_OEMBED_FACEBOOK_VIDEO","EMBED_OEMBED_DAILYMOTION_VIDEO"]),b=jQuery(s).height(),u=jQuery(s).width(),d='<span class="bwg_popup_image_spun1" style="display: '+(l?"block":"table")+'; width: inherit; height: inherit;"><span class="bwg_popup_image_spun2" style="display:'+(l?"block":"table-cell")+'; vertical-align: middle;text-align: center;height: 100%;">';if(l){if(jQuery("#bwg_download").addClass("bwg-hidden"),d+='<span class="bwg_popup_embed bwg_popup_watermark" style="display: '+(w?"block":"table")+'; table-layout: fixed; height: 100%;">'+(g?'<div class="bwg_inst_play_btn_cont" onclick="bwg_play_instagram_video(this)" ><div class="bwg_inst_play"></div></div>':" "),n){var h=0,m=0;b<u+88?h=(m=b)-88:m=(h=u)+88,d+=spider_display_embed(r[a].filetype,r[a].image_url,r[a].filename,{class:"bwg_embed_frame","data-width":r[a].image_width,"data-height":r[a].image_height,frameborder:"0",allowfullscreen:"allowfullscreen",style:"width:"+h+"px; height:"+m+"px; vertical-align:middle; display:inline-block; position:relative;"})}else d+=spider_display_embed(r[a].filetype,r[a].image_url,r[a].filename,{class:"bwg_embed_frame",frameborder:"0",allowfullscreen:"allowfullscreen",style:"display:"+(w?"block":"table-cell")+"; width:inherit; height:inherit; vertical-align:middle;"});d+="</span>"}else jQuery(".bwg-loading").removeClass("bwg-hidden"),jQuery("#bwg_download").removeClass("bwg-hidden"),d+='<img style="max-height: '+b+"px; max-width: "+u+'px;" class="bwg_popup_image bwg_popup_watermark" src="'+gallery_box_data.site_url+jQuery("<span />").html(decodeURIComponent(r[a].image_url)).text()+'" alt="'+r[a].alt+'" />';function p(){gallery_box_data.preload_images&&bwg_preload_images(a),window["bwg_"+gallery_box_data.bwg_image_effect](s,o,_),jQuery(s).find(".bwg_fb_video").each(function(){jQuery(this).attr("src","")}),l?jQuery("#bwg_fullsize_image").attr("href",decodeURIComponent(r[a].image_url)):(jQuery("#bwg_fullsize_image").attr("href",gallery_box_data.site_url+decodeURIComponent(r[a].image_url)),jQuery("#bwg_download").attr("href",gallery_box_data.site_url+decodeURIComponent(r[a].thumb_url).replace("/thumb/","/.original/")));var e=decodeURIComponent(r[a].image_url).split("/");jQuery("#bwg_download").attr("download",e[e.length-1].replace(/\?bwg=(\d+)$/,""));var t=encodeURIComponent(gallery_box_data.bwg_share_url)+"="+r[a].id+encodeURIComponent("#bwg"+gallery_box_data.gallery_id+"/")+r[a].id;if(l)var i=encodeURIComponent(r[a].thumb_url);else i=gallery_box_data.bwg_share_image_url+encodeURIComponent(encodeURIComponent(r[a].pure_image_url));i=i.replace(/%252F|%25252F/g,"%2F"),void 0!==addthis_share&&(addthis_share.url=t),jQuery("#bwg_facebook_a").attr("href","https://www.facebook.com/sharer/sharer.php?u="+t),jQuery("#bwg_twitter_a").attr("href","https://twitter.com/share?url="+t),jQuery("#bwg_pinterest_a").attr("href","http://pinterest.com/pin/create/button/?s=100&url="+t+"&media="+i+"&description="+r[a].alt+"%0A"+r[a].description),jQuery("#bwg_tumblr_a").attr("href","https://www.tumblr.com/share/photo?source="+i+"&caption="+r[a].alt+"&clickthru="+t),jQuery(".bwg_comment_container").hasClass("bwg_open")&&(jQuery(".bwg_comments .mCSB_container").css("top","0"),jQuery("#bwg_added_comments").show(),spider_set_input_value("ajax_task","display"),spider_set_input_value("image_id",jQuery("#bwg_popup_image").attr("image_id")),spider_ajax_save("bwg_comment_form")),jQuery(".bwg_ecommerce_container").hasClass("bwg_open")&&(0==r[a].pricelist?(bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")),bwg_animate_image_box_for_hide_sidebar(),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_close"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_show_ecommerce),jQuery(".spider_popup_close_fullscreen").show()):get_ajax_pricelist()),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".bwg_comments").mCustomScrollbar({advanced:{updateOnContentResize:!0}}),jQuery(".bwg_comments .mCSB_scrollTools").hide(),gallery_box_data.enable_image_filmstrip&&bwg_move_filmstrip(),bwg_resize_instagram_post()}if(d+="</span></span>",jQuery(o).html(d),jQuery(o).find("img").on("load error",function(){jQuery(".bwg-loading").addClass("bwg-hidden")}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:u,maxHeight:b,height:"auto"}),l)p();else jQuery(o).find("img").one("load",function(){p()}).each(function(){this.complete&&jQuery(this).load()})}}function bwg_preload_images_lightbox(e){for(var t=gallery_box_data.data,i=t.length,a=0==gallery_box_data.preload_images_count||gallery_box_data.preload_images_count>=i?i:gallery_box_data.preload_images_count,r=0,_=1;r<a;_++){var s=1;do{var o=(e+_*s+i)%i;if(void 0!==t[o])-1<t[o].filetype.indexOf("EMBED_")||jQuery("<img/>").attr("src",gallery_box_data.site_url+jQuery("<span />").html(decodeURIComponent(t[o].image_url)).text());s*=-1,r++}while(1!=s)}}function bwg_popup_sidebar_open(e){var t=gallery_box_data.lightbox_comment_width,i=gallery_box_data.lightbox_comment_pos;if(t>jQuery(window).width()){if(t=jQuery(window).width(),e.css({width:t}),jQuery(".spider_popup_close_fullscreen").hide(),jQuery(".spider_popup_close").hide(),jQuery(".bwg_ctrl_btn").hasClass("bwg-icon-pause")){var a=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase());jQuery(".bwg_play_pause").trigger(a?"touchend":"click")}}else jQuery(".spider_popup_close_fullscreen").show();"left"==i?e.animate({left:0},100):e.animate({right:0},100)}function bwg_comment(){if(jQuery(".bwg_watermark").css({display:"none"}),jQuery(".bwg_ecommerce_wrap").css("z-index","-1"),jQuery(".bwg_comment_wrap").css("z-index","25"),jQuery(".bwg_ecommerce_container").hasClass("bwg_open")&&(bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_close"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_show_ecommerce)),jQuery(".bwg_comment_container").hasClass("bwg_open"))"1"==jQuery(".bwg_comment_container").attr("data-play-status")&&jQuery(".bwg_ctrl_btn.bwg_play_pause").removeClass("bwg-icon-play").addClass("bwg-icon-pause").attr("title",bwg_objectsL10n.bwg_pause),bwg_popup_sidebar_close(jQuery(".bwg_comment_container")),bwg_animate_image_box_for_hide_sidebar(),jQuery(".bwg_comment_wrap").css("z-index","-1"),jQuery(".bwg_comment_container").attr("class","bwg_comment_container bwg_close"),jQuery(".bwg_comment").attr("title",bwg_objectsL10n.bwg_show_comments),jQuery(".spider_popup_close_fullscreen").show();else{jQuery(".bwg_play_pause").hasClass("bwg-icon-pause")?jQuery(".bwg_comment_container").attr("data-play-status","1"):jQuery(".bwg_comment_container").attr("data-play-status","0"),jQuery(".bwg_ctrl_btn.bwg_play_pause").removeClass("bwg-icon-pause").addClass("bwg-icon-play").attr("title",bwg_objectsL10n.bwg_play),bwg_popup_sidebar_open(jQuery(".bwg_comment_container")),bwg_animate_image_box_for_show_sidebar(),jQuery(".bwg_comment_container").attr("class","bwg_comment_container bwg_open"),jQuery(".bwg_comment").attr("title",bwg_objectsL10n.bwg_hide_comments);var e=parseInt(jQuery("#bwg_current_image_key").val());void 0!==gallery_box_data.current_image_key&&0!=gallery_box_data.data[e].comment_count&&(jQuery("#bwg_added_comments").show(),spider_set_input_value("ajax_task","display"),spider_set_input_value("image_id",jQuery("#bwg_popup_image").attr("image_id")),spider_ajax_save("bwg_comment_form"))}jQuery(".bwg_comments").mCustomScrollbar("update",{scrollInertia:150,advanced:{updateOnContentResize:!0}})}function bwg_ecommerce(){jQuery(".bwg_watermark").css({display:"none"}),jQuery(".bwg_ecommerce_wrap").css("z-index","25"),jQuery(".bwg_comment_wrap").css("z-index","-1"),jQuery(".bwg_comment_container").hasClass("bwg_open")&&(bwg_popup_sidebar_close(jQuery(".bwg_comment_container")),jQuery(".bwg_comment_container").attr("class","bwg_comment_container bwg_close"),jQuery(".bwg_comment").attr("title",bwg_objectsL10n.bwg_show_comments)),jQuery(".bwg_ecommerce_container").hasClass("bwg_open")?(bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")),bwg_animate_image_box_for_hide_sidebar(),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_close"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_show_ecommerce)):(bwg_popup_sidebar_open(jQuery(".bwg_ecommerce_container")),bwg_animate_image_box_for_show_sidebar(),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_open"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_hide_ecommerce),get_ajax_pricelist())}function bwg_popup_sidebar_close(e){var t=parseInt(e.css("borderRightWidth"));t||(t=0),"left"==lightbox_comment_pos?e.animate({left:-e.width()-t},100):"right"==lightbox_comment_pos&&e.animate({right:-e.width()-t},100)}function bwg_animate_image_box_for_hide_sidebar(){"left"==lightbox_comment_pos?jQuery(".bwg_image_wrap").animate({left:0,width:jQuery("#spider_popup_wrap").width()},100):"right"==lightbox_comment_pos&&jQuery(".bwg_image_wrap").animate({right:0,width:jQuery("#spider_popup_wrap").width()},100),jQuery(".bwg_image_container").animate({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},100),jQuery(".bwg_popup_image").animate({maxWidth:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed").animate({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").animate({width:jQuery(".spider_popup_wrap").width()},100),jQuery(".bwg_filmstrip").animate({width:jQuery(".spider_popup_wrap").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},100)):"height"==gallery_box_data.width_or_height&&(jQuery(".bwg_filmstrip_container").animate({height:jQuery(".spider_popup_wrap").width()},100),jQuery(".bwg_filmstrip").animate({height:jQuery(".spider_popup_wrap").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},100)),bwg_set_filmstrip_pos(jQuery(".spider_popup_wrap").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),jQuery(".spider_popup_close_fullscreen").show(100)}function bwg_animate_image_box_for_show_sidebar(){var e=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width();"left"==lightbox_comment_pos?jQuery(".bwg_image_wrap").animate({left:e,width:jQuery("#spider_popup_wrap").width()-e},100):"right"==lightbox_comment_pos&&jQuery(".bwg_image_wrap").animate({right:e,width:jQuery("#spider_popup_wrap").width()-e},100),jQuery(".bwg_image_container").animate({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e},100),jQuery(".bwg_popup_image").animate({maxWidth:jQuery("#spider_popup_wrap").width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({maxWidth:jQuery("#spider_popup_wrap").width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height&&(jQuery(".bwg_filmstrip_container").css({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?0:e)}),jQuery(".bwg_filmstrip").animate({width:jQuery(".bwg_filmstrip_container").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},100),bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip_container").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data))}function bwg_reset_zoom(){var e=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),t=document.querySelector('meta[name="viewport"]');e&&t&&(t.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0")}function bwg_open_with_fullscreen(){jQuery(".bwg_watermark").css({display:"none"});var e=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(e=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width()),bwg_popup_current_width=jQuery(window).width(),bwg_popup_current_height=window.innerHeight,jQuery("#spider_popup_wrap").css({width:jQuery(window).width(),height:window.innerHeight,left:0,top:0,margin:0,zIndex:100002}),jQuery(".bwg_image_wrap").css({width:jQuery(window).width()-e}),jQuery(".bwg_image_container").css({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)}),jQuery(".bwg_popup_image").css({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_video").css({width:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").css({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").css({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)),jQuery(".bwg_resize-full").attr("class","bwg-icon-compress bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_restore),jQuery(".spider_popup_close").attr("class","bwg_ctrl_btn spider_popup_close_fullscreen")}function bwg_resize_full(){jQuery(".bwg_watermark").css({display:"none"});var e=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(e=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width()),jQuery(".bwg_resize-full").hasClass("bwg-icon-compress")?(jQuery(window).width()>gallery_box_data.image_width&&(bwg_popup_current_width=gallery_box_data.image_width),window.innerHeight>gallery_box_data.image_height&&(bwg_popup_current_height=gallery_box_data.image_height),jQuery("#spider_popup_wrap").animate({width:bwg_popup_current_width,height:bwg_popup_current_height,left:"50%",top:"50%",marginLeft:-bwg_popup_current_width/2,marginTop:-bwg_popup_current_height/2,zIndex:100002},500),jQuery(".bwg_image_wrap").animate({width:bwg_popup_current_width-e},500),jQuery(".bwg_image_container").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},500),jQuery(".bwg_popup_image").animate({maxWidth:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_change_watermark_container(),jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<window.innerHeight&&jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close")}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({maxWidth:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container(),jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<window.innerHeight&&jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close")}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").animate({width:bwg_popup_current_width-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({width:bwg_popup_current_width-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(bwg_popup_current_width-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(bwg_popup_current_height-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:bwg_popup_current_height-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").attr("class","bwg-icon-expand bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_maximize),setTimeout(function(){bwg_info_height_set()},500)):(bwg_popup_current_width=jQuery(window).width(),bwg_popup_current_height=window.innerHeight,jQuery("#spider_popup_wrap").animate({width:jQuery(window).width(),height:window.innerHeight,left:0,top:0,margin:0,zIndex:100002},500),jQuery(".bwg_image_wrap").animate({width:jQuery(window).width()-e},500),jQuery(".bwg_image_container").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},500),jQuery(".bwg_popup_image").animate({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").animate({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").animate({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:window.innerHeight-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").attr("class","bwg-icon-compress bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_restore),jQuery(".spider_popup_close").attr("class","bwg_ctrl_btn spider_popup_close_fullscreen")),setTimeout(function(){bwg_info_height_set()},500)}function bwg_popup_resize_lightbox(){void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&(jQuery.fullscreen.isFullScreen()||(jQuery(".bwg_resize-full").show(),jQuery(".bwg_resize-full").hasClass("bwg-icon-compress")||jQuery(".bwg_resize-full").attr("class","bwg-icon-expand bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_maximize),jQuery(".bwg_fullscreen").attr("class","bwg-icon-arrows-out bwg_ctrl_btn bwg_fullscreen"),jQuery(".bwg_fullscreen").attr("title",bwg_objectsL10n.fullscreen)));var e=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(e=gallery_box_data.lightbox_comment_width),e>jQuery(window).width()?(e=jQuery(window).width(),jQuery(".bwg_comment_container").css({width:e}),jQuery(".bwg_ecommerce_container").css({width:e}),jQuery(".spider_popup_close_fullscreen").hide()):jQuery(".spider_popup_close_fullscreen").show(),window.innerHeight>gallery_box_data.image_height&&1!=gallery_box_data.open_with_fullscreen&&!jQuery(".bwg_resize-full").hasClass("bwg-icon-compress")?(jQuery("#spider_popup_wrap").css({height:gallery_box_data.image_height,top:"50%",marginTop:-gallery_box_data.image_height/2,zIndex:100002}),jQuery(".bwg_image_container").css({height:gallery_box_data.image_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxHeight:gallery_box_data.image_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxHeight:gallery_box_data.image_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),"vertical"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({height:gallery_box_data.image_height}),jQuery(".bwg_filmstrip").css({height:gallery_box_data.image_height-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_height=gallery_box_data.image_height):(jQuery("#spider_popup_wrap").css({height:window.innerHeight,top:0,marginTop:0,zIndex:100002}),jQuery(".bwg_image_container").css({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),"vertical"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({height:window.innerHeight}),jQuery(".bwg_filmstrip").css({height:window.innerHeight-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_height=window.innerHeight),jQuery(window).width()>=gallery_box_data.image_width&&1!=gallery_box_data.open_with_fullscreen?(jQuery("#spider_popup_wrap").css({width:gallery_box_data.image_width,left:"50%",marginLeft:-gallery_box_data.image_width/2,zIndex:100002}),jQuery(".bwg_image_wrap").css({width:gallery_box_data.image_width-e}),jQuery(".bwg_image_container").css({width:gallery_box_data.image_width-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxWidth:gallery_box_data.image_width-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:gallery_box_data.image_width-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),"horizontal"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({width:gallery_box_data.image_width-e}),jQuery(".bwg_filmstrip").css({width:gallery_box_data.image_width-e-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_width=gallery_box_data.image_width):(jQuery("#spider_popup_wrap").css({width:jQuery(window).width(),left:0,marginLeft:0,zIndex:100002}),jQuery(".bwg_image_wrap").css({width:jQuery(window).width()-e}),jQuery(".bwg_image_container").css({width:jQuery(window).width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_popup_image").css({maxWidth:jQuery(window).width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:jQuery(window).width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),"horizontal"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({width:jQuery(window).width()-e}),jQuery(".bwg_filmstrip").css({width:jQuery(window).width()-e-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_width=jQuery(window).width()),bwg_resize_instagram_post(),bwg_change_watermark_container(),window.innerHeight>gallery_box_data.image_height-2*gallery_box_data.lightbox_close_btn_top&&jQuery(window).width()>=gallery_box_data.image_width-2*gallery_box_data.lightbox_close_btn_right&&1!=gallery_box_data.open_with_fullscreen?jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close"):jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<jQuery(window).height()&&jQuery(".spider_popup_close").attr("class","bwg_ctrl_btn spider_popup_close_fullscreen");var t=jQuery(".bwg_ctrl_btn_container").height();"bottom"==gallery_box_data.lightbox_ctrl_btn_pos&&jQuery(".bwg_toggle_container i").hasClass("bwg-icon-caret-down")&&jQuery(".bwg_toggle_container").css("bottom",t+"px"),"top"==gallery_box_data.lightbox_ctrl_btn_pos&&jQuery(".bwg_toggle_container i").hasClass("bwg-icon-caret-up")&&jQuery(".bwg_toggle_container").css("top",t+"px")}function bwg_rating(e,t,i,a){lightbox_rate_stars_count=gallery_box_data.lightbox_rate_stars_count,lightbox_rate_size=gallery_box_data.lightbox_rate_size,lightbox_rate_icon=gallery_box_data.lightbox_rate_icon;var r="Not rated yet.";0!=i&&""!=i&&(r=parseFloat(i).toFixed(1)+"\n Votes: "+t),void 0!==jQuery().raty&&jQuery.isFunction(jQuery().raty)&&jQuery("#bwg_star").raty({score:function(){return jQuery(this).attr("data-score")},starType:"i",number:lightbox_rate_stars_count,size:lightbox_rate_size,readOnly:function(){return!!e},noRatedMsg:"Not rated yet.",click:function(t,e){jQuery("#bwg_star").hide(),jQuery("#bwg_rated").show(),spider_set_input_value("rate_ajax_task","save_rate"),jQuery.when(spider_rate_ajax_save("bwg_rate_form")).then(function(){gallery_box_data.data[a].rate=t,++gallery_box_data.data[a].rate_count;var e=parseFloat(jQuery("#bwg_star").attr("data-score"));gallery_box_data.data[a].avg_rating=e?((e+t)/2).toFixed(1):t.toFixed(1),bwg_rating(gallery_box_data.data[a].rate,gallery_box_data.data[a].rate_count,gallery_box_data.data[a].avg_rating,gallery_box_data.current_image_key)})},starHalf:"bwg-icon-"+lightbox_rate_icon+("star"==lightbox_rate_icon?"-half":"")+"-o",starOff:"bwg-icon-"+lightbox_rate_icon+"-o",starOn:"bwg-icon-"+lightbox_rate_icon,cancelOff:"bwg-icon-minus-square-o",cancelOn:"bwg-icon-minus-square-o",cancel:!1,cancelHint:"Cancel your rating.",hints:[r,r,r,r,r],alreadyRatedMsg:parseFloat(i).toFixed(1)+"\nYou have already rated.\nVotes: "+t})}function changeDownloadsTotal(e){var t=0;0==jQuery("[name=option_show_digital_items_count]").val()?jQuery("[name=selected_download_item]:checked").each(function(){t+=Number(jQuery(this).closest("tr").attr("data-price"))}):jQuery(".digital_image_count").each(function(){0!=Number(jQuery(this).val())&&(t+=Number(jQuery(this).closest("tr").attr("data-price"))*Number(jQuery(this).val()))}),t=t.toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),jQuery(".product_downloads_price").html(t)}function changeMenualTotal(e){Number(jQuery(e).val())<=0&&jQuery(e).val("1");var t=Number(jQuery(e).val()),i=Number(jQuery(".product_manual_price").attr("data-actual-price"));i=(i*=t).toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),jQuery(".product_manual_price").html(i)}function onSelectableParametersChange(e){var t=0,i=gallery_box_data.data[jQuery("#bwg_current_image_key").val()].pricelist_manual_price?gallery_box_data.data[jQuery("#bwg_current_image_key").val()].pricelist_manual_price:"0";i=parseFloat(i.replace(",",""));var a=jQuery(e).closest(".image_selected_parameter").attr("data-parameter-type"),r=jQuery(e).val();r=r.split("*");var _=parseFloat(r[1]),s=r[0],o=Number(jQuery(e).closest(".image_selected_parameter").find(".already_selected_values").val());if("4"==a||"5"==a){var l=parseFloat(s+_);jQuery(e).closest(".image_selected_parameter").find(".already_selected_values").val(l)}else if("6"==a){if(0==jQuery(e).is(":checked"))var n=o-parseFloat(s+_);else n=o+parseFloat(s+_);jQuery(e).closest(".image_selected_parameter").find(".already_selected_values").val(n)}jQuery(".already_selected_values").each(function(){t+=Number(jQuery(this).val())}),i+=t,jQuery(".product_manual_price").attr("data-actual-price",i),i=(i*=Number(jQuery(".image_count").val())<=0?1:Number(jQuery(".image_count").val())).toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),jQuery(".product_manual_price").html(i)}function onBtnClickAddToCart(){var e=jQuery("[name=type]").val();if(""!=e){var t={};if("manual"==e){var i=jQuery(".image_count").val(),a={};jQuery(".manual").find(".image_selected_parameter").each(function(){var e=jQuery(this).attr("data-parameter-id"),t="";switch(jQuery(this).attr("data-parameter-type")){case"2":t=jQuery(this).find("input").val();break;case"3":t=jQuery(this).find("textarea").val();break;case"4":t=jQuery(this).find("select :selected").val();break;case"5":t=jQuery(this).find("[type=radio]:checked").val();break;case"6":var i=[];jQuery(this).find("[type=checkbox]:checked").each(function(){i.push(jQuery(this).val())}),t=i}a[e]=t}),t.count=i,t.parameters=a,t.price=jQuery(".product_manual_price").attr("data-price").replace(",","")}else{var r=[];if(0==jQuery("[name=option_show_digital_items_count]").val()){if(0==jQuery("[name=selected_download_item]:checked").length)return void jQuery(".add_to_cart_msg").html("You must select at least one item.");jQuery("[name=selected_download_item]:checked").each(function(){var e={};e.id=jQuery(this).val(),e.count=1,e.price=jQuery(this).closest("tr").attr("data-price"),r.push(e)})}else jQuery(".digital_image_count").each(function(){var e={};0<jQuery(this).val()&&(e.id=jQuery(this).closest("tr").attr("data-id"),e.price=jQuery(this).closest("tr").attr("data-price"),e.count=jQuery(this).val(),r.push(e))});if(0==(t.downloadItems=r).length)return void jQuery(".add_to_cart_msg").html("Please select at least one item")}var _=jQuery("#ajax_url").val(),s={action:"add_cart",task:"add_cart",controller:"checkout",image_id:jQuery("#bwg_popup_image").attr("image_id"),type:e,data:JSON.stringify(t)};jQuery.ajax({type:"POST",url:_,data:s,success:function(e){responseData=JSON.parse(e),jQuery(".add_to_cart_msg").html(responseData.msg),jQuery(".products_in_cart").html(responseData.products_in_cart),1==responseData.redirect&&(window.location.href="<?php echo get_permalink($options->checkout_page);?>")},beforeSend:function(){},complete:function(){}})}else jQuery(".add_to_cart_msg").html("Please select Prints and products or Downloads")}function onBtnViewCart(){var e=jQuery("[name=option_checkout_page]").val();jQuery("#bwg_ecommerce_form").attr("action",e),jQuery("#bwg_ecommerce_form").submit()}function bwg_load_visible_images(e,t,i){0<=e-t&&(startPoint=e-t),i<e+t&&(endPoint=i);for(var a=startPoint;a<=endPoint;a++){var r=jQuery("#bwg_filmstrip_thumbnail_"+a+" img");r.removeClass("bwg-hidden"),r.attr("src",r.data("url"))}}function bwg_load_filmstrip(){for(var e=1;e<=total_thumbnail_count;e++){var t;if(leftIndex=startPoint-e,rightIndex=endPoint+e,rightIndex<total_thumbnail_count)(t=jQuery("#bwg_filmstrip_thumbnail_"+rightIndex+" img")).removeClass("bwg-hidden"),t.attr("src",t.data("url"));if(0<=leftIndex)(t=jQuery("#bwg_filmstrip_thumbnail_"+leftIndex+" img")).removeClass("bwg-hidden"),t.attr("src",t.data("url"))}jQuery(".bwg_filmstrip_thumbnail").each(function(){var e=jQuery(this).find("img");void 0===e.attr("style")&&(0==e.width()?e.on("load",function(){jQuery(this).find(".bwg_filmstrip_thumbnail_img_wrap"),bwg_filmstrip_thumb_view(e)}):(jQuery(this).find(".bwg_filmstrip_thumbnail_img_wrap"),bwg_filmstrip_thumb_view(e)))})}function bwg_filmstrip_thumb_view(e){var t=gallery_box_data.image_filmstrip_height,i=gallery_box_data.image_filmstrip_width,a=i-gallery_box_data.filmstrip_thumb_right_left_space,r=t,_=Math.max(i/e.width(),t/e.height()),s=e.width()*_,o=e.height()*_;e.css({width:s,height:o,marginLeft:(a-s)/2,marginTop:(r-o)/2})}function bwg_info_height_set(){bwg_info_position(!1),jQuery(".mCustomScrollBox").length&&jQuery(".bwg_image_info_container1").height()<jQuery(".mCustomScrollBox").height()+jQuery(".bwg_toggle_container").height()+bwg_image_info_pos+2*parseInt(gallery_box_data.lightbox_info_margin)&&jQuery(".bwg_image_info").css({height:jQuery(".bwg_image_info_container1").height()-jQuery(".bwg_toggle_container").height()-bwg_image_info_pos-2*parseInt(gallery_box_data.lightbox_info_margin)})}function bwg_info_position(e){var t=0,i="none";"top"==gallery_box_data.lightbox_ctrl_btn_pos?"top"==gallery_box_data.lightbox_info_pos&&(i="top"):"bottom"==gallery_box_data.lightbox_info_pos&&(i="bottom"),jQuery(".bwg_ctrl_btn_container").hasClass("closed")||("top"==gallery_box_data.lightbox_ctrl_btn_pos?"top"==gallery_box_data.lightbox_info_pos&&(t=jQuery(".bwg_ctrl_btn_container").height()):"bottom"==gallery_box_data.lightbox_info_pos&&(t=jQuery(".bwg_ctrl_btn_container").height())),"top"==i?0==e?jQuery(".bwg_image_info").css("top",t):jQuery(".bwg_image_info").animate({top:t+"px"},500):"bottom"==i&&(0==e?jQuery(".bwg_image_info").css("bottom",t):jQuery(".bwg_image_info").animate({bottom:t+"px"},500))}function spider_display_embed(e,t,i,a){var r="";switch(e){case"EMBED_OEMBED_YOUTUBE_VIDEO":var _="<iframe ";for(attr in""!=i&&(_+=' src="//www.youtube.com/embed/'+i+'?enablejsapi=1&wmode=transparent"'),a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(_+=" "+attr+'="'+a[attr]+'"');r+=_+=" ></iframe>";break;case"EMBED_OEMBED_VIMEO_VIDEO":var s="<iframe ";for(attr in""!=i&&(s+=' src="//player.vimeo.com/video/'+i+'?enablejsapi=1"'),a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(s+=" "+attr+'="'+a[attr]+'"');r+=s+=" ></iframe>";break;case"EMBED_OEMBED_FLICKR_IMAGE":var o="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(o+=" "+attr+'="'+a[attr]+'"');o+=" >",""!=i&&(o+='<img src="'+i+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;">'),r+=o+="</div>";break;case"EMBED_OEMBED_FLICKR_VIDEO":break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":var l="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"');l+=" >",""!=i&&(l+='<video style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+i+'" type="video/mp4"> Your browser does not support the video tag. </video>'),r+=l+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":l="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"');l+=" >",""!=i&&(l+='<img src="//instagram.com/p/'+i+'/media/?size=l" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'),r+=l+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_POST":l="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"',"CLASS"!=attr&&"class"!=attr&&"Class"!=attr||(obj_class=a[attr]));l+=" >",""!=i&&(l+='<iframe class="inner_instagram_iframe_'+obj_class+'" src="//instagr.am/p/'+i+'/embed/?enablejsapi=1" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'),r+=l+="</div>";break;case"EMBED_OEMBED_FACEBOOK_IMAGE":var n="<span ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(n+=" "+attr+'="'+a[attr]+'"');n+=" >",""!=i&&(n+='<img src="'+t+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:100%;">'),r+=n+="</span>";break;case"EMBED_OEMBED_FACEBOOK_VIDEO":var g="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(g+=" "+attr+'="'+a[attr]+'"');g+=" >",""!=i&&(g+='<iframe src="//www.facebook.com/video/embed?video_id='+t+'&enablejsapi=1&wmode=transparent" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" class="bwg_fb_video" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'),r+=g+="</div>";break;case"EMBED_OEMBED_DAILYMOTION_VIDEO":var w="<iframe ";for(attr in""!=i&&(w+=' src="//www.dailymotion.com/embed/video/'+i+'?api=postMessage"'),a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(w+=" "+attr+'="'+a[attr]+'"');r+=w+=" ></iframe>";break;case"EMBED_OEMBED_IMGUR":var b="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"');b+=" >",""!=i&&(b+='<img src="'+i+'" style="max-width:100% !important; max-height:100% !important; width:auto; height:auto !important;">'),r+=b+="</div>";break;case"EMBED_OEMBED_GOOGLE_PHOTO_IMAGE":var u="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(u+=" "+attr+'="'+a[attr]+'"');u+=" >",""!=i&&(u+='<img src="'+t+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'),r+=u+="</div>";break;default:var d={content:""};jQuery(document).trigger("bwg_display_embed",[d,e,t,i,a]),r=d.content}return r}function bwg_add_instagram_gallery(e,s){if(!0===(s=void 0!==s&&s)){if(bwg_check_instagram_gallery_input(e,s))return!1;var t="0";1==jQuery("input[name=popup_instagram_post_gallery]:checked").val()&&(t="1");var i=encodeURI(jQuery("#popup_instagram_gallery_source").val()),a=encodeURI(jQuery("#popup_instagram_image_number").val())}else{if(bwg_check_instagram_gallery_input(e,s))return!1;if(!bwg_check_gallery_empty(!1,!0))return!1;t="0";1==jQuery("input[name=instagram_post_gallery]:checked").val()&&(t="1");i=encodeURI(jQuery("#gallery_source").val());var r=jQuery("input[name=update_flag]:checked").val();a=encodeURI(jQuery("#autogallery_image_number").val())}jQuery("#bulk_embed").hide(),jQuery("#loading_div").show();var o=[],_={action:"addInstagramGallery",instagram_user:i,instagram_access_token:e,whole_post:t,autogallery_image_number:a,update_flag:r,async:!0};jQuery.post(ajax_url,_,function(e){if(0==e)return alert("Error: cannot get response from the server."),jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1;var t=e.indexOf("WD_delimiter_start"),i=e.indexOf("WD_delimiter_end");if(-1==t||-1==i)return jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1;if(e=e.substring(t+18,i),response_JSON=jQuery.parseJSON(e),response_JSON){if("error"==response_JSON[0])return alert("Error: "+jQuery.parseJSON(e)[1]),jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1;for(var a=response_JSON.length,r=1;r<=a;r++)if(0!=response_JSON[a-r]){var _=response_JSON[a-r];o.push(_)}return bwg_add_image(o),s||(bwg_gallery_update_flag(),jQuery("#tr_instagram_gallery_add_button").hide()),jQuery("#loading_div").hide(),s&&jQuery(".opacity_bulk_embed").hide(),"ok"}return alert("There is some error. Cannot add Instagram gallery."),jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1})}var bwg=0,isMobile=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),bwg_click=isMobile?"touchend":"click",bwg_params=[],bwg_params_ib=[],bwg_params_carousel=[];function bwg_main_ready(){1==bwg_objectsL10n.lazy_load&&jQuery(function(){jQuery("img.bwg_lazyload").lazy({onFinishedAll:function(){jQuery(".lazy_loader").removeClass("lazy_loader")}})}),jQuery(".bwg_container").each(function(){0<jQuery(this).find(".wd_error").length&&bwg_container_loaded(jQuery(this).data("bwg"))}),bwg_document_ready(),jQuery(".bwg-thumbnails, .bwg-masonry-thumbnails, .bwg-album-thumbnails").each(function(){bwg_all_thumnails_loaded(this)}),jQuery(".bwg-mosaic-thumbnails").each(function(){bwg_thumbnail_mosaic(this)}),bwg_slideshow_ready(),bwg_carousel_ready(),bwg_carousel_onload(),bwg_image_browser_ready()}function bwg_resize_search_line(){jQuery(".search_line").each(function(){var e=jQuery(this);e.width()<410?e.addClass("bwg-search-line-responsive"):e.removeClass("bwg-search-line-responsive")})}function bwg_slideshow_resize(){jQuery(".bwg_slideshow").each(function(){bwg=jQuery(this).attr("data-bwg"),jQuery("#bwg_slideshow_image_container_"+bwg).length&&(bwg_params[bwg]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+bwg).attr("data-params")),bwg_params[bwg].event_stack=[],bwg_popup_resize(bwg))})}function bwg_blog_style_resize(){jQuery(".bwg_blog_style").each(function(){bwg=jQuery(this).attr("data-bwg"),jQuery(".bwg_embed_frame_16x9_"+bwg).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height(.5625*jQuery(this).width())}),jQuery(".bwg_embed_frame_instapost_"+bwg).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height((jQuery(this).width()-16)*jQuery(this).attr("data-height")/jQuery(this).attr("data-width")+96)})})}function bwg_blog_style_onload(){jQuery(".bwg_blog_style").each(function(){bwg=jQuery(this).attr("data-bwg");jQuery("#bwg_blog_style_"+bwg);jQuery(".bwg_embed_frame_16x9_"+bwg).each(function(e){if(jQuery(".bwg_blog_style_image_"+bwg).find(".fluid-width-video-wrapper").length){jQuery(".fluid-width-video-wrapper").removeAttr("style");var t=jQuery(this).parents(".bwg_blog_style_image_"+bwg).find(".fluid-width-video-wrapper").contents();jQuery(this).parents(".fluid-width-video-wrapper").replaceWith(t)}jQuery(this).width(jQuery(this).parents(".bwg_blog_style_image_"+bwg).width()),jQuery(this).height(.5625*jQuery(this).width())}),jQuery(".bwg_embed_frame_instapost_"+bwg).each(function(e){jQuery(this).width(jQuery(this).parents(".bwg_blog_style_image_"+bwg).width()),jQuery(this).height((jQuery(this).width()-16)*jQuery(this).attr("data-height")/jQuery(this).attr("data-width")+96)}),bwg_container_loaded(bwg)})}function bwg_blog_style_ready(){jQuery(".bwg_blog_style").each(function(){var e=jQuery(this).attr("data-bwg");bwg_container_loaded(e);var t=!1;jQuery(this).find(".bwg_lightbox_"+e).on("click",function(){var e=jQuery(this).attr("data-image-id");if(jQuery("#bwg_blog_style_share_buttons_"+e).removeAttr("data-open-comment"),!t)return t=!0,setTimeout(function(){t=!1},100),bwg_gallery_box(e,jQuery(this).closest(".bwg_container")),!1}),jQuery(".bwg_lightbox_"+e+" .bwg_ecommerce").on("click",function(e){if(e.stopPropagation(),!t)return t=!0,setTimeout(function(){t=!1},100),bwg_gallery_box(jQuery(this).attr("data-image-id"),jQuery(this).closest(".bwg_container"),!0),!1});var i=window.location.hash.substring(1);i&&"-1"!=i.indexOf("bwg")&&(bwg_hash_array=i.replace("bwg","").split("/"),"<?php echo $params_array['gallery_id']; ?>"==bwg_hash_array[0]&&bwg_gallery_box(bwg_hash_array[1]))})}function bwg_slideshow_focus(){jQuery(".bwg_slideshow").each(function(){bwg=jQuery(this).attr("data-bwg"),jQuery("#bwg_slideshow_image_container_"+bwg).length&&(bwg_params[bwg]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+bwg).attr("data-params")),bwg_params[bwg].event_stack=[],window.clearInterval(window["bwg_playInterval"+bwg]),jQuery(".bwg_ctrl_btn_"+bwg).hasClass("bwg-icon-play")||bwg_play(bwg_params[bwg].data,bwg))})}function bwg_slideshow_blur(){jQuery(".bwg_slideshow").each(function(){bwg=jQuery(this).attr("data-bwg"),jQuery("#bwg_slideshow_image_container_"+bwg).length&&(bwg_params[bwg]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+bwg).attr("data-params")),bwg_params[bwg].event_stack=[],window.clearInterval(window["bwg_playInterval"+bwg]))})}function bwg_carousel_ready(){jQuery(".bwg-carousel").each(function(){var t=jQuery(this).data("bwg");bwg_params_carousel[t]=[],bwg_params_carousel[t].bwg_currentCenterNum=1,bwg_params_carousel[t].bwg_currentlyMoving=!1,bwg_params_carousel[t].data=[],jQuery("#spider_carousel_left-ico_"+t).on("click",function(e){bwg_params_carousel[t].carousel.prev(),e.stopPropagation(),e.stopImmediatePropagation()}),jQuery("#spider_carousel_right-ico_"+t).on("click",function(e){bwg_params_carousel[t].carousel.next(),e.stopPropagation(),e.stopImmediatePropagation()}),parseInt(bwg_params_carousel[t].carousel_enable_autoplay)&&(jQuery(".bwg_carousel_play_pause_"+t).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_carousel_play_pause_"+t).attr("class","bwg-icon-pause bwg_ctrl_btn_"+t+" bwg_carousel_play_pause_"+t)),jQuery(".bwg_carousel_play_pause_"+t).on(bwg_click,function(e){jQuery(".bwg_ctrl_btn_"+t).hasClass("bwg-icon-play")?(jQuery(".bwg_carousel_play_pause_"+t).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_carousel_play_pause_"+t).attr("class","bwg-icon-pause bwg_ctrl_btn_"+t+" bwg_carousel_play_pause_"+t),bwg_params_carousel[t].carousel.start()):(jQuery(".bwg_carousel_play_pause_"+t).attr("title",bwg_objectsL10n.play),jQuery(".bwg_carousel_play_pause_"+t).attr("class","bwg-icon-play bwg_ctrl_btn_"+t+" bwg_carousel_play_pause_"+t),bwg_params_carousel[t].carousel.pause()),e.stopPropagation(),e.stopImmediatePropagation()}),void 0!==jQuery().swiperight&&jQuery.isFunction(jQuery().swiperight)&&jQuery("#bwg_container1_"+t).swiperight(function(){bwg_params_carousel[t].carousel.prev()}),void 0!==jQuery().swipeleft&&jQuery.isFunction(jQuery().swipeleft)&&jQuery("#bwg_container1_"+t).swipeleft(function(){bwg_params_carousel[t].carousel.next()})})}function bwg_carousel_resize(){jQuery(".bwg-carousel").each(function(){var e=jQuery(this).data("bwg");bwg_carousel_params(e,!0),bwg_params_carousel[e].carousel.pause(),bwg_carousel_watermark(e),jQuery(".bwg_ctrl_btn_"+e).hasClass("bwg-icon-play")||bwg_params_carousel[e].carousel.start()})}function bwg_carousel_onload(){jQuery(".bwg-carousel").each(function(){var e=jQuery(this).data("bwg");bwg_params_carousel[e]=jQuery(this).data("params"),bwg_params_carousel[e].parent_width=0,bwg_carousel_watermark(e),bwg_carousel_params(e,!1),bwg_container_loaded(e)})}function bwg_carousel_params(t,e){var i=jQuery("#bwg_container1_"+t).parent();i.hasClass("elementor-tab-content")&&i.width(i.closest(".elementor-widget-wrap").width());var a=i.width(),r=1;a<bwg_params_carousel[t].carousel_r_width?r=a/bwg_params_carousel[t].carousel_r_width:a=bwg_params_carousel[t].carousel_r_width,bwg_params_carousel[t].parent_width!=a&&(bwg_params_carousel[t].parent_width=a,bwg_params_carousel[t].carousel_image_column_number>bwg_params_carousel[t].count&&(bwg_params_carousel[t].carousel_image_column_number=bwg_params_carousel[t].count),jQuery(".bwg_carousel_play_pause_"+t).css({display:parseInt(bwg_params_carousel[t].carousel_play_pause_butt)?"":"none"}),parseInt(bwg_params_carousel[t].carousel_prev_next_butt)?(jQuery("#bwg_carousel-right"+t).css({display:""}),jQuery("#bwg_carousel-left"+t).css({display:""})):(jQuery("#bwg_carousel-left"+t).css({display:"none"}),jQuery("#bwg_carousel-right"+t).css({display:"none"})),jQuery(".inner_instagram_iframe_bwg_embed_frame_"+t).each(function(){var e=jQuery(this).parent();bwg_params_carousel[t].image_height/(parseInt(e.attr("data-height"))+96)<bwg_params_carousel[t].image_width/parseInt(e.attr("data-width"))?(e.height(bwg_params_carousel[t].image_height*r),e.width((e.height()-96)*e.attr("data-width")/e.attr("data-height")+16)):(e.width(bwg_params_carousel[t].image_width*r),e.height((e.width()-16)*e.attr("data-height")/e.attr("data-width")+96))}),jQuery(".bwg_carousel_image_container_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_watermark_text_"+t+", .bwg_carousel_watermark_text_"+t+":hover").css({fontSize:a*(bwg_params_carousel[t].watermark_font_size/bwg_params_carousel[t].image_width)*r}),jQuery(".bwg_carousel-image "+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_watermark_container_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_embed_video_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_watermark_spun_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel-container"+t).css({width:a,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_video_hide"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),bwg_params_carousel[t].carousel&&!e||(e&&bwg_params_carousel[t].carousel&&bwg_params_carousel[t].carousel.pause(),bwg_params_carousel[t].carousel=jQuery("#bwg_carousel"+t).featureCarousel({containerWidth:a*r,containerHeight:bwg_params_carousel[t].image_height*r,fit_containerWidth:bwg_params_carousel[t].carousel_fit_containerWidth,largeFeatureWidth:bwg_params_carousel[t].image_width*r,largeFeatureHeight:bwg_params_carousel[t].image_height*r,smallFeaturePar:bwg_params_carousel[t].carousel_image_par,currentlyMoving:!1,startingFeature:bwg_params_carousel[t].bwg_currentCenterNum,featuresArray:[],timeoutVar:null,rotationsRemaining:0,autoPlay:1e3*bwg_params_carousel[t].car_inter,interval:1e3*bwg_params_carousel[t].carousel_interval,imagecount:bwg_params_carousel[t].carousel_image_column_number,bwg_number:t,enable_image_title:bwg_params_carousel[t].enable_image_title,borderWidth:0})))}function bwg_carousel_watermark(e){var t=1,i=jQuery("#bwg_container1_"+e).parent().width();if(i<bwg_params_carousel[e].carousel_r_width&&(t=i/bwg_params_carousel[e].carousel_r_width),i>=bwg_params_carousel[e].image_width)bwg_carousel_change_watermark_container(e),jQuery("#bwg_carousel_play_pause-ico_"+e).css({fontSize:bwg_params_carousel[e].carousel_play_pause_btn_size}),jQuery(".bwg_carousel_watermark_image_"+e).css({maxWidth:bwg_params_carousel[e].watermark_width*t,maxHeight:bwg_params_carousel[e].watermark_height*t}),jQuery(".bwg_carousel_watermark_text_"+e+", .bwg_carousel_watermark_text_"+e+":hover").css({fontSize:t*bwg_params_carousel[e].watermark_font_size});else{var a=bwg_params_carousel[e].image_width/t;bwg_carousel_change_watermark_container(e),jQuery("#bwg_carousel_play_pause-ico_"+e).css({fontSize:i*bwg_params_carousel[e].carousel_play_pause_btn_size/a}),jQuery(".bwg_carousel_watermark_image_"+e).css({maxWidth:i*bwg_params_carousel[e].watermark_width/a,maxHeight:i*bwg_params_carousel[e].watermark_height/a}),jQuery(".bwg_carousel_watermark_text_"+e+", .bwg_carousel_watermark_text_"+e+":hover").css({fontSize:i*bwg_params_carousel[e].watermark_font_size/a})}}function bwg_carousel_change_watermark_container(a){jQuery(".bwg_carousel"+a).children().each(function(){if(2==jQuery(this).css("zIndex")){var e=jQuery(this).find("img");e.length||(e=jQuery(this).find("iframe"));var t=e.width(),i=e.height();jQuery(".bwg_carousel_watermark_spun_"+a).width(t),jQuery(".bwg_carousel_watermark_spun_"+a).height(i),jQuery(".bwg_carousel_title_spun_"+a).width(t),jQuery(".bwg_carouel_title_spun_"+a).height(i),jQuery(".bwg_carousel_watermark_"+a).css({display:"none"})}})}function bwg_carousel_preload(e,t){var i=jQuery(".bwg_carousel_preload").get();t||i.reverse();var a=0;jQuery(i).each(function(){if(1<++a)return!1;jQuery(this).parent().hasClass("bwg_carousel_embed_video_"+e)||jQuery(this).parent().hasClass("bwg_embed_frame_"+e)||jQuery(this).parent().hasClass("bwg_carousel_video")?(jQuery(this).attr("src",jQuery(this).attr("data-src")),jQuery(this).on("load",function(){jQuery(this).removeClass("bwg_carousel_preload")}),jQuery(this).parent().hasClass("bwg_carousel_video")&&(jQuery(".bwg_carousel_video")[0].load(),jQuery(this).parent().parent().removeClass("bwg_carousel_preload")),jQuery(this).removeAttr("data-src")):(jQuery(this).css({"background-image":"url('"+jQuery(this).attr("data-background")+"')",height:"100%"}),jQuery(this).removeClass("bwg_carousel_preload"),jQuery(this).removeAttr("data-background"))})}function bwg_slideshow_ready(){jQuery(".bwg_slideshow").each(function(){var i=jQuery(this).data("bwg");if(jQuery("#bwg_slideshow_image_container_"+i).length){bwg_params[i]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+i).attr("data-params")),bwg_params[i].event_stack=[],bwg_container_loaded(i);var e=bwg_params[i].data;void 0!==jQuery().swiperight&&jQuery.isFunction(jQuery().swiperight)&&jQuery("#bwg_container1_"+i).swiperight(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key_"+i).val()),0<=parseInt(jQuery("#bwg_current_image_key_"+i).val())-bwg_iterator(i)?(parseInt(jQuery("#bwg_current_image_key_"+i).val())-bwg_iterator(i))%e.length:e.length-1,e,"",i),!1}),void 0!==jQuery().swipeleft&&jQuery.isFunction(jQuery().swipeleft)&&jQuery("#bwg_container1_"+i).swipeleft(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key_"+i).val()),parseInt(jQuery("#bwg_current_image_key_"+i).val())+bwg_iterator(i)%e.length,e,"",i),!1});var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click";bwg_popup_resize(i),jQuery(".bwg_slideshow_watermark_"+i).css({display:"none"}),jQuery(".bwg_slideshow_title_text_"+i).css({display:"none"}),jQuery(".bwg_slideshow_description_text_"+i).css({display:"none"}),setTimeout(function(){bwg_change_watermark_container(i)},500),"horizontal"==bwg_params[i].filmstrip_direction?jQuery(".bwg_slideshow_image_container_"+i).height(jQuery(".bwg_slideshow_image_wrap_"+i).height()-bwg_params[i].slideshow_filmstrip_height):jQuery(".bwg_slideshow_image_container_"+i).width(jQuery(".bwg_slideshow_image_wrap_"+i).width()-bwg_params[i].slideshow_filmstrip_width);var a=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";jQuery(".bwg_slideshow_filmstrip_"+i).bind(a,function(e){var t=window.event||e;return 0<((t=t.originalEvent?t.originalEvent:t).detail?-40*t.detail:t.wheelDelta)?jQuery(".bwg_slideshow_filmstrip_left_"+i).trigger("click"):jQuery(".bwg_slideshow_filmstrip_right_"+i).trigger("click"),!1}),jQuery(".bwg_slideshow_filmstrip_right_"+i).on(t,function(){jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).stop(!0,!1),"left"==bwg_params[i].left_or_top?"width"==bwg_params[i].width_or_height?(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width())&&(jQuery(".bwg_slideshow_filmstrip_left_"+i).css({opacity:1}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width()-(parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width)))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({left:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({left:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left-(parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width))},500,"linear")),window.setTimeout(function(){jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left==-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width())&&jQuery(".bwg_slideshow_filmstrip_right_"+i).css({opacity:.3})},500)):(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height())&&(jQuery(".bwg_slideshow_filmstrip_left_"+i).css({opacity:1}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height()-(parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width)))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({left:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({left:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left-(parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width))},500,"linear")),window.setTimeout(function(){jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left==-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height())&&jQuery(".bwg_slideshow_filmstrip_right_"+i).css({opacity:.3})},500)):"width"==bwg_params[i].width_or_height?(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width())&&(jQuery(".bwg_slideshow_filmstrip_left_"+i).css({opacity:1}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width()-parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({top:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({top:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top-parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top==-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width())&&jQuery(".bwg_slideshow_filmstrip_right_"+i).css({opacity:.3})},500)):(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height())&&(jQuery(".bwg_slideshow_filmstrip_left_"+i).css({opacity:1}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height()-(parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width)))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({top:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({top:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top-(parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width))},500,"linear")),window.setTimeout(function(){jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top==-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height())&&jQuery(".bwg_slideshow_filmstrip_right_"+i).css({opacity:.3})},500))}),jQuery(".bwg_slideshow_filmstrip_left_"+i).on(t,function(){jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).stop(!0,!1),"left"==bwg_params[i].left_or_top?(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left<0&&(jQuery(".bwg_slideshow_filmstrip_right_"+i).css({opacity:1}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left>-(bwg_params[i].filmstrip_thumb_margin_hor+bwg_params[i].slideshow_filmstrip_width)?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({left:0},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({left:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left+parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width)},500,"linear")),window.setTimeout(function(){0==jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left&&jQuery(".bwg_slideshow_filmstrip_left_"+i).css({opacity:.3})},500)):(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top<0&&(jQuery(".bwg_slideshow_filmstrip_right_"+i).css({opacity:1}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top>-(bwg_params[i].filmstrip_thumb_margin_hor+bwg_params[i].slideshow_filmstrip_width)?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({top:0},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({top:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top+parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width)},500,"linear")),window.setTimeout(function(){0==jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top&&jQuery(".bwg_slideshow_filmstrip_left_"+i).css({opacity:.3})},500))}),"width"==bwg_params[i].width_or_height?bwg_set_filmstrip_pos(jQuery(".bwg_slideshow_filmstrip_"+i).width(),i):bwg_set_filmstrip_pos(jQuery(".bwg_slideshow_filmstrip_"+i).height(),i),jQuery("#bwg_slideshow_play_pause_"+i).off(t).on(t,function(){jQuery(".bwg_ctrl_btn_"+i).hasClass("bwg-icon-play")?(bwg_play(bwg_params[i].data,i),jQuery(".bwg_slideshow_play_pause_"+i).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_slideshow_play_pause_"+i).attr("class","bwg-icon-pause bwg_ctrl_btn_"+i+" bwg_slideshow_play_pause_"+i),1==bwg_params[i].enable_slideshow_music&&document.getElementById("bwg_audio_"+i).play()):(window.clearInterval(window["bwg_playInterval"+i]),jQuery(".bwg_slideshow_play_pause_"+i).attr("title","Play"),jQuery(".bwg_slideshow_play_pause_"+i).attr("class","bwg-icon-play bwg_ctrl_btn_"+i+" bwg_slideshow_play_pause_"+i),1==bwg_params[i].enable_slideshow_music&&document.getElementById("bwg_audio_"+i).pause())}),0!=bwg_params[i].enable_slideshow_autoplay&&(bwg_play(bwg_params[i].data,i),jQuery(".bwg_slideshow_play_pause_"+i).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_slideshow_play_pause_"+i).attr("class","bwg-icon-pause bwg_ctrl_btn_"+i+" bwg_slideshow_play_pause_"+i),1==bwg_params[i].enable_slideshow_music&&jQuery("#bwg_audio_"+i).length&&document.getElementById("bwg_audio_"+i).play()),bwg_params[i].preload_images&&bwg_preload_images(parseInt(jQuery("#bwg_current_image_key_".$bwg).val()),i),jQuery(".bwg_slideshow_image_"+i).removeAttr("width"),jQuery(".bwg_slideshow_image_"+i).removeAttr("height")}})}function bwg_image_browser_resize(){jQuery(".bwg_image_browser").each(function(){var e=jQuery(this).attr("data-bwg");jQuery(".image_browser_images_conteiner_"+e).length&&(bwg_params_ib[e]=JSON.parse(jQuery("#bwg_container1_"+e+" .image_browser_images_conteiner_"+e).attr("data-params")),bwg_image_browser(e))})}function bwg_image_browser_ready(){jQuery(".bwg_image_browser").each(function(){var e=jQuery(this).attr("data-bwg");bwg_container_loaded(e),jQuery(".image_browser_images_conteiner_"+e).length&&(bwg_params_ib[e]=JSON.parse(jQuery(".image_browser_images_conteiner_"+e).attr("data-params")),setTimeout(function(){bwg_image_browser(e)},3))})}function bwg_search_focus(e){jQuery(e).parent().find(".bwg_search_input").focus(),jQuery(e).hide()}function bwg_key_press(e){jQuery(e).parent().find(".bwg_search_reset_container").removeClass("bwg-hidden"),jQuery(e).parent().find(".bwg_search_loupe_container1").removeClass("bwg-hidden")}function bwg_all_thumnails_loaded(t){var i=0,a=jQuery(t).find("img").length;return 0==a?bwg_all_thumbnails_loaded_callback(t):jQuery(t).find("img").each(function(){var e=jQuery(this).attr("src");jQuery("<img/>").attr("src",e).on("load error",function(){++i>=a&&bwg_all_thumbnails_loaded_callback(t)})}),0==a}function bwg_all_thumbnails_loaded_callback(e){jQuery(e).hasClass("bwg-thumbnails")&&!jQuery(e).hasClass("bwg-masonry-thumbnails")&&bwg_thumbnail(e),jQuery(e).hasClass("bwg-masonry-thumbnails")&&bwg_thumbnail_masonry(e),jQuery(e).hasClass("bwg-album-extended")&&bwg_album_extended(e)}function bwg_album_thumbnail(e){bwg_container_loaded(jQuery(e).data("bwg"))}function bwg_album_extended(e){var t=jQuery(e).width(),i=jQuery(e).data("thumbnail-width"),a=jQuery(e).data("spacing"),r=jQuery(e).data("max-count"),_=parseInt(t/(2*i));_<1&&(_=1),r<_&&(_=r);var s=100/_,o=jQuery(e).find(".bwg-extended-item"),l=parseInt(o.css("margin-left")),n=parseInt(o.css("margin-right"));o.css({width:"calc("+s+"% - "+(l+n)+"px)"}),o.width()<i?o.find(".bwg-extended-item0, .bwg-extended-item1").css({width:"calc(100% - "+a+"px)"}):o.width()>2*i?(o.find(".bwg-extended-item0").css({width:"calc(50% - "+a+"px)"}),o.find(".bwg-extended-item1").css({width:"calc(100% - "+(i+2*a)+"px)"})):o.find(".bwg-extended-item0, .bwg-extended-item1").css({width:"calc(50% - "+a+"px)"}),jQuery(e).children(".bwg-extended-item").each(function(){var e=jQuery(this).find("img"),t=jQuery(this).find(".bwg-item0"),i=jQuery(this).find(".bwg-item2"),a=e.data("width"),r=e.data("height");""!=a&&""!=r||(a=e.width(),r=e.height());var _=a/r;i.width()/i.height()>a/r?(i.width()>a?e.css({width:"100%",height:i.width()/_}):e.css({maxWidth:"100%",height:i.width()/_}),a=i.width(),r=i.width()/_):(i.height()>r?e.css({height:"100%",width:i.height()*_,maxWidth:"initial"}):e.css({maxHeight:"100%",width:i.height()*_,maxWidth:"initial"}),r=i.height(),a=i.height()*_),jQuery(this).find(".bwg-item2").css({marginLeft:(t.width()-a)/2,marginTop:(t.height()-r)/2})}),bwg_container_loaded(jQuery(e).data("bwg"))}function bwg_thumbnail(e){var t=jQuery(e).width(),i=jQuery(e).data("thumbnail-width"),a=jQuery(e).data("max-count"),r=parseInt(t/i)+1;a<r&&(r=a);var _=100/r;jQuery(e).find(".bwg-item").css({width:_+"%"}),jQuery(e).children(".bwg-item").each(function(){var e=jQuery(this).find("img"),t=jQuery(this).find(".bwg-item2"),i=jQuery(this).find(".bwg-item1"),a=0<t.width()?t.width():i.width(),r=0<t.height()?t.height():i.height(),_=e.data("width"),s=e.data("height");""!=_&&""!=s&&void 0!==_&&void 0!==s||(_=e.width(),s=e.height());var o=_/s;e.removeAttr("style"),o<a/r?(_<a?e.css({width:"100%",height:a/o}):e.css({maxWidth:"100%",height:Math.ceil(a/o)}),s=(_=a)/o):(r>e.height()?e.css({height:"100%",width:r*o,maxWidth:"initial"}):e.css({maxHeight:"100%",width:r*o,maxWidth:"initial"}),_=(s=r)*o),jQuery(this).find(".bwg-item2").css({marginLeft:(a-_)/2,marginTop:(r-s)/2})}),bwg_container_loaded(jQuery(e).data("bwg"))}function bwg_thumbnail_masonry(e){var t="#bwg_thumbnails_masonry_"+(bwg=jQuery(e).attr("data-bwg"));jQuery("#bwg_album_masonry_"+bwg).length&&(t="#bwg_album_masonry_"+bwg),0===jQuery(".bwg-container-temp"+bwg).length&&(jQuery(t).clone().appendTo("#bwg_container3_"+bwg).removeAttr("id").removeClass("bwg-container-"+bwg).addClass("bwg-container-temp"+bwg),jQuery(".bwg-container-temp"+bwg).empty());var a=jQuery(".bwg-container-temp"+bwg),r=jQuery(t),_=a;if(a.prepend(r.html()),_.find(".bwg-empty-item").remove(),"horizontal"==_.data("masonry-type")){var s=_.data("thumbnail-height"),o=_.data("max-count"),l=[];for(i=0;i<o;i++)l.push(0);_.find(".bwg-item").each(function(){var e=l.indexOf(Math.min.apply(Math,l));jQuery(this).css({height:s,order:e+1}),l[e]+=jQuery(this)[0].getBoundingClientRect().width});var n=Math.max.apply(Math,l);for(_.width(n),i=0;i<o;i++)l[i]<n&&_.append(jQuery('<div class="bwg-item bwg-empty-item"></div>').css({height:s,order:i+1,width:n-l[i]}))}else{_.removeAttr("style");n=_.width();var g=_.data("thumbnail-width"),w=(o=_.data("max-count"),parseInt(n/g)+("0"==_.data("resizable-thumbnails")?0:1));o<w&&(w=o);var b=_.find(".bwg-item").length;b<w&&(w=b);var u,d,h=100/w,m=[];for(i=0;i<w;i++)m.push(0);_.find(".bwg-item").each(function(){var e=m.indexOf(Math.min.apply(Math,m));if(jQuery(this).css({width:h+"%",order:e+1}),0<jQuery(this).find("img").attr("data-width").length&&0<jQuery(this).find("img").attr("data-height").length){d=jQuery(this).find("img").data("width")/jQuery(this).find("img").data("height"),u=jQuery(this).width()/d;var t=+(jQuery(this).find("a>.bwg-title1").height()+jQuery(this).find("a>.bwg-masonry-thumb-description").height());jQuery(this).height(u+t)}m[e]+=jQuery(this)[0].getBoundingClientRect().height});var p=Math.max.apply(Math,m);for(i=0;i<w;i++)m[i]<p&&_.append(jQuery('<div class="bwg-item bwg-empty-item"></div>').css({width:h+"%",order:i+1,height:p-m[i]}));_.outerWidth(w*g),_.height(p)}if(""!=a.html()){r.outerWidth(w*g),r.height(p),r.empty();var c=a.html();r.append(c),r.find(".bwg_lazyload").each(function(){null!=jQuery(this).attr("data-original")&&""!=jQuery(this).attr("data-original")&&jQuery(this).attr("src",jQuery(this).attr("data-original"))}),a.empty().hide()}bwg_container_loaded(_.data("bwg"))}function bwg_container_loaded(e){jQuery("#gal_front_form_"+e).removeClass("bwg-hidden"),jQuery("#ajax_loading_"+e).addClass("bwg-hidden")}function bwg_thumbnail_mosaic_logic(e){var t=e.attr("data-bwg"),i=e.attr("data-block-id"),a=parseInt(e.attr("data-thumb-padding"))/2,r=parseInt(e.attr("data-thumb-border"))+a;if("horizontal"==e.attr("data-mosaic-direction")){var _=parseInt(e.attr("data-height"));if("1"==e.attr("data-resizable"))if(1920<=jQuery(window).width())var s=(1+jQuery(window).width()/1920)*_;else if(jQuery(window).width()<=640)s=jQuery(window).width()/640*_;else s=_;else s=_;(c=jQuery(".bwg_mosaic_thumb_"+t)).each(function(e){var t=jQuery(this).data("width"),i=jQuery(this).data("height");""!=t&&""!=i&&void 0!==t&&void 0!==i||(t=c.get(e).naturalWidth,i=c.get(e).naturalHeight),t=t*s/i,c.eq(e).height(s),c.eq(e).width(t)});var o=jQuery("#bwg_mosaic_thumbnails_div_"+t).width()/100*parseInt(e.attr("data-total-width"));jQuery("#"+i).width(o);var l=s+2*r,n=0,g=[];g[0]=0;var w=[],b=w[0]=0;c.each(function(e){row_cum_width2=b+c.eq(e).width()+2*r,row_cum_width2-o<0?(b=row_cum_width2,g[e]=n,w[n]++):e!==c.length-1?Math.abs(b-o)>Math.abs(row_cum_width2-o)||Math.abs(b-o)<=Math.abs(row_cum_width2-o)&&0==w[n]?e!==c.length-2?(b=row_cum_width2,g[e]=n,w[n]++,w[++n]=0,b=0):(b=row_cum_width2,g[e]=n,w[n]++):(w[++n]=1,g[e]=n,b=row_cum_width2-b):(b=row_cum_width2,g[e]=n,w[n]++)});for(var u=[],d=[],h=0;h<=n;h++)u[h]=1,d[h]=l;for(h=0;h<=n;h++)b=0,c.each(function(e){g[e]==h&&(b+=c.eq(e).width())}),u[h]=z=(o-2*w[h]*r)/b,d[h]=(l-2*r)*u[h]+2*r;(S=[])[0]=0;var m=[],p=[];m[0]=0,p[0]=0;for(h=1;h<=n;h++)m[h]=m[0],p[h]=p[h-1]+d[h-1];c.each(function(e){var t=c.eq(e).width(),i=c.eq(e).height();c.eq(e).width(t*u[g[e]]),c.eq(e).height(i*u[g[e]]),c.eq(e).parent().css({top:p[g[e]],left:m[g[e]]}),m[g[e]]+=t*u[g[e]]+2*r,S[g[e]]=e}),jQuery("#"+i).height(p[n]+d[n]-p[0])}else{var c,y=parseInt(e.attr("data-width"));if("1"==e.attr("data-resizable")){if(1920<=jQuery(window).width())var f=(1+jQuery(window).width()/1920)*y;else if(jQuery(window).width()<=640)f=jQuery(window).width()/640*y;else f=y;if(0<jQuery(".header-content-with_tab").length)f=jQuery(".header-content-with_tab").width()/4-10}else f=y;(c=jQuery(".bwg_mosaic_thumb_"+t)).each(function(e){var t=jQuery(this).data("width"),i=jQuery(this).data("height");""!=t&&""!=i&&void 0!==t&&void 0!==i||(t=c.get(e).naturalWidth,i=c.get(e).naturalHeight),c.eq(e).height(i*f/t),c.eq(e).width(f)});o=jQuery("#bwg_mosaic_thumbnails_div_"+t).width()/100*parseInt(e.attr("data-total-width"));jQuery("#"+i).width(o);var j=f+2*r<o?f:o-2*r,Q=Math.floor(o/(j+2*r)),v=[];v[0]=0;for(var x=[],k=[],z=0;z<Q;z++)k[z]=0,x[z]=0;c.each(function(e){for(var t=0,i=k[0],a=0;a<Q;a++)i>k[a]&&(i=k[a],t=a);v[e]=t,x[t]++,B=i,T=0+t*(j+2*r),c.eq(e).parent().css({top:B,left:T}),k[t]+=c.eq(e).height()+2*r}),(u=[])[0]=1;var C=0,I=[],E=0,O=0;for(z=0;z<Q;z++)C+=j,I[z]=0,c.each(function(e){v[e]==z&&(I[z]+=c.eq(e).height())}),0!=I[z]&&(E+=j/I[z],O+=j*x[z]*2*r/I[z]);var M=0;0!=E&&(M=(C+O)/E);for(z=0;z<Q;z++)0!=I[z]&&(u[z]=(M-2*x[z]*r)/I[z]);var S,T=[];T[0]=0;for(z=1;z<=Q;z++)T[z]=T[z-1]+j*u[z-1]+2*r;var B=[];for(z=0;z<Q;z++)B[z]=0;(S=[])[0]=0,c.each(function(e){var t=c.eq(e).width(),i=c.eq(e).height();c.eq(e).width(t*u[v[e]]),c.eq(e).height(i*u[v[e]]),c.eq(e).parent().css({top:B[v[e]],left:T[v[e]]}),B[v[e]]+=i*u[v[e]]+2*r,S[v[e]]=e}),jQuery("#"+i).width(T[Q]).height(B[0])}}function bwg_thumbnail_mosaic(e){var t=jQuery(e),i=jQuery.Deferred();if(i.done([bwg_thumbnail_mosaic_logic]).done(function(e){"1"!=e.data("mosaic-thumb-transition")&&jQuery(".bwg_mosaic_thumb_spun_"+t).css({transition:"all 0.3s ease 0s","-webkit-transition":"all 0.3s ease 0s"});var t=e.data("bwg");jQuery(".bwg_mosaic_thumbnails_"+t).css({visibility:"visible"}),jQuery(".tablenav-pages_"+t).css({visibility:"visible"}),bwg_container_loaded(t),jQuery(".bwg_mosaic_thumb_"+t).removeClass("bwg-hidden"),jQuery("#bwg_mosaic_thumbnails_div_"+t).removeClass("bwg-hidden")}),i.resolve(t),"hover"==t.attr("data-image-title")){var a=parseInt(t.attr("data-thumb-padding"))/2,r=parseInt(t.attr("data-thumb-border"))+a;bwg_mosaic_title_on_hover(t.data("bwg"),t,r)}"hover"==t.attr("data-ecommerce-icon")&&(jQuery(".bwg_mosaic_thumb_spun_"+bwg).on("mouseenter",function(){var e=jQuery(this).parents(".bwg-mosaic-thumb-span").children(".bwg_mosaic_thumb_"+bwg).width(),t=jQuery(this).parents(".bwg-mosaic-thumb-span").children(".bwg_mosaic_thumb_"+bwg).height();jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).width(e);var i=jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).width(),a=jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).height();jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).css({top:r+.5*t-.5*a,left:r+.5*e-.5*i,opacity:1})}),jQuery(".bwg_mosaic_thumb_spun_"+bwg).on("mouseleave",function(){jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).css({top:0,left:-1e4,opacity:0,padding:t.attr("data-title-margin")})}))}function bwg_mosaic_title_on_hover(r,e,_){jQuery(".bwg-mosaic-thumb-span").on("mouseenter",function(){var e=jQuery(this).children(".bwg_mosaic_thumb_"+r).width(),t=jQuery(this).children(".bwg_mosaic_thumb_"+r).height();jQuery(this).find(".bwg_mosaic_title_spun1_"+r).width(e);var i=jQuery(this).find(".bwg_mosaic_title_spun1_"+r).width(),a=jQuery(this).find(".bwg_mosaic_title_spun1_"+r).height();jQuery(this).find(".bwg_mosaic_title_spun1_"+r).css({top:_+.5*t-.5*a<0?_:_+.5*t-.5*a,left:_+.5*e-.5*i,opacity:1,"max-height":"calc(100% - "+2*_+"px)",overflow:"hidden"})}),jQuery(".bwg-mosaic-thumb-span").on("mouseleave",function(){jQuery(this).find(".bwg_mosaic_title_spun1_"+r).css({top:0,left:-1e4,opacity:0,padding:e.attr("data-title-margin"),"max-height":"calc(100% - "+2*_+"px)",overflow:"hidden"})})}function bwg_mosaic_ajax(e,t){var i=0;jQuery(".bwg_mosaic_thumb_spun_"+e+" img").on("load",function(){++i>=t&&bwg_thumbnail_mosaic(jQuery(".bwg-mosaic-thumbnails[data-bwg="+e+"]"))}),jQuery(".bwg_mosaic_thumb_spun_"+e+" img").on("error",function(){jQuery(this).height(100),jQuery(this).width(100),++i>=t&&bwg_thumbnail_mosaic(jQuery(".bwg-mosaic-thumbnails[data-bwg="+e+"]"))})}function bwg_add_album(){var t=!1;"1"!=bwg_objectsL10n.front_ajax&&jQuery(document).off("click",".bwg-album").on("click",".bwg-album",function(){if(!t){var e=jQuery(this).attr("data-bwg");return t=!0,setTimeout(function(){t=!1},100),bwg_ajax("gal_front_form_"+e,e,jQuery(this).attr("data-container_id"),jQuery(this).attr("data-alb_gal_id"),jQuery(this).attr("data-album_gallery_id"),jQuery(this).attr("data-def_type"),"",jQuery(this).attr("data-title")),!1}}),jQuery(".bwg_description_more").on("click",function(){jQuery(this).hasClass("bwg_more")?(jQuery(this).parent().find(".bwg_description_full").show(),jQuery(this).addClass("bwg_hide").removeClass("bwg_more"),jQuery(this).html(jQuery(this).data("hide-msg"))):(jQuery(this).parent().find(".bwg_description_full").hide(),jQuery(this).addClass("bwg_more").removeClass("bwg_hide"),jQuery(this).html(jQuery(this).data("more-msg")))})}function bwg_add_lightbox(){var i=!1;jQuery(document).on("click",".bwg_lightbox .bwg-item0, .bwg_lightbox .bwg_slide, .bwg_lightbox .bwg-carousel-image, .bwg_lightbox .bwg-title1",function(e){e.stopPropagation(),e.preventDefault();var t=jQuery(this).closest("a");if(!i)return i=!0,setTimeout(function(){i=!1},100),bwg_gallery_box(jQuery(t).attr("data-image-id"),jQuery(t).closest(".bwg_container")),!1}),jQuery(".bwg_lightbox .bwg_ecommerce").on("click",function(e){if(e.stopPropagation(),!i)return i=!0,setTimeout(function(){i=!1},100),bwg_gallery_box(jQuery(this).closest(".bwg_lightbox").attr("data-image-id"),jQuery(this).closest(".bwg_container"),!0),!1})}function bwg_filter_by_tag(e){var t="",i=jQuery(e).parent().parent(),a=i.find(".current_view").val(),r=i.find(".form_id").val(),_=i.find(".cur_gal_id").val(),s=i.find(".album_gallery_id").val(),o=i.find(".type").val();jQuery(e).parent().find(".opt.selected").each(function(){t=t+jQuery(e).text()+","}),""==(t=t.slice(0,-1))&&(t=bwg_objectsL10n.bwg_select_tag),jQuery(e).parent().find(".CaptionCont").attr("title",t),jQuery(e).parent().find(".CaptionCont .placeholder").html(t),jQuery("#bwg_tag_id_"+a).val(jQuery("#bwg_tag_id_"+_).val()),bwg_select_tag(a,r,_,s,o,!1)}function bwg_document_ready(){bwg_add_lightbox(),jQuery('div[id^="bwg_container1_"]').each(function(){var e=jQuery(this);e.data("right-click-protection")&&bwg_disable_right_click(e),jQuery(".SumoSelect > .CaptionCont > label > i").addClass("bwg-icon-angle-down closed");var t=e.find(".search_tags");if("1"==bwg_objectsL10n.front_ajax&&t.length)for(var i=0;i<t[0].length;i++)void 0===t[0][i].attributes.selected&&(t[0][i].selected=!1);t.length&&(t.SumoSelect({triggerChangeCombined:!0,placeholder:bwg_objectsL10n.bwg_select_tag,search:!0,searchText:bwg_objectsL10n.bwg_search,forceCustomRendering:!0,noMatch:bwg_objectsL10n.bwg_tag_no_match,captionFormatAllSelected:bwg_objectsL10n.bwg_all_tags_selected,captionFormat:"{0} "+bwg_objectsL10n.bwg_tags_selected,okCancelInMulti:!0,locale:[bwg_objectsL10n.ok,bwg_objectsL10n.cancel,bwg_objectsL10n.select_all]}),t.off("change").on("change",function(){bwg_filter_by_tag(this)}));var a=e.find(".bwg_order");a.length&&a.SumoSelect({triggerChangeCombined:!0,forceCustomRendering:!0}),jQuery(this).find("search_placeholder_title").hide(),""==jQuery(this).find(".bwg_search_input").val()&&jQuery(this).find("search_placeholder_title").show(),jQuery(".bwg_thumbnail .bwg_search_container_2").focusout(function(e){""==jQuery(this).find(".bwg_search_input").val()&&(jQuery(this).find(".search_placeholder_title").show(),jQuery(this).find(".bwg_search_loupe_container1").addClass("bwg-hidden"),jQuery(this).find(".bwg_search_reset_container").addClass("bwg-hidden"))})}),jQuery(".search_tags").on("sumo:opened",function(){0==jQuery(this).parent().find("ul li").length&&(jQuery(".no-match").html(bwg_objectsL10n.bwg_tag_no_match),jQuery(".no-match").show())}),jQuery(".bwg_thumbnail .SumoSelect").on("sumo:closed",function(){jQuery(this).find("label i").removeClass("bwg-icon-angle-up opened"),jQuery(this).find("label i").addClass("bwg-icon-angle-down closed")}),jQuery(".bwg_thumbnail .SumoSelect").on("sumo:opened",function(){jQuery(this).find("label i").removeClass("bwg-icon-angle-down closed"),jQuery(this).find("label i").addClass("bwg-icon-angle-up opened")}),bwg_add_album();var e=window.location.hash.substring(1);if(e&&"-1"!=e.indexOf("bwg")){bwg_hash_array=e.replace("bwg","").split("/");var t=jQuery(".bwg_container");t&&bwg_gallery_box(bwg_hash_array[1],t,!1,bwg_hash_array[0])}bwg_blog_style_ready(),bwg_image_browser_ready(),bwg_resize_search_line()}function bwg_clear_search_input(e){if("1"!=bwg_objectsL10n.front_ajax)jQuery("#bwg_search_input_"+e).val(""),jQuery("#bwg_search_container_1_"+e+" .bwg_search_loupe_container1").addClass("bwg-hidden"),jQuery("#bwg_search_container_1_"+e+" .bwg_search_reset_container").addClass("bwg-hidden");else{var t=window.location.href,i=bwg_remove_url_parameter("bwg_search_"+e,t,t);window.location.replace(i)}}function bwg_check_search_input_enter(e,t){return 13!=(t.which||t.keyCode)||(jQuery(e).closest(".bwg_search_container_1").find(".bwg_search").trigger("click"),!1)}function bwg_ajax(t,i,a,r,e,_,s,o,l,n,g,w){if("1"!=bwg_objectsL10n.front_ajax||!0===n){jQuery("#ajax_loading_"+i).removeClass("bwg-hidden"),jQuery(".bwg_load_more_ajax_loading").css({top:jQuery("#bwg_container1_"+bwg).height()-jQuery(".bwg_load_more_ajax_loading").height()}),"function"==typeof bwg_scroll_load_action&&jQuery(window).off("scroll",bwg_scroll_load_action),jQuery(".bwg_thumbnail .search_tags").off("sumo:closed");var b=jQuery("#"+t).data("ajax-url"),u=0;if(void 0===n)n=!1;var d=jQuery("#page_number_"+i).val(),h=jQuery("#bwg_search_input_"+i).val(),m={},p=jQuery("#bwg_album_breadcrumb_"+i).val();if(p&&!0!==n){var c=JSON.parse(p);if("back"==r){c.splice(-1,1);var y=c.slice(-1)[0];r=y.id,d=y.page,m["action_"+i]="back"}else"numeric"===n||s?(c.splice(-1,1),c.push({id:r,page:d,search:h})):(c.push({id:r,page:1}),d=1);m["bwg_album_breadcrumb_"+i]=JSON.stringify(c)}if(m.gallery_type=jQuery("#"+t).data("gallery-type"),m.gallery_id=jQuery("#"+t).data("gallery-id"),m.tag=jQuery("#"+t).data("tag"),m.album_id=jQuery("#"+t).data("album-id"),m.theme_id=jQuery("#"+t).data("theme-id"),m.shortcode_id=jQuery("#"+t).data("shortcode-id"),m.bwg=i,m.current_url=encodeURI(jQuery("#bwg_container1_"+i).data("current-url")),s&&(d=1),void 0===o||""==o)o="";if(void 0===g||""==g)g="";if(void 0===l||""==l)l=jQuery(".bwg_order_"+i).val();if(void 0===w)w=!0;if(1==w&&jQuery("html, body").animate({scrollTop:jQuery("#"+t).offset().top-150},500),m["page_number_"+i]=d,m["bwg_load_more_"+i]=jQuery("#bwg_load_more_"+i).val(),m["album_gallery_id_"+i]=r,m["type_"+i]=_,m["title_"+i]=o,m["description_"+i]=g,m["sortImagesByValue_"+i]=l,0<jQuery("#bwg_search_input_"+i).length&&(m["bwg_search_"+i]=jQuery("#bwg_search_input_"+i).val()),void 0!==m["bwg_album_breadcrumb_"+i]){var f=jQuery.parseJSON(m["bwg_album_breadcrumb_"+i]);jQuery.each(f,function(e,t){m["bwg_search_"+i]="",r==t.id&&(m["bwg_search_"+i]=t.search)})}return m["bwg_tag_id_"+a]=jQuery("#bwg_tag_id_"+a).val(),jQuery("#ajax_loading_"+i).removeClass("bwg-hidden"),jQuery(".bwg_load_more_ajax_loading").css({top:jQuery("#bwg_container1_"+bwg).height()-jQuery(".bwg_load_more_ajax_loading").height()}),jQuery.ajax({type:"POST",url:b,data:m,success:function(e){jQuery(e).find(".bwg_masonry_thumb_spun_"+i+" img").length,u=jQuery(e).find(".bwg_mosaic_thumb_spun_"+i+" img").length,!0===n?(a=="bwg_thumbnails_mosaic_"+i?jQuery("#"+a).append(jQuery(e).closest(".bwg-container-"+i).find("#"+a).html()):a=="bwg_album_compact_"+i?jQuery("#"+a).append(jQuery(e).closest(".bwg-album-thumbnails").html()):a=="bwg_thumbnails_masonry_"+i?jQuery(".bwg-container-temp"+i).append(jQuery(e).closest(".bwg-container-"+i).html()):jQuery("#"+a).append(jQuery(e).closest(".bwg-container-"+i).html()),jQuery(".bwg_nav_cont_"+i).html(jQuery(e).closest(".bwg_nav_cont_"+i).html())):jQuery("#bwg_container3_"+i).html(e)},complete:function(){jQuery("div[id^='bwg_container1_'] img").each(function(){null!=jQuery(this).attr("data-lazy-src")&&""!=jQuery(this).attr("data-lazy-src")?jQuery(this).attr("src",jQuery(this).attr("data-lazy-src")):null!=jQuery(this).attr("data-original")&&""!=jQuery(this).attr("data-original")&&jQuery(this).attr("src",jQuery(this).attr("data-original"))}),jQuery(".blog_style_image_buttons_conteiner_"+i).find(jQuery(".bwg_blog_style_img_"+i)).on("load",function(){jQuery(".bwg_blog_style_img_"+i).closest(jQuery(".blog_style_image_buttons_conteiner_"+i)).show()}),jQuery("#bwg_tags_id_"+a).val(jQuery("#bwg_tag_id_"+a).val()),jQuery(".pagination-links_"+i).length&&jQuery("html, body").animate({scrollTop:jQuery("#"+t).offset().top-150},500),bwg_document_ready(),bwg_carousel_ready(),bwg_carousel_onload(),bwg_mosaic_ajax(i,u),bwg_all_thumnails_loaded(".bwg-container-"+i)&&bwg_container_loaded(i),jQuery(".blog_style_images_conteiner_"+i+" .bwg_embed_frame_16x9_"+i).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height(.5625*jQuery(this).width())}),jQuery(".blog_style_images_conteiner_"+i+" .bwg_embed_frame_instapost_"+i).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height((jQuery(this).width()-16)*jQuery(this).attr("data-height")/jQuery(this).attr("data-width")+96)}),jQuery("#bwg_embed_frame_16x9_"+i).width(jQuery("#bwg_embed_frame_16x9_"+i).parent().width()),jQuery("#bwg_embed_frame_16x9_"+i).height(.5625*jQuery("#bwg_embed_frame_16x9_"+i).width()),jQuery("#bwg_embed_frame_instapost_"+i).width(jQuery("#bwg_embed_frame_16x9_"+i).parent().width()),jQuery(".bwg_embed_frame_instapost_"+i).height((jQuery(".bwg_embed_frame_instapost_"+i).width()-16)*jQuery(".bwg_embed_frame_instapost_"+i).attr("data-height")/jQuery(".bwg_embed_frame_instapost_"+i).attr("data-width")+96),jQuery("#bwg_search_input_"+i).val(m["bwg_search_"+i]),""!=jQuery("#bwg_search_input_"+i).val()?(jQuery("#bwg_search_input_"+i).parent().find(".search_placeholder_title").hide(),jQuery("#bwg_search_input_"+i).parent().parent().find(".bwg_search_reset_container").show(),jQuery("#bwg_search_input_"+i).parent().parent().find(".bwg_search_loupe_container1").show()):jQuery("#bwg_search_input_"+i).parent().find(".search_placeholder_title").show();var e=jQuery("#bwg_container2_"+i+" .cur_gal_id").val();jQuery("#bwg_tag_id_"+i).val(jQuery("#bwg_tag_id_"+e).val())}}),!1}if("back"===r)return-1==document.referrer.indexOf(window.location.host)?(str=jQuery(location).attr("href"),void window.location.replace(str.substring(0,str.indexOf("type_0")))):void window.history.back();var j=jQuery("#bwg_search_input_"+i).val(),Q=window.location.href,v="",x=jQuery("#bwg_tag_id_"+i).val();if("#"==Q.substr(-1)&&(Q=Q.slice(0,-1)),""!==j&&void 0!==j?!1!==(v=bwg_add_url_parameter(v=bwg_remove_url_parameter("page_number_"+i,Q),"bwg_search_"+i,j))&&(Q=v):!1!==(v=bwg_remove_url_parameter("bwg_search_"+i,Q))&&(Q=v),void 0!==l&&""!==l&&!1!==(v=bwg_add_url_parameter(Q,"sort_by_"+i,l))&&(Q=v),null!=x&&0<x.length){var k="",z=x.split(",");jQuery.each(z,function(e){var t=",";e===z.length-1&&(t=""),k+=z[e]+t}),""!==k&&!1!==(v=bwg_add_url_parameter(Q,"filter_tag_"+i,k))&&(Q=v)}else!1!==(v=bwg_remove_url_parameter("filter_tag_"+i,v))&&(Q=v);window.location.href=Q}function bwg_add_url_parameter(e,t,i){var a=new RegExp("([?&])"+t+"=.*?(&|$)","i"),r=-1!==e.indexOf("?")?"&":"?";return e.match(a)?e.replace(a,"$1"+t+"="+i+"$2"):e+r+t+"="+i}function bwg_remove_url_parameter(e,t){var i=t.split("?"),a=i[0]+"?",r="";if(void 0!==i[1]&&(r=i[1]),""===r)return t;var _,s,o=decodeURIComponent(r).split("&");for(s=0;s<o.length;s++)(_=o[s].split("="))[0]!=e&&(a=a+_[0]+"="+_[1]+"&");return a.substring(0,a.length-1)}function bwg_select_tag(e,t,i,a,r,_){_&&jQuery("#bwg_tag_id_"+i).val(""),bwg_ajax(t,e,i,a,"",r,1,"")}function bwg_cube(e,t,i,a,r,_,s,o,l,n,g){var w,b=!1,u="";if(void 0!==g&&""!==g){b=!0,bwg_params[g].bwg_trans_in_progress=!0,u="_"+g,w=bwg_params[g].bwg_transition_duration;bwg_params[g].event_stack}else w=bwg_transition_duration;if(!bwg_testBrowser_cssTransitions(g))return bwg_fallback(o,l,n,g);if(!bwg_testBrowser_cssTransforms3d(g))return bwg_fallback3d(o,l,n,g);function d(){if(jQuery(o).removeAttr("style"),jQuery(l).removeAttr("style"),jQuery(".bwg_slider"+u).removeAttr("style"),jQuery(o).css({opacity:0,"z-index":1}),jQuery(l).css({opacity:1,"z-index":2}),jQuery(".bwg_image_info").show(),jQuery(o).html(""),b){bwg_change_watermark_container(g),bwg_params[g].bwg_trans_in_progress=!1;var e=bwg_params[g].data,t=bwg_params[g].event_stack}else{e="";gallery_box_data.bwg_trans_in_progress=!1;t=gallery_box_data.event_stack}if(void 0!==t&&0<t.length){var i=t[0].split("-");t.shift(),bwg_change_image(i[0],i[1],e,!0,g)}bwg_change_watermark_container()}b?(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+g).removeClass("bwg_slideshow_thumb_active_"+g).addClass("bwg_slideshow_thumb_deactive_"+g),jQuery("#bwg_filmstrip_thumbnail_"+bwg_params[g].bwg_current_key+"_"+g).removeClass("bwg_slideshow_thumb_deactive_"+g).addClass("bwg_slideshow_thumb_active_"+g),jQuery(".bwg_slideshow_dots_"+g).removeClass("bwg_slideshow_dots_active_"+g).addClass("bwg_slideshow_dots_deactive_"+g),jQuery("#bwg_dots_"+bwg_params[g].bwg_current_key+"_"+g).removeClass("bwg_slideshow_dots_deactive_"+g).addClass("bwg_slideshow_dots_active_"+g),jQuery(".bwg_slide_bg_"+g).css("perspective",1e3)):(gallery_box_data.bwg_trans_in_progress=!0,jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+gallery_box_data.bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active"),jQuery(".bwg_slide_bg").css("perspective",1e3)),jQuery(o).css({transform:"translateZ("+e+"px)",backfaceVisibility:"hidden"}),jQuery(l).css({opacity:1,backfaceVisibility:"hidden",transform:"translateY("+i+"px) translateX("+t+"px) rotateY("+r+"deg) rotateX("+a+"deg)"}),jQuery(".bwg_slider"+u).css({transform:"translateZ(-"+e+"px)",transformStyle:"preserve-3d"}),setTimeout(function(){jQuery(".bwg_slider"+u).css({transition:"all "+w+"ms ease-in-out",transform:"translateZ(-"+e+"px) rotateX("+_+"deg) rotateY("+s+"deg)"})},20),jQuery(".bwg_slider"+u).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(d)),0==w&&d()}function bwg_fade(e,t,i,a){var r,_=!1;function s(){jQuery(".bwg_image_info").show(),bwg_change_watermark_container(a),_?bwg_params[a].bwg_trans_in_progress=!1:gallery_box_data.bwg_trans_in_progress=!1}r=void 0!==a&&""!==a?(_=!0,bwg_params[a].bwg_trans_in_progress=!0,bwg_params[a].bwg_transition_duration):(gallery_box_data.bwg_trans_in_progress=!0,gallery_box_data.bwg_transition_duration),_?(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+a).removeClass("bwg_slideshow_thumb_active_"+a).addClass("bwg_slideshow_thumb_deactive_"+a),jQuery("#bwg_filmstrip_thumbnail_"+bwg_params[a].bwg_current_key+"_"+a).removeClass("bwg_slideshow_thumb_deactive_"+a).addClass("bwg_slideshow_thumb_active_"+a),jQuery(".bwg_slideshow_dots_"+a).removeClass("bwg_slideshow_dots_active_"+a).addClass("bwg_slideshow_dots_deactive_"+a),jQuery("#bwg_dots_"+bwg_params[a].bwg_current_key+"_"+a).removeClass("bwg_slideshow_dots_deactive_"+a).addClass("bwg_slideshow_dots_active_"+a)):(jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+gallery_box_data.bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active")),bwg_testBrowser_cssTransitions()?(jQuery(t).css("transition","opacity "+r+"ms linear"),jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),jQuery(t).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(s))):(jQuery(e).animate({opacity:0,"z-index":1},r),jQuery(t).animate({opacity:1,"z-index":2},{duration:r,complete:function(){_?bwg_params[a].bwg_trans_in_progress=!1:gallery_box_data.bwg_trans_in_progress=!1,jQuery(e).html(""),s()}}),jQuery(e).fadeTo(r,0),jQuery(t).fadeTo(r,1)),0==r&&s()}function bwg_change_watermark_container(t){jQuery(".bwg_slider"+(void 0!==t&&""!==t?"_"+t:"")).children().each(function(){if(2==jQuery(this).css("zIndex")){var e=jQuery(this).find("img");if(e.length)if(e.prop("complete"))bwg_change_each_watermark_container(e.width(),e.height(),t);else e.on("load",function(){bwg_change_each_watermark_container(e.width(),e.height(),t)});else(e=jQuery(this).find("iframe")).length||(e=jQuery(this).find("video")),bwg_change_each_watermark_container(e.width(),e.height(),t)}})}function bwg_change_each_watermark_container(e,t,i){var a=void 0!==i&&""!==i?"_"+i:"",r=void 0!==i&&""!==i?"_slideshow":"";if(jQuery(".bwg"+r+"_watermark_spun"+a).width(e),jQuery(".bwg"+r+"_watermark_spun"+a).height(t),jQuery(".bwg"+r+"_watermark"+a).css({display:""}),void 0===i||""===i){var _=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(_=gallery_box_data.lightbox_comment_width),e<=jQuery(window).width()-_&&(jQuery(".bwg_watermark_image").css({width:(jQuery(".spider_popup_wrap").width()-_)*gallery_box_data.watermark_font_size/gallery_box_data.image_width}),jQuery(".bwg_watermark_text, .bwg_watermark_text:hover").css({fontSize:(jQuery(".spider_popup_wrap").width()-_)*gallery_box_data.watermark_font_size/gallery_box_data.image_width}))}else jQuery(".bwg"+r+"_title_spun"+a).width(e),jQuery(".bwg"+r+"_title_spun"+a).height(t),jQuery(".bwg"+r+"_description_spun"+a).width(e),jQuery(".bwg"+r+"_description_spun"+a).height(t);jQuery.trim(jQuery(".bwg"+r+"_title_text"+a).text())&&jQuery(".bwg_slideshow_title_text"+a).css({display:""}),jQuery.trim(jQuery(".bwg"+r+"_description_text"+a).text())&&jQuery(".bwg"+r+"_description_text"+a).css({display:""})}function bwg_set_filmstrip_pos(e,t,i){var a,r=void 0!==t&&""!==t?"_"+t:"",_=void 0!==t&&""!==t?"_slideshow":"";a=void 0!==t&&""!==t?bwg_params[t].left_or_top:gallery_box_data.left_or_top;var s=parseInt(jQuery(".bwg_filmstrip_thumbnails").attr("data-all-images-top-bottom-space")),o=parseInt(jQuery(".bwg_filmstrip_thumbnails").attr("data-all-images-right-left-space"));if(void 0===t||""===t){if("outerWidth"==gallery_box_data.outerWidth_or_outerHeight)var l=-bwg_current_filmstrip_pos-jQuery(".bwg_filmstrip_thumbnail").outerWidth(!0)/2;else if("outerHeight"==gallery_box_data.outerWidth_or_outerHeight)l=-bwg_current_filmstrip_pos-jQuery(".bwg_filmstrip_thumbnail").outerHeight(!0)/2;if("width"==gallery_box_data.width_or_height)var n=Math.min(0,Math.max(e-jQuery(".bwg_filmstrip_thumbnails").width(),l+e/2));else if("height"==gallery_box_data.width_or_height)n=Math.min(0,Math.max(e-jQuery(".bwg_filmstrip_thumbnails").height(),l+e/2))}else if("width"==bwg_params[t].width_or_height)l=-bwg_params[t].bwg_current_filmstrip_pos-(jQuery(".bwg_slideshow_filmstrip_thumbnail"+r).width()+bwg_params[t].filmstrip_thumb_margin_hor)/2,n=Math.min(0,Math.max(e-jQuery(".bwg_slideshow_filmstrip_thumbnails"+r).width(),l+e/2));else l=-bwg_params[t].bwg_current_filmstrip_pos-(jQuery(".bwg_slideshow_filmstrip_thumbnail"+r).height()+bwg_params[t].filmstrip_thumb_margin_hor)/2,n=Math.min(0,Math.max(e-jQuery(".bwg_slideshow_filmstrip_thumbnails"+r).height(),l+e/2));0<n+o&&(o=0),0<n+s&&(s=0),"left"==a?jQuery(".bwg"+_+"_filmstrip_thumbnails"+r).animate({left:n+o},{duration:500,complete:function(){bwg_filmstrip_arrows(t)}}):jQuery(".bwg"+_+"_filmstrip_thumbnails"+r).animate({top:n+s},{duration:500,complete:function(){bwg_filmstrip_arrows(t)}})}function bwg_filmstrip_arrows(e){var t=void 0!==e&&""!==e?"_"+e:"",i=void 0!==e&&""!==e?"_slideshow":"";if("width"==(void 0!==e&&""!==e?bwg_params[e].width_or_heigh:gallery_box_data.width_or_height))var a=jQuery(".bwg"+i+"_filmstrip_thumbnails"+t).width(),r=jQuery(".bwg"+i+"_filmstrip"+t).width();else a=jQuery(".bwg"+i+"_filmstrip_thumbnails"+t).height(),r=jQuery(".bwg"+i+"_filmstrip"+t).height();a<r?(jQuery(".bwg"+i+"_filmstrip_left"+t).hide(),jQuery(".bwg"+i+"_filmstrip_right"+t).hide()):(jQuery(".bwg"+i+"_filmstrip_left"+t).show(),jQuery(".bwg"+i+"_filmstrip_right"+t).show())}function bwg_move_filmstrip(e){var t,i,a,r,_,s,o=void 0!==e&&""!==e?"_"+e:"",l=void 0!==e&&""!==e?"_slideshow":"",n=void 0!==e&&""!==e?bwg_params[e].outerWidth_or_outerHeight:gallery_box_data.outerWidth_or_outerHeight,g=void 0!==e&&""!==e?bwg_params[e].left_or_top:gallery_box_data.left_or_top;i="outerWidth"==n?(t=jQuery(".bwg"+l+"_filmstrip"+o).outerWidth(!0),jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).outerWidth(!0)):(t=jQuery(".bwg"+l+"_filmstrip"+o).outerHeight(!0),jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).outerHeight(!0)),s="left"==g?(a=jQuery(".bwg"+l+"_thumb_active"+o).position().left,r="outerWidth"==n?jQuery(".bwg"+l+"_thumb_active"+o).position().left+jQuery(".bwg"+l+"_thumb_active"+o).outerWidth(!0):jQuery(".bwg"+l+"_thumb_active"+o).position().left+jQuery(".bwg"+l+"_thumb_active"+o).outerHeight(!0),_=jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().left,Math.abs(jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().left)+t):(a=jQuery(".bwg"+l+"_thumb_active"+o).position().top,r="outerWidth"==n?jQuery(".bwg"+l+"_thumb_active"+o).position().top+jQuery(".bwg"+l+"_thumb_active"+o).outerWidth(!0):jQuery(".bwg"+l+"_thumb_active"+o).position().top+jQuery(".bwg"+l+"_thumb_active"+o).outerHeight(!0),_=jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().top,Math.abs(jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().top)+t),i<t||(a<Math.abs(_)?"left"==g?jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({left:-a},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}}):jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({top:-a},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}}):s<r&&("left"==g?jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({left:-(r-t)},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}}):jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({top:-(r-t)},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}})))}function bwg_move_dots(e){var t=jQuery(".bwg_slideshow_dots_active_"+e).position().left,i=jQuery(".bwg_slideshow_dots_active_"+e).position().left+jQuery(".bwg_slideshow_dots_active_"+e).outerWidth(!0),a=jQuery(".bwg_slideshow_dots_container_"+e).outerWidth(!0),r=jQuery(".bwg_slideshow_dots_thumbnails_"+e).outerWidth(!1),_=jQuery(".bwg_slideshow_dots_thumbnails_"+e).position().left,s=Math.abs(jQuery(".bwg_slideshow_dots_thumbnails_"+e).position().left)+a;r<a||(t<Math.abs(_)?jQuery(".bwg_slideshow_dots_thumbnails_"+e).animate({left:-t},{duration:500,complete:function(){}}):s<i&&jQuery(".bwg_slideshow_dots_thumbnails_"+e).animate({left:-(i-a)},{duration:500,complete:function(){}}))}function bwg_testBrowser_cssTransitions(e){return bwg_testDom("Transition",e)}function bwg_testBrowser_cssTransforms3d(e){return bwg_testDom("Perspective",e)}function bwg_testDom(e,t){for(var i=["","Webkit","Moz","ms","O","Khtml"],a=i.length;a--;)if(void 0!==document.body.style[i[a]+e])return!0;return!1}function bwg_fallback(e,t,i,a){bwg_fade(e,t,i,a)}function bwg_fallback3d(e,t,i,a){bwg_sliceV(e,t,i,a)}function bwg_none(e,t,i,a){var r=void 0!==a&&""!==a?"_"+a:"";if(jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),void 0!==a&&""!==a){var _=bwg_params[a].bwg_current_key;bwg_change_watermark_container(a),jQuery(".bwg_slideshow_filmstrip_thumbnail"+r).removeClass("bwg_slideshow_thumb_active"+r).addClass("bwg_slideshow_thumb_deactive"+r),jQuery("#bwg_filmstrip_thumbnail_"+_+r).removeClass("bwg_slideshow_thumb_deactive"+r).addClass("bwg_slideshow_thumb_active"+r),jQuery(".bwg_slideshow_dots"+r).removeClass("bwg_slideshow_dots_active"+r).addClass("bwg_slideshow_dots_deactive"+r),jQuery("#bwg_dots_"+_+r).removeClass("bwg_slideshow_dots_deactive"+r).addClass("bwg_slideshow_dots_active"+r)}else jQuery(".bwg_image_info").show(),gallery_box_data.bwg_trans_in_progress=!1,jQuery(e).html(""),bwg_change_watermark_container()}function bwg_iterator(e){var t=1;return void 0!==e&&""!==e&&void 0!==bwg_params[e]&&1==bwg_params[e].enable_slideshow_shuffle&&(t=Math.floor((bwg_params[e].data.length-1)*Math.random()+1)),t}function bwg_change_image_slideshow(e,t,i,a,r){i=bwg_params[r].data;if(jQuery("#bwg_slideshow_image_container_"+r).find("iframe").each(function(){jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*"),jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }',"*"),jQuery(this)[0].contentWindow.postMessage("pause","*")}),jQuery("#image_id_"+r+"_"+i[e].id).find(".bwg_fb_video").each(function(){jQuery(this).attr("src",jQuery(this).attr("src"))}),i[t]){if(jQuery(".bwg_ctrl_btn_"+r).hasClass("bwg-icon-pause")&&bwg_play(bwg_params[r].data,r),a||(jQuery("#bwg_current_image_key_"+r).val(t),"-1"==e?e=jQuery(".bwg_slideshow_thumb_active_"+r).children("img").attr("image_key"):"-2"==e&&(e=jQuery(".bwg_slideshow_dots_active_"+r).attr("image_key"))),bwg_params[r].bwg_trans_in_progress)return void bwg_params[r].event_stack.push(e+"-"+t);var _="right";if(t<e)_="left";else if(e==t)return;jQuery(".bwg_slideshow_watermark_"+r).css({display:"none"}),jQuery(".bwg_slideshow_title_text_"+r).css({display:"none"}),jQuery(".bwg_slideshow_description_text_"+r).css({display:"none"}),"width"==bwg_params[r].width_or_height?bwg_params[r].bwg_current_filmstrip_pos=t*(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+r).width()+2+2*bwg_params[r].lightbox_filmstrip_thumb_border_width):bwg_params[r].bwg_current_filmstrip_pos=t*(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+r).height()+2+2*bwg_params[r].lightbox_filmstrip_thumb_border_width),e=t,bwg_params[r].bwg_current_key=e,jQuery("#bwg_slideshow_image_"+r).attr("image_id",i[t].id),jQuery(".bwg_slideshow_title_text_"+r).html(jQuery('<span style="display: block;" />').html(i[t].alt).text()),jQuery(".bwg_slideshow_description_text_"+r).html(jQuery('<span style="display: block;" />').html(i[t].description).text());var s=2==jQuery(".bwg_slideshow_image_spun_"+r).css("zIndex")?".bwg_slideshow_image_spun_"+r:".bwg_slideshow_image_second_spun_"+r,o=s==".bwg_slideshow_image_second_spun_"+r?".bwg_slideshow_image_spun_"+r:".bwg_slideshow_image_second_spun_"+r,l=-1<i[t].filetype.indexOf("EMBED_"),n=-1<i[t].filetype.indexOf("INSTAGRAM_POST"),g=-1<i[t].filetype.indexOf("INSTAGRAM_VIDEO"),w=jQuery(s).height(),b=jQuery(s).width(),u='<span class="bwg_slideshow_image_spun1_'+r+'" style="display: '+(l?"block":"table")+' ;width: inherit; height: inherit;"><span class="bwg_slideshow_image_spun2_'+r+'" style="display: '+(l?"block":"table-cell")+'; vertical-align: middle; text-align: center; ">';if(l){if(u+='<span style="height: '+w+"px; width: "+b+'px;" class="bwg_popup_embed bwg_popup_watermark">',g&&(u+='<span class="bwg_inst_play_btn_cont" onclick="bwg_play_instagram_video(this)"><span class="bwg_inst_play"></span></span>'),n){var d=0,h=0;w<b+88?d=(h=w)-88:h=(d=b)+88,u+=spider_display_embed(i[t].filetype,decodeURIComponent(i[t].image_url),i[t].filename,{class:"bwg_embed_frame","data-width":i[t].image_width,"data-height":i[t].image_height,frameborder:"0",allowfullscreen:"allowfullscreen",style:"width:"+d+"px; height:"+h+"px; vertical-align:middle; display:inline-block; position:relative;"})}else u+=spider_display_embed(i[t].filetype,decodeURIComponent(i[t].image_url),i[t].filename,{class:"bwg_embed_frame",frameborder:"0",allowfullscreen:"allowfullscreen",style:"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"});u+="</span>"}else{if("do_nothing"!=bwg_params[r].thumb_click_action){var m="";"open_lightbox"==bwg_params[r].thumb_click_action?m+=' class="bwg_lightbox" data-image-id="'+i[t].id+'"':"redirect_to_url"==bwg_params[r].thumb_click_action&&i[t].redirect_url&&(m+='href="'+i[t].redirect_url+'"'+(bwg_params[r].thumb_link_target&&1==bwg_params[r].thumb_link_target?' target="_blank"':"")),u+="<a "+m+">"}u+='<img style="max-height: '+w+"px !important; max-width: "+b+'px !important; display:inline-block;" ',u+=' class="bwg_slide bwg_slideshow_image_'+r+'" ',u+=' id="bwg_slideshow_image_'+r+'" ',u+=' src="'+bwg_params[r].upload_url+jQuery("<span style='display: block;' />").html(decodeURIComponent(i[t].image_url)).text()+'" alt="'+i[t].alt+'" image_id="'+i[t].id+'" /></a>'}u+="</span></span>",jQuery(o).html(u),bwg_params[r].preload_images&&bwg_preload_images(t,r),window["bwg_"+bwg_params[r].slideshow_effect](s,o,_,r),0<bwg_params[r].enable_slideshow_filmstrip?bwg_move_filmstrip(r):bwg_move_dots(r),i[t].is_embed_video?jQuery("#bwg_slideshow_play_pause_"+r).css({display:"none"}):jQuery("#bwg_slideshow_play_pause_"+r).css({display:""})}bwg_add_lightbox()}function bwg_preload_images_slideshow(e,t){var i=bwg_params[t].data;count=bwg_params[t].preload_images_count/2;var a=i.length;if(a<bwg_params[t].preload_images_count&&(count=0),0!=count)for(var r=e-count;r<e+count;r++){var _=parseInt((r+a)%a),s=-1<i[_].filetype.indexOf("EMBED_");void 0!==i[_]&&(s||jQuery("<img/>").attr("src",bwg_params[t].upload_url+jQuery('<span style="display: block;" />').html(decodeURIComponent(i[_].image_url)).text()))}else for(r=0;r<i.length;r++){s=-1<i[r].filetype.indexOf("EMBED_");void 0!==i[r]&&(s||jQuery("<img/>").attr("src",bwg_params[t].upload_url+jQuery('<span style="display: block;" />').html(decodeURIComponent(i[r].image_url)).text()))}}function bwg_preload_images(e,t){void 0!==t&&""!==t?bwg_preload_images_slideshow(e,t):bwg_preload_images_lightbox(e)}function bwg_popup_resize_slidshow(e){var t=jQuery(".bwg_slideshow_image_wrap_"+e).parent().width(),i=bwg_params[e].data;if(t>=bwg_params[e].image_width){jQuery(".bwg_slideshow_image_wrap_"+e).css({width:bwg_params[e].image_width}),jQuery(".bwg_slideshow_image_wrap_"+e).css({height:bwg_params[e].image_height}),jQuery(".bwg_slideshow_image_container_"+e).css({width:"horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].image_width:bwg_params[e].image_width-bwg_params[e].slideshow_filmstrip_width}),jQuery(".bwg_slideshow_image_container_"+e).css({height:"horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].image_height-bwg_params[e].slideshow_filmstrip_height:bwg_params[e].image_height}),jQuery(".bwg_slideshow_image_"+e).css({cssText:(bwg_params[e].filmstrip_direction,bwg_params[e].image_width)}),jQuery(".bwg_slideshow_embed_"+e).css({cssText:(bwg_params[e].filmstrip_direction,bwg_params[e].image_width)}),bwg_resize_instagram_post(e),bwg_change_watermark_container(e);var a="horizontal"==bwg_params[e].filmstrip_direction?"width: "+bwg_params[e].image_width:"height: "+bwg_params[e].image_height,r="horizontal"==bwg_params[e].filmstrip_direction?"width: "+(bwg_params[e].image_width-40):"height: "+(bwg_params[e].image_height-40);jQuery(".bwg_slideshow_filmstrip_container_"+e).css({cssText:a}),jQuery(".bwg_slideshow_filmstrip_"+e).css({cssText:r}),jQuery(".bwg_slideshow_dots_container_"+e).css({width:bwg_params[e].image_width}),jQuery("#bwg_slideshow_play_pause-ico_"+e).css({fontSize:bwg_params[e].slideshow_play_pause_btn_size}),"image"==bwg_params[e].watermark_type&&jQuery(".bwg_slideshow_watermark_image_"+e).css({maxWidth:bwg_params[e].watermark_width,maxHeight:bwg_params[e].watermark_height}),"text"==bwg_params[e].watermark_type&&jQuery(".bwg_slideshow_watermark_text_"+e+", .bwg_slideshow_watermark_text_"+e+" : hover").css({fontSize:bwg_params[e].watermark_font_size}),jQuery(".bwg_slideshow_title_text_"+e).css({fontSize:2*bwg_params[e].slideshow_title_font_size}),jQuery(".bwg_slideshow_description_text_"+e).css({fontSize:2*bwg_params[e].slideshow_description_font_size})}else jQuery(".bwg_slideshow_image_wrap_"+e).css({width:t}),jQuery(".bwg_slideshow_image_wrap_"+e).css({height:t*bwg_params[e].image_height/bwg_params[e].image_width}),jQuery(".bwg_slideshow_image_container_"+e).css({width:t-("horizontal"==bwg_params[e].filmstrip_direction?0:bwg_params[e].slideshow_filmstrip_width)}),jQuery(".bwg_slideshow_image_container_"+e).css({height:t*bwg_params[e].image_height/bwg_params[e].image_width-("horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].slideshow_filmstrip_height:0)}),jQuery(".bwg_slideshow_image_"+e).css({cssText:"max-width: "+(t-("horizontal"==bwg_params[e].filmstrip_direction?0:bwg_params[e].slideshow_filmstrip_width))+"px !important; max-height: "+(t*(bwg_params[e].image_height/bwg_params[e].image_width)-("horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].slideshow_filmstrip_height:0)-1)+"px !important;"}),jQuery(".bwg_slideshow_embed_"+e).css({cssText:"width: "+(t-("horizontal"==bwg_params[e].filmstrip_direction?0:bwg_params[e].slideshow_filmstrip_width))+"px !important; height: "+(t*(bwg_params[e].image_height/bwg_params[e].image_width)-("horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].slideshow_filmstrip_height:0)-1)+"px !important;"}),bwg_resize_instagram_post(e),bwg_change_watermark_container(e),"horizontal"==bwg_params[e].filmstrip_direction?(jQuery(".bwg_slideshow_filmstrip_container_"+e).css({width:t}),jQuery(".bwg_slideshow_filmstrip_"+e).css({width:t-40})):(jQuery(".bwg_slideshow_filmstrip_container_"+e).css({height:t*bwg_params[e].image_height/bwg_params[e].image_width}),jQuery(".bwg_slideshow_filmstrip_"+e).css({height:t*bwg_params[e].image_height/bwg_params[e].image_width-40})),jQuery(".bwg_slideshow_dots_container_"+e).css({width:t}),jQuery("#bwg_slideshow_play_pause-ico_"+e).css({fontSize:t*bwg_params[e].slideshow_play_pause_btn_size/bwg_params[e].image_width}),jQuery(".bwg_slideshow_watermark_image_"+e).css({maxWidth:t*bwg_params[e].watermark_width/bwg_params[e].image_width,maxHeight:t*bwg_params[e].watermark_height/bwg_params[e].image_width}),jQuery(".bwg_slideshow_watermark_text_"+e+", .bwg_slideshow_watermark_text_"+e+":hover").css({fontSize:t*bwg_params[e].watermark_font_size/bwg_params[e].image_width}),jQuery(".bwg_slideshow_title_text_"+e).css({fontSize:2*t*bwg_params[e].slideshow_title_font_size/bwg_params[e].image_width}),jQuery(".bwg_slideshow_description_text_"+e).css({fontSize:2*t*bwg_params[e].slideshow_description_font_size/bwg_params[e].image_width}),jQuery(".bwg_slideshow_image_"+e).css({display:"inline-block"});i[parseInt(jQuery("#bwg_current_image_key_"+e).val())].is_embed_video?jQuery("#bwg_slideshow_play_pause_"+e).css({display:"none"}):jQuery("#bwg_slideshow_play_pause_"+e).css({display:""})}function bwg_popup_resize(e){void 0!==e&&""!==e?bwg_popup_resize_slidshow(e):bwg_popup_resize_lightbox()}function bwg_change_image(e,t,i,a,r){void 0!==r&&""!==r?bwg_change_image_slideshow(e,t,i,a,r):bwg_change_image_lightbox(e,t,i=gallery_box_data.data,a)}function bwg_resize_instagram_post(e){if(void 0!==e&&""!==e){if(jQuery(".inner_instagram_iframe_bwg_embed_frame_"+e).length){var t=jQuery(".bwg_slideshow_embed_"+e).width(),i=jQuery(".bwg_slideshow_embed_").height();jQuery(".inner_instagram_iframe_bwg_embed_frame_"+e).each(function(){var e=jQuery(this).parent();i/(parseInt(e.attr("data-height"))+96)<t/parseInt(e.attr("data-width"))?(e.height(i),e.width((e.height()-96)*e.attr("data-width")/e.attr("data-height")+16)):(e.width(t),e.height((e.width()-16)*e.attr("data-height")/e.attr("data-width")+96))}),bwg_change_watermark_container(e)}}else if(jQuery(".inner_instagram_iframe_bwg_embed_frame").length){t=jQuery(".bwg_image_container").width(),i=jQuery(".bwg_image_container").height();jQuery(".inner_instagram_iframe_bwg_embed_frame").each(function(){var e=jQuery(this).parent();i/(parseInt(e.attr("data-height"))+176)<t/parseInt(e.attr("data-width"))?(e.height(i),e.width((e.height()-176)*e.attr("data-width")/e.attr("data-height")+16)):(e.width(t),e.height((e.width()-16)*e.attr("data-height")/e.attr("data-width")+96)),e.css({top:.5*(i-e.height())})}),bwg_change_watermark_container()}}function bwg_play(t,i){if(void 0!==i&&""!==i)t=bwg_params[i].data;void 0!==i&&""!==i?(window.clearInterval(window["bwg_playInterval"+i]),window["bwg_playInterval"+i]=setInterval(function(){var e=1;1==bwg_params[i].enable_slideshow_shuffle&&(e=Math.floor((t.length-1)*Math.random()+1)),bwg_change_image(parseInt(jQuery("#bwg_current_image_key_"+i).val()),(parseInt(jQuery("#bwg_current_image_key_"+i).val())+e)%t.length,t,"",i)},1e3*bwg_params[i].slideshow_interval)):(window.clearInterval(gallery_box_data.bwg_playInterval),gallery_box_data.bwg_playInterval=setInterval(function(){jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_play_pause").length&&jQuery(".bwg_play_pause").hasClass("bwg-icon-play")||(void 0===t||void 0!==t[parseInt(jQuery("#bwg_current_image_key").val())+1]?bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),parseInt(jQuery("#bwg_current_image_key").val())+1):1==gallery_box_data.enable_loop&&bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),0))},1e3*gallery_box_data.slideshow_interval))}function bwg_image_browser(e){if(jQuery("#bwg_embed_frame_16x9_"+e).width(jQuery("#bwg_embed_frame_16x9_"+e).parents(".image_browser_image_buttons_"+e).width()),jQuery("#bwg_embed_frame_16x9_"+e).height(.5625*jQuery("#bwg_embed_frame_16x9_"+e).width()),jQuery("#bwg_embed_frame_instapost_"+e).width(jQuery("#bwg_embed_frame_16x9_"+e).parents(".image_browser_image_buttons_"+e).width()),jQuery(".image_browser_images_conteiner_"+e).find(".fluid-width-video-wrapper").length){var t=jQuery(".image_browser_images_conteiner_"+e).find(".fluid-width-video-wrapper").contents();jQuery(".image_browser_images_conteiner_"+e).find(".fluid-width-video-wrapper").replaceWith(t)}jQuery(".bwg_embed_frame_instapost_"+e).height((jQuery(".bwg_embed_frame_instapost_"+e).width()-16)*jQuery(".bwg_embed_frame_instapost_"+e).attr("data-height")/jQuery(".bwg_embed_frame_instapost_"+e).attr("data-width")+96);var i=jQuery(".image_browser_images_"+e).width();i<=108?jQuery(".paging-input_"+e).css("display","none"):(i<=200?(jQuery(".paging-input_"+e).css("margin","0% 0% 0% 0%"),jQuery(".paging-input_"+e).css("display","inline")):i<=580?(jQuery(".paging-input_"+e).css("display","inline"),jQuery(".tablenav-pages_"+e+" a").css("font-size","13px"),jQuery(".paging-input_"+e).css("margin","0% 7% 0% 7%")):(jQuery(".tablenav-pages_"+e+" a").css("font-size","15px"),jQuery(".paging-input_"+e).css("margin","0% 14% 0% 14%"),jQuery(".paging-input_"+e).css("display","inline")),jQuery(".tablenav-pages_"+e+" .next-page").css("margin","0% 0% 0% 0%"),jQuery(".tablenav-pages_"+e+" .prev-page").css("margin","0% 0% 0% 0%"))}function bwg_disable_right_click(e){e.bind("contextmenu",function(){return!1}),e.css("webkitTouchCallout","none")}jQuery(document).ready(function(){bwg_main_ready(),jQuery(".bwg_container").each(function(){var e=!1;if(0<jQuery(this).find(".wd_error").length&&(e=!0),!e){var t=0;jQuery(this).on("visibility",function(){var e=jQuery(this);setInterval(function(){e.is(":hidden")?1==t&&(t=0,bwg_slideshow_blur()):0==t&&(t=1,bwg_main_ready(),bwg_slideshow_focus())},300)}).trigger("visibility")}})}),jQuery(window).on("resize",function(){setTimeout(function(){var e=!1;jQuery(".bwg_container").each(function(){0<jQuery(this).find(".wd_error").length&&(e=!0)}),e||(jQuery(".bwg-thumbnails, .bwg-masonry-thumbnails, .bwg-album-thumbnails").each(function(){bwg_all_thumnails_loaded(this)}),bwg_slideshow_resize(),bwg_image_browser_resize(),bwg_carousel_resize(),bwg_blog_style_resize(),jQuery(".bwg-mosaic-thumbnails").each(function(){bwg_thumbnail_mosaic(this)})),bwg_resize_search_line()},0)}),jQuery(window).on("load",function(){var e=!1;jQuery(".bwg_container").each(function(){0<jQuery(this).find(".wd_error").length&&(e=!0)}),e||(bwg_blog_style_onload(),jQuery(".bwg-mosaic-thumbnails").each(function(){bwg_thumbnail_mosaic(this)}))}),jQuery(".bwg-masonry-thumb-span img, .bwg-mosaic-thumb-span img").on("error",function(){jQuery(this).height(100),jQuery(this).width(100)});
1
+ var bwg_current_filmstrip_pos,total_thumbnail_count,key,startPoint,endPoint,bwg_image_info_pos,filmstrip_width,preloadCount,filmstrip_thumbnail_width,filmstrip_thumbnail_height,addthis_share,lightbox_comment_pos,bwg_transition_duration,bwg_playInterval,isPopUpOpened=!1,bwg_overflow_initial_value=!1,bwg_overflow_x_initial_value=!1,bwg_overflow_y_initial_value=!1;function gallery_box_ready(){filmstrip_thumbnail_width=jQuery(".bwg_filmstrip_thumbnail").width(),filmstrip_thumbnail_height=jQuery(".bwg_filmstrip_thumbnail").height(),1==gallery_box_data.open_with_fullscreen?(filmstrip_width=jQuery(window).width(),filmstrip_height=jQuery(window).height()):(filmstrip_width=jQuery(".bwg_filmstrip_container").width(),filmstrip_height=jQuery(".bwg_filmstrip_container").height()),preloadCount="horizontal"==gallery_box_data.filmstrip_direction?parseInt(filmstrip_width/filmstrip_thumbnail_width)+gallery_box_data.preload_images_count:parseInt(filmstrip_height/filmstrip_thumbnail_height)+gallery_box_data.preload_images_count,total_thumbnail_count=jQuery(".bwg_filmstrip_thumbnail").length,key=parseInt(jQuery("#bwg_current_image_key").val()),startPoint=0,endPoint=key+preloadCount,jQuery(function(){bwg_load_visible_images(key,preloadCount,total_thumbnail_count),jQuery(".pge_tabs li a").on("click",function(){return jQuery(".pge_tabs_container > div").hide(),jQuery(".pge_tabs li").removeClass("pge_active"),jQuery(jQuery(this).attr("href")).show(),jQuery(this).closest("li").addClass("pge_active"),jQuery("[name=type]").val(jQuery(this).attr("href").substr(1)),!1});var e=jQuery("#bwg_rated").attr("data-params");bwg_rating((e=JSON.parse(e)).current_rate,e.current_rate_count,e.current_avg_rating,e.current_image_key)}),1==gallery_box_data.is_pro&&1==gallery_box_data.enable_addthis&&gallery_box_data.addthis_profile_id&&(addthis_share={url:gallery_box_data.share_url}),lightbox_comment_pos=gallery_box_data.lightbox_comment_pos,bwg_image_info_pos=jQuery(".bwg_ctrl_btn_container").length?jQuery(".bwg_ctrl_btn_container").height():0,bwg_transition_duration=gallery_box_data.slideshow_interval<4*gallery_box_data.slideshow_effect_duration&&0!=gallery_box_data.slideshow_interval?1e3*gallery_box_data.slideshow_interval/4:1e3*gallery_box_data.slideshow_effect_duration,gallery_box_data.bwg_transition_duration=bwg_transition_duration,gallery_box_data.bwg_trans_in_progress=!1,(jQuery("#spider_popup_wrap").width()>=jQuery(window).width()||jQuery("#spider_popup_wrap").height()>=jQuery(window).height())&&jQuery(".spider_popup_close").attr("class","bwg_ctrl_btn spider_popup_close_fullscreen"),window.clearInterval(bwg_playInterval),bwg_current_filmstrip_pos=gallery_box_data.current_pos,jQuery(document).on("keydown",function(e){jQuery("#bwg_name").is(":focus")||jQuery("#bwg_email").is(":focus")||jQuery("#bwg_comment").is(":focus")||jQuery("#bwg_captcha_input").is(":focus")||(39===e.keyCode?bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),parseInt(jQuery("#bwg_current_image_key").val())+1):37===e.keyCode?bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),parseInt(jQuery("#bwg_current_image_key").val())-1):27===e.keyCode?spider_destroypopup(1e3):32===e.keyCode&&jQuery(".bwg_play_pause").trigger("click"))}),jQuery(window).resize(function(){void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&(jQuery.fullscreen.isFullScreen()||bwg_popup_resize())});var r=gallery_box_data.image_width,_=gallery_box_data.image_height;if(1==gallery_box_data.is_pro){1==gallery_box_data.enable_addthis&&gallery_box_data.addthis_profile_id&&jQuery(".at4-share-outer").show(),spider_set_input_value("rate_ajax_task","save_hit_count"),spider_rate_ajax_save("bwg_rate_form");var e=gallery_box_data.data,t=gallery_box_data.current_image_key;jQuery(".bwg_image_hits span").html(++e[t].hit_count);var i=window.location.hash;i&&"-1"!=i.indexOf("bwg")||(location.replace("#bwg"+gallery_box_data.gallery_id+"/"+gallery_box_data.current_image_id),history.replaceState(void 0,void 0,"#bwg"+gallery_box_data.gallery_id+"/"+gallery_box_data.current_image_id))}1==gallery_box_data.image_right_click&&(jQuery(".bwg_image_wrap").bind("contextmenu",function(e){return!1}),jQuery(".bwg_image_wrap").css("webkitTouchCallout","none")),jQuery("#spider_popup_wrap").bind("touchmove",function(e){e.preventDefault()}),void 0!==jQuery().swiperight&&jQuery.isFunction(jQuery().swiperight)&&jQuery("#spider_popup_wrap .bwg_image_wrap").swiperight(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+gallery_box_data.data.length-1)%gallery_box_data.data.length),!1}),void 0!==jQuery().swipeleft&&jQuery.isFunction(jQuery().swipeleft)&&jQuery("#spider_popup_wrap .bwg_image_wrap").swipeleft(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+1)%gallery_box_data.data.length),!1}),bwg_reset_zoom();var a=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click";jQuery("#spider_popup_left").on(a,function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+gallery_box_data.data.length-1)%gallery_box_data.data.length),!1}),jQuery("#spider_popup_right").on(a,function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),(parseInt(jQuery("#bwg_current_image_key").val())+1)%gallery_box_data.data.length),!1}),-1!=navigator.appVersion.indexOf("MSIE 10")||-1!=navigator.appVersion.indexOf("MSIE 9")?setTimeout(function(){bwg_popup_resize()},1):bwg_popup_resize(),jQuery(".bwg_watermark").css({display:"none"}),setTimeout(function(){bwg_change_watermark_container()},500),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&(jQuery.fullscreen.isNativelySupported()||jQuery(".bwg_fullscreen").hide()),"horizontal"==gallery_box_data.filmstrip_direction?(jQuery(".bwg_image_container").height(jQuery(".bwg_image_wrap").height()-gallery_box_data.image_filmstrip_height),jQuery(".bwg_image_container").width(jQuery(".bwg_image_wrap").width())):(jQuery(".bwg_image_container").height(jQuery(".bwg_image_wrap").height()),jQuery(".bwg_image_container").width(jQuery(".bwg_image_wrap").width()-gallery_box_data.image_filmstrip_width)),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".bwg_comments,.bwg_ecommerce_panel, .bwg_image_info").mCustomScrollbar({scrollInertia:150,advanced:{updateOnContentResize:!0}});var s=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";jQuery(".bwg_filmstrip").on(s,function(e){var t=window.event||e,i=(t=t.originalEvent?t.originalEvent:t).detail?-40*t.detail:t.wheelDelta,a=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase());0<i?jQuery(".bwg_filmstrip_left").trigger(a?"touchend":"click"):jQuery(".bwg_filmstrip_right").trigger(a?"touchend":"click")}),jQuery(".bwg_filmstrip_right").on(a,function(){jQuery(".bwg_filmstrip_thumbnails").stop(!0,!1),"left"==gallery_box_data.left_or_top?"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_thumbnails").position().left>=-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().left<-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({left:-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().left-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500)):(jQuery(".bwg_filmstrip_thumbnails").position().left>=-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().left<-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({left:-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().left-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500)):"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_thumbnails").position().top>=-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().top<-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({left:-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().top-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").width()-jQuery(".bwg_filmstrip").width())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500)):(jQuery(".bwg_filmstrip_thumbnails").position().top>=-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&(jQuery(".bwg_filmstrip_left").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().top<-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width+gallery_box_data.all_images_right_left_space))?jQuery(".bwg_filmstrip_thumbnails").animate({top:-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height()-gallery_box_data.all_images_right_left_space)},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({top:jQuery(".bwg_filmstrip_thumbnails").position().top-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_filmstrip_thumbnails").position().left==-(jQuery(".bwg_filmstrip_thumbnails").height()-jQuery(".bwg_filmstrip").height())&&jQuery(".bwg_filmstrip_right").css({opacity:.3})},500))}),"left"==gallery_box_data.left_or_top?jQuery(".bwg_filmstrip_left").on(a,function(){jQuery(".bwg_filmstrip_thumbnails").stop(!0,!1),jQuery(".bwg_filmstrip_thumbnails").position().left<0&&(jQuery(".bwg_filmstrip_right").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().left>-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)?jQuery(".bwg_filmstrip_thumbnails").animate({left:0},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({left:jQuery(".bwg_filmstrip_thumbnails").position().left+gallery_box_data.image_filmstrip_width+gallery_box_data.filmstrip_thumb_right_left_space},500,"linear")),window.setTimeout(function(){0==jQuery(".bwg_filmstrip_thumbnails").position().left&&jQuery(".bwg_filmstrip_left").css({opacity:.3})},500)}):jQuery(".bwg_filmstrip_left").on(a,function(){jQuery(".bwg_filmstrip_thumbnails").stop(!0,!1),jQuery(".bwg_filmstrip_thumbnails").position().top<0&&(jQuery(".bwg_filmstrip_right").css({opacity:1}),jQuery(".bwg_filmstrip_thumbnails").position().top>-(gallery_box_data.filmstrip_thumb_right_left_space+gallery_box_data.image_filmstrip_width)?jQuery(".bwg_filmstrip_thumbnails").animate({top:0},500,"linear"):jQuery(".bwg_filmstrip_thumbnails").animate({top:jQuery(".bwg_filmstrip_thumbnails").position().top+gallery_box_data.image_filmstrip_width+gallery_box_data.filmstrip_thumb_right_left_space},500,"linear")),window.setTimeout(function(){0==jQuery(".bwg_filmstrip_thumbnails").position().top&&jQuery(".bwg_filmstrip_left").css({opacity:.3})},500)}),"width"==gallery_box_data.width_or_height?bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip").width(),"",gallery_box_data):bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip").height(),"",gallery_box_data),jQuery(".bwg_info").on(a,function(){if("none"==jQuery(".bwg_image_info_container1").css("display")){jQuery(".bwg_image_info_container1").css("display","table-cell"),jQuery(".bwg_info").attr("title",bwg_objectsL10n.bwg_hide_info);jQuery(".bwg_ctrl_btn_container").length&&jQuery(".bwg_ctrl_btn_container").height();jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set()}else jQuery(".bwg_image_info_container1").css("display","none"),jQuery(".bwg_info").attr("title",bwg_objectsL10n.bwg_show_info)}),jQuery(".bwg_rate").on(a,function(){"none"==jQuery(".bwg_image_rate_container1").css("display")?(jQuery(".bwg_image_rate_container1").css("display","table-cell"),jQuery(".bwg_rate").attr("title",bwg_objectsL10n.bwg_hide_rating)):(jQuery(".bwg_image_rate_container1").css("display","none"),jQuery(".bwg_rate").attr("title",bwg_objectsL10n.bwg_show_rating))}),jQuery(".bwg_comment, .bwg_comments_close_btn").on(a,function(){bwg_comment()}),jQuery(".bwg_ecommerce, .bwg_ecommerce_close_btn").on(a,function(){bwg_ecommerce()}),jQuery(".bwg_toggle_container").on(a,function(){var e="top"==gallery_box_data.lightbox_ctrl_btn_pos?"bwg-icon-caret-up":"bwg-icon-caret-down",t="top"==gallery_box_data.lightbox_ctrl_btn_pos?"bwg-icon-caret-down":"bwg-icon-caret-up";jQuery(".bwg_toggle_container i").hasClass(e)?(gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_rate_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_rate_pos||jQuery(".bwg_image_rate").animate({top:0},500):jQuery(".bwg_image_rate").animate({bottom:0},500),gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_hit_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_hit_pos||jQuery(".bwg_image_hit").animate({top:0},500):jQuery(".bwg_image_hit").animate({bottom:0},500),"bottom"==gallery_box_data.lightbox_ctrl_btn_pos?(jQuery(".bwg_ctrl_btn_container").animate({bottom:"-"+jQuery(".bwg_ctrl_btn_container").height()},500).addClass("closed"),jQuery(".bwg_toggle_container").animate({bottom:0},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+t)}})):(jQuery(".bwg_ctrl_btn_container").animate({top:"-"+jQuery(".bwg_ctrl_btn_container").height()},500).addClass("closed"),jQuery(".bwg_toggle_container").animate({top:0},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+t)}}))):(gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_rate_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_rate_pos||jQuery(".bwg_image_rate").animate({top:jQuery(".bwg_ctrl_btn_container").height()},500):jQuery(".bwg_image_rate").animate({bottom:jQuery(".bwg_ctrl_btn_container").height()},500),gallery_box_data.enable_image_filmstrip&&"bottom"==gallery_box_data.lightbox_filmstrip_pos||"bottom"!=gallery_box_data.lightbox_ctrl_btn_pos||"bottom"!=gallery_box_data.lightbox_hit_pos?gallery_box_data.enable_image_filmstrip&&"top"==gallery_box_data.lightbox_filmstrip_pos||"top"!=gallery_box_data.lightbox_ctrl_btn_pos||"top"!=gallery_box_data.lightbox_hit_pos||jQuery(".bwg_image_hit").animate({top:jQuery(".bwg_ctrl_btn_container").height()},500):jQuery(".bwg_image_hit").animate({bottom:jQuery(".bwg_ctrl_btn_container").height()},500),"bottom"==gallery_box_data.lightbox_ctrl_btn_pos?(jQuery(".bwg_ctrl_btn_container").animate({bottom:0},500).removeClass("closed"),jQuery(".bwg_toggle_container").animate({bottom:jQuery(".bwg_ctrl_btn_container").height()},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+e)}})):(jQuery(".bwg_ctrl_btn_container").animate({top:0},500).removeClass("closed"),jQuery(".bwg_toggle_container").animate({top:jQuery(".bwg_ctrl_btn_container").height()},{duration:500,complete:function(){jQuery(".bwg_toggle_container i").attr("class","bwg_toggle_btn "+e)}}))),bwg_info_position(!0)});var o=window.innerHeight;jQuery(".bwg_resize-full").on(a,function(){bwg_resize_full()}),jQuery(".bwg_fullscreen").on(a,function(){jQuery(".bwg_watermark").css({display:"none"});var e,t=0;if((jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(t=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width()),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen))if(jQuery.fullscreen.isFullScreen())jQuery.fullscreen.exit(),e=o,jQuery(window).width()>gallery_box_data.image_width&&(r=gallery_box_data.image_width),window.innerHeight>gallery_box_data.image_height&&(_=gallery_box_data.image_height),gallery_box_data.open_with_fullscreen&&(r=jQuery(window).width(),_=e),jQuery("#spider_popup_wrap").on("fscreenclose",function(){jQuery("#spider_popup_wrap").css({width:r,height:_,left:"50%",top:"50%",marginLeft:-r/2,marginTop:-_/2,zIndex:1e5}),jQuery(".bwg_image_wrap").css({width:r-t}),jQuery(".bwg_image_container").css({height:_-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:r-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxWidth:r-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:_-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:r-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:_-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),bwg_resize_instagram_post(),bwg_change_watermark_container(),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").css({width:r-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({width:r-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(r-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").css({height:_-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({height:_-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(_-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:_-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").show(),jQuery(".bwg_resize-full").attr("class","bwg-icon-expand bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_maximize),jQuery(".bwg_fullscreen").attr("class","bwg-icon-arrows-out bwg_ctrl_btn bwg_fullscreen"),jQuery(".bwg_fullscreen").attr("title",bwg_objectsL10n.bwg_fullscreen),jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<window.innerHeight&&jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close")});else{jQuery("#spider_popup_wrap").fullscreen();var i=screen.width,a=screen.height;jQuery("#spider_popup_wrap").css({width:i,height:a,left:0,top:0,margin:0,zIndex:1e5}),jQuery(".bwg_image_wrap").css({width:i-t}),jQuery(".bwg_image_container").css({height:a-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:i-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxWidth:i-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:a-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:i-t-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:a-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),bwg_resize_instagram_post(),bwg_change_watermark_container(),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").css({width:i-("horizontal"==gallery_box_data.filmstrip_direction?t:0)},500),jQuery(".bwg_filmstrip").css({width:i-("horizontal"==gallery_box_data.filmstrip_direction?t:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(i-("horizontal"==gallery_box_data.filmstrip_direction?t:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").css({height:a-("horizontal"==gallery_box_data.filmstrip_direction)?"comment_container_width":0}),jQuery(".bwg_filmstrip").css({height:a-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(a-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:a-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").hide(),jQuery(".bwg_fullscreen").attr("class","bwg-icon-compress bwg_ctrl_btn bwg_fullscreen"),jQuery(".bwg_fullscreen").attr("title",bwg_objectsL10n.bwg_exit_fullscreen),jQuery(".spider_popup_close").attr("class","bwg_ctrl_btn spider_popup_close_fullscreen")}return!1}),jQuery(".bwg_play_pause, .bwg_popup_image").on(a,function(){jQuery(".bwg_play_pause").length&&jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&!jQuery(".bwg_comment_container").hasClass("bwg_open")?(bwg_play(gallery_box_data.data),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_pause),jQuery(".bwg_play_pause").attr("class","bwg-icon-pause bwg_ctrl_btn bwg_play_pause")):(window.clearInterval(bwg_playInterval),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_play),jQuery(".bwg_play_pause").attr("class","bwg-icon-play bwg_ctrl_btn bwg_play_pause"))}),gallery_box_data.open_with_autoplay&&(bwg_play(gallery_box_data.data),jQuery(".bwg_play_pause").attr("title",bwg_objectsL10n.bwg_pause),jQuery(".bwg_play_pause").attr("class","bwg-icon-pause bwg_ctrl_btn bwg_play_pause")),gallery_box_data.open_with_fullscreen&&bwg_open_with_fullscreen(),jQuery(".bwg_popup_image").removeAttr("width"),jQuery(".bwg_popup_image").removeAttr("height"),jQuery(window).focus(function(){jQuery(".bwg_play_pause").length&&!jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&bwg_play(gallery_box_data.data)}),jQuery(window).blur(function(){event_stack=[],window.clearInterval(bwg_playInterval)});gallery_box_data.lightbox_ctrl_btn_pos;1==gallery_box_data.open_ecommerce&&setTimeout(function(){bwg_ecommerce()},400),1==gallery_box_data.open_comment&&bwg_comment()}function spider_createpopup(e,t,i,a,r,_,s,o){e=e.replace(/&#038;/g,"&"),isPopUpOpened||(isPopUpOpened=!0,spider_hasalreadyreceivedpopup(_)||spider_isunsupporteduseragent()||(bwg_overflow_initial_value=jQuery("html").css("overflow"),bwg_overflow_x_initial_value=jQuery("html").css("overflow-x"),bwg_overflow_y_initial_value=jQuery("html").css("overflow-y"),jQuery("html").attr("style","overflow:hidden !important;"),jQuery("#bwg_spider_popup_loading_"+t).show(),jQuery("#spider_popup_overlay_"+t).css({display:"block"}),jQuery.ajax({type:"GET",url:e,success:function(e){var t=jQuery('<div id="spider_popup_wrap" class="spider_popup_wrap" style=" width:'+i+"px; height:"+a+"px; margin-top:-"+a/2+"px; margin-left: -"+i/2+'px; ">'+e+"</div>").hide().appendTo("body");gallery_box_ready(),spider_showpopup(_,s,t,r,o)},beforeSend:function(){},complete:function(){}})))}function spider_showpopup(e,t,i,a,r){var _=gallery_box_data.data,s=parseInt(jQuery("#bwg_current_image_key").val());void 0!==_[s]&&(isPopUpOpened=!0,-1<_[s].filetype.indexOf("EMBED_")?bwg_first_image_load(i,r):jQuery("#spider_popup_wrap .bwg_popup_image_spun img").prop("complete")?bwg_first_image_load(i,r):jQuery("#spider_popup_wrap .bwg_popup_image_spun img").on("load error",function(){bwg_first_image_load(i,r)}),spider_receivedpopup(e,t))}function bwg_first_image_load(e,t){e.show();var i=jQuery(".bwg_ctrl_btn_container").height();"bottom"==t?jQuery(".bwg_toggle_container").css("bottom",i+"px"):"top"==t&&jQuery(".bwg_toggle_container").css("top",i+"px"),jQuery(".bwg_spider_popup_loading").hide(),1==gallery_box_data.preload_images&&bwg_preload_images(parseInt(jQuery("#bwg_current_image_key").val())),bwg_load_filmstrip(),bwg_info_height_set()}function spider_hasalreadyreceivedpopup(e){return-1<document.cookie.indexOf(e)&&delete document.cookie[document.cookie.indexOf(e)],!1}function spider_receivedpopup(e,t){var i=new Date;i.setDate(i.getDate()+t),document.cookie=e+"=true;expires="+i.toUTCString()+";path=/"}function spider_isunsupporteduseragent(){return!window.XMLHttpRequest}function spider_destroypopup(e){null!=document.getElementById("spider_popup_wrap")&&(void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&jQuery.fullscreen.isFullScreen()&&jQuery.fullscreen.exit(),"undefined"!=typeof enable_addthis&&enable_addthis&&jQuery(".at4-share-outer").hide(),setTimeout(function(){jQuery(".spider_popup_wrap").remove(),jQuery(".bwg_spider_popup_loading").css({display:"none"}),jQuery(".spider_popup_overlay").css({display:"none"}),jQuery(document).off("keydown"),!1!==bwg_overflow_initial_value&&jQuery("html").css("overflow",bwg_overflow_initial_value),!1!==bwg_overflow_x_initial_value&&jQuery("html").css("overflow-x",bwg_overflow_x_initial_value),!1!==bwg_overflow_y_initial_value&&jQuery("html").css("overflow-y",bwg_overflow_y_initial_value)},20)),isPopUpOpened=!1;var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),i=document.querySelector('meta[name="viewport"]');t&&i&&(i.content="width=device-width, initial-scale=1");var a=jQuery(document).scrollTop();bwg_objectsL10n.is_pro&&location.replace("#"),jQuery(document).scrollTop(a),void 0!==gallery_box_data.bwg_playInterval&&clearInterval(gallery_box_data.bwg_playInterval)}function get_ajax_pricelist(){var e={};return jQuery(".add_to_cart_msg").html(""),e.ajax_task="display",e.image_id=jQuery("#bwg_popup_image").attr("image_id"),jQuery("#ecommerce_ajax_loading").css("height",jQuery(".bwg_ecommerce_panel").css("height")),jQuery("#ecommerce_opacity_div").css("width",jQuery(".bwg_ecommerce_panel").css("width")),jQuery("#ecommerce_opacity_div").css("height",jQuery(".bwg_ecommerce_panel").css("height")),jQuery("#ecommerce_loading_div").css("width",jQuery(".bwg_ecommerce_panel").css("width")),jQuery("#ecommerce_loading_div").css("height",jQuery(".bwg_ecommerce_panel").css("height")),jQuery("#ecommerce_opacity_div").css("display","block"),jQuery("#ecommerce_loading_div").css("display","table-cell"),jQuery.ajax({type:"POST",url:jQuery("#bwg_ecommerce_form").attr("action"),data:e,success:function(e){jQuery(".pge_tabs li a").on("click",function(){return jQuery(".pge_tabs_container > div").hide(),jQuery(".pge_tabs li").removeClass("pge_active"),jQuery(jQuery(this).attr("href")).show(),jQuery(this).closest("li").addClass("pge_active"),jQuery("[name=type]").val(jQuery(this).attr("href").substr(1)),!1});var t=jQuery(e).find(".manual").html();jQuery(".manual").html(t);var i=jQuery(e).find(".downloads").html();jQuery(".downloads").html(i);var a=jQuery(e).find(".pge_options").html();jQuery(".pge_options").html(a);var r=jQuery(e).find(".pge_add_to_cart").html();jQuery(".pge_add_to_cart").html(r)},beforeSend:function(){},complete:function(){jQuery("#ecommerce_opacity_div").css("display","none"),jQuery("#ecommerce_loading_div").css("display","none")}}),!1}function spider_ajax_save(e){var t={};return t.bwg_name=jQuery("#bwg_name").val(),t.bwg_comment=jQuery("#bwg_comment").val(),t.bwg_email=jQuery("#bwg_email").val(),t.bwg_captcha_input=jQuery("#bwg_captcha_input").val(),t.ajax_task=jQuery("#ajax_task").val(),t.image_id=jQuery("#image_id").val(),t.comment_id=jQuery("#comment_id").val(),jQuery("#ajax_loading").css("height",jQuery(".bwg_comments").css("height")),jQuery("#opacity_div").css("width",jQuery(".bwg_comments").css("width")),jQuery("#opacity_div").css("height",jQuery(".bwg_comments").css("height")),jQuery("#loading_div").css("width",jQuery(".bwg_comments").css("width")),jQuery("#loading_div").css("height",jQuery(".bwg_comments").css("height")),document.getElementById("opacity_div").style.display="",document.getElementById("loading_div").style.display="table-cell",jQuery.ajax({type:"POST",url:jQuery("#"+e).attr("action"),data:t,success:function(e){var t=jQuery(e).find(".bwg_comments").html();jQuery(".bwg_comments").html(t)},beforeSend:function(){},complete:function(){document.getElementById("opacity_div").style.display="none",document.getElementById("loading_div").style.display="none",jQuery(".bwg_comments").mCustomScrollbar({scrollInertia:150,advanced:{updateOnContentResize:!0}}),jQuery(".bwg_comments_close_btn").click(bwg_comment),bwg_captcha_refresh("bwg_captcha")}}),!1}function spider_rate_ajax_save(i){var e={};return e.image_id=jQuery("#"+i+" input[name='image_id']").val(),e.rate=jQuery("#"+i+" input[name='score']").val(),e.ajax_task=jQuery("#rate_ajax_task").val(),jQuery.ajax({type:"POST",url:jQuery("#"+i).attr("action"),data:e,success:function(e){var t=jQuery(e).find("#"+i).html();jQuery("#"+i).html(t)},beforeSend:function(){},complete:function(){}})}function spider_set_input_value(e,t){document.getElementById(e)&&(document.getElementById(e).value=t)}function spider_form_submit(e,t){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function spider_check_required(e,t){return""==jQuery("#"+e).val()&&(alert(t+" "+bwg_objectsL10n.bwg_field_required),jQuery("#"+e).attr("style","border-color: #FF0000;"),jQuery("#"+e).focus(),!0)}function comment_check_privacy_policy(){var e=jQuery("#bwg_submit");e.removeClass("bwg-submit-disabled"),e.removeAttr("disabled"),jQuery("#bwg_comment_privacy_policy").is(":checked")||(e.addClass("bwg-submit-disabled"),e.attr("disabled","disabled"))}function spider_check_email(e){if(""!=jQuery("#"+e).val())return-1==jQuery("#"+e).val().replace(/^\s+|\s+$/g,"").search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)&&(alert(bwg_objectsL10n.bwg_mail_validation),!0)}function bwg_captcha_refresh(e){document.getElementById(e+"_img")&&document.getElementById(e+"_input")&&(srcArr=document.getElementById(e+"_img").src.split("&r="),document.getElementById(e+"_img").src=srcArr[0]+"&r="+Math.floor(100*Math.random()),document.getElementById(e+"_img").style.display="inline-block",document.getElementById(e+"_input").value="")}function bwg_play_instagram_video(e,t){jQuery(e).parent().find("video").each(function(){jQuery(this).get(0).paused?(jQuery(this).get(0).play(),jQuery(e).children().hide()):(jQuery(this).get(0).pause(),jQuery(e).children().show())})}function bwg_add_comment(){var t=jQuery("#bwg_comment_form"),e=t.attr("action"),i={ajax_task:"add_comment"};return i.comment_name=t.find("#bwg_name").val(),i.comment_email=t.find("#bwg_email").val(),i.comment_text=t.find("#bwg_comment").val(),i.comment_captcha=t.find("#bwg_captcha_input").val(),i.privacy_policy=t.find("#bwg_comment_privacy_policy").is(":checked")?1:0,i.comment_image_id=jQuery("#bwg_popup_image").attr("image_id"),i.comment_moderation=t.find("#bwg_comment_moderation").val(),jQuery(".bwg_spider_ajax_loading").hide(),jQuery.ajax({url:e,type:"POST",dataType:"json",data:i,success:function(e){jQuery(".bwg_comment_error").text(""),1==e.error?jQuery.each(e.error_messages,function(e,t){t&&jQuery(".bwg_comment_"+e+"_error").text(t)}):(t.find("#bwg_comment").val(""),jQuery(".bwg_comment_waiting_message").hide(),0==e.published&&jQuery(".bwg_comment_waiting_message").show(),""!=e.html_comments_block&&jQuery("#bwg_added_comments").html(e.html_comments_block).show())},beforeSend:function(){jQuery(".bwg_spider_ajax_loading").show()},complete:function(){0<t.find("#bwg_comment_privacy_policy").length&&(t.find("#bwg_comment_privacy_policy").prop("checked",!1),comment_check_privacy_policy()),bwg_captcha_refresh("bwg_captcha"),jQuery(".bwg_spider_ajax_loading").hide()},error:function(){}}),!1}function bwg_remove_comment(t){var e=jQuery("#bwg_comment_form").attr("action"),i={ajax_task:"delete_comment"};return i.id_image=jQuery("#bwg_popup_image").attr("image_id"),i.id_comment=t,jQuery.ajax({url:e,type:"POST",dataType:"json",data:i,success:function(e){0==e.error&&jQuery("#bwg_comment_block_"+t).fadeOut("slow").remove()},beforeSend:function(){},complete:function(){},error:function(){}}),!1}function bwg_gallery_box(e,t,i,a){jQuery(".bwg-validate").each(function(){jQuery(this).on("keypress change",function(){jQuery(this).parent().next().find(".bwg_comment_error").html("")})}),void 0===i&&(i=!1);var r,_=t.data("bwg");r=t.find(".bwg-container").data("lightbox-url")?t.find(".bwg-container").data("lightbox-url"):t.data("lightbox-url");var s=t.find(".cur_gal_id").val(),o=jQuery("#bwg_tag_id_"+s).val();o=o||0;var l=1==i?"&open_ecommerce=1":"",n=jQuery("#bwg_search_input_"+_).val(),g=jQuery("#bwg_order_"+_).val()?"&filtersortby="+jQuery("#bwg_order_"+_).val():"";n=n||"",void 0!==a&&(r+="&gallery_id="+a);var w="",b=jQuery("#bwg_blog_style_share_buttons_"+e).attr("data-open-comment");void 0!==b&&!1!==b&&(w="&open_comment=1"),spider_createpopup(r+"&bwg_random_seed="+jQuery("#bwg_random_seed_"+_).val()+"&image_id="+e+"&filter_tag="+o+l+w+"&filter_search_name="+n+g,_,t.data("popup-width"),t.data("popup-height"),1,"testpopup",5,t.data("buttons-position"))}function bwg_change_image_lightbox(e,a,r,t){if(jQuery("#bwg_rate_form input[name='image_id']").val(r[a].id),bwg_current_key=gallery_box_data.bwg_current_key,jQuery(".bwg_image_info").css("height","auto"),setTimeout(function(){bwg_info_height_set(),jQuery(".bwg_image_description").height()>jQuery(".bwg_image_info").height()&&jQuery(".mCSB_container").hasClass("mCS_no_scrollbar")&&jQuery(".bwg_image_info").mCustomScrollbar("destroy"),jQuery(".bwg_image_info").hasClass("mCustomScrollbar")||void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".bwg_image_info").mCustomScrollbar({scrollInertia:150,advanced:{updateOnContentResize:!0}})},200),jQuery("#spider_popup_left").show(),jQuery("#spider_popup_right").show(),jQuery(".bwg_image_info").hide(),0==gallery_box_data.enable_loop&&(a==parseInt(r.length)-1&&jQuery("#spider_popup_right").hide(),0==a&&jQuery("#spider_popup_left").hide()),1==gallery_box_data.ecommerceACtive&&1==gallery_box_data.enable_image_ecommerce)if(0==gallery_box_data.data[a].pricelist)jQuery(".bwg_ecommerce").hide();else{jQuery(".bwg_ecommerce").show(),jQuery(".pge_tabs li").hide(),jQuery("#downloads").hide(),jQuery("#manual").hide();var i=gallery_box_data.data[a].pricelist_sections.split(",");if(i)if(jQuery("#"+i[0]).show(),jQuery("[name=type]").val(i[0]),1<i.length)for(jQuery(".pge_tabs").show(),k=0;k<i.length;k++)jQuery("#"+i[k]+"_li").show();else jQuery(".pge_tabs").hide();else jQuery("[name=type]").val("")}if(jQuery("#bwg_image_container").find("iframe").each(function(){jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*"),jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }',"*"),jQuery(this)[0].contentWindow.postMessage("pause","*")}),jQuery("#bwg_image_container").find("video").each(function(){jQuery(this).trigger("pause")}),void 0===r&&(r=gallery_box_data.data),void 0!==r[a]&&void 0!==r[e]){if(jQuery(".bwg_play_pause").length&&!jQuery(".bwg_play_pause").hasClass("bwg-icon-play")&&bwg_play(r),t||jQuery("#bwg_current_image_key").val(a),gallery_box_data.bwg_trans_in_progress)return void gallery_box_data.event_stack.push(e+"-"+a);var _="right";if(bwg_current_key>a)_="left";else if(bwg_current_key==a)return;jQuery(".bwg_image_count").html(r[a].number),jQuery(".bwg_watermark").css({display:"none"}),"width"==gallery_box_data.width_or_height?bwg_current_filmstrip_pos=a*(jQuery(".bwg_filmstrip_thumbnail").width()+2+2*gallery_box_data.lightbox_filmstrip_thumb_border_width):"height"==gallery_box_data.width_or_height&&(bwg_current_filmstrip_pos=a*(jQuery(".bwg_filmstrip_thumbnail").height()+2+2*gallery_box_data.lightbox_filmstrip_thumb_border_width)),gallery_box_data.bwg_current_key=a,bwg_objectsL10n.is_pro&&(location.replace("#bwg"+gallery_box_data.gallery_id+"/"+r[a].id),history.replaceState(void 0,void 0,"#bwg"+gallery_box_data.gallery_id+"/"+r[a].id)),jQuery("#bwg_rate_form input[name='image_id']").val(r[a].id),gallery_box_data.popup_enable_rate&&(jQuery("#bwg_star").attr("data-score",r[a].avg_rating),jQuery("#bwg_star").removeAttr("title"),r[a].cur_key=a,bwg_rating(r[a].rate,r[a].rate_count,r[a].avg_rating,a)),spider_set_input_value("rate_ajax_task","save_hit_count"),spider_rate_ajax_save("bwg_rate_form"),jQuery(".bwg_image_hits span").html(++r[a].hit_count),jQuery("#bwg_popup_image").attr("image_id",r[a].id),jQuery(".bwg_image_title").html(jQuery("<span />").html(r[a].alt).text()),jQuery(".bwg_image_description").html(jQuery("<span />").html(r[a].description).text()),jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+a).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active"),jQuery(".bwg_image_info").css("opacity",1),""==r[a].alt.trim()&&""==r[a].description.trim()&&jQuery(".bwg_image_info").css("opacity",0),"none"!=jQuery(".bwg_image_info_container1").css("display")?jQuery(".bwg_image_info_container1").css("display","table-cell"):jQuery(".bwg_image_info_container1").css("display","none"),"none"!=jQuery(".bwg_image_rate_container1").css("display")?jQuery(".bwg_image_rate_container1").css("display","table-cell"):jQuery(".bwg_image_rate_container1").css("display","none");var s=2==jQuery(".bwg_popup_image_spun").css("zIndex")?".bwg_popup_image_spun":".bwg_popup_image_second_spun",o=".bwg_popup_image_second_spun"==s?".bwg_popup_image_spun":".bwg_popup_image_second_spun",l=-1<r[a].filetype.indexOf("EMBED_"),n=-1<r[a].filetype.indexOf("INSTAGRAM_POST"),g=-1<r[a].filetype.indexOf("INSTAGRAM_VIDEO"),w=-1!==jQuery.inArray(r[a].filetype,["EMBED_OEMBED_YOUTUBE_VIDEO","EMBED_OEMBED_VIMEO_VIDEO","EMBED_OEMBED_FACEBOOK_VIDEO","EMBED_OEMBED_DAILYMOTION_VIDEO"]),b=jQuery(s).height(),u=jQuery(s).width(),d='<span class="bwg_popup_image_spun1" style="display: '+(l?"block":"table")+'; width: inherit; height: inherit;"><span class="bwg_popup_image_spun2" style="display:'+(l?"block":"table-cell")+'; vertical-align: middle;text-align: center;height: 100%;">';if(l){if(jQuery("#bwg_download").addClass("bwg-hidden"),d+='<span class="bwg_popup_embed bwg_popup_watermark" style="display: '+(w?"block":"table")+'; table-layout: fixed; height: 100%;">'+(g?'<div class="bwg_inst_play_btn_cont" onclick="bwg_play_instagram_video(this)" ><div class="bwg_inst_play"></div></div>':" "),n){var h=0,m=0;b<u+88?h=(m=b)-88:m=(h=u)+88,d+=spider_display_embed(r[a].filetype,r[a].image_url,r[a].filename,{class:"bwg_embed_frame","data-width":r[a].image_width,"data-height":r[a].image_height,frameborder:"0",allowfullscreen:"allowfullscreen",style:"width:"+h+"px; height:"+m+"px; vertical-align:middle; display:inline-block; position:relative;"})}else d+=spider_display_embed(r[a].filetype,r[a].image_url,r[a].filename,{class:"bwg_embed_frame",frameborder:"0",allowfullscreen:"allowfullscreen",style:"display:"+(w?"block":"table-cell")+"; width:inherit; height:inherit; vertical-align:middle;"});d+="</span>"}else jQuery(".bwg-loading").removeClass("bwg-hidden"),jQuery("#bwg_download").removeClass("bwg-hidden"),d+='<img style="max-height: '+b+"px; max-width: "+u+'px;" class="bwg_popup_image bwg_popup_watermark" src="'+gallery_box_data.site_url+jQuery("<span />").html(decodeURIComponent(r[a].image_url)).text()+'" alt="'+r[a].alt+'" />';function p(){gallery_box_data.preload_images&&bwg_preload_images(a),window["bwg_"+gallery_box_data.bwg_image_effect](s,o,_),jQuery(s).find(".bwg_fb_video").each(function(){jQuery(this).attr("src","")}),l?jQuery("#bwg_fullsize_image").attr("href",decodeURIComponent(r[a].image_url)):(jQuery("#bwg_fullsize_image").attr("href",gallery_box_data.site_url+decodeURIComponent(r[a].image_url)),jQuery("#bwg_download").attr("href",gallery_box_data.site_url+decodeURIComponent(r[a].thumb_url).replace("/thumb/","/.original/")));var e=decodeURIComponent(r[a].image_url).split("/");jQuery("#bwg_download").attr("download",e[e.length-1].replace(/\?bwg=(\d+)$/,""));var t=encodeURIComponent(gallery_box_data.bwg_share_url)+"="+r[a].id+encodeURIComponent("#bwg"+gallery_box_data.gallery_id+"/")+r[a].id;if(l)var i=encodeURIComponent(r[a].thumb_url);else i=gallery_box_data.bwg_share_image_url+encodeURIComponent(encodeURIComponent(r[a].pure_image_url));i=i.replace(/%252F|%25252F/g,"%2F"),void 0!==addthis_share&&(addthis_share.url=t),jQuery("#bwg_facebook_a").attr("href","https://www.facebook.com/sharer/sharer.php?u="+t),jQuery("#bwg_twitter_a").attr("href","https://twitter.com/share?url="+t),jQuery("#bwg_pinterest_a").attr("href","http://pinterest.com/pin/create/button/?s=100&url="+t+"&media="+i+"&description="+r[a].alt+"%0A"+r[a].description),jQuery("#bwg_tumblr_a").attr("href","https://www.tumblr.com/share/photo?source="+i+"&caption="+r[a].alt+"&clickthru="+t),jQuery(".bwg_comment_container").hasClass("bwg_open")&&(jQuery(".bwg_comments .mCSB_container").css("top","0"),jQuery("#bwg_added_comments").show(),spider_set_input_value("ajax_task","display"),spider_set_input_value("image_id",jQuery("#bwg_popup_image").attr("image_id")),spider_ajax_save("bwg_comment_form")),jQuery(".bwg_ecommerce_container").hasClass("bwg_open")&&(0==r[a].pricelist?(bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")),bwg_animate_image_box_for_hide_sidebar(),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_close"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_show_ecommerce),jQuery(".spider_popup_close_fullscreen").show()):get_ajax_pricelist()),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".bwg_comments").mCustomScrollbar({advanced:{updateOnContentResize:!0}}),jQuery(".bwg_comments .mCSB_scrollTools").hide(),gallery_box_data.enable_image_filmstrip&&bwg_move_filmstrip(),bwg_resize_instagram_post()}if(d+="</span></span>",jQuery(o).html(d),jQuery(o).find("img").on("load error",function(){jQuery(".bwg-loading").addClass("bwg-hidden")}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:u,maxHeight:b,height:"auto"}),l)p();else jQuery(o).find("img").one("load",function(){p()}).each(function(){this.complete&&jQuery(this).load()})}}function bwg_preload_images_lightbox(e){for(var t=gallery_box_data.data,i=t.length,a=0==gallery_box_data.preload_images_count||gallery_box_data.preload_images_count>=i?i:gallery_box_data.preload_images_count,r=0,_=1;r<a;_++){var s=1;do{var o=(e+_*s+i)%i;if(void 0!==t[o])-1<t[o].filetype.indexOf("EMBED_")||jQuery("<img/>").attr("src",gallery_box_data.site_url+jQuery("<span />").html(decodeURIComponent(t[o].image_url)).text());s*=-1,r++}while(1!=s)}}function bwg_popup_sidebar_open(e){var t=gallery_box_data.lightbox_comment_width,i=gallery_box_data.lightbox_comment_pos;if(t>jQuery(window).width()){if(t=jQuery(window).width(),e.css({width:t}),jQuery(".spider_popup_close_fullscreen").hide(),jQuery(".spider_popup_close").hide(),jQuery(".bwg_ctrl_btn").hasClass("bwg-icon-pause")){var a=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase());jQuery(".bwg_play_pause").trigger(a?"touchend":"click")}}else jQuery(".spider_popup_close_fullscreen").show();"left"==i?e.animate({left:0},100):e.animate({right:0},100)}function bwg_comment(){if(jQuery(".bwg_watermark").css({display:"none"}),jQuery(".bwg_ecommerce_wrap").css("z-index","-1"),jQuery(".bwg_comment_wrap").css("z-index","25"),jQuery(".bwg_ecommerce_container").hasClass("bwg_open")&&(bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_close"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_show_ecommerce)),jQuery(".bwg_comment_container").hasClass("bwg_open"))"1"==jQuery(".bwg_comment_container").attr("data-play-status")&&jQuery(".bwg_ctrl_btn.bwg_play_pause").removeClass("bwg-icon-play").addClass("bwg-icon-pause").attr("title",bwg_objectsL10n.bwg_pause),bwg_popup_sidebar_close(jQuery(".bwg_comment_container")),bwg_animate_image_box_for_hide_sidebar(),jQuery(".bwg_comment_wrap").css("z-index","-1"),jQuery(".bwg_comment_container").attr("class","bwg_comment_container bwg_close"),jQuery(".bwg_comment").attr("title",bwg_objectsL10n.bwg_show_comments),jQuery(".spider_popup_close_fullscreen").show();else{jQuery(".bwg_play_pause").hasClass("bwg-icon-pause")?jQuery(".bwg_comment_container").attr("data-play-status","1"):jQuery(".bwg_comment_container").attr("data-play-status","0"),jQuery(".bwg_ctrl_btn.bwg_play_pause").removeClass("bwg-icon-pause").addClass("bwg-icon-play").attr("title",bwg_objectsL10n.bwg_play),bwg_popup_sidebar_open(jQuery(".bwg_comment_container")),bwg_animate_image_box_for_show_sidebar(),jQuery(".bwg_comment_container").attr("class","bwg_comment_container bwg_open"),jQuery(".bwg_comment").attr("title",bwg_objectsL10n.bwg_hide_comments);var e=parseInt(jQuery("#bwg_current_image_key").val());void 0!==gallery_box_data.current_image_key&&0!=gallery_box_data.data[e].comment_count&&(jQuery("#bwg_added_comments").show(),spider_set_input_value("ajax_task","display"),spider_set_input_value("image_id",jQuery("#bwg_popup_image").attr("image_id")),spider_ajax_save("bwg_comment_form"))}jQuery(".bwg_comments").mCustomScrollbar("update",{scrollInertia:150,advanced:{updateOnContentResize:!0}})}function bwg_ecommerce(){jQuery(".bwg_watermark").css({display:"none"}),jQuery(".bwg_ecommerce_wrap").css("z-index","25"),jQuery(".bwg_comment_wrap").css("z-index","-1"),jQuery(".bwg_comment_container").hasClass("bwg_open")&&(bwg_popup_sidebar_close(jQuery(".bwg_comment_container")),jQuery(".bwg_comment_container").attr("class","bwg_comment_container bwg_close"),jQuery(".bwg_comment").attr("title",bwg_objectsL10n.bwg_show_comments)),jQuery(".bwg_ecommerce_container").hasClass("bwg_open")?(bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")),bwg_animate_image_box_for_hide_sidebar(),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_close"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_show_ecommerce)):(bwg_popup_sidebar_open(jQuery(".bwg_ecommerce_container")),bwg_animate_image_box_for_show_sidebar(),jQuery(".bwg_ecommerce_container").attr("class","bwg_ecommerce_container bwg_open"),jQuery(".bwg_ecommerce").attr("title",bwg_objectsL10n.bwg_hide_ecommerce),get_ajax_pricelist())}function bwg_popup_sidebar_close(e){var t=parseInt(e.css("borderRightWidth"));t||(t=0),"left"==lightbox_comment_pos?e.animate({left:-e.width()-t},100):"right"==lightbox_comment_pos&&e.animate({right:-e.width()-t},100)}function bwg_animate_image_box_for_hide_sidebar(){"left"==lightbox_comment_pos?jQuery(".bwg_image_wrap").animate({left:0,width:jQuery("#spider_popup_wrap").width()},100):"right"==lightbox_comment_pos&&jQuery(".bwg_image_wrap").animate({right:0,width:jQuery("#spider_popup_wrap").width()},100),jQuery(".bwg_image_container").animate({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},100),jQuery(".bwg_popup_image").animate({maxWidth:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed").animate({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").animate({width:jQuery(".spider_popup_wrap").width()},100),jQuery(".bwg_filmstrip").animate({width:jQuery(".spider_popup_wrap").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},100)):"height"==gallery_box_data.width_or_height&&(jQuery(".bwg_filmstrip_container").animate({height:jQuery(".spider_popup_wrap").width()},100),jQuery(".bwg_filmstrip").animate({height:jQuery(".spider_popup_wrap").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},100)),bwg_set_filmstrip_pos(jQuery(".spider_popup_wrap").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),jQuery(".spider_popup_close_fullscreen").show(100)}function bwg_animate_image_box_for_show_sidebar(){var e=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width();"left"==lightbox_comment_pos?jQuery(".bwg_image_wrap").animate({left:e,width:jQuery("#spider_popup_wrap").width()-e},100):"right"==lightbox_comment_pos&&jQuery(".bwg_image_wrap").animate({right:e,width:jQuery("#spider_popup_wrap").width()-e},100),jQuery(".bwg_image_container").animate({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e},100),jQuery(".bwg_popup_image").animate({maxWidth:jQuery("#spider_popup_wrap").width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({maxWidth:jQuery("#spider_popup_wrap").width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},{duration:100,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height&&(jQuery(".bwg_filmstrip_container").css({width:jQuery("#spider_popup_wrap").width()-("vertical"==gallery_box_data.filmstrip_direction?0:e)}),jQuery(".bwg_filmstrip").animate({width:jQuery(".bwg_filmstrip_container").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},100),bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip_container").width()-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data))}function bwg_reset_zoom(){var e=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),t=document.querySelector('meta[name="viewport"]');e&&t&&(t.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0")}function bwg_open_with_fullscreen(){jQuery(".bwg_watermark").css({display:"none"});var e=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(e=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width()),bwg_popup_current_width=jQuery(window).width(),bwg_popup_current_height=window.innerHeight,jQuery("#spider_popup_wrap").css({width:jQuery(window).width(),height:window.innerHeight,left:0,top:0,margin:0,zIndex:100002}),jQuery(".bwg_image_wrap").css({width:jQuery(window).width()-e}),jQuery(".bwg_image_container").css({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)}),jQuery(".bwg_popup_image").css({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_video").css({width:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").css({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").css({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)}),jQuery(".bwg_filmstrip").css({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())}),bwg_set_filmstrip_pos(window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?"comment_container_width":0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)),jQuery(".bwg_resize-full").attr("class","bwg-icon-compress bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_restore),jQuery(".spider_popup_close").attr("class","bwg_ctrl_btn spider_popup_close_fullscreen")}function bwg_resize_full(){jQuery(".bwg_watermark").css({display:"none"});var e=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(e=jQuery(".bwg_comment_container").width()||jQuery(".bwg_ecommerce_container").width()),jQuery(".bwg_resize-full").hasClass("bwg-icon-compress")?(jQuery(window).width()>gallery_box_data.image_width&&(bwg_popup_current_width=gallery_box_data.image_width),window.innerHeight>gallery_box_data.image_height&&(bwg_popup_current_height=gallery_box_data.image_height),jQuery("#spider_popup_wrap").animate({width:bwg_popup_current_width,height:bwg_popup_current_height,left:"50%",top:"50%",marginLeft:-bwg_popup_current_width/2,marginTop:-bwg_popup_current_height/2,zIndex:100002},500),jQuery(".bwg_image_wrap").animate({width:bwg_popup_current_width-e},500),jQuery(".bwg_image_container").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},500),jQuery(".bwg_popup_image").animate({maxWidth:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_change_watermark_container(),jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<window.innerHeight&&jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close")}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({maxWidth:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container(),jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<window.innerHeight&&jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close")}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").animate({width:bwg_popup_current_width-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({width:bwg_popup_current_width-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(bwg_popup_current_width-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(bwg_popup_current_height-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:bwg_popup_current_height-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").attr("class","bwg-icon-expand bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_maximize),setTimeout(function(){bwg_info_height_set()},500)):(bwg_popup_current_width=jQuery(window).width(),bwg_popup_current_height=window.innerHeight,jQuery("#spider_popup_wrap").animate({width:jQuery(window).width(),height:window.innerHeight,left:0,top:0,margin:0,zIndex:100002},500),jQuery(".bwg_image_wrap").animate({width:jQuery(window).width()-e},500),jQuery(".bwg_image_container").animate({height:bwg_popup_current_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0),width:bwg_popup_current_width-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)},500),jQuery(".bwg_popup_image").animate({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_change_watermark_container()}}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({maxWidth:jQuery(window).width()-e-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0),maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)},{duration:500,complete:function(){bwg_resize_instagram_post(),bwg_change_watermark_container()}}),"width"==gallery_box_data.width_or_height?(jQuery(".bwg_filmstrip_container").animate({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({width:jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(jQuery(window).width()-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data)):(jQuery(".bwg_filmstrip_container").animate({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?e:0)},500),jQuery(".bwg_filmstrip").animate({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())},500),bwg_set_filmstrip_pos(window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?e:0)-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height()),"",gallery_box_data),"horizontal"!=gallery_box_data.filmstrip_direction&&jQuery(".bwg_filmstrip_right").css({top:window.innerHeight-jQuery(".bwg_filmstrip_right").height()})),jQuery(".bwg_resize-full").attr("class","bwg-icon-compress bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_restore),jQuery(".spider_popup_close").attr("class","bwg_ctrl_btn spider_popup_close_fullscreen")),setTimeout(function(){bwg_info_height_set()},500)}function bwg_popup_resize_lightbox(){void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&(jQuery.fullscreen.isFullScreen()||(jQuery(".bwg_resize-full").show(),jQuery(".bwg_resize-full").hasClass("bwg-icon-compress")||jQuery(".bwg_resize-full").attr("class","bwg-icon-expand bwg_ctrl_btn bwg_resize-full"),jQuery(".bwg_resize-full").attr("title",bwg_objectsL10n.bwg_maximize),jQuery(".bwg_fullscreen").attr("class","bwg-icon-arrows-out bwg_ctrl_btn bwg_fullscreen"),jQuery(".bwg_fullscreen").attr("title",bwg_objectsL10n.fullscreen)));var e=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(e=gallery_box_data.lightbox_comment_width),e>jQuery(window).width()?(e=jQuery(window).width(),jQuery(".bwg_comment_container").css({width:e}),jQuery(".bwg_ecommerce_container").css({width:e}),jQuery(".spider_popup_close_fullscreen").hide()):jQuery(".spider_popup_close_fullscreen").show(),window.innerHeight>gallery_box_data.image_height&&1!=gallery_box_data.open_with_fullscreen&&!jQuery(".bwg_resize-full").hasClass("bwg-icon-compress")?(jQuery("#spider_popup_wrap").css({height:gallery_box_data.image_height,top:"50%",marginTop:-gallery_box_data.image_height/2,zIndex:100002}),jQuery(".bwg_image_container").css({height:gallery_box_data.image_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxHeight:gallery_box_data.image_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxHeight:gallery_box_data.image_height-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),"vertical"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({height:gallery_box_data.image_height}),jQuery(".bwg_filmstrip").css({height:gallery_box_data.image_height-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_height=gallery_box_data.image_height):(jQuery("#spider_popup_wrap").css({height:window.innerHeight,top:0,marginTop:0,zIndex:100002}),jQuery(".bwg_image_container").css({height:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxHeight:window.innerHeight-("horizontal"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_height:0)}),"vertical"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({height:window.innerHeight}),jQuery(".bwg_filmstrip").css({height:window.innerHeight-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_height=window.innerHeight),jQuery(window).width()>=gallery_box_data.image_width&&1!=gallery_box_data.open_with_fullscreen?(jQuery("#spider_popup_wrap").css({width:gallery_box_data.image_width,left:"50%",marginLeft:-gallery_box_data.image_width/2,zIndex:100002}),jQuery(".bwg_image_wrap").css({width:gallery_box_data.image_width-e}),jQuery(".bwg_image_container").css({width:gallery_box_data.image_width-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_image_info").css("height","auto"),bwg_info_height_set(),jQuery(".bwg_popup_image").css({maxWidth:gallery_box_data.image_width-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:gallery_box_data.image_width-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),"horizontal"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({width:gallery_box_data.image_width-e}),jQuery(".bwg_filmstrip").css({width:gallery_box_data.image_width-e-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_width=gallery_box_data.image_width):(jQuery("#spider_popup_wrap").css({width:jQuery(window).width(),left:0,marginLeft:0,zIndex:100002}),jQuery(".bwg_image_wrap").css({width:jQuery(window).width()-e}),jQuery(".bwg_image_container").css({width:jQuery(window).width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_popup_image").css({maxWidth:jQuery(window).width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({maxWidth:jQuery(window).width()-("vertical"==gallery_box_data.filmstrip_direction?gallery_box_data.image_filmstrip_width:0)-e}),"horizontal"==gallery_box_data.filmstrip_direction&&(jQuery(".bwg_filmstrip_container").css({width:jQuery(window).width()-e}),jQuery(".bwg_filmstrip").css({width:jQuery(window).width()-e-2*("horizontal"==gallery_box_data.filmstrip_direction?jQuery(".bwg_filmstrip_right").width():jQuery(".bwg_filmstrip_right").height())})),bwg_popup_current_width=jQuery(window).width()),bwg_resize_instagram_post(),bwg_change_watermark_container(),window.innerHeight>gallery_box_data.image_height-2*gallery_box_data.lightbox_close_btn_top&&jQuery(window).width()>=gallery_box_data.image_width-2*gallery_box_data.lightbox_close_btn_right&&1!=gallery_box_data.open_with_fullscreen?jQuery(".spider_popup_close_fullscreen").attr("class","spider_popup_close"):jQuery("#spider_popup_wrap").width()<jQuery(window).width()&&jQuery("#spider_popup_wrap").height()<jQuery(window).height()&&jQuery(".spider_popup_close").attr("class","bwg_ctrl_btn spider_popup_close_fullscreen");var t=jQuery(".bwg_ctrl_btn_container").height();"bottom"==gallery_box_data.lightbox_ctrl_btn_pos&&jQuery(".bwg_toggle_container i").hasClass("bwg-icon-caret-down")&&jQuery(".bwg_toggle_container").css("bottom",t+"px"),"top"==gallery_box_data.lightbox_ctrl_btn_pos&&jQuery(".bwg_toggle_container i").hasClass("bwg-icon-caret-up")&&jQuery(".bwg_toggle_container").css("top",t+"px")}function bwg_rating(e,t,i,a){lightbox_rate_stars_count=gallery_box_data.lightbox_rate_stars_count,lightbox_rate_size=gallery_box_data.lightbox_rate_size,lightbox_rate_icon=gallery_box_data.lightbox_rate_icon;var r="Not rated yet.";0!=i&&""!=i&&(r=parseFloat(i).toFixed(1)+"\n Votes: "+t),void 0!==jQuery().raty&&jQuery.isFunction(jQuery().raty)&&jQuery("#bwg_star").raty({score:function(){return jQuery(this).attr("data-score")},starType:"i",number:lightbox_rate_stars_count,size:lightbox_rate_size,readOnly:function(){return!!e},noRatedMsg:"Not rated yet.",click:function(t,e){jQuery("#bwg_star").hide(),jQuery("#bwg_rated").show(),spider_set_input_value("rate_ajax_task","save_rate"),jQuery.when(spider_rate_ajax_save("bwg_rate_form")).then(function(){gallery_box_data.data[a].rate=t,++gallery_box_data.data[a].rate_count;var e=parseFloat(jQuery("#bwg_star").attr("data-score"));gallery_box_data.data[a].avg_rating=e?((e+t)/2).toFixed(1):t.toFixed(1),bwg_rating(gallery_box_data.data[a].rate,gallery_box_data.data[a].rate_count,gallery_box_data.data[a].avg_rating,gallery_box_data.current_image_key)})},starHalf:"bwg-icon-"+lightbox_rate_icon+("star"==lightbox_rate_icon?"-half":"")+"-o",starOff:"bwg-icon-"+lightbox_rate_icon+"-o",starOn:"bwg-icon-"+lightbox_rate_icon,cancelOff:"bwg-icon-minus-square-o",cancelOn:"bwg-icon-minus-square-o",cancel:!1,cancelHint:"Cancel your rating.",hints:[r,r,r,r,r],alreadyRatedMsg:parseFloat(i).toFixed(1)+"\nYou have already rated.\nVotes: "+t})}function changeDownloadsTotal(e){var t=0;0==jQuery("[name=option_show_digital_items_count]").val()?jQuery("[name=selected_download_item]:checked").each(function(){t+=Number(jQuery(this).closest("tr").attr("data-price"))}):jQuery(".digital_image_count").each(function(){0!=Number(jQuery(this).val())&&(t+=Number(jQuery(this).closest("tr").attr("data-price"))*Number(jQuery(this).val()))}),t=t.toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),jQuery(".product_downloads_price").html(t)}function changeMenualTotal(e){Number(jQuery(e).val())<=0&&jQuery(e).val("1");var t=Number(jQuery(e).val()),i=Number(jQuery(".product_manual_price").attr("data-actual-price"));i=(i*=t).toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),jQuery(".product_manual_price").html(i)}function onSelectableParametersChange(e){var t=0,i=gallery_box_data.data[jQuery("#bwg_current_image_key").val()].pricelist_manual_price?gallery_box_data.data[jQuery("#bwg_current_image_key").val()].pricelist_manual_price:"0";i=parseFloat(i.replace(",",""));var a=jQuery(e).closest(".image_selected_parameter").attr("data-parameter-type"),r=jQuery(e).val();r=r.split("*");var _=parseFloat(r[1]),s=r[0],o=Number(jQuery(e).closest(".image_selected_parameter").find(".already_selected_values").val());if("4"==a||"5"==a){var l=parseFloat(s+_);jQuery(e).closest(".image_selected_parameter").find(".already_selected_values").val(l)}else if("6"==a){if(0==jQuery(e).is(":checked"))var n=o-parseFloat(s+_);else n=o+parseFloat(s+_);jQuery(e).closest(".image_selected_parameter").find(".already_selected_values").val(n)}jQuery(".already_selected_values").each(function(){t+=Number(jQuery(this).val())}),i+=t,jQuery(".product_manual_price").attr("data-actual-price",i),i=(i*=Number(jQuery(".image_count").val())<=0?1:Number(jQuery(".image_count").val())).toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"),jQuery(".product_manual_price").html(i)}function onBtnClickAddToCart(){var e=jQuery("[name=type]").val();if(""!=e){var t={};if("manual"==e){var i=jQuery(".image_count").val(),a={};jQuery(".manual").find(".image_selected_parameter").each(function(){var e=jQuery(this).attr("data-parameter-id"),t="";switch(jQuery(this).attr("data-parameter-type")){case"2":t=jQuery(this).find("input").val();break;case"3":t=jQuery(this).find("textarea").val();break;case"4":t=jQuery(this).find("select :selected").val();break;case"5":t=jQuery(this).find("[type=radio]:checked").val();break;case"6":var i=[];jQuery(this).find("[type=checkbox]:checked").each(function(){i.push(jQuery(this).val())}),t=i}a[e]=t}),t.count=i,t.parameters=a,t.price=jQuery(".product_manual_price").attr("data-price").replace(",","")}else{var r=[];if(0==jQuery("[name=option_show_digital_items_count]").val()){if(0==jQuery("[name=selected_download_item]:checked").length)return void jQuery(".add_to_cart_msg").html("You must select at least one item.");jQuery("[name=selected_download_item]:checked").each(function(){var e={};e.id=jQuery(this).val(),e.count=1,e.price=jQuery(this).closest("tr").attr("data-price"),r.push(e)})}else jQuery(".digital_image_count").each(function(){var e={};0<jQuery(this).val()&&(e.id=jQuery(this).closest("tr").attr("data-id"),e.price=jQuery(this).closest("tr").attr("data-price"),e.count=jQuery(this).val(),r.push(e))});if(0==(t.downloadItems=r).length)return void jQuery(".add_to_cart_msg").html("Please select at least one item")}var _=jQuery("#ajax_url").val(),s={action:"add_cart",task:"add_cart",controller:"checkout",image_id:jQuery("#bwg_popup_image").attr("image_id"),type:e,data:JSON.stringify(t)};jQuery.ajax({type:"POST",url:_,data:s,success:function(e){responseData=JSON.parse(e),jQuery(".add_to_cart_msg").html(responseData.msg),jQuery(".products_in_cart").html(responseData.products_in_cart),1==responseData.redirect&&(window.location.href="<?php echo get_permalink($options->checkout_page);?>")},beforeSend:function(){},complete:function(){}})}else jQuery(".add_to_cart_msg").html("Please select Prints and products or Downloads")}function onBtnViewCart(){var e=jQuery("[name=option_checkout_page]").val();jQuery("#bwg_ecommerce_form").attr("action",e),jQuery("#bwg_ecommerce_form").submit()}function bwg_load_visible_images(e,t,i){0<=e-t&&(startPoint=e-t),i<e+t&&(endPoint=i);for(var a=startPoint;a<=endPoint;a++){var r=jQuery("#bwg_filmstrip_thumbnail_"+a+" img");r.removeClass("bwg-hidden"),r.attr("src",r.data("url"))}}function bwg_load_filmstrip(){for(var e=1;e<=total_thumbnail_count;e++){var t;if(leftIndex=startPoint-e,rightIndex=endPoint+e,rightIndex<total_thumbnail_count)(t=jQuery("#bwg_filmstrip_thumbnail_"+rightIndex+" img")).removeClass("bwg-hidden"),t.attr("src",t.data("url"));if(0<=leftIndex)(t=jQuery("#bwg_filmstrip_thumbnail_"+leftIndex+" img")).removeClass("bwg-hidden"),t.attr("src",t.data("url"))}jQuery(".bwg_filmstrip_thumbnail").each(function(){var e=jQuery(this).find("img");void 0===e.attr("style")&&(0==e.width()?e.on("load",function(){jQuery(this).find(".bwg_filmstrip_thumbnail_img_wrap"),bwg_filmstrip_thumb_view(e)}):(jQuery(this).find(".bwg_filmstrip_thumbnail_img_wrap"),bwg_filmstrip_thumb_view(e)))})}function bwg_filmstrip_thumb_view(e){var t=gallery_box_data.image_filmstrip_height,i=gallery_box_data.image_filmstrip_width,a=i-gallery_box_data.filmstrip_thumb_right_left_space,r=t,_=Math.max(i/e.width(),t/e.height()),s=e.width()*_,o=e.height()*_;e.css({width:s,height:o,marginLeft:(a-s)/2,marginTop:(r-o)/2})}function bwg_info_height_set(){bwg_info_position(!1),jQuery(".mCustomScrollBox").length&&jQuery(".bwg_image_info_container1").height()<jQuery(".mCustomScrollBox").height()+jQuery(".bwg_toggle_container").height()+bwg_image_info_pos+2*parseInt(gallery_box_data.lightbox_info_margin)&&jQuery(".bwg_image_info").css({height:jQuery(".bwg_image_info_container1").height()-jQuery(".bwg_toggle_container").height()-bwg_image_info_pos-2*parseInt(gallery_box_data.lightbox_info_margin)})}function bwg_info_position(e){var t=0,i="none";"top"==gallery_box_data.lightbox_ctrl_btn_pos?"top"==gallery_box_data.lightbox_info_pos&&(i="top"):"bottom"==gallery_box_data.lightbox_info_pos&&(i="bottom"),jQuery(".bwg_ctrl_btn_container").hasClass("closed")||("top"==gallery_box_data.lightbox_ctrl_btn_pos?"top"==gallery_box_data.lightbox_info_pos&&(t=jQuery(".bwg_ctrl_btn_container").height()):"bottom"==gallery_box_data.lightbox_info_pos&&(t=jQuery(".bwg_ctrl_btn_container").height())),"top"==i?0==e?jQuery(".bwg_image_info").css("top",t):jQuery(".bwg_image_info").animate({top:t+"px"},500):"bottom"==i&&(0==e?jQuery(".bwg_image_info").css("bottom",t):jQuery(".bwg_image_info").animate({bottom:t+"px"},500))}function spider_display_embed(e,t,i,a){var r="";switch(e){case"EMBED_OEMBED_YOUTUBE_VIDEO":var _="<iframe ";for(attr in""!=i&&(_+=' src="//www.youtube.com/embed/'+i+'?enablejsapi=1&wmode=transparent"'),a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(_+=" "+attr+'="'+a[attr]+'"');r+=_+=" ></iframe>";break;case"EMBED_OEMBED_VIMEO_VIDEO":var s="<iframe ";for(attr in""!=i&&(s+=' src="//player.vimeo.com/video/'+i+'?enablejsapi=1"'),a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(s+=" "+attr+'="'+a[attr]+'"');r+=s+=" ></iframe>";break;case"EMBED_OEMBED_FLICKR_IMAGE":var o="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(o+=" "+attr+'="'+a[attr]+'"');o+=" >",""!=i&&(o+='<img src="'+i+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;">'),r+=o+="</div>";break;case"EMBED_OEMBED_FLICKR_VIDEO":break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":var l="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"');l+=" >",""!=i&&(l+='<video style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+i+'" type="video/mp4"> Your browser does not support the video tag. </video>'),r+=l+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":l="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"');l+=" >",""!=i&&(l+='<img src="//instagram.com/p/'+i+'/media/?size=l" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'),r+=l+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_POST":l="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"',"CLASS"!=attr&&"class"!=attr&&"Class"!=attr||(obj_class=a[attr]));l+=" >",""!=i&&(l+='<iframe class="inner_instagram_iframe_'+obj_class+'" src="//instagr.am/p/'+i+'/embed/?enablejsapi=1" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'),r+=l+="</div>";break;case"EMBED_OEMBED_FACEBOOK_IMAGE":var n="<span ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(n+=" "+attr+'="'+a[attr]+'"');n+=" >",""!=i&&(n+='<img src="'+t+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:100%;">'),r+=n+="</span>";break;case"EMBED_OEMBED_FACEBOOK_VIDEO":var g="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(g+=" "+attr+'="'+a[attr]+'"');g+=" >",""!=i&&(g+='<iframe src="//www.facebook.com/video/embed?video_id='+t+'&enablejsapi=1&wmode=transparent" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" class="bwg_fb_video" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'),r+=g+="</div>";break;case"EMBED_OEMBED_DAILYMOTION_VIDEO":var w="<iframe ";for(attr in""!=i&&(w+=' src="//www.dailymotion.com/embed/video/'+i+'?api=postMessage"'),a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(w+=" "+attr+'="'+a[attr]+'"');r+=w+=" ></iframe>";break;case"EMBED_OEMBED_IMGUR":var b="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(l+=" "+attr+'="'+a[attr]+'"');b+=" >",""!=i&&(b+='<img src="'+i+'" style="max-width:100% !important; max-height:100% !important; width:auto; height:auto !important;">'),r+=b+="</div>";break;case"EMBED_OEMBED_GOOGLE_PHOTO_IMAGE":var u="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(u+=" "+attr+'="'+a[attr]+'"');u+=" >",""!=i&&(u+='<img src="'+t+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'),r+=u+="</div>";break;default:var d={content:""};jQuery(document).trigger("bwg_display_embed",[d,e,t,i,a]),r=d.content}return r}function bwg_add_instagram_gallery(e,s){if(!0===(s=void 0!==s&&s)){if(bwg_check_instagram_gallery_input(e,s))return!1;var t="0";1==jQuery("input[name=popup_instagram_post_gallery]:checked").val()&&(t="1");var i=encodeURI(jQuery("#popup_instagram_gallery_source").val()),a=encodeURI(jQuery("#popup_instagram_image_number").val())}else{if(bwg_check_instagram_gallery_input(e,s))return!1;if(!bwg_check_gallery_empty(!1,!0))return!1;t="0";1==jQuery("input[name=instagram_post_gallery]:checked").val()&&(t="1");i=encodeURI(jQuery("#gallery_source").val());var r=jQuery("input[name=update_flag]:checked").val();a=encodeURI(jQuery("#autogallery_image_number").val())}jQuery("#bulk_embed").hide(),jQuery("#loading_div").show();var o=[],_={action:"addInstagramGallery",instagram_user:i,instagram_access_token:e,whole_post:t,autogallery_image_number:a,update_flag:r,async:!0};jQuery.post(ajax_url,_,function(e){if(0==e)return alert("Error: cannot get response from the server."),jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1;var t=e.indexOf("WD_delimiter_start"),i=e.indexOf("WD_delimiter_end");if(-1==t||-1==i)return jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1;if(e=e.substring(t+18,i),response_JSON=JSON.parse(e),response_JSON){if("error"==response_JSON[0])return alert("Error: "+JSON.parse(e)[1]),jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1;for(var a=response_JSON.length,r=1;r<=a;r++)if(0!=response_JSON[a-r]){var _=response_JSON[a-r];o.push(_)}return bwg_add_image(o),s||(bwg_gallery_update_flag(),jQuery("#tr_instagram_gallery_add_button").hide()),jQuery("#loading_div").hide(),s&&jQuery(".opacity_bulk_embed").hide(),"ok"}return alert("There is some error. Cannot add Instagram gallery."),jQuery("#loading_div").hide(),s&&jQuery("#bulk_embed").show(),!1})}var bwg=0,isMobile=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),bwg_click=isMobile?"touchend":"click",bwg_params=[],bwg_params_ib=[],bwg_params_carousel=[];function bwg_main_ready(){1==bwg_objectsL10n.lazy_load&&jQuery(function(){jQuery("img.bwg_lazyload").lazy({onFinishedAll:function(){jQuery(".lazy_loader").removeClass("lazy_loader")}})}),jQuery(".bwg_container").each(function(){0<jQuery(this).find(".wd_error").length&&bwg_container_loaded(jQuery(this).data("bwg"))}),bwg_document_ready(),jQuery(".bwg-thumbnails, .bwg-masonry-thumbnails, .bwg-album-thumbnails").each(function(){bwg_all_thumnails_loaded(this)}),jQuery(".bwg-mosaic-thumbnails").each(function(){bwg_thumbnail_mosaic(this)}),bwg_slideshow_ready(),bwg_carousel_ready(),bwg_carousel_onload(),bwg_image_browser_ready()}function bwg_resize_search_line(){jQuery(".search_line").each(function(){var e=jQuery(this);e.width()<410?e.addClass("bwg-search-line-responsive"):e.removeClass("bwg-search-line-responsive")})}function bwg_slideshow_resize(){jQuery(".bwg_slideshow").each(function(){bwg=jQuery(this).attr("data-bwg"),jQuery("#bwg_slideshow_image_container_"+bwg).length&&(bwg_params[bwg]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+bwg).attr("data-params")),bwg_params[bwg].event_stack=[],bwg_popup_resize(bwg))})}function bwg_blog_style_resize(){jQuery(".bwg_blog_style").each(function(){bwg=jQuery(this).attr("data-bwg"),jQuery(".bwg_embed_frame_16x9_"+bwg).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height(.5625*jQuery(this).width())}),jQuery(".bwg_embed_frame_instapost_"+bwg).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height((jQuery(this).width()-16)*jQuery(this).attr("data-height")/jQuery(this).attr("data-width")+96)})})}function bwg_blog_style_onload(){jQuery(".bwg_blog_style").each(function(){bwg=jQuery(this).attr("data-bwg");jQuery("#bwg_blog_style_"+bwg);jQuery(".bwg_embed_frame_16x9_"+bwg).each(function(e){if(jQuery(".bwg_blog_style_image_"+bwg).find(".fluid-width-video-wrapper").length){jQuery(".fluid-width-video-wrapper").removeAttr("style");var t=jQuery(this).parents(".bwg_blog_style_image_"+bwg).find(".fluid-width-video-wrapper").contents();jQuery(this).parents(".fluid-width-video-wrapper").replaceWith(t)}jQuery(this).width(jQuery(this).parents(".bwg_blog_style_image_"+bwg).width()),jQuery(this).height(.5625*jQuery(this).width())}),jQuery(".bwg_embed_frame_instapost_"+bwg).each(function(e){jQuery(this).width(jQuery(this).parents(".bwg_blog_style_image_"+bwg).width()),jQuery(this).height((jQuery(this).width()-16)*jQuery(this).attr("data-height")/jQuery(this).attr("data-width")+96)}),bwg_container_loaded(bwg)})}function bwg_blog_style_ready(){jQuery(".bwg_blog_style").each(function(){var e=jQuery(this).attr("data-bwg");bwg_container_loaded(e);var t=!1;jQuery(this).find(".bwg_lightbox_"+e).on("click",function(){var e=jQuery(this).attr("data-image-id");if(jQuery("#bwg_blog_style_share_buttons_"+e).removeAttr("data-open-comment"),!t)return t=!0,setTimeout(function(){t=!1},100),bwg_gallery_box(e,jQuery(this).closest(".bwg_container")),!1}),jQuery(".bwg_lightbox_"+e+" .bwg_ecommerce").on("click",function(e){if(e.stopPropagation(),!t)return t=!0,setTimeout(function(){t=!1},100),bwg_gallery_box(jQuery(this).attr("data-image-id"),jQuery(this).closest(".bwg_container"),!0),!1});var i=window.location.hash.substring(1);i&&"-1"!=i.indexOf("bwg")&&(bwg_hash_array=i.replace("bwg","").split("/"),"<?php echo $params_array['gallery_id']; ?>"==bwg_hash_array[0]&&bwg_gallery_box(bwg_hash_array[1]))})}function bwg_slideshow_focus(){jQuery(".bwg_slideshow").each(function(){bwg=jQuery(this).attr("data-bwg"),jQuery("#bwg_slideshow_image_container_"+bwg).length&&(bwg_params[bwg]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+bwg).attr("data-params")),bwg_params[bwg].event_stack=[],window.clearInterval(window["bwg_playInterval"+bwg]),jQuery(".bwg_ctrl_btn_"+bwg).hasClass("bwg-icon-play")||bwg_play(bwg_params[bwg].data,bwg))})}function bwg_slideshow_blur(){jQuery(".bwg_slideshow").each(function(){bwg=jQuery(this).attr("data-bwg"),jQuery("#bwg_slideshow_image_container_"+bwg).length&&(bwg_params[bwg]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+bwg).attr("data-params")),bwg_params[bwg].event_stack=[],window.clearInterval(window["bwg_playInterval"+bwg]))})}function bwg_carousel_ready(){jQuery(".bwg-carousel").each(function(){var t=jQuery(this).data("bwg");bwg_params_carousel[t]=[],bwg_params_carousel[t].bwg_currentCenterNum=1,bwg_params_carousel[t].bwg_currentlyMoving=!1,bwg_params_carousel[t].data=[],jQuery("#spider_carousel_left-ico_"+t).on("click",function(e){bwg_params_carousel[t].carousel.prev(),e.stopPropagation(),e.stopImmediatePropagation()}),jQuery("#spider_carousel_right-ico_"+t).on("click",function(e){bwg_params_carousel[t].carousel.next(),e.stopPropagation(),e.stopImmediatePropagation()}),parseInt(bwg_params_carousel[t].carousel_enable_autoplay)&&(jQuery(".bwg_carousel_play_pause_"+t).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_carousel_play_pause_"+t).attr("class","bwg-icon-pause bwg_ctrl_btn_"+t+" bwg_carousel_play_pause_"+t)),jQuery(".bwg_carousel_play_pause_"+t).on(bwg_click,function(e){jQuery(".bwg_ctrl_btn_"+t).hasClass("bwg-icon-play")?(jQuery(".bwg_carousel_play_pause_"+t).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_carousel_play_pause_"+t).attr("class","bwg-icon-pause bwg_ctrl_btn_"+t+" bwg_carousel_play_pause_"+t),bwg_params_carousel[t].carousel.start()):(jQuery(".bwg_carousel_play_pause_"+t).attr("title",bwg_objectsL10n.play),jQuery(".bwg_carousel_play_pause_"+t).attr("class","bwg-icon-play bwg_ctrl_btn_"+t+" bwg_carousel_play_pause_"+t),bwg_params_carousel[t].carousel.pause()),e.stopPropagation(),e.stopImmediatePropagation()}),void 0!==jQuery().swiperight&&jQuery.isFunction(jQuery().swiperight)&&jQuery("#bwg_container1_"+t).swiperight(function(){bwg_params_carousel[t].carousel.prev()}),void 0!==jQuery().swipeleft&&jQuery.isFunction(jQuery().swipeleft)&&jQuery("#bwg_container1_"+t).swipeleft(function(){bwg_params_carousel[t].carousel.next()})})}function bwg_carousel_resize(){jQuery(".bwg-carousel").each(function(){var e=jQuery(this).data("bwg");bwg_carousel_params(e,!0),bwg_params_carousel[e].carousel.pause(),bwg_carousel_watermark(e),jQuery(".bwg_ctrl_btn_"+e).hasClass("bwg-icon-play")||bwg_params_carousel[e].carousel.start()})}function bwg_carousel_onload(){jQuery(".bwg-carousel").each(function(){var e=jQuery(this).data("bwg");bwg_params_carousel[e]=jQuery(this).data("params"),bwg_params_carousel[e].parent_width=0,bwg_carousel_watermark(e),bwg_carousel_params(e,!1),bwg_container_loaded(e)})}function bwg_carousel_params(t,e){var i=jQuery("#bwg_container1_"+t).parent();i.hasClass("elementor-tab-content")&&i.width(i.closest(".elementor-widget-wrap").width());var a=i.width(),r=1;a<bwg_params_carousel[t].carousel_r_width?r=a/bwg_params_carousel[t].carousel_r_width:a=bwg_params_carousel[t].carousel_r_width,bwg_params_carousel[t].parent_width!=a&&(bwg_params_carousel[t].parent_width=a,bwg_params_carousel[t].carousel_image_column_number>bwg_params_carousel[t].count&&(bwg_params_carousel[t].carousel_image_column_number=bwg_params_carousel[t].count),jQuery(".bwg_carousel_play_pause_"+t).css({display:parseInt(bwg_params_carousel[t].carousel_play_pause_butt)?"":"none"}),parseInt(bwg_params_carousel[t].carousel_prev_next_butt)?(jQuery("#bwg_carousel-right"+t).css({display:""}),jQuery("#bwg_carousel-left"+t).css({display:""})):(jQuery("#bwg_carousel-left"+t).css({display:"none"}),jQuery("#bwg_carousel-right"+t).css({display:"none"})),jQuery(".inner_instagram_iframe_bwg_embed_frame_"+t).each(function(){var e=jQuery(this).parent();bwg_params_carousel[t].image_height/(parseInt(e.attr("data-height"))+96)<bwg_params_carousel[t].image_width/parseInt(e.attr("data-width"))?(e.height(bwg_params_carousel[t].image_height*r),e.width((e.height()-96)*e.attr("data-width")/e.attr("data-height")+16)):(e.width(bwg_params_carousel[t].image_width*r),e.height((e.width()-16)*e.attr("data-height")/e.attr("data-width")+96))}),jQuery(".bwg_carousel_image_container_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_watermark_text_"+t+", .bwg_carousel_watermark_text_"+t+":hover").css({fontSize:a*(bwg_params_carousel[t].watermark_font_size/bwg_params_carousel[t].image_width)*r}),jQuery(".bwg_carousel-image "+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_watermark_container_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_embed_video_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel_watermark_spun_"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_carousel-container"+t).css({width:a,height:bwg_params_carousel[t].image_height*r}),jQuery(".bwg_video_hide"+t).css({width:bwg_params_carousel[t].image_width*r,height:bwg_params_carousel[t].image_height*r}),bwg_params_carousel[t].carousel&&!e||(e&&bwg_params_carousel[t].carousel&&bwg_params_carousel[t].carousel.pause(),bwg_params_carousel[t].carousel=jQuery("#bwg_carousel"+t).featureCarousel({containerWidth:a*r,containerHeight:bwg_params_carousel[t].image_height*r,fit_containerWidth:bwg_params_carousel[t].carousel_fit_containerWidth,largeFeatureWidth:bwg_params_carousel[t].image_width*r,largeFeatureHeight:bwg_params_carousel[t].image_height*r,smallFeaturePar:bwg_params_carousel[t].carousel_image_par,currentlyMoving:!1,startingFeature:bwg_params_carousel[t].bwg_currentCenterNum,featuresArray:[],timeoutVar:null,rotationsRemaining:0,autoPlay:1e3*bwg_params_carousel[t].car_inter,interval:1e3*bwg_params_carousel[t].carousel_interval,imagecount:bwg_params_carousel[t].carousel_image_column_number,bwg_number:t,enable_image_title:bwg_params_carousel[t].enable_image_title,borderWidth:0})))}function bwg_carousel_watermark(e){var t=1,i=jQuery("#bwg_container1_"+e).parent().width();if(i<bwg_params_carousel[e].carousel_r_width&&(t=i/bwg_params_carousel[e].carousel_r_width),i>=bwg_params_carousel[e].image_width)bwg_carousel_change_watermark_container(e),jQuery("#bwg_carousel_play_pause-ico_"+e).css({fontSize:bwg_params_carousel[e].carousel_play_pause_btn_size}),jQuery(".bwg_carousel_watermark_image_"+e).css({maxWidth:bwg_params_carousel[e].watermark_width*t,maxHeight:bwg_params_carousel[e].watermark_height*t}),jQuery(".bwg_carousel_watermark_text_"+e+", .bwg_carousel_watermark_text_"+e+":hover").css({fontSize:t*bwg_params_carousel[e].watermark_font_size});else{var a=bwg_params_carousel[e].image_width/t;bwg_carousel_change_watermark_container(e),jQuery("#bwg_carousel_play_pause-ico_"+e).css({fontSize:i*bwg_params_carousel[e].carousel_play_pause_btn_size/a}),jQuery(".bwg_carousel_watermark_image_"+e).css({maxWidth:i*bwg_params_carousel[e].watermark_width/a,maxHeight:i*bwg_params_carousel[e].watermark_height/a}),jQuery(".bwg_carousel_watermark_text_"+e+", .bwg_carousel_watermark_text_"+e+":hover").css({fontSize:i*bwg_params_carousel[e].watermark_font_size/a})}}function bwg_carousel_change_watermark_container(a){jQuery(".bwg_carousel"+a).children().each(function(){if(2==jQuery(this).css("zIndex")){var e=jQuery(this).find("img");e.length||(e=jQuery(this).find("iframe"));var t=e.width(),i=e.height();jQuery(".bwg_carousel_watermark_spun_"+a).width(t),jQuery(".bwg_carousel_watermark_spun_"+a).height(i),jQuery(".bwg_carousel_title_spun_"+a).width(t),jQuery(".bwg_carouel_title_spun_"+a).height(i),jQuery(".bwg_carousel_watermark_"+a).css({display:"none"})}})}function bwg_carousel_preload(e,t){var i=jQuery(".bwg_carousel_preload").get();t||i.reverse();var a=0;jQuery(i).each(function(){if(1<++a)return!1;jQuery(this).parent().hasClass("bwg_carousel_embed_video_"+e)||jQuery(this).parent().hasClass("bwg_embed_frame_"+e)||jQuery(this).parent().hasClass("bwg_carousel_video")?(jQuery(this).attr("src",jQuery(this).attr("data-src")),jQuery(this).on("load",function(){jQuery(this).removeClass("bwg_carousel_preload")}),jQuery(this).parent().hasClass("bwg_carousel_video")&&(jQuery(".bwg_carousel_video")[0].load(),jQuery(this).parent().parent().removeClass("bwg_carousel_preload")),jQuery(this).removeAttr("data-src")):(jQuery(this).css({"background-image":"url('"+jQuery(this).attr("data-background")+"')",height:"100%"}),jQuery(this).removeClass("bwg_carousel_preload"),jQuery(this).removeAttr("data-background"))})}function bwg_slideshow_ready(){jQuery(".bwg_slideshow").each(function(){var i=jQuery(this).data("bwg");if(jQuery("#bwg_slideshow_image_container_"+i).length){bwg_params[i]=JSON.parse(jQuery("#bwg_slideshow_image_container_"+i).attr("data-params")),bwg_params[i].event_stack=[],bwg_container_loaded(i);var e=bwg_params[i].data;void 0!==jQuery().swiperight&&jQuery.isFunction(jQuery().swiperight)&&jQuery("#bwg_container1_"+i).swiperight(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key_"+i).val()),0<=parseInt(jQuery("#bwg_current_image_key_"+i).val())-bwg_iterator(i)?(parseInt(jQuery("#bwg_current_image_key_"+i).val())-bwg_iterator(i))%e.length:e.length-1,e,"",i),!1}),void 0!==jQuery().swipeleft&&jQuery.isFunction(jQuery().swipeleft)&&jQuery("#bwg_container1_"+i).swipeleft(function(){return bwg_change_image(parseInt(jQuery("#bwg_current_image_key_"+i).val()),parseInt(jQuery("#bwg_current_image_key_"+i).val())+bwg_iterator(i)%e.length,e,"",i),!1});var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click";bwg_popup_resize(i),jQuery(".bwg_slideshow_watermark_"+i).css({display:"none"}),jQuery(".bwg_slideshow_title_text_"+i).css({display:"none"}),jQuery(".bwg_slideshow_description_text_"+i).css({display:"none"}),setTimeout(function(){bwg_change_watermark_container(i)},500),"horizontal"==bwg_params[i].filmstrip_direction?jQuery(".bwg_slideshow_image_container_"+i).height(jQuery(".bwg_slideshow_image_wrap_"+i).height()-bwg_params[i].slideshow_filmstrip_height):jQuery(".bwg_slideshow_image_container_"+i).width(jQuery(".bwg_slideshow_image_wrap_"+i).width()-bwg_params[i].slideshow_filmstrip_width);var a=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";jQuery(".bwg_slideshow_filmstrip_"+i).bind(a,function(e){var t=window.event||e;return 0<((t=t.originalEvent?t.originalEvent:t).detail?-40*t.detail:t.wheelDelta)?jQuery(".bwg_slideshow_filmstrip_left_"+i).trigger("click"):jQuery(".bwg_slideshow_filmstrip_right_"+i).trigger("click"),!1}),jQuery(".bwg_slideshow_filmstrip_right_"+i).on(t,function(){jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).stop(!0,!1),"left"==bwg_params[i].left_or_top?"width"==bwg_params[i].width_or_height?(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width())&&(jQuery(".bwg_slideshow_filmstrip_left_"+i).css({opacity:1}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width()-(parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width)))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({left:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({left:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left-(parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width))},500,"linear")),window.setTimeout(function(){jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left==-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width())&&jQuery(".bwg_slideshow_filmstrip_right_"+i).css({opacity:.3})},500)):(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height())&&(jQuery(".bwg_slideshow_filmstrip_left_"+i).css({opacity:1}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height()-(parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width)))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({left:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({left:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left-(parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width))},500,"linear")),window.setTimeout(function(){jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left==-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height())&&jQuery(".bwg_slideshow_filmstrip_right_"+i).css({opacity:.3})},500)):"width"==bwg_params[i].width_or_height?(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width())&&(jQuery(".bwg_slideshow_filmstrip_left_"+i).css({opacity:1}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width()-parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({top:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({top:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top-parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width)},500,"linear")),window.setTimeout(function(){jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top==-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).width()-jQuery(".bwg_slideshow_filmstrip_"+i).width())&&jQuery(".bwg_slideshow_filmstrip_right_"+i).css({opacity:.3})},500)):(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top>=-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height())&&(jQuery(".bwg_slideshow_filmstrip_left_"+i).css({opacity:1}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top<-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height()-(parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width)))?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({top:-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height())},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({top:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top-(parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width))},500,"linear")),window.setTimeout(function(){jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top==-(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).height()-jQuery(".bwg_slideshow_filmstrip_"+i).height())&&jQuery(".bwg_slideshow_filmstrip_right_"+i).css({opacity:.3})},500))}),jQuery(".bwg_slideshow_filmstrip_left_"+i).on(t,function(){jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).stop(!0,!1),"left"==bwg_params[i].left_or_top?(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left<0&&(jQuery(".bwg_slideshow_filmstrip_right_"+i).css({opacity:1}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left>-(bwg_params[i].filmstrip_thumb_margin_hor+bwg_params[i].slideshow_filmstrip_width)?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({left:0},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({left:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left+parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width)},500,"linear")),window.setTimeout(function(){0==jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().left&&jQuery(".bwg_slideshow_filmstrip_left_"+i).css({opacity:.3})},500)):(jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top<0&&(jQuery(".bwg_slideshow_filmstrip_right_"+i).css({opacity:1}),jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top>-(bwg_params[i].filmstrip_thumb_margin_hor+bwg_params[i].slideshow_filmstrip_width)?jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({top:0},500,"linear"):jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).animate({top:jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top+parseInt(bwg_params[i].filmstrip_thumb_margin_hor)+parseInt(bwg_params[i].slideshow_filmstrip_width)},500,"linear")),window.setTimeout(function(){0==jQuery(".bwg_slideshow_filmstrip_thumbnails_"+i).position().top&&jQuery(".bwg_slideshow_filmstrip_left_"+i).css({opacity:.3})},500))}),"width"==bwg_params[i].width_or_height?bwg_set_filmstrip_pos(jQuery(".bwg_slideshow_filmstrip_"+i).width(),i):bwg_set_filmstrip_pos(jQuery(".bwg_slideshow_filmstrip_"+i).height(),i),jQuery("#bwg_slideshow_play_pause_"+i).off(t).on(t,function(){jQuery(".bwg_ctrl_btn_"+i).hasClass("bwg-icon-play")?(bwg_play(bwg_params[i].data,i),jQuery(".bwg_slideshow_play_pause_"+i).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_slideshow_play_pause_"+i).attr("class","bwg-icon-pause bwg_ctrl_btn_"+i+" bwg_slideshow_play_pause_"+i),1==bwg_params[i].enable_slideshow_music&&document.getElementById("bwg_audio_"+i).play()):(window.clearInterval(window["bwg_playInterval"+i]),jQuery(".bwg_slideshow_play_pause_"+i).attr("title","Play"),jQuery(".bwg_slideshow_play_pause_"+i).attr("class","bwg-icon-play bwg_ctrl_btn_"+i+" bwg_slideshow_play_pause_"+i),1==bwg_params[i].enable_slideshow_music&&document.getElementById("bwg_audio_"+i).pause())}),0!=bwg_params[i].enable_slideshow_autoplay&&(bwg_play(bwg_params[i].data,i),jQuery(".bwg_slideshow_play_pause_"+i).attr("title",bwg_objectsL10n.pause),jQuery(".bwg_slideshow_play_pause_"+i).attr("class","bwg-icon-pause bwg_ctrl_btn_"+i+" bwg_slideshow_play_pause_"+i),1==bwg_params[i].enable_slideshow_music&&jQuery("#bwg_audio_"+i).length&&document.getElementById("bwg_audio_"+i).play()),bwg_params[i].preload_images&&bwg_preload_images(parseInt(jQuery("#bwg_current_image_key_".$bwg).val()),i),jQuery(".bwg_slideshow_image_"+i).removeAttr("width"),jQuery(".bwg_slideshow_image_"+i).removeAttr("height")}})}function bwg_image_browser_resize(){jQuery(".bwg_image_browser").each(function(){var e=jQuery(this).attr("data-bwg");jQuery(".image_browser_images_conteiner_"+e).length&&(bwg_params_ib[e]=JSON.parse(jQuery("#bwg_container1_"+e+" .image_browser_images_conteiner_"+e).attr("data-params")),bwg_image_browser(e))})}function bwg_image_browser_ready(){jQuery(".bwg_image_browser").each(function(){var e=jQuery(this).attr("data-bwg");bwg_container_loaded(e),jQuery(".image_browser_images_conteiner_"+e).length&&(bwg_params_ib[e]=JSON.parse(jQuery(".image_browser_images_conteiner_"+e).attr("data-params")),setTimeout(function(){bwg_image_browser(e)},3))})}function bwg_search_focus(e){jQuery(e).parent().find(".bwg_search_input").focus(),jQuery(e).hide()}function bwg_key_press(e){jQuery(e).parent().find(".bwg_search_reset_container").removeClass("bwg-hidden"),jQuery(e).parent().find(".bwg_search_loupe_container1").removeClass("bwg-hidden")}function bwg_all_thumnails_loaded(t){var i=0,a=jQuery(t).find("img").length;return 0==a?bwg_all_thumbnails_loaded_callback(t):jQuery(t).find("img").each(function(){var e=jQuery(this).attr("src");jQuery("<img/>").attr("src",e).on("load error",function(){++i>=a&&bwg_all_thumbnails_loaded_callback(t)})}),0==a}function bwg_all_thumbnails_loaded_callback(e){jQuery(e).hasClass("bwg-thumbnails")&&!jQuery(e).hasClass("bwg-masonry-thumbnails")&&bwg_thumbnail(e),jQuery(e).hasClass("bwg-masonry-thumbnails")&&bwg_thumbnail_masonry(e),jQuery(e).hasClass("bwg-album-extended")&&bwg_album_extended(e)}function bwg_album_thumbnail(e){bwg_container_loaded(jQuery(e).data("bwg"))}function bwg_album_extended(e){var t=jQuery(e).width(),i=jQuery(e).data("thumbnail-width"),a=jQuery(e).data("spacing"),r=jQuery(e).data("max-count"),_=parseInt(t/(2*i));_<1&&(_=1),r<_&&(_=r);var s=100/_,o=jQuery(e).find(".bwg-extended-item"),l=parseInt(o.css("margin-left")),n=parseInt(o.css("margin-right"));o.css({width:"calc("+s+"% - "+(l+n)+"px)"}),o.width()<i?o.find(".bwg-extended-item0, .bwg-extended-item1").css({width:"calc(100% - "+a+"px)"}):o.width()>2*i?(o.find(".bwg-extended-item0").css({width:"calc(50% - "+a+"px)"}),o.find(".bwg-extended-item1").css({width:"calc(100% - "+(i+2*a)+"px)"})):o.find(".bwg-extended-item0, .bwg-extended-item1").css({width:"calc(50% - "+a+"px)"}),jQuery(e).children(".bwg-extended-item").each(function(){var e=jQuery(this).find("img"),t=jQuery(this).find(".bwg-item0"),i=jQuery(this).find(".bwg-item2"),a=e.data("width"),r=e.data("height");""!=a&&""!=r||(a=e.width(),r=e.height());var _=a/r;i.width()/i.height()>a/r?(i.width()>a?e.css({width:"100%",height:i.width()/_}):e.css({maxWidth:"100%",height:i.width()/_}),a=i.width(),r=i.width()/_):(i.height()>r?e.css({height:"100%",width:i.height()*_,maxWidth:"initial"}):e.css({maxHeight:"100%",width:i.height()*_,maxWidth:"initial"}),r=i.height(),a=i.height()*_),jQuery(this).find(".bwg-item2").css({marginLeft:(t.width()-a)/2,marginTop:(t.height()-r)/2})}),bwg_container_loaded(jQuery(e).data("bwg"))}function bwg_thumbnail(e){var t=jQuery(e).width(),i=jQuery(e).data("thumbnail-width"),a=jQuery(e).data("max-count"),r=parseInt(t/i)+1;a<r&&(r=a);var _=100/r;jQuery(e).find(".bwg-item").css({width:_+"%"}),jQuery(e).children(".bwg-item").each(function(){var e=jQuery(this).find("img"),t=jQuery(this).find(".bwg-item2"),i=jQuery(this).find(".bwg-item1"),a=0<t.width()?t.width():i.width(),r=0<t.height()?t.height():i.height(),_=e.data("width"),s=e.data("height");""!=_&&""!=s&&void 0!==_&&void 0!==s||(_=e.width(),s=e.height());var o=_/s;e.removeAttr("style"),o<a/r?(_<a?e.css({width:"100%",height:a/o}):e.css({maxWidth:"100%",height:Math.ceil(a/o)}),s=(_=a)/o):(r>e.height()?e.css({height:"100%",width:r*o,maxWidth:"initial"}):e.css({maxHeight:"100%",width:r*o,maxWidth:"initial"}),_=(s=r)*o),jQuery(this).find(".bwg-item2").css({marginLeft:(a-_)/2,marginTop:(r-s)/2})}),bwg_container_loaded(jQuery(e).data("bwg"))}function bwg_thumbnail_masonry(e){var t="#bwg_thumbnails_masonry_"+(bwg=jQuery(e).attr("data-bwg"));jQuery("#bwg_album_masonry_"+bwg).length&&(t="#bwg_album_masonry_"+bwg),0===jQuery(".bwg-container-temp"+bwg).length&&(jQuery(t).clone().appendTo("#bwg_container3_"+bwg).removeAttr("id").removeClass("bwg-container-"+bwg).addClass("bwg-container-temp"+bwg),jQuery(".bwg-container-temp"+bwg).empty());var a=jQuery(".bwg-container-temp"+bwg),r=jQuery(t),_=a;if(a.prepend(r.html()),_.find(".bwg-empty-item").remove(),"horizontal"==_.data("masonry-type")){var s=_.data("thumbnail-height"),o=_.data("max-count"),l=[];for(i=0;i<o;i++)l.push(0);_.find(".bwg-item").each(function(){var e=l.indexOf(Math.min.apply(Math,l));jQuery(this).css({height:s,order:e+1}),l[e]+=jQuery(this)[0].getBoundingClientRect().width});var n=Math.max.apply(Math,l);for(_.width(n),i=0;i<o;i++)l[i]<n&&_.append(jQuery('<div class="bwg-item bwg-empty-item"></div>').css({height:s,order:i+1,width:n-l[i]}))}else{_.removeAttr("style");n=_.width();var g=_.data("thumbnail-width"),w=(o=_.data("max-count"),parseInt(n/g)+("0"==_.data("resizable-thumbnails")?0:1));o<w&&(w=o);var b=_.find(".bwg-item").length;b<w&&(w=b);var u,d,h=100/w,m=[];for(i=0;i<w;i++)m.push(0);_.find(".bwg-item").each(function(){var e=m.indexOf(Math.min.apply(Math,m));if(jQuery(this).css({width:h+"%",order:e+1}),0<jQuery(this).find("img").attr("data-width").length&&0<jQuery(this).find("img").attr("data-height").length){d=jQuery(this).find("img").data("width")/jQuery(this).find("img").data("height"),u=jQuery(this).width()/d;var t=+(jQuery(this).find("a>.bwg-title1").height()+jQuery(this).find("a>.bwg-masonry-thumb-description").height());jQuery(this).height(u+t)}m[e]+=jQuery(this)[0].getBoundingClientRect().height});var p=Math.max.apply(Math,m);for(i=0;i<w;i++)m[i]<p&&_.append(jQuery('<div class="bwg-item bwg-empty-item"></div>').css({width:h+"%",order:i+1,height:p-m[i]}));_.outerWidth(w*g),_.height(p)}if(""!=a.html()){r.outerWidth(w*g),r.height(p),r.empty();var c=a.html();r.append(c),r.find(".bwg_lazyload").each(function(){null!=jQuery(this).attr("data-original")&&""!=jQuery(this).attr("data-original")&&jQuery(this).attr("src",jQuery(this).attr("data-original"))}),a.empty().hide()}bwg_container_loaded(_.data("bwg"))}function bwg_container_loaded(e){jQuery("#gal_front_form_"+e).removeClass("bwg-hidden"),jQuery("#ajax_loading_"+e).addClass("bwg-hidden")}function bwg_thumbnail_mosaic_logic(e){var t=e.attr("data-bwg"),i=e.attr("data-block-id"),a=parseInt(e.attr("data-thumb-padding"))/2,r=parseInt(e.attr("data-thumb-border"))+a;if("horizontal"==e.attr("data-mosaic-direction")){var _=parseInt(e.attr("data-height"));if("1"==e.attr("data-resizable"))if(1920<=jQuery(window).width())var s=(1+jQuery(window).width()/1920)*_;else if(jQuery(window).width()<=640)s=jQuery(window).width()/640*_;else s=_;else s=_;(c=jQuery(".bwg_mosaic_thumb_"+t)).each(function(e){var t=jQuery(this).data("width"),i=jQuery(this).data("height");""!=t&&""!=i&&void 0!==t&&void 0!==i||(t=c.get(e).naturalWidth,i=c.get(e).naturalHeight),t=t*s/i,c.eq(e).height(s),c.eq(e).width(t)});var o=jQuery("#bwg_mosaic_thumbnails_div_"+t).width()/100*parseInt(e.attr("data-total-width"));jQuery("#"+i).width(o);var l=s+2*r,n=0,g=[];g[0]=0;var w=[],b=w[0]=0;c.each(function(e){row_cum_width2=b+c.eq(e).width()+2*r,row_cum_width2-o<0?(b=row_cum_width2,g[e]=n,w[n]++):e!==c.length-1?Math.abs(b-o)>Math.abs(row_cum_width2-o)||Math.abs(b-o)<=Math.abs(row_cum_width2-o)&&0==w[n]?e!==c.length-2?(b=row_cum_width2,g[e]=n,w[n]++,w[++n]=0,b=0):(b=row_cum_width2,g[e]=n,w[n]++):(w[++n]=1,g[e]=n,b=row_cum_width2-b):(b=row_cum_width2,g[e]=n,w[n]++)});for(var u=[],d=[],h=0;h<=n;h++)u[h]=1,d[h]=l;for(h=0;h<=n;h++)b=0,c.each(function(e){g[e]==h&&(b+=c.eq(e).width())}),u[h]=z=(o-2*w[h]*r)/b,d[h]=(l-2*r)*u[h]+2*r;(S=[])[0]=0;var m=[],p=[];m[0]=0,p[0]=0;for(h=1;h<=n;h++)m[h]=m[0],p[h]=p[h-1]+d[h-1];c.each(function(e){var t=c.eq(e).width(),i=c.eq(e).height();c.eq(e).width(t*u[g[e]]),c.eq(e).height(i*u[g[e]]),c.eq(e).parent().css({top:p[g[e]],left:m[g[e]]}),m[g[e]]+=t*u[g[e]]+2*r,S[g[e]]=e}),jQuery("#"+i).height(p[n]+d[n]-p[0])}else{var c,y=parseInt(e.attr("data-width"));if("1"==e.attr("data-resizable")){if(1920<=jQuery(window).width())var f=(1+jQuery(window).width()/1920)*y;else if(jQuery(window).width()<=640)f=jQuery(window).width()/640*y;else f=y;if(0<jQuery(".header-content-with_tab").length)f=jQuery(".header-content-with_tab").width()/4-10}else f=y;(c=jQuery(".bwg_mosaic_thumb_"+t)).each(function(e){var t=jQuery(this).data("width"),i=jQuery(this).data("height");""!=t&&""!=i&&void 0!==t&&void 0!==i||(t=c.get(e).naturalWidth,i=c.get(e).naturalHeight),c.eq(e).height(i*f/t),c.eq(e).width(f)});o=jQuery("#bwg_mosaic_thumbnails_div_"+t).width()/100*parseInt(e.attr("data-total-width"));jQuery("#"+i).width(o);var j=f+2*r<o?f:o-2*r,Q=Math.floor(o/(j+2*r)),v=[];v[0]=0;for(var x=[],k=[],z=0;z<Q;z++)k[z]=0,x[z]=0;c.each(function(e){for(var t=0,i=k[0],a=0;a<Q;a++)i>k[a]&&(i=k[a],t=a);v[e]=t,x[t]++,B=i,T=0+t*(j+2*r),c.eq(e).parent().css({top:B,left:T}),k[t]+=c.eq(e).height()+2*r}),(u=[])[0]=1;var C=0,I=[],E=0,O=0;for(z=0;z<Q;z++)C+=j,I[z]=0,c.each(function(e){v[e]==z&&(I[z]+=c.eq(e).height())}),0!=I[z]&&(E+=j/I[z],O+=j*x[z]*2*r/I[z]);var M=0;0!=E&&(M=(C+O)/E);for(z=0;z<Q;z++)0!=I[z]&&(u[z]=(M-2*x[z]*r)/I[z]);var S,T=[];T[0]=0;for(z=1;z<=Q;z++)T[z]=T[z-1]+j*u[z-1]+2*r;var B=[];for(z=0;z<Q;z++)B[z]=0;(S=[])[0]=0,c.each(function(e){var t=c.eq(e).width(),i=c.eq(e).height();c.eq(e).width(t*u[v[e]]),c.eq(e).height(i*u[v[e]]),c.eq(e).parent().css({top:B[v[e]],left:T[v[e]]}),B[v[e]]+=i*u[v[e]]+2*r,S[v[e]]=e}),jQuery("#"+i).width(T[Q]).height(B[0])}}function bwg_thumbnail_mosaic(e){var t=jQuery(e),i=jQuery.Deferred();if(i.done([bwg_thumbnail_mosaic_logic]).done(function(e){"1"!=e.data("mosaic-thumb-transition")&&jQuery(".bwg_mosaic_thumb_spun_"+t).css({transition:"all 0.3s ease 0s","-webkit-transition":"all 0.3s ease 0s"});var t=e.data("bwg");jQuery(".bwg_mosaic_thumbnails_"+t).css({visibility:"visible"}),jQuery(".tablenav-pages_"+t).css({visibility:"visible"}),bwg_container_loaded(t),jQuery(".bwg_mosaic_thumb_"+t).removeClass("bwg-hidden"),jQuery("#bwg_mosaic_thumbnails_div_"+t).removeClass("bwg-hidden")}),i.resolve(t),"hover"==t.attr("data-image-title")){var a=parseInt(t.attr("data-thumb-padding"))/2,r=parseInt(t.attr("data-thumb-border"))+a;bwg_mosaic_title_on_hover(t.data("bwg"),t,r)}"hover"==t.attr("data-ecommerce-icon")&&(jQuery(".bwg_mosaic_thumb_spun_"+bwg).on("mouseenter",function(){var e=jQuery(this).parents(".bwg-mosaic-thumb-span").children(".bwg_mosaic_thumb_"+bwg).width(),t=jQuery(this).parents(".bwg-mosaic-thumb-span").children(".bwg_mosaic_thumb_"+bwg).height();jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).width(e);var i=jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).width(),a=jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).height();jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).css({top:r+.5*t-.5*a,left:r+.5*e-.5*i,opacity:1})}),jQuery(".bwg_mosaic_thumb_spun_"+bwg).on("mouseleave",function(){jQuery(this).children(".bwg_ecommerce_spun1_"+bwg).css({top:0,left:-1e4,opacity:0,padding:t.attr("data-title-margin")})}))}function bwg_mosaic_title_on_hover(r,e,_){jQuery(".bwg-mosaic-thumb-span").on("mouseenter",function(){var e=jQuery(this).children(".bwg_mosaic_thumb_"+r).width(),t=jQuery(this).children(".bwg_mosaic_thumb_"+r).height();jQuery(this).find(".bwg_mosaic_title_spun1_"+r).width(e);var i=jQuery(this).find(".bwg_mosaic_title_spun1_"+r).width(),a=jQuery(this).find(".bwg_mosaic_title_spun1_"+r).height();jQuery(this).find(".bwg_mosaic_title_spun1_"+r).css({top:_+.5*t-.5*a<0?_:_+.5*t-.5*a,left:_+.5*e-.5*i,opacity:1,"max-height":"calc(100% - "+2*_+"px)",overflow:"hidden"})}),jQuery(".bwg-mosaic-thumb-span").on("mouseleave",function(){jQuery(this).find(".bwg_mosaic_title_spun1_"+r).css({top:0,left:-1e4,opacity:0,padding:e.attr("data-title-margin"),"max-height":"calc(100% - "+2*_+"px)",overflow:"hidden"})})}function bwg_mosaic_ajax(e,t){var i=0;jQuery(".bwg_mosaic_thumb_spun_"+e+" img").on("load",function(){++i>=t&&bwg_thumbnail_mosaic(jQuery(".bwg-mosaic-thumbnails[data-bwg="+e+"]"))}),jQuery(".bwg_mosaic_thumb_spun_"+e+" img").on("error",function(){jQuery(this).height(100),jQuery(this).width(100),++i>=t&&bwg_thumbnail_mosaic(jQuery(".bwg-mosaic-thumbnails[data-bwg="+e+"]"))})}function bwg_add_album(){var t=!1;"1"!=bwg_objectsL10n.front_ajax&&jQuery(document).off("click",".bwg-album").on("click",".bwg-album",function(){if(!t){var e=jQuery(this).attr("data-bwg");return t=!0,setTimeout(function(){t=!1},100),bwg_ajax("gal_front_form_"+e,e,jQuery(this).attr("data-container_id"),jQuery(this).attr("data-alb_gal_id"),jQuery(this).attr("data-album_gallery_id"),jQuery(this).attr("data-def_type"),"",jQuery(this).attr("data-title")),!1}}),jQuery(".bwg_description_more").on("click",function(){jQuery(this).hasClass("bwg_more")?(jQuery(this).parent().find(".bwg_description_full").show(),jQuery(this).addClass("bwg_hide").removeClass("bwg_more"),jQuery(this).html(jQuery(this).data("hide-msg"))):(jQuery(this).parent().find(".bwg_description_full").hide(),jQuery(this).addClass("bwg_more").removeClass("bwg_hide"),jQuery(this).html(jQuery(this).data("more-msg")))})}function bwg_add_lightbox(){var i=!1;jQuery(document).on("click",".bwg_lightbox .bwg-item0, .bwg_lightbox .bwg_slide, .bwg_lightbox .bwg-carousel-image, .bwg_lightbox .bwg-title1",function(e){e.stopPropagation(),e.preventDefault();var t=jQuery(this).closest("a");if(!i)return i=!0,setTimeout(function(){i=!1},100),bwg_gallery_box(jQuery(t).attr("data-image-id"),jQuery(t).closest(".bwg_container")),!1}),jQuery(".bwg_lightbox .bwg_ecommerce").on("click",function(e){if(e.stopPropagation(),!i)return i=!0,setTimeout(function(){i=!1},100),bwg_gallery_box(jQuery(this).closest(".bwg_lightbox").attr("data-image-id"),jQuery(this).closest(".bwg_container"),!0),!1})}function bwg_filter_by_tag(e){var t="",i=jQuery(e).parent().parent(),a=i.find(".current_view").val(),r=i.find(".form_id").val(),_=i.find(".cur_gal_id").val(),s=i.find(".album_gallery_id").val(),o=i.find(".type").val();jQuery(e).parent().find(".opt.selected").each(function(){t=t+jQuery(e).text()+","}),""==(t=t.slice(0,-1))&&(t=bwg_objectsL10n.bwg_select_tag),jQuery(e).parent().find(".CaptionCont").attr("title",t),jQuery(e).parent().find(".CaptionCont .placeholder").html(t),jQuery("#bwg_tag_id_"+a).val(jQuery("#bwg_tag_id_"+_).val()),bwg_select_tag(a,r,_,s,o,!1)}function bwg_document_ready(){bwg_add_lightbox(),jQuery('div[id^="bwg_container1_"]').each(function(){var e=jQuery(this);e.data("right-click-protection")&&bwg_disable_right_click(e),jQuery(".SumoSelect > .CaptionCont > label > i").addClass("bwg-icon-angle-down closed");var t=e.find(".search_tags");if("1"==bwg_objectsL10n.front_ajax&&t.length)for(var i=0;i<t[0].length;i++)void 0===t[0][i].attributes.selected&&(t[0][i].selected=!1);t.length&&(t.SumoSelect({triggerChangeCombined:!0,placeholder:bwg_objectsL10n.bwg_select_tag,search:!0,searchText:bwg_objectsL10n.bwg_search,forceCustomRendering:!0,noMatch:bwg_objectsL10n.bwg_tag_no_match,captionFormatAllSelected:bwg_objectsL10n.bwg_all_tags_selected,captionFormat:"{0} "+bwg_objectsL10n.bwg_tags_selected,okCancelInMulti:!0,locale:[bwg_objectsL10n.ok,bwg_objectsL10n.cancel,bwg_objectsL10n.select_all]}),t.off("change").on("change",function(){bwg_filter_by_tag(this)}));var a=e.find(".bwg_order");a.length&&a.SumoSelect({triggerChangeCombined:!0,forceCustomRendering:!0}),jQuery(this).find("search_placeholder_title").hide(),""==jQuery(this).find(".bwg_search_input").val()&&jQuery(this).find("search_placeholder_title").show(),jQuery(".bwg_thumbnail .bwg_search_container_2").focusout(function(e){""==jQuery(this).find(".bwg_search_input").val()&&(jQuery(this).find(".search_placeholder_title").show(),jQuery(this).find(".bwg_search_loupe_container1").addClass("bwg-hidden"),jQuery(this).find(".bwg_search_reset_container").addClass("bwg-hidden"))})}),jQuery(".search_tags").on("sumo:opened",function(){0==jQuery(this).parent().find("ul li").length&&(jQuery(".no-match").html(bwg_objectsL10n.bwg_tag_no_match),jQuery(".no-match").show())}),jQuery(".bwg_thumbnail .SumoSelect").on("sumo:closed",function(){jQuery(this).find("label i").removeClass("bwg-icon-angle-up opened"),jQuery(this).find("label i").addClass("bwg-icon-angle-down closed")}),jQuery(".bwg_thumbnail .SumoSelect").on("sumo:opened",function(){jQuery(this).find("label i").removeClass("bwg-icon-angle-down closed"),jQuery(this).find("label i").addClass("bwg-icon-angle-up opened")}),bwg_add_album();var e=window.location.hash.substring(1);if(e&&"-1"!=e.indexOf("bwg")){bwg_hash_array=e.replace("bwg","").split("/");var t=jQuery(".bwg_container");t&&bwg_gallery_box(bwg_hash_array[1],t,!1,bwg_hash_array[0])}bwg_blog_style_ready(),bwg_image_browser_ready(),bwg_resize_search_line()}function bwg_clear_search_input(e){if("1"!=bwg_objectsL10n.front_ajax)jQuery("#bwg_search_input_"+e).val(""),jQuery("#bwg_search_container_1_"+e+" .bwg_search_loupe_container1").addClass("bwg-hidden"),jQuery("#bwg_search_container_1_"+e+" .bwg_search_reset_container").addClass("bwg-hidden");else{var t=window.location.href,i=bwg_remove_url_parameter("bwg_search_"+e,t,t);window.location.replace(i)}}function bwg_check_search_input_enter(e,t){return 13!=(t.which||t.keyCode)||(jQuery(e).closest(".bwg_search_container_1").find(".bwg_search").trigger("click"),!1)}function bwg_ajax(t,i,a,r,e,_,s,o,l,n,g,w){if("1"!=bwg_objectsL10n.front_ajax||!0===n){jQuery("#ajax_loading_"+i).removeClass("bwg-hidden"),jQuery(".bwg_load_more_ajax_loading").css({top:jQuery("#bwg_container1_"+bwg).height()-jQuery(".bwg_load_more_ajax_loading").height()}),"function"==typeof bwg_scroll_load_action&&jQuery(window).off("scroll",bwg_scroll_load_action),jQuery(".bwg_thumbnail .search_tags").off("sumo:closed");var b=jQuery("#"+t).data("ajax-url"),u=0;if(void 0===n)n=!1;var d=jQuery("#page_number_"+i).val(),h=jQuery("#bwg_search_input_"+i).val(),m={},p=jQuery("#bwg_album_breadcrumb_"+i).val();if(p&&!0!==n){var c=JSON.parse(p);if("back"==r){c.splice(-1,1);var y=c.slice(-1)[0];r=y.id,d=y.page,m["action_"+i]="back"}else"numeric"===n||s?(c.splice(-1,1),c.push({id:r,page:d,search:h})):(c.push({id:r,page:1}),d=1);m["bwg_album_breadcrumb_"+i]=JSON.stringify(c)}if(m.gallery_type=jQuery("#"+t).data("gallery-type"),m.gallery_id=jQuery("#"+t).data("gallery-id"),m.tag=jQuery("#"+t).data("tag"),m.album_id=jQuery("#"+t).data("album-id"),m.theme_id=jQuery("#"+t).data("theme-id"),m.shortcode_id=jQuery("#"+t).data("shortcode-id"),m.bwg=i,m.current_url=encodeURI(jQuery("#bwg_container1_"+i).data("current-url")),s&&(d=1),void 0===o||""==o)o="";if(void 0===g||""==g)g="";if(void 0===l||""==l)l=jQuery(".bwg_order_"+i).val();if(void 0===w)w=!0;if(1==w&&jQuery("html, body").animate({scrollTop:jQuery("#"+t).offset().top-150},500),m["page_number_"+i]=d,m["bwg_load_more_"+i]=jQuery("#bwg_load_more_"+i).val(),m["album_gallery_id_"+i]=r,m["type_"+i]=_,m["title_"+i]=o,m["description_"+i]=g,m["sortImagesByValue_"+i]=l,0<jQuery("#bwg_search_input_"+i).length&&(m["bwg_search_"+i]=jQuery("#bwg_search_input_"+i).val()),void 0!==m["bwg_album_breadcrumb_"+i]){var f=JSON.parse(m["bwg_album_breadcrumb_"+i]);jQuery.each(f,function(e,t){m["bwg_search_"+i]="",r==t.id&&(m["bwg_search_"+i]=t.search)})}return m["bwg_tag_id_"+a]=jQuery("#bwg_tag_id_"+a).val(),jQuery("#ajax_loading_"+i).removeClass("bwg-hidden"),jQuery(".bwg_load_more_ajax_loading").css({top:jQuery("#bwg_container1_"+bwg).height()-jQuery(".bwg_load_more_ajax_loading").height()}),jQuery.ajax({type:"POST",url:b,data:m,success:function(e){jQuery(e).find(".bwg_masonry_thumb_spun_"+i+" img").length,u=jQuery(e).find(".bwg_mosaic_thumb_spun_"+i+" img").length,!0===n?(a=="bwg_thumbnails_mosaic_"+i?jQuery("#"+a).append(jQuery(e).closest(".bwg-container-"+i).find("#"+a).html()):a=="bwg_album_compact_"+i?jQuery("#"+a).append(jQuery(e).closest(".bwg-album-thumbnails").html()):a=="bwg_thumbnails_masonry_"+i?jQuery(".bwg-container-temp"+i).append(jQuery(e).closest(".bwg-container-"+i).html()):jQuery("#"+a).append(jQuery(e).closest(".bwg-container-"+i).html()),jQuery(".bwg_nav_cont_"+i).html(jQuery(e).closest(".bwg_nav_cont_"+i).html())):jQuery("#bwg_container3_"+i).html(e)},complete:function(){jQuery("div[id^='bwg_container1_'] img").each(function(){null!=jQuery(this).attr("data-lazy-src")&&""!=jQuery(this).attr("data-lazy-src")?jQuery(this).attr("src",jQuery(this).attr("data-lazy-src")):null!=jQuery(this).attr("data-original")&&""!=jQuery(this).attr("data-original")&&jQuery(this).attr("src",jQuery(this).attr("data-original"))}),jQuery(".blog_style_image_buttons_conteiner_"+i).find(jQuery(".bwg_blog_style_img_"+i)).on("load",function(){jQuery(".bwg_blog_style_img_"+i).closest(jQuery(".blog_style_image_buttons_conteiner_"+i)).show()}),jQuery("#bwg_tags_id_"+a).val(jQuery("#bwg_tag_id_"+a).val()),jQuery(".pagination-links_"+i).length&&jQuery("html, body").animate({scrollTop:jQuery("#"+t).offset().top-150},500),bwg_document_ready(),bwg_carousel_ready(),bwg_carousel_onload(),bwg_mosaic_ajax(i,u),bwg_all_thumnails_loaded(".bwg-container-"+i)&&bwg_container_loaded(i),jQuery(".blog_style_images_conteiner_"+i+" .bwg_embed_frame_16x9_"+i).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height(.5625*jQuery(this).width())}),jQuery(".blog_style_images_conteiner_"+i+" .bwg_embed_frame_instapost_"+i).each(function(e){jQuery(this).width(jQuery(this).parent().width()),jQuery(this).height((jQuery(this).width()-16)*jQuery(this).attr("data-height")/jQuery(this).attr("data-width")+96)}),jQuery("#bwg_embed_frame_16x9_"+i).width(jQuery("#bwg_embed_frame_16x9_"+i).parent().width()),jQuery("#bwg_embed_frame_16x9_"+i).height(.5625*jQuery("#bwg_embed_frame_16x9_"+i).width()),jQuery("#bwg_embed_frame_instapost_"+i).width(jQuery("#bwg_embed_frame_16x9_"+i).parent().width()),jQuery(".bwg_embed_frame_instapost_"+i).height((jQuery(".bwg_embed_frame_instapost_"+i).width()-16)*jQuery(".bwg_embed_frame_instapost_"+i).attr("data-height")/jQuery(".bwg_embed_frame_instapost_"+i).attr("data-width")+96),jQuery("#bwg_search_input_"+i).val(m["bwg_search_"+i]),""!=jQuery("#bwg_search_input_"+i).val()?(jQuery("#bwg_search_input_"+i).parent().find(".search_placeholder_title").hide(),jQuery("#bwg_search_input_"+i).parent().parent().find(".bwg_search_reset_container").show(),jQuery("#bwg_search_input_"+i).parent().parent().find(".bwg_search_loupe_container1").show()):jQuery("#bwg_search_input_"+i).parent().find(".search_placeholder_title").show();var e=jQuery("#bwg_container2_"+i+" .cur_gal_id").val();jQuery("#bwg_tag_id_"+i).val(jQuery("#bwg_tag_id_"+e).val())}}),!1}if("back"===r)return-1==document.referrer.indexOf(window.location.host)?(str=jQuery(location).attr("href"),void window.location.replace(str.substring(0,str.indexOf("type_0")))):void window.history.back();var j=jQuery("#bwg_search_input_"+i).val(),Q=window.location.href,v="",x=jQuery("#bwg_tag_id_"+i).val();if("#"==Q.substr(-1)&&(Q=Q.slice(0,-1)),""!==j&&void 0!==j?!1!==(v=bwg_add_url_parameter(v=bwg_remove_url_parameter("page_number_"+i,Q),"bwg_search_"+i,j))&&(Q=v):!1!==(v=bwg_remove_url_parameter("bwg_search_"+i,Q))&&(Q=v),void 0!==l&&""!==l&&!1!==(v=bwg_add_url_parameter(Q,"sort_by_"+i,l))&&(Q=v),null!=x&&0<x.length){var k="",z=x.split(",");jQuery.each(z,function(e){var t=",";e===z.length-1&&(t=""),k+=z[e]+t}),""!==k&&!1!==(v=bwg_add_url_parameter(Q,"filter_tag_"+i,k))&&(Q=v)}else!1!==(v=bwg_remove_url_parameter("filter_tag_"+i,v))&&(Q=v);window.location.href=Q}function bwg_add_url_parameter(e,t,i){var a=new RegExp("([?&])"+t+"=.*?(&|$)","i"),r=-1!==e.indexOf("?")?"&":"?";return e.match(a)?e.replace(a,"$1"+t+"="+i+"$2"):e+r+t+"="+i}function bwg_remove_url_parameter(e,t){var i=t.split("?"),a=i[0]+"?",r="";if(void 0!==i[1]&&(r=i[1]),""===r)return t;var _,s,o=decodeURIComponent(r).split("&");for(s=0;s<o.length;s++)(_=o[s].split("="))[0]!=e&&(a=a+_[0]+"="+_[1]+"&");return a.substring(0,a.length-1)}function bwg_select_tag(e,t,i,a,r,_){_&&jQuery("#bwg_tag_id_"+i).val(""),bwg_ajax(t,e,i,a,"",r,1,"")}function bwg_cube(e,t,i,a,r,_,s,o,l,n,g){var w,b=!1,u="";if(void 0!==g&&""!==g){b=!0,bwg_params[g].bwg_trans_in_progress=!0,u="_"+g,w=bwg_params[g].bwg_transition_duration;bwg_params[g].event_stack}else w=bwg_transition_duration;if(!bwg_testBrowser_cssTransitions(g))return bwg_fallback(o,l,n,g);if(!bwg_testBrowser_cssTransforms3d(g))return bwg_fallback3d(o,l,n,g);function d(){if(jQuery(o).removeAttr("style"),jQuery(l).removeAttr("style"),jQuery(".bwg_slider"+u).removeAttr("style"),jQuery(o).css({opacity:0,"z-index":1}),jQuery(l).css({opacity:1,"z-index":2}),jQuery(".bwg_image_info").show(),jQuery(o).html(""),b){bwg_change_watermark_container(g),bwg_params[g].bwg_trans_in_progress=!1;var e=bwg_params[g].data,t=bwg_params[g].event_stack}else{e="";gallery_box_data.bwg_trans_in_progress=!1;t=gallery_box_data.event_stack}if(void 0!==t&&0<t.length){var i=t[0].split("-");t.shift(),bwg_change_image(i[0],i[1],e,!0,g)}bwg_change_watermark_container()}b?(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+g).removeClass("bwg_slideshow_thumb_active_"+g).addClass("bwg_slideshow_thumb_deactive_"+g),jQuery("#bwg_filmstrip_thumbnail_"+bwg_params[g].bwg_current_key+"_"+g).removeClass("bwg_slideshow_thumb_deactive_"+g).addClass("bwg_slideshow_thumb_active_"+g),jQuery(".bwg_slideshow_dots_"+g).removeClass("bwg_slideshow_dots_active_"+g).addClass("bwg_slideshow_dots_deactive_"+g),jQuery("#bwg_dots_"+bwg_params[g].bwg_current_key+"_"+g).removeClass("bwg_slideshow_dots_deactive_"+g).addClass("bwg_slideshow_dots_active_"+g),jQuery(".bwg_slide_bg_"+g).css("perspective",1e3)):(gallery_box_data.bwg_trans_in_progress=!0,jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+gallery_box_data.bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active"),jQuery(".bwg_slide_bg").css("perspective",1e3)),jQuery(o).css({transform:"translateZ("+e+"px)",backfaceVisibility:"hidden"}),jQuery(l).css({opacity:1,backfaceVisibility:"hidden",transform:"translateY("+i+"px) translateX("+t+"px) rotateY("+r+"deg) rotateX("+a+"deg)"}),jQuery(".bwg_slider"+u).css({transform:"translateZ(-"+e+"px)",transformStyle:"preserve-3d"}),setTimeout(function(){jQuery(".bwg_slider"+u).css({transition:"all "+w+"ms ease-in-out",transform:"translateZ(-"+e+"px) rotateX("+_+"deg) rotateY("+s+"deg)"})},20),jQuery(".bwg_slider"+u).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(d)),0==w&&d()}function bwg_fade(e,t,i,a){var r,_=!1;function s(){jQuery(".bwg_image_info").show(),bwg_change_watermark_container(a),_?bwg_params[a].bwg_trans_in_progress=!1:gallery_box_data.bwg_trans_in_progress=!1}r=void 0!==a&&""!==a?(_=!0,bwg_params[a].bwg_trans_in_progress=!0,bwg_params[a].bwg_transition_duration):(gallery_box_data.bwg_trans_in_progress=!0,gallery_box_data.bwg_transition_duration),_?(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+a).removeClass("bwg_slideshow_thumb_active_"+a).addClass("bwg_slideshow_thumb_deactive_"+a),jQuery("#bwg_filmstrip_thumbnail_"+bwg_params[a].bwg_current_key+"_"+a).removeClass("bwg_slideshow_thumb_deactive_"+a).addClass("bwg_slideshow_thumb_active_"+a),jQuery(".bwg_slideshow_dots_"+a).removeClass("bwg_slideshow_dots_active_"+a).addClass("bwg_slideshow_dots_deactive_"+a),jQuery("#bwg_dots_"+bwg_params[a].bwg_current_key+"_"+a).removeClass("bwg_slideshow_dots_deactive_"+a).addClass("bwg_slideshow_dots_active_"+a)):(jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"),jQuery("#bwg_filmstrip_thumbnail_"+gallery_box_data.bwg_current_key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active")),bwg_testBrowser_cssTransitions()?(jQuery(t).css("transition","opacity "+r+"ms linear"),jQuery(e).css("transition","opacity "+r+"ms linear"),jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),jQuery(t).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(s))):(jQuery(e).animate({opacity:0,"z-index":1},r),jQuery(t).animate({opacity:1,"z-index":2},{duration:r,complete:function(){_?bwg_params[a].bwg_trans_in_progress=!1:gallery_box_data.bwg_trans_in_progress=!1,jQuery(e).html(""),s()}}),jQuery(e).fadeTo(r,0),jQuery(t).fadeTo(r,1)),0==r&&s()}function bwg_change_watermark_container(t){jQuery(".bwg_slider"+(void 0!==t&&""!==t?"_"+t:"")).children().each(function(){if(2==jQuery(this).css("zIndex")){var e=jQuery(this).find("img");if(e.length)if(e.prop("complete"))bwg_change_each_watermark_container(e.width(),e.height(),t);else e.on("load",function(){bwg_change_each_watermark_container(e.width(),e.height(),t)});else(e=jQuery(this).find("iframe")).length||(e=jQuery(this).find("video")),bwg_change_each_watermark_container(e.width(),e.height(),t)}})}function bwg_change_each_watermark_container(e,t,i){var a=void 0!==i&&""!==i?"_"+i:"",r=void 0!==i&&""!==i?"_slideshow":"";if(jQuery(".bwg"+r+"_watermark_spun"+a).width(e),jQuery(".bwg"+r+"_watermark_spun"+a).height(t),jQuery(".bwg"+r+"_watermark"+a).css({display:""}),void 0===i||""===i){var _=0;(jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_ecommerce_container").hasClass("bwg_open"))&&(_=gallery_box_data.lightbox_comment_width),e<=jQuery(window).width()-_&&(jQuery(".bwg_watermark_image").css({width:(jQuery(".spider_popup_wrap").width()-_)*gallery_box_data.watermark_font_size/gallery_box_data.image_width}),jQuery(".bwg_watermark_text, .bwg_watermark_text:hover").css({fontSize:(jQuery(".spider_popup_wrap").width()-_)*gallery_box_data.watermark_font_size/gallery_box_data.image_width}))}else jQuery(".bwg"+r+"_title_spun"+a).width(e),jQuery(".bwg"+r+"_title_spun"+a).height(t),jQuery(".bwg"+r+"_description_spun"+a).width(e),jQuery(".bwg"+r+"_description_spun"+a).height(t);jQuery.trim(jQuery(".bwg"+r+"_title_text"+a).text())&&jQuery(".bwg_slideshow_title_text"+a).css({display:""}),jQuery.trim(jQuery(".bwg"+r+"_description_text"+a).text())&&jQuery(".bwg"+r+"_description_text"+a).css({display:""})}function bwg_set_filmstrip_pos(e,t,i){var a,r=void 0!==t&&""!==t?"_"+t:"",_=void 0!==t&&""!==t?"_slideshow":"";a=void 0!==t&&""!==t?bwg_params[t].left_or_top:gallery_box_data.left_or_top;var s=parseInt(jQuery(".bwg_filmstrip_thumbnails").attr("data-all-images-top-bottom-space")),o=parseInt(jQuery(".bwg_filmstrip_thumbnails").attr("data-all-images-right-left-space"));if(void 0===t||""===t){if("outerWidth"==gallery_box_data.outerWidth_or_outerHeight)var l=-bwg_current_filmstrip_pos-jQuery(".bwg_filmstrip_thumbnail").outerWidth(!0)/2;else if("outerHeight"==gallery_box_data.outerWidth_or_outerHeight)l=-bwg_current_filmstrip_pos-jQuery(".bwg_filmstrip_thumbnail").outerHeight(!0)/2;if("width"==gallery_box_data.width_or_height)var n=Math.min(0,Math.max(e-jQuery(".bwg_filmstrip_thumbnails").width(),l+e/2));else if("height"==gallery_box_data.width_or_height)n=Math.min(0,Math.max(e-jQuery(".bwg_filmstrip_thumbnails").height(),l+e/2))}else if("width"==bwg_params[t].width_or_height)l=-bwg_params[t].bwg_current_filmstrip_pos-(jQuery(".bwg_slideshow_filmstrip_thumbnail"+r).width()+bwg_params[t].filmstrip_thumb_margin_hor)/2,n=Math.min(0,Math.max(e-jQuery(".bwg_slideshow_filmstrip_thumbnails"+r).width(),l+e/2));else l=-bwg_params[t].bwg_current_filmstrip_pos-(jQuery(".bwg_slideshow_filmstrip_thumbnail"+r).height()+bwg_params[t].filmstrip_thumb_margin_hor)/2,n=Math.min(0,Math.max(e-jQuery(".bwg_slideshow_filmstrip_thumbnails"+r).height(),l+e/2));0<n+o&&(o=0),0<n+s&&(s=0),"left"==a?jQuery(".bwg"+_+"_filmstrip_thumbnails"+r).animate({left:n+o},{duration:500,complete:function(){bwg_filmstrip_arrows(t)}}):jQuery(".bwg"+_+"_filmstrip_thumbnails"+r).animate({top:n+s},{duration:500,complete:function(){bwg_filmstrip_arrows(t)}})}function bwg_filmstrip_arrows(e){var t=void 0!==e&&""!==e?"_"+e:"",i=void 0!==e&&""!==e?"_slideshow":"";if("width"==(void 0!==e&&""!==e?bwg_params[e].width_or_heigh:gallery_box_data.width_or_height))var a=jQuery(".bwg"+i+"_filmstrip_thumbnails"+t).width(),r=jQuery(".bwg"+i+"_filmstrip"+t).width();else a=jQuery(".bwg"+i+"_filmstrip_thumbnails"+t).height(),r=jQuery(".bwg"+i+"_filmstrip"+t).height();a<r?(jQuery(".bwg"+i+"_filmstrip_left"+t).hide(),jQuery(".bwg"+i+"_filmstrip_right"+t).hide()):(jQuery(".bwg"+i+"_filmstrip_left"+t).show(),jQuery(".bwg"+i+"_filmstrip_right"+t).show())}function bwg_move_filmstrip(e){var t,i,a,r,_,s,o=void 0!==e&&""!==e?"_"+e:"",l=void 0!==e&&""!==e?"_slideshow":"",n=void 0!==e&&""!==e?bwg_params[e].outerWidth_or_outerHeight:gallery_box_data.outerWidth_or_outerHeight,g=void 0!==e&&""!==e?bwg_params[e].left_or_top:gallery_box_data.left_or_top;i="outerWidth"==n?(t=jQuery(".bwg"+l+"_filmstrip"+o).outerWidth(!0),jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).outerWidth(!0)):(t=jQuery(".bwg"+l+"_filmstrip"+o).outerHeight(!0),jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).outerHeight(!0)),s="left"==g?(a=jQuery(".bwg"+l+"_thumb_active"+o).position().left,r="outerWidth"==n?jQuery(".bwg"+l+"_thumb_active"+o).position().left+jQuery(".bwg"+l+"_thumb_active"+o).outerWidth(!0):jQuery(".bwg"+l+"_thumb_active"+o).position().left+jQuery(".bwg"+l+"_thumb_active"+o).outerHeight(!0),_=jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().left,Math.abs(jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().left)+t):(a=jQuery(".bwg"+l+"_thumb_active"+o).position().top,r="outerWidth"==n?jQuery(".bwg"+l+"_thumb_active"+o).position().top+jQuery(".bwg"+l+"_thumb_active"+o).outerWidth(!0):jQuery(".bwg"+l+"_thumb_active"+o).position().top+jQuery(".bwg"+l+"_thumb_active"+o).outerHeight(!0),_=jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().top,Math.abs(jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).position().top)+t),i<t||(a<Math.abs(_)?"left"==g?jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({left:-a},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}}):jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({top:-a},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}}):s<r&&("left"==g?jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({left:-(r-t)},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}}):jQuery(".bwg"+l+"_filmstrip_thumbnails"+o).animate({top:-(r-t)},{duration:500,complete:function(){bwg_filmstrip_arrows(e)}})))}function bwg_move_dots(e){var t=jQuery(".bwg_slideshow_dots_active_"+e).position().left,i=jQuery(".bwg_slideshow_dots_active_"+e).position().left+jQuery(".bwg_slideshow_dots_active_"+e).outerWidth(!0),a=jQuery(".bwg_slideshow_dots_container_"+e).outerWidth(!0),r=jQuery(".bwg_slideshow_dots_thumbnails_"+e).outerWidth(!1),_=jQuery(".bwg_slideshow_dots_thumbnails_"+e).position().left,s=Math.abs(jQuery(".bwg_slideshow_dots_thumbnails_"+e).position().left)+a;r<a||(t<Math.abs(_)?jQuery(".bwg_slideshow_dots_thumbnails_"+e).animate({left:-t},{duration:500,complete:function(){}}):s<i&&jQuery(".bwg_slideshow_dots_thumbnails_"+e).animate({left:-(i-a)},{duration:500,complete:function(){}}))}function bwg_testBrowser_cssTransitions(e){return bwg_testDom("Transition",e)}function bwg_testBrowser_cssTransforms3d(e){return bwg_testDom("Perspective",e)}function bwg_testDom(e,t){for(var i=["","Webkit","Moz","ms","O","Khtml"],a=i.length;a--;)if(void 0!==document.body.style[i[a]+e])return!0;return!1}function bwg_fallback(e,t,i,a){bwg_fade(e,t,i,a)}function bwg_fallback3d(e,t,i,a){bwg_sliceV(e,t,i,a)}function bwg_none(e,t,i,a){var r=void 0!==a&&""!==a?"_"+a:"";if(jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),void 0!==a&&""!==a){var _=bwg_params[a].bwg_current_key;bwg_change_watermark_container(a),jQuery(".bwg_slideshow_filmstrip_thumbnail"+r).removeClass("bwg_slideshow_thumb_active"+r).addClass("bwg_slideshow_thumb_deactive"+r),jQuery("#bwg_filmstrip_thumbnail_"+_+r).removeClass("bwg_slideshow_thumb_deactive"+r).addClass("bwg_slideshow_thumb_active"+r),jQuery(".bwg_slideshow_dots"+r).removeClass("bwg_slideshow_dots_active"+r).addClass("bwg_slideshow_dots_deactive"+r),jQuery("#bwg_dots_"+_+r).removeClass("bwg_slideshow_dots_deactive"+r).addClass("bwg_slideshow_dots_active"+r)}else jQuery(".bwg_image_info").show(),gallery_box_data.bwg_trans_in_progress=!1,jQuery(e).html(""),bwg_change_watermark_container()}function bwg_iterator(e){var t=1;return void 0!==e&&""!==e&&void 0!==bwg_params[e]&&1==bwg_params[e].enable_slideshow_shuffle&&(t=Math.floor((bwg_params[e].data.length-1)*Math.random()+1)),t}function bwg_change_image_slideshow(e,t,i,a,r){i=bwg_params[r].data;if(jQuery("#bwg_slideshow_image_container_"+r).find("iframe").each(function(){jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*"),jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }',"*"),jQuery(this)[0].contentWindow.postMessage("pause","*")}),jQuery("#image_id_"+r+"_"+i[e].id).find(".bwg_fb_video").each(function(){jQuery(this).attr("src",jQuery(this).attr("src"))}),i[t]){if(jQuery(".bwg_ctrl_btn_"+r).hasClass("bwg-icon-pause")&&bwg_play(bwg_params[r].data,r),a||(jQuery("#bwg_current_image_key_"+r).val(t),"-1"==e?e=jQuery(".bwg_slideshow_thumb_active_"+r).children("img").attr("image_key"):"-2"==e&&(e=jQuery(".bwg_slideshow_dots_active_"+r).attr("image_key"))),bwg_params[r].bwg_trans_in_progress)return void bwg_params[r].event_stack.push(e+"-"+t);var _="right";if(t<e)_="left";else if(e==t)return;jQuery(".bwg_slideshow_watermark_"+r).css({display:"none"}),jQuery(".bwg_slideshow_title_text_"+r).css({display:"none"}),jQuery(".bwg_slideshow_description_text_"+r).css({display:"none"}),"width"==bwg_params[r].width_or_height?bwg_params[r].bwg_current_filmstrip_pos=t*(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+r).width()+2+2*bwg_params[r].lightbox_filmstrip_thumb_border_width):bwg_params[r].bwg_current_filmstrip_pos=t*(jQuery(".bwg_slideshow_filmstrip_thumbnail_"+r).height()+2+2*bwg_params[r].lightbox_filmstrip_thumb_border_width),e=t,bwg_params[r].bwg_current_key=e,jQuery("#bwg_slideshow_image_"+r).attr("image_id",i[t].id),jQuery(".bwg_slideshow_title_text_"+r).html(jQuery('<span style="display: block;" />').html(i[t].alt).text()),jQuery(".bwg_slideshow_description_text_"+r).html(jQuery('<span style="display: block;" />').html(i[t].description).text());var s=2==jQuery(".bwg_slideshow_image_spun_"+r).css("zIndex")?".bwg_slideshow_image_spun_"+r:".bwg_slideshow_image_second_spun_"+r,o=s==".bwg_slideshow_image_second_spun_"+r?".bwg_slideshow_image_spun_"+r:".bwg_slideshow_image_second_spun_"+r,l=-1<i[t].filetype.indexOf("EMBED_"),n=-1<i[t].filetype.indexOf("INSTAGRAM_POST"),g=-1<i[t].filetype.indexOf("INSTAGRAM_VIDEO"),w=jQuery(s).height(),b=jQuery(s).width(),u='<span class="bwg_slideshow_image_spun1_'+r+'" style="display: '+(l?"block":"table")+' ;width: inherit; height: inherit;"><span class="bwg_slideshow_image_spun2_'+r+'" style="display: '+(l?"block":"table-cell")+'; vertical-align: middle; text-align: center; ">';if(l){if(u+='<span style="height: '+w+"px; width: "+b+'px;" class="bwg_popup_embed bwg_popup_watermark">',g&&(u+='<span class="bwg_inst_play_btn_cont" onclick="bwg_play_instagram_video(this)"><span class="bwg_inst_play"></span></span>'),n){var d=0,h=0;w<b+88?d=(h=w)-88:h=(d=b)+88,u+=spider_display_embed(i[t].filetype,decodeURIComponent(i[t].image_url),i[t].filename,{class:"bwg_embed_frame","data-width":i[t].image_width,"data-height":i[t].image_height,frameborder:"0",allowfullscreen:"allowfullscreen",style:"width:"+d+"px; height:"+h+"px; vertical-align:middle; display:inline-block; position:relative;"})}else u+=spider_display_embed(i[t].filetype,decodeURIComponent(i[t].image_url),i[t].filename,{class:"bwg_embed_frame",frameborder:"0",allowfullscreen:"allowfullscreen",style:"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"});u+="</span>"}else{if("do_nothing"!=bwg_params[r].thumb_click_action){var m="";"open_lightbox"==bwg_params[r].thumb_click_action?m+=' class="bwg_lightbox" data-image-id="'+i[t].id+'"':"redirect_to_url"==bwg_params[r].thumb_click_action&&i[t].redirect_url&&(m+='href="'+i[t].redirect_url+'"'+(bwg_params[r].thumb_link_target&&1==bwg_params[r].thumb_link_target?' target="_blank"':"")),u+="<a "+m+">"}u+='<img style="max-height: '+w+"px !important; max-width: "+b+'px !important; display:inline-block;" ',u+=' class="bwg_slide bwg_slideshow_image_'+r+'" ',u+=' id="bwg_slideshow_image_'+r+'" ',u+=' src="'+bwg_params[r].upload_url+jQuery("<span style='display: block;' />").html(decodeURIComponent(i[t].image_url)).text()+'" alt="'+i[t].alt+'" image_id="'+i[t].id+'" /></a>'}u+="</span></span>",jQuery(o).html(u),bwg_params[r].preload_images&&bwg_preload_images(t,r),window["bwg_"+bwg_params[r].slideshow_effect](s,o,_,r),0<bwg_params[r].enable_slideshow_filmstrip?bwg_move_filmstrip(r):bwg_move_dots(r),i[t].is_embed_video?jQuery("#bwg_slideshow_play_pause_"+r).css({display:"none"}):jQuery("#bwg_slideshow_play_pause_"+r).css({display:""})}bwg_add_lightbox()}function bwg_preload_images_slideshow(e,t){var i=bwg_params[t].data;count=bwg_params[t].preload_images_count/2;var a=i.length;if(a<bwg_params[t].preload_images_count&&(count=0),0!=count)for(var r=e-count;r<e+count;r++){var _=parseInt((r+a)%a),s=-1<i[_].filetype.indexOf("EMBED_");void 0!==i[_]&&(s||jQuery("<img/>").attr("src",bwg_params[t].upload_url+jQuery('<span style="display: block;" />').html(decodeURIComponent(i[_].image_url)).text()))}else for(r=0;r<i.length;r++){s=-1<i[r].filetype.indexOf("EMBED_");void 0!==i[r]&&(s||jQuery("<img/>").attr("src",bwg_params[t].upload_url+jQuery('<span style="display: block;" />').html(decodeURIComponent(i[r].image_url)).text()))}}function bwg_preload_images(e,t){void 0!==t&&""!==t?bwg_preload_images_slideshow(e,t):bwg_preload_images_lightbox(e)}function bwg_popup_resize_slidshow(e){var t=jQuery(".bwg_slideshow_image_wrap_"+e).parent().width(),i=bwg_params[e].data;if(t>=bwg_params[e].image_width){jQuery(".bwg_slideshow_image_wrap_"+e).css({width:bwg_params[e].image_width}),jQuery(".bwg_slideshow_image_wrap_"+e).css({height:bwg_params[e].image_height}),jQuery(".bwg_slideshow_image_container_"+e).css({width:"horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].image_width:bwg_params[e].image_width-bwg_params[e].slideshow_filmstrip_width}),jQuery(".bwg_slideshow_image_container_"+e).css({height:"horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].image_height-bwg_params[e].slideshow_filmstrip_height:bwg_params[e].image_height}),jQuery(".bwg_slideshow_image_"+e).css({cssText:(bwg_params[e].filmstrip_direction,bwg_params[e].image_width)}),jQuery(".bwg_slideshow_embed_"+e).css({cssText:(bwg_params[e].filmstrip_direction,bwg_params[e].image_width)}),bwg_resize_instagram_post(e),bwg_change_watermark_container(e);var a="horizontal"==bwg_params[e].filmstrip_direction?"width: "+bwg_params[e].image_width:"height: "+bwg_params[e].image_height,r="horizontal"==bwg_params[e].filmstrip_direction?"width: "+(bwg_params[e].image_width-40):"height: "+(bwg_params[e].image_height-40);jQuery(".bwg_slideshow_filmstrip_container_"+e).css({cssText:a}),jQuery(".bwg_slideshow_filmstrip_"+e).css({cssText:r}),jQuery(".bwg_slideshow_dots_container_"+e).css({width:bwg_params[e].image_width}),jQuery("#bwg_slideshow_play_pause-ico_"+e).css({fontSize:bwg_params[e].slideshow_play_pause_btn_size}),"image"==bwg_params[e].watermark_type&&jQuery(".bwg_slideshow_watermark_image_"+e).css({maxWidth:bwg_params[e].watermark_width,maxHeight:bwg_params[e].watermark_height}),"text"==bwg_params[e].watermark_type&&jQuery(".bwg_slideshow_watermark_text_"+e+", .bwg_slideshow_watermark_text_"+e+" : hover").css({fontSize:bwg_params[e].watermark_font_size}),jQuery(".bwg_slideshow_title_text_"+e).css({fontSize:2*bwg_params[e].slideshow_title_font_size}),jQuery(".bwg_slideshow_description_text_"+e).css({fontSize:2*bwg_params[e].slideshow_description_font_size})}else jQuery(".bwg_slideshow_image_wrap_"+e).css({width:t}),jQuery(".bwg_slideshow_image_wrap_"+e).css({height:t*bwg_params[e].image_height/bwg_params[e].image_width}),jQuery(".bwg_slideshow_image_container_"+e).css({width:t-("horizontal"==bwg_params[e].filmstrip_direction?0:bwg_params[e].slideshow_filmstrip_width)}),jQuery(".bwg_slideshow_image_container_"+e).css({height:t*bwg_params[e].image_height/bwg_params[e].image_width-("horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].slideshow_filmstrip_height:0)}),jQuery(".bwg_slideshow_image_"+e).css({cssText:"max-width: "+(t-("horizontal"==bwg_params[e].filmstrip_direction?0:bwg_params[e].slideshow_filmstrip_width))+"px !important; max-height: "+(t*(bwg_params[e].image_height/bwg_params[e].image_width)-("horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].slideshow_filmstrip_height:0)-1)+"px !important;"}),jQuery(".bwg_slideshow_embed_"+e).css({cssText:"width: "+(t-("horizontal"==bwg_params[e].filmstrip_direction?0:bwg_params[e].slideshow_filmstrip_width))+"px !important; height: "+(t*(bwg_params[e].image_height/bwg_params[e].image_width)-("horizontal"==bwg_params[e].filmstrip_direction?bwg_params[e].slideshow_filmstrip_height:0)-1)+"px !important;"}),bwg_resize_instagram_post(e),bwg_change_watermark_container(e),"horizontal"==bwg_params[e].filmstrip_direction?(jQuery(".bwg_slideshow_filmstrip_container_"+e).css({width:t}),jQuery(".bwg_slideshow_filmstrip_"+e).css({width:t-40})):(jQuery(".bwg_slideshow_filmstrip_container_"+e).css({height:t*bwg_params[e].image_height/bwg_params[e].image_width}),jQuery(".bwg_slideshow_filmstrip_"+e).css({height:t*bwg_params[e].image_height/bwg_params[e].image_width-40})),jQuery(".bwg_slideshow_dots_container_"+e).css({width:t}),jQuery("#bwg_slideshow_play_pause-ico_"+e).css({fontSize:t*bwg_params[e].slideshow_play_pause_btn_size/bwg_params[e].image_width}),jQuery(".bwg_slideshow_watermark_image_"+e).css({maxWidth:t*bwg_params[e].watermark_width/bwg_params[e].image_width,maxHeight:t*bwg_params[e].watermark_height/bwg_params[e].image_width}),jQuery(".bwg_slideshow_watermark_text_"+e+", .bwg_slideshow_watermark_text_"+e+":hover").css({fontSize:t*bwg_params[e].watermark_font_size/bwg_params[e].image_width}),jQuery(".bwg_slideshow_title_text_"+e).css({fontSize:2*t*bwg_params[e].slideshow_title_font_size/bwg_params[e].image_width}),jQuery(".bwg_slideshow_description_text_"+e).css({fontSize:2*t*bwg_params[e].slideshow_description_font_size/bwg_params[e].image_width}),jQuery(".bwg_slideshow_image_"+e).css({display:"inline-block"});i[parseInt(jQuery("#bwg_current_image_key_"+e).val())].is_embed_video?jQuery("#bwg_slideshow_play_pause_"+e).css({display:"none"}):jQuery("#bwg_slideshow_play_pause_"+e).css({display:""})}function bwg_popup_resize(e){void 0!==e&&""!==e?bwg_popup_resize_slidshow(e):bwg_popup_resize_lightbox()}function bwg_change_image(e,t,i,a,r){void 0!==r&&""!==r?bwg_change_image_slideshow(e,t,i,a,r):bwg_change_image_lightbox(e,t,i=gallery_box_data.data,a)}function bwg_resize_instagram_post(e){if(void 0!==e&&""!==e){if(jQuery(".inner_instagram_iframe_bwg_embed_frame_"+e).length){var t=jQuery(".bwg_slideshow_embed_"+e).width(),i=jQuery(".bwg_slideshow_embed_").height();jQuery(".inner_instagram_iframe_bwg_embed_frame_"+e).each(function(){var e=jQuery(this).parent();i/(parseInt(e.attr("data-height"))+96)<t/parseInt(e.attr("data-width"))?(e.height(i),e.width((e.height()-96)*e.attr("data-width")/e.attr("data-height")+16)):(e.width(t),e.height((e.width()-16)*e.attr("data-height")/e.attr("data-width")+96))}),bwg_change_watermark_container(e)}}else if(jQuery(".inner_instagram_iframe_bwg_embed_frame").length){t=jQuery(".bwg_image_container").width(),i=jQuery(".bwg_image_container").height();jQuery(".inner_instagram_iframe_bwg_embed_frame").each(function(){var e=jQuery(this).parent();i/(parseInt(e.attr("data-height"))+176)<t/parseInt(e.attr("data-width"))?(e.height(i),e.width((e.height()-176)*e.attr("data-width")/e.attr("data-height")+16)):(e.width(t),e.height((e.width()-16)*e.attr("data-height")/e.attr("data-width")+96)),e.css({top:.5*(i-e.height())})}),bwg_change_watermark_container()}}function bwg_play(t,i){if(void 0!==i&&""!==i)t=bwg_params[i].data;void 0!==i&&""!==i?(window.clearInterval(window["bwg_playInterval"+i]),window["bwg_playInterval"+i]=setInterval(function(){var e=1;1==bwg_params[i].enable_slideshow_shuffle&&(e=Math.floor((t.length-1)*Math.random()+1)),bwg_change_image(parseInt(jQuery("#bwg_current_image_key_"+i).val()),(parseInt(jQuery("#bwg_current_image_key_"+i).val())+e)%t.length,t,"",i)},1e3*bwg_params[i].slideshow_interval)):(window.clearInterval(gallery_box_data.bwg_playInterval),gallery_box_data.bwg_playInterval=setInterval(function(){jQuery(".bwg_comment_container").hasClass("bwg_open")||jQuery(".bwg_play_pause").length&&jQuery(".bwg_play_pause").hasClass("bwg-icon-play")||(void 0===t||void 0!==t[parseInt(jQuery("#bwg_current_image_key").val())+1]?bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),parseInt(jQuery("#bwg_current_image_key").val())+1):1==gallery_box_data.enable_loop&&bwg_change_image(parseInt(jQuery("#bwg_current_image_key").val()),0))},1e3*gallery_box_data.slideshow_interval))}function bwg_image_browser(e){if(jQuery("#bwg_embed_frame_16x9_"+e).width(jQuery("#bwg_embed_frame_16x9_"+e).parents(".image_browser_image_buttons_"+e).width()),jQuery("#bwg_embed_frame_16x9_"+e).height(.5625*jQuery("#bwg_embed_frame_16x9_"+e).width()),jQuery("#bwg_embed_frame_instapost_"+e).width(jQuery("#bwg_embed_frame_16x9_"+e).parents(".image_browser_image_buttons_"+e).width()),jQuery(".image_browser_images_conteiner_"+e).find(".fluid-width-video-wrapper").length){var t=jQuery(".image_browser_images_conteiner_"+e).find(".fluid-width-video-wrapper").contents();jQuery(".image_browser_images_conteiner_"+e).find(".fluid-width-video-wrapper").replaceWith(t)}jQuery(".bwg_embed_frame_instapost_"+e).height((jQuery(".bwg_embed_frame_instapost_"+e).width()-16)*jQuery(".bwg_embed_frame_instapost_"+e).attr("data-height")/jQuery(".bwg_embed_frame_instapost_"+e).attr("data-width")+96);var i=jQuery(".image_browser_images_"+e).width();i<=108?jQuery(".paging-input_"+e).css("display","none"):(i<=200?(jQuery(".paging-input_"+e).css("margin","0% 0% 0% 0%"),jQuery(".paging-input_"+e).css("display","inline")):i<=580?(jQuery(".paging-input_"+e).css("display","inline"),jQuery(".tablenav-pages_"+e+" a").css("font-size","13px"),jQuery(".paging-input_"+e).css("margin","0% 7% 0% 7%")):(jQuery(".tablenav-pages_"+e+" a").css("font-size","15px"),jQuery(".paging-input_"+e).css("margin","0% 14% 0% 14%"),jQuery(".paging-input_"+e).css("display","inline")),jQuery(".tablenav-pages_"+e+" .next-page").css("margin","0% 0% 0% 0%"),jQuery(".tablenav-pages_"+e+" .prev-page").css("margin","0% 0% 0% 0%"))}function bwg_disable_right_click(e){e.bind("contextmenu",function(){return!1}),e.css("webkitTouchCallout","none")}jQuery(function(){bwg_main_ready(),jQuery(".bwg_container").each(function(){var e=!1;if(0<jQuery(this).find(".wd_error").length&&(e=!0),!e){var t=0;jQuery(this).on("visibility",function(){var e=jQuery(this);setInterval(function(){e.is(":hidden")?1==t&&(t=0,bwg_slideshow_blur()):0==t&&(t=1,bwg_main_ready(),bwg_slideshow_focus())},300)}).trigger("visibility")}})}),jQuery(window).on("resize",function(){setTimeout(function(){var e=!1;jQuery(".bwg_container").each(function(){0<jQuery(this).find(".wd_error").length&&(e=!0)}),e||(jQuery(".bwg-thumbnails, .bwg-masonry-thumbnails, .bwg-album-thumbnails").each(function(){bwg_all_thumnails_loaded(this)}),bwg_slideshow_resize(),bwg_image_browser_resize(),bwg_carousel_resize(),bwg_blog_style_resize(),jQuery(".bwg-mosaic-thumbnails").each(function(){bwg_thumbnail_mosaic(this)})),bwg_resize_search_line()},0)}),jQuery(window).on("load",function(){var e=!1;jQuery(".bwg_container").each(function(){0<jQuery(this).find(".wd_error").length&&(e=!0)}),e||(bwg_blog_style_onload(),jQuery(".bwg-mosaic-thumbnails").each(function(){bwg_thumbnail_mosaic(this)}))}),jQuery(".bwg-masonry-thumb-span img, .bwg-mosaic-thumb-span img").on("error",function(){jQuery(this).height(100),jQuery(this).width(100)});
photo-gallery.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Photo Gallery
4
  * Plugin URI: https://10web.io/plugins/wordpress-photo-gallery/?utm_source=photo_gallery&utm_medium=free_plugin
5
  * Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
6
- * Version: 1.5.60
7
  * Author: Photo Gallery Team
8
  * Author URI: https://10web.io/plugins/?utm_source=photo_gallery&utm_medium=free_plugin
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -106,8 +106,8 @@ final class BWG {
106
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
107
  $this->front_url = $this->plugin_url;
108
  $this->main_file = plugin_basename(__FILE__);
109
- $this->plugin_version = '1.5.60';
110
- $this->db_version = '1.5.60';
111
  $this->prefix = 'bwg';
112
  $this->nicename = __('Photo Gallery', $this->prefix);
113
  require_once($this->plugin_dir . '/framework/BWGOptions.php');
@@ -1871,7 +1871,7 @@ final class BWG {
1871
  * @param $add_ons_notice
1872
  */
1873
  function addons_compatibility_notice($add_ons_notice) {
1874
- $addon_names = implode($add_ons_notice, ', ');
1875
  $count = count($add_ons_notice);
1876
  $single = __('Please update the %s add-on to start using.', $this->prefix);
1877
  $plural = __('Please update the %s add-ons to start using.', $this->prefix);
3
  * Plugin Name: Photo Gallery
4
  * Plugin URI: https://10web.io/plugins/wordpress-photo-gallery/?utm_source=photo_gallery&utm_medium=free_plugin
5
  * Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
6
+ * Version: 1.5.61
7
  * Author: Photo Gallery Team
8
  * Author URI: https://10web.io/plugins/?utm_source=photo_gallery&utm_medium=free_plugin
9
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
106
  $this->plugin_url = plugins_url(plugin_basename(dirname(__FILE__)));
107
  $this->front_url = $this->plugin_url;
108
  $this->main_file = plugin_basename(__FILE__);
109
+ $this->plugin_version = '1.5.61';
110
+ $this->db_version = '1.5.61';
111
  $this->prefix = 'bwg';
112
  $this->nicename = __('Photo Gallery', $this->prefix);
113
  require_once($this->plugin_dir . '/framework/BWGOptions.php');
1871
  * @param $add_ons_notice
1872
  */
1873
  function addons_compatibility_notice($add_ons_notice) {
1874
+ $addon_names = implode(', ', $add_ons_notice);
1875
  $count = count($add_ons_notice);
1876
  $single = __('Please update the %s add-on to start using.', $this->prefix);
1877
  $plural = __('Please update the %s add-ons to start using.', $this->prefix);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: webdorado,wdsupport,photogallerysupport,10web
3
  Tags: gallery, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, photo albums, gallery slider, gallery lightbox, wordpress photo gallery plugin, fullscreen gallery, watermarking, video gallery
4
  Requires at least: 4.6
5
  Tested up to: 5.5
6
- Stable tag: 1.5.60
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -281,6 +281,11 @@ Choose whether to display random or the first/last specific number of images.
281
  **Theme.** Choose the theme, which will be applied to the gallery/album.
282
 
283
  == Changelog ==
 
 
 
 
 
284
  = 1.5.60 =
285
  * Fixed: JS Injection vulnerability.
286
 
3
  Tags: gallery, photo gallery, image gallery, responsive gallery, wordpress gallery plugin, photo albums, gallery slider, gallery lightbox, wordpress photo gallery plugin, fullscreen gallery, watermarking, video gallery
4
  Requires at least: 4.6
5
  Tested up to: 5.5
6
+ Stable tag: 1.5.61
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
281
  **Theme.** Choose the theme, which will be applied to the gallery/album.
282
 
283
  == Changelog ==
284
+ = 1.5.61 =
285
+ * Fixed: Conflicts with WP5.5.
286
+ * Fixed: Conflicts with PHP7.4.
287
+ * Fixed: Bug on lightbox fading effect.
288
+
289
  = 1.5.60 =
290
  * Fixed: JS Injection vulnerability.
291
 
wd/assets/js/overview.js CHANGED
@@ -1,7 +1,7 @@
1
  jQuery(window).resize(function () {
2
  tenWebOverviewResize();
3
  });
4
- jQuery(document).ready(function () {
5
  tenWebOverviewResize();
6
  });
7
 
1
  jQuery(window).resize(function () {
2
  tenWebOverviewResize();
3
  });
4
+ jQuery(function() {
5
  tenWebOverviewResize();
6
  });
7
 
wd/includes/deactivate.php CHANGED
@@ -45,7 +45,7 @@ class TenWebNewLibDeactivate {
45
  $wd_options = $this->config;
46
  ?>
47
  <script>
48
- jQuery(document).ready(function () {
49
  tenwebReady("<?php echo $wd_options->prefix; ?>");
50
  });
51
  </script>
45
  $wd_options = $this->config;
46
  ?>
47
  <script>
48
+ jQuery(function() {
49
  tenwebReady("<?php echo $wd_options->prefix; ?>");
50
  });
51
  </script>