Version Description
- Tweak: Changed tooltip and notes regarding how to display a YouTube feed from a certain YouTube channel.
- Fix: YouTube iframe JavaScript file was being loaded with HTTP. Changed to HTTPS.
- Fix: Prevented error if allow_url_fopen set to false in php.ini by changing how RSS channel feeds are retrieved from YouTube.
- Fix: Unable to view YouTube account details if more than one YouTube account connected.
Download this release
Release Info
Developer | smashballoon |
Plugin | Feeds for YouTube (YouTube video, channel, and gallery plugin) |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- README.txt +64 -57
- css/admin.css +0 -1
- inc/admin/admin-functions.php +4 -3
- inc/admin/class-sby-admin.php +2 -1
- inc/class-sby-rss-connect.php +58 -45
- js/admin.js +2 -2
- js/sb-youtube.js +1 -1
- js/sb-youtube.min.js +1 -1
- youtube-feed.php +4 -4
README.txt
CHANGED
@@ -1,46 +1,47 @@
|
|
1 |
-
=== Feeds for YouTube (YouTube
|
2 |
Author: Smash Balloon
|
3 |
Contributors: smashballoon, craig-at-smash-balloon
|
4 |
Support Website: http://smashballoon/youtube-feed/
|
5 |
-
Tags: YouTube, YouTube feed, YouTube
|
6 |
Requires at least: 3.4
|
7 |
Tested up to: 5.3
|
8 |
-
Stable tag: 1.0.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
-
|
13 |
|
14 |
== Description ==
|
15 |
-
Display
|
16 |
|
17 |
### YouTube Feed Features
|
18 |
* **Completely Customizable** YouTube feeds - by default inherits your theme's styles
|
19 |
* **Completely responsive and mobile optimized** - your YouTube feeds look great on any screen size
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
* **
|
|
|
24 |
* Built-in easy to use "YouTube Feed" Widget
|
25 |
* Fully internationalized and translatable into any language
|
26 |
-
*
|
27 |
* Enter your own custom CSS or JavaScript for even deeper customization
|
28 |
|
29 |
-
For simple step-by-step directions on how to set up the Feeds for YouTube plugin please refer to our [setup guide](http://smashballoon.com/youtube-feed/free/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube setup guide').
|
30 |
|
31 |
### Benefits
|
32 |
-
* **Increase social engagement** between you and your YouTube subscribers
|
33 |
* **Save time** by using the Feeds for YouTube plugin to generate dynamic, search engine crawlable content on your website
|
34 |
-
* **Get more subscribers** by displaying your YouTube videos directly on your site
|
35 |
* Display your YouTube channel content **your way** to perfectly match your website's style
|
36 |
* The plugin is **updated regularly** with new features, bug-fixes and YouTube API changes
|
37 |
* Support is quick, effective, and always happy to help
|
38 |
* We're dedicated to providing the **most customizable**, **robust** and **well supported** YouTube feed plugin in the world!
|
39 |
|
40 |
### Feedback or Support
|
41 |
-
Customer support is a huge deal to us. We pride ourselves on always providing quick, effective, and courteous support to all of our users. If you're having an issue with our YouTube
|
42 |
|
43 |
-
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.
|
44 |
|
45 |
### Pro Version (Feeds for YouTube Pro)
|
46 |
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 YouTube content in even more powerful ways:
|
@@ -74,35 +75,35 @@ To find out more about the team, see [here](https://smashballoon.com/about/ "Tea
|
|
74 |
|
75 |
### YouTube Feed Shortcode Settings
|
76 |
|
77 |
-
You can edit the settings globally for all YouTube feeds on your site using the plugin settings page, but if you want to change settings for specific YouTube feeds then you can do so by using the shortcode settings listed below:
|
78 |
|
79 |
**channel** - Display videos from a YouTube channel. Eg: [youtube-feed channel="smashballoon"]
|
80 |
-
**width** - The width of your YouTube feed. Any number with a unit like "px" or "%". Eg: [youtube-feed width="300px"]
|
81 |
-
**height** - The height of your YouTube feed. Any number with a unit like "px" or "em". Eg: [youtube-feed height="500px"]
|
82 |
-
**background** - Background color for your YouTube feed. Any hex color code. Eg: [youtube-feed background="#f00"]
|
83 |
-
**playvideo** - What the user needs to do to play a YouTube video: **onclick**, **automatically**. Eg: [youtube-feed playvideo="onclick"]
|
84 |
-
**layout** - How your YouTube videos are displayed visually. Eg: [youtube-feed layout="list"]
|
85 |
-
**num** - The number of YouTube videos in the feed. Eg: [youtube-feed num="5"]
|
86 |
-
**itemspacing** - The spacing/padding around the YouTube videos in the feed. Any number with a unit like "px" or "em". Eg: [youtube-feed itemspacing="5px"]
|
87 |
-
**showheader** - Include a header for this YouTube feed. Eg: [youtube-feed showheader="false"]
|
88 |
**showdescription** Include the channel description in the YouTube feed header. Eg: [youtube-feed showdescription="false"]
|
89 |
-
**showbutton** - Include a "Load More" button at the bottom of the feed to load more YouTube videos. Eg: [youtube-feed showbutton="false"]
|
90 |
-
**buttoncolor** - Background color for the "Load More" button at the bottom of the YouTube feed. Any hex color code Eg: [youtube-feed buttoncolor="#0f0"]
|
91 |
**buttontextcolor** - Text color for the "Load More" button. Any hex color code. Eg: [youtube-feed buttontextcolor="#00f"]
|
92 |
**buttontext** - The text that appers on the "Load More" button. Eg: [youtube-feed buttontext=""More Videos""]
|
93 |
-
**showsubscribe** - Include a "Subscribe" button at the bottom of the YouTube feed to load more YouTube videos. Eg: [youtube-feed showsubscribe="false"]
|
94 |
-
**subscribecolor** - Background color for the YouTube "Subscribe" button. Any hex color code. Eg: [youtube-feed subscribecolor="#0f0"]
|
95 |
-
**subscribetextcolor** - Text color for the YouTube "Subscribe" button. Any hex color code. Eg: [youtube-feed subscribetextcolor="#00f"]
|
96 |
-
**subscribetext** - The text that appers on the YouTube "Subscribe" button. Eg: [youtube-feed subscribetext=""Subscribe to My Channel""]
|
97 |
|
98 |
== Installation ==
|
99 |
1. Install the Feeds for YouTube plugin either via the WordPress plugin directory, or by uploading the files to your web server (in the /wp-content/plugins/ directory).
|
100 |
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
101 |
-
3. Navigate to the 'Feeds for YouTube' settings page to configure your YouTube
|
102 |
-
4. Use the shortcode [youtube-feed] in your page, post or widget to display your YouTube feed.
|
103 |
5. You can display multiple YouTube channels with different configurations by specifying the necessary parameters directly in the shortcode: [youtube-feed channel=smashballoon].
|
104 |
|
105 |
-
For simple step-by-step directions on how to set up the Feeds for YouTube plugin please refer to our [setup guide](http://smashballoon.com/youtube-feed/free/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube setup guide').
|
106 |
|
107 |
= Setting up the Free Feeds for YouTube WordPress Plugin =
|
108 |
|
@@ -118,27 +119,27 @@ The Feeds for YouTube plugin is brand new and so we're currently working on impr
|
|
118 |
|
119 |
5) Enter a YouTube channel name to display videos from.
|
120 |
|
121 |
-
6) Navigate to the Customize and Style pages to customize your YouTube feed.
|
122 |
|
123 |
-
7) Once you've customized your YouTube feed, click on the "Display Your Feed" tab for directions on how to display your YouTube feed (or multiple YouTube feeds).
|
124 |
|
125 |
-
8) Copy the [youtube-feed] shortcode and paste it into any page, post or widget where you want the YouTube feed to appear.
|
126 |
|
127 |
9) You can paste the [youtube-feed] shortcode directly into your page editor.
|
128 |
|
129 |
10) You can use the default WordPress 'Text' widget to display your Feeds for YouTube in a sidebar or other widget area.
|
130 |
|
131 |
-
11) View your website to see your YouTube feed(s) in all their glory!
|
132 |
|
133 |
== Frequently Asked Questions ==
|
134 |
|
135 |
-
= Can I display multiple YouTube feeds on my site or on the same page? =
|
136 |
|
137 |
Yep. You can display multiple YouTube feeds by using our built-in shortcode options, for example: `[youtube-feed channel="smashballoon" num=3]`.
|
138 |
|
139 |
-
= How do I embed a YouTube gallery directly into a WordPress page template? =
|
140 |
|
141 |
-
You can embed your YouTube
|
142 |
|
143 |
= Will Feeds for YouTube work with W3 Total Cache or other caching plugins? =
|
144 |
|
@@ -150,11 +151,11 @@ Yep, just use the following setting: Feeds for YouTube > Customize > Video Exper
|
|
150 |
|
151 |
= How can I change the layout of my YouTube video feed? =
|
152 |
|
153 |
-
This free plugin has several layout options built into it. Use the settings in the following location to display your YouTube videos in a list, grid, or gallery layout: Feeds for YouTube > Customize > Layout. You can also change the spacing/padding between the YouTube videos by using the "Spacing between videos" setting in this same section.
|
154 |
|
155 |
= Can I select how many YouTube videos should be displayed in the feed? =
|
156 |
|
157 |
-
Yep, you can choose to display between 1-50 YouTube videos in your feed by using the following setting: Feeds for YouTube > Customize > Layout > Number of Videos. The plugin also contains a "Load More" button to allow you to infinitely load more YouTube videos into your feed.
|
158 |
|
159 |
= Will my YouTube gallery be responsive to accommodate mobile visitors? =
|
160 |
|
@@ -162,43 +163,49 @@ Yes. All YouTube feed layouts are completely mobile responsive. Using the plugin
|
|
162 |
|
163 |
= Will videos from my YouTube channel be cached? =
|
164 |
|
165 |
-
Yes. The Feeds for YouTube plugin will cache all of the posts collected from the YouTube API. Your YouTube videos and information about your YouTube channel can then be retrieved and used for future page loads.
|
166 |
|
167 |
-
= How do I find the nickname
|
168 |
|
169 |
You can display videos from any YouTube channel using the unique YouTube channel ID. This can be found by viewing the channel page on YouTube and looking at the end of the URL. ex: https://www.youtube.com/channel/UC1a2b3c4D5F6g7i8j9k. You can also use the channel nickname.
|
170 |
|
171 |
-
= How does the plugin retrieve my YouTube videos? =
|
172 |
|
173 |
The plugin connects to YouTube and requests data about videos from your YouTube channel in three ways: The RSS feed associated with each YouTube Channel, using the Smash Balloon app and the YouTube API, and using an API Key to connect to the YouTube API. The plugin uses each connection type in certain circumstances with the main concern of optimizing API calls overall.
|
174 |
|
175 |
= Will displaying my YouTube channel affect the time it takes to load the page? =
|
176 |
|
177 |
-
The Feeds for YouTube plugin
|
178 |
|
179 |
= How often do new videos from my YouTube channel appear in the YouTube gallery? =
|
180 |
|
181 |
-
By default, the plugin retrieves new YouTube videos for your YouTube gallery once every hour. You can reduce this to as little as 15 minutes if needed. You can even set your YouTube gallery to update using WordPress cron in the background so the caching process is not relying on the page with your YouTube gallery being visited.
|
182 |
|
183 |
== Screenshots ==
|
184 |
|
185 |
-
1. By default the plugin inherits styles from your theme
|
186 |
-
2. Display multiple YouTube feeds and customize each one
|
187 |
3. When using the "grid" layout, YouTube videos open and play in a lightbox
|
188 |
4. Feeds for YouTube Settings pages
|
189 |
-
5. Built in customization settings make customizing your YouTube feed easy
|
190 |
-
6. Use handy shortcode options to customize individual YouTube feeds
|
191 |
-
7. To display a YouTube feed just copy and paste the [youtube-feed] shortcode into a widget or page
|
192 |
|
193 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
= 1.0.2 =
|
195 |
-
* New: Changed the method used to update feeds to reduce YouTube API requests.
|
196 |
-
* Tweak: More posts cached in the wp_posts table when a YouTube API request is made.
|
197 |
-
* Tweak:
|
198 |
-
* Fix: Error when deactivating and reactivating plugin with background caching enabled.
|
199 |
|
200 |
= 1.0.1 =
|
201 |
-
* Fix: Optimized API calls to reduce requests.
|
202 |
* Fix: Minor bug fixes.
|
203 |
|
204 |
= 1.0 =
|
1 |
+
=== Feeds for YouTube (YouTube feed, channel, and gallery plugin) ===
|
2 |
Author: Smash Balloon
|
3 |
Contributors: smashballoon, craig-at-smash-balloon
|
4 |
Support Website: http://smashballoon/youtube-feed/
|
5 |
+
Tags: YouTube, YouTube feed, YouTube channel, YouTube widget, YouTube gallery
|
6 |
Requires at least: 3.4
|
7 |
Tested up to: 5.3
|
8 |
+
Stable tag: 1.0.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
12 |
+
A simple to use YouTube Feed plugin for displaying customizable YouTube feeds from any YouTube channel. All YouTube feeds are fast and responsive.
|
13 |
|
14 |
== Description ==
|
15 |
+
**Display customizable YouTube channel feeds on your website. Feed your YouTube channel content automatically to your website in powerful and customizable ways.**
|
16 |
|
17 |
### YouTube Feed Features
|
18 |
* **Completely Customizable** YouTube feeds - by default inherits your theme's styles
|
19 |
* **Completely responsive and mobile optimized** - your YouTube feeds look great on any screen size
|
20 |
+
* **Light and low overhead** - minimal bloat and optimized requests to YouTube
|
21 |
+
* **Multiple layouts** - display videos from any YouTube channel in a list, gallery, or grid layout
|
22 |
+
* **Multiple feeds** from different YouTube channels on multiple pages or widgets
|
23 |
+
* **Lightning fast** - post caching and minimized YouTube API requests means that your YouTube feed loads lightning fast
|
24 |
+
* **Infinitely load more** of your YouTube channel videos with the 'Load More' button
|
25 |
* Built-in easy to use "YouTube Feed" Widget
|
26 |
* Fully internationalized and translatable into any language
|
27 |
+
* Includes a header at the top of your YouTube channel feed
|
28 |
* Enter your own custom CSS or JavaScript for even deeper customization
|
29 |
|
30 |
+
For simple step-by-step directions on how to set up the Feeds for YouTube plugin please refer to our [setup guide](http://smashballoon.com/youtube-feed/free/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube channel setup guide').
|
31 |
|
32 |
### Benefits
|
33 |
+
* **Increase social engagement** between you and your YouTube channel subscribers
|
34 |
* **Save time** by using the Feeds for YouTube plugin to generate dynamic, search engine crawlable content on your website
|
35 |
+
* **Get more subscribers** to your channel by displaying your YouTube videos directly on your site
|
36 |
* Display your YouTube channel content **your way** to perfectly match your website's style
|
37 |
* The plugin is **updated regularly** with new features, bug-fixes and YouTube API changes
|
38 |
* Support is quick, effective, and always happy to help
|
39 |
* We're dedicated to providing the **most customizable**, **robust** and **well supported** YouTube feed plugin in the world!
|
40 |
|
41 |
### Feedback or Support
|
42 |
+
Customer support is a huge deal to us. We pride ourselves on always providing quick, effective, and courteous support to all of our users. If you're having an issue with our YouTube plugin then just let us know and we'll be there to help as soon as possible. You can either open a ticket on the support forum on [WordPress.org](https://wordpress.org/support/plugin/feeds-for-youtube/ "YouTube Feed Free support forum"), or directly on [our website](https://smashballoon.com/youtube-feed/support/ "YouTube channel Feed website support form").
|
43 |
|
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 channel Support') what the problem is and we'll get back to you right away.
|
45 |
|
46 |
### Pro Version (Feeds for YouTube Pro)
|
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 YouTube content in even more powerful ways:
|
75 |
|
76 |
### YouTube Feed Shortcode Settings
|
77 |
|
78 |
+
You can edit the settings globally for all YouTube feeds on your site using the plugin settings page, but if you want to change settings for specific YouTube channel feeds then you can do so by using the shortcode settings listed below:
|
79 |
|
80 |
**channel** - Display videos from a YouTube channel. Eg: [youtube-feed channel="smashballoon"]
|
81 |
+
**width** - The width of your YouTube channel feed. Any number with a unit like "px" or "%". Eg: [youtube-feed width="300px"]
|
82 |
+
**height** - The height of your YouTube channel feed. Any number with a unit like "px" or "em". Eg: [youtube-feed height="500px"]
|
83 |
+
**background** - Background color for your YouTube channel feed. Any hex color code. Eg: [youtube-feed background="#f00"]
|
84 |
+
**playvideo** - What the user needs to do to play a YouTube channel video: **onclick**, **automatically**. Eg: [youtube-feed playvideo="onclick"]
|
85 |
+
**layout** - How your YouTube channel videos are displayed visually. Eg: [youtube-feed layout="list"]
|
86 |
+
**num** - The number of YouTube videos in the channel feed. Eg: [youtube-feed num="5"]
|
87 |
+
**itemspacing** - The spacing/padding around the YouTube channel videos in the feed. Any number with a unit like "px" or "em". Eg: [youtube-feed itemspacing="5px"]
|
88 |
+
**showheader** - Include a header for this YouTube channel feed. Eg: [youtube-feed showheader="false"]
|
89 |
**showdescription** Include the channel description in the YouTube feed header. Eg: [youtube-feed showdescription="false"]
|
90 |
+
**showbutton** - Include a "Load More" button at the bottom of the feed to load more YouTube channel videos. Eg: [youtube-feed showbutton="false"]
|
91 |
+
**buttoncolor** - Background color for the "Load More" button at the bottom of the YouTube channel feed. Any hex color code Eg: [youtube-feed buttoncolor="#0f0"]
|
92 |
**buttontextcolor** - Text color for the "Load More" button. Any hex color code. Eg: [youtube-feed buttontextcolor="#00f"]
|
93 |
**buttontext** - The text that appers on the "Load More" button. Eg: [youtube-feed buttontext=""More Videos""]
|
94 |
+
**showsubscribe** - Include a "Subscribe" button at the bottom of the YouTube channel feed to load more YouTube videos. Eg: [youtube-feed showsubscribe="false"]
|
95 |
+
**subscribecolor** - Background color for the YouTube channel "Subscribe" button. Any hex color code. Eg: [youtube-feed subscribecolor="#0f0"]
|
96 |
+
**subscribetextcolor** - Text color for the YouTube channel "Subscribe" button. Any hex color code. Eg: [youtube-feed subscribetextcolor="#00f"]
|
97 |
+
**subscribetext** - The text that appers on the YouTube channel "Subscribe" button. Eg: [youtube-feed subscribetext=""Subscribe to My Channel""]
|
98 |
|
99 |
== Installation ==
|
100 |
1. Install the Feeds for YouTube plugin either via the WordPress plugin directory, or by uploading the files to your web server (in the /wp-content/plugins/ directory).
|
101 |
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
102 |
+
3. Navigate to the 'Feeds for YouTube' settings page to configure your YouTube channel feed.
|
103 |
+
4. Use the shortcode [youtube-feed] in your page, post or widget to display your YouTube channel feed.
|
104 |
5. You can display multiple YouTube channels with different configurations by specifying the necessary parameters directly in the shortcode: [youtube-feed channel=smashballoon].
|
105 |
|
106 |
+
For simple step-by-step directions on how to set up the Feeds for YouTube plugin please refer to our [setup guide](http://smashballoon.com/youtube-feed/free/?utm_source=wordpress&utm_campaign=sby 'Feeds for YouTube channel setup guide').
|
107 |
|
108 |
= Setting up the Free Feeds for YouTube WordPress Plugin =
|
109 |
|
119 |
|
120 |
5) Enter a YouTube channel name to display videos from.
|
121 |
|
122 |
+
6) Navigate to the Customize and Style pages to customize your YouTube channel feed.
|
123 |
|
124 |
+
7) Once you've customized your YouTube channel feed, click on the "Display Your Feed" tab for directions on how to display your YouTube feed (or multiple YouTube channel feeds).
|
125 |
|
126 |
+
8) Copy the [youtube-feed] shortcode and paste it into any page, post or widget where you want the YouTube channel feed to appear.
|
127 |
|
128 |
9) You can paste the [youtube-feed] shortcode directly into your page editor.
|
129 |
|
130 |
10) You can use the default WordPress 'Text' widget to display your Feeds for YouTube in a sidebar or other widget area.
|
131 |
|
132 |
+
11) View your website to see your YouTube channel feed(s) in all their glory!
|
133 |
|
134 |
== Frequently Asked Questions ==
|
135 |
|
136 |
+
= Can I display multiple YouTube channel feeds on my site or on the same page? =
|
137 |
|
138 |
Yep. You can display multiple YouTube feeds by using our built-in shortcode options, for example: `[youtube-feed channel="smashballoon" num=3]`.
|
139 |
|
140 |
+
= How do I embed a YouTube channel or gallery directly into a WordPress page template? =
|
141 |
|
142 |
+
You can embed your YouTube feed directly into a template file by using the WordPress [do_shortcode](http://codex.wordpress.org/Function_Reference/do_shortcode) function: `<?php echo do_shortcode('[youtube-feed]'); ?>`.
|
143 |
|
144 |
= Will Feeds for YouTube work with W3 Total Cache or other caching plugins? =
|
145 |
|
151 |
|
152 |
= How can I change the layout of my YouTube video feed? =
|
153 |
|
154 |
+
This free plugin has several layout options built into it. Use the settings in the following location to display your YouTube channel videos in a list, grid, or gallery layout: Feeds for YouTube > Customize > Layout. You can also change the spacing/padding between the YouTube videos by using the "Spacing between videos" setting in this same section.
|
155 |
|
156 |
= Can I select how many YouTube videos should be displayed in the feed? =
|
157 |
|
158 |
+
Yep, you can choose to display between 1-50 YouTube videos in your feed by using the following setting: Feeds for YouTube > Customize > Layout > Number of Videos. The plugin also contains a "Load More" button to allow you to infinitely load more YouTube channel videos into your feed.
|
159 |
|
160 |
= Will my YouTube gallery be responsive to accommodate mobile visitors? =
|
161 |
|
163 |
|
164 |
= Will videos from my YouTube channel be cached? =
|
165 |
|
166 |
+
Yes. The Feeds for YouTube plugin will cache all of the posts collected from the YouTube API. Your YouTube channel videos and information about your YouTube channel can then be retrieved and used for future page loads.
|
167 |
|
168 |
+
= How do I find the nickname or channel ID for different YouTube channels? =
|
169 |
|
170 |
You can display videos from any YouTube channel using the unique YouTube channel ID. This can be found by viewing the channel page on YouTube and looking at the end of the URL. ex: https://www.youtube.com/channel/UC1a2b3c4D5F6g7i8j9k. You can also use the channel nickname.
|
171 |
|
172 |
+
= How does the plugin retrieve my YouTube channel videos? =
|
173 |
|
174 |
The plugin connects to YouTube and requests data about videos from your YouTube channel in three ways: The RSS feed associated with each YouTube Channel, using the Smash Balloon app and the YouTube API, and using an API Key to connect to the YouTube API. The plugin uses each connection type in certain circumstances with the main concern of optimizing API calls overall.
|
175 |
|
176 |
= Will displaying my YouTube channel affect the time it takes to load the page? =
|
177 |
|
178 |
+
The Feeds for YouTube plugin had been designed to minimize the impact it has on page load time. For example, iframes for playing YouTube videos are not loaded until the feed is interacted with by a visitor. Thumbnails of your YouTube videos are the smallest resolution necessary relative to the size of the feed. Also, these video thumbnails are not loaded until the rest of the content on the page is loaded.
|
179 |
|
180 |
= How often do new videos from my YouTube channel appear in the YouTube gallery? =
|
181 |
|
182 |
+
By default, the plugin retrieves new YouTube videos for your YouTube gallery once every hour. You can reduce this to as little as 15 minutes if needed. You can even set your YouTube channel gallery to update using WordPress cron in the background so the caching process is not relying on the page with your YouTube gallery being visited.
|
183 |
|
184 |
== Screenshots ==
|
185 |
|
186 |
+
1. By default the Feeds for YouTube plugin inherits styles from your theme
|
187 |
+
2. Display multiple YouTube channel feeds and customize each one
|
188 |
3. When using the "grid" layout, YouTube videos open and play in a lightbox
|
189 |
4. Feeds for YouTube Settings pages
|
190 |
+
5. Built in customization settings make customizing your YouTube channel feed easy
|
191 |
+
6. Use handy shortcode options to customize individual YouTube channel feeds
|
192 |
+
7. To display a YouTube channel feed just copy and paste the [youtube-feed] shortcode into a widget or page
|
193 |
|
194 |
== Changelog ==
|
195 |
+
= 1.0.3 =
|
196 |
+
* Tweak: Changed tooltip and notes regarding how to display a YouTube feed from a certain YouTube channel.
|
197 |
+
* Fix: YouTube iframe JavaScript file was being loaded with HTTP. Changed to HTTPS.
|
198 |
+
* Fix: Prevented error if allow_url_fopen set to false in php.ini by changing how RSS channel feeds are retrieved from YouTube.
|
199 |
+
* Fix: Unable to view YouTube account details if more than one YouTube account connected.
|
200 |
+
|
201 |
= 1.0.2 =
|
202 |
+
* New: Changed the method used to update YouTube feeds to reduce YouTube channel API requests.
|
203 |
+
* Tweak: More YouTube posts cached in the wp_posts table when a YouTube API request is made.
|
204 |
+
* Tweak: YouTube channel data cached to reduce YouTube API requests.
|
205 |
+
* Fix: Error when deactivating and reactivating the Feeds for YouTube plugin with background caching enabled.
|
206 |
|
207 |
= 1.0.1 =
|
208 |
+
* Fix: Optimized API calls to YouTube to reduce requests.
|
209 |
* Fix: Minor bug fixes.
|
210 |
|
211 |
= 1.0 =
|
css/admin.css
CHANGED
@@ -270,7 +270,6 @@
|
|
270 |
#sbspf_admin .sbspf_connected_account .sbspf_ca_username span{
|
271 |
font-size: 10px;
|
272 |
font-weight: normal;
|
273 |
-
text-transform: uppercase;
|
274 |
padding: 0;
|
275 |
margin: 0;
|
276 |
display: block;
|
270 |
#sbspf_admin .sbspf_connected_account .sbspf_ca_username span{
|
271 |
font-size: 10px;
|
272 |
font-weight: normal;
|
|
|
273 |
padding: 0;
|
274 |
margin: 0;
|
275 |
display: block;
|
inc/admin/admin-functions.php
CHANGED
@@ -61,15 +61,16 @@ function sby_admin_init() {
|
|
61 |
'label' => __( 'Channel', SBY_TEXT_DOMAIN ),
|
62 |
'input_type' => 'text',
|
63 |
'default' => $first_channel_id,
|
64 |
-
'note' => __( 'Eg:
|
65 |
'tooltip' => '<p><ul>
|
66 |
<li><b>' . __( 'Channel ID or User Name', SBY_TEXT_DOMAIN ).'</b><br>
|
67 |
' . __( 'You can find the ID or User Name of your YouTube Channel from the URL. In each URL format, the text you need to use is highlighted below:', SBY_TEXT_DOMAIN ).'<br><br>
|
68 |
' . __( 'URL Format 1:', SBY_TEXT_DOMAIN ).' <code>https://www.youtube.com/channel/<span class="sbspf-highlight">UC1a2b3c4D5F6g7i8j9k</span></code>
|
69 |
<br>
|
70 |
' . __( 'URL Format 2:', SBY_TEXT_DOMAIN ).' <code>https://www.youtube.com/user/<span class="sbspf-highlight">your_user_name</span></code>
|
71 |
-
|
72 |
-
</ul
|
|
|
73 |
)
|
74 |
);
|
75 |
$admin->set_feed_types( $types );
|
61 |
'label' => __( 'Channel', SBY_TEXT_DOMAIN ),
|
62 |
'input_type' => 'text',
|
63 |
'default' => $first_channel_id,
|
64 |
+
'note' => __( 'Eg: Channel ID or User Name.', SBY_TEXT_DOMAIN ),
|
65 |
'tooltip' => '<p><ul>
|
66 |
<li><b>' . __( 'Channel ID or User Name', SBY_TEXT_DOMAIN ).'</b><br>
|
67 |
' . __( 'You can find the ID or User Name of your YouTube Channel from the URL. In each URL format, the text you need to use is highlighted below:', SBY_TEXT_DOMAIN ).'<br><br>
|
68 |
' . __( 'URL Format 1:', SBY_TEXT_DOMAIN ).' <code>https://www.youtube.com/channel/<span class="sbspf-highlight">UC1a2b3c4D5F6g7i8j9k</span></code>
|
69 |
<br>
|
70 |
' . __( 'URL Format 2:', SBY_TEXT_DOMAIN ).' <code>https://www.youtube.com/user/<span class="sbspf-highlight">your_user_name</span></code>
|
71 |
+
</li>
|
72 |
+
</ul>
|
73 |
+
<span class="sbspf_aside">Note that the "username" example is a legacy feature only available to older accounts.</span></p>'
|
74 |
)
|
75 |
);
|
76 |
$admin->set_feed_types( $types );
|
inc/admin/class-sby-admin.php
CHANGED
@@ -296,7 +296,8 @@ class SBY_Admin extends SB_YOUTUBE_Admin {
|
|
296 |
$args = array(
|
297 |
'title' => __( 'Advanced', $text_domain ),
|
298 |
'id' => 'sbspf_advanced',
|
299 |
-
'tab' => 'customize'
|
|
|
300 |
);
|
301 |
$this->add_settings_section( $args );
|
302 |
|
296 |
$args = array(
|
297 |
'title' => __( 'Advanced', $text_domain ),
|
298 |
'id' => 'sbspf_advanced',
|
299 |
+
'tab' => 'customize',
|
300 |
+
'save_after' => true
|
301 |
);
|
302 |
$this->add_settings_section( $args );
|
303 |
|
inc/class-sby-rss-connect.php
CHANGED
@@ -32,56 +32,69 @@ class SBY_RSS_Connect
|
|
32 |
}
|
33 |
|
34 |
public function connect() {
|
35 |
-
$
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
),
|
57 |
-
'
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
),
|
62 |
-
'
|
63 |
-
|
|
|
64 |
),
|
65 |
-
|
66 |
-
|
67 |
-
),
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
);
|
74 |
-
$this_item_array['statistics'] = array(
|
75 |
-
'viewCount' => (int) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->community->statistics->attributes()->views,
|
76 |
-
'starRating' => (float) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->community->starRating->attributes()->average,
|
77 |
-
);
|
78 |
-
$items_array[] = $this_item_array;
|
79 |
-
|
80 |
}
|
81 |
-
}
|
82 |
|
|
|
83 |
|
84 |
-
|
|
|
|
|
85 |
|
86 |
}
|
87 |
|
32 |
}
|
33 |
|
34 |
public function connect() {
|
35 |
+
$args = array(
|
36 |
+
'timeout' => 60,
|
37 |
+
'sslverify' => false
|
38 |
+
);
|
39 |
+
$response = wp_remote_get( esc_url_raw( $this->url ), $args );
|
40 |
+
|
41 |
+
if ( ! is_wp_error( $response ) ) {
|
42 |
+
// certain ways of representing the html for double quotes causes errors so replaced here.
|
43 |
+
$response = $response['body'];
|
44 |
+
|
45 |
+
$parsed_obj = simplexml_load_string( $response );
|
46 |
+
|
47 |
+
$items_array = array();
|
48 |
+
if ( isset( $parsed_obj->entry ) ) {
|
49 |
+
foreach ( $parsed_obj->entry as $video_xml ) {
|
50 |
+
|
51 |
+
$this_item_array = array();
|
52 |
+
|
53 |
+
$high_thumbnail_url = (string) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->thumbnail->attributes()->url;
|
54 |
+
|
55 |
+
$this_item_array['snippet'] = array(
|
56 |
+
'publishedAt' => (string) $video_xml->published,
|
57 |
+
'channelId' => (string) $video_xml->children( 'http://www.youtube.com/xml/schemas/2015' )->channelId,
|
58 |
+
'title' => (string) $video_xml->title,
|
59 |
+
'description' => (string) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->description,
|
60 |
+
'thumbnails' => array(
|
61 |
+
'default' => array(
|
62 |
+
'url' => (string) str_replace( 'hqdefault.jpg', 'default.jpg', $high_thumbnail_url ),
|
63 |
+
),
|
64 |
+
'medium' => array(
|
65 |
+
'url' => str_replace( 'hqdefault.jpg', 'mqdefault.jpg', $high_thumbnail_url ),
|
66 |
+
),
|
67 |
+
'high' => array(
|
68 |
+
'url' => $high_thumbnail_url,
|
69 |
+
'width' => (string) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->thumbnail->attributes()->width,
|
70 |
+
'height' => (string) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->thumbnail->attributes()->height,
|
71 |
+
),
|
72 |
+
'standard' => array(
|
73 |
+
'url' => str_replace( 'hqdefault.jpg', 'sddefault.jpg', $high_thumbnail_url ),
|
74 |
+
),
|
75 |
+
'maxres' => array(
|
76 |
+
'url' => str_replace( 'hqdefault.jpg', 'maxresdefault.jpg', $high_thumbnail_url ),
|
77 |
+
),
|
78 |
),
|
79 |
+
'channelTitle' => (string) $video_xml->author->name,
|
80 |
+
'resourceId' => array(
|
81 |
+
'videoId' => (string) $video_xml->children( 'http://www.youtube.com/xml/schemas/2015' )->videoId
|
82 |
),
|
83 |
+
);
|
84 |
+
$this_item_array['statistics'] = array(
|
85 |
+
'viewCount' => (int) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->community->statistics->attributes()->views,
|
86 |
+
'starRating' => (float) $video_xml->children( 'http://search.yahoo.com/mrss/' )->group->community->starRating->attributes()->average,
|
87 |
+
);
|
88 |
+
$items_array[] = $this_item_array;
|
89 |
+
|
90 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
|
|
92 |
|
93 |
+
$this->response = $items_array;
|
94 |
|
95 |
+
} else {
|
96 |
+
$this->response = $response;
|
97 |
+
}
|
98 |
|
99 |
}
|
100 |
|
js/admin.js
CHANGED
@@ -211,11 +211,11 @@
|
|
211 |
},
|
212 |
initInfoToggle: function(el) {
|
213 |
var self = this;
|
214 |
-
el.find('.'+self.plugin +'_ca_show_token').click(function() {
|
215 |
$(this).closest('.'+self.plugin +'_ca_info').find('.'+self.plugin +'_ca_accesstoken').slideToggle(200);
|
216 |
});
|
217 |
|
218 |
-
el.find('.'+self.plugin +'_ca_token_shortcode').click(function() {
|
219 |
$(this).closest('.'+self.plugin +'_ca_info').find('.'+self.plugin +'_ca_shortcode').slideToggle(200);
|
220 |
});
|
221 |
},
|
211 |
},
|
212 |
initInfoToggle: function(el) {
|
213 |
var self = this;
|
214 |
+
el.find('.'+self.plugin +'_ca_show_token').off().click(function() {
|
215 |
$(this).closest('.'+self.plugin +'_ca_info').find('.'+self.plugin +'_ca_accesstoken').slideToggle(200);
|
216 |
});
|
217 |
|
218 |
+
el.find('.'+self.plugin +'_ca_token_shortcode').off().click(function() {
|
219 |
$(this).closest('.'+self.plugin +'_ca_info').find('.'+self.plugin +'_ca_shortcode').slideToggle(200);
|
220 |
});
|
221 |
},
|
js/sb-youtube.js
CHANGED
@@ -52,7 +52,7 @@ if(!sby_js_exists) {
|
|
52 |
var tag = document.createElement("script");
|
53 |
var firstScript = document.getElementsByTagName("script")[0];
|
54 |
|
55 |
-
tag.src = "
|
56 |
tag.id = youtubeScriptId;
|
57 |
firstScript.parentNode.insertBefore(tag, firstScript);
|
58 |
|
52 |
var tag = document.createElement("script");
|
53 |
var firstScript = document.getElementsByTagName("script")[0];
|
54 |
|
55 |
+
tag.src = "https://www.youtube.com/iframe_api";
|
56 |
tag.id = youtubeScriptId;
|
57 |
firstScript.parentNode.insertBefore(tag, firstScript);
|
58 |
|
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(){this.feeds={},this.options=sbyOptions,this.isTouch=function(){if("ontouchstart"in document.documentElement)return!0;return!1}()}function t(e,i,t){this.el=e,this.index=i,this.settings=t,this.playerAPIReady=!1,this.consentGiven=!0,this.players={},this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.isInitialized=!1}function s(i,t){e.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:i,success:t})}i.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");if(null===document.getElementById("youtube-api")){var s=document.createElement("script"),a=document.getElementsByTagName("script")[0];s.src="http://www.youtube.com/iframe_api",s.id="youtube-api",a.parentNode.insertBefore(s,a)}i(t)},createLightbox:function(){(function(){var i=jQuery,t=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}(),s=function(){function t(e){this.options=e,this.album=[],this.currentImageIndex=void 0,this.init()}return t.prototype.init=function(){this.enable(),this.build()},t.prototype.enable=function(){var e=this;i("body").on("click","a[data-sby-lightbox]",function(t){return e.start(i(t.currentTarget)),!1})},t.prototype.build=function(){var e=this;i("<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' id='sby_lb-player'></div><div class='sby_lb-nav'><a class='sby_lb-prev' href='#' ><p class='sby-screenreader'>Previous Slide</p></a><a class='sby_lb-next' href='#' ><p class='sby-screenreader'>Next Slide</p></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 class='sby_lb-closeContainer'><a class='sby_lb-close'></a></div></div></div></div>").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&&window.sbyLightboxPlayer.pauseVideo(),jQuery("#sby_lightboxOverlay, #sby_lightbox").fadeOut())}),this.$lightbox.hide(),jQuery("#sby_lightboxOverlay").on("click",function(t){return void 0!==window.sbyLightboxPlayer&&window.sbyLightboxPlayer.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&&window.sbyLightboxPlayer.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&&window.sbyLightboxPlayer.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&&window.sbyLightboxPlayer.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&&window.sbyLightboxPlayer.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&&window.sbyLightboxPlayer.pauseVideo(),e.end(),!1})},t.prototype.start=function(e){function t(e){s.album.push({link:e.attr("href"),video:e.attr("data-video-id")})}var s=this,a=i(window);a.on("resize",i.proxy(this.sizeOverlay,this)),i("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var n,o=0,d=e.attr("data-sby-lightbox");if(d){n=i(e.prop("tagName")+'[data-sby-lightbox="'+d+'"]');for(var r=0;r<n.length;r=++r)t(i(n[r])),n[r]===e[0]&&(o=r)}else if("lightbox"===e.attr("rel"))t(e);else{n=i(e.prop("tagName")+'[rel="'+e.attr("rel")+'"]');for(var l=0;l<n.length;l=++l)t(i(n[l])),n[l]===e[0]&&(o=l)}var h=a.scrollTop()+this.options.positionFromTop,b=a.scrollLeft();this.$lightbox.css({top:h+"px",left:b+"px"}).fadeIn(this.options.fadeDuration),this.changeImage(o)},t.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,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},t.prototype.sizeOverlay=function(){this.$overlay.width(i(window).width()).height(i(document).height())},t.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()},t.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()},t.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"))))},t.prototype.updateDetails=function(){if(sby_supports_video()&&(jQuery("#sby_lightbox").removeClass("sby_video_lightbox"),this.album[this.currentImageIndex].video.length)){jQuery("#sby_lightbox").addClass("sby_video_lightbox");var e=this.album[this.currentImageIndex].video,i=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var t={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:e,playerVars:{modestbranding:1,rel:0,autoplay:i}};window.sbyLightboxPlayer=new window.YT.Player("sby_lb-player",t)}else window.sbyLightboxPlayer.loadVideoById(e)}},t.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)},t.prototype.enableKeyboardNav=function(){i(document).on("keyup.keyboard",i.proxy(this.keyboardAction,this))},t.prototype.disableKeyboardNav=function(){i(document).off(".keyboard")},t.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&&window.sbyLightboxPlayer.pauseVideo())},t.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"})},t}();i(function(){var i=new t;new s(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 a=e(this),n=void 0!==a.attr("data-sby-flags")?a.attr("data-sby-flags").split(","):[],o=void 0!==a.attr("data-options")?JSON.parse(a.attr("data-options")):{};if(n.indexOf("testAjax")>-1){window.sby.triggeredTest=!0;s({action:"sby_on_ajax_test_trigger"},function(e){console.log("did test")})}var d={cols:a.attr("data-cols"),colsmobile:"same"!==a.attr("data-colsmobile")?a.attr("data-colsmobile"):a.attr("data-cols"),num:a.attr("data-num"),imgRes:a.attr("data-res"),feedID:a.attr("data-feedid"),shortCodeAtts:a.attr("data-shortcode-atts"),resizingEnabled:-1===n.indexOf("resizeDisable"),imageLoadEnabled:-1===n.indexOf("imageLoadDisable"),debugEnabled:n.indexOf("debug")>-1,favorLocal:n.indexOf("favorLocal")>-1,ajaxPostLoad:n.indexOf("ajaxPostLoad")>-1,checkWPPosts:n.indexOf("checkWPPosts")>-1,cacheAll:n.indexOf("cacheAll")>-1,lightboxEnabled:void 0!==a.attr("data-sby-supports-lightbox"),autoMinRes:1,general:o};window.sby.feeds[i]=function(e,i,s){return new t(e,i,s)}(this,i,d),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,">").replace(/(<)/g,"<").replace(/(<br\/>)/g,"<br>").replace(/(<br>)/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)}},t.prototype={init:function(){var e=this;this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var i,t=(i=0,function(e,t){clearTimeout(i),i=setTimeout(e,t)});jQuery(window).resize(function(){t(function(){e.afterResize()},500)})},initLayout: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){i.preventDefault(),t.onThumbnailClick(e(this),!0)}),i.mouseenter(function(){t.canCreatePlayer()&&(i.find(".sby_player_outer_wrap iframe").length||(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)))}))},createPlayer:function(i,t,s,a){var n=e(this.el),o=this;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")})},onStateChange:function(i){1===i.data&&void 0!==o.players&&n.find(".sby_item").each(function(){var i=o.getVideoID(e(this));t!==i&&void 0!==o.players[i]&&o.players[i].pauseVideo()})}});var d=new window.YT.Player(i,a);return n.hasClass("sby_layout_list")&&void 0===this.players[t]?this.players[t]=d:void 0===this.player&&(this.player=d),d},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraItemsForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass()},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(),setTimeout(function(){i.find(".sby_loader").addClass("sby_hidden"),i.find(".sby_btn_text").removeClass("sby_hidden"),t.maybeRaiseImageResolution()},500)},beforeNewImagesRevealed:function(){this.setImageHeight(),this.maybeRaiseImageResolution(!0),this.setImageSizeClass()},revealNewImages:function(){var i=e(this.el),t=this;"function"==typeof sbyCustomJS&&setTimeout(function(){sbyCustomJS()},100),i.find(".sby_item").each(function(i){var s=jQuery(this);s.find(".sby_video_thumbnail").hover(function(){jQuery(this).fadeTo(200,.85)},function(){jQuery(this).stop().fadeTo(500,1)}),s.find(".sby_video_thumbnail").off().click(function(i){i.preventDefault(),t.onThumbnailClick(e(this),!1)}),s.find(".sby_video_thumbnail").mouseenter(function(){t.onThumbnailEnter(e(this),!1)}),s.find(".sby_player_wrap").mouseleave(function(){t.onThumbnailLeave(e(this),!1)}),t.settings.lightboxEnabled&&(s.find(".sby_video_thumbnail").attr("data-sby-lightbox",t.index),"undefined"!=typeof sbyOptions&&void 0!==sbyOptions.lightboxPlaceholder&&s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholder))}),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)},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;s({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.cacheAll){s({action:"sby_check_wp_submit",feed_id:i.settings.feedID,atts:i.settings.shortCodeAtts,offset:e(this.el).find(".sby_item").length,cache_all:i.settings.cacheAll},function(e){if(0===e.trim().indexOf("{")){var t=JSON.parse(e);i.settings.debugEnabled&&console.log(t)}})}},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;s({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);t.settings.debugEnabled&&console.log(a),void 0!==a.feedStatus.cacheAll&&a.feedStatus.cacheAll?t.settings.cacheAll=!0:t.settings.cacheAll=!1,void 0!==a.feedStatus.checkWPPosts&&a.feedStatus.checkWPPosts?t.settings.checkWPPosts=!0:t.settings.checkWPPosts=!1,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")){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===window.sby.options.placeholder||s){if(a.settings.debugEnabled){var h=o===window.sby.options.placeholder?"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("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;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>120&&n<240?i.addClass("sby_medium"):n<=120&&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(e){if(e.hasClass("sby_item")||e.hasClass("sby_player_item")){if(void 0!==e.find(".sby_video_thumbnail").attr("data-video-id"))return e.find(".sby_video_thumbnail").attr("data-video-id")}else if(e.closest("sby_item").length||e.closest("sby_player_item").length){var i=e.closest("sby_item").length?e.closest("sby_item"):e.closest("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(e.hasClass("sb_youtube"))return e.find(".sby_item").first().find(".sby_video_thumbnail").attr("data-video-id");return console.log("no id"),""},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)},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){if(this.canCreatePlayer()){var s=e(this.el);if(s.hasClass("sby_layout_gallery"))s.addClass("sby_player_added").find(".sby_player_outer_wrap").addClass("sby_player_loading"),s.find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").show().removeClass("sby_hidden"),s.find(".sby_player_outer_wrap iframe").length?t?this.playVideoInPlayer(this.getVideoID(s.find(".sby_item").first())):(this.playVideoInPlayer(this.getVideoID(i.closest(".sby_item"))),this.afterVideoChanged()):t?this.createPlayer("sby_player"+this.index):this.createPlayer("sby_player"+this.index,this.getVideoID(i.closest(".sby_item")));else if(e(this.el).hasClass("sby_layout_grid")){var a=i.closest(".sby_item"),n=this.getVideoID(a);this.playVideoInPlayer(n),this.afterVideoChanged()}else if(e(this.el).hasClass("sby_layout_list")){a=i.closest(".sby_item"),n=this.getVideoID(a);a.find("iframe").length||(a.find(".sby_loader").show().removeClass("sby_hidden"),a.addClass("sby_player_loading sby_player_loaded"),this.createPlayer("sby_player_"+n,n))}}},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){},canCreatePlayer:function(){return this.playerAPIReady&&this.consentGiven},playVideoInPlayer:function(e){void 0!==this.player&&void 0!==this.player.loadVideoById&&this.player.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))}},window.sby_init=function(){window.sby=new i,window.sby.createPage(window.sby.createFeeds,{whenFeedsCreated:window.sby.afterFeedsCreated})}}(jQuery),jQuery(document).ready(function(e){sby_init()})}window.onYouTubeIframeAPIReady=function(){var e=document.getElementsByClassName("sb_youtube").length;if(e>0)for(var i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0};
|
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(){this.feeds={},this.options=sbyOptions,this.isTouch=function(){if("ontouchstart"in document.documentElement)return!0;return!1}()}function t(e,i,t){this.el=e,this.index=i,this.settings=t,this.playerAPIReady=!1,this.consentGiven=!0,this.players={},this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.isInitialized=!1}function s(i,t){e.ajax({url:sbyOptions.adminAjaxUrl,type:"post",data:i,success:t})}i.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");if(null===document.getElementById("youtube-api")){var s=document.createElement("script"),a=document.getElementsByTagName("script")[0];s.src="https://www.youtube.com/iframe_api",s.id="youtube-api",a.parentNode.insertBefore(s,a)}i(t)},createLightbox:function(){(function(){var i=jQuery,t=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}(),s=function(){function t(e){this.options=e,this.album=[],this.currentImageIndex=void 0,this.init()}return t.prototype.init=function(){this.enable(),this.build()},t.prototype.enable=function(){var e=this;i("body").on("click","a[data-sby-lightbox]",function(t){return e.start(i(t.currentTarget)),!1})},t.prototype.build=function(){var e=this;i("<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' id='sby_lb-player'></div><div class='sby_lb-nav'><a class='sby_lb-prev' href='#' ><p class='sby-screenreader'>Previous Slide</p></a><a class='sby_lb-next' href='#' ><p class='sby-screenreader'>Next Slide</p></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 class='sby_lb-closeContainer'><a class='sby_lb-close'></a></div></div></div></div>").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&&window.sbyLightboxPlayer.pauseVideo(),jQuery("#sby_lightboxOverlay, #sby_lightbox").fadeOut())}),this.$lightbox.hide(),jQuery("#sby_lightboxOverlay").on("click",function(t){return void 0!==window.sbyLightboxPlayer&&window.sbyLightboxPlayer.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&&window.sbyLightboxPlayer.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&&window.sbyLightboxPlayer.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&&window.sbyLightboxPlayer.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&&window.sbyLightboxPlayer.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&&window.sbyLightboxPlayer.pauseVideo(),e.end(),!1})},t.prototype.start=function(e){function t(e){s.album.push({link:e.attr("href"),video:e.attr("data-video-id")})}var s=this,a=i(window);a.on("resize",i.proxy(this.sizeOverlay,this)),i("select, object, embed").css({visibility:"hidden"}),this.sizeOverlay(),this.album=[];var n,o=0,d=e.attr("data-sby-lightbox");if(d){n=i(e.prop("tagName")+'[data-sby-lightbox="'+d+'"]');for(var r=0;r<n.length;r=++r)t(i(n[r])),n[r]===e[0]&&(o=r)}else if("lightbox"===e.attr("rel"))t(e);else{n=i(e.prop("tagName")+'[rel="'+e.attr("rel")+'"]');for(var l=0;l<n.length;l=++l)t(i(n[l])),n[l]===e[0]&&(o=l)}var h=a.scrollTop()+this.options.positionFromTop,b=a.scrollLeft();this.$lightbox.css({top:h+"px",left:b+"px"}).fadeIn(this.options.fadeDuration),this.changeImage(o)},t.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,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},t.prototype.sizeOverlay=function(){this.$overlay.width(i(window).width()).height(i(document).height())},t.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()},t.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()},t.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"))))},t.prototype.updateDetails=function(){if(sby_supports_video()&&(jQuery("#sby_lightbox").removeClass("sby_video_lightbox"),this.album[this.currentImageIndex].video.length)){jQuery("#sby_lightbox").addClass("sby_video_lightbox");var e=this.album[this.currentImageIndex].video,i=sbyOptions.autoplay;if(void 0===window.sbyLightboxPlayer){var t={host:window.location.protocol+"//www.youtube-nocookie.com",videoId:e,playerVars:{modestbranding:1,rel:0,autoplay:i}};window.sbyLightboxPlayer=new window.YT.Player("sby_lb-player",t)}else window.sbyLightboxPlayer.loadVideoById(e)}},t.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)},t.prototype.enableKeyboardNav=function(){i(document).on("keyup.keyboard",i.proxy(this.keyboardAction,this))},t.prototype.disableKeyboardNav=function(){i(document).off(".keyboard")},t.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&&window.sbyLightboxPlayer.pauseVideo())},t.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"})},t}();i(function(){var i=new t;new s(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 a=e(this),n=void 0!==a.attr("data-sby-flags")?a.attr("data-sby-flags").split(","):[],o=void 0!==a.attr("data-options")?JSON.parse(a.attr("data-options")):{};if(n.indexOf("testAjax")>-1){window.sby.triggeredTest=!0;s({action:"sby_on_ajax_test_trigger"},function(e){console.log("did test")})}var d={cols:a.attr("data-cols"),colsmobile:"same"!==a.attr("data-colsmobile")?a.attr("data-colsmobile"):a.attr("data-cols"),num:a.attr("data-num"),imgRes:a.attr("data-res"),feedID:a.attr("data-feedid"),shortCodeAtts:a.attr("data-shortcode-atts"),resizingEnabled:-1===n.indexOf("resizeDisable"),imageLoadEnabled:-1===n.indexOf("imageLoadDisable"),debugEnabled:n.indexOf("debug")>-1,favorLocal:n.indexOf("favorLocal")>-1,ajaxPostLoad:n.indexOf("ajaxPostLoad")>-1,checkWPPosts:n.indexOf("checkWPPosts")>-1,cacheAll:n.indexOf("cacheAll")>-1,lightboxEnabled:void 0!==a.attr("data-sby-supports-lightbox"),autoMinRes:1,general:o};window.sby.feeds[i]=function(e,i,s){return new t(e,i,s)}(this,i,d),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,">").replace(/(<)/g,"<").replace(/(<br\/>)/g,"<br>").replace(/(<br>)/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)}},t.prototype={init:function(){var e=this;this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var i,t=(i=0,function(e,t){clearTimeout(i),i=setTimeout(e,t)});jQuery(window).resize(function(){t(function(){e.afterResize()},500)})},initLayout: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){i.preventDefault(),t.onThumbnailClick(e(this),!0)}),i.mouseenter(function(){t.canCreatePlayer()&&(i.find(".sby_player_outer_wrap iframe").length||(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)))}))},createPlayer:function(i,t,s,a){var n=e(this.el),o=this;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")})},onStateChange:function(i){1===i.data&&void 0!==o.players&&n.find(".sby_item").each(function(){var i=o.getVideoID(e(this));t!==i&&void 0!==o.players[i]&&o.players[i].pauseVideo()})}});var d=new window.YT.Player(i,a);return n.hasClass("sby_layout_list")&&void 0===this.players[t]?this.players[t]=d:void 0===this.player&&(this.player=d),d},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraItemsForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass()},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(),setTimeout(function(){i.find(".sby_loader").addClass("sby_hidden"),i.find(".sby_btn_text").removeClass("sby_hidden"),t.maybeRaiseImageResolution()},500)},beforeNewImagesRevealed:function(){this.setImageHeight(),this.maybeRaiseImageResolution(!0),this.setImageSizeClass()},revealNewImages:function(){var i=e(this.el),t=this;"function"==typeof sbyCustomJS&&setTimeout(function(){sbyCustomJS()},100),i.find(".sby_item").each(function(i){var s=jQuery(this);s.find(".sby_video_thumbnail").hover(function(){jQuery(this).fadeTo(200,.85)},function(){jQuery(this).stop().fadeTo(500,1)}),s.find(".sby_video_thumbnail").off().click(function(i){i.preventDefault(),t.onThumbnailClick(e(this),!1)}),s.find(".sby_video_thumbnail").mouseenter(function(){t.onThumbnailEnter(e(this),!1)}),s.find(".sby_player_wrap").mouseleave(function(){t.onThumbnailLeave(e(this),!1)}),t.settings.lightboxEnabled&&(s.find(".sby_video_thumbnail").attr("data-sby-lightbox",t.index),"undefined"!=typeof sbyOptions&&void 0!==sbyOptions.lightboxPlaceholder&&s.find(".sby_video_thumbnail").attr("href",sbyOptions.lightboxPlaceholder))}),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)},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;s({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.cacheAll){s({action:"sby_check_wp_submit",feed_id:i.settings.feedID,atts:i.settings.shortCodeAtts,offset:e(this.el).find(".sby_item").length,cache_all:i.settings.cacheAll},function(e){if(0===e.trim().indexOf("{")){var t=JSON.parse(e);i.settings.debugEnabled&&console.log(t)}})}},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;s({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);t.settings.debugEnabled&&console.log(a),void 0!==a.feedStatus.cacheAll&&a.feedStatus.cacheAll?t.settings.cacheAll=!0:t.settings.cacheAll=!1,void 0!==a.feedStatus.checkWPPosts&&a.feedStatus.checkWPPosts?t.settings.checkWPPosts=!0:t.settings.checkWPPosts=!1,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")){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===window.sby.options.placeholder||s){if(a.settings.debugEnabled){var h=o===window.sby.options.placeholder?"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("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;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>120&&n<240?i.addClass("sby_medium"):n<=120&&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(e){if(e.hasClass("sby_item")||e.hasClass("sby_player_item")){if(void 0!==e.find(".sby_video_thumbnail").attr("data-video-id"))return e.find(".sby_video_thumbnail").attr("data-video-id")}else if(e.closest("sby_item").length||e.closest("sby_player_item").length){var i=e.closest("sby_item").length?e.closest("sby_item"):e.closest("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(e.hasClass("sb_youtube"))return e.find(".sby_item").first().find(".sby_video_thumbnail").attr("data-video-id");return console.log("no id"),""},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)},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){if(this.canCreatePlayer()){var s=e(this.el);if(s.hasClass("sby_layout_gallery"))s.addClass("sby_player_added").find(".sby_player_outer_wrap").addClass("sby_player_loading"),s.find(".sby_player_outer_wrap .sby_video_thumbnail").find(".sby_loader").show().removeClass("sby_hidden"),s.find(".sby_player_outer_wrap iframe").length?t?this.playVideoInPlayer(this.getVideoID(s.find(".sby_item").first())):(this.playVideoInPlayer(this.getVideoID(i.closest(".sby_item"))),this.afterVideoChanged()):t?this.createPlayer("sby_player"+this.index):this.createPlayer("sby_player"+this.index,this.getVideoID(i.closest(".sby_item")));else if(e(this.el).hasClass("sby_layout_grid")){var a=i.closest(".sby_item"),n=this.getVideoID(a);this.playVideoInPlayer(n),this.afterVideoChanged()}else if(e(this.el).hasClass("sby_layout_list")){a=i.closest(".sby_item"),n=this.getVideoID(a);a.find("iframe").length||(a.find(".sby_loader").show().removeClass("sby_hidden"),a.addClass("sby_player_loading sby_player_loaded"),this.createPlayer("sby_player_"+n,n))}}},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){},canCreatePlayer:function(){return this.playerAPIReady&&this.consentGiven},playVideoInPlayer:function(e){void 0!==this.player&&void 0!==this.player.loadVideoById&&this.player.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))}},window.sby_init=function(){window.sby=new i,window.sby.createPage(window.sby.createFeeds,{whenFeedsCreated:window.sby.afterFeedsCreated})}}(jQuery),jQuery(document).ready(function(e){sby_init()})}window.onYouTubeIframeAPIReady=function(){var e=document.getElementsByClassName("sb_youtube").length;if(e>0)for(var i=0;i<e;i++)window.sby.feeds[i].playerAPIReady=!0};
|
youtube-feed.php
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
/*
|
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
|
6 |
-
Version: 1.0.
|
7 |
-
Author: Smash Balloon
|
8 |
Author URI: http://smashballoon.com/
|
9 |
Text Domain: feeds-for-youtube
|
10 |
*/
|
@@ -26,7 +26,7 @@ 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.0.
|
30 |
}
|
31 |
if ( ! defined( 'SBY_DBVERSION' ) ) {
|
32 |
define( 'SBY_DBVERSION', 1.1 );
|
2 |
/*
|
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.0.3
|
7 |
+
Author: Smash Balloon YouTube Team
|
8 |
Author URI: http://smashballoon.com/
|
9 |
Text Domain: feeds-for-youtube
|
10 |
*/
|
26 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
27 |
|
28 |
if ( ! defined( 'SBYVER' ) ) {
|
29 |
+
define( 'SBYVER', '1.0.3' );
|
30 |
}
|
31 |
if ( ! defined( 'SBY_DBVERSION' ) ) {
|
32 |
define( 'SBY_DBVERSION', 1.1 );
|