Feeds for YouTube (YouTube video, channel, and gallery plugin) - Version 1.4

Version Description

  • New: The locations of the YouTube feeds on your site will now be logged and listed on a single page for easier management. After this feature has been active for awhile, a "Feed Finder" link will appear next to the Feed Type setting on the plugin Settings page which allows you to see a list of all feeds on your site along with their locations.
  • Fix: Pro version of the Web Toffee GDPR Cookie Consent plugin was not being detected.
  • Fix: Updated jQuery methods for compatibility with WordPress 5.7.
Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Feeds for YouTube (YouTube video, channel, and gallery plugin)
Version 1.4
Comparing to
See all releases

Code changes from version 1.3 to 1.4

README.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: smashballoon, craig-at-smash-balloon
4
  Support Website: http://smashballoon/youtube-feed/
5
  Tags: YouTube, YouTube feed, YouTube widget, YouTube channel, YouTube gallery
6
  Requires at least: 3.4
7
- Tested up to: 5.6
8
- Stable tag: 1.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -44,7 +44,7 @@ Customer support is a huge deal to us. We pride ourselves on always providing qu
44
  If you like the plugin then please consider leaving a review, as it really helps to support the plugin. If you have an issue then please allow us to help you fix it before leaving a review. Just [let us know](https://smashballoon.com/youtube-feed/support/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube Support') what the problem is and we'll get back to you right away.
45
 
46
  ### Pro Version
47
- We plan on releasing a [Pro version](http://smashballoon.com/youtube-feed/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube Pro') which includes some awesome additional features to help you display your content in even more powerful ways:
48
 
49
  * Display YouTube videos from your **favorites list**
50
  * Integrate the **YouTube Live API** to show live streaming videos on your site.
@@ -55,6 +55,8 @@ We plan on releasing a [Pro version](http://smashballoon.com/youtube-feed/?utm_s
55
  * Customizable **actions when video completes** like displaying a link to a product page for example, or displaying thumbnails of your other videos.
56
  * Download video data into a **custom post type** to allow visitors to browse and view videos on your website.
57
 
 
 
58
  ### How to use the "Feeds for YouTube" plugin
59
 
60
  One of our main priorities has always been to make our plugins as easy as possible to setup and use. Once you've installed the "Feeds for YouTube" plugin there are only a few steps to get up and running:
@@ -165,8 +167,13 @@ By default, the plugin retrieves new videos for your YouTube gallery once every
165
  7. To display a YouTube feed just copy and paste the [youtube-feed] shortcode into a widget or page
166
 
167
  == Changelog ==
 
 
 
 
 
168
  = 1.3 =
169
- * New: Integrations with popular GDPR cookie consent solutions added: Cookie Notice by dFactory, GDPR Cookie Consent by WebToffee, Cookiebot by Cybot A/S, Complianz by Really Simple Plugins, and Borlabs Cookie by Borlabs. Visit the YouTube Feed settings page, Customize tab, GDPR section for more information.
170
  * Fix: Date that video was published would not always match what was shown on YouTube.com.
171
 
172
  = 1.2.4 =
4
  Support Website: http://smashballoon/youtube-feed/
5
  Tags: YouTube, YouTube feed, YouTube widget, YouTube channel, YouTube gallery
6
  Requires at least: 3.4
7
+ Tested up to: 5.7
8
+ Stable tag: 1.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
44
  If you like the plugin then please consider leaving a review, as it really helps to support the plugin. If you have an issue then please allow us to help you fix it before leaving a review. Just [let us know](https://smashballoon.com/youtube-feed/support/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube Support') what the problem is and we'll get back to you right away.
45
 
46
  ### Pro Version
47
+ In order to maintain the free version of the plugin on an ongoing basis, and to provide quick and effective support for free, we offer a [Pro version](http://smashballoon.com/youtube-feed/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube Pro') of the plugin which includes some awesome additional features to help you display your content in even more powerful ways:
48
 
49
  * Display YouTube videos from your **favorites list**
50
  * Integrate the **YouTube Live API** to show live streaming videos on your site.
55
  * Customizable **actions when video completes** like displaying a link to a product page for example, or displaying thumbnails of your other videos.
56
  * Download video data into a **custom post type** to allow visitors to browse and view videos on your website.
57
 
58
+ Check out the [Pro version](http://smashballoon.com/youtube-feed/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube Pro').
59
+
60
  ### How to use the "Feeds for YouTube" plugin
61
 
62
  One of our main priorities has always been to make our plugins as easy as possible to setup and use. Once you've installed the "Feeds for YouTube" plugin there are only a few steps to get up and running:
167
  7. To display a YouTube feed just copy and paste the [youtube-feed] shortcode into a widget or page
168
 
169
  == Changelog ==
170
+ = 1.4 =
171
+ * New: The locations of the YouTube feeds on your site will now be logged and listed on a single page for easier management. After this feature has been active for awhile, a "Feed Finder" link will appear next to the Feed Type setting on the plugin Settings page which allows you to see a list of all feeds on your site along with their locations.
172
+ * Fix: Pro version of the Web Toffee GDPR Cookie Consent plugin was not being detected.
173
+ * Fix: Updated jQuery methods for compatibility with WordPress 5.7.
174
+
175
  = 1.3 =
176
+ * New: Integrations with popular GDPR cookie consent solutions added. Visit the YouTube Feed settings page, Customize tab, GDPR section for more information.
177
  * Fix: Date that video was published would not always match what was shown on YouTube.com.
178
 
179
  = 1.2.4 =
css/admin.css CHANGED
@@ -1150,4 +1150,34 @@
1150
  text-align: center;
1151
  width: 20px;
1152
  -webkit-font-smoothing: antialiased
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1153
  }
1150
  text-align: center;
1151
  width: 20px;
1152
  -webkit-font-smoothing: antialiased
1153
+ }
1154
+
1155
+ /* Locator Summary */
1156
+ .sby-feed-locator-summary-wrap {
1157
+ max-width: 1100px;
1158
+ margin-bottom: 40px;
1159
+ }
1160
+ .sby-full-wrap {
1161
+ display: none;
1162
+ }
1163
+ .sby-locator-more {
1164
+ display: inline-block;
1165
+ margin: 0 0 0 1px;
1166
+ padding: 0 5px;
1167
+ border: 1px solid rgba(0,0,0,0.1);
1168
+ border-radius: 3px;
1169
+ line-height: 1.6;
1170
+ }
1171
+
1172
+ .sby_shortcode_visible .sby_locations_link {
1173
+ display: none;
1174
+ }
1175
+ .sby_locations_link a {
1176
+ font-weight: normal;
1177
+ text-decoration: none;
1178
+ }
1179
+ .sby_locations_link svg {
1180
+ width: 11px;
1181
+ position: relative;
1182
+ top: 1px;
1183
  }
css/sby-notices.css CHANGED
@@ -2,6 +2,7 @@
2
  .sby_notice{
3
  position: relative;
4
  overflow: hidden;
 
5
  max-width: 885px;
6
  margin-top: 10px;
7
  padding: 10px 10px 7px 10px;
2
  .sby_notice{
3
  position: relative;
4
  overflow: hidden;
5
+ clear: both;
6
  max-width: 885px;
7
  margin-top: 10px;
8
  padding: 10px 10px 7px 10px;
inc/admin/admin-functions.php CHANGED
@@ -35,6 +35,13 @@ function sby_admin_init() {
35
  'slug' => 'support',
36
  'capability' => $capability,
37
  'numbered_tab' => false
 
 
 
 
 
 
 
38
  )
39
  );
40
 
35
  'slug' => 'support',
36
  'capability' => $capability,
37
  'numbered_tab' => false
38
+ ),
39
+ array(
40
+ 'title' => __( 'All Feeds', SBY_TEXT_DOMAIN ),
41
+ 'slug' => 'allfeeds',
42
+ 'capability' => $capability,
43
+ 'numbered_tab' => false,
44
+ 'has_nav_tab' => false
45
  )
46
  );
47
 
inc/admin/class-sbspf-admin.php CHANGED
@@ -328,6 +328,10 @@ class SB_YOUTUBE_Admin {
328
  }
329
  $formatted_label .= '</code><br>';
330
 
 
 
 
 
331
  $title = $formatted_label;
332
  } else {
333
  $title = $this->format_title( $args['title'], $args['name'], $shortcode, $title_after );
@@ -936,7 +940,8 @@ class SB_YOUTUBE_Admin {
936
  );
937
 
938
  foreach ( $this->tabs as $tab ) {
939
- if ( $tab['slug'] !== 'configure' ) {
 
940
  $title = isset( $tab['title'] ) ? $tab['title'] : '';
941
  $capability = isset( $tab['capability'] ) ? $tab['capability'] : 'manage_options';
942
  $slug = isset( $tab['slug'] ) ? $tab['slug'] : '';
328
  }
329
  $formatted_label .= '</code><br>';
330
 
331
+ if ( isset( $args['shortcode']['after_description'] ) ) {
332
+ $formatted_label .= $args['shortcode']['after_description'];
333
+ }
334
+
335
  $title = $formatted_label;
336
  } else {
337
  $title = $this->format_title( $args['title'], $args['name'], $shortcode, $title_after );
940
  );
941
 
942
  foreach ( $this->tabs as $tab ) {
943
+ if ( $tab['slug'] !== 'configure'
944
+ && ! isset( $tab['has_nav_tab'] ) ) {
945
  $title = isset( $tab['title'] ) ? $tab['title'] : '';
946
  $capability = isset( $tab['capability'] ) ? $tab['capability'] : 'manage_options';
947
  $slug = isset( $tab['slug'] ) ? $tab['slug'] : '';
inc/admin/class-sby-admin.php CHANGED
@@ -21,16 +21,23 @@ class SBY_Admin extends SB_YOUTUBE_Admin {
21
  );
22
  $this->add_settings_section( $args );
23
 
 
 
 
 
 
 
24
  /* Types */
25
  $args = array(
26
  'name' => 'type',
27
  'section' => 'sbspf_types',
28
  'callback' => 'types',
29
- 'title' => '<label>' . __( 'Feed Type', $text_domain ) .'</label>',
30
  'shortcode' => array(
31
  'key' => 'type',
32
  'example' => 'channel',
33
  'description' => __( 'Type of feed to display', $text_domain ) . ' e.g. channel, playlist, search, favorites, live',
 
34
  'display_section' => 'configure'
35
  ),
36
  'types' => $this->types
@@ -859,6 +866,16 @@ class SBY_Admin extends SB_YOUTUBE_Admin {
859
  );
860
  $this->add_settings_field( $args );
861
 
 
 
 
 
 
 
 
 
 
 
862
  }
863
 
864
  public function cache( $args ) {
21
  );
22
  $this->add_settings_section( $args );
23
 
24
+ $locator_html = '';
25
+ if ( SBY_Feed_Locator::count_unique() > -1 ) {
26
+ $locator_html .= '<div class="sby_locations_link">';
27
+ $locator_html .= '<a href="?page=' . $this->slug .'&amp;tab=allfeeds"><svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="search" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-search fa-w-16 fa-2x"><path fill="currentColor" d="M508.5 468.9L387.1 347.5c-2.3-2.3-5.3-3.5-8.5-3.5h-13.2c31.5-36.5 50.6-84 50.6-136C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c52 0 99.5-19.1 136-50.6v13.2c0 3.2 1.3 6.2 3.5 8.5l121.4 121.4c4.7 4.7 12.3 4.7 17 0l22.6-22.6c4.7-4.7 4.7-12.3 0-17zM208 368c-88.4 0-160-71.6-160-160S119.6 48 208 48s160 71.6 160 160-71.6 160-160 160z" class=""></path></svg> ' . __( 'Feed Finder', $text_domain ) . '</a>';
28
+ $locator_html .= '</div>';
29
+ }
30
  /* Types */
31
  $args = array(
32
  'name' => 'type',
33
  'section' => 'sbspf_types',
34
  'callback' => 'types',
35
+ 'title' => '<label>' . __( 'Select a Feed Type', $text_domain ) .'</label>',
36
  'shortcode' => array(
37
  'key' => 'type',
38
  'example' => 'channel',
39
  'description' => __( 'Type of feed to display', $text_domain ) . ' e.g. channel, playlist, search, favorites, live',
40
+ 'after_description' => $locator_html,
41
  'display_section' => 'configure'
42
  ),
43
  'types' => $this->types
866
  );
867
  $this->add_settings_field( $args );
868
 
869
+ $args = array(
870
+ 'name' => 'enqueue_js_in_head',
871
+ 'section' => 'sbspf_advanced',
872
+ 'callback' => 'checkbox',
873
+ 'title' => __( 'Enqueue JS file in head', $text_domain ),
874
+ 'default' => false,
875
+ 'tooltip_info' => __( 'Check this box if you\'d like to enqueue the JavaScript file for the plugin in the head instead of the footer.', $text_domain )
876
+ );
877
+ $this->add_settings_field( $args );
878
+
879
  }
880
 
881
  public function cache( $args ) {
inc/admin/templates/allfeeds.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Custom Feeds for Twitter Feed Locator Summary Template
4
+ * Creates the HTML for the feed locator summary
5
+ *
6
+ * @version 1.14 Custom Feeds for Twitter Pro by Smash Balloon
7
+ *
8
+ */
9
+ // Don't load directly
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ die( '-1' );
12
+ }
13
+ $locator_summary = SBY_Feed_Locator::summary();
14
+ $database_settings = sby_get_database_settings();
15
+ ?>
16
+ <div class="sby-feed-locator-summary-wrap">
17
+ <h3><?php esc_html_e( 'Feed Finder Summary', 'feeds-for-youtube' ); ?></h3>
18
+ <p><?php esc_html_e( 'The table below shows a record of all feeds found on your site. A feed may not show up here immediately after being created.', 'feeds-for-youtube' ); ?></p>
19
+ <?php
20
+ if ( ! empty( $locator_summary ) ) : ?>
21
+
22
+ <?php foreach ( $locator_summary as $locator_section ) :
23
+ if ( ! empty( $locator_section['results'] ) ) : ?>
24
+ <div class="sby-single-location">
25
+ <h4><?php echo esc_html( $locator_section['label'] ); ?></h4>
26
+ <table class="widefat striped">
27
+ <thead>
28
+ <tr>
29
+ <th><?php esc_html_e( 'Type', 'feeds-for-youtube' ); ?></th>
30
+ <th><?php esc_html_e( 'Sources', 'feeds-for-youtube' ); ?></th>
31
+ <th><?php esc_html_e( 'Shortcode', 'feeds-for-youtube' ); ?></th>
32
+ <th><?php esc_html_e( 'Location', 'feeds-for-youtube' ); ?></th>
33
+ </tr>
34
+ </thead>
35
+ <tbody>
36
+
37
+ <?php foreach ( $locator_section['results'] as $result ) :
38
+ $shortcode_atts = json_decode( $result['shortcode_atts'], true );
39
+ $shortcode_atts = is_array( $shortcode_atts ) ? $shortcode_atts : array();
40
+
41
+ if ( class_exists( 'SBY_Settings_Pro' ) ) {
42
+ $settings_obj = new SBY_Settings_Pro( $shortcode_atts, $database_settings );
43
+ } else {
44
+ $settings_obj = new SBY_Settings( $shortcode_atts, $database_settings );
45
+ }
46
+ $settings = $settings_obj->get_settings();
47
+ $settings_obj->set_feed_type_and_terms();
48
+ $display_terms = $settings_obj->feed_type_and_terms_display();
49
+ $comma_separated = implode(', ', $display_terms );
50
+ //$comma_separated = implode(', ', array() );
51
+ $display = $comma_separated;
52
+ if ( strlen( $comma_separated ) > 31 ) {
53
+ $display = '<span class="sby-condensed-wrap">' . substr( $comma_separated, 0, 30 ) . '<a class="sby-locator-more" href="JavaScript:void(0);">...</a></span>';
54
+ $comma_separated = '<span class="sby-full-wrap">' . esc_html( $comma_separated ) . '</span>';
55
+ } else {
56
+ $comma_separated = '';
57
+ }
58
+ $type = isset( $settings['type'] ) ? $settings['type'] : 'user';
59
+ $full_shortcode_string = '[youtube-feed';
60
+ foreach ( $shortcode_atts as $key => $value ) {
61
+ $full_shortcode_string .= ' ' . esc_html( $key ) . '="' . esc_html( $value ) . '"';
62
+ }
63
+ $full_shortcode_string .= ']';
64
+ ?>
65
+ <tr>
66
+ <td><?php echo esc_html( $type ); ?></td>
67
+ <td><?php echo $display . $comma_separated; ?></td>
68
+ <td>
69
+ <span class="sby-condensed-wrap"><a class="sby-locator-more" href="JavaScript:void(0);"><?php esc_html_e( 'Show', 'feeds-for-youtube' ); ?></a></span>
70
+ <span class="sby-full-wrap"><?php echo $full_shortcode_string; ?></span>
71
+ </td>
72
+ <td><a href="<?php echo esc_url( get_the_permalink( $result['post_id'] ) ); ?>" target="_blank" rel="noopener"><?php echo esc_html( get_the_title( $result['post_id'] ) ); ?></a></td>
73
+ </tr>
74
+ <?php endforeach; ?>
75
+
76
+
77
+ </tbody>
78
+ </table>
79
+ </div>
80
+
81
+ <?php endif;
82
+ endforeach;
83
+ else: ?>
84
+ <p><?php esc_html_e( 'Locations of your feeds are currently being detected. You\'ll see more information posted here soon!', 'feeds-for-youtube' ); ?></p>
85
+ <?php endif; ?>
86
+ </div>
inc/admin/templates/main.php CHANGED
@@ -46,11 +46,13 @@ $tabs = $this->get_tabs();
46
  <?php
47
  $i = 1;
48
  foreach ( $tabs as $tab ) :
 
49
  $title = isset( $tab['numbered_tab'] ) && ! $tab['numbered_tab'] ? __( $tab['title'], 'feeds-for-youtube' ) : $i . '. ' . __( $tab['title'], 'feeds-for-youtube' );
50
  ?>
51
  <a href="admin.php?page=<?php echo esc_attr( $slug ); ?>&tab=<?php echo esc_attr( $tab['slug'] ); ?>" class="nav-tab <?php if ( $active_tab === $tab['slug'] ){ echo 'nav-tab-active'; } ?>"><?php echo $title; ?></a>
52
  <?php
53
- $i ++;
 
54
  endforeach; ?>
55
  </h2>
56
  <?php
46
  <?php
47
  $i = 1;
48
  foreach ( $tabs as $tab ) :
49
+ if ( ! isset( $tab['has_nav_tab'] ) ) :
50
  $title = isset( $tab['numbered_tab'] ) && ! $tab['numbered_tab'] ? __( $tab['title'], 'feeds-for-youtube' ) : $i . '. ' . __( $tab['title'], 'feeds-for-youtube' );
51
  ?>
52
  <a href="admin.php?page=<?php echo esc_attr( $slug ); ?>&tab=<?php echo esc_attr( $tab['slug'] ); ?>" class="nav-tab <?php if ( $active_tab === $tab['slug'] ){ echo 'nav-tab-active'; } ?>"><?php echo $title; ?></a>
53
  <?php
54
+ $i ++;
55
+ endif;
56
  endforeach; ?>
57
  </h2>
58
  <?php
inc/admin/templates/support.php CHANGED
@@ -108,6 +108,33 @@ if ( ! empty( $cron_report ) ) {
108
  echo "\n";
109
  ?>
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  ## Error Log: ##
112
  <?php
113
  global $sby_posts_manager;
108
  echo "\n";
109
  ?>
110
 
111
+ ## Location Summary: ##
112
+ <?php
113
+ $locator_summary = SBY_Feed_Locator::summary();
114
+ $condensed_shortcode_atts = array( 'type', 'channel', 'id', 'live', 'search', 'playlist', 'layout', 'whitelist', 'includewords' );
115
+
116
+ if ( ! empty( $locator_summary) ) {
117
+
118
+ foreach ( $locator_summary as $locator_section ) {
119
+ if ( ! empty( $locator_section['results'] ) ) {
120
+ $first_five = array_slice( $locator_section['results'], 0, 5 );
121
+ foreach ( $first_five as $result ) {
122
+ $condensed_shortcode_string = '[youtube-feeds';
123
+ $shortcode_atts = json_decode( $result['shortcode_atts'], true );
124
+ $shortcode_atts = is_array( $shortcode_atts ) ? $shortcode_atts : array();
125
+ foreach ( $shortcode_atts as $key => $value ) {
126
+ if ( in_array( $key, $condensed_shortcode_atts, true ) ) {
127
+ $condensed_shortcode_string .= ' ' . esc_html( $key ). '="' . esc_html( $value ) . '"';
128
+ }
129
+ }
130
+ $condensed_shortcode_string .= ']';
131
+ echo esc_url( get_the_permalink( $result['post_id'] ) ) . ' ' . $condensed_shortcode_string . "\n";
132
+ }
133
+
134
+ }
135
+ }
136
+ }?>
137
+
138
  ## Error Log: ##
139
  <?php
140
  global $sby_posts_manager;
inc/class-sby-feed-locator.php ADDED
@@ -0,0 +1,419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class SBY_Feed_Locator
4
+ *
5
+ * Locates feeds on the site and logs information about them in the database.
6
+ *
7
+ * @since 1.14
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ die( '-1' );
12
+ }
13
+
14
+ class SBY_Feed_Locator
15
+ {
16
+ private $feed_details;
17
+
18
+ private $expiration_time;
19
+
20
+ private $matching_entries;
21
+
22
+ public function __construct( $feed_details ) {
23
+ /**
24
+ * Example of how $feed_details is structured
25
+ *
26
+ * $feed_details = array(
27
+ * 'feed_id' => $transient_name,
28
+ * 'atts' => $atts,
29
+ * 'location' => array(
30
+ * 'post_id' => get_the_ID(),
31
+ * 'html' => 'unknown'
32
+ * )
33
+ * );
34
+ */
35
+ $this->feed_details = $feed_details;
36
+
37
+ $this->matching_entries = array();
38
+
39
+ $this->expiration_time = time() - 2 * WEEK_IN_SECONDS;
40
+ }
41
+
42
+ /**
43
+ * Returns records that match the post ID and feed ID
44
+ * of the feed being located
45
+ *
46
+ * @return array
47
+ *
48
+ * @since 1.14
49
+ */
50
+ public function retrieve_matching_entries() {
51
+ global $wpdb;
52
+ $feed_locator_table_name = esc_sql( $wpdb->prefix . SBY_FEED_LOCATOR );
53
+
54
+ $results = $wpdb->get_results( $wpdb->prepare("
55
+ SELECT *
56
+ FROM $feed_locator_table_name
57
+ WHERE post_id = %d
58
+ AND feed_id = %s", $this->feed_details['location']['post_id'], $this->feed_details['feed_id'] ),ARRAY_A );
59
+
60
+ return $results;
61
+ }
62
+
63
+ /**
64
+ * Add feed being located to the database
65
+ *
66
+ * @since 1.14
67
+ */
68
+ public function insert_entry() {
69
+ global $wpdb;
70
+
71
+ $feed_locator_table_name = esc_sql( $wpdb->prefix . SBY_FEED_LOCATOR );
72
+
73
+ $affected = $wpdb->query( $wpdb->prepare( "INSERT INTO $feed_locator_table_name
74
+ (feed_id,
75
+ post_id,
76
+ html_location,
77
+ shortcode_atts,
78
+ last_update)
79
+ VALUES (
80
+ %s,
81
+ %d,
82
+ %s,
83
+ %s,
84
+ %s);",
85
+ $this->feed_details['feed_id'],
86
+ $this->feed_details['location']['post_id'],
87
+ $this->feed_details['location']['html'],
88
+ sby_json_encode( $this->feed_details['atts'] ),
89
+ date( 'Y-m-d H:i:s' ) ) );
90
+ }
91
+
92
+ /**
93
+ * Update a record based on the existing "id" column. Location can change
94
+ * from "unknown" to one of footer, content, header, or sidebar.
95
+ *
96
+ * @param $id
97
+ * @param $location
98
+ *
99
+ * @since 1.14
100
+ */
101
+ public function update_entry( $id, $location ) {
102
+ global $wpdb;
103
+
104
+ $feed_locator_table_name = esc_sql( $wpdb->prefix . SBY_FEED_LOCATOR );
105
+
106
+ $query = $wpdb->query( $wpdb->prepare( "
107
+ UPDATE $feed_locator_table_name
108
+ SET last_update = %s, html_location = %s
109
+ WHERE id = %d;", date( 'Y-m-d H:i:s' ), $location, $id ) );
110
+ }
111
+
112
+ /**
113
+ * Processes a feed being located based on whether or not the record
114
+ * exists as well as whether or not an unknown location needs to be
115
+ * updated.
116
+ *
117
+ * @since 1.14
118
+ */
119
+ public function add_or_update_entry() {
120
+ if ( empty( $this->feed_details['feed_id'] ) ) {
121
+ return;
122
+ }
123
+
124
+ $this->matching_entries = $this->retrieve_matching_entries();
125
+
126
+ if ( empty( $this->matching_entries ) ) {
127
+ $this->insert_entry();
128
+ } else {
129
+ $matching_indices = array();
130
+ $matched_location = false;
131
+ $non_unknown_match = false;
132
+ $unknown_match = false;
133
+
134
+ foreach ( $this->matching_entries as $index => $matching_entry ) {
135
+ $details_atts = is_array( $this->feed_details['atts'] ) ? $this->feed_details['atts'] : array();
136
+ $matching_atts = json_decode( $matching_entry['shortcode_atts'], true );
137
+ if ( ! is_array( $matching_atts ) ) {
138
+ $matching_atts = array();
139
+ }
140
+ $atts_diff = array_diff( $matching_atts, $details_atts ); // determines if the shortcode settings match the shortcode settings of an existing feed
141
+ if ( empty( $atts_diff ) ) {
142
+ $matching_indices[] = $matching_entry['id'];
143
+ if ( $matching_entry['html_location'] === $this->feed_details['location']['html'] ) {
144
+ $matched_location = $index;
145
+ $this->update_entry( $matching_entry['id'], $matching_entry['html_location'] );
146
+ }
147
+ if ( $matching_entry['html_location'] !== 'unknown' ) {
148
+ $non_unknown_match = $index;
149
+ } else {
150
+ $unknown_match = $index;
151
+ }
152
+ }
153
+ }
154
+
155
+ if ( false === $matched_location ) {
156
+ // if there is no matched location, there is only one feed on the page, and the feed being checked has an unknown location, update the known location
157
+ if ( count( $matching_indices ) === 1
158
+ && $this->feed_details['location']['html'] === 'unknown'
159
+ && false !== $non_unknown_match ) {
160
+ $this->update_entry( $this->matching_entries[ $non_unknown_match ]['id'], $this->matching_entries[ $non_unknown_match ]['html_location'] );
161
+ } else {
162
+ if ( $this->feed_details['location']['html'] !== 'unknown'
163
+ && false !== $unknown_match ) {
164
+ $this->update_entry( $this->matching_entries[ $unknown_match ]['id'], $this->feed_details['location']['html'] );
165
+ } else {
166
+ $this->insert_entry();
167
+ }
168
+
169
+ }
170
+ }
171
+
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Old feeds are only detected once a day to keep load on the server low.
177
+ *
178
+ * @return bool
179
+ *
180
+ * @since 1.14
181
+ */
182
+ public static function should_clear_old_locations() {
183
+ $sby_statuses_option = get_option( 'sby_statuses', array() );
184
+ $last_old_feed_check = isset( $sby_statuses_option['feed_locator']['last_check'] ) ? $sby_statuses_option['feed_locator']['last_check'] : 0;
185
+
186
+ return $last_old_feed_check < time() - DAY_IN_SECONDS;
187
+ }
188
+
189
+ /**
190
+ * Old feeds are removed if they haven't been updated in two weeks.
191
+ *
192
+ * @since 1.14
193
+ */
194
+ public static function delete_old_locations() {
195
+ global $wpdb;
196
+
197
+ $feed_locator_table_name = esc_sql( $wpdb->prefix . SBY_FEED_LOCATOR );
198
+ $two_weeks_ago = date( 'Y-m-d H:i:s', time() - 2 * WEEK_IN_SECONDS );
199
+
200
+ $affected = $wpdb->query( $wpdb->prepare(
201
+ "DELETE FROM $feed_locator_table_name WHERE last_update < %s;", $two_weeks_ago ) );
202
+
203
+ $sby_statuses_option = get_option( 'sby_statuses', array() );
204
+ $sby_statuses_option['feed_locator']['last_check'] = time();
205
+ if ( ! isset( $sby_statuses_option['feed_locator']['initialized'] ) ) {
206
+ $sby_statuses_option['feed_locator']['initialized'] = time();
207
+ }
208
+
209
+ update_option( 'sby_statuses', $sby_statuses_option, true );
210
+ }
211
+
212
+ /**
213
+ * Feeds are located with the page load randomly (5% or 1/30 loads)
214
+ * to decrease load on the server.
215
+ *
216
+ * If the locating just started (within 5 minutes) it is run more often
217
+ * to collect feed locations quickly.
218
+ *
219
+ * @return bool
220
+ *
221
+ * @since 1.14
222
+ */
223
+ public static function should_do_locating() {
224
+ $sby_statuses_option = get_option( 'sby_statuses', array() );
225
+ if ( isset( $sby_statuses_option['feed_locator']['initialized'] )
226
+ && $sby_statuses_option['feed_locator']['initialized'] < (time() - 300) ) {
227
+ $should_do_locating = rand( 1, 10 ) === 10;
228
+ } else {
229
+ $should_do_locating = rand( 1, 30 ) === 30;
230
+ }
231
+ $should_do_locating = apply_filters( 'sby_should_do_locating', $should_do_locating );
232
+
233
+ return $should_do_locating;
234
+ }
235
+
236
+ /**
237
+ * Simliar to the should_do_locating method but will add an additional
238
+ * database query to see if there is a feed with an unknown location that
239
+ * matches the details of the feed in question.
240
+ *
241
+ * @param $feed_id
242
+ * @param $post_id
243
+ *
244
+ * @return bool
245
+ *
246
+ * @since 1.14
247
+ */
248
+ public static function should_do_ajax_locating( $feed_id, $post_id ) {
249
+
250
+ $should_do_locating = rand( 1, 50 ) === 50;
251
+
252
+ $should_do_locating = apply_filters( 'sby_should_do_ajax_locating', $should_do_locating );
253
+
254
+ return $should_do_locating;
255
+ }
256
+
257
+ /**
258
+ * Feeds are located with the page load randomly (1/30 loads)
259
+ * to decrease load on the server.
260
+ *
261
+ * If the locating just started (within 5 minutes) it is run more often
262
+ * to collect feed locations quickly.
263
+ *
264
+ * @param $feed_id
265
+ * @param $post_id
266
+ *
267
+ * @return bool
268
+ *
269
+ * @since 1.14
270
+ */
271
+ public static function entries_need_locating( $feed_id, $post_id ) {
272
+ global $wpdb;
273
+ $feed_locator_table_name = esc_sql( $wpdb->prefix . SBY_FEED_LOCATOR );
274
+
275
+ $one_day_ago = date( 'Y-m-d H:i:s', time() - DAY_IN_SECONDS );
276
+
277
+ $results = $wpdb->get_results( $wpdb->prepare("
278
+ SELECT id
279
+ FROM $feed_locator_table_name
280
+ WHERE html_location = 'unknown'
281
+ AND last_update < %s
282
+ AND feed_id = %s
283
+ AND post_id = %d
284
+ LIMIT 1;", $one_day_ago, $feed_id, $post_id ),ARRAY_A );
285
+
286
+ return isset( $results[0] );
287
+ }
288
+
289
+ /**
290
+ * A custom table stores locations
291
+ *
292
+ * @since 1.14
293
+ */
294
+ public static function create_table() {
295
+ global $wpdb;
296
+
297
+ $feed_locator_table_name = esc_sql( $wpdb->prefix . SBY_FEED_LOCATOR );
298
+
299
+ if ( $wpdb->get_var( "show tables like '$feed_locator_table_name'" ) != $feed_locator_table_name ) {
300
+ $sql = "CREATE TABLE " . $feed_locator_table_name . " (
301
+ id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
302
+ feed_id VARCHAR(50) DEFAULT '' NOT NULL,
303
+ post_id BIGINT(20) UNSIGNED NOT NULL,
304
+ html_location VARCHAR(50) DEFAULT 'unknown' NOT NULL,
305
+ shortcode_atts LONGTEXT NOT NULL,
306
+ last_update DATETIME
307
+ );";
308
+ $wpdb->query( $sql );
309
+ }
310
+ $error = $wpdb->last_error;
311
+ $query = $wpdb->last_query;
312
+ $had_error = false;
313
+ if ( $wpdb->get_var( "show tables like '$feed_locator_table_name'" ) != $feed_locator_table_name ) {
314
+ $had_error = true;
315
+ }
316
+
317
+ if ( ! $had_error ) {
318
+ $wpdb->query( "ALTER TABLE $feed_locator_table_name ADD INDEX feed_id (feed_id)" );
319
+ $wpdb->query( "ALTER TABLE $feed_locator_table_name ADD INDEX post_id (post_id)" );
320
+ }
321
+ }
322
+
323
+ /**
324
+ * Counts the number of unique feeds in the database.
325
+ *
326
+ * @return int
327
+ *
328
+ * @since 1.14
329
+ */
330
+ public static function count_unique() {
331
+ global $wpdb;
332
+
333
+ $feed_locator_table_name = esc_sql( $wpdb->prefix . SBY_FEED_LOCATOR );
334
+ $results_content = $wpdb->get_results( "
335
+ SELECT COUNT(*) AS num_entries
336
+ FROM $feed_locator_table_name
337
+ WHERE html_location = 'content'
338
+ ", ARRAY_A );
339
+
340
+
341
+ $results_other = $wpdb->get_results( "
342
+ SELECT COUNT(*) AS num_entries
343
+ FROM $feed_locator_table_name
344
+ WHERE html_location != 'content'
345
+ AND html_location != 'unknown'
346
+ GROUP BY feed_id
347
+ ", ARRAY_A );
348
+
349
+ $total = 0;
350
+ if ( isset( $results_content[0]['num_entries'] ) ) {
351
+ $total += (int)$results_content[0]['num_entries'];
352
+ }
353
+ if ( isset( $results_other[0]['num_entries'] ) ) {
354
+ $total += (int)$results_other[0]['num_entries'];
355
+ }
356
+
357
+ return $total;
358
+ }
359
+
360
+ /**
361
+ * Creates a summary of the located feeds in an array
362
+ *
363
+ * @return array
364
+ *
365
+ * @since 1.14
366
+ */
367
+ public static function summary() {
368
+ global $wpdb;
369
+
370
+ $feed_locator_table_name = esc_sql( $wpdb->prefix . SBY_FEED_LOCATOR );
371
+
372
+ $locations = array(
373
+ array(
374
+ 'label' => __( 'Content', 'feeds-for-youtube' ),
375
+ 'html_locations' => array( 'content', 'unknown' )
376
+ ),
377
+ array(
378
+ 'label' => __( 'Header', 'feeds-for-youtube' ),
379
+ 'html_locations' => array( 'header' ),
380
+ 'group_by' => 'feed_id'
381
+ ),
382
+ array(
383
+ 'label' => __( 'Sidebar', 'feeds-for-youtube' ),
384
+ 'html_locations' => array( 'sidebar' ),
385
+ 'group_by' => 'feed_id'
386
+ ),
387
+ array(
388
+ 'label' => __( 'Footer', 'feeds-for-youtube' ),
389
+ 'html_locations' => array( 'footer' ),
390
+ 'group_by' => 'feed_id'
391
+ )
392
+ );
393
+
394
+ $one_result_found = false;
395
+
396
+ foreach ( $locations as $key => $location ) {
397
+ $in = implode( "', '", $location['html_locations'] );
398
+ $group_by = isset( $location['group_by'] ) ? "GROUP BY " . $location['group_by'] : "";
399
+ $results = $wpdb->get_results("
400
+ SELECT *
401
+ FROM $feed_locator_table_name
402
+ WHERE html_location IN ('$in')
403
+ $group_by
404
+ ORDER BY last_update ASC",ARRAY_A );
405
+
406
+ if ( isset( $results[0] ) ) {
407
+ $one_result_found = true;
408
+ }
409
+
410
+ $locations[ $key ]['results'] = $results;
411
+ }
412
+
413
+ if ( ! $one_result_found ) {
414
+ return array();
415
+ }
416
+
417
+ return $locations;
418
+ }
419
+ }
inc/class-sby-feed.php CHANGED
@@ -1239,6 +1239,10 @@ class SBY_Feed
1239
  if ( SBY_GDPR_Integrations::doing_gdpr( $settings ) ) {
1240
  $flags[] = 'gdpr';
1241
  }
 
 
 
 
1242
  if ( $settings['disablecdn'] ) {
1243
  $flags[] = 'disablecdn';
1244
  }
@@ -1249,7 +1253,7 @@ class SBY_Feed
1249
  if ( ! empty( $flags ) ) {
1250
  $other_atts .= ' data-sby-flags="' . implode(',', $flags ) . '"';
1251
  }
1252
-
1253
  if ( $settings['layout'] === 'grid' || $settings['layout'] === 'carousel' ) {
1254
  $other_atts .= ' data-sby-supports-lightbox="1"';
1255
  }
1239
  if ( SBY_GDPR_Integrations::doing_gdpr( $settings ) ) {
1240
  $flags[] = 'gdpr';
1241
  }
1242
+ if ( ! is_admin()
1243
+ && SBY_Feed_Locator::should_do_ajax_locating( $this->regular_feed_transient_name, get_the_ID() ) ) {
1244
+ $flags[] = 'locator';
1245
+ }
1246
  if ( $settings['disablecdn'] ) {
1247
  $flags[] = 'disablecdn';
1248
  }
1253
  if ( ! empty( $flags ) ) {
1254
  $other_atts .= ' data-sby-flags="' . implode(',', $flags ) . '"';
1255
  }
1256
+ $other_atts .= ' data-postid="' . get_the_ID() . '"';
1257
  if ( $settings['layout'] === 'grid' || $settings['layout'] === 'carousel' ) {
1258
  $other_atts .= ' data-sby-supports-lightbox="1"';
1259
  }
inc/class-sby-gdpr-integrations.php CHANGED
@@ -31,7 +31,7 @@ class SBY_GDPR_Integrations {
31
  if ( class_exists( 'Cookie_Notice' ) ) {
32
  return 'Cookie Notice by dFactory';
33
  }
34
- if ( function_exists( 'run_cookie_law_info' ) ) {
35
  return 'GDPR Cookie Consent by WebToffee';
36
  }
37
  if ( class_exists( 'Cookiebot_WP' ) ) {
31
  if ( class_exists( 'Cookie_Notice' ) ) {
32
  return 'Cookie Notice by dFactory';
33
  }
34
+ if ( function_exists( 'run_cookie_law_info' ) || class_exists( 'Cookie_Law_Info' ) ) {
35
  return 'GDPR Cookie Consent by WebToffee';
36
  }
37
  if ( class_exists( 'Cookiebot_WP' ) ) {
inc/class-sby-settings.php CHANGED
@@ -215,6 +215,21 @@ class SBY_Settings {
215
  }
216
  }
217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  /**
219
  * Based on the settings related to retrieving post data from the API,
220
  * this setting is used to make sure all endpoints needed for the feed are
215
  }
216
  }
217
 
218
+ public function feed_type_and_terms_display() {
219
+
220
+ if ( ! isset( $this->feed_type_and_terms ) ) {
221
+ return array();
222
+ }
223
+ $return = array();
224
+ foreach ( $this->feed_type_and_terms as $feed_type => $type_terms ) {
225
+ foreach ( $type_terms as $term ) {
226
+ $return[] = $term['term'];
227
+ }
228
+ }
229
+ return $return;
230
+
231
+ }
232
+
233
  /**
234
  * Based on the settings related to retrieving post data from the API,
235
  * this setting is used to make sure all endpoints needed for the feed are
inc/sby-functions.php CHANGED
@@ -176,6 +176,19 @@ function sby_get_next_post_set() {
176
  $youtube_feed_settings->set_transient_name( $feed_id );
177
  $transient_name = $youtube_feed_settings->get_transient_name();
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  if ( $transient_name !== $feed_id ) {
180
  die( 'id does not match' );
181
  }
@@ -325,6 +338,19 @@ function sby_process_wp_posts() {
325
  }
326
  $atts = $atts_raw; // now sanitized
327
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  $offset = isset( $_POST['offset'] ) ? (int)$_POST['offset'] : 0;
329
 
330
  $cache_all = isset( $_POST['cache_all'] ) ? $_POST['cache_all'] === 'true' : false;
@@ -391,6 +417,47 @@ function sby_process_post_set_caching( $posts, $feed_id ) {
391
  return array();
392
  }
393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  function sby_debug_report( $youtube_feed, $feed_id ) {
395
 
396
  if ( ! isset( $_GET['sby_debug'] ) ) {
@@ -481,6 +548,14 @@ function sby_maybe_clear_cache_using_cron() {
481
  }
482
  add_action( 'sby_cron_job', 'sby_maybe_clear_cache_using_cron' );
483
 
 
 
 
 
 
 
 
 
484
  /**
485
  * When certain events occur, page caches need to
486
  * clear or errors occur or changes will not be seen
176
  $youtube_feed_settings->set_transient_name( $feed_id );
177
  $transient_name = $youtube_feed_settings->get_transient_name();
178
 
179
+ $location = isset( $_POST['location'] ) && in_array( $_POST['location'], array( 'header', 'footer', 'sidebar', 'content' ), true ) ? sanitize_text_field( $_POST['location'] ) : 'unknown';
180
+ $post_id = isset( $_POST['post_id'] ) && $_POST['post_id'] !== 'unknown' ? (int)$_POST['post_id'] : 'unknown';
181
+ $feed_details = array(
182
+ 'feed_id' => $feed_id,
183
+ 'atts' => $atts,
184
+ 'location' => array(
185
+ 'post_id' => $post_id,
186
+ 'html' => $location
187
+ )
188
+ );
189
+
190
+ sby_do_background_tasks( $feed_details );
191
+
192
  if ( $transient_name !== $feed_id ) {
193
  die( 'id does not match' );
194
  }
338
  }
339
  $atts = $atts_raw; // now sanitized
340
 
341
+ $location = isset( $_POST['location'] ) && in_array( $_POST['location'], array( 'header', 'footer', 'sidebar', 'content' ), true ) ? sanitize_text_field( $_POST['location'] ) : 'unknown';
342
+ $post_id = isset( $_POST['post_id'] ) && $_POST['post_id'] !== 'unknown' ? (int)$_POST['post_id'] : 'unknown';
343
+ $feed_details = array(
344
+ 'feed_id' => $feed_id,
345
+ 'atts' => $atts,
346
+ 'location' => array(
347
+ 'post_id' => $post_id,
348
+ 'html' => $location
349
+ )
350
+ );
351
+
352
+ sby_do_background_tasks( $feed_details );
353
+
354
  $offset = isset( $_POST['offset'] ) ? (int)$_POST['offset'] : 0;
355
 
356
  $cache_all = isset( $_POST['cache_all'] ) ? $_POST['cache_all'] === 'true' : false;
417
  return array();
418
  }
419
 
420
+ function sby_do_locator() {
421
+ if ( ! isset( $_POST['feed_id'] ) || strpos( $_POST['feed_id'], 'sbi' ) === false ) {
422
+ die( 'invalid feed ID');
423
+ }
424
+
425
+ $feed_id = sanitize_text_field( $_POST['feed_id'] );
426
+
427
+ $atts_raw = isset( $_POST['atts'] ) ? json_decode( stripslashes( $_POST['atts'] ), true ) : array();
428
+ if ( is_array( $atts_raw ) ) {
429
+ array_map( 'sanitize_text_field', $atts_raw );
430
+ } else {
431
+ $atts_raw = array();
432
+ }
433
+ $atts = $atts_raw; // now sanitized
434
+
435
+ $location = isset( $_POST['location'] ) && in_array( $_POST['location'], array( 'header', 'footer', 'sidebar', 'content' ), true ) ? sanitize_text_field( $_POST['location'] ) : 'unknown';
436
+ $post_id = isset( $_POST['post_id'] ) && $_POST['post_id'] !== 'unknown' ? (int)$_POST['post_id'] : 'unknown';
437
+ $feed_details = array(
438
+ 'feed_id' => $feed_id,
439
+ 'atts' => $atts,
440
+ 'location' => array(
441
+ 'post_id' => $post_id,
442
+ 'html' => $location
443
+ )
444
+ );
445
+
446
+ sby_do_background_tasks( $feed_details );
447
+
448
+ wp_die( 'locating success' );
449
+ }
450
+ add_action( 'wp_ajax_sby_do_locator', 'sby_do_locator' );
451
+ add_action( 'wp_ajax_nopriv_sby_do_locator', 'sby_do_locator' );
452
+
453
+ function sby_do_background_tasks( $feed_details ) {
454
+ $locator = new SBY_Feed_Locator( $feed_details );
455
+ $locator->add_or_update_entry();
456
+ if ( $locator->should_clear_old_locations() ) {
457
+ $locator->delete_old_locations();
458
+ }
459
+ }
460
+
461
  function sby_debug_report( $youtube_feed, $feed_id ) {
462
 
463
  if ( ! isset( $_GET['sby_debug'] ) ) {
548
  }
549
  add_action( 'sby_cron_job', 'sby_maybe_clear_cache_using_cron' );
550
 
551
+ function sby_json_encode( $thing ) {
552
+ if ( function_exists( 'wp_json_encode' ) ) {
553
+ return wp_json_encode( $thing );
554
+ } else {
555
+ return json_encode( $thing );
556
+ }
557
+ }
558
+
559
  /**
560
  * When certain events occur, page caches need to
561
  * clear or errors occur or changes will not be seen
js/admin.js CHANGED
@@ -15,7 +15,7 @@
15
  self.initClickRemove($(this));
16
  self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
17
  });
18
- this.$adminEl.find('.sbspf_type_input').change(function() {
19
  self.updateOnSelect($(this));
20
  });self.updateOnSelect();
21
 
@@ -27,7 +27,7 @@
27
 
28
  this.addManualAccessTokenListener();
29
 
30
- $(id + '_search_submit').click(function(event) {
31
  event.preventDefault();
32
 
33
  var submitData = {
@@ -48,23 +48,26 @@
48
  });
49
 
50
  // color picker
51
- var $ctfColorpicker = $(cla+'_colorpicker');
52
 
53
- if($ctfColorpicker.length > 0){
54
- $ctfColorpicker.wpColorPicker();
55
  }
56
 
57
  // shortcode tooltips
58
  var $adminLabel = $(id +'_admin label');
59
 
60
- $adminLabel.click(function(){
61
  var $shortcode = $(this).siblings(cla + '_shortcode');
62
  if($shortcode.is(':visible')){
 
63
  $shortcode.hide();
64
  } else {
 
65
  $shortcode.show();
66
  }
67
  });
 
68
  $adminLabel.hover(function(){
69
  if($(this).siblings(cla + '_shortcode').length && ! $(this).find(cla + '_shortcode_symbol').length){
70
  $(this).append('<code class="'+self.plugin+'_shortcode_symbol">[]</code>');
@@ -75,7 +78,7 @@
75
  $(cla + '_shortcode').hide();
76
 
77
  //Scroll to hash for quick links
78
- $(id + '_admin a').click(function() {
79
  if(location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
80
  var target = $(this.hash);
81
  target = target.length ? target : this.hash.slice(1);
@@ -97,7 +100,7 @@
97
  $(cla+'-caching-cron-options').show();
98
  }
99
 
100
- $('.'+self.plugin+'_caching_type_input').change(function() {
101
  if (this.value == 'page') {
102
  $(cla+'-caching-cron-options').slideUp();
103
  $(cla+'-caching-page-options').slideDown();
@@ -115,7 +118,7 @@
115
  //Should we show anything initially?
116
  if(sbspf_cache_cron_interval == '30mins' || sbspf_cache_cron_interval == '1hour') $sbspf_caching_time_settings.hide();
117
 
118
- $(id+'_cache_cron_interval').change(function(){
119
  sbspf_cache_cron_interval = $(id+'_cache_cron_interval').val();
120
 
121
  if(sbspf_cache_cron_interval == '30mins' || sbspf_cache_cron_interval == '1hour'){
@@ -133,16 +136,16 @@
133
  }
134
 
135
  self.updateLayoutOptionsDisplay();
136
- $(cla + '_layout_type').change(function() {
137
  self.updateLayoutOptionsDisplay()
138
  });
139
- $(cla + '_sub_option_type').change(function() {
140
  self.updateBoxSelectionDisplay()
141
  });
142
  self.updateBoxSelectionDisplay();
143
 
144
  // tooltips
145
- $(id +'_admin '+ cla + '_tooltip_link').click(function(){
146
  if ($(this).closest( cla + '_box').length) {
147
  $(this).closest( cla + '_box').find(cla + '_tooltip').slideToggle();
148
 
@@ -151,7 +154,7 @@
151
  }
152
  });
153
 
154
- $(id +'_admin '+ cla + '_type_tooltip_link').click(function(){
155
  $(this).closest(cla + '_row').find(cla + '_tooltip').slideToggle();
156
  });
157
 
@@ -159,10 +162,10 @@
159
  var $feedWidth = $(id+'_admin '+id+'_settings_width'),
160
  $widthUnit = $(id+'_admin '+id+'_settings_width_unit');
161
  if ($feedWidth.length) {
162
- $feedWidth.change(function(){
163
  self.updateFeedWidthDisplay();
164
  });
165
- $widthUnit.change(function(){
166
  self.updateFeedWidthDisplay();
167
  });
168
  self.updateFeedWidthDisplay();
@@ -197,7 +200,7 @@
197
  },
198
  initClickRemove: function(el) {
199
  var self = this;
200
- el.find('.'+this.plugin +'_delete_account').click(function() {
201
  if (!$(this).closest('.'+self.plugin +'_connected_accounts_wrap').hasClass(self.plugin +'-waiting')) {
202
  $(this).closest('.'+self.plugin +'_connected_accounts_wrap').addClass(self.plugin +'-waiting');
203
  var $connectedAccount = $(this).closest('.'+self.plugin +'_connected_account'),
@@ -230,17 +233,17 @@
230
  },
231
  initInfoToggle: function(el) {
232
  var self = this;
233
- el.find('.'+self.plugin +'_ca_show_token').off().click(function() {
234
  $(this).closest('.'+self.plugin +'_ca_info').find('.'+self.plugin +'_ca_accesstoken').slideToggle(200);
235
  });
236
 
237
- el.find('.'+self.plugin +'_ca_token_shortcode').off().click(function() {
238
  $(this).closest('.'+self.plugin +'_ca_info').find('.'+self.plugin +'_ca_shortcode').slideToggle(200);
239
  });
240
  },
241
  initAppCredToggle: function() {
242
  var self = this;
243
- $('#'+self.plugin +'_have_own_tokens').click(function() {
244
  if ($(this).is(':checked')) {
245
  $(this).closest('form').find('.'+self.plugin +'_own_credentials_wrap').slideDown();
246
  } else {
@@ -269,7 +272,7 @@
269
  $widthOptions.slideUp();
270
  }
271
 
272
- $('#sby_settings_width_unit, #sby_settings_width').change(function(){
273
  feedWidth = $('#sby_settings_width').length ? $('#sby_settings_width').val() : '100';
274
  widthUnit = $('#sby_settings_widthunit').length ? $('#sby_settings_widthunit').val() : '%';
275
 
@@ -285,7 +288,7 @@
285
  },
286
  initActionButtons: function() {
287
  $('#sbspf_admin .sbspf-button-action').each(function(){
288
- $(this).click(function() {
289
  event.preventDefault();
290
  $(this).next('.sbspf_success').remove();
291
 
@@ -294,7 +297,7 @@
294
  $targetWaitingEl = typeof $(this).attr('data-sby-waiter') !== 'undefined' ? $($(this).attr('data-sby-waiter')) : $(this),
295
  $self = $(this);
296
  if (!confirmMessage || window.confirm(confirmMessage)) {
297
- $(this).attr('disabled',true);
298
  $targetWaitingEl.after('<div class="spinner sbspf_spinner" style="display:inline-block;visibility: visible;"></div>');
299
 
300
  var submitData = {
@@ -302,7 +305,7 @@
302
  'sbspf_nonce' : sbspf.nonce
303
  };
304
  var onSuccess = function (data) {
305
- $self.removeAttr('disabled');
306
  $targetWaitingEl.next('.spinner').fadeOut('slow',function(){
307
  $targetWaitingEl.after('<span class="sbspf_success"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="check-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-check-circle fa-w-16"><path fill="currentColor" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z" class=""></path></svg></span>');
308
  });
@@ -329,17 +332,16 @@
329
  cla = '.'+this.plugin;
330
 
331
  $(cla+'_manually_connect_wrap').hide();
332
- $(cla+'_manually_connect').click(function(event) {
333
  event.preventDefault();
334
  if ( $(cla+'_manually_connect_wrap').is(':visible') ) {
335
  $(cla+'_manually_connect_wrap').slideUp(200);
336
  } else {
337
  $(cla+'_manually_connect_wrap').slideDown(200);
338
- $(id+'_manual_at').focus();
339
  }
340
  });
341
 
342
- $(id+'_manual_submit').click(function(event) {
343
  event.preventDefault();
344
  var $self = $(this);
345
  var accessToken = $(id+'_manual_at').val(),
@@ -350,7 +352,7 @@
350
  $(cla+'_manually_connect_wrap').show().prepend('<div class="'+self.plugin+'_user_id_error" style="display:block;">Please enter a valid access token</div>');
351
  }
352
  } else if (! error) {
353
- $(this).attr('disabled',true);
354
  $(this).closest(cla+'_manually_connect_wrap').fadeOut();
355
  $(cla+'_connected_accounts_wrap').fadeTo("slow" , 0.5).find(cla+'_user_id_error').remove();
356
 
@@ -361,7 +363,7 @@
361
  };
362
  var onSuccess = function (data) {
363
  $(cla+'_connected_accounts_wrap').fadeTo("slow" , 1);
364
- $self.removeAttr('disabled');
365
  var returnObj = JSON.parse(data.trim());
366
  $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
367
  self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
@@ -459,7 +461,7 @@
459
  jQuery('#sbspf-notice-bar').show();
460
  }
461
 
462
- jQuery('#sbspf-notice-bar .dismiss').click(function(e) {
463
  e.preventDefault();
464
  jQuery('#sbspf-notice-bar').remove();
465
  var submitData = {
@@ -471,7 +473,7 @@
471
  sbAjax(submitData,onSuccess);
472
  });
473
 
474
- $('#sbspf_usecustomsearch').change(function() {
475
  if ($(this).is(':checked')) {
476
  $('#sbspf_usecustomsearch_reveal').show();
477
  } else {
@@ -486,7 +488,7 @@
486
  }
487
 
488
 
489
- $('.sbspf_dismiss_button').click(function() {
490
  event.preventDefault();
491
  $('#sbspf_modal_overlay').remove();
492
  var submitData = {
@@ -495,7 +497,7 @@
495
  sbAjax(submitData,function() {});
496
  });
497
 
498
- $('.sbspf_dismiss_at_warning_button').click(function() {
499
  event.preventDefault();
500
  $('#sbspf_modal_overlay').remove();
501
  var submitData = {
@@ -536,7 +538,7 @@
536
  } else if (jQuery(this).hasClass('sbspf_layout_settings')){
537
  if (!jQuery(this).find('.sbspf_lock').length) {
538
  jQuery(this).find('.sbspf_layout_setting').first().append('<span class="sbspf_note"><a href="https://smashballoon.com/youtube-feed/?utm_source=plugin-free&amp;utm_campaign=sby" target="_blank">Upgrade to Pro to enable the carousel layout</a></span>');
539
- jQuery(this).find('input,select,textarea').attr('disabled','true');
540
  }
541
  } else {
542
  if (jQuery(this).closest('td').find('.sbspf_single_checkbox').length
@@ -555,10 +557,10 @@
555
  }
556
  }else if (jQuery(this).find('input[type=checkbox]').length) {
557
  var $closestTD = jQuery(this).closest('td');
558
- jQuery(this).find('input').attr('disabled','true');
559
  if (jQuery(this).find('input').is(':checked')) {
560
  var $clone = jQuery(this).find('input').clone();
561
- $clone.removeAttr('disabled').removeAttr('checked').attr('type','hidden');
562
  jQuery(this).append($clone);
563
  }
564
  jQuery(this).find('input').removeAttr('checked');
@@ -577,9 +579,9 @@
577
  $('.sbspf_type_row').each(function() {
578
  if ($(this).find('.sbspf_type_input').attr('value') !== 'channel') {
579
  $('.sbspf_disabled_wrap').append($(this));
580
- $(this).find('input').attr('disabled',true);
581
  } else {
582
- $(this).find('input').removeAttr('disabled');
583
  }
584
  });
585
 
@@ -589,7 +591,7 @@
589
  $(this).find('tr').addClass('sbspf_pro_only_row');
590
  var $table = $(this).find('table');
591
  $table.hide();
592
- $(this).find('.sbspf-show-pro').click(function(event){
593
  event.preventDefault();
594
  $table.toggle();
595
  });
@@ -608,11 +610,11 @@
608
  });
609
 
610
  if (typeof $('#sbspf_get_token').attr('data-show-warning') !== 'undefined') {
611
- $('#sbspf_get_token').click(function(event) {
612
  event.preventDefault();
613
  var html = self.getModal();
614
  $('#sbspf_admin').append(html);
615
- $('#sbspf_admin').find('.sbspf_modal_close').click(function() {
616
  $('#sbspf_admin').find('#sbspf_modal_overlay').remove();
617
  });
618
 
@@ -652,6 +654,14 @@
652
  }
653
  sbspfCheckGdprSetting(jQuery('#sbspf_gdpr_setting').val());
654
 
 
 
 
 
 
 
 
 
655
  };
656
 
657
  this.toggleCustomDateField = function() {
@@ -669,7 +679,7 @@
669
  $('.sbspf_type_row').each(function() {
670
  if ($(this).find('.sbspf_type_input').attr('value') !== 'channel') {
671
  $closestTD.append($(this));
672
- $(this).find('input').removeAttr('disabled');
673
  }
674
  });
675
  $('.sby_disabled_wrap').remove();
@@ -683,9 +693,9 @@
683
  $('.sbspf_type_row').each(function() {
684
  if ($(this).find('.sbspf_type_input').attr('value') !== 'channel') {
685
  $('.sby_disabled_wrap').append($(this));
686
- $(this).find('input').attr('disabled',true);
687
  } else {
688
- $(this).find('input').removeAttr('disabled');
689
  }
690
  });
691
  }
@@ -754,17 +764,16 @@
754
  cla = '.'+this.plugin;
755
 
756
  $(cla+'_manually_connect_wrap').hide();
757
- $(cla+'_manually_connect').click(function(event) {
758
  event.preventDefault();
759
  if ( $(cla+'_manually_connect_wrap').is(':visible') ) {
760
  $(cla+'_manually_connect_wrap').slideUp(200);
761
  } else {
762
  $(cla+'_manually_connect_wrap').slideDown(200);
763
- $(id+'_manual_at').focus();
764
  }
765
  });
766
 
767
- $(id+'_manual_submit').click(function(event) {
768
  event.preventDefault();
769
  var $self = $(this);
770
  var accessToken = $(id+'_manual_at').val(),
@@ -776,7 +785,7 @@
776
  $(cla+'_manually_connect_wrap').show().prepend('<div class="'+self.plugin+'_user_id_error" style="display:block;">Please enter a valid access token</div>');
777
  }
778
  } else if (! error) {
779
- $(this).attr('disabled',true);
780
  $(this).closest(cla+'_manually_connect_wrap').fadeOut();
781
  $(cla+'_connected_accounts_wrap').fadeTo("slow" , 0.5).find(cla+'_user_id_error').remove();
782
 
@@ -788,7 +797,7 @@
788
  };
789
  var onSuccess = function (data) {
790
  $(cla+'_connected_accounts_wrap').fadeTo("slow" , 1);
791
- $self.removeAttr('disabled');
792
  if (data.trim().indexOf('{') === 0) {
793
  var returnObj = JSON.parse(data.trim());
794
  if (typeof returnObj.error === 'undefined') {
@@ -820,17 +829,16 @@
820
  cla = '.'+this.plugin;
821
 
822
  $(cla+'_manually_connect_wrap').hide();
823
- $(cla+'_manually_connect').click(function(event) {
824
  event.preventDefault();
825
  if ( $(cla+'_manually_connect_wrap').is(':visible') ) {
826
  $(cla+'_manually_connect_wrap').slideUp(200);
827
  } else {
828
  $(cla+'_manually_connect_wrap').slideDown(200);
829
- $(id+'_manual_at').focus();
830
  }
831
  });
832
 
833
- $(id+'_manual_submit').click(function(event) {
834
  event.preventDefault();
835
  var $self = $(this);
836
  var accessToken = $(id+'_manual_at').val(),
@@ -842,7 +850,7 @@
842
  $(cla+'_manually_connect_wrap').show().prepend('<div class="'+self.plugin+'_user_id_error" style="display:block;">Please enter a valid access token</div>');
843
  }
844
  } else if (! error) {
845
- $(this).attr('disabled',true);
846
  $(this).closest(cla+'_manually_connect_wrap').fadeOut();
847
  $(cla+'_connected_accounts_wrap').fadeTo("slow" , 0.5).find(cla+'_user_id_error').remove();
848
 
@@ -854,7 +862,7 @@
854
  };
855
  var onSuccess = function (data) {
856
  $(cla+'_connected_accounts_wrap').fadeTo("slow" , 1);
857
- $self.removeAttr('disabled');
858
  if (data.trim().indexOf('{') === 0) {
859
  var returnObj = JSON.parse(data.trim());
860
  if (typeof returnObj.error === 'undefined') {
@@ -862,12 +870,10 @@
862
  $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
863
  self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
864
  self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
865
- console.log('added');
866
  } else {
867
  $('#sbspf_connected_account_'+returnObj.account_id).replaceWith(returnObj.html);
868
  self.initClickRemove($('#sbspf_connected_account_'+returnObj.account_id));
869
  self.initInfoToggle($('#sbspf_connected_account_'+returnObj.account_id));
870
- console.log('updated');
871
  }
872
  } else {
873
  alert(returnObj.error);
@@ -875,7 +881,7 @@
875
  }
876
 
877
  self.toggleAccessTokenDisclaimer();
878
- $('.sbspf_dismiss_at_warning_button').click(function() {
879
  event.preventDefault();
880
  $('#sbspf_modal_overlay').remove();
881
  var submitData = {
15
  self.initClickRemove($(this));
16
  self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
17
  });
18
+ this.$adminEl.find('.sbspf_type_input').on('change',function() {
19
  self.updateOnSelect($(this));
20
  });self.updateOnSelect();
21
 
27
 
28
  this.addManualAccessTokenListener();
29
 
30
+ $(id + '_search_submit').on('click',function(event) {
31
  event.preventDefault();
32
 
33
  var submitData = {
48
  });
49
 
50
  // color picker
51
+ var $sbyColorpicker = $(cla+'_colorpicker');
52
 
53
+ if($sbyColorpicker.length > 0){
54
+ $sbyColorpicker.wpColorPicker();
55
  }
56
 
57
  // shortcode tooltips
58
  var $adminLabel = $(id +'_admin label');
59
 
60
+ $adminLabel.on('click',function(){
61
  var $shortcode = $(this).siblings(cla + '_shortcode');
62
  if($shortcode.is(':visible')){
63
+ $(this).closest('tr').removeClass('sby_shortcode_visible');
64
  $shortcode.hide();
65
  } else {
66
+ $(this).closest('tr').addClass('sby_shortcode_visible');
67
  $shortcode.show();
68
  }
69
  });
70
+
71
  $adminLabel.hover(function(){
72
  if($(this).siblings(cla + '_shortcode').length && ! $(this).find(cla + '_shortcode_symbol').length){
73
  $(this).append('<code class="'+self.plugin+'_shortcode_symbol">[]</code>');
78
  $(cla + '_shortcode').hide();
79
 
80
  //Scroll to hash for quick links
81
+ $(id + '_admin a').on('click',function() {
82
  if(location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
83
  var target = $(this.hash);
84
  target = target.length ? target : this.hash.slice(1);
100
  $(cla+'-caching-cron-options').show();
101
  }
102
 
103
+ $('.'+self.plugin+'_caching_type_input').on('change',function() {
104
  if (this.value == 'page') {
105
  $(cla+'-caching-cron-options').slideUp();
106
  $(cla+'-caching-page-options').slideDown();
118
  //Should we show anything initially?
119
  if(sbspf_cache_cron_interval == '30mins' || sbspf_cache_cron_interval == '1hour') $sbspf_caching_time_settings.hide();
120
 
121
+ $(id+'_cache_cron_interval').on('change',function(){
122
  sbspf_cache_cron_interval = $(id+'_cache_cron_interval').val();
123
 
124
  if(sbspf_cache_cron_interval == '30mins' || sbspf_cache_cron_interval == '1hour'){
136
  }
137
 
138
  self.updateLayoutOptionsDisplay();
139
+ $(cla + '_layout_type').on('change',function() {
140
  self.updateLayoutOptionsDisplay()
141
  });
142
+ $(cla + '_sub_option_type').on('change',function() {
143
  self.updateBoxSelectionDisplay()
144
  });
145
  self.updateBoxSelectionDisplay();
146
 
147
  // tooltips
148
+ $(id +'_admin '+ cla + '_tooltip_link').on('click',function(){
149
  if ($(this).closest( cla + '_box').length) {
150
  $(this).closest( cla + '_box').find(cla + '_tooltip').slideToggle();
151
 
154
  }
155
  });
156
 
157
+ $(id +'_admin '+ cla + '_type_tooltip_link').on('click',function(){
158
  $(this).closest(cla + '_row').find(cla + '_tooltip').slideToggle();
159
  });
160
 
162
  var $feedWidth = $(id+'_admin '+id+'_settings_width'),
163
  $widthUnit = $(id+'_admin '+id+'_settings_width_unit');
164
  if ($feedWidth.length) {
165
+ $feedWidth.on('change',function(){
166
  self.updateFeedWidthDisplay();
167
  });
168
+ $widthUnit.on('change',function(){
169
  self.updateFeedWidthDisplay();
170
  });
171
  self.updateFeedWidthDisplay();
200
  },
201
  initClickRemove: function(el) {
202
  var self = this;
203
+ el.find('.'+this.plugin +'_delete_account').on('click',function() {
204
  if (!$(this).closest('.'+self.plugin +'_connected_accounts_wrap').hasClass(self.plugin +'-waiting')) {
205
  $(this).closest('.'+self.plugin +'_connected_accounts_wrap').addClass(self.plugin +'-waiting');
206
  var $connectedAccount = $(this).closest('.'+self.plugin +'_connected_account'),
233
  },
234
  initInfoToggle: function(el) {
235
  var self = this;
236
+ el.find('.'+self.plugin +'_ca_show_token').off().on('click',function() {
237
  $(this).closest('.'+self.plugin +'_ca_info').find('.'+self.plugin +'_ca_accesstoken').slideToggle(200);
238
  });
239
 
240
+ el.find('.'+self.plugin +'_ca_token_shortcode').off().on('click',function() {
241
  $(this).closest('.'+self.plugin +'_ca_info').find('.'+self.plugin +'_ca_shortcode').slideToggle(200);
242
  });
243
  },
244
  initAppCredToggle: function() {
245
  var self = this;
246
+ $('#'+self.plugin +'_have_own_tokens').on('click',function() {
247
  if ($(this).is(':checked')) {
248
  $(this).closest('form').find('.'+self.plugin +'_own_credentials_wrap').slideDown();
249
  } else {
272
  $widthOptions.slideUp();
273
  }
274
 
275
+ $('#sby_settings_width_unit, #sby_settings_width').on('change',function(){
276
  feedWidth = $('#sby_settings_width').length ? $('#sby_settings_width').val() : '100';
277
  widthUnit = $('#sby_settings_widthunit').length ? $('#sby_settings_widthunit').val() : '%';
278
 
288
  },
289
  initActionButtons: function() {
290
  $('#sbspf_admin .sbspf-button-action').each(function(){
291
+ $(this).on('click',function() {
292
  event.preventDefault();
293
  $(this).next('.sbspf_success').remove();
294
 
297
  $targetWaitingEl = typeof $(this).attr('data-sby-waiter') !== 'undefined' ? $($(this).attr('data-sby-waiter')) : $(this),
298
  $self = $(this);
299
  if (!confirmMessage || window.confirm(confirmMessage)) {
300
+ $(this).prop('disabled',true);
301
  $targetWaitingEl.after('<div class="spinner sbspf_spinner" style="display:inline-block;visibility: visible;"></div>');
302
 
303
  var submitData = {
305
  'sbspf_nonce' : sbspf.nonce
306
  };
307
  var onSuccess = function (data) {
308
+ $self.prop('disabled',false);
309
  $targetWaitingEl.next('.spinner').fadeOut('slow',function(){
310
  $targetWaitingEl.after('<span class="sbspf_success"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="check-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-check-circle fa-w-16"><path fill="currentColor" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z" class=""></path></svg></span>');
311
  });
332
  cla = '.'+this.plugin;
333
 
334
  $(cla+'_manually_connect_wrap').hide();
335
+ $(cla+'_manually_connect').on('click',function(event) {
336
  event.preventDefault();
337
  if ( $(cla+'_manually_connect_wrap').is(':visible') ) {
338
  $(cla+'_manually_connect_wrap').slideUp(200);
339
  } else {
340
  $(cla+'_manually_connect_wrap').slideDown(200);
 
341
  }
342
  });
343
 
344
+ $(id+'_manual_submit').on('click',function(event) {
345
  event.preventDefault();
346
  var $self = $(this);
347
  var accessToken = $(id+'_manual_at').val(),
352
  $(cla+'_manually_connect_wrap').show().prepend('<div class="'+self.plugin+'_user_id_error" style="display:block;">Please enter a valid access token</div>');
353
  }
354
  } else if (! error) {
355
+ $(this).prop('disabled',true);
356
  $(this).closest(cla+'_manually_connect_wrap').fadeOut();
357
  $(cla+'_connected_accounts_wrap').fadeTo("slow" , 0.5).find(cla+'_user_id_error').remove();
358
 
363
  };
364
  var onSuccess = function (data) {
365
  $(cla+'_connected_accounts_wrap').fadeTo("slow" , 1);
366
+ $self.prop('disabled',false);
367
  var returnObj = JSON.parse(data.trim());
368
  $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
369
  self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
461
  jQuery('#sbspf-notice-bar').show();
462
  }
463
 
464
+ jQuery('#sbspf-notice-bar .dismiss').on('click',function(e) {
465
  e.preventDefault();
466
  jQuery('#sbspf-notice-bar').remove();
467
  var submitData = {
473
  sbAjax(submitData,onSuccess);
474
  });
475
 
476
+ $('#sbspf_usecustomsearch').on('change',function() {
477
  if ($(this).is(':checked')) {
478
  $('#sbspf_usecustomsearch_reveal').show();
479
  } else {
488
  }
489
 
490
 
491
+ $('.sbspf_dismiss_button').on('click',function() {
492
  event.preventDefault();
493
  $('#sbspf_modal_overlay').remove();
494
  var submitData = {
497
  sbAjax(submitData,function() {});
498
  });
499
 
500
+ $('.sbspf_dismiss_at_warning_button').on('click',function() {
501
  event.preventDefault();
502
  $('#sbspf_modal_overlay').remove();
503
  var submitData = {
538
  } else if (jQuery(this).hasClass('sbspf_layout_settings')){
539
  if (!jQuery(this).find('.sbspf_lock').length) {
540
  jQuery(this).find('.sbspf_layout_setting').first().append('<span class="sbspf_note"><a href="https://smashballoon.com/youtube-feed/?utm_source=plugin-free&amp;utm_campaign=sby" target="_blank">Upgrade to Pro to enable the carousel layout</a></span>');
541
+ jQuery(this).find('input,select,textarea').prop('disabled',true);
542
  }
543
  } else {
544
  if (jQuery(this).closest('td').find('.sbspf_single_checkbox').length
557
  }
558
  }else if (jQuery(this).find('input[type=checkbox]').length) {
559
  var $closestTD = jQuery(this).closest('td');
560
+ jQuery(this).find('input').prop('disabled',true);
561
  if (jQuery(this).find('input').is(':checked')) {
562
  var $clone = jQuery(this).find('input').clone();
563
+ $clone.prop('disabled',false).removeAttr('checked').attr('type','hidden');
564
  jQuery(this).append($clone);
565
  }
566
  jQuery(this).find('input').removeAttr('checked');
579
  $('.sbspf_type_row').each(function() {
580
  if ($(this).find('.sbspf_type_input').attr('value') !== 'channel') {
581
  $('.sbspf_disabled_wrap').append($(this));
582
+ $(this).find('input').prop('disabled',true);
583
  } else {
584
+ $(this).find('input').prop('disabled',false);
585
  }
586
  });
587
 
591
  $(this).find('tr').addClass('sbspf_pro_only_row');
592
  var $table = $(this).find('table');
593
  $table.hide();
594
+ $(this).find('.sbspf-show-pro').on('click',function(event){
595
  event.preventDefault();
596
  $table.toggle();
597
  });
610
  });
611
 
612
  if (typeof $('#sbspf_get_token').attr('data-show-warning') !== 'undefined') {
613
+ $('#sbspf_get_token').on('click',function(event) {
614
  event.preventDefault();
615
  var html = self.getModal();
616
  $('#sbspf_admin').append(html);
617
+ $('#sbspf_admin').find('.sbspf_modal_close').on('click',function() {
618
  $('#sbspf_admin').find('#sbspf_modal_overlay').remove();
619
  });
620
 
654
  }
655
  sbspfCheckGdprSetting(jQuery('#sbspf_gdpr_setting').val());
656
 
657
+ // Locator
658
+ jQuery('.sby-locator-more').on('click',function(e) {
659
+ e.preventDefault();
660
+ jQuery(this).closest('td').find('.sby-full-wrap').show();
661
+ jQuery(this).closest('td').find('.sby-condensed-wrap').hide();
662
+ jQuery(this).remove();
663
+ });
664
+
665
  };
666
 
667
  this.toggleCustomDateField = function() {
679
  $('.sbspf_type_row').each(function() {
680
  if ($(this).find('.sbspf_type_input').attr('value') !== 'channel') {
681
  $closestTD.append($(this));
682
+ $(this).find('input').prop('disabled',false);
683
  }
684
  });
685
  $('.sby_disabled_wrap').remove();
693
  $('.sbspf_type_row').each(function() {
694
  if ($(this).find('.sbspf_type_input').attr('value') !== 'channel') {
695
  $('.sby_disabled_wrap').append($(this));
696
+ $(this).find('input').prop('disabled',true);
697
  } else {
698
+ $(this).find('input').prop('disabled',false);
699
  }
700
  });
701
  }
764
  cla = '.'+this.plugin;
765
 
766
  $(cla+'_manually_connect_wrap').hide();
767
+ $(cla+'_manually_connect').on('click',function(event) {
768
  event.preventDefault();
769
  if ( $(cla+'_manually_connect_wrap').is(':visible') ) {
770
  $(cla+'_manually_connect_wrap').slideUp(200);
771
  } else {
772
  $(cla+'_manually_connect_wrap').slideDown(200);
 
773
  }
774
  });
775
 
776
+ $(id+'_manual_submit').on('click',function(event) {
777
  event.preventDefault();
778
  var $self = $(this);
779
  var accessToken = $(id+'_manual_at').val(),
785
  $(cla+'_manually_connect_wrap').show().prepend('<div class="'+self.plugin+'_user_id_error" style="display:block;">Please enter a valid access token</div>');
786
  }
787
  } else if (! error) {
788
+ $(this).prop('disabled',true);
789
  $(this).closest(cla+'_manually_connect_wrap').fadeOut();
790
  $(cla+'_connected_accounts_wrap').fadeTo("slow" , 0.5).find(cla+'_user_id_error').remove();
791
 
797
  };
798
  var onSuccess = function (data) {
799
  $(cla+'_connected_accounts_wrap').fadeTo("slow" , 1);
800
+ $self.prop('disabled',false);
801
  if (data.trim().indexOf('{') === 0) {
802
  var returnObj = JSON.parse(data.trim());
803
  if (typeof returnObj.error === 'undefined') {
829
  cla = '.'+this.plugin;
830
 
831
  $(cla+'_manually_connect_wrap').hide();
832
+ $(cla+'_manually_connect').on('click',function(event) {
833
  event.preventDefault();
834
  if ( $(cla+'_manually_connect_wrap').is(':visible') ) {
835
  $(cla+'_manually_connect_wrap').slideUp(200);
836
  } else {
837
  $(cla+'_manually_connect_wrap').slideDown(200);
 
838
  }
839
  });
840
 
841
+ $(id+'_manual_submit').on('click',function(event) {
842
  event.preventDefault();
843
  var $self = $(this);
844
  var accessToken = $(id+'_manual_at').val(),
850
  $(cla+'_manually_connect_wrap').show().prepend('<div class="'+self.plugin+'_user_id_error" style="display:block;">Please enter a valid access token</div>');
851
  }
852
  } else if (! error) {
853
+ $(this).prop('disabled',true);
854
  $(this).closest(cla+'_manually_connect_wrap').fadeOut();
855
  $(cla+'_connected_accounts_wrap').fadeTo("slow" , 0.5).find(cla+'_user_id_error').remove();
856
 
862
  };
863
  var onSuccess = function (data) {
864
  $(cla+'_connected_accounts_wrap').fadeTo("slow" , 1);
865
+ $self.prop('disabled',false);
866
  if (data.trim().indexOf('{') === 0) {
867
  var returnObj = JSON.parse(data.trim());
868
  if (typeof returnObj.error === 'undefined') {
870
  $('.'+self.plugin +'_connected_accounts_wrap').prepend(returnObj.html);
871
  self.initClickRemove($('.'+self.plugin +'_connected_accounts_wrap').last());
872
  self.initInfoToggle($('.'+self.plugin +'_connected_accounts_wrap').last());
 
873
  } else {
874
  $('#sbspf_connected_account_'+returnObj.account_id).replaceWith(returnObj.html);
875
  self.initClickRemove($('#sbspf_connected_account_'+returnObj.account_id));
876
  self.initInfoToggle($('#sbspf_connected_account_'+returnObj.account_id));
 
877
  }
878
  } else {
879
  alert(returnObj.error);
881
  }
882
 
883
  self.toggleAccessTokenDisclaimer();
884
+ $('.sbspf_dismiss_at_warning_button').on('click',function() {
885
  event.preventDefault();
886
  $('#sbspf_modal_overlay').remove();
887
  var submitData = {
js/sb-youtube.js CHANGED
@@ -198,7 +198,7 @@ if(!sby_js_exists) {
198
  sby_timer = setTimeout(sby_callback, sby_ms);
199
  };
200
  })();
201
- jQuery(window).resize(function () {
202
  sby_lb_delay(function () {
203
  lbBuilder.afterResize();
204
  }, 200);
@@ -467,7 +467,7 @@ if(!sby_js_exists) {
467
  new c(a)
468
 
469
  //Lightbox hide photo function
470
- $('.sby_lightbox_action a').unbind().bind('click', function(){
471
  $(this).parent().find('.sby_lightbox_tooltip').toggle();
472
  });
473
  }
@@ -499,6 +499,7 @@ if(!sby_js_exists) {
499
  num : $self.attr('data-num'),
500
  imgRes : $self.attr('data-res'),
501
  feedID : $self.attr('data-feedid'),
 
502
  shortCodeAtts : $self.attr('data-shortcode-atts'),
503
  resizingEnabled : (flags.indexOf('resizeDisable') === -1),
504
  imageLoadEnabled : (flags.indexOf('imageLoadDisable') === -1),
@@ -511,6 +512,7 @@ if(!sby_js_exists) {
511
  consentGiven : (flags.indexOf('gdpr') === -1),
512
  noCDN : (flags.indexOf('disablecdn') > -1),
513
  lightboxEnabled : typeof $self.attr('data-sby-supports-lightbox') !== 'undefined',
 
514
  autoMinRes : 1,
515
  general : general
516
  };
@@ -533,10 +535,15 @@ if(!sby_js_exists) {
533
  // enable header hover action
534
  $('.sb_instagram_header').each(function () {
535
  var $thisHeader = $(this);
536
- $thisHeader.find('.sby_header_link').hover(function () {
537
- $thisHeader.find('.sby_header_img_hover').addClass('sby_fade_in');
538
- }, function () {
539
- $thisHeader.find('.sby_header_img_hover').removeClass('sby_fade_in');
 
 
 
 
 
540
  });
541
  });
542
 
@@ -612,7 +619,7 @@ if(!sby_js_exists) {
612
  sby_timer = setTimeout(sby_callback, sby_ms);
613
  };
614
  })();
615
- jQuery(window).resize(function () {
616
  sby_delay(function () {
617
  feed.afterResize();
618
  }, 500);
@@ -627,7 +634,7 @@ if(!sby_js_exists) {
627
  feed = this;
628
  if ($self.hasClass('sby_layout_gallery') && $self.find('.sby_player_outer_wrap').length) {
629
  this.maybeRaiseSingleImageResolution($self.find('.sby_player_outer_wrap'), 0, true);
630
- $self.find('.sby_player_outer_wrap .sby_video_thumbnail').off().click(function (event) {
631
  if ((!feed.settings.lightboxEnabled || (feed.settings.lightboxEnabled && feed.settings.noCDN))
632
  && (feed.settings.noCDN || !feed.settings.consentGiven)) {
633
  if (typeof $(this).closest('.sby_item').length
@@ -879,14 +886,14 @@ if(!sby_js_exists) {
879
  });
880
  }
881
 
882
- $self.find('.sby_video_thumbnail').mouseenter(function() {
883
  feed.onThumbnailEnter($(this), false);
884
  });
885
- $self.find('.sby_player_wrap').mouseleave(function() {
886
  feed.onThumbnailLeave($(this), false);
887
  });
888
  //init click
889
- $self.find('.sby_video_thumbnail').click(function(event) {
890
  if ((!feed.settings.lightboxEnabled || (feed.settings.lightboxEnabled && feed.settings.noCDN))
891
  && (feed.settings.noCDN || !feed.settings.consentGiven)) {
892
  if (typeof $(this).closest('.sby_item').length
@@ -975,6 +982,8 @@ if(!sby_js_exists) {
975
  needs_resizing: feed.needsResizing,
976
  offset: itemOffset,
977
  feed_id: feed.settings.feedID,
 
 
978
  atts: feed.settings.shortCodeAtts,
979
  };
980
  var onSuccess = function(data) {
@@ -998,6 +1007,8 @@ if(!sby_js_exists) {
998
  action: 'sby_check_wp_submit',
999
  feed_id: feedID,
1000
  atts: feed.settings.shortCodeAtts,
 
 
1001
  offset: ! $(this.el).hasClass('sby_layout_carousel') ? $(this.el).find('.sby_item').length : Math.floor(($(this.el).find('.sby_item').length / 2) -1),
1002
  posts: posts,
1003
  cache_all : feed.settings.cacheAll
@@ -1034,6 +1045,8 @@ if(!sby_js_exists) {
1034
  action: 'sby_load_more_clicked',
1035
  offset: itemOffset,
1036
  feed_id: feed.settings.feedID,
 
 
1037
  atts: feed.settings.shortCodeAtts,
1038
  current_resolution: feed.imageResolution
1039
  };
@@ -1646,6 +1659,22 @@ if(!sby_js_exists) {
1646
  }
1647
 
1648
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1649
  }
1650
  };
1651
 
@@ -1775,7 +1804,7 @@ if(!sby_js_exists) {
1775
  }
1776
 
1777
  // Cookie Notice by dFactory
1778
- $('#cookie-notice a').click(function() {
1779
  setTimeout(function() {
1780
  $.each(window.sby.feeds,function(index){
1781
  window.sby.feeds[ index ].afterConsentToggled();
@@ -1784,7 +1813,7 @@ if(!sby_js_exists) {
1784
  });
1785
 
1786
  // Cookie Notice by dFactory
1787
- $('#cookie-law-info-bar a').click(function() {
1788
  setTimeout(function() {
1789
  $.each(window.sby.feeds,function(index){
1790
  window.sby.feeds[ index ].afterConsentToggled();
@@ -1793,7 +1822,7 @@ if(!sby_js_exists) {
1793
  });
1794
 
1795
  // GDPR Cookie Consent by WebToffee
1796
- $('.cli-user-preference-checkbox').click(function(){
1797
  setTimeout(function() {
1798
  $.each(window.sby.feeds,function(index){
1799
  window.sby.feeds[ index ].settings.consentGiven = false;
@@ -1916,7 +1945,7 @@ window.onYouTubeIframeAPIReady = function() {
1916
  $self.find('.sby_item').css('opacity',1);
1917
  $self.find('.sby_player_loading').removeClass('sby_player_loading');
1918
  if ($self.hasClass('sby_layout_list')) {
1919
- $self.find('.sby_item_video_thumbnail').mouseenter(function() {
1920
  jQuery(this).css('z-index',-1);
1921
  })
1922
  }
198
  sby_timer = setTimeout(sby_callback, sby_ms);
199
  };
200
  })();
201
+ jQuery(window).on('resize',function () {
202
  sby_lb_delay(function () {
203
  lbBuilder.afterResize();
204
  }, 200);
467
  new c(a)
468
 
469
  //Lightbox hide photo function
470
+ $('.sby_lightbox_action a').off().on('click', function(){
471
  $(this).parent().find('.sby_lightbox_tooltip').toggle();
472
  });
473
  }
499
  num : $self.attr('data-num'),
500
  imgRes : $self.attr('data-res'),
501
  feedID : $self.attr('data-feedid'),
502
+ postID : typeof $self.attr( 'data-postid' ) !== 'undefind' ? $self.attr( 'data-postid' ) : 'unknown',
503
  shortCodeAtts : $self.attr('data-shortcode-atts'),
504
  resizingEnabled : (flags.indexOf('resizeDisable') === -1),
505
  imageLoadEnabled : (flags.indexOf('imageLoadDisable') === -1),
512
  consentGiven : (flags.indexOf('gdpr') === -1),
513
  noCDN : (flags.indexOf('disablecdn') > -1),
514
  lightboxEnabled : typeof $self.attr('data-sby-supports-lightbox') !== 'undefined',
515
+ locator : (flags.indexOf('locator') > -1),
516
  autoMinRes : 1,
517
  general : general
518
  };
535
  // enable header hover action
536
  $('.sb_instagram_header').each(function () {
537
  var $thisHeader = $(this);
538
+ $thisHeader.find('.sby_header_link').on('mouseenter mouseleave', function(e) {
539
+ switch(e.type) {
540
+ case 'mouseenter':
541
+ $thisHeader.find('.sby_header_img_hover').addClass('sby_fade_in');
542
+ break;
543
+ case 'mouseleave':
544
+ $thisHeader.find('.sby_header_img_hover').removeClass('sby_fade_in');
545
+ break;
546
+ }
547
  });
548
  });
549
 
619
  sby_timer = setTimeout(sby_callback, sby_ms);
620
  };
621
  })();
622
+ jQuery(window).on('resize',function () {
623
  sby_delay(function () {
624
  feed.afterResize();
625
  }, 500);
634
  feed = this;
635
  if ($self.hasClass('sby_layout_gallery') && $self.find('.sby_player_outer_wrap').length) {
636
  this.maybeRaiseSingleImageResolution($self.find('.sby_player_outer_wrap'), 0, true);
637
+ $self.find('.sby_player_outer_wrap .sby_video_thumbnail').off().on('click',function (event) {
638
  if ((!feed.settings.lightboxEnabled || (feed.settings.lightboxEnabled && feed.settings.noCDN))
639
  && (feed.settings.noCDN || !feed.settings.consentGiven)) {
640
  if (typeof $(this).closest('.sby_item').length
886
  });
887
  }
888
 
889
+ $self.find('.sby_video_thumbnail').on('mouseenter',function() {
890
  feed.onThumbnailEnter($(this), false);
891
  });
892
+ $self.find('.sby_player_wrap').on('mouseleave',function() {
893
  feed.onThumbnailLeave($(this), false);
894
  });
895
  //init click
896
+ $self.find('.sby_video_thumbnail').on('click',function(event) {
897
  if ((!feed.settings.lightboxEnabled || (feed.settings.lightboxEnabled && feed.settings.noCDN))
898
  && (feed.settings.noCDN || !feed.settings.consentGiven)) {
899
  if (typeof $(this).closest('.sby_item').length
982
  needs_resizing: feed.needsResizing,
983
  offset: itemOffset,
984
  feed_id: feed.settings.feedID,
985
+ location: feed.locationGuess(),
986
+ post_id: feed.settings.postID,
987
  atts: feed.settings.shortCodeAtts,
988
  };
989
  var onSuccess = function(data) {
1007
  action: 'sby_check_wp_submit',
1008
  feed_id: feedID,
1009
  atts: feed.settings.shortCodeAtts,
1010
+ location: feed.locationGuess(),
1011
+ post_id: feed.settings.postID,
1012
  offset: ! $(this.el).hasClass('sby_layout_carousel') ? $(this.el).find('.sby_item').length : Math.floor(($(this.el).find('.sby_item').length / 2) -1),
1013
  posts: posts,
1014
  cache_all : feed.settings.cacheAll
1045
  action: 'sby_load_more_clicked',
1046
  offset: itemOffset,
1047
  feed_id: feed.settings.feedID,
1048
+ location: feed.locationGuess(),
1049
+ post_id: feed.settings.postID,
1050
  atts: feed.settings.shortCodeAtts,
1051
  current_resolution: feed.imageResolution
1052
  };
1659
  }
1660
 
1661
  }
1662
+ },
1663
+ locationGuess: function() {
1664
+ var $feed = $(this.el),
1665
+ location = 'content';
1666
+
1667
+ if ($feed.closest('footer').length) {
1668
+ location = 'footer';
1669
+ } else if ($feed.closest('.header').length
1670
+ || $feed.closest('header').length) {
1671
+ location = 'header';
1672
+ } else if ($feed.closest('.sidebar').length
1673
+ || $feed.closest('aside').length) {
1674
+ location = 'sidebar';
1675
+ }
1676
+
1677
+ return location;
1678
  }
1679
  };
1680
 
1804
  }
1805
 
1806
  // Cookie Notice by dFactory
1807
+ $('#cookie-notice a').on('click',function() {
1808
  setTimeout(function() {
1809
  $.each(window.sby.feeds,function(index){
1810
  window.sby.feeds[ index ].afterConsentToggled();
1813
  });
1814
 
1815
  // Cookie Notice by dFactory
1816
+ $('#cookie-law-info-bar a').on('click',function() {
1817
  setTimeout(function() {
1818
  $.each(window.sby.feeds,function(index){
1819
  window.sby.feeds[ index ].afterConsentToggled();
1822
  });
1823
 
1824
  // GDPR Cookie Consent by WebToffee
1825
+ $('.cli-user-preference-checkbox').on('click',function(){
1826
  setTimeout(function() {
1827
  $.each(window.sby.feeds,function(index){
1828
  window.sby.feeds[ index ].settings.consentGiven = false;
1945
  $self.find('.sby_item').css('opacity',1);
1946
  $self.find('.sby_player_loading').removeClass('sby_player_loading');
1947
  if ($self.hasClass('sby_layout_list')) {
1948
+ $self.find('.sby_item_video_thumbnail').on('mouseenter',function() {
1949
  jQuery(this).css('z-index',-1);
1950
  })
1951
  }
js/sb-youtube.min.js CHANGED
@@ -1 +1 @@
1
- var sby_js_exists=void 0!==sby_js_exists;if(!sby_js_exists){function sby_supports_video(){return!!document.createElement("video").canPlayType}!function(e){function i(){var e,i,t,s=s||{VER:"0.9.944"};s.bgs_Available=!1,s.bgs_CheckRunned=!1,function(e){e.fn.extend({sby_imgLiquid:function(i){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},function(){if(!s.bgs_CheckRunned){s.bgs_CheckRunned=!0;var i=e('<span style="background-size:cover" />');e("body").append(i),function(){var e=i[0];if(e&&window.getComputedStyle){var t=window.getComputedStyle(e,null);t&&t.backgroundSize&&(s.bgs_Available="cover"===t.backgroundSize)}}(),i.remove()}}();var t=this;return this.options=i,this.settings=e.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(i){function a(){(r.responsive||h.data("sby_imgLiquid_oldProcessed"))&&h.data("sby_imgLiquid_settings")&&(r=h.data("sby_imgLiquid_settings"),l.actualSize=l.get(0).offsetWidth+l.get(0).offsetHeight/1e4,l.sizeOld&&l.actualSize!==l.sizeOld&&o(),l.sizeOld=l.actualSize,setTimeout(a,r.responsiveCheckTime))}function n(){h.data("sby_imgLiquid_error",!0),l.addClass("sby_imgLiquid_error"),r.onItemError&&r.onItemError(i,l,h),d()}function o(){var e,t,s,a,n,o,b,y,u=0,g=0,c=l.width(),f=l.height();void 0===h.data("owidth")&&h.data("owidth",h[0].width),void 0===h.data("oheight")&&h.data("oheight",h[0].height),r.fill===c/f>=h.data("owidth")/h.data("oheight")?(e="100%",t="auto",s=Math.floor(c),a=Math.floor(c*(h.data("oheight")/h.data("owidth")))):(e="auto",t="100%",s=Math.floor(f*(h.data("owidth")/h.data("oheight"))),a=Math.floor(f)),b=c-s,"left"===(n=r.horizontalAlign.toLowerCase())&&(g=0),"center"===n&&(g=.5*b),"right"===n&&(g=b),-1!==n.indexOf("%")&&((n=parseInt(n.replace("%",""),10))>0&&(g=b*n*.01)),y=f-a,"left"===(o=r.verticalAlign.toLowerCase())&&(u=0),"center"===o&&(u=.5*y),"bottom"===o&&(u=y),-1!==o.indexOf("%")&&((o=parseInt(o.replace("%",""),10))>0&&(u=y*o*.01)),r.hardPixels&&(e=s,t=a),h.css({width:e,height:t,"margin-left":Math.floor(g),"margin-top":Math.floor(u)}),h.data("sby_imgLiquid_oldProcessed")||(h.fadeTo(r.fadeInTime,1),h.data("sby_imgLiquid_oldProcessed",!0),r.removeBoxBackground&&l.css("background-image","none"),l.addClass("sby_imgLiquid_nobgSize"),l.addClass("sby_imgLiquid_ready")),r.onItemFinish&&r.onItemFinish(i,l,h),d()}function d(){i===t.length-1&&t.settings.onFinish&&t.settings.onFinish()}var r=t.settings,l=e(this),h=e("img:first",l);return h.length?(h.data("sby_imgLiquid_settings")?(l.removeClass("sby_imgLiquid_error").removeClass("sby_imgLiquid_ready"),r=e.extend({},h.data("sby_imgLiquid_settings"),t.options)):r=e.extend({},t.settings,function(){var e={};if(t.settings.useDataHtmlAttr){var i=l.attr("data-sby_imgLiquid-fill"),a=l.attr("data-sby_imgLiquid-horizontalAlign"),n=l.attr("data-sby_imgLiquid-verticalAlign");("true"===i||"false"===i)&&(e.fill=Boolean("true"===i)),void 0===a||"left"!==a&&"center"!==a&&"right"!==a&&-1===a.indexOf("%")||(e.horizontalAlign=a),void 0===n||"top"!==n&&"bottom"!==n&&"center"!==n&&-1===n.indexOf("%")||(e.verticalAlign=n)}return s.isIE&&t.settings.ieFadeInDisabled&&(e.fadeInTime=0),e}()),h.data("sby_imgLiquid_settings",r),r.onItemStart&&r.onItemStart(i,l,h),void(s.bgs_Available&&r.useBackgroundSize?(-1===l.css("background-image").indexOf(encodeURI(h.attr("src")))&&l.css({"background-image":'url("'+encodeURI(h.attr("src"))+'")'}),l.css({"background-size":r.fill?"cover":"contain","background-position":(r.horizontalAlign+" "+r.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),e("a:first",l).css({display:"block",width:"100%",height:"100%"}),e("img",l).css({display:"none"}),r.onItemFinish&&r.onItemFinish(i,l,h),l.addClass("sby_imgLiquid_bgSize"),l.addClass("sby_imgLiquid_ready"),d()):function t(){if(h.data("oldSrc")&&h.data("oldSrc")!==h.attr("src")){var s=h.clone().removeAttr("style");return s.data("sby_imgLiquid_settings",h.data("sby_imgLiquid_settings")),h.parent().prepend(s),h.remove(),(h=s)[0].width=0,void setTimeout(t,10)}return h.data("sby_imgLiquid_oldProcessed")?void o():(h.data("sby_imgLiquid_oldProcessed",!1),h.data("oldSrc",h.attr("src")),e("img:not(:first)",l).css("display","none"),l.css({overflow:"hidden"}),h.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),h.on("error",n),h[0].onerror=n,function e(){h.data("sby_imgLiquid_error")||h.data("sby_imgLiquid_loaded")||h.data("sby_imgLiquid_oldProcessed")||(l.is(":visible")&&h[0].complete&&h[0].width>0&&h[0].height>0?(h.data("sby_imgLiquid_loaded",!0),setTimeout(o,i*r.delay)):setTimeout(e,r.timecheckvisibility))}(),void a())}())):void n()})}})}(jQuery),e=s.injectCss,i=document.getElementsByTagName("head")[0],(t=document.createElement("style")).type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),i.appendChild(t)}function t(){this.feeds={},this.options=sbyOptions,this.isTouch=function(){if("ontouchstart"in document.documentElement)return!0;return!1}()}function s(e,i,t){this.el=e,this.index=i,this.settings=t,this.placeholderURL=window.sby.options.placeholder,t.narrowPlayer&&(this.placeholderURL=window.sby.options.placeholderNarrow),this.playerAPIReady=!1,this.consentGiven=t.consentGiven,this.players={},this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.isInitialized=!1,this.mostRecentlyLoadedPosts=[]}function a(){}function n(i,t){e.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:i,success:t})}t.prototype={createPage:function(i,t){void 0!==window.sbyajaxurl&&-1!==window.sbyajaxurl.indexOf(window.location.hostname)||(window.sbyajaxurl=window.location.hostname+"/wp-admin/admin-ajax.php"),e(".sby_no_js_error_message").remove(),e(".sby_no_js").removeClass("sby_no_js"),i(t)},maybeAddYTAPI:function(){if(null===document.getElementById("sby-youtube-api")){var e=document.createElement("script"),i=document.getElementsByTagName("script")[0];e.src="https://www.youtube.com/iframe_api",e.id="sby-youtube-api",i.parentNode.insertBefore(e,i)}},createLightbox:function(){var i,t=new a,s=(i=0,function(e,t){clearTimeout(i),i=setTimeout(e,t)});jQuery(window).resize(function(){s(function(){t.afterResize()},200)}),function(){var i=jQuery,s=function(){function e(){this.fadeDuration=500,this.fitImagesInViewport=!0,this.resizeDuration=700,this.positionFromTop=50,this.showImageNumberLabel=!0,this.alwaysShowNavOnTouchDevices=!1,this.wrapAround=!1}return e.prototype.albumLabel=function(e,i){return e+" / "+i},e}(),a=function(){function s(e){this.options=e,this.album=[],this.currentImageIndex=void 0,this.init()}return s.prototype.init=function(){this.enable(),this.build()},s.prototype.enable=function(){var e=this;i("body").on("click","a[data-sby-lightbox]",function(t){return e.start(i(t.currentTarget)),!1})},s.prototype.build=function(){var e=this;i(""+t.template()).appendTo(i("body")),this.$lightbox=i("#sby_lightbox"),this.$overlay=i("#sby_lightboxOverlay"),this.$outerContainer=this.$lightbox.find(".sby_lb-outerContainer"),this.$container=this.$lightbox.find(".sby_lb-container"),this.containerTopPadding=parseInt(this.$container.css("padding-top"),10),this.containerRightPadding=parseInt(this.$container.css("padding-right"),10),this.containerBottomPadding=parseInt(this.$container.css("padding-bottom"),10),this.containerLeftPadding=parseInt(this.$container.css("padding-left"),10),this.$overlay.hide().on("click",function(){return e.end(),!1}),jQuery(document).on("click",function(e,i,t){jQuery(e.target).closest(".sby_lb-outerContainer").length||jQuery(e.target).closest(".sby_lb-dataContainer").length||(void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),jQuery("#sby_lightboxOverlay, #sby_lightbox").fadeOut())}),this.$lightbox.hide(),jQuery("#sby_lightboxOverlay").on("click",function(t){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),"sby_lightbox"===i(t.target).attr("id")&&e.end(),!1}),this.$lightbox.find(".sby_lb-prev").on("click",function(){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),e.changeImage(0===e.currentImageIndex?e.album.length-1:e.currentImageIndex-1),!1}),this.$lightbox.find(".sby_lb-container").on("swiperight",function(){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),e.changeImage(0===e.currentImageIndex?e.album.length-1:e.currentImageIndex-1),!1}),this.$lightbox.find(".sby_lb-next").on("click",function(){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),e.changeImage(e.currentImageIndex===e.album.length-1?0:e.currentImageIndex+1),!1}),this.$lightbox.find(".sby_lb-container").on("swipeleft",function(){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),e.changeImage(e.currentImageIndex===e.album.length-1?0:e.currentImageIndex+1),!1}),this.$lightbox.find(".sby_lb-loader, .sby_lb-close").on("click",function(){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),e.end(),!1})},s.prototype.start=function(e){function s(e){a.album.push(t.getData(e))}var a=this,n=i(window);n.on("resize",i.proxy(this.sizeOverlay,this)),i("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var o,d=0,r=e.attr("data-sby-lightbox");if(r){o=i(e.prop("tagName")+'[data-sby-lightbox="'+r+'"]');for(var l=0;l<o.length;l=++l)s(i(o[l])),o[l]===e[0]&&(d=l)}else if("lightbox"===e.attr("rel"))s(e);else{o=i(e.prop("tagName")+'[rel="'+e.attr("rel")+'"]');for(var h=0;h<o.length;h=++h)s(i(o[h])),o[h]===e[0]&&(d=h)}var b=n.scrollTop()+this.options.positionFromTop,y=n.scrollLeft();this.$lightbox.css({top:b+"px",left:y+"px"}).fadeIn(this.options.fadeDuration),this.changeImage(d)},s.prototype.changeImage=function(e){var t=this;this.disableKeyboardNav();var s=this.$lightbox.find(".sby_lb-image");this.$overlay.fadeIn(this.options.fadeDuration),i(".sby_lb-loader").fadeIn("slow"),this.$lightbox.find(".sby_lb-image, .sby_lb-nav, .sby_lb-prev, .sby_lb-next, .sby_lb-dataContainer, .sby_lb-numbers, .sby_lb-caption").hide(),this.$outerContainer.addClass("animating");var a=new Image;a.onload=function(){var n,o,d,r,l,h;s.attr("src",t.album[e].link),i(a),s.width(a.width),s.height(a.height),t.options.fitImagesInViewport&&(h=i(window).width(),l=i(window).height(),r=h-t.containerLeftPadding-t.containerRightPadding-20-100,d=l-t.containerTopPadding-t.containerBottomPadding-150,(a.width>r||a.height>d)&&(a.width/r>a.height/d?(o=r,n=parseInt(a.height/(a.width/o),10),s.width(o),s.height(n)):(n=d,o=parseInt(a.width/(a.height/n),10),s.width(o),s.height(n)))),t.sizeContainer(s.width(),s.height())},a.src=this.album[e].link,this.currentImageIndex=e},s.prototype.sizeOverlay=function(){this.$overlay.width(i(window).width()).height(i(document).height())},s.prototype.sizeContainer=function(e,i){function t(){s.$lightbox.find(".sby_lb-dataContainer").width(o),s.$lightbox.find(".sby_lb-prevLink").height(d),s.$lightbox.find(".sby_lb-nextLink").height(d),s.showImage()}var s=this,a=this.$outerContainer.outerWidth(),n=this.$outerContainer.outerHeight(),o=e+this.containerLeftPadding+this.containerRightPadding,d=i+this.containerTopPadding+this.containerBottomPadding;a!==o||n!==d?this.$outerContainer.animate({width:o,height:d},this.options.resizeDuration,"swing",function(){t()}):t()},s.prototype.showImage=function(){this.$lightbox.find(".sby_lb-loader").hide(),this.$lightbox.find(".sby_lb-image").fadeIn("slow"),this.updateNav(),this.updateDetails(),this.preloadNeighboringImages(),this.enableKeyboardNav()},s.prototype.updateNav=function(){var e=!1;try{document.createEvent("TouchEvent"),e=!!this.options.alwaysShowNavOnTouchDevices}catch(e){}this.$lightbox.find(".sby_lb-nav").show(),this.album.length>1&&(this.options.wrapAround?(e&&this.$lightbox.find(".sby_lb-prev, .sby_lb-next").css("opacity","1"),this.$lightbox.find(".sby_lb-prev, .sby_lb-next").show()):(this.currentImageIndex>0&&(this.$lightbox.find(".sby_lb-prev").show(),e&&this.$lightbox.find(".sby_lb-prev").css("opacity","1")),this.currentImageIndex<this.album.length-1&&(this.$lightbox.find(".sby_lb-next").show(),e&&this.$lightbox.find(".sby_lb-next").css("opacity","1"))))},s.prototype.updateDetails=function(){var i=this;jQuery("iframe.sby_lb-player-loaded").length&&(jQuery(".sby_lb-player-placeholder").replaceWith(jQuery("iframe.sby_lb-player-loaded")),jQuery("iframe.sby_lb-player-loaded").removeClass("sby_lb-player-loaded").show());var s=window.sby.feeds[this.album[this.currentImageIndex].feedIndex];if(t.beforePlayerSetup(this.$lightbox,this.album[this.currentImageIndex],this.currentImageIndex,this.album,s),sby_supports_video()){if(jQuery("#sby_lightbox").removeClass("sby_video_lightbox"),s.settings.consentGiven&&this.album[this.currentImageIndex].video.length){jQuery(".sby_gdpr_notice").remove();var a="sby_lb-player";jQuery("#sby_lightbox").addClass("sby_video_lightbox");var n=this.album[this.currentImageIndex].video,o=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var d={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:n,playerVars:{modestbranding:1,rel:0,autoplay:o},events:{onStateChange:function(i){var t=i.target.getVideoData().video_id;s.afterStateChange(a,t,i,e("#"+a).closest(".sby_video_thumbnail_wrap"))}}};s.maybeAddCTA(a),window.sbyLightboxPlayer=new window.YT.Player(a,d)}else window.sbyLightboxPlayer.loadVideoById(n);this.$outerContainer.removeClass("animating"),this.$lightbox.find(".sby_lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return i.sizeOverlay()}),setTimeout(function(){e("#sby_lightbox .sby_lb-player").css({height:e("#sby_lightbox .sby_lb-outerContainer").height()+"px",width:e("#sby_lightbox .sby_lb-outerContainer").width()+"px",top:0})},400),this.$lightbox.find("iframe").length&&this.$lightbox.find("iframe").attr("title",this.album[this.currentImageIndex].videoTitle)}else{var r=e(".sby_item[data-video-id="+this.album[this.currentImageIndex].video+"]").find(".sby_video_thumbnail").attr("data-full-res");e(".sby_lb-image").attr("src",r),this.$outerContainer.removeClass("animating"),this.$lightbox.find(".sby_lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return i.sizeOverlay()}),jQuery(".sby_lb-container").prepend('<a href="https://www.youtube.com/watch?v='+this.album[this.currentImageIndex].video+'" target="_blank" rel="noopener noreferrer" class="sby_gdpr_notice"><svg style="color: rgba(255,255,255,1)" class="svg-inline--fa fa-play fa-w-14 sby_playbtn" aria-label="Play" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="play" role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"></path></svg></a>')}t.afterPlayerSetup(this.$lightbox,this.album[this.currentImageIndex],this.currentImageIndex,this.album),this.album.length>1&&this.options.showImageNumberLabel?this.$lightbox.find(".sby_lb-number").text(this.options.albumLabel(this.currentImageIndex+1,this.album.length)).fadeIn("fast"):this.$lightbox.find(".sby_lb-number").hide()}},s.prototype.preloadNeighboringImages=function(){this.album.length>this.currentImageIndex+1&&((new Image).src=this.album[this.currentImageIndex+1].link);this.currentImageIndex>0&&((new Image).src=this.album[this.currentImageIndex-1].link)},s.prototype.enableKeyboardNav=function(){i(document).on("keyup.keyboard",i.proxy(this.keyboardAction,this))},s.prototype.disableKeyboardNav=function(){i(document).off(".keyboard")},s.prototype.keyboardAction=function(i){var t=event.keyCode,s=String.fromCharCode(t).toLowerCase();27===t||s.match(/x|o|c/)?(sby_supports_video()&&e("#sby_lightbox video.sby_video")[0].pause(),e("#sby_lightbox iframe").attr("src",""),this.end()):"p"===s||37===t?(0!==this.currentImageIndex?this.changeImage(this.currentImageIndex-1):this.options.wrapAround&&this.album.length>1&&this.changeImage(this.album.length-1),sby_supports_video()&&e("#sby_lightbox video.sby_video")[0].pause(),e("#sby_lightbox iframe").attr("src","")):"n"!==s&&39!==t||(this.currentImageIndex!==this.album.length-1?this.changeImage(this.currentImageIndex+1):this.options.wrapAround&&this.album.length>1&&this.changeImage(0),void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo())},s.prototype.end=function(){this.disableKeyboardNav(),i(window).off("resize",this.sizeOverlay),this.$lightbox.fadeOut(this.options.fadeDuration),this.$overlay.fadeOut(this.options.fadeDuration),i("select, object, embed").css({visibility:"visible"})},s}();i(function(){var i=new s;new a(i),e(".sby_lightbox_action a").unbind().bind("click",function(){e(this).parent().find(".sby_lightbox_tooltip").toggle()})})}.call(this)},createFeeds:function(i){window.sby.createLightbox(),i.whenFeedsCreated(e(".sb_youtube").each(function(i){e(this).attr("data-sby-index",i+1),e(this).find(".sby_player").replaceWith('<div id="sby_player'+i+'"></div>');var t=e(this),a=void 0!==t.attr("data-sby-flags")?t.attr("data-sby-flags").split(","):[],o=void 0!==t.attr("data-options")?JSON.parse(t.attr("data-options")):{};if(a.indexOf("testAjax")>-1){window.sby.triggeredTest=!0;n({action:"sby_on_ajax_test_trigger"},function(e){console.log("did test")})}var d={cols:t.attr("data-cols"),colsmobile:"same"!==t.attr("data-colsmobile")?t.attr("data-colsmobile"):t.attr("data-cols"),num:t.attr("data-num"),imgRes:t.attr("data-res"),feedID:t.attr("data-feedid"),shortCodeAtts:t.attr("data-shortcode-atts"),resizingEnabled:-1===a.indexOf("resizeDisable"),imageLoadEnabled:-1===a.indexOf("imageLoadDisable"),debugEnabled:a.indexOf("debug")>-1,favorLocal:a.indexOf("favorLocal")>-1,ajaxPostLoad:a.indexOf("ajaxPostLoad")>-1,checkWPPosts:a.indexOf("checkWPPosts")>-1,cacheAll:a.indexOf("cacheAll")>-1,gdpr:a.indexOf("gdpr")>-1,consentGiven:-1===a.indexOf("gdpr"),noCDN:a.indexOf("disablecdn")>-1,lightboxEnabled:void 0!==t.attr("data-sby-supports-lightbox"),autoMinRes:1,general:o};window.sby.feeds[i]=function(e,i,t){return new s(e,i,t)}(this,i,d),void 0!==window.sbyAPIReady&&(window.sby.feeds[i].playerAPIReady=!0),window.sby.feeds[i].setResizedImages(),window.sby.feeds[i].init();var r=jQuery.Event("sbyafterfeedcreate");r.feed=window.sby.feeds[i],jQuery(window).trigger(r)}))},afterFeedsCreated:function(){e(".sb_instagram_header").each(function(){var i=e(this);i.find(".sby_header_link").hover(function(){i.find(".sby_header_img_hover").addClass("sby_fade_in")},function(){i.find(".sby_header_img_hover").removeClass("sby_fade_in")})})},encodeHTML:function(e){return void 0===e?"":e.replace(/(>)/g,"&gt;").replace(/(<)/g,"&lt;").replace(/(&lt;br\/&gt;)/g,"<br>").replace(/(&lt;br&gt;)/g,"<br>")},urlDetect:function(e){return e.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/g)}},s.prototype={init:function(){var i=this;i.settings.consentGiven=i.checkConsent(),i.settings.consentGiven&&window.sby.maybeAddYTAPI(),i.settings.noCDN&&!i.settings.consentGiven&&(e(this.el).find(".sb_youtube_header").length?e(this.el).find(".sb_youtube_header").addClass("sby_no_consent"):e(this.el).prev(".sb_youtube_header").length&&e(this.el).prev(".sb_youtube_header").addClass("sby_no_consent")),e(this.el).find("#sby_mod_error").length&&e(this.el).prepend(e(this.el).find("#sby_mod_error")),this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var t,s=(t=0,function(e,i){clearTimeout(t),t=setTimeout(e,i)});jQuery(window).resize(function(){s(function(){i.afterResize()},500)})},initLayout:function(){this.initGalleryLayout(),this.initGrid()},initGalleryLayout:function(){var i=e(this.el),t=this;i.hasClass("sby_layout_gallery")&&i.find(".sby_player_outer_wrap").length&&(this.maybeRaiseSingleImageResolution(i.find(".sby_player_outer_wrap"),0,!0),i.find(".sby_player_outer_wrap .sby_video_thumbnail").off().click(function(i){if((!t.settings.lightboxEnabled||t.settings.lightboxEnabled&&t.settings.noCDN)&&(t.settings.noCDN||!t.settings.consentGiven))return e(this).closest(".sby_item").length,void(void 0!==e(this).closest(".sby_item").attr("data-video-id")&&e(this).attr("href","https://www.youtube.com/watch?v="+e(this).closest(".sby_item").attr("data-video-id")));i.preventDefault(),t.onThumbnailClick(e(this),!0)}),i.find(".sby_item").first().addClass("sby_current"),i.mouseenter(function(){t.canCreatePlayer()&&(i.find(".sby_player_outer_wrap iframe").length?void 0===t.player&&t.playerEagerLoaded()&&t.createPlayer("sby_player"+t.index):(i.addClass("sby_player_added").find(".sby_player_outer_wrap").addClass("sby_player_loading"),i.find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").show().removeClass("sby_hidden"),t.createPlayer("sby_player"+t.index)))}),window.sbySemiEagerLoading&&t.createPlayer("sby_player"+t.index),t.settings.noCDN&&i.find(".sby_player_outer_wrap").append('<div class="sby_play_btn">\n <span class="sby_play_btn_bg"></span>\n <svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="youtube" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="svg-inline--fa fa-youtube fa-w-18"><path fill="currentColor" d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z" class=""></path></svg> </div>'))},createPlayer:function(i,t,s,a){var n=e(this.el),o=this;if(t=void 0!==t?t:this.getVideoID(n.find(".sby_item").first()),s=void 0!==s?s:0,void 0===a&&(a={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:t,playerVars:{modestbranding:1,rel:0,autoplay:s}}),void 0===a.events&&(a.events={onReady:function(){n.find(".sby_player_outer_wrap").removeClass("sby_player_loading").find(".sby_video_thumbnail").css("z-index",-1).find(".sby_loader").hide().addClass("sby_hidden"),e("#"+i).length&&e("#"+i).closest(".sby_video_thumbnail_wrap").find(".sby_video_thumbnail").length&&e("#"+i).closest(".sby_video_thumbnail_wrap").find(".sby_video_thumbnail").fadeTo(0,"slow",function(){e(this).css("z-index",-1),e(this).find(".sby_loader").hide().addClass("sby_hidden"),e(this).closest(".sby_item").removeClass("sby_player_loading")});var t=jQuery.Event("sbyafterplayerready");t.feed=o,t.player=this,jQuery(window).trigger(t)},onStateChange:function(s){n.find(".sby_player_outer_wrap").removeClass("sby_player_loading").find(".sby_video_thumbnail").css("z-index",-1).find(".sby_loader").hide().addClass("sby_hidden"),o.afterStateChange(i,t,s,e("#"+i).closest(".sby_video_thumbnail_wrap")),1===s.data&&void 0!==o.players&&n.find(".sby_item").each(function(){var i=o.getVideoID(e(this));e(this).find("iframe").length&&i!==t&&void 0!==o.players[i]&&"function"==typeof o.players[i].pauseVideo&&o.players[i].pauseVideo()})}}),window.sbyEagerLoading)var d=YT.get(i);else d=new window.YT.Player(i,a);this.maybeAddCTA(i),n.hasClass("sby_layout_list")&&void 0===this.players[t]?this.players[t]=d:void 0===this.player&&(this.player=d);var r=jQuery.Event("sbyafterplayercreated");return r.feed=this,jQuery(window).trigger(r),d},afterStateChange:function(e,i,t,s){},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraItemsForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),this.afterFeedSet(),this.sizePlayer(),this.sizeItems(),this.settings.consentGiven?this.applyFullFeatures():this.removeFeatures()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass(),this.sizePlayer(),this.sizeItems()},afterLoadMoreClicked:function(e){e.find(".sby_loader").removeClass("sby_hidden"),e.find(".sby_btn_text").addClass("sby_hidden"),e.closest(".sb_youtube").find(".sby_num_diff_hide").addClass("sby_transition").removeClass("sby_num_diff_hide")},afterNewImagesLoaded:function(){var i=e(this.el),t=this;this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),this.sizePlayer(),this.sizeItems(),setTimeout(function(){i.find(".sby_loader").addClass("sby_hidden"),i.find(".sby_btn_text").removeClass("sby_hidden"),t.maybeRaiseImageResolution()},500),this.settings.consentGiven?this.applyFullFeatures():this.removeFeatures()},beforeNewImagesRevealed:function(){this.setImageHeight(),this.maybeRaiseImageResolution(!0),this.setImageSizeClass()},afterFeedSet:function(){},sizePlayer:function(){var i=e(this.el),t=this;if(i.hasClass("sby_layout_gallery")){$playerThumbnail=i.find(".sby_player_item").find(".sby_player_video_thumbnail");var s=$playerThumbnail.innerWidth(),a=Math.floor(9*s/16);t.settings.narrowPlayer&&(a=Math.floor(3*s/4)),$playerThumbnail.css("height",a+"px").css("overflow","hidden")}else i.hasClass("sby_layout_list")&&i.find(".sby_item").each(function(){$playerThumbnail=e(this).find(".sby_item_video_thumbnail");var i=$playerThumbnail.innerWidth(),s=Math.floor(9*i/16);t.settings.narrowPlayer&&(s=Math.floor(3*i/4)),$playerThumbnail.css("height",s+"px").css("overflow","hidden")})},sizeItems:function(){var i=e(this.el);i.hasClass("sby_layout_list")||i.find(".sby_item").find(".sby_item_video_thumbnail").each(function(){if(e(this).hasClass("sby_imgLiquid_ready")){var i=e(this).innerWidth(),t=Math.floor(9*i/16);e(this).css("height",t+"px").css("overflow","hidden")}})},revealNewImages:function(){var i=e(this.el),t=this;this.applyImageLiquid(),"function"==typeof sbyCustomJS&&setTimeout(function(){sbyCustomJS()},100),i.find(".sby-screenreader").find("img").remove(),i.find(".sby_item.sby_new").each(function(i){var s=jQuery(this),a=s.attr("data-video-id");window.sbyEagerLoading&&t.canCreatePlayer()&&e("#sby_player_"+a).length&&(player=new YT.Player("sby_player_"+a,{height:"100",width:"100",videoId:a,playerVars:{modestbranding:1,rel:0,autoplay:0},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&s.find(".sby_item").each(function(){var i=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&jQuery(e.target.a).attr("id")!==jQuery(this).find("iframe").attr("id")&&YT.get("sby_player_"+i).pauseVideo()})}}})),s.find(".sby_video_thumbnail").mouseenter(function(){t.onThumbnailEnter(e(this),!1)}),s.find(".sby_player_wrap").mouseleave(function(){t.onThumbnailLeave(e(this),!1)}),s.find(".sby_video_thumbnail").click(function(i){if((!t.settings.lightboxEnabled||t.settings.lightboxEnabled&&t.settings.noCDN)&&(t.settings.noCDN||!t.settings.consentGiven))return e(this).closest(".sby_item").length,void(void 0!==e(this).closest(".sby_item").attr("data-video-id")&&e(this).attr("href","https://www.youtube.com/watch?v="+e(this).closest(".sby_item").attr("data-video-id")));i.preventDefault(),t.onThumbnailClick(e(this),!1)}),t.settings.lightboxEnabled&&(s.find(".sby_video_thumbnail").attr("data-sby-lightbox",t.index),"undefined"!=typeof sbyOptions&&void 0!==sbyOptions.lightboxPlaceholder&&(t.settings.narrowPlayer?s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholderNarrow):s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholder))),t.afterItemRevealed(s),""===s.find(".sby_info_item").text().trim()&&s.find(".sby_info_item").addClass("sby_no_space")}),i.find(".sby_player_item").each(function(e){var i=jQuery(this);t.afterItemRevealed(i)}),setTimeout(function(){i.find(".sby_item.sby_new").removeClass("sby_new");var e=10;i.find(".sby_transition").length;i.find(".sby_transition").each(function(i){var t=jQuery(this);setTimeout(function(){t.removeClass("sby_transition")},e),e+=10})},500)},afterItemRevealed:function(){},afterNewImagesRevealed:function(){this.listenForVisibilityChange(),this.sendNeedsResizingToServer(),this.sendCheckWPPostsToServer(),this.settings.imageLoadEnabled||e(".sby_no_resraise").removeClass("sby_no_resraise");var i=e.Event("sbyafterimagesloaded");i.el=e(this.el),e(window).trigger(i)},setResizedImages:function(){e(this.el).find(".sby_resized_image_data").length&&void 0!==e(this.el).find(".sby_resized_image_data").attr("data-resized")&&0===e(this.el).find(".sby_resized_image_data").attr("data-resized").indexOf('{"')&&(this.resizedImages=JSON.parse(e(this.el).find(".sby_resized_image_data").attr("data-resized")),e(this.el).find(".sby_resized_image_data").remove())},sendNeedsResizingToServer:function(){var i=this;if(i.needsResizing.length>0&&i.settings.resizingEnabled){var t=e(this.el).find(".sby_item").length;n({action:"sby_resized_images_submit",needs_resizing:i.needsResizing,offset:t,feed_id:i.settings.feedID,atts:i.settings.shortCodeAtts},function(e){if(0===e.trim().indexOf("{")){var t=JSON.parse(e);i.settings.debugEnabled&&console.log(t)}})}},sendCheckWPPostsToServer:function(){var i=this;if(i.settings.checkWPPosts||i.settings.singleCheckPosts){var t=void 0!==i.settings.feedID?i.settings.feedID:"sby_single",s=i.mostRecentlyLoadedPosts;i.mostRecentlyLoadedPosts=[];n({action:"sby_check_wp_submit",feed_id:t,atts:i.settings.shortCodeAtts,offset:e(this.el).hasClass("sby_layout_carousel")?Math.floor(e(this.el).find(".sby_item").length/2-1):e(this.el).find(".sby_item").length,posts:s,cache_all:i.settings.cacheAll},function(e){if(0===e.trim().indexOf("{")){var t=JSON.parse(e);i.settings.debugEnabled&&console.log(t),i.afterSendCheckWPPostsToServer(t)}})}},afterSendCheckWPPostsToServer:function(e){},loadMoreButtonInit:function(){var i=e(this.el),t=this;i.find(".sby_footer .sby_load_btn").off().on("click",function(){t.afterLoadMoreClicked(jQuery(this)),t.getNewPostSet()})},getNewPostSet:function(){var i=e(this.el),t=this;n({action:"sby_load_more_clicked",offset:i.find(".sby_item").length,feed_id:t.settings.feedID,atts:t.settings.shortCodeAtts,current_resolution:t.imageResolution},function(s){if(0===s.trim().indexOf("{")){var a=JSON.parse(s),n=void 0!==a.feedStatus.checkWPPosts&&a.feedStatus.checkWPPosts;t.settings.debugEnabled&&console.log(a),t.settings.checkWPPosts=!!n,t.appendNewPosts(a.html),t.addResizedImages(a.resizedImages),t.settings.ajaxPostLoad?(t.settings.ajaxPostLoad=!1,t.afterInitialImagesLoaded()):t.afterNewImagesLoaded(),a.feedStatus.shouldPaginate?t.outOfPages=!1:(t.outOfPages=!0,i.find(".sby_load_btn").hide()),e(".sby_no_js").removeClass("sby_no_js")}})},appendNewPosts:function(i){var t=e(this.el);t.find(".sby_items_wrap .sby_item").length?t.find(".sby_items_wrap .sby_item").last().after(i):t.find(".sby_items_wrap").append(i)},addResizedImages:function(e){for(var i in e)this.resizedImages[i]=e[i]},setImageHeight:function(){},maybeRaiseSingleImageResolution:function(i,t,s){var a=this,n=a.getImageUrls(i),o=i.find(".sby_video_thumbnail > img").attr("src"),d=150;s=void 0!==s&&s;if(!(i.hasClass("sby_no_resraise")||!a.settings.consentGiven&&a.settings.noCDN)){e.each(n,function(e,i){i===o&&(d=parseInt(e),s=!1)});var r=640;switch(a.settings.imgRes){case"thumb":r=120;break;case"medium":r=320;break;case"large":r=480;break;case"full":r=640;break;default:var l=Math.max(a.settings.autoMinRes,i.find(".sby_video_thumbnail").innerWidth());switch(a.getBestResolutionForAuto(l,1,e(this.el).find("sby_item").first())){case 480:r=480;break;case 320:r=320;break;case 120:r=120}}if(r>d||o===a.placeholderURL||s){if(a.settings.debugEnabled){var h=o===a.placeholderURL?"was placeholder":"too small";console.log("rais res for "+o,h)}var b=n[r];i.find(".sby_video_thumbnail > img").attr("src",b),i.find(".sby_video_thumbnail").hasClass("sby_imgLiquid_ready")&&i.find(".sby_video_thumbnail").css("background-image",'url("'+b+'")')}i.find("img").on("error",function(){if(e(this).hasClass("sby_img_error"))console.log("unfixed error "+e(this).attr("src"));else{if(e(this).addClass("sby_img_error"),e(this).attr("src").indexOf("i.ytimg.com")>-1)a.settings.favorLocal=!0,a.getImageUrls(e(this).closest(".sby_item"))[640];else void 0!==e(this).closest(".sby_video_thumbnail").attr("data-full-res")||e(this).closest(".sby_video_thumbnail").attr("href");setTimeout(function(){a.afterResize()},1500)}})}},maybeRaiseImageResolution:function(i){var t=this,s=void 0!==i&&!0===i?".sby_item.sby_new":".sby_item",a=!t.isInitialized;e(t.el).find(s).each(function(i){!e(this).hasClass("sby_num_diff_hide")&&e(this).find(".sby_video_thumbnail").length&&void 0!==e(this).find(".sby_video_thumbnail").attr("data-img-src-set")&&t.maybeRaiseSingleImageResolution(e(this),i,a)}),t.isInitialized=!0},getBestResolutionForAuto:function(i,t,s){(isNaN(t)||t<1)&&(t=1);var a=i*t,n=10*Math.ceil(a/10),o=[120,320,480,640];if(s.hasClass("sby_highlighted")&&(n*=2),-1===o.indexOf(parseInt(n))){var d=!1;e.each(o,function(e,i){i>parseInt(n)&&!d&&(n=i,d=!0)})}return n},hideExtraItemsForWidth:function(){if("carousel"!==this.layout){var i=e(this.el),t=void 0!==i.attr("data-num")&&""!==i.attr("data-num")?parseInt(i.attr("data-num")):1,s=void 0!==i.attr("data-nummobile")&&""!==i.attr("data-nummobile")?parseInt(i.attr("data-nummobile")):t;i.hasClass(".sby_layout_carousel")||(e(window).width()<480?s<i.find(".sby_item").length&&i.find(".sby_item").slice(s-i.find(".sby_item").length).addClass("sby_num_diff_hide"):t<i.find(".sby_item").length&&i.find(".sby_item").slice(t-i.find(".sby_item").length).addClass("sby_num_diff_hide"))}},setImageSizeClass:function(){var i=e(this.el);i.removeClass("sby_small sby_medium");var t=i.innerWidth(),s=parseInt(i.find(".sby_items_wrap").outerWidth()-i.find(".sby_items_wrap").width())/2,a=this.getColumnCount(),n=(t-s*(a+2))/a;n>140&&n<240?i.addClass("sby_medium"):n<=140&&i.addClass("sby_small")},setMinImageWidth:function(){e(this.el).find(".sby_item .sby_video_thumbnail").first().length?this.minImageWidth=e(this.el).find(".sby_item .sby_video_thumbnail").first().innerWidth():this.minImageWidth=150},setImageResolution:function(){if("auto"===this.settings.imgRes)this.imageResolution="auto";else switch(this.settings.imgRes){case"thumb":this.imageResolution=150;break;case"medium":this.imageResolution=320;break;default:this.imageResolution=640}},getImageUrls:function(e){var i=JSON.parse(e.find(".sby_video_thumbnail").attr("data-img-src-set").replace(/\\\//g,"/")),t=e.attr("id").replace("sby_","").replace("player_","");if(void 0!==this.resizedImages[t]&&"video"!==this.resizedImages[t]&&"pending"!==this.resizedImages[t]&&"error"!==this.resizedImages[t].id&&"video"!==this.resizedImages[t].id&&"pending"!==this.resizedImages[t].id){if(void 0!==this.resizedImages[t].sizes){var s=[];void 0!==this.resizedImages[t].sizes.full&&(s.push(640),i[640]=sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg",e.find(".sby_link_area").attr("href",sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg"),e.find(".sby_video_thumbnail").attr("data-full-res",sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg")),void 0!==this.resizedImages[t].sizes.low&&(s.push(320),i[320]=sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg",this.settings.favorLocal&&void 0===this.resizedImages[t].sizes.full&&(e.find(".sby_link_area").attr("href",sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg"),e.find(".sby_video_thumbnail").attr("data-full-res",sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg"))),void 0!==this.resizedImages[t].sizes.thumb&&(s.push(150),i[150]=sbyOptions.resized_url+this.resizedImages[t].id+"thumb.jpg"),this.settings.favorLocal&&(-1===s.indexOf(640)&&s.indexOf(320)>-1&&(i[640]=sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg"),-1===s.indexOf(320)&&(s.indexOf(640)>-1?i[320]=sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg":s.indexOf(150)>-1&&(i[320]=sbyOptions.resized_url+this.resizedImages[t].id+"thumb.jpg")),-1===s.indexOf(150)&&(s.indexOf(320)>-1?i[150]=sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg":s.indexOf(640)>-1&&(i[150]=sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg")))}}else(void 0===this.resizedImages[t]||void 0!==this.resizedImages[t].id&&"pending"!==this.resizedImages[t].id&&"error"!==this.resizedImages[t].id)&&this.addToNeedsResizing(t);return i},getVideoID:function(i){if(i.hasClass("sby_item")||i.hasClass("sby_player_item")){if(void 0!==i.find(".sby_video_thumbnail").attr("data-video-id"))return i.find(".sby_video_thumbnail").attr("data-video-id")}else if(i.closest("sby_item").length||i.closest("sby_player_item").length){var t=i.closest("sby_item").length?i.closest("sby_item"):i.closest("sby_player_item");if(void 0!==t.find(".sby_video_thumbnail").attr("data-video-id"))return t.find(".sby_video_thumbnail").attr("data-video-id")}else{if(i.hasClass("sb_youtube"))return i.find(".sby_item").first().find(".sby_video_thumbnail").attr("data-video-id");if(e(this.el).find(".sby_video_thumbnail").first().length&&void 0!==e(this.el).find(".sby_video_thumbnail").first().attr("data-video-id"))return e(this.el).find(".sby_video_thumbnail").first().attr("data-video-id")}return""},getAvatarUrl:function(e,i){if(""===e)return"";var t=this.settings.general.avatars;return"local"===(i=void 0!==i?i:"local")?void 0!==t["LCL"+e]&&1===parseInt(t["LCL"+e])?sbyOptions.resized_url+e+".jpg":void 0!==t[e]?t[e]:"":void 0!==t[e]?t[e]:void 0!==t["LCL"+e]&&1===parseInt(t["LCL"+e])?sbyOptions.resized_url+e+".jpg":""},addToNeedsResizing:function(e){-1===this.needsResizing.indexOf(e)&&this.needsResizing.push(e)},applyImageLiquid:function(){var t=e(this.el);i(),"function"==typeof t.find(".sby_player_item").sby_imgLiquid&&(t.find(".sby_player_item").length&&t.find(".sby_player_item .sby_player_video_thumbnail").sby_imgLiquid({fill:!0}),t.find(".sby_item .sby_item_video_thumbnail").sby_imgLiquid({fill:!0}))},listenForVisibilityChange:function(){var i,t,s,a=this;i=jQuery,t={callback:function(){},runOnLoad:!0,frequency:100,sbyPreviousVisibility:null},s={sbyCheckVisibility:function(e,i){if(jQuery.contains(document,e[0])){var t=i.sbyPreviousVisibility,a=e.is(":visible");i.sbyPreviousVisibility=a,null==t?i.runOnLoad&&i.callback(e,a):t!==a&&i.callback(e,a),setTimeout(function(){s.sbyCheckVisibility(e,i)},i.frequency)}}},i.fn.sbyVisibilityChanged=function(e){var a=i.extend({},t,e);return this.each(function(){s.sbyCheckVisibility(i(this),a)})},"function"==typeof e(this.el).filter(":hidden").sbyVisibilityChanged&&e(this.el).filter(":hidden").sbyVisibilityChanged({callback:function(e,i){a.afterResize()},runOnLoad:!1})},getColumnCount:function(){var i=e(this.el),t=this.settings.cols,s=this.settings.colsmobile,a=t;return sbyWindowWidth=window.innerWidth,i.hasClass("sby_mob_col_auto")?(sbyWindowWidth<640&&parseInt(t)>2&&parseInt(t)<7&&(a=2),sbyWindowWidth<640&&parseInt(t)>6&&parseInt(t)<11&&(a=4),sbyWindowWidth<=480&&parseInt(t)>2&&(a=1)):sbyWindowWidth<=480&&(a=s),parseInt(a)},onThumbnailClick:function(i,t,s){if(this.canCreatePlayer()){var a=e(this.el);if(a.hasClass("sby_layout_gallery"))if(a.find(".sby_current").removeClass("sby_current"),i.closest(".sby_item").addClass("sby_current"),i.closest(".sby_item").addClass("sby_current"),a.addClass("sby_player_added").find(".sby_player_outer_wrap").addClass("sby_player_loading"),a.find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").show().removeClass("sby_hidden"),a.find(".sby_player_outer_wrap iframe").length)if(t){s=void 0===s?this.getVideoID(a.find(".sby_item").first()):s;this.playVideoInPlayer(s)}else{s=void 0===s?this.getVideoID(i.closest(".sby_item")):s;this.changePlayerInfo(i.closest(".sby_item")),this.playVideoInPlayer(s),this.afterVideoChanged()}else if(t)this.createPlayer("sby_player"+this.index);else{var s=void 0===s?this.getVideoID(i.closest(".sby_item")):s;this.createPlayer("sby_player"+this.index,s)}else if(e(this.el).hasClass("sby_layout_grid")||e(this.el).hasClass("sby_layout_carousel")){var n=i.closest(".sby_item");s=void 0===s?this.getVideoID(n):s;this.playVideoInPlayer(s),this.afterVideoChanged()}else if(e(this.el).hasClass("sby_layout_list")){n=i.closest(".sby_item"),s=void 0===s?this.getVideoID(n):s;n.length&&!n.find("iframe").length?(n.find(".sby_loader").show().removeClass("sby_hidden"),n.addClass("sby_player_loading sby_player_loaded"),this.createPlayer("sby_player_"+s,s)):(this.playVideoInPlayer(s,n.attr("data-video-id")),this.afterVideoChanged())}}},onThumbnailEnter:function(i){if(this.canCreatePlayer()&&e(this.el).hasClass("sby_layout_list")){var t=i.closest(".sby_item"),s=this.getVideoID(t);t.find("iframe").length||(t.find(".sby_loader").show().removeClass("sby_hidden"),t.addClass("sby_player_loading sby_player_loaded"),this.createPlayer("sby_player_"+s,s,0))}},onThumbnailLeave:function(e){},changePlayerInfo:function(e){},playerEagerLoaded:function(){if(void 0!==this.player||e(this.el).hasClass("sby_player_loaded"))return!0},initGrid:function(){if(window.sbySemiEagerLoading&&jQuery("#sby_lightbox").length){var i=this;playerID="sby_lb-player",jQuery("#sby_lightbox").addClass("sby_video_lightbox");var t=e(this.el).find("sby_item").first().attr("data-video-id"),s=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var a={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:t,playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(t){var s=t.target.getVideoData().video_id;i.afterStateChange(playerID,s,t,e("#"+playerID).closest(".sby_video_thumbnail_wrap"))}}};i.maybeAddCTA(playerID),window.sbyLightboxPlayer=new window.YT.Player(playerID,a)}}},maybeAddCTA:function(e,i){},canCreatePlayer:function(){return!e(this.el).find("#sby_blank").length&&(this.playerEagerLoaded()||this.playerAPIReady&&this.settings.consentGiven||window.sbyAPIReady&&this.settings.consentGiven)},playVideoInPlayer:function(e,i){void 0!==this.player&&void 0!==this.player.loadVideoById?this.player.loadVideoById(e):void 0!==window.sbyLightboxPlayer&&void 0!==window.sbyLightboxPlayer.loadVideoById?window.sbyLightboxPlayer.loadVideoById(e):void 0!==i&&void 0!==this.players&&void 0!==this.players[i]&&void 0!==this.players[i].loadVideoById&&this.players[i].loadVideoById(e)},afterVideoChanged:function(){e(this.el).hasClass("sby_layout_gallery")&&(e(this.el).find(".sby_player_outer_wrap").removeClass("sby_player_loading"),e(this.el).find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").hide().addClass("sby_hidden"),e(window).width()<480&&e("html, body").animate({scrollTop:e(this.el).find(".sby_player_outer_wrap").offset().top},300))},checkConsent:function(){if(this.settings.consentGiven||!this.settings.gdpr)return this.settings.noCDN=!1,!0;if("undefined"!=typeof CLI_Cookie)null!==CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)&&(this.settings.consentGiven="yes"===CLI_Cookie.read("cookielawinfo-checkbox-non-necessary"));else if(void 0!==window.cnArgs){var e=("; "+document.cookie).split("; cookie_notice_accepted=");if(2===e.length){var i=e.pop().split(";").shift();this.settings.consentGiven="true"===i}}else void 0!==window.cookieconsent?this.settings.consentGiven="allow"===function(e){for(var i=e+"=",t=window.document.cookie.split(";"),s=0;s<t.length;s++){var a=t[s].trim();if(0==a.indexOf(i))return a.substring(i.length,a.length)}return""}("complianz_consent_status"):void 0!==window.Cookiebot?this.settings.consentGiven=Cookiebot.consented:void 0!==window.BorlabsCookie&&(this.settings.consentGiven=window.BorlabsCookie.checkCookieConsent("youtube"));var t=jQuery.Event("sbycheckconsent");return t.feed=this,jQuery(window).trigger(t),this.settings.consentGiven&&(this.settings.noCDN=!1),this.settings.consentGiven},afterConsentToggled:function(){if(this.checkConsent()){var e=this;window.sby.maybeAddYTAPI(),e.maybeRaiseImageResolution(),e.applyFullFeatures(),setTimeout(function(){e.afterResize()},500)}},removeFeatures:function(){this.settings.noCDN&&e(this.el).find(".sby_video_thumbnail").each(function(){e(this).removeAttr("data-sby-lightbox")})},applyFullFeatures:function(){var i=this;e(i.el).find(".sby_header_img img").attr("src",e(i.el).find(".sby_header_img").attr("data-avatar-url")),void 0===e(i.el).find(".sby_video_thumbnail").first().attr("data-sby-lightbox")&&i.settings.lightboxEnabled&&e(i.el).find(".sby_video_thumbnail").each(function(){e(this).attr("data-sby-lightbox",i.index)});var t=e(i.el);if(t.find(".sby_no_consent").removeClass("sby_no_consent"),t.hasClass("sby_layout_gallery")&&t.find(".sby_player_outer_wrap").length){if(this.maybeRaiseSingleImageResolution(t.find(".sby_player_outer_wrap"),0,!0),t.find(".sby_player_outer_wrap .sby_play_btn").remove(),t.find(".sby_item").first().addClass("sby_current"),!i.canCreatePlayer())return;t.find(".sby_player_outer_wrap iframe").length||i.createPlayer("sby_player"+i.index)}}},a.prototype={getData:function(e){return{feedIndex:parseInt(e.closest(".sb_youtube").attr("data-sby-index")-1),link:e.attr("href"),videoTitle:void 0!==e.attr("data-video-title")?e.attr("data-video-title"):"YouTube Video",video:e.attr("data-video-id")}},template:function(){return"<div id='sby_lightboxOverlay' class='sby_lightboxOverlay'></div><div id='sby_lightbox' class='sby_lightbox'><div class='sby_lb-outerContainer'><div class='sby_lb-container'><img class='sby_lb-image' alt='Lightbox image placeholder' src='' /><div class='sby_lb-player sby_lb-player-placeholder' id='sby_lb-player'></div><div class='sby_lb-nav'><a class='sby_lb-prev' href='#' ><p class='sby-screenreader'>Previous Slide</p><span></span></a><a class='sby_lb-next' href='#' ><p class='sby-screenreader'>Next Slide</p><span></span></a></div><div class='sby_lb-loader'><a class='sby_lb-cancel'></a></div></div></div><div class='sby_lb-dataContainer'><div class='sby_lb-data'><div class='sby_lb-details'><div class='sby_lb-caption'></div><div class='sby_lb-info'><div class='sby_lb-number'></div></div></div><div class='sby_lb-closeContainer'><a class='sby_lb-close'></a></div></div></div></div>"},beforePlayerSetup:function(e,i,t,s,a){},afterPlayerSetup:function(e,i,t,s){},afterResize:function(){var i=e("#sby_lightbox .sby_lb-player").height();if(i>100){var t=e("#sby_lightbox .sby_lb-outerContainer").height()-i;t>10&&e("#sby_lightbox .sby_lb-player").css("top",t/2)}},pausePlayer:function(){void 0!==YT.get("sby_lb-player")&&"function"==typeof YT.get("sby_lb-player").pauseVideo?YT.get("sby_lb-player").pauseVideo():void 0!==window.sbyLightboxPlayer&&"function"==typeof window.sbyLightboxPlayer.pauseVideo&&window.sbyLightboxPlayer.pauseVideo()}},window.sby_init=function(){window.sby=new t,window.sby.createPage(window.sby.createFeeds,{whenFeedsCreated:window.sby.afterFeedsCreated})}}(jQuery),void 0===window.sbyEagerLoading&&(window.sbyEagerLoading=void 0!==window.sbyOptions&&window.sbyOptions.eagerload,jQuery("div[data-vc-video-bg]").length&&(window.sbyEagerLoading=!0)),void 0===window.sbySemiEagerLoading&&(window.sbySemiEagerLoading=void 0!==window.sbyOptions&&window.sbyOptions.semiEagerload,(jQuery("div[data-vc-video-bg]").length||window.sbyEagerLoading)&&(window.sbySemiEagerLoading=!1)),jQuery(document).ready(function(e){window.sbySemiEagerLoading||sby_init(),e("#cookie-notice a").click(function(){setTimeout(function(){e.each(window.sby.feeds,function(e){window.sby.feeds[e].afterConsentToggled()})},1e3)}),e("#cookie-law-info-bar a").click(function(){setTimeout(function(){e.each(window.sby.feeds,function(e){window.sby.feeds[e].afterConsentToggled()})},1e3)}),e(".cli-user-preference-checkbox").click(function(){setTimeout(function(){e.each(window.sby.feeds,function(e){window.sby.feeds[e].settings.consentGiven=!1,window.sby.feeds[e].afterConsentToggled()})},1e3)}),e(window).on("CookiebotOnAccept",function(i){e.each(window.sby.feeds,function(e){window.sby.feeds[e].settings.consentGiven=!0,window.sby.feeds[e].afterConsentToggled()})}),e(document).on("cmplzAcceptAll",function(i){e.each(window.sby.feeds,function(e){window.sby.feeds[e].settings.consentGiven=!0,window.sby.feeds[e].afterConsentToggled()})}),e(document).on("cmplzRevoke",function(i){e.each(window.sby.feeds,function(e){window.sby.feeds[e].settings.consentGiven=!1,window.sby.feeds[e].afterConsentToggled()})}),e(document).on("borlabs-cookie-consent-saved",function(i){e.each(window.sby.feeds,function(e){window.sby.feeds[e].settings.consentGiven=!1,window.sby.feeds[e].afterConsentToggled()})})})}if(window.sbySemiEagerLoading){var sbyYScriptId="sby-youtube-api",sbyYScript=document.getElementById(sbyYScriptId);if(null===sbyYScript){var tag=document.createElement("script"),firstScript=document.getElementsByTagName("script")[0];tag.src="https://www.youtube.com/iframe_api",tag.id=sbyYScriptId,firstScript.parentNode.insertBefore(tag,firstScript)}}window.onYouTubeIframeAPIReady=function(){var e=document.getElementsByClassName("sb_youtube").length;if(e>0){if(window.sbySemiEagerLoading){if(void 0!==window.sby)for(var i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0;else window.sbyAPIReady=!0;sby_init()}else if(jQuery(".sb_youtube").each(function(e){var i=jQuery(this);i.find(".sby_live_player").length&&(player=new YT.Player(i.find(".sby_live_player").attr("id"),{events:{onReady:function(){i.find(".sby_live_player").hide(),i.find(".sby_item").remove();var t=YT.get(i.find(".sby_live_player").attr("id")).getVideoData().video_id;i.find(".sby_player_video_thumbnail").attr("data-video-id",t).css("z-index",-1);i.find(".sby_item").length;var s={action:"sby_live_retrieve",video_id:t,feed_id:i.attr("data-feedid"),atts:i.attr("data-shortcode-atts")};jQuery.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:s,success:function(t){if(0===t.trim().indexOf("{")){var s=window.sby.feeds[e],a=JSON.parse(t),n=void 0!==a.feedStatus.checkWPPosts&&a.feedStatus.checkWPPosts;s.settings.debugEnabled&&console.log(a),s.settings.checkWPPosts=!!n,s.appendNewPosts(a.html),s.addResizedImages(a.resizedImages),s.afterInitialImagesLoaded(),a.feedStatus.shouldPaginate?s.outOfPages=!1:(s.outOfPages=!0,i.find(".sby_load_btn").hide()),jQuery(".sby_no_js").removeClass("sby_no_js"),i.find(".sby_live_player").remove(),i.hasClass("sby_layout_gallery")&&s.createPlayer("sby_player"+s.index),i.find(".sby_player_item").css("opacity",1),i.find(".sby_item").css("opacity",1),i.find(".sby_player_loading").removeClass("sby_player_loading"),i.hasClass("sby_layout_list")&&i.find(".sby_item_video_thumbnail").mouseenter(function(){jQuery(this).css("z-index",-1)})}}})}}}))}),window.sbyEagerLoading){var t=!1,s=!1;jQuery(".sb_youtube").each(function(e){var i=jQuery(this);i.hasClass("sby_layout_list")?(jQuery(this).addClass("sby_player_loaded"),i.find(".sby_item").each(function(){videoID=jQuery(this).attr("data-video-id"),player=new YT.Player("sby_player_"+videoID,{height:"100",width:"100",videoId:videoID,playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&i.find(".sby_item").each(function(){var e=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&e!==jQuery(this).find("iframe").attr("id").replace("sby_player_","")&&YT.get("sby_player_"+e).pauseVideo()})}}})})):i.hasClass("sby_layout_gallery")?(jQuery(this).addClass("sby_player_loaded"),player=new YT.Player("sby_player"+e,{height:"100",width:"100",videoId:jQuery(this).find(".sby_item").first().attr("data-video-id"),playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&i.find(".sby_item").each(function(){var i=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&jQuery(e.target.a).attr("id")!==jQuery(this).find("iframe").attr("id")&&YT.get("sby_player_"+i).pauseVideo()})}}})):t=!0})}else if(void 0!==window.sby)for(i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0;else window.sbyAPIReady=!0;t&&(jQuery("#sby_lb-player").length||jQuery(".sb_youtube").first().append('<div class="sby_lb-player-loaded sby_lb-player" id="sby_lb-player" style="display: none;"></div>'),player=new YT.Player("sby_lb-player",{height:"100",width:"100",videoId:jQuery(this).find(".sby_item").first().attr("data-video-id"),playerVars:{modestbranding:1,rel:0,autoplay:s}}),window.sbyLightboxPlayer=player)}};
1
+ var sby_js_exists=void 0!==sby_js_exists;if(!sby_js_exists){function sby_supports_video(){return!!document.createElement("video").canPlayType}!function(e){function i(){var e,i,t,s=s||{VER:"0.9.944"};s.bgs_Available=!1,s.bgs_CheckRunned=!1,function(e){e.fn.extend({sby_imgLiquid:function(i){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},function(){if(!s.bgs_CheckRunned){s.bgs_CheckRunned=!0;var i=e('<span style="background-size:cover" />');e("body").append(i),function(){var e=i[0];if(e&&window.getComputedStyle){var t=window.getComputedStyle(e,null);t&&t.backgroundSize&&(s.bgs_Available="cover"===t.backgroundSize)}}(),i.remove()}}();var t=this;return this.options=i,this.settings=e.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(i){function a(){(r.responsive||h.data("sby_imgLiquid_oldProcessed"))&&h.data("sby_imgLiquid_settings")&&(r=h.data("sby_imgLiquid_settings"),l.actualSize=l.get(0).offsetWidth+l.get(0).offsetHeight/1e4,l.sizeOld&&l.actualSize!==l.sizeOld&&o(),l.sizeOld=l.actualSize,setTimeout(a,r.responsiveCheckTime))}function n(){h.data("sby_imgLiquid_error",!0),l.addClass("sby_imgLiquid_error"),r.onItemError&&r.onItemError(i,l,h),d()}function o(){var e,t,s,a,n,o,b,y,u=0,c=0,g=l.width(),f=l.height();void 0===h.data("owidth")&&h.data("owidth",h[0].width),void 0===h.data("oheight")&&h.data("oheight",h[0].height),r.fill===g/f>=h.data("owidth")/h.data("oheight")?(e="100%",t="auto",s=Math.floor(g),a=Math.floor(g*(h.data("oheight")/h.data("owidth")))):(e="auto",t="100%",s=Math.floor(f*(h.data("owidth")/h.data("oheight"))),a=Math.floor(f)),b=g-s,"left"===(n=r.horizontalAlign.toLowerCase())&&(c=0),"center"===n&&(c=.5*b),"right"===n&&(c=b),-1!==n.indexOf("%")&&((n=parseInt(n.replace("%",""),10))>0&&(c=b*n*.01)),y=f-a,"left"===(o=r.verticalAlign.toLowerCase())&&(u=0),"center"===o&&(u=.5*y),"bottom"===o&&(u=y),-1!==o.indexOf("%")&&((o=parseInt(o.replace("%",""),10))>0&&(u=y*o*.01)),r.hardPixels&&(e=s,t=a),h.css({width:e,height:t,"margin-left":Math.floor(c),"margin-top":Math.floor(u)}),h.data("sby_imgLiquid_oldProcessed")||(h.fadeTo(r.fadeInTime,1),h.data("sby_imgLiquid_oldProcessed",!0),r.removeBoxBackground&&l.css("background-image","none"),l.addClass("sby_imgLiquid_nobgSize"),l.addClass("sby_imgLiquid_ready")),r.onItemFinish&&r.onItemFinish(i,l,h),d()}function d(){i===t.length-1&&t.settings.onFinish&&t.settings.onFinish()}var r=t.settings,l=e(this),h=e("img:first",l);return h.length?(h.data("sby_imgLiquid_settings")?(l.removeClass("sby_imgLiquid_error").removeClass("sby_imgLiquid_ready"),r=e.extend({},h.data("sby_imgLiquid_settings"),t.options)):r=e.extend({},t.settings,function(){var e={};if(t.settings.useDataHtmlAttr){var i=l.attr("data-sby_imgLiquid-fill"),a=l.attr("data-sby_imgLiquid-horizontalAlign"),n=l.attr("data-sby_imgLiquid-verticalAlign");("true"===i||"false"===i)&&(e.fill=Boolean("true"===i)),void 0===a||"left"!==a&&"center"!==a&&"right"!==a&&-1===a.indexOf("%")||(e.horizontalAlign=a),void 0===n||"top"!==n&&"bottom"!==n&&"center"!==n&&-1===n.indexOf("%")||(e.verticalAlign=n)}return s.isIE&&t.settings.ieFadeInDisabled&&(e.fadeInTime=0),e}()),h.data("sby_imgLiquid_settings",r),r.onItemStart&&r.onItemStart(i,l,h),void(s.bgs_Available&&r.useBackgroundSize?(-1===l.css("background-image").indexOf(encodeURI(h.attr("src")))&&l.css({"background-image":'url("'+encodeURI(h.attr("src"))+'")'}),l.css({"background-size":r.fill?"cover":"contain","background-position":(r.horizontalAlign+" "+r.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),e("a:first",l).css({display:"block",width:"100%",height:"100%"}),e("img",l).css({display:"none"}),r.onItemFinish&&r.onItemFinish(i,l,h),l.addClass("sby_imgLiquid_bgSize"),l.addClass("sby_imgLiquid_ready"),d()):function t(){if(h.data("oldSrc")&&h.data("oldSrc")!==h.attr("src")){var s=h.clone().removeAttr("style");return s.data("sby_imgLiquid_settings",h.data("sby_imgLiquid_settings")),h.parent().prepend(s),h.remove(),(h=s)[0].width=0,void setTimeout(t,10)}return h.data("sby_imgLiquid_oldProcessed")?void o():(h.data("sby_imgLiquid_oldProcessed",!1),h.data("oldSrc",h.attr("src")),e("img:not(:first)",l).css("display","none"),l.css({overflow:"hidden"}),h.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),h.on("error",n),h[0].onerror=n,function e(){h.data("sby_imgLiquid_error")||h.data("sby_imgLiquid_loaded")||h.data("sby_imgLiquid_oldProcessed")||(l.is(":visible")&&h[0].complete&&h[0].width>0&&h[0].height>0?(h.data("sby_imgLiquid_loaded",!0),setTimeout(o,i*r.delay)):setTimeout(e,r.timecheckvisibility))}(),void a())}())):void n()})}})}(jQuery),e=s.injectCss,i=document.getElementsByTagName("head")[0],(t=document.createElement("style")).type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),i.appendChild(t)}function t(){this.feeds={},this.options=sbyOptions,this.isTouch=function(){if("ontouchstart"in document.documentElement)return!0;return!1}()}function s(e,i,t){this.el=e,this.index=i,this.settings=t,this.placeholderURL=window.sby.options.placeholder,t.narrowPlayer&&(this.placeholderURL=window.sby.options.placeholderNarrow),this.playerAPIReady=!1,this.consentGiven=t.consentGiven,this.players={},this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.isInitialized=!1,this.mostRecentlyLoadedPosts=[]}function a(){}function n(i,t){e.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:i,success:t})}t.prototype={createPage:function(i,t){void 0!==window.sbyajaxurl&&-1!==window.sbyajaxurl.indexOf(window.location.hostname)||(window.sbyajaxurl=window.location.hostname+"/wp-admin/admin-ajax.php"),e(".sby_no_js_error_message").remove(),e(".sby_no_js").removeClass("sby_no_js"),i(t)},maybeAddYTAPI:function(){if(null===document.getElementById("sby-youtube-api")){var e=document.createElement("script"),i=document.getElementsByTagName("script")[0];e.src="https://www.youtube.com/iframe_api",e.id="sby-youtube-api",i.parentNode.insertBefore(e,i)}},createLightbox:function(){var i,t=new a,s=(i=0,function(e,t){clearTimeout(i),i=setTimeout(e,t)});jQuery(window).on("resize",function(){s(function(){t.afterResize()},200)}),function(){var i=jQuery,s=function(){function e(){this.fadeDuration=500,this.fitImagesInViewport=!0,this.resizeDuration=700,this.positionFromTop=50,this.showImageNumberLabel=!0,this.alwaysShowNavOnTouchDevices=!1,this.wrapAround=!1}return e.prototype.albumLabel=function(e,i){return e+" / "+i},e}(),a=function(){function s(e){this.options=e,this.album=[],this.currentImageIndex=void 0,this.init()}return s.prototype.init=function(){this.enable(),this.build()},s.prototype.enable=function(){var e=this;i("body").on("click","a[data-sby-lightbox]",function(t){return e.start(i(t.currentTarget)),!1})},s.prototype.build=function(){var e=this;i(""+t.template()).appendTo(i("body")),this.$lightbox=i("#sby_lightbox"),this.$overlay=i("#sby_lightboxOverlay"),this.$outerContainer=this.$lightbox.find(".sby_lb-outerContainer"),this.$container=this.$lightbox.find(".sby_lb-container"),this.containerTopPadding=parseInt(this.$container.css("padding-top"),10),this.containerRightPadding=parseInt(this.$container.css("padding-right"),10),this.containerBottomPadding=parseInt(this.$container.css("padding-bottom"),10),this.containerLeftPadding=parseInt(this.$container.css("padding-left"),10),this.$overlay.hide().on("click",function(){return e.end(),!1}),jQuery(document).on("click",function(e,i,t){jQuery(e.target).closest(".sby_lb-outerContainer").length||jQuery(e.target).closest(".sby_lb-dataContainer").length||(void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),jQuery("#sby_lightboxOverlay, #sby_lightbox").fadeOut())}),this.$lightbox.hide(),jQuery("#sby_lightboxOverlay").on("click",function(t){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),"sby_lightbox"===i(t.target).attr("id")&&e.end(),!1}),this.$lightbox.find(".sby_lb-prev").on("click",function(){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),e.changeImage(0===e.currentImageIndex?e.album.length-1:e.currentImageIndex-1),!1}),this.$lightbox.find(".sby_lb-container").on("swiperight",function(){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),e.changeImage(0===e.currentImageIndex?e.album.length-1:e.currentImageIndex-1),!1}),this.$lightbox.find(".sby_lb-next").on("click",function(){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),e.changeImage(e.currentImageIndex===e.album.length-1?0:e.currentImageIndex+1),!1}),this.$lightbox.find(".sby_lb-container").on("swipeleft",function(){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),e.changeImage(e.currentImageIndex===e.album.length-1?0:e.currentImageIndex+1),!1}),this.$lightbox.find(".sby_lb-loader, .sby_lb-close").on("click",function(){return void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo(),e.end(),!1})},s.prototype.start=function(e){function s(e){a.album.push(t.getData(e))}var a=this,n=i(window);n.on("resize",i.proxy(this.sizeOverlay,this)),i("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var o,d=0,r=e.attr("data-sby-lightbox");if(r){o=i(e.prop("tagName")+'[data-sby-lightbox="'+r+'"]');for(var l=0;l<o.length;l=++l)s(i(o[l])),o[l]===e[0]&&(d=l)}else if("lightbox"===e.attr("rel"))s(e);else{o=i(e.prop("tagName")+'[rel="'+e.attr("rel")+'"]');for(var h=0;h<o.length;h=++h)s(i(o[h])),o[h]===e[0]&&(d=h)}var b=n.scrollTop()+this.options.positionFromTop,y=n.scrollLeft();this.$lightbox.css({top:b+"px",left:y+"px"}).fadeIn(this.options.fadeDuration),this.changeImage(d)},s.prototype.changeImage=function(e){var t=this;this.disableKeyboardNav();var s=this.$lightbox.find(".sby_lb-image");this.$overlay.fadeIn(this.options.fadeDuration),i(".sby_lb-loader").fadeIn("slow"),this.$lightbox.find(".sby_lb-image, .sby_lb-nav, .sby_lb-prev, .sby_lb-next, .sby_lb-dataContainer, .sby_lb-numbers, .sby_lb-caption").hide(),this.$outerContainer.addClass("animating");var a=new Image;a.onload=function(){var n,o,d,r,l,h;s.attr("src",t.album[e].link),i(a),s.width(a.width),s.height(a.height),t.options.fitImagesInViewport&&(h=i(window).width(),l=i(window).height(),r=h-t.containerLeftPadding-t.containerRightPadding-20-100,d=l-t.containerTopPadding-t.containerBottomPadding-150,(a.width>r||a.height>d)&&(a.width/r>a.height/d?(o=r,n=parseInt(a.height/(a.width/o),10),s.width(o),s.height(n)):(n=d,o=parseInt(a.width/(a.height/n),10),s.width(o),s.height(n)))),t.sizeContainer(s.width(),s.height())},a.src=this.album[e].link,this.currentImageIndex=e},s.prototype.sizeOverlay=function(){this.$overlay.width(i(window).width()).height(i(document).height())},s.prototype.sizeContainer=function(e,i){function t(){s.$lightbox.find(".sby_lb-dataContainer").width(o),s.$lightbox.find(".sby_lb-prevLink").height(d),s.$lightbox.find(".sby_lb-nextLink").height(d),s.showImage()}var s=this,a=this.$outerContainer.outerWidth(),n=this.$outerContainer.outerHeight(),o=e+this.containerLeftPadding+this.containerRightPadding,d=i+this.containerTopPadding+this.containerBottomPadding;a!==o||n!==d?this.$outerContainer.animate({width:o,height:d},this.options.resizeDuration,"swing",function(){t()}):t()},s.prototype.showImage=function(){this.$lightbox.find(".sby_lb-loader").hide(),this.$lightbox.find(".sby_lb-image").fadeIn("slow"),this.updateNav(),this.updateDetails(),this.preloadNeighboringImages(),this.enableKeyboardNav()},s.prototype.updateNav=function(){var e=!1;try{document.createEvent("TouchEvent"),e=!!this.options.alwaysShowNavOnTouchDevices}catch(e){}this.$lightbox.find(".sby_lb-nav").show(),this.album.length>1&&(this.options.wrapAround?(e&&this.$lightbox.find(".sby_lb-prev, .sby_lb-next").css("opacity","1"),this.$lightbox.find(".sby_lb-prev, .sby_lb-next").show()):(this.currentImageIndex>0&&(this.$lightbox.find(".sby_lb-prev").show(),e&&this.$lightbox.find(".sby_lb-prev").css("opacity","1")),this.currentImageIndex<this.album.length-1&&(this.$lightbox.find(".sby_lb-next").show(),e&&this.$lightbox.find(".sby_lb-next").css("opacity","1"))))},s.prototype.updateDetails=function(){var i=this;jQuery("iframe.sby_lb-player-loaded").length&&(jQuery(".sby_lb-player-placeholder").replaceWith(jQuery("iframe.sby_lb-player-loaded")),jQuery("iframe.sby_lb-player-loaded").removeClass("sby_lb-player-loaded").show());var s=window.sby.feeds[this.album[this.currentImageIndex].feedIndex];if(t.beforePlayerSetup(this.$lightbox,this.album[this.currentImageIndex],this.currentImageIndex,this.album,s),sby_supports_video()){if(jQuery("#sby_lightbox").removeClass("sby_video_lightbox"),s.settings.consentGiven&&this.album[this.currentImageIndex].video.length){jQuery(".sby_gdpr_notice").remove();var a="sby_lb-player";jQuery("#sby_lightbox").addClass("sby_video_lightbox");var n=this.album[this.currentImageIndex].video,o=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var d={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:n,playerVars:{modestbranding:1,rel:0,autoplay:o},events:{onStateChange:function(i){var t=i.target.getVideoData().video_id;s.afterStateChange(a,t,i,e("#"+a).closest(".sby_video_thumbnail_wrap"))}}};s.maybeAddCTA(a),window.sbyLightboxPlayer=new window.YT.Player(a,d)}else window.sbyLightboxPlayer.loadVideoById(n);this.$outerContainer.removeClass("animating"),this.$lightbox.find(".sby_lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return i.sizeOverlay()}),setTimeout(function(){e("#sby_lightbox .sby_lb-player").css({height:e("#sby_lightbox .sby_lb-outerContainer").height()+"px",width:e("#sby_lightbox .sby_lb-outerContainer").width()+"px",top:0})},400),this.$lightbox.find("iframe").length&&this.$lightbox.find("iframe").attr("title",this.album[this.currentImageIndex].videoTitle)}else{var r=e(".sby_item[data-video-id="+this.album[this.currentImageIndex].video+"]").find(".sby_video_thumbnail").attr("data-full-res");e(".sby_lb-image").attr("src",r),this.$outerContainer.removeClass("animating"),this.$lightbox.find(".sby_lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return i.sizeOverlay()}),jQuery(".sby_lb-container").prepend('<a href="https://www.youtube.com/watch?v='+this.album[this.currentImageIndex].video+'" target="_blank" rel="noopener noreferrer" class="sby_gdpr_notice"><svg style="color: rgba(255,255,255,1)" class="svg-inline--fa fa-play fa-w-14 sby_playbtn" aria-label="Play" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="play" role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"></path></svg></a>')}t.afterPlayerSetup(this.$lightbox,this.album[this.currentImageIndex],this.currentImageIndex,this.album),this.album.length>1&&this.options.showImageNumberLabel?this.$lightbox.find(".sby_lb-number").text(this.options.albumLabel(this.currentImageIndex+1,this.album.length)).fadeIn("fast"):this.$lightbox.find(".sby_lb-number").hide()}},s.prototype.preloadNeighboringImages=function(){this.album.length>this.currentImageIndex+1&&((new Image).src=this.album[this.currentImageIndex+1].link);this.currentImageIndex>0&&((new Image).src=this.album[this.currentImageIndex-1].link)},s.prototype.enableKeyboardNav=function(){i(document).on("keyup.keyboard",i.proxy(this.keyboardAction,this))},s.prototype.disableKeyboardNav=function(){i(document).off(".keyboard")},s.prototype.keyboardAction=function(i){var t=event.keyCode,s=String.fromCharCode(t).toLowerCase();27===t||s.match(/x|o|c/)?(sby_supports_video()&&e("#sby_lightbox video.sby_video")[0].pause(),e("#sby_lightbox iframe").attr("src",""),this.end()):"p"===s||37===t?(0!==this.currentImageIndex?this.changeImage(this.currentImageIndex-1):this.options.wrapAround&&this.album.length>1&&this.changeImage(this.album.length-1),sby_supports_video()&&e("#sby_lightbox video.sby_video")[0].pause(),e("#sby_lightbox iframe").attr("src","")):"n"!==s&&39!==t||(this.currentImageIndex!==this.album.length-1?this.changeImage(this.currentImageIndex+1):this.options.wrapAround&&this.album.length>1&&this.changeImage(0),void 0!==window.sbyLightboxPlayer&&YT.get("sby_lb-player").pauseVideo())},s.prototype.end=function(){this.disableKeyboardNav(),i(window).off("resize",this.sizeOverlay),this.$lightbox.fadeOut(this.options.fadeDuration),this.$overlay.fadeOut(this.options.fadeDuration),i("select, object, embed").css({visibility:"visible"})},s}();i(function(){var i=new s;new a(i),e(".sby_lightbox_action a").off().on("click",function(){e(this).parent().find(".sby_lightbox_tooltip").toggle()})})}.call(this)},createFeeds:function(i){window.sby.createLightbox(),i.whenFeedsCreated(e(".sb_youtube").each(function(i){e(this).attr("data-sby-index",i+1),e(this).find(".sby_player").replaceWith('<div id="sby_player'+i+'"></div>');var t=e(this),a=void 0!==t.attr("data-sby-flags")?t.attr("data-sby-flags").split(","):[],o=void 0!==t.attr("data-options")?JSON.parse(t.attr("data-options")):{};if(a.indexOf("testAjax")>-1){window.sby.triggeredTest=!0;n({action:"sby_on_ajax_test_trigger"},function(e){console.log("did test")})}var d={cols:t.attr("data-cols"),colsmobile:"same"!==t.attr("data-colsmobile")?t.attr("data-colsmobile"):t.attr("data-cols"),num:t.attr("data-num"),imgRes:t.attr("data-res"),feedID:t.attr("data-feedid"),postID:"undefind"!=typeof t.attr("data-postid")?t.attr("data-postid"):"unknown",shortCodeAtts:t.attr("data-shortcode-atts"),resizingEnabled:-1===a.indexOf("resizeDisable"),imageLoadEnabled:-1===a.indexOf("imageLoadDisable"),debugEnabled:a.indexOf("debug")>-1,favorLocal:a.indexOf("favorLocal")>-1,ajaxPostLoad:a.indexOf("ajaxPostLoad")>-1,checkWPPosts:a.indexOf("checkWPPosts")>-1,cacheAll:a.indexOf("cacheAll")>-1,gdpr:a.indexOf("gdpr")>-1,consentGiven:-1===a.indexOf("gdpr"),noCDN:a.indexOf("disablecdn")>-1,lightboxEnabled:void 0!==t.attr("data-sby-supports-lightbox"),locator:a.indexOf("locator")>-1,autoMinRes:1,general:o};window.sby.feeds[i]=function(e,i,t){return new s(e,i,t)}(this,i,d),void 0!==window.sbyAPIReady&&(window.sby.feeds[i].playerAPIReady=!0),window.sby.feeds[i].setResizedImages(),window.sby.feeds[i].init();var r=jQuery.Event("sbyafterfeedcreate");r.feed=window.sby.feeds[i],jQuery(window).trigger(r)}))},afterFeedsCreated:function(){e(".sb_instagram_header").each(function(){var i=e(this);i.find(".sby_header_link").on("mouseenter mouseleave",function(e){switch(e.type){case"mouseenter":i.find(".sby_header_img_hover").addClass("sby_fade_in");break;case"mouseleave":i.find(".sby_header_img_hover").removeClass("sby_fade_in")}})})},encodeHTML:function(e){return void 0===e?"":e.replace(/(>)/g,"&gt;").replace(/(<)/g,"&lt;").replace(/(&lt;br\/&gt;)/g,"<br>").replace(/(&lt;br&gt;)/g,"<br>")},urlDetect:function(e){return e.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/g)}},s.prototype={init:function(){var i=this;i.settings.consentGiven=i.checkConsent(),i.settings.consentGiven&&window.sby.maybeAddYTAPI(),i.settings.noCDN&&!i.settings.consentGiven&&(e(this.el).find(".sb_youtube_header").length?e(this.el).find(".sb_youtube_header").addClass("sby_no_consent"):e(this.el).prev(".sb_youtube_header").length&&e(this.el).prev(".sb_youtube_header").addClass("sby_no_consent")),e(this.el).find("#sby_mod_error").length&&e(this.el).prepend(e(this.el).find("#sby_mod_error")),this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var t,s=(t=0,function(e,i){clearTimeout(t),t=setTimeout(e,i)});jQuery(window).on("resize",function(){s(function(){i.afterResize()},500)})},initLayout:function(){this.initGalleryLayout(),this.initGrid()},initGalleryLayout:function(){var i=e(this.el),t=this;i.hasClass("sby_layout_gallery")&&i.find(".sby_player_outer_wrap").length&&(this.maybeRaiseSingleImageResolution(i.find(".sby_player_outer_wrap"),0,!0),i.find(".sby_player_outer_wrap .sby_video_thumbnail").off().on("click",function(i){if((!t.settings.lightboxEnabled||t.settings.lightboxEnabled&&t.settings.noCDN)&&(t.settings.noCDN||!t.settings.consentGiven))return e(this).closest(".sby_item").length,void(void 0!==e(this).closest(".sby_item").attr("data-video-id")&&e(this).attr("href","https://www.youtube.com/watch?v="+e(this).closest(".sby_item").attr("data-video-id")));i.preventDefault(),t.onThumbnailClick(e(this),!0)}),i.find(".sby_item").first().addClass("sby_current"),i.mouseenter(function(){t.canCreatePlayer()&&(i.find(".sby_player_outer_wrap iframe").length?void 0===t.player&&t.playerEagerLoaded()&&t.createPlayer("sby_player"+t.index):(i.addClass("sby_player_added").find(".sby_player_outer_wrap").addClass("sby_player_loading"),i.find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").show().removeClass("sby_hidden"),t.createPlayer("sby_player"+t.index)))}),window.sbySemiEagerLoading&&t.createPlayer("sby_player"+t.index),t.settings.noCDN&&i.find(".sby_player_outer_wrap").append('<div class="sby_play_btn">\n <span class="sby_play_btn_bg"></span>\n <svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="youtube" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="svg-inline--fa fa-youtube fa-w-18"><path fill="currentColor" d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z" class=""></path></svg> </div>'))},createPlayer:function(i,t,s,a){var n=e(this.el),o=this;if(t=void 0!==t?t:this.getVideoID(n.find(".sby_item").first()),s=void 0!==s?s:0,void 0===a&&(a={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:t,playerVars:{modestbranding:1,rel:0,autoplay:s}}),void 0===a.events&&(a.events={onReady:function(){n.find(".sby_player_outer_wrap").removeClass("sby_player_loading").find(".sby_video_thumbnail").css("z-index",-1).find(".sby_loader").hide().addClass("sby_hidden"),e("#"+i).length&&e("#"+i).closest(".sby_video_thumbnail_wrap").find(".sby_video_thumbnail").length&&e("#"+i).closest(".sby_video_thumbnail_wrap").find(".sby_video_thumbnail").fadeTo(0,"slow",function(){e(this).css("z-index",-1),e(this).find(".sby_loader").hide().addClass("sby_hidden"),e(this).closest(".sby_item").removeClass("sby_player_loading")});var t=jQuery.Event("sbyafterplayerready");t.feed=o,t.player=this,jQuery(window).trigger(t)},onStateChange:function(s){n.find(".sby_player_outer_wrap").removeClass("sby_player_loading").find(".sby_video_thumbnail").css("z-index",-1).find(".sby_loader").hide().addClass("sby_hidden"),o.afterStateChange(i,t,s,e("#"+i).closest(".sby_video_thumbnail_wrap")),1===s.data&&void 0!==o.players&&n.find(".sby_item").each(function(){var i=o.getVideoID(e(this));e(this).find("iframe").length&&i!==t&&void 0!==o.players[i]&&"function"==typeof o.players[i].pauseVideo&&o.players[i].pauseVideo()})}}),window.sbyEagerLoading)var d=YT.get(i);else d=new window.YT.Player(i,a);this.maybeAddCTA(i),n.hasClass("sby_layout_list")&&void 0===this.players[t]?this.players[t]=d:void 0===this.player&&(this.player=d);var r=jQuery.Event("sbyafterplayercreated");return r.feed=this,jQuery(window).trigger(r),d},afterStateChange:function(e,i,t,s){},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraItemsForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),this.afterFeedSet(),this.sizePlayer(),this.sizeItems(),this.settings.consentGiven?this.applyFullFeatures():this.removeFeatures()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass(),this.sizePlayer(),this.sizeItems()},afterLoadMoreClicked:function(e){e.find(".sby_loader").removeClass("sby_hidden"),e.find(".sby_btn_text").addClass("sby_hidden"),e.closest(".sb_youtube").find(".sby_num_diff_hide").addClass("sby_transition").removeClass("sby_num_diff_hide")},afterNewImagesLoaded:function(){var i=e(this.el),t=this;this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),this.sizePlayer(),this.sizeItems(),setTimeout(function(){i.find(".sby_loader").addClass("sby_hidden"),i.find(".sby_btn_text").removeClass("sby_hidden"),t.maybeRaiseImageResolution()},500),this.settings.consentGiven?this.applyFullFeatures():this.removeFeatures()},beforeNewImagesRevealed:function(){this.setImageHeight(),this.maybeRaiseImageResolution(!0),this.setImageSizeClass()},afterFeedSet:function(){},sizePlayer:function(){var i=e(this.el),t=this;if(i.hasClass("sby_layout_gallery")){$playerThumbnail=i.find(".sby_player_item").find(".sby_player_video_thumbnail");var s=$playerThumbnail.innerWidth(),a=Math.floor(9*s/16);t.settings.narrowPlayer&&(a=Math.floor(3*s/4)),$playerThumbnail.css("height",a+"px").css("overflow","hidden")}else i.hasClass("sby_layout_list")&&i.find(".sby_item").each(function(){$playerThumbnail=e(this).find(".sby_item_video_thumbnail");var i=$playerThumbnail.innerWidth(),s=Math.floor(9*i/16);t.settings.narrowPlayer&&(s=Math.floor(3*i/4)),$playerThumbnail.css("height",s+"px").css("overflow","hidden")})},sizeItems:function(){var i=e(this.el);i.hasClass("sby_layout_list")||i.find(".sby_item").find(".sby_item_video_thumbnail").each(function(){if(e(this).hasClass("sby_imgLiquid_ready")){var i=e(this).innerWidth(),t=Math.floor(9*i/16);e(this).css("height",t+"px").css("overflow","hidden")}})},revealNewImages:function(){var i=e(this.el),t=this;this.applyImageLiquid(),"function"==typeof sbyCustomJS&&setTimeout(function(){sbyCustomJS()},100),i.find(".sby-screenreader").find("img").remove(),i.find(".sby_item.sby_new").each(function(i){var s=jQuery(this),a=s.attr("data-video-id");window.sbyEagerLoading&&t.canCreatePlayer()&&e("#sby_player_"+a).length&&(player=new YT.Player("sby_player_"+a,{height:"100",width:"100",videoId:a,playerVars:{modestbranding:1,rel:0,autoplay:0},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&s.find(".sby_item").each(function(){var i=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&jQuery(e.target.a).attr("id")!==jQuery(this).find("iframe").attr("id")&&YT.get("sby_player_"+i).pauseVideo()})}}})),s.find(".sby_video_thumbnail").on("mouseenter",function(){t.onThumbnailEnter(e(this),!1)}),s.find(".sby_player_wrap").on("mouseleave",function(){t.onThumbnailLeave(e(this),!1)}),s.find(".sby_video_thumbnail").on("click",function(i){if((!t.settings.lightboxEnabled||t.settings.lightboxEnabled&&t.settings.noCDN)&&(t.settings.noCDN||!t.settings.consentGiven))return e(this).closest(".sby_item").length,void(void 0!==e(this).closest(".sby_item").attr("data-video-id")&&e(this).attr("href","https://www.youtube.com/watch?v="+e(this).closest(".sby_item").attr("data-video-id")));i.preventDefault(),t.onThumbnailClick(e(this),!1)}),t.settings.lightboxEnabled&&(s.find(".sby_video_thumbnail").attr("data-sby-lightbox",t.index),"undefined"!=typeof sbyOptions&&void 0!==sbyOptions.lightboxPlaceholder&&(t.settings.narrowPlayer?s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholderNarrow):s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholder))),t.afterItemRevealed(s),""===s.find(".sby_info_item").text().trim()&&s.find(".sby_info_item").addClass("sby_no_space")}),i.find(".sby_player_item").each(function(e){var i=jQuery(this);t.afterItemRevealed(i)}),setTimeout(function(){i.find(".sby_item.sby_new").removeClass("sby_new");var e=10;i.find(".sby_transition").length;i.find(".sby_transition").each(function(i){var t=jQuery(this);setTimeout(function(){t.removeClass("sby_transition")},e),e+=10})},500)},afterItemRevealed:function(){},afterNewImagesRevealed:function(){this.listenForVisibilityChange(),this.sendNeedsResizingToServer(),this.sendCheckWPPostsToServer(),this.settings.imageLoadEnabled||e(".sby_no_resraise").removeClass("sby_no_resraise");var i=e.Event("sbyafterimagesloaded");i.el=e(this.el),e(window).trigger(i)},setResizedImages:function(){e(this.el).find(".sby_resized_image_data").length&&void 0!==e(this.el).find(".sby_resized_image_data").attr("data-resized")&&0===e(this.el).find(".sby_resized_image_data").attr("data-resized").indexOf('{"')&&(this.resizedImages=JSON.parse(e(this.el).find(".sby_resized_image_data").attr("data-resized")),e(this.el).find(".sby_resized_image_data").remove())},sendNeedsResizingToServer:function(){var i=this;if(i.needsResizing.length>0&&i.settings.resizingEnabled){var t=e(this.el).find(".sby_item").length;n({action:"sby_resized_images_submit",needs_resizing:i.needsResizing,offset:t,feed_id:i.settings.feedID,location:i.locationGuess(),post_id:i.settings.postID,atts:i.settings.shortCodeAtts},function(e){if(0===e.trim().indexOf("{")){var t=JSON.parse(e);i.settings.debugEnabled&&console.log(t)}})}},sendCheckWPPostsToServer:function(){var i=this;if(i.settings.checkWPPosts||i.settings.singleCheckPosts){var t=void 0!==i.settings.feedID?i.settings.feedID:"sby_single",s=i.mostRecentlyLoadedPosts;i.mostRecentlyLoadedPosts=[];n({action:"sby_check_wp_submit",feed_id:t,atts:i.settings.shortCodeAtts,location:i.locationGuess(),post_id:i.settings.postID,offset:e(this.el).hasClass("sby_layout_carousel")?Math.floor(e(this.el).find(".sby_item").length/2-1):e(this.el).find(".sby_item").length,posts:s,cache_all:i.settings.cacheAll},function(e){if(0===e.trim().indexOf("{")){var t=JSON.parse(e);i.settings.debugEnabled&&console.log(t),i.afterSendCheckWPPostsToServer(t)}})}},afterSendCheckWPPostsToServer:function(e){},loadMoreButtonInit:function(){var i=e(this.el),t=this;i.find(".sby_footer .sby_load_btn").off().on("click",function(){t.afterLoadMoreClicked(jQuery(this)),t.getNewPostSet()})},getNewPostSet:function(){var i=e(this.el),t=this;n({action:"sby_load_more_clicked",offset:i.find(".sby_item").length,feed_id:t.settings.feedID,location:t.locationGuess(),post_id:t.settings.postID,atts:t.settings.shortCodeAtts,current_resolution:t.imageResolution},function(s){if(0===s.trim().indexOf("{")){var a=JSON.parse(s),n=void 0!==a.feedStatus.checkWPPosts&&a.feedStatus.checkWPPosts;t.settings.debugEnabled&&console.log(a),t.settings.checkWPPosts=!!n,t.appendNewPosts(a.html),t.addResizedImages(a.resizedImages),t.settings.ajaxPostLoad?(t.settings.ajaxPostLoad=!1,t.afterInitialImagesLoaded()):t.afterNewImagesLoaded(),a.feedStatus.shouldPaginate?t.outOfPages=!1:(t.outOfPages=!0,i.find(".sby_load_btn").hide()),e(".sby_no_js").removeClass("sby_no_js")}})},appendNewPosts:function(i){var t=e(this.el);t.find(".sby_items_wrap .sby_item").length?t.find(".sby_items_wrap .sby_item").last().after(i):t.find(".sby_items_wrap").append(i)},addResizedImages:function(e){for(var i in e)this.resizedImages[i]=e[i]},setImageHeight:function(){},maybeRaiseSingleImageResolution:function(i,t,s){var a=this,n=a.getImageUrls(i),o=i.find(".sby_video_thumbnail > img").attr("src"),d=150;s=void 0!==s&&s;if(!(i.hasClass("sby_no_resraise")||!a.settings.consentGiven&&a.settings.noCDN)){e.each(n,function(e,i){i===o&&(d=parseInt(e),s=!1)});var r=640;switch(a.settings.imgRes){case"thumb":r=120;break;case"medium":r=320;break;case"large":r=480;break;case"full":r=640;break;default:var l=Math.max(a.settings.autoMinRes,i.find(".sby_video_thumbnail").innerWidth());switch(a.getBestResolutionForAuto(l,1,e(this.el).find("sby_item").first())){case 480:r=480;break;case 320:r=320;break;case 120:r=120}}if(r>d||o===a.placeholderURL||s){if(a.settings.debugEnabled){var h=o===a.placeholderURL?"was placeholder":"too small";console.log("rais res for "+o,h)}var b=n[r];i.find(".sby_video_thumbnail > img").attr("src",b),i.find(".sby_video_thumbnail").hasClass("sby_imgLiquid_ready")&&i.find(".sby_video_thumbnail").css("background-image",'url("'+b+'")')}i.find("img").on("error",function(){if(e(this).hasClass("sby_img_error"))console.log("unfixed error "+e(this).attr("src"));else{if(e(this).addClass("sby_img_error"),e(this).attr("src").indexOf("i.ytimg.com")>-1)a.settings.favorLocal=!0,a.getImageUrls(e(this).closest(".sby_item"))[640];else void 0!==e(this).closest(".sby_video_thumbnail").attr("data-full-res")||e(this).closest(".sby_video_thumbnail").attr("href");setTimeout(function(){a.afterResize()},1500)}})}},maybeRaiseImageResolution:function(i){var t=this,s=void 0!==i&&!0===i?".sby_item.sby_new":".sby_item",a=!t.isInitialized;e(t.el).find(s).each(function(i){!e(this).hasClass("sby_num_diff_hide")&&e(this).find(".sby_video_thumbnail").length&&void 0!==e(this).find(".sby_video_thumbnail").attr("data-img-src-set")&&t.maybeRaiseSingleImageResolution(e(this),i,a)}),t.isInitialized=!0},getBestResolutionForAuto:function(i,t,s){(isNaN(t)||t<1)&&(t=1);var a=i*t,n=10*Math.ceil(a/10),o=[120,320,480,640];if(s.hasClass("sby_highlighted")&&(n*=2),-1===o.indexOf(parseInt(n))){var d=!1;e.each(o,function(e,i){i>parseInt(n)&&!d&&(n=i,d=!0)})}return n},hideExtraItemsForWidth:function(){if("carousel"!==this.layout){var i=e(this.el),t=void 0!==i.attr("data-num")&&""!==i.attr("data-num")?parseInt(i.attr("data-num")):1,s=void 0!==i.attr("data-nummobile")&&""!==i.attr("data-nummobile")?parseInt(i.attr("data-nummobile")):t;i.hasClass(".sby_layout_carousel")||(e(window).width()<480?s<i.find(".sby_item").length&&i.find(".sby_item").slice(s-i.find(".sby_item").length).addClass("sby_num_diff_hide"):t<i.find(".sby_item").length&&i.find(".sby_item").slice(t-i.find(".sby_item").length).addClass("sby_num_diff_hide"))}},setImageSizeClass:function(){var i=e(this.el);i.removeClass("sby_small sby_medium");var t=i.innerWidth(),s=parseInt(i.find(".sby_items_wrap").outerWidth()-i.find(".sby_items_wrap").width())/2,a=this.getColumnCount(),n=(t-s*(a+2))/a;n>140&&n<240?i.addClass("sby_medium"):n<=140&&i.addClass("sby_small")},setMinImageWidth:function(){e(this.el).find(".sby_item .sby_video_thumbnail").first().length?this.minImageWidth=e(this.el).find(".sby_item .sby_video_thumbnail").first().innerWidth():this.minImageWidth=150},setImageResolution:function(){if("auto"===this.settings.imgRes)this.imageResolution="auto";else switch(this.settings.imgRes){case"thumb":this.imageResolution=150;break;case"medium":this.imageResolution=320;break;default:this.imageResolution=640}},getImageUrls:function(e){var i=JSON.parse(e.find(".sby_video_thumbnail").attr("data-img-src-set").replace(/\\\//g,"/")),t=e.attr("id").replace("sby_","").replace("player_","");if(void 0!==this.resizedImages[t]&&"video"!==this.resizedImages[t]&&"pending"!==this.resizedImages[t]&&"error"!==this.resizedImages[t].id&&"video"!==this.resizedImages[t].id&&"pending"!==this.resizedImages[t].id){if(void 0!==this.resizedImages[t].sizes){var s=[];void 0!==this.resizedImages[t].sizes.full&&(s.push(640),i[640]=sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg",e.find(".sby_link_area").attr("href",sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg"),e.find(".sby_video_thumbnail").attr("data-full-res",sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg")),void 0!==this.resizedImages[t].sizes.low&&(s.push(320),i[320]=sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg",this.settings.favorLocal&&void 0===this.resizedImages[t].sizes.full&&(e.find(".sby_link_area").attr("href",sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg"),e.find(".sby_video_thumbnail").attr("data-full-res",sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg"))),void 0!==this.resizedImages[t].sizes.thumb&&(s.push(150),i[150]=sbyOptions.resized_url+this.resizedImages[t].id+"thumb.jpg"),this.settings.favorLocal&&(-1===s.indexOf(640)&&s.indexOf(320)>-1&&(i[640]=sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg"),-1===s.indexOf(320)&&(s.indexOf(640)>-1?i[320]=sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg":s.indexOf(150)>-1&&(i[320]=sbyOptions.resized_url+this.resizedImages[t].id+"thumb.jpg")),-1===s.indexOf(150)&&(s.indexOf(320)>-1?i[150]=sbyOptions.resized_url+this.resizedImages[t].id+"low.jpg":s.indexOf(640)>-1&&(i[150]=sbyOptions.resized_url+this.resizedImages[t].id+"full.jpg")))}}else(void 0===this.resizedImages[t]||void 0!==this.resizedImages[t].id&&"pending"!==this.resizedImages[t].id&&"error"!==this.resizedImages[t].id)&&this.addToNeedsResizing(t);return i},getVideoID:function(i){if(i.hasClass("sby_item")||i.hasClass("sby_player_item")){if(void 0!==i.find(".sby_video_thumbnail").attr("data-video-id"))return i.find(".sby_video_thumbnail").attr("data-video-id")}else if(i.closest("sby_item").length||i.closest("sby_player_item").length){var t=i.closest("sby_item").length?i.closest("sby_item"):i.closest("sby_player_item");if(void 0!==t.find(".sby_video_thumbnail").attr("data-video-id"))return t.find(".sby_video_thumbnail").attr("data-video-id")}else{if(i.hasClass("sb_youtube"))return i.find(".sby_item").first().find(".sby_video_thumbnail").attr("data-video-id");if(e(this.el).find(".sby_video_thumbnail").first().length&&void 0!==e(this.el).find(".sby_video_thumbnail").first().attr("data-video-id"))return e(this.el).find(".sby_video_thumbnail").first().attr("data-video-id")}return""},getAvatarUrl:function(e,i){if(""===e)return"";var t=this.settings.general.avatars;return"local"===(i=void 0!==i?i:"local")?void 0!==t["LCL"+e]&&1===parseInt(t["LCL"+e])?sbyOptions.resized_url+e+".jpg":void 0!==t[e]?t[e]:"":void 0!==t[e]?t[e]:void 0!==t["LCL"+e]&&1===parseInt(t["LCL"+e])?sbyOptions.resized_url+e+".jpg":""},addToNeedsResizing:function(e){-1===this.needsResizing.indexOf(e)&&this.needsResizing.push(e)},applyImageLiquid:function(){var t=e(this.el);i(),"function"==typeof t.find(".sby_player_item").sby_imgLiquid&&(t.find(".sby_player_item").length&&t.find(".sby_player_item .sby_player_video_thumbnail").sby_imgLiquid({fill:!0}),t.find(".sby_item .sby_item_video_thumbnail").sby_imgLiquid({fill:!0}))},listenForVisibilityChange:function(){var i,t,s,a=this;i=jQuery,t={callback:function(){},runOnLoad:!0,frequency:100,sbyPreviousVisibility:null},s={sbyCheckVisibility:function(e,i){if(jQuery.contains(document,e[0])){var t=i.sbyPreviousVisibility,a=e.is(":visible");i.sbyPreviousVisibility=a,null==t?i.runOnLoad&&i.callback(e,a):t!==a&&i.callback(e,a),setTimeout(function(){s.sbyCheckVisibility(e,i)},i.frequency)}}},i.fn.sbyVisibilityChanged=function(e){var a=i.extend({},t,e);return this.each(function(){s.sbyCheckVisibility(i(this),a)})},"function"==typeof e(this.el).filter(":hidden").sbyVisibilityChanged&&e(this.el).filter(":hidden").sbyVisibilityChanged({callback:function(e,i){a.afterResize()},runOnLoad:!1})},getColumnCount:function(){var i=e(this.el),t=this.settings.cols,s=this.settings.colsmobile,a=t;return sbyWindowWidth=window.innerWidth,i.hasClass("sby_mob_col_auto")?(sbyWindowWidth<640&&parseInt(t)>2&&parseInt(t)<7&&(a=2),sbyWindowWidth<640&&parseInt(t)>6&&parseInt(t)<11&&(a=4),sbyWindowWidth<=480&&parseInt(t)>2&&(a=1)):sbyWindowWidth<=480&&(a=s),parseInt(a)},onThumbnailClick:function(i,t,s){if(this.canCreatePlayer()){var a=e(this.el);if(a.hasClass("sby_layout_gallery"))if(a.find(".sby_current").removeClass("sby_current"),i.closest(".sby_item").addClass("sby_current"),i.closest(".sby_item").addClass("sby_current"),a.addClass("sby_player_added").find(".sby_player_outer_wrap").addClass("sby_player_loading"),a.find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").show().removeClass("sby_hidden"),a.find(".sby_player_outer_wrap iframe").length)if(t){s=void 0===s?this.getVideoID(a.find(".sby_item").first()):s;this.playVideoInPlayer(s)}else{s=void 0===s?this.getVideoID(i.closest(".sby_item")):s;this.changePlayerInfo(i.closest(".sby_item")),this.playVideoInPlayer(s),this.afterVideoChanged()}else if(t)this.createPlayer("sby_player"+this.index);else{var s=void 0===s?this.getVideoID(i.closest(".sby_item")):s;this.createPlayer("sby_player"+this.index,s)}else if(e(this.el).hasClass("sby_layout_grid")||e(this.el).hasClass("sby_layout_carousel")){var n=i.closest(".sby_item");s=void 0===s?this.getVideoID(n):s;this.playVideoInPlayer(s),this.afterVideoChanged()}else if(e(this.el).hasClass("sby_layout_list")){n=i.closest(".sby_item"),s=void 0===s?this.getVideoID(n):s;n.length&&!n.find("iframe").length?(n.find(".sby_loader").show().removeClass("sby_hidden"),n.addClass("sby_player_loading sby_player_loaded"),this.createPlayer("sby_player_"+s,s)):(this.playVideoInPlayer(s,n.attr("data-video-id")),this.afterVideoChanged())}}},onThumbnailEnter:function(i){if(this.canCreatePlayer()&&e(this.el).hasClass("sby_layout_list")){var t=i.closest(".sby_item"),s=this.getVideoID(t);t.find("iframe").length||(t.find(".sby_loader").show().removeClass("sby_hidden"),t.addClass("sby_player_loading sby_player_loaded"),this.createPlayer("sby_player_"+s,s,0))}},onThumbnailLeave:function(e){},changePlayerInfo:function(e){},playerEagerLoaded:function(){if(void 0!==this.player||e(this.el).hasClass("sby_player_loaded"))return!0},initGrid:function(){if(window.sbySemiEagerLoading&&jQuery("#sby_lightbox").length){var i=this;playerID="sby_lb-player",jQuery("#sby_lightbox").addClass("sby_video_lightbox");var t=e(this.el).find("sby_item").first().attr("data-video-id"),s=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var a={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:t,playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(t){var s=t.target.getVideoData().video_id;i.afterStateChange(playerID,s,t,e("#"+playerID).closest(".sby_video_thumbnail_wrap"))}}};i.maybeAddCTA(playerID),window.sbyLightboxPlayer=new window.YT.Player(playerID,a)}}},maybeAddCTA:function(e,i){},canCreatePlayer:function(){return!e(this.el).find("#sby_blank").length&&(this.playerEagerLoaded()||this.playerAPIReady&&this.settings.consentGiven||window.sbyAPIReady&&this.settings.consentGiven)},playVideoInPlayer:function(e,i){void 0!==this.player&&void 0!==this.player.loadVideoById?this.player.loadVideoById(e):void 0!==window.sbyLightboxPlayer&&void 0!==window.sbyLightboxPlayer.loadVideoById?window.sbyLightboxPlayer.loadVideoById(e):void 0!==i&&void 0!==this.players&&void 0!==this.players[i]&&void 0!==this.players[i].loadVideoById&&this.players[i].loadVideoById(e)},afterVideoChanged:function(){e(this.el).hasClass("sby_layout_gallery")&&(e(this.el).find(".sby_player_outer_wrap").removeClass("sby_player_loading"),e(this.el).find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").hide().addClass("sby_hidden"),e(window).width()<480&&e("html, body").animate({scrollTop:e(this.el).find(".sby_player_outer_wrap").offset().top},300))},checkConsent:function(){if(this.settings.consentGiven||!this.settings.gdpr)return this.settings.noCDN=!1,!0;if("undefined"!=typeof CLI_Cookie)null!==CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)&&(this.settings.consentGiven="yes"===CLI_Cookie.read("cookielawinfo-checkbox-non-necessary"));else if(void 0!==window.cnArgs){var e=("; "+document.cookie).split("; cookie_notice_accepted=");if(2===e.length){var i=e.pop().split(";").shift();this.settings.consentGiven="true"===i}}else void 0!==window.cookieconsent?this.settings.consentGiven="allow"===function(e){for(var i=e+"=",t=window.document.cookie.split(";"),s=0;s<t.length;s++){var a=t[s].trim();if(0==a.indexOf(i))return a.substring(i.length,a.length)}return""}("complianz_consent_status"):void 0!==window.Cookiebot?this.settings.consentGiven=Cookiebot.consented:void 0!==window.BorlabsCookie&&(this.settings.consentGiven=window.BorlabsCookie.checkCookieConsent("youtube"));var t=jQuery.Event("sbycheckconsent");return t.feed=this,jQuery(window).trigger(t),this.settings.consentGiven&&(this.settings.noCDN=!1),this.settings.consentGiven},afterConsentToggled:function(){if(this.checkConsent()){var e=this;window.sby.maybeAddYTAPI(),e.maybeRaiseImageResolution(),e.applyFullFeatures(),setTimeout(function(){e.afterResize()},500)}},removeFeatures:function(){this.settings.noCDN&&e(this.el).find(".sby_video_thumbnail").each(function(){e(this).removeAttr("data-sby-lightbox")})},applyFullFeatures:function(){var i=this;e(i.el).find(".sby_header_img img").attr("src",e(i.el).find(".sby_header_img").attr("data-avatar-url")),void 0===e(i.el).find(".sby_video_thumbnail").first().attr("data-sby-lightbox")&&i.settings.lightboxEnabled&&e(i.el).find(".sby_video_thumbnail").each(function(){e(this).attr("data-sby-lightbox",i.index)});var t=e(i.el);if(t.find(".sby_no_consent").removeClass("sby_no_consent"),t.hasClass("sby_layout_gallery")&&t.find(".sby_player_outer_wrap").length){if(this.maybeRaiseSingleImageResolution(t.find(".sby_player_outer_wrap"),0,!0),t.find(".sby_player_outer_wrap .sby_play_btn").remove(),t.find(".sby_item").first().addClass("sby_current"),!i.canCreatePlayer())return;t.find(".sby_player_outer_wrap iframe").length||i.createPlayer("sby_player"+i.index)}},locationGuess:function(){var i=e(this.el),t="content";return i.closest("footer").length?t="footer":i.closest(".header").length||i.closest("header").length?t="header":(i.closest(".sidebar").length||i.closest("aside").length)&&(t="sidebar"),t}},a.prototype={getData:function(e){return{feedIndex:parseInt(e.closest(".sb_youtube").attr("data-sby-index")-1),link:e.attr("href"),videoTitle:void 0!==e.attr("data-video-title")?e.attr("data-video-title"):"YouTube Video",video:e.attr("data-video-id")}},template:function(){return"<div id='sby_lightboxOverlay' class='sby_lightboxOverlay'></div><div id='sby_lightbox' class='sby_lightbox'><div class='sby_lb-outerContainer'><div class='sby_lb-container'><img class='sby_lb-image' alt='Lightbox image placeholder' src='' /><div class='sby_lb-player sby_lb-player-placeholder' id='sby_lb-player'></div><div class='sby_lb-nav'><a class='sby_lb-prev' href='#' ><p class='sby-screenreader'>Previous Slide</p><span></span></a><a class='sby_lb-next' href='#' ><p class='sby-screenreader'>Next Slide</p><span></span></a></div><div class='sby_lb-loader'><a class='sby_lb-cancel'></a></div></div></div><div class='sby_lb-dataContainer'><div class='sby_lb-data'><div class='sby_lb-details'><div class='sby_lb-caption'></div><div class='sby_lb-info'><div class='sby_lb-number'></div></div></div><div class='sby_lb-closeContainer'><a class='sby_lb-close'></a></div></div></div></div>"},beforePlayerSetup:function(e,i,t,s,a){},afterPlayerSetup:function(e,i,t,s){},afterResize:function(){var i=e("#sby_lightbox .sby_lb-player").height();if(i>100){var t=e("#sby_lightbox .sby_lb-outerContainer").height()-i;t>10&&e("#sby_lightbox .sby_lb-player").css("top",t/2)}},pausePlayer:function(){void 0!==YT.get("sby_lb-player")&&"function"==typeof YT.get("sby_lb-player").pauseVideo?YT.get("sby_lb-player").pauseVideo():void 0!==window.sbyLightboxPlayer&&"function"==typeof window.sbyLightboxPlayer.pauseVideo&&window.sbyLightboxPlayer.pauseVideo()}},window.sby_init=function(){window.sby=new t,window.sby.createPage(window.sby.createFeeds,{whenFeedsCreated:window.sby.afterFeedsCreated})}}(jQuery),void 0===window.sbyEagerLoading&&(window.sbyEagerLoading=void 0!==window.sbyOptions&&window.sbyOptions.eagerload,jQuery("div[data-vc-video-bg]").length&&(window.sbyEagerLoading=!0)),void 0===window.sbySemiEagerLoading&&(window.sbySemiEagerLoading=void 0!==window.sbyOptions&&window.sbyOptions.semiEagerload,(jQuery("div[data-vc-video-bg]").length||window.sbyEagerLoading)&&(window.sbySemiEagerLoading=!1)),jQuery(document).ready(function(e){window.sbySemiEagerLoading||sby_init(),e("#cookie-notice a").on("click",function(){setTimeout(function(){e.each(window.sby.feeds,function(e){window.sby.feeds[e].afterConsentToggled()})},1e3)}),e("#cookie-law-info-bar a").on("click",function(){setTimeout(function(){e.each(window.sby.feeds,function(e){window.sby.feeds[e].afterConsentToggled()})},1e3)}),e(".cli-user-preference-checkbox").on("click",function(){setTimeout(function(){e.each(window.sby.feeds,function(e){window.sby.feeds[e].settings.consentGiven=!1,window.sby.feeds[e].afterConsentToggled()})},1e3)}),e(window).on("CookiebotOnAccept",function(i){e.each(window.sby.feeds,function(e){window.sby.feeds[e].settings.consentGiven=!0,window.sby.feeds[e].afterConsentToggled()})}),e(document).on("cmplzAcceptAll",function(i){e.each(window.sby.feeds,function(e){window.sby.feeds[e].settings.consentGiven=!0,window.sby.feeds[e].afterConsentToggled()})}),e(document).on("cmplzRevoke",function(i){e.each(window.sby.feeds,function(e){window.sby.feeds[e].settings.consentGiven=!1,window.sby.feeds[e].afterConsentToggled()})}),e(document).on("borlabs-cookie-consent-saved",function(i){e.each(window.sby.feeds,function(e){window.sby.feeds[e].settings.consentGiven=!1,window.sby.feeds[e].afterConsentToggled()})})})}if(window.sbySemiEagerLoading){var sbyYScriptId="sby-youtube-api",sbyYScript=document.getElementById(sbyYScriptId);if(null===sbyYScript){var tag=document.createElement("script"),firstScript=document.getElementsByTagName("script")[0];tag.src="https://www.youtube.com/iframe_api",tag.id=sbyYScriptId,firstScript.parentNode.insertBefore(tag,firstScript)}}window.onYouTubeIframeAPIReady=function(){var e=document.getElementsByClassName("sb_youtube").length;if(e>0){if(window.sbySemiEagerLoading){if(void 0!==window.sby)for(var i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0;else window.sbyAPIReady=!0;sby_init()}else if(jQuery(".sb_youtube").each(function(e){var i=jQuery(this);i.find(".sby_live_player").length&&(player=new YT.Player(i.find(".sby_live_player").attr("id"),{events:{onReady:function(){i.find(".sby_live_player").hide(),i.find(".sby_item").remove();var t=YT.get(i.find(".sby_live_player").attr("id")).getVideoData().video_id;i.find(".sby_player_video_thumbnail").attr("data-video-id",t).css("z-index",-1);i.find(".sby_item").length;var s={action:"sby_live_retrieve",video_id:t,feed_id:i.attr("data-feedid"),atts:i.attr("data-shortcode-atts")};jQuery.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:s,success:function(t){if(0===t.trim().indexOf("{")){var s=window.sby.feeds[e],a=JSON.parse(t),n=void 0!==a.feedStatus.checkWPPosts&&a.feedStatus.checkWPPosts;s.settings.debugEnabled&&console.log(a),s.settings.checkWPPosts=!!n,s.appendNewPosts(a.html),s.addResizedImages(a.resizedImages),s.afterInitialImagesLoaded(),a.feedStatus.shouldPaginate?s.outOfPages=!1:(s.outOfPages=!0,i.find(".sby_load_btn").hide()),jQuery(".sby_no_js").removeClass("sby_no_js"),i.find(".sby_live_player").remove(),i.hasClass("sby_layout_gallery")&&s.createPlayer("sby_player"+s.index),i.find(".sby_player_item").css("opacity",1),i.find(".sby_item").css("opacity",1),i.find(".sby_player_loading").removeClass("sby_player_loading"),i.hasClass("sby_layout_list")&&i.find(".sby_item_video_thumbnail").on("mouseenter",function(){jQuery(this).css("z-index",-1)})}}})}}}))}),window.sbyEagerLoading){var t=!1,s=!1;jQuery(".sb_youtube").each(function(e){var i=jQuery(this);i.hasClass("sby_layout_list")?(jQuery(this).addClass("sby_player_loaded"),i.find(".sby_item").each(function(){videoID=jQuery(this).attr("data-video-id"),player=new YT.Player("sby_player_"+videoID,{height:"100",width:"100",videoId:videoID,playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&i.find(".sby_item").each(function(){var e=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&e!==jQuery(this).find("iframe").attr("id").replace("sby_player_","")&&YT.get("sby_player_"+e).pauseVideo()})}}})})):i.hasClass("sby_layout_gallery")?(jQuery(this).addClass("sby_player_loaded"),player=new YT.Player("sby_player"+e,{height:"100",width:"100",videoId:jQuery(this).find(".sby_item").first().attr("data-video-id"),playerVars:{modestbranding:1,rel:0,autoplay:s},events:{onStateChange:function(e){e.target.getVideoData().video_id;1===e.data&&i.find(".sby_item").each(function(){var i=jQuery(this).attr("data-video-id");jQuery(this).find("iframe").length&&jQuery(e.target.a).attr("id")!==jQuery(this).find("iframe").attr("id")&&YT.get("sby_player_"+i).pauseVideo()})}}})):t=!0})}else if(void 0!==window.sby)for(i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0;else window.sbyAPIReady=!0;t&&(jQuery("#sby_lb-player").length||jQuery(".sb_youtube").first().append('<div class="sby_lb-player-loaded sby_lb-player" id="sby_lb-player" style="display: none;"></div>'),player=new YT.Player("sby_lb-player",{height:"100",width:"100",videoId:jQuery(this).find(".sby_item").first().attr("data-video-id"),playerVars:{modestbranding:1,rel:0,autoplay:s}}),window.sbyLightboxPlayer=player)}};
uninstall.php CHANGED
@@ -22,9 +22,10 @@ if ( ! $sby_preserve_settings ) {
22
  delete_option( 'sby_errors' );
23
  delete_option( 'sby_ajax_status' );
24
  delete_option( 'sby_db_version' );
25
-
26
  delete_option( 'sby_rating_notice' );
27
- delete_option( 'sby_notifications' );
 
28
 
29
  // delete role
30
  global $wp_roles;
@@ -92,6 +93,9 @@ if ( ! $sby_preserve_settings ) {
92
  $wpdb->query( "DROP TABLE IF EXISTS $posts_table_name" );
93
  $wpdb->query( "DROP TABLE IF EXISTS $feeds_posts_table_name" );
94
 
 
 
 
95
  $image_files = glob( trailingslashit( $upload['basedir'] ) . trailingslashit( 'sby-local-media' ) . '*' ); // get all file names
96
  foreach ( $image_files as $file ) { // iterate files
97
  if ( is_file( $file ) ) {
22
  delete_option( 'sby_errors' );
23
  delete_option( 'sby_ajax_status' );
24
  delete_option( 'sby_db_version' );
25
+ delete_option( 'sby_statuses' );
26
  delete_option( 'sby_rating_notice' );
27
+ delete_option( 'sby_newuser_notifications' );
28
+ delete_option( 'sby_usage_tracking_config' );
29
 
30
  // delete role
31
  global $wp_roles;
93
  $wpdb->query( "DROP TABLE IF EXISTS $posts_table_name" );
94
  $wpdb->query( "DROP TABLE IF EXISTS $feeds_posts_table_name" );
95
 
96
+ $locator_table_name = $wpdb->prefix . SBY_FEED_LOCATOR;
97
+ $wpdb->query( "DROP TABLE IF EXISTS $locator_table_name" );
98
+
99
  $image_files = glob( trailingslashit( $upload['basedir'] ) . trailingslashit( 'sby-local-media' ) . '*' ); // get all file names
100
  foreach ( $image_files as $file ) { // iterate files
101
  if ( is_file( $file ) ) {
youtube-feed.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: Feeds for YouTube
4
  Plugin URI: http://smashballoon.com/youtube-feed
5
  Description: The Feeds for YouTube plugin allows you to display customizable YouTube feeds from any YouTube channel.
6
- Version: 1.3
7
  Author: Smash Balloon YouTube Team
8
  Author URI: http://smashballoon.com/
9
  Text Domain: feeds-for-youtube
10
  */
11
  /*
12
- Copyright 2020 Smash Balloon LLC (email : hey@smashballoon.com)
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License as published by
15
  the Free Software Foundation; either version 2 of the License, or
@@ -26,10 +26,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
27
 
28
  if ( ! defined( 'SBYVER' ) ) {
29
- define( 'SBYVER', '1.3' );
30
  }
31
  if ( ! defined( 'SBY_DBVERSION' ) ) {
32
- define( 'SBY_DBVERSION', 1.3 );
33
  }
34
  // Upload folder name for local image files for posts
35
  if ( ! defined( 'SBY_UPLOADS_NAME' ) ) {
@@ -55,6 +55,9 @@ if ( ! defined( 'SBY_PLUGIN_DIR' ) ) {
55
  if ( ! defined( 'SBY_PLUGIN_URL' ) ) {
56
  define( 'SBY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
57
  }
 
 
 
58
 
59
  if ( function_exists( 'sby_init' ) ) {
60
  wp_die( "Please deactivate Feeds for YouTube.<br /><br />Back to the WordPress <a href='".get_admin_url( null, 'plugins.php' )."'>Plugins page</a>." );
@@ -128,6 +131,7 @@ if ( function_exists( 'sby_init' ) ) {
128
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-cron-update.php';
129
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-display-elements.php';
130
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-feed.php';
 
131
  include_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-gdpr-integrations.php';
132
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-parse.php';
133
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-posts-manager.php';
@@ -303,12 +307,7 @@ if ( function_exists( 'sby_init' ) ) {
303
 
304
  $db_ver = get_option( 'sby_db_version', 0 );
305
 
306
- if ( (float) $db_ver < 1.0 ) {
307
- update_option( 'sby_db_version', SBY_DBVERSION );
308
- }
309
-
310
- if ( (float) $db_ver < 1.1 ) {
311
-
312
  $sby_statuses_option = get_option( 'sby_statuses', array() );
313
 
314
  if ( ! isset( $sby_statuses_option['first_install'] ) ) {
@@ -343,13 +342,13 @@ if ( function_exists( 'sby_init' ) ) {
343
  update_option( 'sby_db_version', SBY_DBVERSION );
344
  }
345
 
346
- if ( (float) $db_ver < 1.2 ) {
347
  sby_add_caps();
348
 
349
  update_option( 'sby_db_version', SBY_DBVERSION );
350
  }
351
 
352
- if ( (float) $db_ver < 1.3 ) {
353
  if ( ! wp_next_scheduled( 'sby_notification_update' ) ) {
354
  $timestamp = strtotime( 'next monday' );
355
  $timestamp = $timestamp + (3600 * 24 * 7);
@@ -361,6 +360,14 @@ if ( function_exists( 'sby_init' ) ) {
361
  update_option( 'sby_db_version', SBY_DBVERSION );
362
  }
363
 
 
 
 
 
 
 
 
 
364
  }
365
  add_action( 'wp_loaded', 'sby_check_for_db_updates' );
366
 
3
  Plugin Name: Feeds for YouTube
4
  Plugin URI: http://smashballoon.com/youtube-feed
5
  Description: The Feeds for YouTube plugin allows you to display customizable YouTube feeds from any YouTube channel.
6
+ Version: 1.4
7
  Author: Smash Balloon YouTube Team
8
  Author URI: http://smashballoon.com/
9
  Text Domain: feeds-for-youtube
10
  */
11
  /*
12
+ Copyright 2021 Smash Balloon LLC (email : hey@smashballoon.com)
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License as published by
15
  the Free Software Foundation; either version 2 of the License, or
26
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
27
 
28
  if ( ! defined( 'SBYVER' ) ) {
29
+ define( 'SBYVER', '1.4' );
30
  }
31
  if ( ! defined( 'SBY_DBVERSION' ) ) {
32
+ define( 'SBY_DBVERSION', '1.4' );
33
  }
34
  // Upload folder name for local image files for posts
35
  if ( ! defined( 'SBY_UPLOADS_NAME' ) ) {
55
  if ( ! defined( 'SBY_PLUGIN_URL' ) ) {
56
  define( 'SBY_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
57
  }
58
+ if ( ! defined( 'SBY_FEED_LOCATOR' ) ) {
59
+ define( 'SBY_FEED_LOCATOR', 'sby_feed_locator' );
60
+ }
61
 
62
  if ( function_exists( 'sby_init' ) ) {
63
  wp_die( "Please deactivate Feeds for YouTube.<br /><br />Back to the WordPress <a href='".get_admin_url( null, 'plugins.php' )."'>Plugins page</a>." );
131
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-cron-update.php';
132
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-display-elements.php';
133
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-feed.php';
134
+ include_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-feed-locator.php';
135
  include_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-gdpr-integrations.php';
136
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-parse.php';
137
  require_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-posts-manager.php';
307
 
308
  $db_ver = get_option( 'sby_db_version', 0 );
309
 
310
+ if ( version_compare( $db_ver, '1.1', '<' ) ) {
 
 
 
 
 
311
  $sby_statuses_option = get_option( 'sby_statuses', array() );
312
 
313
  if ( ! isset( $sby_statuses_option['first_install'] ) ) {
342
  update_option( 'sby_db_version', SBY_DBVERSION );
343
  }
344
 
345
+ if ( version_compare( $db_ver, '1.2', '<' ) ) {
346
  sby_add_caps();
347
 
348
  update_option( 'sby_db_version', SBY_DBVERSION );
349
  }
350
 
351
+ if ( version_compare( $db_ver, '1.3', '<' ) ) {
352
  if ( ! wp_next_scheduled( 'sby_notification_update' ) ) {
353
  $timestamp = strtotime( 'next monday' );
354
  $timestamp = $timestamp + (3600 * 24 * 7);
360
  update_option( 'sby_db_version', SBY_DBVERSION );
361
  }
362
 
363
+ if ( version_compare( $db_ver, '1.4', '<' ) ) {
364
+ include_once trailingslashit( SBY_PLUGIN_DIR ) . 'inc/class-sby-feed-locator.php';
365
+
366
+ SBY_Feed_Locator::create_table();
367
+
368
+ update_option( 'sby_db_version', SBY_DBVERSION );
369
+ }
370
+
371
  }
372
  add_action( 'wp_loaded', 'sby_check_for_db_updates' );
373