Version Description
- Fix:The plugin will no longer continue to attempt to connect to the Instagram API if there is an access token encryption error.
- Fix: Added a content type to JSON responses to improve reliability for loading more posts and creating local images.
Download this release
Release Info
Developer | smashballoon |
Plugin | Instagram Feed |
Version | 2.9.9 |
Comparing to | |
See all releases |
Code changes from version 2.9.8 to 2.9.9
- README.txt +5 -1
- inc/class-sb-instagram-api-connect.php +7 -3
- inc/if-functions.php +2 -0
- instagram-feed.php +2 -2
- js/sb-instagram-2-2.js +1079 -1075
- js/sb-instagram-2-2.min.js +1 -1
- js/sbi-scripts.js +1079 -1075
- js/sbi-scripts.min.js +1 -1
README.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: smashballoon, craig-at-smash-balloon
|
|
3 |
Tags: Instagram, Instagram feed, Instagram photos, Instagram widget, Instagram gallery
|
4 |
Requires at least: 3.4
|
5 |
Tested up to: 5.8
|
6 |
-
Stable tag: 2.9.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -331,6 +331,10 @@ We understand that sometimes you need help, have issues or just have questions.
|
|
331 |
* Plus more customization options added all the time!
|
332 |
|
333 |
== Changelog ==
|
|
|
|
|
|
|
|
|
334 |
= 2.9.8 =
|
335 |
* Tweak: Added a warning if the access token could not be decrypted for use in API requests.
|
336 |
* Tweak: Added a fallback method to reach the Instagram API if a cURL error 6 error is detected.
|
3 |
Tags: Instagram, Instagram feed, Instagram photos, Instagram widget, Instagram gallery
|
4 |
Requires at least: 3.4
|
5 |
Tested up to: 5.8
|
6 |
+
Stable tag: 2.9.9
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
331 |
* Plus more customization options added all the time!
|
332 |
|
333 |
== Changelog ==
|
334 |
+
= 2.9.9 =
|
335 |
+
* Fix: The plugin will no longer continue to attempt to connect to the Instagram API if there is an access token encryption error.
|
336 |
+
* Fix: Added a content type to JSON responses to improve reliability for loading more posts and creating local images.
|
337 |
+
|
338 |
= 2.9.8 =
|
339 |
* Tweak: Added a warning if the access token could not be decrypted for use in API requests.
|
340 |
* Tweak: Added a fallback method to reach the Instagram API if a cURL error 6 error is detected.
|
inc/class-sb-instagram-api-connect.php
CHANGED
@@ -106,7 +106,7 @@ class SB_Instagram_API_Connect
|
|
106 |
*
|
107 |
* @since 2.2.2/5.3.3
|
108 |
*/
|
109 |
-
public function type_allows_after_paging(
|
110 |
return false;
|
111 |
}
|
112 |
|
@@ -119,13 +119,13 @@ class SB_Instagram_API_Connect
|
|
119 |
*
|
120 |
* @since 2.0/5.0
|
121 |
*/
|
122 |
-
public function get_next_page(
|
123 |
if ( ! empty( $this->response['pagination']['next_url'] ) ) {
|
124 |
return $this->response['pagination']['next_url'];
|
125 |
} elseif ( ! empty( $this->response['paging']['next'] ) ) {
|
126 |
return $this->response['paging']['next'];
|
127 |
} else {
|
128 |
-
if ( $this->type_allows_after_paging(
|
129 |
if ( isset( $this->response['paging']['cursors']['after'] ) ) {
|
130 |
return $this->response['paging']['cursors']['after'];
|
131 |
}
|
@@ -186,6 +186,10 @@ class SB_Instagram_API_Connect
|
|
186 |
* @since 2.0/5.0
|
187 |
*/
|
188 |
public function connect() {
|
|
|
|
|
|
|
|
|
189 |
$args = array(
|
190 |
'timeout' => 20,
|
191 |
);
|
106 |
*
|
107 |
* @since 2.2.2/5.3.3
|
108 |
*/
|
109 |
+
public function type_allows_after_paging() {
|
110 |
return false;
|
111 |
}
|
112 |
|
119 |
*
|
120 |
* @since 2.0/5.0
|
121 |
*/
|
122 |
+
public function get_next_page() {
|
123 |
if ( ! empty( $this->response['pagination']['next_url'] ) ) {
|
124 |
return $this->response['pagination']['next_url'];
|
125 |
} elseif ( ! empty( $this->response['paging']['next'] ) ) {
|
126 |
return $this->response['paging']['next'];
|
127 |
} else {
|
128 |
+
if ( $this->type_allows_after_paging() ) {
|
129 |
if ( isset( $this->response['paging']['cursors']['after'] ) ) {
|
130 |
return $this->response['paging']['cursors']['after'];
|
131 |
}
|
186 |
* @since 2.0/5.0
|
187 |
*/
|
188 |
public function connect() {
|
189 |
+
if ( empty( $this->url ) ) {
|
190 |
+
$this->response = array();
|
191 |
+
return;
|
192 |
+
}
|
193 |
$args = array(
|
194 |
'timeout' => 20,
|
195 |
);
|
inc/if-functions.php
CHANGED
@@ -343,6 +343,7 @@ function sbi_get_next_post_set() {
|
|
343 |
'resizedImages' => SB_Instagram_Feed::get_resized_images_source_set( $instagram_feed->get_image_ids_post_set(), 1, $feed_id )
|
344 |
);
|
345 |
|
|
|
346 |
echo sbi_json_encode( $return );
|
347 |
|
348 |
die();
|
@@ -435,6 +436,7 @@ function sbi_process_submitted_resize_ids() {
|
|
435 |
global $sb_instagram_posts_manager;
|
436 |
|
437 |
if ( ! $sb_instagram_posts_manager->image_resizing_disabled() ) {
|
|
|
438 |
echo sbi_json_encode( SB_Instagram_Feed::get_resized_images_source_set( $settings['minnum'], $offset - $settings['minnum'], $feed_id ) );
|
439 |
die();
|
440 |
}
|
343 |
'resizedImages' => SB_Instagram_Feed::get_resized_images_source_set( $instagram_feed->get_image_ids_post_set(), 1, $feed_id )
|
344 |
);
|
345 |
|
346 |
+
header( 'Content-Type: application/json; charset=utf-8' );
|
347 |
echo sbi_json_encode( $return );
|
348 |
|
349 |
die();
|
436 |
global $sb_instagram_posts_manager;
|
437 |
|
438 |
if ( ! $sb_instagram_posts_manager->image_resizing_disabled() ) {
|
439 |
+
header( 'Content-Type: application/json; charset=utf-8' );
|
440 |
echo sbi_json_encode( SB_Instagram_Feed::get_resized_images_source_set( $settings['minnum'], $offset - $settings['minnum'], $feed_id ) );
|
441 |
die();
|
442 |
}
|
instagram-feed.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Smash Balloon Instagram Feed
|
4 |
Plugin URI: https://smashballoon.com/instagram-feed
|
5 |
Description: Display beautifully clean, customizable, and responsive Instagram feeds.
|
6 |
-
Version: 2.9.
|
7 |
Author: Smash Balloon
|
8 |
Author URI: https://smashballoon.com/
|
9 |
License: GPLv2 or later
|
@@ -23,7 +23,7 @@ along with this program; if not, write to the Free Software
|
|
23 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
24 |
*/
|
25 |
if ( ! defined( 'SBIVER' ) ) {
|
26 |
-
define( 'SBIVER', '2.9.
|
27 |
}
|
28 |
// Db version.
|
29 |
if ( ! defined( 'SBI_DBVERSION' ) ) {
|
3 |
Plugin Name: Smash Balloon Instagram Feed
|
4 |
Plugin URI: https://smashballoon.com/instagram-feed
|
5 |
Description: Display beautifully clean, customizable, and responsive Instagram feeds.
|
6 |
+
Version: 2.9.9
|
7 |
Author: Smash Balloon
|
8 |
Author URI: https://smashballoon.com/
|
9 |
License: GPLv2 or later
|
23 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
24 |
*/
|
25 |
if ( ! defined( 'SBIVER' ) ) {
|
26 |
+
define( 'SBIVER', '2.9.9' );
|
27 |
}
|
28 |
// Db version.
|
29 |
if ( ! defined( 'SBI_DBVERSION' ) ) {
|
js/sb-instagram-2-2.js
CHANGED
@@ -1,1142 +1,1146 @@
|
|
1 |
var sbi_js_exists = (typeof sbi_js_exists !== 'undefined') ? true : false;
|
2 |
if(!sbi_js_exists) {
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
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 |
-
if (c.data("oldSrc") && c.data("oldSrc") !== c.attr("src")) {
|
64 |
-
var a = c.clone().removeAttr("style");
|
65 |
-
return a.data("sbi_imgLiquid_settings", c.data("sbi_imgLiquid_settings")), c.parent().prepend(a), c.remove(), c = a, c[0].width = 0, void setTimeout(o, 10)
|
66 |
-
}
|
67 |
-
return c.data("sbi_imgLiquid_oldProcessed") ? void r() : (c.data("sbi_imgLiquid_oldProcessed", !1), c.data("oldSrc", c.attr("src")), i("img:not(:first)", u).css("display", "none"), u.css({overflow: "hidden"}), c.fadeTo(0, 0).removeAttr("width").removeAttr("height").css({
|
68 |
-
visibility: "visible",
|
69 |
-
"max-width": "none",
|
70 |
-
"max-height": "none",
|
71 |
-
width: "auto",
|
72 |
-
height: "auto",
|
73 |
-
display: "block"
|
74 |
-
}), c.on("error", n), c[0].onerror = n, e(), void d())
|
75 |
-
}
|
76 |
-
|
77 |
-
function d() {
|
78 |
-
(g.responsive || c.data("sbi_imgLiquid_oldProcessed")) && c.data("sbi_imgLiquid_settings") && (g = c.data("sbi_imgLiquid_settings"), u.actualSize = u.get(0).offsetWidth + u.get(0).offsetHeight / 1e4, u.sizeOld && u.actualSize !== u.sizeOld && r(), u.sizeOld = u.actualSize, setTimeout(d, g.responsiveCheckTime))
|
79 |
-
}
|
80 |
-
|
81 |
-
function n() {
|
82 |
-
c.data("sbi_imgLiquid_error", !0), u.addClass("sbi_imgLiquid_error"), g.onItemError && g.onItemError(t, u, c), l()
|
83 |
-
}
|
84 |
-
|
85 |
-
function s() {
|
86 |
-
var i = {};
|
87 |
-
if (a.settings.useDataHtmlAttr) {
|
88 |
-
var t = u.attr("data-sbi_imgLiquid-fill"),
|
89 |
-
e = u.attr("data-sbi_imgLiquid-horizontalAlign"),
|
90 |
-
o = u.attr("data-sbi_imgLiquid-verticalAlign");
|
91 |
-
("true" === t || "false" === t) && (i.fill = Boolean("true" === t)), void 0 === e || "left" !== e && "center" !== e && "right" !== e && -1 === e.indexOf("%") || (i.horizontalAlign = e), void 0 === o || "top" !== o && "bottom" !== o && "center" !== o && -1 === o.indexOf("%") || (i.verticalAlign = o)
|
92 |
-
}
|
93 |
-
return sbi_imgLiquid.isIE && a.settings.ieFadeInDisabled && (i.fadeInTime = 0), i
|
94 |
-
}
|
95 |
-
|
96 |
-
function r() {
|
97 |
-
var i, e, a, o, d, n, s, r, m = 0, h = 0, f = u.width(), v = u.height();
|
98 |
-
void 0 === c.data("owidth") && c.data("owidth", c[0].width), void 0 === c.data("oheight") && c.data("oheight", c[0].height), g.fill === f / v >= c.data("owidth") / c.data("oheight") ? (i = "100%", e = "auto", a = Math.floor(f), o = Math.floor(f * (c.data("oheight") / c.data("owidth")))) : (i = "auto", e = "100%", a = Math.floor(v * (c.data("owidth") / c.data("oheight"))), o = Math.floor(v)), d = g.horizontalAlign.toLowerCase(), s = f - a, "left" === d && (h = 0), "center" === d && (h = .5 * s), "right" === d && (h = s), -1 !== d.indexOf("%") && (d = parseInt(d.replace("%", ""), 10), d > 0 && (h = s * d * .01)), n = g.verticalAlign.toLowerCase(), r = v - o, "left" === n && (m = 0), "center" === n && (m = .5 * r), "bottom" === n && (m = r), -1 !== n.indexOf("%") && (n = parseInt(n.replace("%", ""), 10), n > 0 && (m = r * n * .01)), g.hardPixels && (i = a, e = o), c.css({
|
99 |
-
width: i,
|
100 |
-
height: e,
|
101 |
-
"margin-left": Math.floor(h),
|
102 |
-
"margin-top": Math.floor(m)
|
103 |
-
}), c.data("sbi_imgLiquid_oldProcessed") || (c.fadeTo(g.fadeInTime, 1), c.data("sbi_imgLiquid_oldProcessed", !0), g.removeBoxBackground && u.css("background-image", "none"), u.addClass("sbi_imgLiquid_nobgSize"), u.addClass("sbi_imgLiquid_ready")), g.onItemFinish && g.onItemFinish(t, u, c), l()
|
104 |
-
}
|
105 |
-
|
106 |
-
function l() {
|
107 |
-
t === a.length - 1 && a.settings.onFinish && a.settings.onFinish()
|
108 |
-
}
|
109 |
-
|
110 |
-
var g = a.settings, u = i(this), c = i("img:first", u);
|
111 |
-
return c.length ? (c.data("sbi_imgLiquid_settings") ? (u.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"), g = i.extend({}, c.data("sbi_imgLiquid_settings"), a.options)) : g = i.extend({}, a.settings, s()), c.data("sbi_imgLiquid_settings", g), g.onItemStart && g.onItemStart(t, u, c), void (sbi_imgLiquid.bgs_Available && g.useBackgroundSize ? e() : o())) : void n()
|
112 |
-
})
|
113 |
-
}
|
114 |
-
})
|
115 |
-
}(jQuery);
|
116 |
-
|
117 |
-
// Use imagefill to set the images as backgrounds so they can be square
|
118 |
-
!function () {
|
119 |
-
var css = sbi_imgLiquid.injectCss,
|
120 |
-
head = document.getElementsByTagName('head')[0],
|
121 |
-
style = document.createElement('style');
|
122 |
-
style.type = 'text/css';
|
123 |
-
if (style.styleSheet) {
|
124 |
-
style.styleSheet.cssText = css;
|
125 |
-
} else {
|
126 |
-
style.appendChild(document.createTextNode(css));
|
127 |
}
|
128 |
-
head.appendChild(style);
|
129 |
-
}();
|
130 |
-
}
|
131 |
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
var n = {runOnLoad: !0, frequency: 100, sbiPreviousVisibility: null
|
136 |
-
}, c = {};
|
137 |
-
c.sbiCheckVisibility = function (i, n) {
|
138 |
-
if (jQuery.contains(document, i[0])) {
|
139 |
-
var e = n.sbiPreviousVisibility, t = i.is(":visible");
|
140 |
-
n.sbiPreviousVisibility = t, null == e ? n.runOnLoad && n.callback(i, t) : e !== t && n.callback(i, t), setTimeout(function () {
|
141 |
-
c.sbiCheckVisibility(i, n)
|
142 |
-
}, n.frequency)
|
143 |
-
}
|
144 |
-
}, i.fn.sbiVisibilityChanged = function (e) {
|
145 |
-
var t = i.extend({}, n, e);
|
146 |
-
return this.each(function () {
|
147 |
-
c.sbiCheckVisibility(i(this), t)
|
148 |
-
})
|
149 |
}
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
}
|
152 |
|
153 |
-
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
var evt = jQuery.Event('sbiafterfeedcreate');
|
211 |
-
evt.feed = window.sbi.feeds[index];
|
212 |
-
jQuery(window).trigger(evt);
|
213 |
-
|
214 |
-
})
|
215 |
-
);
|
216 |
-
},
|
217 |
-
afterFeedsCreated: function () {
|
218 |
-
// enable header hover action
|
219 |
-
$('.sb_instagram_header').each(function () {
|
220 |
-
var $thisHeader = $(this);
|
221 |
-
$thisHeader.find('.sbi_header_link').on('mouseenter mouseleave', function(e) {
|
222 |
-
switch(e.type) {
|
223 |
-
case 'mouseenter':
|
224 |
-
$thisHeader.find('.sbi_header_img_hover').addClass('sbi_fade_in');
|
225 |
-
break;
|
226 |
-
case 'mouseleave':
|
227 |
-
$thisHeader.find('.sbi_header_img_hover').removeClass('sbi_fade_in');
|
228 |
-
break;
|
229 |
-
}
|
230 |
-
});
|
231 |
-
});
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
}
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
}
|
251 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
}
|
265 |
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
//Photo links
|
350 |
-
$self.find('.sbi_photo').on('mouseenter mouseleave', function(e) {
|
351 |
-
switch(e.type) {
|
352 |
-
case 'mouseenter':
|
353 |
-
jQuery(this).fadeTo(200, 0.85);
|
354 |
-
break;
|
355 |
-
case 'mouseleave':
|
356 |
-
jQuery(this).stop().fadeTo(500, 1);
|
357 |
-
break;
|
358 |
-
}
|
359 |
-
});
|
360 |
-
}); //End .sbi_item each
|
361 |
-
|
362 |
-
//Remove the new class after 500ms, once the sorting is done
|
363 |
-
setTimeout(function () {
|
364 |
-
jQuery('#sbi_images .sbi_item.sbi_new').removeClass('sbi_new');
|
365 |
-
//Loop through items and remove class to reveal them
|
366 |
-
var time = 10;
|
367 |
-
$self.find('.sbi_transition').each(function() {
|
368 |
-
var $sbi_item_transition_el = jQuery(this);
|
369 |
-
|
370 |
-
setTimeout( function(){
|
371 |
-
$sbi_item_transition_el.removeClass('sbi_transition');
|
372 |
-
}, time);
|
373 |
-
time += 10;
|
374 |
-
});
|
375 |
-
}, 500);
|
376 |
-
},
|
377 |
-
lazyLoadCheck: function($item){
|
378 |
-
var feed = this;
|
379 |
-
if ($item.find('.sbi_photo').length && !$item.closest('.sbi').hasClass('sbi-no-ll-check')) {
|
380 |
-
var imgSrcSet = feed.getImageUrls($item),
|
381 |
-
maxResImage = typeof imgSrcSet[640] !== 'undefined' ? imgSrcSet[640] : $item.find('.sbi_photo').attr('data-full-res');
|
382 |
-
|
383 |
-
if (!feed.settings.consentGiven) {
|
384 |
-
if (maxResImage.indexOf('scontent') > -1) {
|
385 |
-
return;
|
386 |
-
}
|
387 |
-
}
|
388 |
-
|
389 |
-
$item.find('.sbi_photo img').each(function() {
|
390 |
-
if (maxResImage && typeof $(this).attr('data-src') !== 'undefined') {
|
391 |
-
$(this).attr('data-src',maxResImage);
|
392 |
-
}
|
393 |
-
if (maxResImage && typeof $(this).attr('data-orig-src') !== 'undefined') {
|
394 |
-
$(this).attr('data-orig-src',maxResImage);
|
395 |
-
}
|
396 |
-
$(this).on('load',function() {
|
397 |
-
if (!$(this).hasClass('sbi-replaced')
|
398 |
-
&& $(this).attr('src').indexOf('placeholder') > -1) {
|
399 |
-
$(this).addClass('sbi-replaced');
|
400 |
-
if (maxResImage) {
|
401 |
-
$(this).attr('src',maxResImage);
|
402 |
-
if ($(this).closest('.sbi_imgLiquid_bgSize').length) {
|
403 |
-
$(this).closest('.sbi_imgLiquid_bgSize').css('background-image', 'url(' + maxResImage + ')');
|
404 |
-
}
|
405 |
-
}
|
406 |
-
}
|
407 |
-
});
|
408 |
-
});
|
409 |
-
}
|
410 |
-
},
|
411 |
-
afterNewImagesRevealed: function() {
|
412 |
-
this.listenForVisibilityChange();
|
413 |
-
this.sendNeedsResizingToServer();
|
414 |
-
if (!this.settings.imageLoadEnabled) {
|
415 |
-
$('.sbi_no_resraise').removeClass('sbi_no_resraise');
|
416 |
-
}
|
417 |
-
|
418 |
-
var evt = $.Event('sbiafterimagesloaded');
|
419 |
-
evt.el = $(this.el);
|
420 |
-
$(window).trigger(evt);
|
421 |
-
},
|
422 |
-
setResizedImages: function () {
|
423 |
-
if ($(this.el).find('.sbi_resized_image_data').length
|
424 |
-
&& typeof $(this.el).find('.sbi_resized_image_data').attr('data-resized') !== 'undefined'
|
425 |
-
&& $(this.el).find('.sbi_resized_image_data').attr('data-resized').indexOf('{"') === 0) {
|
426 |
-
this.resizedImages = JSON.parse($(this.el).find('.sbi_resized_image_data').attr('data-resized'));
|
427 |
-
$(this.el).find('.sbi_resized_image_data').remove();
|
428 |
-
}
|
429 |
-
},
|
430 |
-
sendNeedsResizingToServer: function() {
|
431 |
-
var feed = this,
|
432 |
-
$self = $(this.el);
|
433 |
-
if (feed.needsResizing.length > 0 && feed.settings.resizingEnabled) {
|
434 |
-
var itemOffset = $(this.el).find('.sbi_item').length,
|
435 |
-
cacheAll = typeof feed.settings.general.cache_all !== 'undefined' ? feed.settings.general.cache_all : false;
|
436 |
-
var locatorNonce = '';
|
437 |
-
if ( typeof $self.attr( 'data-locatornonce' ) !== 'undefined' ) {
|
438 |
-
locatorNonce = $self.attr( 'data-locatornonce' );
|
439 |
-
}
|
440 |
-
var submitData = {
|
441 |
-
action: 'sbi_resized_images_submit',
|
442 |
-
needs_resizing: feed.needsResizing,
|
443 |
-
offset: itemOffset,
|
444 |
-
feed_id: feed.settings.feedID,
|
445 |
-
atts: feed.settings.shortCodeAtts,
|
446 |
-
location: feed.locationGuess(),
|
447 |
-
post_id: feed.settings.postID,
|
448 |
-
cache_all: cacheAll,
|
449 |
-
locator_nonce: locatorNonce
|
450 |
-
};
|
451 |
-
var onSuccess = function(data) {
|
452 |
-
if (data.trim().indexOf('{') === 0) {
|
453 |
-
var response = JSON.parse(data);
|
454 |
-
if (feed.settings.debugEnabled) {
|
455 |
-
console.log(response);
|
456 |
-
}
|
457 |
-
for (var property in response) {
|
458 |
-
if (response.hasOwnProperty(property)) {
|
459 |
-
feed.resizedImages[property] = response[property];
|
460 |
-
}
|
461 |
-
}
|
462 |
-
feed.maybeRaiseImageResolution();
|
463 |
-
|
464 |
-
setTimeout(function() {
|
465 |
-
feed.afterResize();
|
466 |
-
},500);
|
467 |
-
}
|
468 |
-
};
|
469 |
-
sbiAjax(submitData,onSuccess);
|
470 |
-
} else if (feed.settings.locator) {
|
471 |
-
var locatorNonce = '';
|
472 |
-
if ( typeof $self.attr( 'data-locatornonce' ) !== 'undefined' ) {
|
473 |
-
locatorNonce = $self.attr( 'data-locatornonce' );
|
474 |
-
}
|
475 |
-
var submitData = {
|
476 |
-
action: 'sbi_do_locator',
|
477 |
-
feed_id: feed.settings.feedID,
|
478 |
-
atts: feed.settings.shortCodeAtts,
|
479 |
-
location: feed.locationGuess(),
|
480 |
-
post_id: feed.settings.postID,
|
481 |
-
locator_nonce: locatorNonce
|
482 |
-
};
|
483 |
-
var onSuccess = function(data) {
|
484 |
-
console.log('done.');
|
485 |
-
};
|
486 |
-
sbiAjax(submitData,onSuccess);
|
487 |
-
}
|
488 |
-
},
|
489 |
-
loadMoreButtonInit: function () {
|
490 |
-
var $self = $(this.el),
|
491 |
-
feed = this;
|
492 |
-
$self.find('#sbi_load .sbi_load_btn').off().on('click', function () {
|
493 |
|
494 |
-
|
495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
|
|
508 |
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
}
|
542 |
-
$('.sbi_no_js').removeClass('sbi_no_js');
|
543 |
-
}
|
544 |
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
var sbi_num_cols = this.getColumnCount();
|
568 |
-
|
569 |
-
//Figure out what the width should be using the number of cols
|
570 |
-
//Figure out what the width should be using the number of cols
|
571 |
-
var imagesPadding = $self.find('#sbi_images').innerWidth() - $self.find('#sbi_images').width(),
|
572 |
-
imagepadding = imagesPadding / 2,
|
573 |
-
sbi_photo_width_manual = ( $self.find('#sbi_images').width() / sbi_num_cols ) - imagesPadding;
|
574 |
-
//If the width is less than it should be then set it manually
|
575 |
-
//if( sbi_photo_width <= (sbi_photo_width_manual) ) sbi_photo_width = sbi_photo_width_manual;
|
576 |
-
|
577 |
-
$self.find('.sbi_photo').css('height', sbi_photo_width);
|
578 |
-
|
579 |
-
//Set the position of the carousel arrows
|
580 |
-
if ($self.find('.sbi-owl-nav').length) {
|
581 |
-
setTimeout(function(){
|
582 |
-
//If there's 2 rows then adjust position
|
583 |
-
var sbi_ratio = 2;
|
584 |
-
if( $self.find('.sbi_owl2row-item').length ) sbi_ratio = 1;
|
585 |
-
|
586 |
-
var sbi_arrows_top = ($self.find('.sbi_photo').eq(0).innerWidth()/sbi_ratio);
|
587 |
-
sbi_arrows_top += parseInt(imagepadding)*(2+(2-sbi_ratio));
|
588 |
-
$self.find('.sbi-owl-nav div').css('top', sbi_arrows_top);
|
589 |
-
}, 100);
|
590 |
}
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
return;
|
604 |
}
|
605 |
|
606 |
-
if (
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
return;
|
611 |
-
} else if ($item.find('.sbi_link_area').length && $item.find('.sbi_link_area').attr('href') === window.sbi.options.placeholder.replace('placeholder.png','thumb-placeholder.png')
|
612 |
-
|| !feed.settings.consentGiven) {
|
613 |
-
$item.find('.sbi_link_area').attr('href',imgSrcSet[imgSrcSet.length - 1])
|
614 |
}
|
615 |
-
if (
|
616 |
-
|
|
|
|
|
|
|
617 |
}
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
// If the image has already been changed to an existing real source, don't force the change
|
623 |
-
forceChange = false;
|
624 |
-
}
|
625 |
-
});
|
626 |
-
//Image res
|
627 |
-
var newRes = 640;
|
628 |
-
switch (feed.settings.imgRes) {
|
629 |
-
case 'thumb':
|
630 |
-
newRes = 150;
|
631 |
-
break;
|
632 |
-
case 'medium':
|
633 |
-
newRes = 320;
|
634 |
-
break;
|
635 |
-
case 'full':
|
636 |
-
newRes = 640;
|
637 |
-
break;
|
638 |
-
default:
|
639 |
-
var minImageWidth = Math.max(feed.settings.autoMinRes,$item.find('.sbi_photo').innerWidth()),
|
640 |
-
thisImageReplace = feed.getBestResolutionForAuto(minImageWidth, aspectRatio, $item);
|
641 |
-
switch (thisImageReplace) {
|
642 |
-
case 320:
|
643 |
-
newRes = 320;
|
644 |
-
break;
|
645 |
-
case 150:
|
646 |
-
newRes = 150;
|
647 |
-
break;
|
648 |
-
}
|
649 |
-
break;
|
650 |
}
|
|
|
|
|
|
|
651 |
|
652 |
-
if (newRes > currentRes || currentUrl === window.sbi.options.placeholder || forceChange) {
|
653 |
-
if (feed.settings.debugEnabled) {
|
654 |
-
var reason = currentUrl === window.sbi.options.placeholder ? 'was placeholder' : 'too small';
|
655 |
-
console.log('rais res for ' + currentUrl, reason);
|
656 |
-
}
|
657 |
-
var newUrl = imgSrcSet[newRes].split("?ig_cache_key")[0];
|
658 |
-
if (currentUrl !== newUrl) {
|
659 |
-
$item.find('.sbi_photo img').attr('src', newUrl);
|
660 |
-
$item.find('.sbi_photo').css('background-image', 'url("' + newUrl + '")');
|
661 |
-
}
|
662 |
-
currentRes = newRes;
|
663 |
-
|
664 |
-
if (feed.settings.imgRes === 'auto') {
|
665 |
-
var checked = false;
|
666 |
-
$item.find('.sbi_photo img').on('load', function () {
|
667 |
-
|
668 |
-
var $this_image = $(this);
|
669 |
-
var newAspectRatio = ($this_image.get(0).naturalWidth / $this_image.get(0).naturalHeight);
|
670 |
-
|
671 |
-
if ($this_image.get(0).naturalWidth !== 1000 && newAspectRatio > aspectRatio && !checked) {
|
672 |
-
if (feed.settings.debugEnabled) {
|
673 |
-
console.log('rais res again for aspect ratio change ' + currentUrl);
|
674 |
-
}
|
675 |
-
checked = true;
|
676 |
-
minImageWidth = $item.find('.sbi_photo').innerWidth();
|
677 |
-
thisImageReplace = feed.getBestResolutionForAuto(minImageWidth, newAspectRatio, $item);
|
678 |
-
newRes = 640;
|
679 |
-
|
680 |
-
switch (thisImageReplace) {
|
681 |
-
case 320:
|
682 |
-
newRes = 320;
|
683 |
-
break;
|
684 |
-
case 150:
|
685 |
-
newRes = 150;
|
686 |
-
break;
|
687 |
-
}
|
688 |
-
|
689 |
-
if (newRes > currentRes) {
|
690 |
-
newUrl = imgSrcSet[newRes].split("?ig_cache_key")[0];
|
691 |
-
$this_image.attr('src', newUrl);
|
692 |
-
$this_image.closest('.sbi_photo').css('background-image', 'url("' + newUrl + '")');
|
693 |
-
}
|
694 |
-
if (feed.layout === 'masonry' || feed.layout === 'highlight') {
|
695 |
-
$(feed.el).find('#sbi_images').smashotope(feed.isotopeArgs);
|
696 |
-
setTimeout(function() {
|
697 |
-
$(feed.el).find('#sbi_images').smashotope(feed.isotopeArgs);
|
698 |
-
},500)
|
699 |
-
}
|
700 |
-
} else {
|
701 |
-
if (feed.settings.debugEnabled) {
|
702 |
-
var reason = checked ? 'already checked' : 'no aspect ratio change';
|
703 |
-
console.log('not raising res for replacement ' + currentUrl, reason);
|
704 |
-
}
|
705 |
-
}
|
706 |
-
});
|
707 |
-
}
|
708 |
|
|
|
709 |
|
710 |
-
|
|
|
|
|
|
|
711 |
|
712 |
-
|
713 |
-
if (!$(this).hasClass('sbi_img_error')) {
|
714 |
-
$(this).addClass('sbi_img_error');
|
715 |
-
var sourceFromAPI = ($(this).attr('src').indexOf('media/?size=') > -1 || $(this).attr('src').indexOf('cdninstagram') > -1 || $(this).attr('src').indexOf('fbcdn') > -1)
|
716 |
-
|
717 |
-
if (!sourceFromAPI && feed.settings.consentGiven) {
|
718 |
-
|
719 |
-
if ($(this).closest('.sbi_photo').attr('data-img-src-set') !== 'undefined') {
|
720 |
-
var srcSet = JSON.parse($(this).closest('.sbi_photo').attr('data-img-src-set').replace(/\\\//g, '/'));
|
721 |
-
if (typeof srcSet.d !== 'undefined') {
|
722 |
-
$(this).attr('src', srcSet.d);
|
723 |
-
$(this).closest('.sbi_photo').css('background-image', 'url(' + srcSet.d + ')');
|
724 |
-
$(this).closest('.sbi_item').addClass('sbi_had_error').find('.sbi_link_area').attr('href', srcSet[640]).addClass('sbi_had_error');
|
725 |
-
}
|
726 |
-
}
|
727 |
-
} else {
|
728 |
-
feed.settings.favorLocal = true;
|
729 |
-
var srcSet = feed.getImageUrls($(this).closest('.sbi_item'));
|
730 |
-
if (typeof srcSet[640] !== 'undefined') {
|
731 |
-
$(this).attr('src', srcSet[640]);
|
732 |
-
$(this).closest('.sbi_photo').css('background-image', 'url(' + srcSet[640] + ')');
|
733 |
-
$(this).closest('.sbi_item').addClass('sbi_had_error').find('.sbi_link_area').attr('href', srcSet[640]).addClass('sbi_had_error');
|
734 |
-
}
|
735 |
-
}
|
736 |
-
setTimeout(function() {
|
737 |
-
feed.afterResize();
|
738 |
-
}, 1500)
|
739 |
-
} else {
|
740 |
-
console.log('unfixed error ' + $(this).attr('src'));
|
741 |
-
}
|
742 |
-
});
|
743 |
-
},
|
744 |
-
maybeRaiseImageResolution: function (justNew) {
|
745 |
-
var feed = this,
|
746 |
-
itemsSelector = typeof justNew !== 'undefined' && justNew === true ? '.sbi_item.sbi_new' : '.sbi_item',
|
747 |
-
forceChange = !feed.isInitialized ? true : false;
|
748 |
-
$(feed.el).find(itemsSelector).each(function (index) {
|
749 |
-
if (!$(this).hasClass('sbi_num_diff_hide')
|
750 |
-
&& $(this).find('.sbi_photo').length
|
751 |
-
&& typeof $(this).find('.sbi_photo').attr('data-img-src-set') !== 'undefined') {
|
752 |
-
feed.maybeRaiseSingleImageResolution($(this),index,forceChange);
|
753 |
-
}
|
754 |
-
}); //End .sbi_item each
|
755 |
-
feed.isInitialized = true;
|
756 |
-
},
|
757 |
-
getBestResolutionForAuto: function(colWidth, aspectRatio, $item) {
|
758 |
-
if (isNaN(aspectRatio) || aspectRatio < 1) {
|
759 |
-
aspectRatio = 1;
|
760 |
-
}
|
761 |
-
var bestWidth = colWidth * aspectRatio,
|
762 |
-
bestWidthRounded = Math.ceil(bestWidth / 10) * 10,
|
763 |
-
customSizes = [150, 320, 640];
|
764 |
|
765 |
-
|
766 |
-
|
|
|
|
|
|
|
|
|
767 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
768 |
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
if (item > parseInt(bestWidthRounded) && !done) {
|
773 |
-
bestWidthRounded = item;
|
774 |
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
|
|
779 |
|
780 |
-
|
781 |
-
}
|
782 |
-
|
783 |
-
|
784 |
-
return;
|
785 |
-
}
|
786 |
-
var $self = $(this.el),
|
787 |
-
num = typeof $self.attr('data-num') !== 'undefined' && $self.attr('data-num') !== '' ? parseInt($self.attr('data-num')) : 1,
|
788 |
-
nummobile = typeof $self.attr('data-nummobile') !== 'undefined' && $self.attr('data-nummobile') !== '' ? parseInt($self.attr('data-nummobile')) : num;
|
789 |
-
|
790 |
-
if ($(window).width() < 480) {
|
791 |
-
if (nummobile < $self.find('.sbi_item').length) {
|
792 |
-
$self.find('.sbi_item').slice(nummobile - $self.find('.sbi_item').length).addClass('sbi_num_diff_hide');
|
793 |
-
}
|
794 |
-
} else {
|
795 |
-
if (num < $self.find('.sbi_item').length) {
|
796 |
-
$self.find('.sbi_item').slice(num - $self.find('.sbi_item').length).addClass('sbi_num_diff_hide');
|
797 |
-
}
|
798 |
-
}
|
799 |
-
},
|
800 |
-
setImageSizeClass: function () {
|
801 |
-
var $self = $(this.el);
|
802 |
-
$self.removeClass('sbi_small sbi_medium');
|
803 |
-
var feedWidth = $self.innerWidth(),
|
804 |
-
photoPadding = parseInt(($self.find('#sbi_images').outerWidth() - $self.find('#sbi_images').width())) / 2,
|
805 |
-
cols = this.getColumnCount(),
|
806 |
-
feedWidthSansPadding = feedWidth - (photoPadding * (cols+2)),
|
807 |
-
colWidth = (feedWidthSansPadding / cols);
|
808 |
-
if (colWidth > 120 && colWidth < 240) {
|
809 |
-
$self.addClass('sbi_medium');
|
810 |
-
} else if (colWidth <= 120) {
|
811 |
-
$self.addClass('sbi_small');
|
812 |
-
}
|
813 |
-
},
|
814 |
-
setMinImageWidth: function () {
|
815 |
-
if ($(this.el).find('.sbi_item .sbi_photo').first().length) {
|
816 |
-
this.minImageWidth = $(this.el).find('.sbi_item .sbi_photo').first().innerWidth();
|
817 |
-
} else {
|
818 |
-
this.minImageWidth = 150;
|
819 |
-
}
|
820 |
-
},
|
821 |
-
setImageResolution: function () {
|
822 |
-
if (this.settings.imgRes === 'auto') {
|
823 |
-
this.imageResolution = 'auto';
|
824 |
-
} else {
|
825 |
-
switch (this.settings.imgRes) {
|
826 |
-
case 'thumb':
|
827 |
-
this.imageResolution = 150;
|
828 |
-
break;
|
829 |
-
case 'medium':
|
830 |
-
this.imageResolution = 320;
|
831 |
-
break;
|
832 |
-
default:
|
833 |
-
this.imageResolution = 640;
|
834 |
-
}
|
835 |
-
}
|
836 |
-
},
|
837 |
-
getImageUrls: function ($item) {
|
838 |
-
var srcSet = JSON.parse($item.find('.sbi_photo').attr('data-img-src-set').replace(/\\\//g, '/')),
|
839 |
-
id = $item.attr('id').replace('sbi_', '');
|
840 |
-
if (!this.settings.consentGiven && !this.settings.overrideBlockCDN) {
|
841 |
-
srcSet = [];
|
842 |
-
}
|
843 |
-
if (typeof this.resizedImages[id] !== 'undefined'
|
844 |
-
&& this.resizedImages[id] !== 'video'
|
845 |
-
&& this.resizedImages[id] !== 'pending'
|
846 |
-
&& this.resizedImages[id].id !== 'error'
|
847 |
-
&& this.resizedImages[id].id !== 'video'
|
848 |
-
&& this.resizedImages[id].id !== 'pending') {
|
849 |
-
|
850 |
-
if (typeof this.resizedImages[id]['sizes'] !== 'undefined') {
|
851 |
-
var foundSizes = [];
|
852 |
-
if (typeof this.resizedImages[id]['sizes']['full'] !== 'undefined') {
|
853 |
-
srcSet[640] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
854 |
-
foundSizes.push(640);
|
855 |
-
}
|
856 |
-
if (typeof this.resizedImages[id]['sizes']['low'] !== 'undefined') {
|
857 |
-
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
858 |
-
foundSizes.push(320);
|
859 |
-
}
|
860 |
-
if (typeof this.resizedImages[id]['sizes']['thumb'] !== 'undefined') {
|
861 |
-
foundSizes.push(150);
|
862 |
-
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'thumb.jpg';
|
863 |
-
}
|
864 |
-
if (this.settings.favorLocal) {
|
865 |
-
if (foundSizes.indexOf(640) === -1) {
|
866 |
-
if (foundSizes.indexOf(320) > -1) {
|
867 |
-
srcSet[640] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
868 |
-
}
|
869 |
-
}
|
870 |
-
if (foundSizes.indexOf(320) === -1) {
|
871 |
-
if (foundSizes.indexOf(640) > -1) {
|
872 |
-
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
873 |
-
} else if (foundSizes.indexOf(150) > -1) {
|
874 |
-
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'thumb.jpg';
|
875 |
-
}
|
876 |
-
}
|
877 |
-
if (foundSizes.indexOf(150) === -1) {
|
878 |
-
if (foundSizes.indexOf(320) > -1) {
|
879 |
-
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
880 |
-
} else if (foundSizes.indexOf(640) > -1) {
|
881 |
-
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
882 |
-
}
|
883 |
-
}
|
884 |
-
}
|
885 |
-
}
|
886 |
-
} else if (typeof this.resizedImages[id] === 'undefined'
|
887 |
-
|| (typeof this.resizedImages[id]['id'] !== 'undefined' && this.resizedImages[id]['id'] !== 'pending' && this.resizedImages[id]['id'] !== 'error')) {
|
888 |
-
this.addToNeedsResizing(id);
|
889 |
-
}
|
890 |
-
|
891 |
-
return srcSet;
|
892 |
-
},
|
893 |
-
getAvatarUrl: function (username,favorType) {
|
894 |
-
if (username === '') {
|
895 |
-
return '';
|
896 |
-
}
|
897 |
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
942 |
}
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
sbiWindowWidth = window.innerWidth;
|
950 |
-
|
951 |
-
if ($self.hasClass('sbi_mob_col_auto')) {
|
952 |
-
if (sbiWindowWidth < 640 && (parseInt(cols) > 2 && parseInt(cols) < 7)) returnCols = 2;
|
953 |
-
if (sbiWindowWidth < 640 && (parseInt(cols) > 6 && parseInt(cols) < 11)) returnCols = 4;
|
954 |
-
if (sbiWindowWidth <= 480 && parseInt(cols) > 2) returnCols = 1;
|
955 |
-
} else if (sbiWindowWidth <= 480) {
|
956 |
-
returnCols = colsmobile;
|
957 |
}
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
if (
|
963 |
-
|
964 |
}
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
if (CLI_Cookie.read('cookielawinfo-checkbox-necessary') !== null) {
|
974 |
-
this.settings.consentGiven = CLI_Cookie.read('cookielawinfo-checkbox-necessary') === 'yes';
|
975 |
-
}
|
976 |
-
}
|
977 |
-
|
978 |
-
} else if (typeof window.cnArgs !== "undefined") { // Cookie Notice by dFactory
|
979 |
-
var value = "; " + document.cookie,
|
980 |
-
parts = value.split( '; cookie_notice_accepted=' );
|
981 |
-
|
982 |
-
if ( parts.length === 2 ) {
|
983 |
-
var val = parts.pop().split( ';' ).shift();
|
984 |
-
|
985 |
-
this.settings.consentGiven = (val === 'true');
|
986 |
-
}
|
987 |
-
} else if (typeof window.cookieconsent !== 'undefined') { // Complianz by Really Simple Plugins
|
988 |
-
this.settings.consentGiven = sbiCmplzGetCookie('complianz_consent_status') === 'allow';
|
989 |
-
} else if (typeof window.Cookiebot !== "undefined") { // Cookiebot by Cybot A/S
|
990 |
-
this.settings.consentGiven = Cookiebot.consented;
|
991 |
-
} else if (typeof window.BorlabsCookie !== 'undefined') { // Borlabs Cookie by Borlabs
|
992 |
-
this.settings.consentGiven = window.BorlabsCookie.checkCookieConsent('instagram');
|
993 |
-
}
|
994 |
-
|
995 |
-
var evt = jQuery.Event('sbicheckconsent');
|
996 |
-
evt.feed = this;
|
997 |
-
jQuery(window).trigger(evt);
|
998 |
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
setTimeout(function() {
|
1007 |
-
feed.afterResize();
|
1008 |
-
},500);
|
1009 |
-
}
|
1010 |
-
},
|
1011 |
-
locationGuess: function() {
|
1012 |
-
var $feed = $(this.el),
|
1013 |
-
location = 'content';
|
1014 |
-
|
1015 |
-
if ($feed.closest('footer').length) {
|
1016 |
-
location = 'footer';
|
1017 |
-
} else if ($feed.closest('.header').length
|
1018 |
-
|| $feed.closest('header').length) {
|
1019 |
-
location = 'header';
|
1020 |
-
} else if ($feed.closest('.sidebar').length
|
1021 |
-
|| $feed.closest('aside').length) {
|
1022 |
-
location = 'sidebar';
|
1023 |
-
}
|
1024 |
|
1025 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1026 |
},
|
1027 |
-
|
1028 |
-
|
1029 |
-
window.sbi_init = function() {
|
1030 |
-
window.sbi = new Sbi();
|
1031 |
-
window.sbi.createPage( window.sbi.createFeeds, {whenFeedsCreated: window.sbi.afterFeedsCreated});
|
1032 |
-
};
|
1033 |
-
|
1034 |
-
function sbiGetNewFeed(feed,index,feedOptions) {
|
1035 |
-
return new SbiFeed(feed,index,feedOptions);
|
1036 |
}
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1045 |
}
|
1046 |
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
|
|
|
|
|
|
|
|
|
|
1050 |
|
1051 |
-
//
|
1052 |
-
|
1053 |
-
|
1054 |
-
//If the name is the cookie string at position 0, we found the cookie and return the cookie value
|
1055 |
-
if (c.indexOf(name) == 0)
|
1056 |
-
return c.substring(name.length, c.length);
|
1057 |
}
|
1058 |
|
1059 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1060 |
}
|
1061 |
|
1062 |
-
|
|
|
|
|
1063 |
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
|
|
|
|
|
|
1071 |
}
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1078 |
}
|
1079 |
-
sbi_init();
|
1080 |
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1088 |
});
|
|
|
|
|
1089 |
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
});
|
1096 |
-
},1000);
|
1097 |
});
|
|
|
|
|
1098 |
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
});
|
1106 |
-
},1000);
|
1107 |
});
|
|
|
|
|
1108 |
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
});
|
1140 |
});
|
|
|
1141 |
|
1142 |
-
} // if sbi_js_exists
|
1 |
var sbi_js_exists = (typeof sbi_js_exists !== 'undefined') ? true : false;
|
2 |
if(!sbi_js_exists) {
|
3 |
+
(function($){
|
4 |
+
|
5 |
+
function sbiAddImgLiquid() {
|
6 |
+
/*! imgLiquid v0.9.944 / 03-05-2013 https://github.com/karacas/imgLiquid */
|
7 |
+
var sbi_imgLiquid = sbi_imgLiquid || {VER: "0.9.944"};
|
8 |
+
sbi_imgLiquid.bgs_Available = !1, sbi_imgLiquid.bgs_CheckRunned = !1, function (i) {
|
9 |
+
function t() {
|
10 |
+
if (!sbi_imgLiquid.bgs_CheckRunned) {
|
11 |
+
sbi_imgLiquid.bgs_CheckRunned = !0;
|
12 |
+
var t = i('<span style="background-size:cover" />');
|
13 |
+
i("body").append(t), !function () {
|
14 |
+
var i = t[0];
|
15 |
+
if (i && window.getComputedStyle) {
|
16 |
+
var e = window.getComputedStyle(i, null);
|
17 |
+
e && e.backgroundSize && (sbi_imgLiquid.bgs_Available = "cover" === e.backgroundSize)
|
18 |
+
}
|
19 |
+
}(), t.remove()
|
20 |
+
}
|
21 |
+
}
|
22 |
|
23 |
+
i.fn.extend({
|
24 |
+
sbi_imgLiquid: function (e) {
|
25 |
+
this.defaults = {
|
26 |
+
fill: !0,
|
27 |
+
verticalAlign: "center",
|
28 |
+
horizontalAlign: "center",
|
29 |
+
useBackgroundSize: !0,
|
30 |
+
useDataHtmlAttr: !0,
|
31 |
+
responsive: !0,
|
32 |
+
delay: 0,
|
33 |
+
fadeInTime: 0,
|
34 |
+
removeBoxBackground: !0,
|
35 |
+
hardPixels: !0,
|
36 |
+
responsiveCheckTime: 500,
|
37 |
+
timecheckvisibility: 500,
|
38 |
+
onStart: null,
|
39 |
+
onFinish: null,
|
40 |
+
onItemStart: null,
|
41 |
+
onItemFinish: null,
|
42 |
+
onItemError: null
|
43 |
+
}, t();
|
44 |
+
var a = this;
|
45 |
+
return this.options = e, this.settings = i.extend({}, this.defaults, this.options), this.settings.onStart && this.settings.onStart(), this.each(function (t) {
|
46 |
+
function e() {
|
47 |
+
-1 === u.css("background-image").indexOf(encodeURI(c.attr("src"))) && u.css({"background-image": 'url("' + encodeURI(c.attr("src")) + '")'}), u.css({
|
48 |
+
"background-size": g.fill ? "cover" : "contain",
|
49 |
+
"background-position": (g.horizontalAlign + " " + g.verticalAlign).toLowerCase(),
|
50 |
+
"background-repeat": "no-repeat"
|
51 |
+
}), i("a:first", u).css({
|
52 |
+
display: "block",
|
53 |
+
width: "100%",
|
54 |
+
height: "100%"
|
55 |
+
}), i("img", u).css({display: "none"}), g.onItemFinish && g.onItemFinish(t, u, c), u.addClass("sbi_imgLiquid_bgSize"), u.addClass("sbi_imgLiquid_ready"), l()
|
56 |
+
}
|
57 |
+
|
58 |
+
function o() {
|
59 |
+
function e() {
|
60 |
+
c.data("sbi_imgLiquid_error") || c.data("sbi_imgLiquid_loaded") || c.data("sbi_imgLiquid_oldProcessed") || (u.is(":visible") && c[0].complete && c[0].width > 0 && c[0].height > 0 ? (c.data("sbi_imgLiquid_loaded", !0), setTimeout(r, t * g.delay)) : setTimeout(e, g.timecheckvisibility))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
|
|
|
|
|
|
62 |
|
63 |
+
if (c.data("oldSrc") && c.data("oldSrc") !== c.attr("src")) {
|
64 |
+
var a = c.clone().removeAttr("style");
|
65 |
+
return a.data("sbi_imgLiquid_settings", c.data("sbi_imgLiquid_settings")), c.parent().prepend(a), c.remove(), c = a, c[0].width = 0, void setTimeout(o, 10)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
+
return c.data("sbi_imgLiquid_oldProcessed") ? void r() : (c.data("sbi_imgLiquid_oldProcessed", !1), c.data("oldSrc", c.attr("src")), i("img:not(:first)", u).css("display", "none"), u.css({overflow: "hidden"}), c.fadeTo(0, 0).removeAttr("width").removeAttr("height").css({
|
68 |
+
visibility: "visible",
|
69 |
+
"max-width": "none",
|
70 |
+
"max-height": "none",
|
71 |
+
width: "auto",
|
72 |
+
height: "auto",
|
73 |
+
display: "block"
|
74 |
+
}), c.on("error", n), c[0].onerror = n, e(), void d())
|
75 |
+
}
|
76 |
+
|
77 |
+
function d() {
|
78 |
+
(g.responsive || c.data("sbi_imgLiquid_oldProcessed")) && c.data("sbi_imgLiquid_settings") && (g = c.data("sbi_imgLiquid_settings"), u.actualSize = u.get(0).offsetWidth + u.get(0).offsetHeight / 1e4, u.sizeOld && u.actualSize !== u.sizeOld && r(), u.sizeOld = u.actualSize, setTimeout(d, g.responsiveCheckTime))
|
79 |
+
}
|
80 |
+
|
81 |
+
function n() {
|
82 |
+
c.data("sbi_imgLiquid_error", !0), u.addClass("sbi_imgLiquid_error"), g.onItemError && g.onItemError(t, u, c), l()
|
83 |
+
}
|
84 |
+
|
85 |
+
function s() {
|
86 |
+
var i = {};
|
87 |
+
if (a.settings.useDataHtmlAttr) {
|
88 |
+
var t = u.attr("data-sbi_imgLiquid-fill"),
|
89 |
+
e = u.attr("data-sbi_imgLiquid-horizontalAlign"),
|
90 |
+
o = u.attr("data-sbi_imgLiquid-verticalAlign");
|
91 |
+
("true" === t || "false" === t) && (i.fill = Boolean("true" === t)), void 0 === e || "left" !== e && "center" !== e && "right" !== e && -1 === e.indexOf("%") || (i.horizontalAlign = e), void 0 === o || "top" !== o && "bottom" !== o && "center" !== o && -1 === o.indexOf("%") || (i.verticalAlign = o)
|
92 |
+
}
|
93 |
+
return sbi_imgLiquid.isIE && a.settings.ieFadeInDisabled && (i.fadeInTime = 0), i
|
94 |
+
}
|
95 |
+
|
96 |
+
function r() {
|
97 |
+
var i, e, a, o, d, n, s, r, m = 0, h = 0, f = u.width(), v = u.height();
|
98 |
+
void 0 === c.data("owidth") && c.data("owidth", c[0].width), void 0 === c.data("oheight") && c.data("oheight", c[0].height), g.fill === f / v >= c.data("owidth") / c.data("oheight") ? (i = "100%", e = "auto", a = Math.floor(f), o = Math.floor(f * (c.data("oheight") / c.data("owidth")))) : (i = "auto", e = "100%", a = Math.floor(v * (c.data("owidth") / c.data("oheight"))), o = Math.floor(v)), d = g.horizontalAlign.toLowerCase(), s = f - a, "left" === d && (h = 0), "center" === d && (h = .5 * s), "right" === d && (h = s), -1 !== d.indexOf("%") && (d = parseInt(d.replace("%", ""), 10), d > 0 && (h = s * d * .01)), n = g.verticalAlign.toLowerCase(), r = v - o, "left" === n && (m = 0), "center" === n && (m = .5 * r), "bottom" === n && (m = r), -1 !== n.indexOf("%") && (n = parseInt(n.replace("%", ""), 10), n > 0 && (m = r * n * .01)), g.hardPixels && (i = a, e = o), c.css({
|
99 |
+
width: i,
|
100 |
+
height: e,
|
101 |
+
"margin-left": Math.floor(h),
|
102 |
+
"margin-top": Math.floor(m)
|
103 |
+
}), c.data("sbi_imgLiquid_oldProcessed") || (c.fadeTo(g.fadeInTime, 1), c.data("sbi_imgLiquid_oldProcessed", !0), g.removeBoxBackground && u.css("background-image", "none"), u.addClass("sbi_imgLiquid_nobgSize"), u.addClass("sbi_imgLiquid_ready")), g.onItemFinish && g.onItemFinish(t, u, c), l()
|
104 |
+
}
|
105 |
+
|
106 |
+
function l() {
|
107 |
+
t === a.length - 1 && a.settings.onFinish && a.settings.onFinish()
|
108 |
+
}
|
109 |
+
|
110 |
+
var g = a.settings, u = i(this), c = i("img:first", u);
|
111 |
+
return c.length ? (c.data("sbi_imgLiquid_settings") ? (u.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"), g = i.extend({}, c.data("sbi_imgLiquid_settings"), a.options)) : g = i.extend({}, a.settings, s()), c.data("sbi_imgLiquid_settings", g), g.onItemStart && g.onItemStart(t, u, c), void (sbi_imgLiquid.bgs_Available && g.useBackgroundSize ? e() : o())) : void n()
|
112 |
+
})
|
113 |
+
}
|
114 |
+
})
|
115 |
+
}(jQuery);
|
116 |
+
|
117 |
+
// Use imagefill to set the images as backgrounds so they can be square
|
118 |
+
!function () {
|
119 |
+
var css = sbi_imgLiquid.injectCss,
|
120 |
+
head = document.getElementsByTagName('head')[0],
|
121 |
+
style = document.createElement('style');
|
122 |
+
style.type = 'text/css';
|
123 |
+
if (style.styleSheet) {
|
124 |
+
style.styleSheet.cssText = css;
|
125 |
+
} else {
|
126 |
+
style.appendChild(document.createTextNode(css));
|
127 |
+
}
|
128 |
+
head.appendChild(style);
|
129 |
+
}();
|
130 |
+
}
|
131 |
+
|
132 |
+
function sbiAddVisibilityListener() {
|
133 |
+
/* Detect when element becomes visible. Used for when the feed is initially hidden, in a tab for example. https://github.com/shaunbowe/jquery.visibilityChanged */
|
134 |
+
!function (i) {
|
135 |
+
var n = { runOnLoad: !0, frequency: 100, sbiPreviousVisibility: null
|
136 |
+
}, c = {};
|
137 |
+
c.sbiCheckVisibility = function (i, n) {
|
138 |
+
if (jQuery.contains(document, i[0])) {
|
139 |
+
var e = n.sbiPreviousVisibility, t = i.is(":visible");
|
140 |
+
n.sbiPreviousVisibility = t, null == e ? n.runOnLoad && n.callback(i, t) : e !== t && n.callback(i, t), setTimeout(function () {
|
141 |
+
c.sbiCheckVisibility(i, n)
|
142 |
+
}, n.frequency)
|
143 |
+
}
|
144 |
+
}, i.fn.sbiVisibilityChanged = function (e) {
|
145 |
+
var t = i.extend({}, n, e);
|
146 |
+
return this.each(function () {
|
147 |
+
c.sbiCheckVisibility(i(this), t)
|
148 |
+
})
|
149 |
+
}
|
150 |
+
}(jQuery);
|
151 |
+
}
|
152 |
+
|
153 |
+
function Sbi() {
|
154 |
+
this.feeds = {};
|
155 |
+
this.options = sb_instagram_js_options;
|
156 |
+
}
|
157 |
+
|
158 |
+
Sbi.prototype = {
|
159 |
+
createPage: function (createFeeds, createFeedsArgs) {
|
160 |
+
if (typeof window.sbiajaxurl === 'undefined' || window.sbiajaxurl.indexOf(window.location.hostname) === -1) {
|
161 |
+
window.sbiajaxurl = location.protocol + '//'+ window.location.hostname + '/wp-admin/admin-ajax.php';
|
162 |
}
|
163 |
|
164 |
+
$('.sbi_no_js_error_message').remove();
|
165 |
+
$('.sbi_no_js').removeClass('sbi_no_js');
|
166 |
+
createFeeds(createFeedsArgs);
|
167 |
+
},
|
168 |
+
createFeeds: function (args) {
|
169 |
+
args.whenFeedsCreated(
|
170 |
+
$('.sbi').each(function (index) {
|
171 |
+
$(this).attr('data-sbi-index', index + 1);
|
172 |
+
var $self = $(this),
|
173 |
+
flags = typeof $self.attr('data-sbi-flags') !== 'undefined' ? $self.attr('data-sbi-flags').split(',') : [],
|
174 |
+
general = typeof $self.attr('data-options') !== 'undefined' ? JSON.parse($self.attr('data-options')) : {};
|
175 |
+
if (flags.indexOf('testAjax') > -1) {
|
176 |
+
window.sbi.triggeredTest = true;
|
177 |
+
var submitData = {
|
178 |
+
'action' : 'sbi_on_ajax_test_trigger'
|
179 |
+
},
|
180 |
+
onSuccess = function(data) {
|
181 |
+
console.log('did test');
|
182 |
+
};
|
183 |
+
sbiAjax(submitData,onSuccess)
|
184 |
+
}
|
185 |
+
var feedOptions = {
|
186 |
+
cols : $self.attr('data-cols'),
|
187 |
+
colsmobile : typeof $self.attr('data-colsmobile') !== 'undefined' && $self.attr('data-colsmobile') !== 'same' ? $self.attr('data-colsmobile') : $self.attr('data-cols'),
|
188 |
+
num : $self.attr('data-num'),
|
189 |
+
imgRes : $self.attr('data-res'),
|
190 |
+
feedID : $self.attr('data-feedid'),
|
191 |
+
postID : typeof $self.attr( 'data-postid' ) !== 'undefind' ? $self.attr( 'data-postid' ) : 'unknown',
|
192 |
+
shortCodeAtts : $self.attr('data-shortcode-atts'),
|
193 |
+
resizingEnabled : (flags.indexOf('resizeDisable') === -1),
|
194 |
+
imageLoadEnabled : (flags.indexOf('imageLoadDisable') === -1),
|
195 |
+
debugEnabled : (flags.indexOf('debug') > -1),
|
196 |
+
favorLocal : (flags.indexOf('favorLocal') > -1),
|
197 |
+
ajaxPostLoad : (flags.indexOf('ajaxPostLoad') > -1),
|
198 |
+
gdpr : (flags.indexOf('gdpr') > -1),
|
199 |
+
overrideBlockCDN : (flags.indexOf('overrideBlockCDN') > -1),
|
200 |
+
consentGiven : false,
|
201 |
+
locator : (flags.indexOf('locator') > -1),
|
202 |
+
autoMinRes : 1,
|
203 |
+
general : general
|
204 |
+
};
|
205 |
+
|
206 |
+
window.sbi.feeds[index] = sbiGetNewFeed(this, index, feedOptions);
|
207 |
+
window.sbi.feeds[index].setResizedImages();
|
208 |
+
window.sbi.feeds[index].init();
|
209 |
+
|
210 |
+
var evt = jQuery.Event('sbiafterfeedcreate');
|
211 |
+
evt.feed = window.sbi.feeds[index];
|
212 |
+
jQuery(window).trigger(evt);
|
213 |
+
|
214 |
+
})
|
215 |
+
);
|
216 |
+
},
|
217 |
+
afterFeedsCreated: function () {
|
218 |
+
// enable header hover action
|
219 |
+
$('.sb_instagram_header').each(function () {
|
220 |
+
var $thisHeader = $(this);
|
221 |
+
$thisHeader.find('.sbi_header_link').on('mouseenter mouseleave', function(e) {
|
222 |
+
switch(e.type) {
|
223 |
+
case 'mouseenter':
|
224 |
+
$thisHeader.find('.sbi_header_img_hover').addClass('sbi_fade_in');
|
225 |
+
break;
|
226 |
+
case 'mouseleave':
|
227 |
+
$thisHeader.find('.sbi_header_img_hover').removeClass('sbi_fade_in');
|
228 |
+
break;
|
229 |
+
}
|
230 |
+
});
|
231 |
+
});
|
232 |
+
|
233 |
+
},
|
234 |
+
encodeHTML: function(raw) {
|
235 |
+
// make sure passed variable is defined
|
236 |
+
if (typeof raw === 'undefined') {
|
237 |
+
return '';
|
238 |
+
}
|
239 |
+
// replace greater than and less than symbols with html entity to disallow html in comments
|
240 |
+
var encoded = raw.replace(/(>)/g,'>'),
|
241 |
+
encoded = encoded.replace(/(<)/g,'<');
|
242 |
+
encoded = encoded.replace(/(<br\/>)/g,'<br>');
|
243 |
+
encoded = encoded.replace(/(<br>)/g,'<br>');
|
244 |
+
|
245 |
+
return encoded;
|
246 |
+
},
|
247 |
+
urlDetect: function(text) {
|
248 |
+
var urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g;
|
249 |
+
return text.match(urlRegex);
|
250 |
+
}
|
251 |
+
};
|
252 |
+
|
253 |
+
function SbiFeed(el, index, settings) {
|
254 |
+
this.el = el;
|
255 |
+
this.index = index;
|
256 |
+
this.settings = settings;
|
257 |
+
this.minImageWidth = 0;
|
258 |
+
this.imageResolution = 150;
|
259 |
+
this.resizedImages = {};
|
260 |
+
this.needsResizing = [];
|
261 |
+
this.outOfPages = false;
|
262 |
+
this.page = 1;
|
263 |
+
this.isInitialized = false;
|
264 |
+
}
|
265 |
+
|
266 |
+
SbiFeed.prototype = {
|
267 |
+
init: function() {
|
268 |
+
var feed = this;
|
269 |
+
feed.settings.consentGiven = feed.checkConsent();
|
270 |
+
if ($(this.el).find('.sbi_photo').parent('p').length) {
|
271 |
+
$(this.el).addClass('sbi_no_autop');
|
272 |
+
}
|
273 |
+
if ($(this.el).find('#sbi_mod_error').length) {
|
274 |
+
$(this.el).prepend($(this.el).find('#sbi_mod_error'));
|
275 |
+
}
|
276 |
+
if (this.settings.ajaxPostLoad) {
|
277 |
+
this.getNewPostSet();
|
278 |
+
} else {
|
279 |
+
this.afterInitialImagesLoaded();
|
280 |
+
//Only check the width once the resize event is over
|
281 |
}
|
282 |
+
var sbi_delay = (function () {
|
283 |
+
var sbi_timer = 0;
|
284 |
+
return function (sbi_callback, sbi_ms) {
|
285 |
+
clearTimeout(sbi_timer);
|
286 |
+
sbi_timer = setTimeout(sbi_callback, sbi_ms);
|
287 |
+
};
|
288 |
+
})();
|
289 |
+
jQuery(window).on('resize',function () {
|
290 |
+
sbi_delay(function () {
|
291 |
+
feed.afterResize();
|
292 |
+
}, 500);
|
293 |
+
});
|
294 |
|
295 |
+
$(this.el).find('.sbi_item').each(function() {
|
296 |
+
feed.lazyLoadCheck($(this));
|
297 |
+
});
|
298 |
+
},
|
299 |
+
afterInitialImagesLoaded: function() {
|
300 |
+
this.loadMoreButtonInit();
|
301 |
+
this.hideExtraImagesForWidth();
|
302 |
+
this.beforeNewImagesRevealed();
|
303 |
+
this.revealNewImages();
|
304 |
+
this.afterNewImagesRevealed();
|
305 |
+
},
|
306 |
+
afterResize: function() {
|
307 |
+
this.setImageHeight();
|
308 |
+
this.setImageResolution();
|
309 |
+
this.maybeRaiseImageResolution();
|
310 |
+
this.setImageSizeClass();
|
311 |
+
},
|
312 |
+
afterLoadMoreClicked: function($button) {
|
313 |
+
$button.find('.sbi_loader').removeClass('sbi_hidden');
|
314 |
+
$button.find('.sbi_btn_text').addClass('sbi_hidden');
|
315 |
+
$button.closest('.sbi').find('.sbi_num_diff_hide').addClass('sbi_transition').removeClass('sbi_num_diff_hide');
|
316 |
+
},
|
317 |
+
afterNewImagesLoaded: function() {
|
318 |
+
var $self = $(this.el),
|
319 |
+
feed = this;
|
320 |
+
this.beforeNewImagesRevealed();
|
321 |
+
this.revealNewImages();
|
322 |
+
this.afterNewImagesRevealed();
|
323 |
+
setTimeout(function () {
|
324 |
+
//Hide the loader in the load more button
|
325 |
+
$self.find('.sbi_loader').addClass('sbi_hidden');
|
326 |
+
$self.find('.sbi_btn_text').removeClass('sbi_hidden');
|
327 |
+
feed.maybeRaiseImageResolution();
|
328 |
+
}, 500);
|
329 |
+
},
|
330 |
+
beforeNewImagesRevealed: function() {
|
331 |
+
this.setImageHeight();
|
332 |
+
this.maybeRaiseImageResolution(true);
|
333 |
+
this.setImageSizeClass();
|
334 |
+
},
|
335 |
+
revealNewImages: function() {
|
336 |
+
var $self = $(this.el);
|
337 |
+
|
338 |
+
$self.find('.sbi-screenreader').each(function() {
|
339 |
+
$(this).find('img').remove();
|
340 |
+
});
|
341 |
|
342 |
+
// Call Custom JS if it exists
|
343 |
+
if (typeof sbi_custom_js == 'function') setTimeout(function(){ sbi_custom_js(); }, 100);
|
344 |
+
|
345 |
+
this.applyImageLiquid();
|
346 |
+
$self.find('.sbi_item').each(function (index) {
|
347 |
+
var $self = jQuery(this);
|
348 |
+
|
349 |
+
//Photo links
|
350 |
+
$self.find('.sbi_photo').on('mouseenter mouseleave', function(e) {
|
351 |
+
switch(e.type) {
|
352 |
+
case 'mouseenter':
|
353 |
+
jQuery(this).fadeTo(200, 0.85);
|
354 |
+
break;
|
355 |
+
case 'mouseleave':
|
356 |
+
jQuery(this).stop().fadeTo(500, 1);
|
357 |
+
break;
|
358 |
+
}
|
359 |
+
});
|
360 |
+
}); //End .sbi_item each
|
361 |
+
|
362 |
+
//Remove the new class after 500ms, once the sorting is done
|
363 |
+
setTimeout(function () {
|
364 |
+
jQuery('#sbi_images .sbi_item.sbi_new').removeClass('sbi_new');
|
365 |
+
//Loop through items and remove class to reveal them
|
366 |
+
var time = 10;
|
367 |
+
$self.find('.sbi_transition').each(function() {
|
368 |
+
var $sbi_item_transition_el = jQuery(this);
|
369 |
+
|
370 |
+
setTimeout( function(){
|
371 |
+
$sbi_item_transition_el.removeClass('sbi_transition');
|
372 |
+
}, time);
|
373 |
+
time += 10;
|
374 |
+
});
|
375 |
+
}, 500);
|
376 |
+
},
|
377 |
+
lazyLoadCheck: function($item){
|
378 |
+
var feed = this;
|
379 |
+
if ($item.find('.sbi_photo').length && !$item.closest('.sbi').hasClass('sbi-no-ll-check')) {
|
380 |
+
var imgSrcSet = feed.getImageUrls($item),
|
381 |
+
maxResImage = typeof imgSrcSet[640] !== 'undefined' ? imgSrcSet[640] : $item.find('.sbi_photo').attr('data-full-res');
|
382 |
+
|
383 |
+
if (!feed.settings.consentGiven) {
|
384 |
+
if (maxResImage.indexOf('scontent') > -1) {
|
385 |
+
return;
|
386 |
+
}
|
387 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
|
389 |
+
$item.find('.sbi_photo img').each(function() {
|
390 |
+
if (maxResImage && typeof $(this).attr('data-src') !== 'undefined') {
|
391 |
+
$(this).attr('data-src',maxResImage);
|
392 |
+
}
|
393 |
+
if (maxResImage && typeof $(this).attr('data-orig-src') !== 'undefined') {
|
394 |
+
$(this).attr('data-orig-src',maxResImage);
|
395 |
+
}
|
396 |
+
$(this).on('load',function() {
|
397 |
+
if (!$(this).hasClass('sbi-replaced')
|
398 |
+
&& $(this).attr('src').indexOf('placeholder') > -1) {
|
399 |
+
$(this).addClass('sbi-replaced');
|
400 |
+
if (maxResImage) {
|
401 |
+
$(this).attr('src',maxResImage);
|
402 |
+
if ($(this).closest('.sbi_imgLiquid_bgSize').length) {
|
403 |
+
$(this).closest('.sbi_imgLiquid_bgSize').css('background-image', 'url(' + maxResImage + ')');
|
404 |
+
}
|
405 |
}
|
406 |
+
}
|
407 |
+
});
|
408 |
+
});
|
409 |
+
}
|
410 |
+
},
|
411 |
+
afterNewImagesRevealed: function() {
|
412 |
+
this.listenForVisibilityChange();
|
413 |
+
this.sendNeedsResizingToServer();
|
414 |
+
if (!this.settings.imageLoadEnabled) {
|
415 |
+
$('.sbi_no_resraise').removeClass('sbi_no_resraise');
|
416 |
+
}
|
417 |
|
418 |
+
var evt = $.Event('sbiafterimagesloaded');
|
419 |
+
evt.el = $(this.el);
|
420 |
+
$(window).trigger(evt);
|
421 |
+
},
|
422 |
+
setResizedImages: function () {
|
423 |
+
if ($(this.el).find('.sbi_resized_image_data').length
|
424 |
+
&& typeof $(this.el).find('.sbi_resized_image_data').attr('data-resized') !== 'undefined'
|
425 |
+
&& $(this.el).find('.sbi_resized_image_data').attr('data-resized').indexOf('{"') === 0) {
|
426 |
+
this.resizedImages = JSON.parse($(this.el).find('.sbi_resized_image_data').attr('data-resized'));
|
427 |
+
$(this.el).find('.sbi_resized_image_data').remove();
|
428 |
+
}
|
429 |
+
},
|
430 |
+
sendNeedsResizingToServer: function() {
|
431 |
+
var feed = this,
|
432 |
+
$self = $(this.el);
|
433 |
+
if (feed.needsResizing.length > 0 && feed.settings.resizingEnabled) {
|
434 |
+
var itemOffset = $(this.el).find('.sbi_item').length,
|
435 |
+
cacheAll = typeof feed.settings.general.cache_all !== 'undefined' ? feed.settings.general.cache_all : false;
|
436 |
+
var locatorNonce = '';
|
437 |
+
if ( typeof $self.attr( 'data-locatornonce' ) !== 'undefined' ) {
|
438 |
+
locatorNonce = $self.attr( 'data-locatornonce' );
|
439 |
+
}
|
440 |
+
var submitData = {
|
441 |
+
action: 'sbi_resized_images_submit',
|
442 |
+
needs_resizing: feed.needsResizing,
|
443 |
+
offset: itemOffset,
|
444 |
+
feed_id: feed.settings.feedID,
|
445 |
+
atts: feed.settings.shortCodeAtts,
|
446 |
+
location: feed.locationGuess(),
|
447 |
+
post_id: feed.settings.postID,
|
448 |
+
cache_all: cacheAll,
|
449 |
+
locator_nonce: locatorNonce
|
450 |
+
};
|
451 |
+
var onSuccess = function(data) {
|
452 |
+
var response = data;
|
453 |
+
|
454 |
+
if (typeof data !== 'object' && data.trim().indexOf('{') === 0) {
|
455 |
+
response = JSON.parse(data.trim());
|
456 |
}
|
457 |
+
if (feed.settings.debugEnabled) {
|
458 |
+
console.log(response);
|
459 |
+
}
|
460 |
+
for (var property in response) {
|
461 |
+
if (response.hasOwnProperty(property)) {
|
462 |
+
feed.resizedImages[property] = response[property];
|
463 |
+
}
|
464 |
+
}
|
465 |
+
feed.maybeRaiseImageResolution();
|
466 |
|
467 |
+
setTimeout(function() {
|
468 |
+
feed.afterResize();
|
469 |
+
},500);
|
470 |
+
|
471 |
+
};
|
472 |
+
sbiAjax(submitData,onSuccess);
|
473 |
+
} else if (feed.settings.locator) {
|
474 |
+
var locatorNonce = '';
|
475 |
+
if ( typeof $self.attr( 'data-locatornonce' ) !== 'undefined' ) {
|
476 |
+
locatorNonce = $self.attr( 'data-locatornonce' );
|
477 |
+
}
|
478 |
+
var submitData = {
|
479 |
+
action: 'sbi_do_locator',
|
480 |
+
feed_id: feed.settings.feedID,
|
481 |
+
atts: feed.settings.shortCodeAtts,
|
482 |
+
location: feed.locationGuess(),
|
483 |
+
post_id: feed.settings.postID,
|
484 |
+
locator_nonce: locatorNonce
|
485 |
+
};
|
486 |
+
var onSuccess = function(data) {
|
487 |
+
|
488 |
+
};
|
489 |
+
sbiAjax(submitData,onSuccess);
|
490 |
+
}
|
491 |
+
},
|
492 |
+
loadMoreButtonInit: function () {
|
493 |
+
var $self = $(this.el),
|
494 |
+
feed = this;
|
495 |
+
$self.find('#sbi_load .sbi_load_btn').off().on('click', function () {
|
496 |
+
|
497 |
+
feed.afterLoadMoreClicked(jQuery(this));
|
498 |
+
feed.getNewPostSet();
|
499 |
+
|
500 |
+
}); //End click event
|
501 |
+
},
|
502 |
+
getNewPostSet: function () {
|
503 |
+
var $self = $(this.el),
|
504 |
+
feed = this;
|
505 |
+
feed.page ++;
|
506 |
+
|
507 |
+
var locatorNonce = '';
|
508 |
+
if ( typeof $self.attr( 'data-locatornonce' ) !== 'undefined' ) {
|
509 |
+
locatorNonce = $self.attr( 'data-locatornonce' );
|
510 |
}
|
511 |
|
512 |
+
var itemOffset = $self.find('.sbi_item').length,
|
513 |
+
submitData = {
|
514 |
+
action: 'sbi_load_more_clicked',
|
515 |
+
offset: itemOffset,
|
516 |
+
page: feed.page,
|
517 |
+
feed_id: feed.settings.feedID,
|
518 |
+
atts: feed.settings.shortCodeAtts,
|
519 |
+
location: feed.locationGuess(),
|
520 |
+
post_id: feed.settings.postID,
|
521 |
+
current_resolution: feed.imageResolution,
|
522 |
+
locator_nonce: locatorNonce
|
523 |
+
};
|
524 |
+
var onSuccess = function (data) {
|
525 |
+
var response = data;
|
526 |
+
|
527 |
+
if (typeof data !== 'object' && data.trim().indexOf('{') === 0) {
|
528 |
+
response = JSON.parse(data.trim());
|
529 |
+
}
|
530 |
+
if (feed.settings.debugEnabled) {
|
531 |
+
console.log(response);
|
532 |
+
}
|
533 |
+
feed.appendNewPosts(response.html);
|
534 |
+
feed.addResizedImages(response.resizedImages);
|
535 |
+
if (feed.settings.ajaxPostLoad) {
|
536 |
+
feed.settings.ajaxPostLoad = false;
|
537 |
+
feed.afterInitialImagesLoaded();
|
538 |
+
} else {
|
539 |
+
feed.afterNewImagesLoaded();
|
540 |
+
}
|
541 |
+
|
542 |
+
if (!response.feedStatus.shouldPaginate) {
|
543 |
+
feed.outOfPages = true;
|
544 |
+
$self.find('.sbi_load_btn').hide();
|
545 |
+
} else {
|
546 |
+
feed.outOfPages = false;
|
547 |
+
}
|
548 |
+
$('.sbi_no_js').removeClass('sbi_no_js');
|
549 |
+
};
|
550 |
+
sbiAjax(submitData, onSuccess);
|
551 |
+
},
|
552 |
+
appendNewPosts: function (newPostsHtml) {
|
553 |
+
var $self = $(this.el);
|
554 |
+
if ($self.find('#sbi_images .sbi_item').length) {
|
555 |
+
$self.find('#sbi_images .sbi_item').last().after(newPostsHtml);
|
556 |
+
} else {
|
557 |
+
$self.find('#sbi_images').append(newPostsHtml);
|
558 |
+
}
|
559 |
+
},
|
560 |
+
addResizedImages: function (resizedImagesToAdd) {
|
561 |
+
for (var imageID in resizedImagesToAdd) {
|
562 |
+
this.resizedImages[imageID] = resizedImagesToAdd[imageID];
|
563 |
+
}
|
564 |
+
},
|
565 |
+
setImageHeight: function() {
|
566 |
+
var $self = $(this.el);
|
567 |
+
|
568 |
+
var sbi_photo_width = $self.find('.sbi_photo').eq(0).innerWidth();
|
569 |
+
|
570 |
+
//Figure out number of columns for either desktop or mobile
|
571 |
+
var sbi_num_cols = this.getColumnCount();
|
572 |
+
|
573 |
+
//Figure out what the width should be using the number of cols
|
574 |
+
//Figure out what the width should be using the number of cols
|
575 |
+
var imagesPadding = $self.find('#sbi_images').innerWidth() - $self.find('#sbi_images').width(),
|
576 |
+
imagepadding = imagesPadding / 2,
|
577 |
+
sbi_photo_width_manual = ( $self.find('#sbi_images').width() / sbi_num_cols ) - imagesPadding;
|
578 |
+
//If the width is less than it should be then set it manually
|
579 |
+
//if( sbi_photo_width <= (sbi_photo_width_manual) ) sbi_photo_width = sbi_photo_width_manual;
|
580 |
+
|
581 |
+
$self.find('.sbi_photo').css('height', sbi_photo_width);
|
582 |
+
|
583 |
+
//Set the position of the carousel arrows
|
584 |
+
if ($self.find('.sbi-owl-nav').length) {
|
585 |
+
setTimeout(function(){
|
586 |
+
//If there's 2 rows then adjust position
|
587 |
+
var sbi_ratio = 2;
|
588 |
+
if( $self.find('.sbi_owl2row-item').length ) sbi_ratio = 1;
|
589 |
+
|
590 |
+
var sbi_arrows_top = ($self.find('.sbi_photo').eq(0).innerWidth()/sbi_ratio);
|
591 |
+
sbi_arrows_top += parseInt(imagepadding)*(2+(2-sbi_ratio));
|
592 |
+
$self.find('.sbi-owl-nav div').css('top', sbi_arrows_top);
|
593 |
+
}, 100);
|
594 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
595 |
|
596 |
+
},
|
597 |
+
maybeRaiseSingleImageResolution: function ($item, index, forceChange) {
|
598 |
+
var feed = this,
|
599 |
+
imgSrcSet = feed.getImageUrls($item),
|
600 |
+
currentUrl = $item.find('.sbi_photo img').attr('src'),
|
601 |
+
currentRes = 150,
|
602 |
+
imagEl = $item.find('img').get(0),
|
603 |
+
aspectRatio = currentUrl === window.sbi.options.placeholder ? 1 : imagEl.naturalWidth/imagEl.naturalHeight,
|
604 |
+
forceChange = typeof forceChange !== 'undefined' ? forceChange : false;
|
605 |
+
|
606 |
+
if ($item.hasClass('sbi_no_resraise') || $item.hasClass('sbi_had_error') || ($item.find('.sbi_link_area').length && $item.find('.sbi_link_area').hasClass('sbi_had_error'))) {
|
607 |
+
return;
|
608 |
+
}
|
609 |
|
610 |
+
if (imgSrcSet.length < 1) {
|
611 |
+
if ($item.find('.sbi_link_area').length) {
|
612 |
+
$item.find('.sbi_link_area').attr('href',window.sbi.options.placeholder.replace('placeholder.png','thumb-placeholder.png'))
|
613 |
+
}
|
614 |
+
return;
|
615 |
+
} else if ($item.find('.sbi_link_area').length && $item.find('.sbi_link_area').attr('href') === window.sbi.options.placeholder.replace('placeholder.png','thumb-placeholder.png')
|
616 |
+
|| !feed.settings.consentGiven) {
|
617 |
+
$item.find('.sbi_link_area').attr('href',imgSrcSet[imgSrcSet.length - 1])
|
618 |
+
}
|
619 |
+
if (typeof imgSrcSet[640] !== 'undefined') {
|
620 |
+
$item.find('.sbi_photo').attr('data-full-res',imgSrcSet[640]);
|
621 |
+
}
|
622 |
|
623 |
+
$.each(imgSrcSet, function (index, value) {
|
624 |
+
if (value === currentUrl) {
|
625 |
+
currentRes = parseInt(index);
|
626 |
+
// If the image has already been changed to an existing real source, don't force the change
|
627 |
+
forceChange = false;
|
628 |
+
}
|
629 |
+
});
|
630 |
+
//Image res
|
631 |
+
var newRes = 640;
|
632 |
+
switch (feed.settings.imgRes) {
|
633 |
+
case 'thumb':
|
634 |
+
newRes = 150;
|
635 |
+
break;
|
636 |
+
case 'medium':
|
637 |
+
newRes = 320;
|
638 |
+
break;
|
639 |
+
case 'full':
|
640 |
+
newRes = 640;
|
641 |
+
break;
|
642 |
+
default:
|
643 |
+
var minImageWidth = Math.max(feed.settings.autoMinRes,$item.find('.sbi_photo').innerWidth()),
|
644 |
+
thisImageReplace = feed.getBestResolutionForAuto(minImageWidth, aspectRatio, $item);
|
645 |
+
switch (thisImageReplace) {
|
646 |
+
case 320:
|
647 |
+
newRes = 320;
|
648 |
+
break;
|
649 |
+
case 150:
|
650 |
+
newRes = 150;
|
651 |
+
break;
|
652 |
+
}
|
653 |
+
break;
|
654 |
+
}
|
|
|
|
|
|
|
655 |
|
656 |
+
if (newRes > currentRes || currentUrl === window.sbi.options.placeholder || forceChange) {
|
657 |
+
if (feed.settings.debugEnabled) {
|
658 |
+
var reason = currentUrl === window.sbi.options.placeholder ? 'was placeholder' : 'too small';
|
659 |
+
console.log('rais res for ' + currentUrl, reason);
|
660 |
+
}
|
661 |
+
var newUrl = imgSrcSet[newRes].split("?ig_cache_key")[0];
|
662 |
+
if (currentUrl !== newUrl) {
|
663 |
+
$item.find('.sbi_photo img').attr('src', newUrl);
|
664 |
+
$item.find('.sbi_photo').css('background-image', 'url("' + newUrl + '")');
|
665 |
+
}
|
666 |
+
currentRes = newRes;
|
667 |
+
|
668 |
+
if (feed.settings.imgRes === 'auto') {
|
669 |
+
var checked = false;
|
670 |
+
$item.find('.sbi_photo img').on('load', function () {
|
671 |
+
|
672 |
+
var $this_image = $(this);
|
673 |
+
var newAspectRatio = ($this_image.get(0).naturalWidth / $this_image.get(0).naturalHeight);
|
674 |
+
|
675 |
+
if ($this_image.get(0).naturalWidth !== 1000 && newAspectRatio > aspectRatio && !checked) {
|
676 |
+
if (feed.settings.debugEnabled) {
|
677 |
+
console.log('rais res again for aspect ratio change ' + currentUrl);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
678 |
}
|
679 |
+
checked = true;
|
680 |
+
minImageWidth = $item.find('.sbi_photo').innerWidth();
|
681 |
+
thisImageReplace = feed.getBestResolutionForAuto(minImageWidth, newAspectRatio, $item);
|
682 |
+
newRes = 640;
|
683 |
+
|
684 |
+
switch (thisImageReplace) {
|
685 |
+
case 320:
|
686 |
+
newRes = 320;
|
687 |
+
break;
|
688 |
+
case 150:
|
689 |
+
newRes = 150;
|
690 |
+
break;
|
|
|
691 |
}
|
692 |
|
693 |
+
if (newRes > currentRes) {
|
694 |
+
newUrl = imgSrcSet[newRes].split("?ig_cache_key")[0];
|
695 |
+
$this_image.attr('src', newUrl);
|
696 |
+
$this_image.closest('.sbi_photo').css('background-image', 'url("' + newUrl + '")');
|
|
|
|
|
|
|
|
|
697 |
}
|
698 |
+
if (feed.layout === 'masonry' || feed.layout === 'highlight') {
|
699 |
+
$(feed.el).find('#sbi_images').smashotope(feed.isotopeArgs);
|
700 |
+
setTimeout(function() {
|
701 |
+
$(feed.el).find('#sbi_images').smashotope(feed.isotopeArgs);
|
702 |
+
},500)
|
703 |
}
|
704 |
+
} else {
|
705 |
+
if (feed.settings.debugEnabled) {
|
706 |
+
var reason = checked ? 'already checked' : 'no aspect ratio change';
|
707 |
+
console.log('not raising res for replacement ' + currentUrl, reason);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
708 |
}
|
709 |
+
}
|
710 |
+
});
|
711 |
+
}
|
712 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
713 |
|
714 |
+
}
|
715 |
|
716 |
+
$item.find('img').on('error', function () {
|
717 |
+
if (!$(this).hasClass('sbi_img_error')) {
|
718 |
+
$(this).addClass('sbi_img_error');
|
719 |
+
var sourceFromAPI = ($(this).attr('src').indexOf('media/?size=') > -1 || $(this).attr('src').indexOf('cdninstagram') > -1 || $(this).attr('src').indexOf('fbcdn') > -1)
|
720 |
|
721 |
+
if (!sourceFromAPI && feed.settings.consentGiven) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
722 |
|
723 |
+
if ($(this).closest('.sbi_photo').attr('data-img-src-set') !== 'undefined') {
|
724 |
+
var srcSet = JSON.parse($(this).closest('.sbi_photo').attr('data-img-src-set').replace(/\\\//g, '/'));
|
725 |
+
if (typeof srcSet.d !== 'undefined') {
|
726 |
+
$(this).attr('src', srcSet.d);
|
727 |
+
$(this).closest('.sbi_photo').css('background-image', 'url(' + srcSet.d + ')');
|
728 |
+
$(this).closest('.sbi_item').addClass('sbi_had_error').find('.sbi_link_area').attr('href', srcSet[640]).addClass('sbi_had_error');
|
729 |
}
|
730 |
+
}
|
731 |
+
} else {
|
732 |
+
feed.settings.favorLocal = true;
|
733 |
+
var srcSet = feed.getImageUrls($(this).closest('.sbi_item'));
|
734 |
+
if (typeof srcSet[640] !== 'undefined') {
|
735 |
+
$(this).attr('src', srcSet[640]);
|
736 |
+
$(this).closest('.sbi_photo').css('background-image', 'url(' + srcSet[640] + ')');
|
737 |
+
$(this).closest('.sbi_item').addClass('sbi_had_error').find('.sbi_link_area').attr('href', srcSet[640]).addClass('sbi_had_error');
|
738 |
+
}
|
739 |
+
}
|
740 |
+
setTimeout(function() {
|
741 |
+
feed.afterResize();
|
742 |
+
}, 1500)
|
743 |
+
} else {
|
744 |
+
console.log('unfixed error ' + $(this).attr('src'));
|
745 |
+
}
|
746 |
+
});
|
747 |
+
},
|
748 |
+
maybeRaiseImageResolution: function (justNew) {
|
749 |
+
var feed = this,
|
750 |
+
itemsSelector = typeof justNew !== 'undefined' && justNew === true ? '.sbi_item.sbi_new' : '.sbi_item',
|
751 |
+
forceChange = !feed.isInitialized ? true : false;
|
752 |
+
$(feed.el).find(itemsSelector).each(function (index) {
|
753 |
+
if (!$(this).hasClass('sbi_num_diff_hide')
|
754 |
+
&& $(this).find('.sbi_photo').length
|
755 |
+
&& typeof $(this).find('.sbi_photo').attr('data-img-src-set') !== 'undefined') {
|
756 |
+
feed.maybeRaiseSingleImageResolution($(this),index,forceChange);
|
757 |
+
}
|
758 |
+
}); //End .sbi_item each
|
759 |
+
feed.isInitialized = true;
|
760 |
+
},
|
761 |
+
getBestResolutionForAuto: function(colWidth, aspectRatio, $item) {
|
762 |
+
if (isNaN(aspectRatio) || aspectRatio < 1) {
|
763 |
+
aspectRatio = 1;
|
764 |
+
}
|
765 |
+
var bestWidth = colWidth * aspectRatio,
|
766 |
+
bestWidthRounded = Math.ceil(bestWidth / 10) * 10,
|
767 |
+
customSizes = [150, 320, 640];
|
768 |
|
769 |
+
if ($item.hasClass('sbi_highlighted')) {
|
770 |
+
bestWidthRounded = bestWidthRounded *2;
|
771 |
+
}
|
|
|
|
|
772 |
|
773 |
+
if (customSizes.indexOf(parseInt(bestWidthRounded)) === -1) {
|
774 |
+
var done = false;
|
775 |
+
$.each(customSizes, function (index, item) {
|
776 |
+
if (item > parseInt(bestWidthRounded) && !done) {
|
777 |
+
bestWidthRounded = item;
|
778 |
|
779 |
+
done = true;
|
780 |
+
}
|
781 |
+
});
|
782 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
783 |
|
784 |
+
return bestWidthRounded;
|
785 |
+
},
|
786 |
+
hideExtraImagesForWidth: function() {
|
787 |
+
if (this.layout === 'carousel') {
|
788 |
+
return;
|
789 |
+
}
|
790 |
+
var $self = $(this.el),
|
791 |
+
num = typeof $self.attr('data-num') !== 'undefined' && $self.attr('data-num') !== '' ? parseInt($self.attr('data-num')) : 1,
|
792 |
+
nummobile = typeof $self.attr('data-nummobile') !== 'undefined' && $self.attr('data-nummobile') !== '' ? parseInt($self.attr('data-nummobile')) : num;
|
793 |
+
|
794 |
+
if ($(window).width() < 480) {
|
795 |
+
if (nummobile < $self.find('.sbi_item').length) {
|
796 |
+
$self.find('.sbi_item').slice(nummobile - $self.find('.sbi_item').length).addClass('sbi_num_diff_hide');
|
797 |
+
}
|
798 |
+
} else {
|
799 |
+
if (num < $self.find('.sbi_item').length) {
|
800 |
+
$self.find('.sbi_item').slice(num - $self.find('.sbi_item').length).addClass('sbi_num_diff_hide');
|
801 |
+
}
|
802 |
+
}
|
803 |
+
},
|
804 |
+
setImageSizeClass: function () {
|
805 |
+
var $self = $(this.el);
|
806 |
+
$self.removeClass('sbi_small sbi_medium');
|
807 |
+
var feedWidth = $self.innerWidth(),
|
808 |
+
photoPadding = parseInt(($self.find('#sbi_images').outerWidth() - $self.find('#sbi_images').width())) / 2,
|
809 |
+
cols = this.getColumnCount(),
|
810 |
+
feedWidthSansPadding = feedWidth - (photoPadding * (cols+2)),
|
811 |
+
colWidth = (feedWidthSansPadding / cols);
|
812 |
+
if (colWidth > 120 && colWidth < 240) {
|
813 |
+
$self.addClass('sbi_medium');
|
814 |
+
} else if (colWidth <= 120) {
|
815 |
+
$self.addClass('sbi_small');
|
816 |
+
}
|
817 |
+
},
|
818 |
+
setMinImageWidth: function () {
|
819 |
+
if ($(this.el).find('.sbi_item .sbi_photo').first().length) {
|
820 |
+
this.minImageWidth = $(this.el).find('.sbi_item .sbi_photo').first().innerWidth();
|
821 |
+
} else {
|
822 |
+
this.minImageWidth = 150;
|
823 |
+
}
|
824 |
+
},
|
825 |
+
setImageResolution: function () {
|
826 |
+
if (this.settings.imgRes === 'auto') {
|
827 |
+
this.imageResolution = 'auto';
|
828 |
+
} else {
|
829 |
+
switch (this.settings.imgRes) {
|
830 |
+
case 'thumb':
|
831 |
+
this.imageResolution = 150;
|
832 |
+
break;
|
833 |
+
case 'medium':
|
834 |
+
this.imageResolution = 320;
|
835 |
+
break;
|
836 |
+
default:
|
837 |
+
this.imageResolution = 640;
|
838 |
+
}
|
839 |
+
}
|
840 |
+
},
|
841 |
+
getImageUrls: function ($item) {
|
842 |
+
var srcSet = JSON.parse($item.find('.sbi_photo').attr('data-img-src-set').replace(/\\\//g, '/')),
|
843 |
+
id = $item.attr('id').replace('sbi_', '');
|
844 |
+
if (!this.settings.consentGiven && !this.settings.overrideBlockCDN) {
|
845 |
+
srcSet = [];
|
846 |
+
}
|
847 |
+
if (typeof this.resizedImages[id] !== 'undefined'
|
848 |
+
&& this.resizedImages[id] !== 'video'
|
849 |
+
&& this.resizedImages[id] !== 'pending'
|
850 |
+
&& this.resizedImages[id].id !== 'error'
|
851 |
+
&& this.resizedImages[id].id !== 'video'
|
852 |
+
&& this.resizedImages[id].id !== 'pending') {
|
853 |
+
|
854 |
+
if (typeof this.resizedImages[id]['sizes'] !== 'undefined') {
|
855 |
+
var foundSizes = [];
|
856 |
+
if (typeof this.resizedImages[id]['sizes']['full'] !== 'undefined') {
|
857 |
+
srcSet[640] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
858 |
+
foundSizes.push(640);
|
859 |
+
}
|
860 |
+
if (typeof this.resizedImages[id]['sizes']['low'] !== 'undefined') {
|
861 |
+
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
862 |
+
foundSizes.push(320);
|
863 |
+
}
|
864 |
+
if (typeof this.resizedImages[id]['sizes']['thumb'] !== 'undefined') {
|
865 |
+
foundSizes.push(150);
|
866 |
+
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'thumb.jpg';
|
867 |
+
}
|
868 |
+
if (this.settings.favorLocal) {
|
869 |
+
if (foundSizes.indexOf(640) === -1) {
|
870 |
+
if (foundSizes.indexOf(320) > -1) {
|
871 |
+
srcSet[640] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
872 |
}
|
873 |
+
}
|
874 |
+
if (foundSizes.indexOf(320) === -1) {
|
875 |
+
if (foundSizes.indexOf(640) > -1) {
|
876 |
+
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
877 |
+
} else if (foundSizes.indexOf(150) > -1) {
|
878 |
+
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'thumb.jpg';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
879 |
}
|
880 |
+
}
|
881 |
+
if (foundSizes.indexOf(150) === -1) {
|
882 |
+
if (foundSizes.indexOf(320) > -1) {
|
883 |
+
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
884 |
+
} else if (foundSizes.indexOf(640) > -1) {
|
885 |
+
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
886 |
}
|
887 |
+
}
|
888 |
+
}
|
889 |
+
}
|
890 |
+
} else if (typeof this.resizedImages[id] === 'undefined'
|
891 |
+
|| (typeof this.resizedImages[id]['id'] !== 'undefined' && this.resizedImages[id]['id'] !== 'pending' && this.resizedImages[id]['id'] !== 'error')) {
|
892 |
+
this.addToNeedsResizing(id);
|
893 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
894 |
|
895 |
+
return srcSet;
|
896 |
+
},
|
897 |
+
getAvatarUrl: function (username,favorType) {
|
898 |
+
if (username === '') {
|
899 |
+
return '';
|
900 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
901 |
|
902 |
+
var availableAvatars = this.settings.general.avatars,
|
903 |
+
favorType = typeof favorType !== 'undefined' ? favorType : 'local';
|
904 |
+
|
905 |
+
if (favorType === 'local') {
|
906 |
+
if (typeof availableAvatars['LCL'+username] !== 'undefined' && parseInt(availableAvatars['LCL'+username]) === 1) {
|
907 |
+
return sb_instagram_js_options.resized_url + username + '.jpg';
|
908 |
+
} else if (typeof availableAvatars[username] !== 'undefined') {
|
909 |
+
return availableAvatars[username];
|
910 |
+
} else {
|
911 |
+
return '';
|
912 |
+
}
|
913 |
+
} else {
|
914 |
+
if (typeof availableAvatars[username] !== 'undefined') {
|
915 |
+
return availableAvatars[username];
|
916 |
+
} else if (typeof availableAvatars['LCL'+username] !== 'undefined' && parseInt(availableAvatars['LCL'+username]) === 1) {
|
917 |
+
return sb_instagram_js_options.resized_url + username + '.jpg';
|
918 |
+
} else {
|
919 |
+
return '';
|
920 |
+
}
|
921 |
+
}
|
922 |
+
},
|
923 |
+
addToNeedsResizing: function (id) {
|
924 |
+
if (this.needsResizing.indexOf(id) === -1) {
|
925 |
+
this.needsResizing.push(id);
|
926 |
+
}
|
927 |
+
},
|
928 |
+
applyImageLiquid: function () {
|
929 |
+
var $self = $(this.el);
|
930 |
+
sbiAddImgLiquid();
|
931 |
+
if (typeof $self.find(".sbi_photo").sbi_imgLiquid == 'function') {
|
932 |
+
$self.find(".sbi_photo").sbi_imgLiquid({fill: true});
|
933 |
+
}
|
934 |
+
},
|
935 |
+
listenForVisibilityChange: function() {
|
936 |
+
var feed = this;
|
937 |
+
sbiAddVisibilityListener();
|
938 |
+
if (typeof $(this.el).filter(':hidden').sbiVisibilityChanged == 'function') {
|
939 |
+
//If the feed is initially hidden (in a tab for example) then check for when it becomes visible and set then set the height
|
940 |
+
$(this.el).filter(':hidden').sbiVisibilityChanged({
|
941 |
+
callback: function (element, visible) {
|
942 |
+
feed.afterResize();
|
943 |
},
|
944 |
+
runOnLoad: false
|
945 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
946 |
}
|
947 |
+
},
|
948 |
+
getColumnCount: function() {
|
949 |
+
var $self = $(this.el),
|
950 |
+
cols = this.settings.cols,
|
951 |
+
colsmobile = this.settings.colsmobile,
|
952 |
+
returnCols = cols,
|
953 |
+
sbiWindowWidth = window.innerWidth;
|
954 |
+
|
955 |
+
if ($self.hasClass('sbi_mob_col_auto')) {
|
956 |
+
if (sbiWindowWidth < 640 && (parseInt(cols) > 2 && parseInt(cols) < 7)) returnCols = 2;
|
957 |
+
if (sbiWindowWidth < 640 && (parseInt(cols) > 6 && parseInt(cols) < 11)) returnCols = 4;
|
958 |
+
if (sbiWindowWidth <= 480 && parseInt(cols) > 2) returnCols = 1;
|
959 |
+
} else if (sbiWindowWidth <= 480) {
|
960 |
+
returnCols = colsmobile;
|
961 |
}
|
962 |
|
963 |
+
return parseInt(returnCols);
|
964 |
+
},
|
965 |
+
checkConsent: function() {
|
966 |
+
if (this.settings.consentGiven || !this.settings.gdpr) {
|
967 |
+
return true;
|
968 |
+
}
|
969 |
+
if (typeof CLI_Cookie !== "undefined") { // GDPR Cookie Consent by WebToffee
|
970 |
+
if (CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) !== null) {
|
971 |
|
972 |
+
// WebToffee no longer uses this cookie but being left here to maintain backwards compatibility
|
973 |
+
if (CLI_Cookie.read('cookielawinfo-checkbox-non-necessary') !== null) {
|
974 |
+
this.settings.consentGiven = CLI_Cookie.read('cookielawinfo-checkbox-non-necessary') === 'yes';
|
|
|
|
|
|
|
975 |
}
|
976 |
|
977 |
+
if (CLI_Cookie.read('cookielawinfo-checkbox-necessary') !== null) {
|
978 |
+
this.settings.consentGiven = CLI_Cookie.read('cookielawinfo-checkbox-necessary') === 'yes';
|
979 |
+
}
|
980 |
+
}
|
981 |
+
|
982 |
+
} else if (typeof window.cnArgs !== "undefined") { // Cookie Notice by dFactory
|
983 |
+
var value = "; " + document.cookie,
|
984 |
+
parts = value.split( '; cookie_notice_accepted=' );
|
985 |
+
|
986 |
+
if ( parts.length === 2 ) {
|
987 |
+
var val = parts.pop().split( ';' ).shift();
|
988 |
+
|
989 |
+
this.settings.consentGiven = (val === 'true');
|
990 |
+
}
|
991 |
+
} else if (typeof window.cookieconsent !== 'undefined') { // Complianz by Really Simple Plugins
|
992 |
+
this.settings.consentGiven = sbiCmplzGetCookie('complianz_consent_status') === 'allow';
|
993 |
+
} else if (typeof window.Cookiebot !== "undefined") { // Cookiebot by Cybot A/S
|
994 |
+
this.settings.consentGiven = Cookiebot.consented;
|
995 |
+
} else if (typeof window.BorlabsCookie !== 'undefined') { // Borlabs Cookie by Borlabs
|
996 |
+
this.settings.consentGiven = window.BorlabsCookie.checkCookieConsent('instagram');
|
997 |
}
|
998 |
|
999 |
+
var evt = jQuery.Event('sbicheckconsent');
|
1000 |
+
evt.feed = this;
|
1001 |
+
jQuery(window).trigger(evt);
|
1002 |
|
1003 |
+
return this.settings.consentGiven; // GDPR not enabled
|
1004 |
+
},
|
1005 |
+
afterConsentToggled: function() {
|
1006 |
+
if (this.checkConsent()) {
|
1007 |
+
var feed = this;
|
1008 |
+
feed.maybeRaiseImageResolution();
|
1009 |
+
|
1010 |
+
setTimeout(function() {
|
1011 |
+
feed.afterResize();
|
1012 |
+
},500);
|
1013 |
}
|
1014 |
+
},
|
1015 |
+
locationGuess: function() {
|
1016 |
+
var $feed = $(this.el),
|
1017 |
+
location = 'content';
|
1018 |
+
|
1019 |
+
if ($feed.closest('footer').length) {
|
1020 |
+
location = 'footer';
|
1021 |
+
} else if ($feed.closest('.header').length
|
1022 |
+
|| $feed.closest('header').length) {
|
1023 |
+
location = 'header';
|
1024 |
+
} else if ($feed.closest('.sidebar').length
|
1025 |
+
|| $feed.closest('aside').length) {
|
1026 |
+
location = 'sidebar';
|
1027 |
}
|
|
|
1028 |
|
1029 |
+
return location;
|
1030 |
+
},
|
1031 |
+
};
|
1032 |
+
|
1033 |
+
window.sbi_init = function() {
|
1034 |
+
window.sbi = new Sbi();
|
1035 |
+
window.sbi.createPage( window.sbi.createFeeds, {whenFeedsCreated: window.sbi.afterFeedsCreated});
|
1036 |
+
};
|
1037 |
+
|
1038 |
+
function sbiGetNewFeed(feed,index,feedOptions) {
|
1039 |
+
return new SbiFeed(feed,index,feedOptions);
|
1040 |
+
}
|
1041 |
+
|
1042 |
+
function sbiAjax(submitData,onSuccess) {
|
1043 |
+
$.ajax({
|
1044 |
+
url: sbiajaxurl,
|
1045 |
+
type: 'post',
|
1046 |
+
data: submitData,
|
1047 |
+
success: onSuccess
|
1048 |
+
});
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
function sbiCmplzGetCookie(cname) {
|
1052 |
+
var name = cname + "="; //Create the cookie name variable with cookie name concatenate with = sign
|
1053 |
+
var cArr = window.document.cookie.split(';'); //Create cookie array by split the cookie by ';'
|
1054 |
+
|
1055 |
+
//Loop through the cookies and return the cookie value if it find the cookie name
|
1056 |
+
for (var i = 0; i < cArr.length; i++) {
|
1057 |
+
var c = cArr[i].trim();
|
1058 |
+
//If the name is the cookie string at position 0, we found the cookie and return the cookie value
|
1059 |
+
if (c.indexOf(name) == 0)
|
1060 |
+
return c.substring(name.length, c.length);
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
return "";
|
1064 |
+
}
|
1065 |
+
|
1066 |
+
})(jQuery);
|
1067 |
+
|
1068 |
+
jQuery(document).ready(function($) {
|
1069 |
+
if (typeof window.sb_instagram_js_options === 'undefined') {
|
1070 |
+
window.sb_instagram_js_options = {
|
1071 |
+
font_method: "svg",
|
1072 |
+
resized_url: location.protocol + '//' + window.location.hostname + "/wp-content/uploads/sb-instagram-feed-images/",
|
1073 |
+
placeholder: location.protocol + '//' + window.location.hostname + "/wp-content/plugins/instagram-feed/img/placeholder.png"
|
1074 |
+
};
|
1075 |
+
}
|
1076 |
+
if (typeof window.sb_instagram_js_options.resized_url !== 'undefined' && window.sb_instagram_js_options.resized_url.indexOf(location.protocol) === -1) {
|
1077 |
+
if (location.protocol === 'http:') {
|
1078 |
+
window.sb_instagram_js_options.resized_url = window.sb_instagram_js_options.resized_url.replace('https:','http:');
|
1079 |
+
} else {
|
1080 |
+
window.sb_instagram_js_options.resized_url = window.sb_instagram_js_options.resized_url.replace('http:','https:');
|
1081 |
+
}
|
1082 |
+
}
|
1083 |
+
sbi_init();
|
1084 |
+
|
1085 |
+
// Cookie Notice by dFactory
|
1086 |
+
$('#cookie-notice a').on('click',function() {
|
1087 |
+
setTimeout(function() {
|
1088 |
+
$.each(window.sbi.feeds,function(index){
|
1089 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
1090 |
});
|
1091 |
+
},1000);
|
1092 |
+
});
|
1093 |
|
1094 |
+
// GDPR Cookie Consent by WebToffee
|
1095 |
+
$('#cookie-law-info-bar a').on('click',function() {
|
1096 |
+
setTimeout(function() {
|
1097 |
+
$.each(window.sbi.feeds,function(index){
|
1098 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
|
|
|
|
1099 |
});
|
1100 |
+
},1000);
|
1101 |
+
});
|
1102 |
|
1103 |
+
// GDPR Cookie Consent by WebToffee
|
1104 |
+
$('.cli-user-preference-checkbox').on('click',function(){
|
1105 |
+
setTimeout(function() {
|
1106 |
+
$.each(window.sbi.feeds,function(index){
|
1107 |
+
window.sbi.feeds[ index ].settings.consentGiven = false;
|
1108 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
|
|
|
|
1109 |
});
|
1110 |
+
},1000);
|
1111 |
+
});
|
1112 |
|
1113 |
+
// Cookiebot
|
1114 |
+
$(window).on('CookiebotOnAccept', function (event) {
|
1115 |
+
$.each(window.sbi.feeds,function(index){
|
1116 |
+
window.sbi.feeds[ index ].settings.consentGiven = true;
|
1117 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
1118 |
+
});
|
1119 |
+
});
|
1120 |
|
1121 |
+
// Complianz by Really Simple Plugins
|
1122 |
+
$(document).on('cmplzAcceptAll', function (event) {
|
1123 |
+
$.each(window.sbi.feeds,function(index){
|
1124 |
+
window.sbi.feeds[ index ].settings.consentGiven = true;
|
1125 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
1126 |
+
});
|
1127 |
+
});
|
1128 |
|
1129 |
+
// Complianz by Really Simple Plugins
|
1130 |
+
$(document).on('cmplzRevoke', function (event) {
|
1131 |
+
$.each(window.sbi.feeds,function(index){
|
1132 |
+
window.sbi.feeds[ index ].settings.consentGiven = false;
|
1133 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
1134 |
+
});
|
1135 |
+
});
|
1136 |
|
1137 |
+
// Borlabs Cookie by Borlabs
|
1138 |
+
$(document).on('borlabs-cookie-consent-saved', function (event) {
|
1139 |
+
$.each(window.sbi.feeds,function(index){
|
1140 |
+
window.sbi.feeds[ index ].settings.consentGiven = false;
|
1141 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
1142 |
+
});
|
|
|
1143 |
});
|
1144 |
+
});
|
1145 |
|
1146 |
+
} // if sbi_js_exists
|
js/sb-instagram-2-2.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var sbi_js_exists=void 0!==sbi_js_exists;sbi_js_exists||(!function(i){function e(){var i,e,t,s=s||{VER:"0.9.944"};s.bgs_Available=!1,s.bgs_CheckRunned=!1,function(i){i.fn.extend({sbi_imgLiquid:function(e){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},function(){if(!s.bgs_CheckRunned){s.bgs_CheckRunned=!0;var e=i('<span style="background-size:cover" />');i("body").append(e),function(){var i=e[0];if(i&&window.getComputedStyle){var t=window.getComputedStyle(i,null);t&&t.backgroundSize&&(s.bgs_Available="cover"===t.backgroundSize)}}(),e.remove()}}();var t=this;return this.options=e,this.settings=i.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(e){function n(){(r.responsive||c.data("sbi_imgLiquid_oldProcessed"))&&c.data("sbi_imgLiquid_settings")&&(r=c.data("sbi_imgLiquid_settings"),l.actualSize=l.get(0).offsetWidth+l.get(0).offsetHeight/1e4,l.sizeOld&&l.actualSize!==l.sizeOld&&a(),l.sizeOld=l.actualSize,setTimeout(n,r.responsiveCheckTime))}function o(){c.data("sbi_imgLiquid_error",!0),l.addClass("sbi_imgLiquid_error"),r.onItemError&&r.onItemError(e,l,c),d()}function a(){var i,t,s,n,o,a,h,g,f=0,u=0,b=l.width(),_=l.height();void 0===c.data("owidth")&&c.data("owidth",c[0].width),void 0===c.data("oheight")&&c.data("oheight",c[0].height),r.fill===b/_>=c.data("owidth")/c.data("oheight")?(i="100%",t="auto",s=Math.floor(b),n=Math.floor(b*(c.data("oheight")/c.data("owidth")))):(i="auto",t="100%",s=Math.floor(_*(c.data("owidth")/c.data("oheight"))),n=Math.floor(_)),h=b-s,"left"===(o=r.horizontalAlign.toLowerCase())&&(u=0),"center"===o&&(u=.5*h),"right"===o&&(u=h),-1!==o.indexOf("%")&&((o=parseInt(o.replace("%",""),10))>0&&(u=h*o*.01)),g=_-n,"left"===(a=r.verticalAlign.toLowerCase())&&(f=0),"center"===a&&(f=.5*g),"bottom"===a&&(f=g),-1!==a.indexOf("%")&&((a=parseInt(a.replace("%",""),10))>0&&(f=g*a*.01)),r.hardPixels&&(i=s,t=n),c.css({width:i,height:t,"margin-left":Math.floor(u),"margin-top":Math.floor(f)}),c.data("sbi_imgLiquid_oldProcessed")||(c.fadeTo(r.fadeInTime,1),c.data("sbi_imgLiquid_oldProcessed",!0),r.removeBoxBackground&&l.css("background-image","none"),l.addClass("sbi_imgLiquid_nobgSize"),l.addClass("sbi_imgLiquid_ready")),r.onItemFinish&&r.onItemFinish(e,l,c),d()}function d(){e===t.length-1&&t.settings.onFinish&&t.settings.onFinish()}var r=t.settings,l=i(this),c=i("img:first",l);return c.length?(c.data("sbi_imgLiquid_settings")?(l.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"),r=i.extend({},c.data("sbi_imgLiquid_settings"),t.options)):r=i.extend({},t.settings,function(){var i={};if(t.settings.useDataHtmlAttr){var e=l.attr("data-sbi_imgLiquid-fill"),n=l.attr("data-sbi_imgLiquid-horizontalAlign"),o=l.attr("data-sbi_imgLiquid-verticalAlign");("true"===e||"false"===e)&&(i.fill=Boolean("true"===e)),void 0===n||"left"!==n&&"center"!==n&&"right"!==n&&-1===n.indexOf("%")||(i.horizontalAlign=n),void 0===o||"top"!==o&&"bottom"!==o&&"center"!==o&&-1===o.indexOf("%")||(i.verticalAlign=o)}return s.isIE&&t.settings.ieFadeInDisabled&&(i.fadeInTime=0),i}()),c.data("sbi_imgLiquid_settings",r),r.onItemStart&&r.onItemStart(e,l,c),void(s.bgs_Available&&r.useBackgroundSize?(-1===l.css("background-image").indexOf(encodeURI(c.attr("src")))&&l.css({"background-image":'url("'+encodeURI(c.attr("src"))+'")'}),l.css({"background-size":r.fill?"cover":"contain","background-position":(r.horizontalAlign+" "+r.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),i("a:first",l).css({display:"block",width:"100%",height:"100%"}),i("img",l).css({display:"none"}),r.onItemFinish&&r.onItemFinish(e,l,c),l.addClass("sbi_imgLiquid_bgSize"),l.addClass("sbi_imgLiquid_ready"),d()):function t(){if(c.data("oldSrc")&&c.data("oldSrc")!==c.attr("src")){var s=c.clone().removeAttr("style");return s.data("sbi_imgLiquid_settings",c.data("sbi_imgLiquid_settings")),c.parent().prepend(s),c.remove(),(c=s)[0].width=0,void setTimeout(t,10)}return c.data("sbi_imgLiquid_oldProcessed")?void a():(c.data("sbi_imgLiquid_oldProcessed",!1),c.data("oldSrc",c.attr("src")),i("img:not(:first)",l).css("display","none"),l.css({overflow:"hidden"}),c.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),c.on("error",o),c[0].onerror=o,function i(){c.data("sbi_imgLiquid_error")||c.data("sbi_imgLiquid_loaded")||c.data("sbi_imgLiquid_oldProcessed")||(l.is(":visible")&&c[0].complete&&c[0].width>0&&c[0].height>0?(c.data("sbi_imgLiquid_loaded",!0),setTimeout(a,e*r.delay)):setTimeout(i,r.timecheckvisibility))}(),void n())}())):void o()})}})}(jQuery),i=s.injectCss,e=document.getElementsByTagName("head")[0],(t=document.createElement("style")).type="text/css",t.styleSheet?t.styleSheet.cssText=i:t.appendChild(document.createTextNode(i)),e.appendChild(t)}function t(){this.feeds={},this.options=sb_instagram_js_options}function s(i,e,t){this.el=i,this.index=e,this.settings=t,this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.page=1,this.isInitialized=!1}function n(e,t){i.ajax({url:sbiajaxurl,type:"post",data:e,success:t})}t.prototype={createPage:function(e,t){void 0!==window.sbiajaxurl&&-1!==window.sbiajaxurl.indexOf(window.location.hostname)||(window.sbiajaxurl=location.protocol+"//"+window.location.hostname+"/wp-admin/admin-ajax.php"),i(".sbi_no_js_error_message").remove(),i(".sbi_no_js").removeClass("sbi_no_js"),e(t)},createFeeds:function(e){e.whenFeedsCreated(i(".sbi").each(function(e){i(this).attr("data-sbi-index",e+1);var t=i(this),o=void 0!==t.attr("data-sbi-flags")?t.attr("data-sbi-flags").split(","):[],a=void 0!==t.attr("data-options")?JSON.parse(t.attr("data-options")):{};if(o.indexOf("testAjax")>-1){window.sbi.triggeredTest=!0;n({action:"sbi_on_ajax_test_trigger"},function(i){console.log("did test")})}var d={cols:t.attr("data-cols"),colsmobile:void 0!==t.attr("data-colsmobile")&&"same"!==t.attr("data-colsmobile")?t.attr("data-colsmobile"):t.attr("data-cols"),num:t.attr("data-num"),imgRes:t.attr("data-res"),feedID:t.attr("data-feedid"),postID:"undefind"!=typeof t.attr("data-postid")?t.attr("data-postid"):"unknown",shortCodeAtts:t.attr("data-shortcode-atts"),resizingEnabled:-1===o.indexOf("resizeDisable"),imageLoadEnabled:-1===o.indexOf("imageLoadDisable"),debugEnabled:o.indexOf("debug")>-1,favorLocal:o.indexOf("favorLocal")>-1,ajaxPostLoad:o.indexOf("ajaxPostLoad")>-1,gdpr:o.indexOf("gdpr")>-1,overrideBlockCDN:o.indexOf("overrideBlockCDN")>-1,consentGiven:!1,locator:o.indexOf("locator")>-1,autoMinRes:1,general:a};window.sbi.feeds[e]=function(i,e,t){return new s(i,e,t)}(this,e,d),window.sbi.feeds[e].setResizedImages(),window.sbi.feeds[e].init();var r=jQuery.Event("sbiafterfeedcreate");r.feed=window.sbi.feeds[e],jQuery(window).trigger(r)}))},afterFeedsCreated:function(){i(".sb_instagram_header").each(function(){var e=i(this);e.find(".sbi_header_link").on("mouseenter mouseleave",function(i){switch(i.type){case"mouseenter":e.find(".sbi_header_img_hover").addClass("sbi_fade_in");break;case"mouseleave":e.find(".sbi_header_img_hover").removeClass("sbi_fade_in")}})})},encodeHTML:function(i){return void 0===i?"":i.replace(/(>)/g,">").replace(/(<)/g,"<").replace(/(<br\/>)/g,"<br>").replace(/(<br>)/g,"<br>")},urlDetect:function(i){return i.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g)}},s.prototype={init:function(){var e=this;e.settings.consentGiven=e.checkConsent(),i(this.el).find(".sbi_photo").parent("p").length&&i(this.el).addClass("sbi_no_autop"),i(this.el).find("#sbi_mod_error").length&&i(this.el).prepend(i(this.el).find("#sbi_mod_error")),this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var t,s=(t=0,function(i,e){clearTimeout(t),t=setTimeout(i,e)});jQuery(window).on("resize",function(){s(function(){e.afterResize()},500)}),i(this.el).find(".sbi_item").each(function(){e.lazyLoadCheck(i(this))})},initLayout:function(){},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraImagesForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass()},afterLoadMoreClicked:function(i){i.find(".sbi_loader").removeClass("sbi_hidden"),i.find(".sbi_btn_text").addClass("sbi_hidden"),i.closest(".sbi").find(".sbi_num_diff_hide").addClass("sbi_transition").removeClass("sbi_num_diff_hide")},afterNewImagesLoaded:function(){var e=i(this.el),t=this;this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),setTimeout(function(){e.find(".sbi_loader").addClass("sbi_hidden"),e.find(".sbi_btn_text").removeClass("sbi_hidden"),t.maybeRaiseImageResolution()},500)},beforeNewImagesRevealed:function(){this.setImageHeight(),this.maybeRaiseImageResolution(!0),this.setImageSizeClass()},revealNewImages:function(){var e=i(this.el);e.find(".sbi-screenreader").each(function(){i(this).find("img").remove()}),"function"==typeof sbi_custom_js&&setTimeout(function(){sbi_custom_js()},100),this.applyImageLiquid(),e.find(".sbi_item").each(function(i){jQuery(this).find(".sbi_photo").on("mouseenter mouseleave",function(i){switch(i.type){case"mouseenter":jQuery(this).fadeTo(200,.85);break;case"mouseleave":jQuery(this).stop().fadeTo(500,1)}})}),setTimeout(function(){jQuery("#sbi_images .sbi_item.sbi_new").removeClass("sbi_new");var i=10;e.find(".sbi_transition").each(function(){var e=jQuery(this);setTimeout(function(){e.removeClass("sbi_transition")},i),i+=10})},500)},lazyLoadCheck:function(e){if(e.find(".sbi_photo").length&&!e.closest(".sbi").hasClass("sbi-no-ll-check")){var t=this.getImageUrls(e),s=void 0!==t[640]?t[640]:e.find(".sbi_photo").attr("data-full-res");if(!this.settings.consentGiven&&s.indexOf("scontent")>-1)return;e.find(".sbi_photo img").each(function(){s&&void 0!==i(this).attr("data-src")&&i(this).attr("data-src",s),s&&void 0!==i(this).attr("data-orig-src")&&i(this).attr("data-orig-src",s),i(this).on("load",function(){!i(this).hasClass("sbi-replaced")&&i(this).attr("src").indexOf("placeholder")>-1&&(i(this).addClass("sbi-replaced"),s&&(i(this).attr("src",s),i(this).closest(".sbi_imgLiquid_bgSize").length&&i(this).closest(".sbi_imgLiquid_bgSize").css("background-image","url("+s+")")))})})}},afterNewImagesRevealed:function(){this.listenForVisibilityChange(),this.sendNeedsResizingToServer(),this.settings.imageLoadEnabled||i(".sbi_no_resraise").removeClass("sbi_no_resraise");var e=i.Event("sbiafterimagesloaded");e.el=i(this.el),i(window).trigger(e)},setResizedImages:function(){i(this.el).find(".sbi_resized_image_data").length&&void 0!==i(this.el).find(".sbi_resized_image_data").attr("data-resized")&&0===i(this.el).find(".sbi_resized_image_data").attr("data-resized").indexOf('{"')&&(this.resizedImages=JSON.parse(i(this.el).find(".sbi_resized_image_data").attr("data-resized")),i(this.el).find(".sbi_resized_image_data").remove())},sendNeedsResizingToServer:function(){var e=this,t=i(this.el);if(e.needsResizing.length>0&&e.settings.resizingEnabled){var s=i(this.el).find(".sbi_item").length,o=void 0!==e.settings.general.cache_all&&e.settings.general.cache_all,a="";void 0!==t.attr("data-locatornonce")&&(a=t.attr("data-locatornonce")),n({action:"sbi_resized_images_submit",needs_resizing:e.needsResizing,offset:s,feed_id:e.settings.feedID,atts:e.settings.shortCodeAtts,location:e.locationGuess(),post_id:e.settings.postID,cache_all:o,locator_nonce:a},function(i){if(0===i.trim().indexOf("{")){var t=JSON.parse(i);for(var s in e.settings.debugEnabled&&console.log(t),t)t.hasOwnProperty(s)&&(e.resizedImages[s]=t[s]);e.maybeRaiseImageResolution(),setTimeout(function(){e.afterResize()},500)}})}else if(e.settings.locator){a="";void 0!==t.attr("data-locatornonce")&&(a=t.attr("data-locatornonce")),n({action:"sbi_do_locator",feed_id:e.settings.feedID,atts:e.settings.shortCodeAtts,location:e.locationGuess(),post_id:e.settings.postID,locator_nonce:a},function(i){})}},loadMoreButtonInit:function(){var e=i(this.el),t=this;e.find("#sbi_load .sbi_load_btn").off().on("click",function(){t.afterLoadMoreClicked(jQuery(this)),t.getNewPostSet()})},getNewPostSet:function(){var e=i(this.el),t=this;t.page++;var s="";void 0!==e.attr("data-locatornonce")&&(s=e.attr("data-locatornonce"));n({action:"sbi_load_more_clicked",offset:e.find(".sbi_item").length,page:t.page,feed_id:t.settings.feedID,atts:t.settings.shortCodeAtts,location:t.locationGuess(),post_id:t.settings.postID,current_resolution:t.imageResolution,locator_nonce:s},function(s){if(0===s.trim().indexOf("{")){var n=JSON.parse(s);t.settings.debugEnabled&&console.log(n),t.appendNewPosts(n.html),t.addResizedImages(n.resizedImages),t.settings.ajaxPostLoad?(t.settings.ajaxPostLoad=!1,t.afterInitialImagesLoaded()):t.afterNewImagesLoaded(),n.feedStatus.shouldPaginate?t.outOfPages=!1:(t.outOfPages=!0,e.find(".sbi_load_btn").hide()),i(".sbi_no_js").removeClass("sbi_no_js")}})},appendNewPosts:function(e){var t=i(this.el);t.find("#sbi_images .sbi_item").length?t.find("#sbi_images .sbi_item").last().after(e):t.find("#sbi_images").append(e)},addResizedImages:function(i){for(var e in i)this.resizedImages[e]=i[e]},setImageHeight:function(){var e=i(this.el),t=e.find(".sbi_photo").eq(0).innerWidth(),s=this.getColumnCount(),n=e.find("#sbi_images").innerWidth()-e.find("#sbi_images").width(),o=n/2;sbi_photo_width_manual=e.find("#sbi_images").width()/s-n,e.find(".sbi_photo").css("height",t),e.find(".sbi-owl-nav").length&&setTimeout(function(){var i=2;e.find(".sbi_owl2row-item").length&&(i=1);var t=e.find(".sbi_photo").eq(0).innerWidth()/i;t+=parseInt(o)*(2-i+2),e.find(".sbi-owl-nav div").css("top",t)},100)},maybeRaiseSingleImageResolution:function(e,t,s){var n=this,o=n.getImageUrls(e),a=e.find(".sbi_photo img").attr("src"),d=150,r=e.find("img").get(0),l=a===window.sbi.options.placeholder?1:r.naturalWidth/r.naturalHeight;s=void 0!==s&&s;if(!(e.hasClass("sbi_no_resraise")||e.hasClass("sbi_had_error")||e.find(".sbi_link_area").length&&e.find(".sbi_link_area").hasClass("sbi_had_error")))if(o.length<1)e.find(".sbi_link_area").length&&e.find(".sbi_link_area").attr("href",window.sbi.options.placeholder.replace("placeholder.png","thumb-placeholder.png"));else{(e.find(".sbi_link_area").length&&e.find(".sbi_link_area").attr("href")===window.sbi.options.placeholder.replace("placeholder.png","thumb-placeholder.png")||!n.settings.consentGiven)&&e.find(".sbi_link_area").attr("href",o[o.length-1]),void 0!==o[640]&&e.find(".sbi_photo").attr("data-full-res",o[640]),i.each(o,function(i,e){e===a&&(d=parseInt(i),s=!1)});var c=640;switch(n.settings.imgRes){case"thumb":c=150;break;case"medium":c=320;break;case"full":c=640;break;default:var h=Math.max(n.settings.autoMinRes,e.find(".sbi_photo").innerWidth()),g=n.getBestResolutionForAuto(h,l,e);switch(g){case 320:c=320;break;case 150:c=150}}if(c>d||a===window.sbi.options.placeholder||s){if(n.settings.debugEnabled){var f=a===window.sbi.options.placeholder?"was placeholder":"too small";console.log("rais res for "+a,f)}var u=o[c].split("?ig_cache_key")[0];if(a!==u&&(e.find(".sbi_photo img").attr("src",u),e.find(".sbi_photo").css("background-image",'url("'+u+'")')),d=c,"auto"===n.settings.imgRes){var b=!1;e.find(".sbi_photo img").on("load",function(){var t=i(this),s=t.get(0).naturalWidth/t.get(0).naturalHeight;if(1e3!==t.get(0).naturalWidth&&s>l&&!b){switch(n.settings.debugEnabled&&console.log("rais res again for aspect ratio change "+a),b=!0,h=e.find(".sbi_photo").innerWidth(),g=n.getBestResolutionForAuto(h,s,e),c=640,g){case 320:c=320;break;case 150:c=150}c>d&&(u=o[c].split("?ig_cache_key")[0],t.attr("src",u),t.closest(".sbi_photo").css("background-image",'url("'+u+'")')),"masonry"!==n.layout&&"highlight"!==n.layout||(i(n.el).find("#sbi_images").smashotope(n.isotopeArgs),setTimeout(function(){i(n.el).find("#sbi_images").smashotope(n.isotopeArgs)},500))}else if(n.settings.debugEnabled){var r=b?"already checked":"no aspect ratio change";console.log("not raising res for replacement "+a,r)}})}}e.find("img").on("error",function(){if(i(this).hasClass("sbi_img_error"))console.log("unfixed error "+i(this).attr("src"));else{var e;if(i(this).addClass("sbi_img_error"),!(i(this).attr("src").indexOf("media/?size=")>-1||i(this).attr("src").indexOf("cdninstagram")>-1||i(this).attr("src").indexOf("fbcdn")>-1)&&n.settings.consentGiven){if("undefined"!==i(this).closest(".sbi_photo").attr("data-img-src-set"))void 0!==(e=JSON.parse(i(this).closest(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/"))).d&&(i(this).attr("src",e.d),i(this).closest(".sbi_photo").css("background-image","url("+e.d+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"))}else n.settings.favorLocal=!0,void 0!==(e=n.getImageUrls(i(this).closest(".sbi_item")))[640]&&(i(this).attr("src",e[640]),i(this).closest(".sbi_photo").css("background-image","url("+e[640]+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"));setTimeout(function(){n.afterResize()},1500)}})}},maybeRaiseImageResolution:function(e){var t=this,s=void 0!==e&&!0===e?".sbi_item.sbi_new":".sbi_item",n=!t.isInitialized;i(t.el).find(s).each(function(e){!i(this).hasClass("sbi_num_diff_hide")&&i(this).find(".sbi_photo").length&&void 0!==i(this).find(".sbi_photo").attr("data-img-src-set")&&t.maybeRaiseSingleImageResolution(i(this),e,n)}),t.isInitialized=!0},getBestResolutionForAuto:function(e,t,s){(isNaN(t)||t<1)&&(t=1);var n=e*t,o=10*Math.ceil(n/10),a=[150,320,640];if(s.hasClass("sbi_highlighted")&&(o*=2),-1===a.indexOf(parseInt(o))){var d=!1;i.each(a,function(i,e){e>parseInt(o)&&!d&&(o=e,d=!0)})}return o},hideExtraImagesForWidth:function(){if("carousel"!==this.layout){var e=i(this.el),t=void 0!==e.attr("data-num")&&""!==e.attr("data-num")?parseInt(e.attr("data-num")):1,s=void 0!==e.attr("data-nummobile")&&""!==e.attr("data-nummobile")?parseInt(e.attr("data-nummobile")):t;i(window).width()<480?s<e.find(".sbi_item").length&&e.find(".sbi_item").slice(s-e.find(".sbi_item").length).addClass("sbi_num_diff_hide"):t<e.find(".sbi_item").length&&e.find(".sbi_item").slice(t-e.find(".sbi_item").length).addClass("sbi_num_diff_hide")}},setImageSizeClass:function(){var e=i(this.el);e.removeClass("sbi_small sbi_medium");var t=e.innerWidth(),s=parseInt(e.find("#sbi_images").outerWidth()-e.find("#sbi_images").width())/2,n=this.getColumnCount(),o=(t-s*(n+2))/n;o>120&&o<240?e.addClass("sbi_medium"):o<=120&&e.addClass("sbi_small")},setMinImageWidth:function(){i(this.el).find(".sbi_item .sbi_photo").first().length?this.minImageWidth=i(this.el).find(".sbi_item .sbi_photo").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(i){var e=JSON.parse(i.find(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/")),t=i.attr("id").replace("sbi_","");if(this.settings.consentGiven||this.settings.overrideBlockCDN||(e=[]),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&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"full.jpg",s.push(640)),void 0!==this.resizedImages[t].sizes.low&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"low.jpg",s.push(320)),void 0!==this.resizedImages[t].sizes.thumb&&(s.push(150),e[150]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"thumb.jpg"),this.settings.favorLocal&&(-1===s.indexOf(640)&&s.indexOf(320)>-1&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"low.jpg"),-1===s.indexOf(320)&&(s.indexOf(640)>-1?e[320]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"full.jpg":s.indexOf(150)>-1&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"thumb.jpg")),-1===s.indexOf(150)&&(s.indexOf(320)>-1?e[150]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"low.jpg":s.indexOf(640)>-1&&(e[150]=sb_instagram_js_options.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 e},getAvatarUrl:function(i,e){if(""===i)return"";var t=this.settings.general.avatars;return"local"===(e=void 0!==e?e:"local")?void 0!==t["LCL"+i]&&1===parseInt(t["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":void 0!==t[i]?t[i]:"":void 0!==t[i]?t[i]:void 0!==t["LCL"+i]&&1===parseInt(t["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":""},addToNeedsResizing:function(i){-1===this.needsResizing.indexOf(i)&&this.needsResizing.push(i)},applyImageLiquid:function(){var t=i(this.el);e(),"function"==typeof t.find(".sbi_photo").sbi_imgLiquid&&t.find(".sbi_photo").sbi_imgLiquid({fill:!0})},listenForVisibilityChange:function(){var e,t,s,n=this;e=jQuery,t={callback:function(){},runOnLoad:!0,frequency:100,sbiPreviousVisibility:null},s={sbiCheckVisibility:function(i,e){if(jQuery.contains(document,i[0])){var t=e.sbiPreviousVisibility,n=i.is(":visible");e.sbiPreviousVisibility=n,null==t?e.runOnLoad&&e.callback(i,n):t!==n&&e.callback(i,n),setTimeout(function(){s.sbiCheckVisibility(i,e)},e.frequency)}}},e.fn.sbiVisibilityChanged=function(i){var n=e.extend({},t,i);return this.each(function(){s.sbiCheckVisibility(e(this),n)})},"function"==typeof i(this.el).filter(":hidden").sbiVisibilityChanged&&i(this.el).filter(":hidden").sbiVisibilityChanged({callback:function(i,e){n.afterResize()},runOnLoad:!1})},getColumnCount:function(){var e=i(this.el),t=this.settings.cols,s=this.settings.colsmobile,n=t;return sbiWindowWidth=window.innerWidth,e.hasClass("sbi_mob_col_auto")?(sbiWindowWidth<640&&parseInt(t)>2&&parseInt(t)<7&&(n=2),sbiWindowWidth<640&&parseInt(t)>6&&parseInt(t)<11&&(n=4),sbiWindowWidth<=480&&parseInt(t)>2&&(n=1)):sbiWindowWidth<=480&&(n=s),parseInt(n)},checkConsent:function(){if(this.settings.consentGiven||!this.settings.gdpr)return!0;if("undefined"!=typeof CLI_Cookie)null!==CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)&&(null!==CLI_Cookie.read("cookielawinfo-checkbox-non-necessary")&&(this.settings.consentGiven="yes"===CLI_Cookie.read("cookielawinfo-checkbox-non-necessary")),null!==CLI_Cookie.read("cookielawinfo-checkbox-necessary")&&(this.settings.consentGiven="yes"===CLI_Cookie.read("cookielawinfo-checkbox-necessary")));else if(void 0!==window.cnArgs){var i=("; "+document.cookie).split("; cookie_notice_accepted=");if(2===i.length){var e=i.pop().split(";").shift();this.settings.consentGiven="true"===e}}else void 0!==window.cookieconsent?this.settings.consentGiven="allow"===function(i){for(var e=i+"=",t=window.document.cookie.split(";"),s=0;s<t.length;s++){var n=t[s].trim();if(0==n.indexOf(e))return n.substring(e.length,n.length)}return""}("complianz_consent_status"):void 0!==window.Cookiebot?this.settings.consentGiven=Cookiebot.consented:void 0!==window.BorlabsCookie&&(this.settings.consentGiven=window.BorlabsCookie.checkCookieConsent("instagram"));var t=jQuery.Event("sbicheckconsent");return t.feed=this,jQuery(window).trigger(t),this.settings.consentGiven},afterConsentToggled:function(){if(this.checkConsent()){var i=this;i.maybeRaiseImageResolution(),setTimeout(function(){i.afterResize()},500)}},locationGuess:function(){var e=i(this.el),t="content";return e.closest("footer").length?t="footer":e.closest(".header").length||e.closest("header").length?t="header":(e.closest(".sidebar").length||e.closest("aside").length)&&(t="sidebar"),t}},window.sbi_init=function(){window.sbi=new t,window.sbi.createPage(window.sbi.createFeeds,{whenFeedsCreated:window.sbi.afterFeedsCreated})}}(jQuery),jQuery(document).ready(function(i){void 0===window.sb_instagram_js_options&&(window.sb_instagram_js_options={font_method:"svg",resized_url:location.protocol+"//"+window.location.hostname+"/wp-content/uploads/sb-instagram-feed-images/",placeholder:location.protocol+"//"+window.location.hostname+"/wp-content/plugins/instagram-feed/img/placeholder.png"}),void 0!==window.sb_instagram_js_options.resized_url&&-1===window.sb_instagram_js_options.resized_url.indexOf(location.protocol)&&("http:"===location.protocol?window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("https:","http:"):window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("http:","https:")),sbi_init(),i("#cookie-notice a").on("click",function(){setTimeout(function(){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].afterConsentToggled()})},1e3)}),i("#cookie-law-info-bar a").on("click",function(){setTimeout(function(){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].afterConsentToggled()})},1e3)}),i(".cli-user-preference-checkbox").on("click",function(){setTimeout(function(){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!1,window.sbi.feeds[i].afterConsentToggled()})},1e3)}),i(window).on("CookiebotOnAccept",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!0,window.sbi.feeds[i].afterConsentToggled()})}),i(document).on("cmplzAcceptAll",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!0,window.sbi.feeds[i].afterConsentToggled()})}),i(document).on("cmplzRevoke",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!1,window.sbi.feeds[i].afterConsentToggled()})}),i(document).on("borlabs-cookie-consent-saved",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!1,window.sbi.feeds[i].afterConsentToggled()})})}));
|
1 |
+
var sbi_js_exists=void 0!==sbi_js_exists;sbi_js_exists||(!function(i){function e(){var i,e,t,s=s||{VER:"0.9.944"};s.bgs_Available=!1,s.bgs_CheckRunned=!1,function(i){i.fn.extend({sbi_imgLiquid:function(e){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},function(){if(!s.bgs_CheckRunned){s.bgs_CheckRunned=!0;var e=i('<span style="background-size:cover" />');i("body").append(e),function(){var i=e[0];if(i&&window.getComputedStyle){var t=window.getComputedStyle(i,null);t&&t.backgroundSize&&(s.bgs_Available="cover"===t.backgroundSize)}}(),e.remove()}}();var t=this;return this.options=e,this.settings=i.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(e){function n(){(r.responsive||c.data("sbi_imgLiquid_oldProcessed"))&&c.data("sbi_imgLiquid_settings")&&(r=c.data("sbi_imgLiquid_settings"),l.actualSize=l.get(0).offsetWidth+l.get(0).offsetHeight/1e4,l.sizeOld&&l.actualSize!==l.sizeOld&&a(),l.sizeOld=l.actualSize,setTimeout(n,r.responsiveCheckTime))}function o(){c.data("sbi_imgLiquid_error",!0),l.addClass("sbi_imgLiquid_error"),r.onItemError&&r.onItemError(e,l,c),d()}function a(){var i,t,s,n,o,a,h,g,f=0,u=0,b=l.width(),_=l.height();void 0===c.data("owidth")&&c.data("owidth",c[0].width),void 0===c.data("oheight")&&c.data("oheight",c[0].height),r.fill===b/_>=c.data("owidth")/c.data("oheight")?(i="100%",t="auto",s=Math.floor(b),n=Math.floor(b*(c.data("oheight")/c.data("owidth")))):(i="auto",t="100%",s=Math.floor(_*(c.data("owidth")/c.data("oheight"))),n=Math.floor(_)),h=b-s,"left"===(o=r.horizontalAlign.toLowerCase())&&(u=0),"center"===o&&(u=.5*h),"right"===o&&(u=h),-1!==o.indexOf("%")&&((o=parseInt(o.replace("%",""),10))>0&&(u=h*o*.01)),g=_-n,"left"===(a=r.verticalAlign.toLowerCase())&&(f=0),"center"===a&&(f=.5*g),"bottom"===a&&(f=g),-1!==a.indexOf("%")&&((a=parseInt(a.replace("%",""),10))>0&&(f=g*a*.01)),r.hardPixels&&(i=s,t=n),c.css({width:i,height:t,"margin-left":Math.floor(u),"margin-top":Math.floor(f)}),c.data("sbi_imgLiquid_oldProcessed")||(c.fadeTo(r.fadeInTime,1),c.data("sbi_imgLiquid_oldProcessed",!0),r.removeBoxBackground&&l.css("background-image","none"),l.addClass("sbi_imgLiquid_nobgSize"),l.addClass("sbi_imgLiquid_ready")),r.onItemFinish&&r.onItemFinish(e,l,c),d()}function d(){e===t.length-1&&t.settings.onFinish&&t.settings.onFinish()}var r=t.settings,l=i(this),c=i("img:first",l);return c.length?(c.data("sbi_imgLiquid_settings")?(l.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"),r=i.extend({},c.data("sbi_imgLiquid_settings"),t.options)):r=i.extend({},t.settings,function(){var i={};if(t.settings.useDataHtmlAttr){var e=l.attr("data-sbi_imgLiquid-fill"),n=l.attr("data-sbi_imgLiquid-horizontalAlign"),o=l.attr("data-sbi_imgLiquid-verticalAlign");("true"===e||"false"===e)&&(i.fill=Boolean("true"===e)),void 0===n||"left"!==n&&"center"!==n&&"right"!==n&&-1===n.indexOf("%")||(i.horizontalAlign=n),void 0===o||"top"!==o&&"bottom"!==o&&"center"!==o&&-1===o.indexOf("%")||(i.verticalAlign=o)}return s.isIE&&t.settings.ieFadeInDisabled&&(i.fadeInTime=0),i}()),c.data("sbi_imgLiquid_settings",r),r.onItemStart&&r.onItemStart(e,l,c),void(s.bgs_Available&&r.useBackgroundSize?(-1===l.css("background-image").indexOf(encodeURI(c.attr("src")))&&l.css({"background-image":'url("'+encodeURI(c.attr("src"))+'")'}),l.css({"background-size":r.fill?"cover":"contain","background-position":(r.horizontalAlign+" "+r.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),i("a:first",l).css({display:"block",width:"100%",height:"100%"}),i("img",l).css({display:"none"}),r.onItemFinish&&r.onItemFinish(e,l,c),l.addClass("sbi_imgLiquid_bgSize"),l.addClass("sbi_imgLiquid_ready"),d()):function t(){if(c.data("oldSrc")&&c.data("oldSrc")!==c.attr("src")){var s=c.clone().removeAttr("style");return s.data("sbi_imgLiquid_settings",c.data("sbi_imgLiquid_settings")),c.parent().prepend(s),c.remove(),(c=s)[0].width=0,void setTimeout(t,10)}return c.data("sbi_imgLiquid_oldProcessed")?void a():(c.data("sbi_imgLiquid_oldProcessed",!1),c.data("oldSrc",c.attr("src")),i("img:not(:first)",l).css("display","none"),l.css({overflow:"hidden"}),c.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),c.on("error",o),c[0].onerror=o,function i(){c.data("sbi_imgLiquid_error")||c.data("sbi_imgLiquid_loaded")||c.data("sbi_imgLiquid_oldProcessed")||(l.is(":visible")&&c[0].complete&&c[0].width>0&&c[0].height>0?(c.data("sbi_imgLiquid_loaded",!0),setTimeout(a,e*r.delay)):setTimeout(i,r.timecheckvisibility))}(),void n())}())):void o()})}})}(jQuery),i=s.injectCss,e=document.getElementsByTagName("head")[0],(t=document.createElement("style")).type="text/css",t.styleSheet?t.styleSheet.cssText=i:t.appendChild(document.createTextNode(i)),e.appendChild(t)}function t(){this.feeds={},this.options=sb_instagram_js_options}function s(i,e,t){this.el=i,this.index=e,this.settings=t,this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.page=1,this.isInitialized=!1}function n(e,t){i.ajax({url:sbiajaxurl,type:"post",data:e,success:t})}t.prototype={createPage:function(e,t){void 0!==window.sbiajaxurl&&-1!==window.sbiajaxurl.indexOf(window.location.hostname)||(window.sbiajaxurl=location.protocol+"//"+window.location.hostname+"/wp-admin/admin-ajax.php"),i(".sbi_no_js_error_message").remove(),i(".sbi_no_js").removeClass("sbi_no_js"),e(t)},createFeeds:function(e){e.whenFeedsCreated(i(".sbi").each(function(e){i(this).attr("data-sbi-index",e+1);var t=i(this),o=void 0!==t.attr("data-sbi-flags")?t.attr("data-sbi-flags").split(","):[],a=void 0!==t.attr("data-options")?JSON.parse(t.attr("data-options")):{};if(o.indexOf("testAjax")>-1){window.sbi.triggeredTest=!0;n({action:"sbi_on_ajax_test_trigger"},function(i){console.log("did test")})}var d={cols:t.attr("data-cols"),colsmobile:void 0!==t.attr("data-colsmobile")&&"same"!==t.attr("data-colsmobile")?t.attr("data-colsmobile"):t.attr("data-cols"),num:t.attr("data-num"),imgRes:t.attr("data-res"),feedID:t.attr("data-feedid"),postID:"undefind"!=typeof t.attr("data-postid")?t.attr("data-postid"):"unknown",shortCodeAtts:t.attr("data-shortcode-atts"),resizingEnabled:-1===o.indexOf("resizeDisable"),imageLoadEnabled:-1===o.indexOf("imageLoadDisable"),debugEnabled:o.indexOf("debug")>-1,favorLocal:o.indexOf("favorLocal")>-1,ajaxPostLoad:o.indexOf("ajaxPostLoad")>-1,gdpr:o.indexOf("gdpr")>-1,overrideBlockCDN:o.indexOf("overrideBlockCDN")>-1,consentGiven:!1,locator:o.indexOf("locator")>-1,autoMinRes:1,general:a};window.sbi.feeds[e]=function(i,e,t){return new s(i,e,t)}(this,e,d),window.sbi.feeds[e].setResizedImages(),window.sbi.feeds[e].init();var r=jQuery.Event("sbiafterfeedcreate");r.feed=window.sbi.feeds[e],jQuery(window).trigger(r)}))},afterFeedsCreated:function(){i(".sb_instagram_header").each(function(){var e=i(this);e.find(".sbi_header_link").on("mouseenter mouseleave",function(i){switch(i.type){case"mouseenter":e.find(".sbi_header_img_hover").addClass("sbi_fade_in");break;case"mouseleave":e.find(".sbi_header_img_hover").removeClass("sbi_fade_in")}})})},encodeHTML:function(i){return void 0===i?"":i.replace(/(>)/g,">").replace(/(<)/g,"<").replace(/(<br\/>)/g,"<br>").replace(/(<br>)/g,"<br>")},urlDetect:function(i){return i.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g)}},s.prototype={init:function(){var e=this;e.settings.consentGiven=e.checkConsent(),i(this.el).find(".sbi_photo").parent("p").length&&i(this.el).addClass("sbi_no_autop"),i(this.el).find("#sbi_mod_error").length&&i(this.el).prepend(i(this.el).find("#sbi_mod_error")),this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var t,s=(t=0,function(i,e){clearTimeout(t),t=setTimeout(i,e)});jQuery(window).on("resize",function(){s(function(){e.afterResize()},500)}),i(this.el).find(".sbi_item").each(function(){e.lazyLoadCheck(i(this))})},afterInitialImagesLoaded:function(){this.loadMoreButtonInit(),this.hideExtraImagesForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass()},afterLoadMoreClicked:function(i){i.find(".sbi_loader").removeClass("sbi_hidden"),i.find(".sbi_btn_text").addClass("sbi_hidden"),i.closest(".sbi").find(".sbi_num_diff_hide").addClass("sbi_transition").removeClass("sbi_num_diff_hide")},afterNewImagesLoaded:function(){var e=i(this.el),t=this;this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),setTimeout(function(){e.find(".sbi_loader").addClass("sbi_hidden"),e.find(".sbi_btn_text").removeClass("sbi_hidden"),t.maybeRaiseImageResolution()},500)},beforeNewImagesRevealed:function(){this.setImageHeight(),this.maybeRaiseImageResolution(!0),this.setImageSizeClass()},revealNewImages:function(){var e=i(this.el);e.find(".sbi-screenreader").each(function(){i(this).find("img").remove()}),"function"==typeof sbi_custom_js&&setTimeout(function(){sbi_custom_js()},100),this.applyImageLiquid(),e.find(".sbi_item").each(function(i){jQuery(this).find(".sbi_photo").on("mouseenter mouseleave",function(i){switch(i.type){case"mouseenter":jQuery(this).fadeTo(200,.85);break;case"mouseleave":jQuery(this).stop().fadeTo(500,1)}})}),setTimeout(function(){jQuery("#sbi_images .sbi_item.sbi_new").removeClass("sbi_new");var i=10;e.find(".sbi_transition").each(function(){var e=jQuery(this);setTimeout(function(){e.removeClass("sbi_transition")},i),i+=10})},500)},lazyLoadCheck:function(e){if(e.find(".sbi_photo").length&&!e.closest(".sbi").hasClass("sbi-no-ll-check")){var t=this.getImageUrls(e),s=void 0!==t[640]?t[640]:e.find(".sbi_photo").attr("data-full-res");if(!this.settings.consentGiven&&s.indexOf("scontent")>-1)return;e.find(".sbi_photo img").each(function(){s&&void 0!==i(this).attr("data-src")&&i(this).attr("data-src",s),s&&void 0!==i(this).attr("data-orig-src")&&i(this).attr("data-orig-src",s),i(this).on("load",function(){!i(this).hasClass("sbi-replaced")&&i(this).attr("src").indexOf("placeholder")>-1&&(i(this).addClass("sbi-replaced"),s&&(i(this).attr("src",s),i(this).closest(".sbi_imgLiquid_bgSize").length&&i(this).closest(".sbi_imgLiquid_bgSize").css("background-image","url("+s+")")))})})}},afterNewImagesRevealed:function(){this.listenForVisibilityChange(),this.sendNeedsResizingToServer(),this.settings.imageLoadEnabled||i(".sbi_no_resraise").removeClass("sbi_no_resraise");var e=i.Event("sbiafterimagesloaded");e.el=i(this.el),i(window).trigger(e)},setResizedImages:function(){i(this.el).find(".sbi_resized_image_data").length&&void 0!==i(this.el).find(".sbi_resized_image_data").attr("data-resized")&&0===i(this.el).find(".sbi_resized_image_data").attr("data-resized").indexOf('{"')&&(this.resizedImages=JSON.parse(i(this.el).find(".sbi_resized_image_data").attr("data-resized")),i(this.el).find(".sbi_resized_image_data").remove())},sendNeedsResizingToServer:function(){var e=this,t=i(this.el);if(e.needsResizing.length>0&&e.settings.resizingEnabled){var s=i(this.el).find(".sbi_item").length,o=void 0!==e.settings.general.cache_all&&e.settings.general.cache_all,a="";void 0!==t.attr("data-locatornonce")&&(a=t.attr("data-locatornonce")),n({action:"sbi_resized_images_submit",needs_resizing:e.needsResizing,offset:s,feed_id:e.settings.feedID,atts:e.settings.shortCodeAtts,location:e.locationGuess(),post_id:e.settings.postID,cache_all:o,locator_nonce:a},function(i){var t=i;for(var s in"object"!=typeof i&&0===i.trim().indexOf("{")&&(t=JSON.parse(i.trim())),e.settings.debugEnabled&&console.log(t),t)t.hasOwnProperty(s)&&(e.resizedImages[s]=t[s]);e.maybeRaiseImageResolution(),setTimeout(function(){e.afterResize()},500)})}else if(e.settings.locator){a="";void 0!==t.attr("data-locatornonce")&&(a=t.attr("data-locatornonce")),n({action:"sbi_do_locator",feed_id:e.settings.feedID,atts:e.settings.shortCodeAtts,location:e.locationGuess(),post_id:e.settings.postID,locator_nonce:a},function(i){})}},loadMoreButtonInit:function(){var e=i(this.el),t=this;e.find("#sbi_load .sbi_load_btn").off().on("click",function(){t.afterLoadMoreClicked(jQuery(this)),t.getNewPostSet()})},getNewPostSet:function(){var e=i(this.el),t=this;t.page++;var s="";void 0!==e.attr("data-locatornonce")&&(s=e.attr("data-locatornonce"));n({action:"sbi_load_more_clicked",offset:e.find(".sbi_item").length,page:t.page,feed_id:t.settings.feedID,atts:t.settings.shortCodeAtts,location:t.locationGuess(),post_id:t.settings.postID,current_resolution:t.imageResolution,locator_nonce:s},function(s){var n=s;"object"!=typeof s&&0===s.trim().indexOf("{")&&(n=JSON.parse(s.trim())),t.settings.debugEnabled&&console.log(n),t.appendNewPosts(n.html),t.addResizedImages(n.resizedImages),t.settings.ajaxPostLoad?(t.settings.ajaxPostLoad=!1,t.afterInitialImagesLoaded()):t.afterNewImagesLoaded(),n.feedStatus.shouldPaginate?t.outOfPages=!1:(t.outOfPages=!0,e.find(".sbi_load_btn").hide()),i(".sbi_no_js").removeClass("sbi_no_js")})},appendNewPosts:function(e){var t=i(this.el);t.find("#sbi_images .sbi_item").length?t.find("#sbi_images .sbi_item").last().after(e):t.find("#sbi_images").append(e)},addResizedImages:function(i){for(var e in i)this.resizedImages[e]=i[e]},setImageHeight:function(){var e=i(this.el),t=e.find(".sbi_photo").eq(0).innerWidth(),s=this.getColumnCount(),n=e.find("#sbi_images").innerWidth()-e.find("#sbi_images").width(),o=n/2;e.find("#sbi_images").width();e.find(".sbi_photo").css("height",t),e.find(".sbi-owl-nav").length&&setTimeout(function(){var i=2;e.find(".sbi_owl2row-item").length&&(i=1);var t=e.find(".sbi_photo").eq(0).innerWidth()/i;t+=parseInt(o)*(2-i+2),e.find(".sbi-owl-nav div").css("top",t)},100)},maybeRaiseSingleImageResolution:function(e,t,s){var n=this,o=n.getImageUrls(e),a=e.find(".sbi_photo img").attr("src"),d=150,r=e.find("img").get(0),l=a===window.sbi.options.placeholder?1:r.naturalWidth/r.naturalHeight;s=void 0!==s&&s;if(!(e.hasClass("sbi_no_resraise")||e.hasClass("sbi_had_error")||e.find(".sbi_link_area").length&&e.find(".sbi_link_area").hasClass("sbi_had_error")))if(o.length<1)e.find(".sbi_link_area").length&&e.find(".sbi_link_area").attr("href",window.sbi.options.placeholder.replace("placeholder.png","thumb-placeholder.png"));else{(e.find(".sbi_link_area").length&&e.find(".sbi_link_area").attr("href")===window.sbi.options.placeholder.replace("placeholder.png","thumb-placeholder.png")||!n.settings.consentGiven)&&e.find(".sbi_link_area").attr("href",o[o.length-1]),void 0!==o[640]&&e.find(".sbi_photo").attr("data-full-res",o[640]),i.each(o,function(i,e){e===a&&(d=parseInt(i),s=!1)});var c=640;switch(n.settings.imgRes){case"thumb":c=150;break;case"medium":c=320;break;case"full":c=640;break;default:var h=Math.max(n.settings.autoMinRes,e.find(".sbi_photo").innerWidth()),g=n.getBestResolutionForAuto(h,l,e);switch(g){case 320:c=320;break;case 150:c=150}}if(c>d||a===window.sbi.options.placeholder||s){if(n.settings.debugEnabled){var f=a===window.sbi.options.placeholder?"was placeholder":"too small";console.log("rais res for "+a,f)}var u=o[c].split("?ig_cache_key")[0];if(a!==u&&(e.find(".sbi_photo img").attr("src",u),e.find(".sbi_photo").css("background-image",'url("'+u+'")')),d=c,"auto"===n.settings.imgRes){var b=!1;e.find(".sbi_photo img").on("load",function(){var t=i(this),s=t.get(0).naturalWidth/t.get(0).naturalHeight;if(1e3!==t.get(0).naturalWidth&&s>l&&!b){switch(n.settings.debugEnabled&&console.log("rais res again for aspect ratio change "+a),b=!0,h=e.find(".sbi_photo").innerWidth(),g=n.getBestResolutionForAuto(h,s,e),c=640,g){case 320:c=320;break;case 150:c=150}c>d&&(u=o[c].split("?ig_cache_key")[0],t.attr("src",u),t.closest(".sbi_photo").css("background-image",'url("'+u+'")')),"masonry"!==n.layout&&"highlight"!==n.layout||(i(n.el).find("#sbi_images").smashotope(n.isotopeArgs),setTimeout(function(){i(n.el).find("#sbi_images").smashotope(n.isotopeArgs)},500))}else if(n.settings.debugEnabled){var r=b?"already checked":"no aspect ratio change";console.log("not raising res for replacement "+a,r)}})}}e.find("img").on("error",function(){if(i(this).hasClass("sbi_img_error"))console.log("unfixed error "+i(this).attr("src"));else{var e;if(i(this).addClass("sbi_img_error"),!(i(this).attr("src").indexOf("media/?size=")>-1||i(this).attr("src").indexOf("cdninstagram")>-1||i(this).attr("src").indexOf("fbcdn")>-1)&&n.settings.consentGiven){if("undefined"!==i(this).closest(".sbi_photo").attr("data-img-src-set"))void 0!==(e=JSON.parse(i(this).closest(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/"))).d&&(i(this).attr("src",e.d),i(this).closest(".sbi_photo").css("background-image","url("+e.d+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"))}else n.settings.favorLocal=!0,void 0!==(e=n.getImageUrls(i(this).closest(".sbi_item")))[640]&&(i(this).attr("src",e[640]),i(this).closest(".sbi_photo").css("background-image","url("+e[640]+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"));setTimeout(function(){n.afterResize()},1500)}})}},maybeRaiseImageResolution:function(e){var t=this,s=void 0!==e&&!0===e?".sbi_item.sbi_new":".sbi_item",n=!t.isInitialized;i(t.el).find(s).each(function(e){!i(this).hasClass("sbi_num_diff_hide")&&i(this).find(".sbi_photo").length&&void 0!==i(this).find(".sbi_photo").attr("data-img-src-set")&&t.maybeRaiseSingleImageResolution(i(this),e,n)}),t.isInitialized=!0},getBestResolutionForAuto:function(e,t,s){(isNaN(t)||t<1)&&(t=1);var n=e*t,o=10*Math.ceil(n/10),a=[150,320,640];if(s.hasClass("sbi_highlighted")&&(o*=2),-1===a.indexOf(parseInt(o))){var d=!1;i.each(a,function(i,e){e>parseInt(o)&&!d&&(o=e,d=!0)})}return o},hideExtraImagesForWidth:function(){if("carousel"!==this.layout){var e=i(this.el),t=void 0!==e.attr("data-num")&&""!==e.attr("data-num")?parseInt(e.attr("data-num")):1,s=void 0!==e.attr("data-nummobile")&&""!==e.attr("data-nummobile")?parseInt(e.attr("data-nummobile")):t;i(window).width()<480?s<e.find(".sbi_item").length&&e.find(".sbi_item").slice(s-e.find(".sbi_item").length).addClass("sbi_num_diff_hide"):t<e.find(".sbi_item").length&&e.find(".sbi_item").slice(t-e.find(".sbi_item").length).addClass("sbi_num_diff_hide")}},setImageSizeClass:function(){var e=i(this.el);e.removeClass("sbi_small sbi_medium");var t=e.innerWidth(),s=parseInt(e.find("#sbi_images").outerWidth()-e.find("#sbi_images").width())/2,n=this.getColumnCount(),o=(t-s*(n+2))/n;o>120&&o<240?e.addClass("sbi_medium"):o<=120&&e.addClass("sbi_small")},setMinImageWidth:function(){i(this.el).find(".sbi_item .sbi_photo").first().length?this.minImageWidth=i(this.el).find(".sbi_item .sbi_photo").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(i){var e=JSON.parse(i.find(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/")),t=i.attr("id").replace("sbi_","");if(this.settings.consentGiven||this.settings.overrideBlockCDN||(e=[]),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&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"full.jpg",s.push(640)),void 0!==this.resizedImages[t].sizes.low&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"low.jpg",s.push(320)),void 0!==this.resizedImages[t].sizes.thumb&&(s.push(150),e[150]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"thumb.jpg"),this.settings.favorLocal&&(-1===s.indexOf(640)&&s.indexOf(320)>-1&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"low.jpg"),-1===s.indexOf(320)&&(s.indexOf(640)>-1?e[320]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"full.jpg":s.indexOf(150)>-1&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"thumb.jpg")),-1===s.indexOf(150)&&(s.indexOf(320)>-1?e[150]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"low.jpg":s.indexOf(640)>-1&&(e[150]=sb_instagram_js_options.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 e},getAvatarUrl:function(i,e){if(""===i)return"";var t=this.settings.general.avatars;return"local"===(e=void 0!==e?e:"local")?void 0!==t["LCL"+i]&&1===parseInt(t["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":void 0!==t[i]?t[i]:"":void 0!==t[i]?t[i]:void 0!==t["LCL"+i]&&1===parseInt(t["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":""},addToNeedsResizing:function(i){-1===this.needsResizing.indexOf(i)&&this.needsResizing.push(i)},applyImageLiquid:function(){var t=i(this.el);e(),"function"==typeof t.find(".sbi_photo").sbi_imgLiquid&&t.find(".sbi_photo").sbi_imgLiquid({fill:!0})},listenForVisibilityChange:function(){var e,t,s,n=this;e=jQuery,t={runOnLoad:!0,frequency:100,sbiPreviousVisibility:null},s={sbiCheckVisibility:function(i,e){if(jQuery.contains(document,i[0])){var t=e.sbiPreviousVisibility,n=i.is(":visible");e.sbiPreviousVisibility=n,null==t?e.runOnLoad&&e.callback(i,n):t!==n&&e.callback(i,n),setTimeout(function(){s.sbiCheckVisibility(i,e)},e.frequency)}}},e.fn.sbiVisibilityChanged=function(i){var n=e.extend({},t,i);return this.each(function(){s.sbiCheckVisibility(e(this),n)})},"function"==typeof i(this.el).filter(":hidden").sbiVisibilityChanged&&i(this.el).filter(":hidden").sbiVisibilityChanged({callback:function(i,e){n.afterResize()},runOnLoad:!1})},getColumnCount:function(){var e=i(this.el),t=this.settings.cols,s=this.settings.colsmobile,n=t,o=window.innerWidth;return e.hasClass("sbi_mob_col_auto")?(o<640&&parseInt(t)>2&&parseInt(t)<7&&(n=2),o<640&&parseInt(t)>6&&parseInt(t)<11&&(n=4),o<=480&&parseInt(t)>2&&(n=1)):o<=480&&(n=s),parseInt(n)},checkConsent:function(){if(this.settings.consentGiven||!this.settings.gdpr)return!0;if("undefined"!=typeof CLI_Cookie)null!==CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)&&(null!==CLI_Cookie.read("cookielawinfo-checkbox-non-necessary")&&(this.settings.consentGiven="yes"===CLI_Cookie.read("cookielawinfo-checkbox-non-necessary")),null!==CLI_Cookie.read("cookielawinfo-checkbox-necessary")&&(this.settings.consentGiven="yes"===CLI_Cookie.read("cookielawinfo-checkbox-necessary")));else if(void 0!==window.cnArgs){var i=("; "+document.cookie).split("; cookie_notice_accepted=");if(2===i.length){var e=i.pop().split(";").shift();this.settings.consentGiven="true"===e}}else void 0!==window.cookieconsent?this.settings.consentGiven="allow"===function(i){for(var e=i+"=",t=window.document.cookie.split(";"),s=0;s<t.length;s++){var n=t[s].trim();if(0==n.indexOf(e))return n.substring(e.length,n.length)}return""}("complianz_consent_status"):void 0!==window.Cookiebot?this.settings.consentGiven=Cookiebot.consented:void 0!==window.BorlabsCookie&&(this.settings.consentGiven=window.BorlabsCookie.checkCookieConsent("instagram"));var t=jQuery.Event("sbicheckconsent");return t.feed=this,jQuery(window).trigger(t),this.settings.consentGiven},afterConsentToggled:function(){if(this.checkConsent()){var i=this;i.maybeRaiseImageResolution(),setTimeout(function(){i.afterResize()},500)}},locationGuess:function(){var e=i(this.el),t="content";return e.closest("footer").length?t="footer":e.closest(".header").length||e.closest("header").length?t="header":(e.closest(".sidebar").length||e.closest("aside").length)&&(t="sidebar"),t}},window.sbi_init=function(){window.sbi=new t,window.sbi.createPage(window.sbi.createFeeds,{whenFeedsCreated:window.sbi.afterFeedsCreated})}}(jQuery),jQuery(document).ready(function(i){void 0===window.sb_instagram_js_options&&(window.sb_instagram_js_options={font_method:"svg",resized_url:location.protocol+"//"+window.location.hostname+"/wp-content/uploads/sb-instagram-feed-images/",placeholder:location.protocol+"//"+window.location.hostname+"/wp-content/plugins/instagram-feed/img/placeholder.png"}),void 0!==window.sb_instagram_js_options.resized_url&&-1===window.sb_instagram_js_options.resized_url.indexOf(location.protocol)&&("http:"===location.protocol?window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("https:","http:"):window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("http:","https:")),sbi_init(),i("#cookie-notice a").on("click",function(){setTimeout(function(){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].afterConsentToggled()})},1e3)}),i("#cookie-law-info-bar a").on("click",function(){setTimeout(function(){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].afterConsentToggled()})},1e3)}),i(".cli-user-preference-checkbox").on("click",function(){setTimeout(function(){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!1,window.sbi.feeds[i].afterConsentToggled()})},1e3)}),i(window).on("CookiebotOnAccept",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!0,window.sbi.feeds[i].afterConsentToggled()})}),i(document).on("cmplzAcceptAll",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!0,window.sbi.feeds[i].afterConsentToggled()})}),i(document).on("cmplzRevoke",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!1,window.sbi.feeds[i].afterConsentToggled()})}),i(document).on("borlabs-cookie-consent-saved",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!1,window.sbi.feeds[i].afterConsentToggled()})})}));
|
js/sbi-scripts.js
CHANGED
@@ -1,1142 +1,1146 @@
|
|
1 |
var sbi_js_exists = (typeof sbi_js_exists !== 'undefined') ? true : false;
|
2 |
if(!sbi_js_exists) {
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
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 |
-
if (c.data("oldSrc") && c.data("oldSrc") !== c.attr("src")) {
|
64 |
-
var a = c.clone().removeAttr("style");
|
65 |
-
return a.data("sbi_imgLiquid_settings", c.data("sbi_imgLiquid_settings")), c.parent().prepend(a), c.remove(), c = a, c[0].width = 0, void setTimeout(o, 10)
|
66 |
-
}
|
67 |
-
return c.data("sbi_imgLiquid_oldProcessed") ? void r() : (c.data("sbi_imgLiquid_oldProcessed", !1), c.data("oldSrc", c.attr("src")), i("img:not(:first)", u).css("display", "none"), u.css({overflow: "hidden"}), c.fadeTo(0, 0).removeAttr("width").removeAttr("height").css({
|
68 |
-
visibility: "visible",
|
69 |
-
"max-width": "none",
|
70 |
-
"max-height": "none",
|
71 |
-
width: "auto",
|
72 |
-
height: "auto",
|
73 |
-
display: "block"
|
74 |
-
}), c.on("error", n), c[0].onerror = n, e(), void d())
|
75 |
-
}
|
76 |
-
|
77 |
-
function d() {
|
78 |
-
(g.responsive || c.data("sbi_imgLiquid_oldProcessed")) && c.data("sbi_imgLiquid_settings") && (g = c.data("sbi_imgLiquid_settings"), u.actualSize = u.get(0).offsetWidth + u.get(0).offsetHeight / 1e4, u.sizeOld && u.actualSize !== u.sizeOld && r(), u.sizeOld = u.actualSize, setTimeout(d, g.responsiveCheckTime))
|
79 |
-
}
|
80 |
-
|
81 |
-
function n() {
|
82 |
-
c.data("sbi_imgLiquid_error", !0), u.addClass("sbi_imgLiquid_error"), g.onItemError && g.onItemError(t, u, c), l()
|
83 |
-
}
|
84 |
-
|
85 |
-
function s() {
|
86 |
-
var i = {};
|
87 |
-
if (a.settings.useDataHtmlAttr) {
|
88 |
-
var t = u.attr("data-sbi_imgLiquid-fill"),
|
89 |
-
e = u.attr("data-sbi_imgLiquid-horizontalAlign"),
|
90 |
-
o = u.attr("data-sbi_imgLiquid-verticalAlign");
|
91 |
-
("true" === t || "false" === t) && (i.fill = Boolean("true" === t)), void 0 === e || "left" !== e && "center" !== e && "right" !== e && -1 === e.indexOf("%") || (i.horizontalAlign = e), void 0 === o || "top" !== o && "bottom" !== o && "center" !== o && -1 === o.indexOf("%") || (i.verticalAlign = o)
|
92 |
-
}
|
93 |
-
return sbi_imgLiquid.isIE && a.settings.ieFadeInDisabled && (i.fadeInTime = 0), i
|
94 |
-
}
|
95 |
-
|
96 |
-
function r() {
|
97 |
-
var i, e, a, o, d, n, s, r, m = 0, h = 0, f = u.width(), v = u.height();
|
98 |
-
void 0 === c.data("owidth") && c.data("owidth", c[0].width), void 0 === c.data("oheight") && c.data("oheight", c[0].height), g.fill === f / v >= c.data("owidth") / c.data("oheight") ? (i = "100%", e = "auto", a = Math.floor(f), o = Math.floor(f * (c.data("oheight") / c.data("owidth")))) : (i = "auto", e = "100%", a = Math.floor(v * (c.data("owidth") / c.data("oheight"))), o = Math.floor(v)), d = g.horizontalAlign.toLowerCase(), s = f - a, "left" === d && (h = 0), "center" === d && (h = .5 * s), "right" === d && (h = s), -1 !== d.indexOf("%") && (d = parseInt(d.replace("%", ""), 10), d > 0 && (h = s * d * .01)), n = g.verticalAlign.toLowerCase(), r = v - o, "left" === n && (m = 0), "center" === n && (m = .5 * r), "bottom" === n && (m = r), -1 !== n.indexOf("%") && (n = parseInt(n.replace("%", ""), 10), n > 0 && (m = r * n * .01)), g.hardPixels && (i = a, e = o), c.css({
|
99 |
-
width: i,
|
100 |
-
height: e,
|
101 |
-
"margin-left": Math.floor(h),
|
102 |
-
"margin-top": Math.floor(m)
|
103 |
-
}), c.data("sbi_imgLiquid_oldProcessed") || (c.fadeTo(g.fadeInTime, 1), c.data("sbi_imgLiquid_oldProcessed", !0), g.removeBoxBackground && u.css("background-image", "none"), u.addClass("sbi_imgLiquid_nobgSize"), u.addClass("sbi_imgLiquid_ready")), g.onItemFinish && g.onItemFinish(t, u, c), l()
|
104 |
-
}
|
105 |
-
|
106 |
-
function l() {
|
107 |
-
t === a.length - 1 && a.settings.onFinish && a.settings.onFinish()
|
108 |
-
}
|
109 |
-
|
110 |
-
var g = a.settings, u = i(this), c = i("img:first", u);
|
111 |
-
return c.length ? (c.data("sbi_imgLiquid_settings") ? (u.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"), g = i.extend({}, c.data("sbi_imgLiquid_settings"), a.options)) : g = i.extend({}, a.settings, s()), c.data("sbi_imgLiquid_settings", g), g.onItemStart && g.onItemStart(t, u, c), void (sbi_imgLiquid.bgs_Available && g.useBackgroundSize ? e() : o())) : void n()
|
112 |
-
})
|
113 |
-
}
|
114 |
-
})
|
115 |
-
}(jQuery);
|
116 |
-
|
117 |
-
// Use imagefill to set the images as backgrounds so they can be square
|
118 |
-
!function () {
|
119 |
-
var css = sbi_imgLiquid.injectCss,
|
120 |
-
head = document.getElementsByTagName('head')[0],
|
121 |
-
style = document.createElement('style');
|
122 |
-
style.type = 'text/css';
|
123 |
-
if (style.styleSheet) {
|
124 |
-
style.styleSheet.cssText = css;
|
125 |
-
} else {
|
126 |
-
style.appendChild(document.createTextNode(css));
|
127 |
}
|
128 |
-
head.appendChild(style);
|
129 |
-
}();
|
130 |
-
}
|
131 |
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
var n = { runOnLoad: !0, frequency: 100, sbiPreviousVisibility: null
|
136 |
-
}, c = {};
|
137 |
-
c.sbiCheckVisibility = function (i, n) {
|
138 |
-
if (jQuery.contains(document, i[0])) {
|
139 |
-
var e = n.sbiPreviousVisibility, t = i.is(":visible");
|
140 |
-
n.sbiPreviousVisibility = t, null == e ? n.runOnLoad && n.callback(i, t) : e !== t && n.callback(i, t), setTimeout(function () {
|
141 |
-
c.sbiCheckVisibility(i, n)
|
142 |
-
}, n.frequency)
|
143 |
-
}
|
144 |
-
}, i.fn.sbiVisibilityChanged = function (e) {
|
145 |
-
var t = i.extend({}, n, e);
|
146 |
-
return this.each(function () {
|
147 |
-
c.sbiCheckVisibility(i(this), t)
|
148 |
-
})
|
149 |
}
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
}
|
152 |
|
153 |
-
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
var evt = jQuery.Event('sbiafterfeedcreate');
|
211 |
-
evt.feed = window.sbi.feeds[index];
|
212 |
-
jQuery(window).trigger(evt);
|
213 |
-
|
214 |
-
})
|
215 |
-
);
|
216 |
-
},
|
217 |
-
afterFeedsCreated: function () {
|
218 |
-
// enable header hover action
|
219 |
-
$('.sb_instagram_header').each(function () {
|
220 |
-
var $thisHeader = $(this);
|
221 |
-
$thisHeader.find('.sbi_header_link').on('mouseenter mouseleave', function(e) {
|
222 |
-
switch(e.type) {
|
223 |
-
case 'mouseenter':
|
224 |
-
$thisHeader.find('.sbi_header_img_hover').addClass('sbi_fade_in');
|
225 |
-
break;
|
226 |
-
case 'mouseleave':
|
227 |
-
$thisHeader.find('.sbi_header_img_hover').removeClass('sbi_fade_in');
|
228 |
-
break;
|
229 |
-
}
|
230 |
-
});
|
231 |
-
});
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
}
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
}
|
251 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
}
|
265 |
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
//Photo links
|
350 |
-
$self.find('.sbi_photo').on('mouseenter mouseleave', function(e) {
|
351 |
-
switch(e.type) {
|
352 |
-
case 'mouseenter':
|
353 |
-
jQuery(this).fadeTo(200, 0.85);
|
354 |
-
break;
|
355 |
-
case 'mouseleave':
|
356 |
-
jQuery(this).stop().fadeTo(500, 1);
|
357 |
-
break;
|
358 |
-
}
|
359 |
-
});
|
360 |
-
}); //End .sbi_item each
|
361 |
-
|
362 |
-
//Remove the new class after 500ms, once the sorting is done
|
363 |
-
setTimeout(function () {
|
364 |
-
jQuery('#sbi_images .sbi_item.sbi_new').removeClass('sbi_new');
|
365 |
-
//Loop through items and remove class to reveal them
|
366 |
-
var time = 10;
|
367 |
-
$self.find('.sbi_transition').each(function() {
|
368 |
-
var $sbi_item_transition_el = jQuery(this);
|
369 |
-
|
370 |
-
setTimeout( function(){
|
371 |
-
$sbi_item_transition_el.removeClass('sbi_transition');
|
372 |
-
}, time);
|
373 |
-
time += 10;
|
374 |
-
});
|
375 |
-
}, 500);
|
376 |
-
},
|
377 |
-
lazyLoadCheck: function($item){
|
378 |
-
var feed = this;
|
379 |
-
if ($item.find('.sbi_photo').length && !$item.closest('.sbi').hasClass('sbi-no-ll-check')) {
|
380 |
-
var imgSrcSet = feed.getImageUrls($item),
|
381 |
-
maxResImage = typeof imgSrcSet[640] !== 'undefined' ? imgSrcSet[640] : $item.find('.sbi_photo').attr('data-full-res');
|
382 |
-
|
383 |
-
if (!feed.settings.consentGiven) {
|
384 |
-
if (maxResImage.indexOf('scontent') > -1) {
|
385 |
-
return;
|
386 |
-
}
|
387 |
-
}
|
388 |
-
|
389 |
-
$item.find('.sbi_photo img').each(function() {
|
390 |
-
if (maxResImage && typeof $(this).attr('data-src') !== 'undefined') {
|
391 |
-
$(this).attr('data-src',maxResImage);
|
392 |
-
}
|
393 |
-
if (maxResImage && typeof $(this).attr('data-orig-src') !== 'undefined') {
|
394 |
-
$(this).attr('data-orig-src',maxResImage);
|
395 |
-
}
|
396 |
-
$(this).on('load',function() {
|
397 |
-
if (!$(this).hasClass('sbi-replaced')
|
398 |
-
&& $(this).attr('src').indexOf('placeholder') > -1) {
|
399 |
-
$(this).addClass('sbi-replaced');
|
400 |
-
if (maxResImage) {
|
401 |
-
$(this).attr('src',maxResImage);
|
402 |
-
if ($(this).closest('.sbi_imgLiquid_bgSize').length) {
|
403 |
-
$(this).closest('.sbi_imgLiquid_bgSize').css('background-image', 'url(' + maxResImage + ')');
|
404 |
-
}
|
405 |
-
}
|
406 |
-
}
|
407 |
-
});
|
408 |
-
});
|
409 |
-
}
|
410 |
-
},
|
411 |
-
afterNewImagesRevealed: function() {
|
412 |
-
this.listenForVisibilityChange();
|
413 |
-
this.sendNeedsResizingToServer();
|
414 |
-
if (!this.settings.imageLoadEnabled) {
|
415 |
-
$('.sbi_no_resraise').removeClass('sbi_no_resraise');
|
416 |
-
}
|
417 |
-
|
418 |
-
var evt = $.Event('sbiafterimagesloaded');
|
419 |
-
evt.el = $(this.el);
|
420 |
-
$(window).trigger(evt);
|
421 |
-
},
|
422 |
-
setResizedImages: function () {
|
423 |
-
if ($(this.el).find('.sbi_resized_image_data').length
|
424 |
-
&& typeof $(this.el).find('.sbi_resized_image_data').attr('data-resized') !== 'undefined'
|
425 |
-
&& $(this.el).find('.sbi_resized_image_data').attr('data-resized').indexOf('{"') === 0) {
|
426 |
-
this.resizedImages = JSON.parse($(this.el).find('.sbi_resized_image_data').attr('data-resized'));
|
427 |
-
$(this.el).find('.sbi_resized_image_data').remove();
|
428 |
-
}
|
429 |
-
},
|
430 |
-
sendNeedsResizingToServer: function() {
|
431 |
-
var feed = this,
|
432 |
-
$self = $(this.el);
|
433 |
-
if (feed.needsResizing.length > 0 && feed.settings.resizingEnabled) {
|
434 |
-
var itemOffset = $(this.el).find('.sbi_item').length,
|
435 |
-
cacheAll = typeof feed.settings.general.cache_all !== 'undefined' ? feed.settings.general.cache_all : false;
|
436 |
-
var locatorNonce = '';
|
437 |
-
if ( typeof $self.attr( 'data-locatornonce' ) !== 'undefined' ) {
|
438 |
-
locatorNonce = $self.attr( 'data-locatornonce' );
|
439 |
-
}
|
440 |
-
var submitData = {
|
441 |
-
action: 'sbi_resized_images_submit',
|
442 |
-
needs_resizing: feed.needsResizing,
|
443 |
-
offset: itemOffset,
|
444 |
-
feed_id: feed.settings.feedID,
|
445 |
-
atts: feed.settings.shortCodeAtts,
|
446 |
-
location: feed.locationGuess(),
|
447 |
-
post_id: feed.settings.postID,
|
448 |
-
cache_all: cacheAll,
|
449 |
-
locator_nonce: locatorNonce
|
450 |
-
};
|
451 |
-
var onSuccess = function(data) {
|
452 |
-
if (data.trim().indexOf('{') === 0) {
|
453 |
-
var response = JSON.parse(data);
|
454 |
-
if (feed.settings.debugEnabled) {
|
455 |
-
console.log(response);
|
456 |
-
}
|
457 |
-
for (var property in response) {
|
458 |
-
if (response.hasOwnProperty(property)) {
|
459 |
-
feed.resizedImages[property] = response[property];
|
460 |
-
}
|
461 |
-
}
|
462 |
-
feed.maybeRaiseImageResolution();
|
463 |
-
|
464 |
-
setTimeout(function() {
|
465 |
-
feed.afterResize();
|
466 |
-
},500);
|
467 |
-
}
|
468 |
-
};
|
469 |
-
sbiAjax(submitData,onSuccess);
|
470 |
-
} else if (feed.settings.locator) {
|
471 |
-
var locatorNonce = '';
|
472 |
-
if ( typeof $self.attr( 'data-locatornonce' ) !== 'undefined' ) {
|
473 |
-
locatorNonce = $self.attr( 'data-locatornonce' );
|
474 |
-
}
|
475 |
-
var submitData = {
|
476 |
-
action: 'sbi_do_locator',
|
477 |
-
feed_id: feed.settings.feedID,
|
478 |
-
atts: feed.settings.shortCodeAtts,
|
479 |
-
location: feed.locationGuess(),
|
480 |
-
post_id: feed.settings.postID,
|
481 |
-
locator_nonce: locatorNonce
|
482 |
-
};
|
483 |
-
var onSuccess = function(data) {
|
484 |
-
|
485 |
-
};
|
486 |
-
sbiAjax(submitData,onSuccess);
|
487 |
-
}
|
488 |
-
},
|
489 |
-
loadMoreButtonInit: function () {
|
490 |
-
var $self = $(this.el),
|
491 |
-
feed = this;
|
492 |
-
$self.find('#sbi_load .sbi_load_btn').off().on('click', function () {
|
493 |
|
494 |
-
|
495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
|
|
508 |
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
}
|
542 |
-
$('.sbi_no_js').removeClass('sbi_no_js');
|
543 |
-
}
|
544 |
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
var sbi_num_cols = this.getColumnCount();
|
568 |
-
|
569 |
-
//Figure out what the width should be using the number of cols
|
570 |
-
//Figure out what the width should be using the number of cols
|
571 |
-
var imagesPadding = $self.find('#sbi_images').innerWidth() - $self.find('#sbi_images').width(),
|
572 |
-
imagepadding = imagesPadding / 2,
|
573 |
-
sbi_photo_width_manual = ( $self.find('#sbi_images').width() / sbi_num_cols ) - imagesPadding;
|
574 |
-
//If the width is less than it should be then set it manually
|
575 |
-
//if( sbi_photo_width <= (sbi_photo_width_manual) ) sbi_photo_width = sbi_photo_width_manual;
|
576 |
-
|
577 |
-
$self.find('.sbi_photo').css('height', sbi_photo_width);
|
578 |
-
|
579 |
-
//Set the position of the carousel arrows
|
580 |
-
if ($self.find('.sbi-owl-nav').length) {
|
581 |
-
setTimeout(function(){
|
582 |
-
//If there's 2 rows then adjust position
|
583 |
-
var sbi_ratio = 2;
|
584 |
-
if( $self.find('.sbi_owl2row-item').length ) sbi_ratio = 1;
|
585 |
-
|
586 |
-
var sbi_arrows_top = ($self.find('.sbi_photo').eq(0).innerWidth()/sbi_ratio);
|
587 |
-
sbi_arrows_top += parseInt(imagepadding)*(2+(2-sbi_ratio));
|
588 |
-
$self.find('.sbi-owl-nav div').css('top', sbi_arrows_top);
|
589 |
-
}, 100);
|
590 |
}
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
return;
|
604 |
}
|
605 |
|
606 |
-
if (
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
return;
|
611 |
-
} else if ($item.find('.sbi_link_area').length && $item.find('.sbi_link_area').attr('href') === window.sbi.options.placeholder.replace('placeholder.png','thumb-placeholder.png')
|
612 |
-
|| !feed.settings.consentGiven) {
|
613 |
-
$item.find('.sbi_link_area').attr('href',imgSrcSet[imgSrcSet.length - 1])
|
614 |
}
|
615 |
-
if (
|
616 |
-
|
|
|
|
|
|
|
617 |
}
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
// If the image has already been changed to an existing real source, don't force the change
|
623 |
-
forceChange = false;
|
624 |
-
}
|
625 |
-
});
|
626 |
-
//Image res
|
627 |
-
var newRes = 640;
|
628 |
-
switch (feed.settings.imgRes) {
|
629 |
-
case 'thumb':
|
630 |
-
newRes = 150;
|
631 |
-
break;
|
632 |
-
case 'medium':
|
633 |
-
newRes = 320;
|
634 |
-
break;
|
635 |
-
case 'full':
|
636 |
-
newRes = 640;
|
637 |
-
break;
|
638 |
-
default:
|
639 |
-
var minImageWidth = Math.max(feed.settings.autoMinRes,$item.find('.sbi_photo').innerWidth()),
|
640 |
-
thisImageReplace = feed.getBestResolutionForAuto(minImageWidth, aspectRatio, $item);
|
641 |
-
switch (thisImageReplace) {
|
642 |
-
case 320:
|
643 |
-
newRes = 320;
|
644 |
-
break;
|
645 |
-
case 150:
|
646 |
-
newRes = 150;
|
647 |
-
break;
|
648 |
-
}
|
649 |
-
break;
|
650 |
}
|
|
|
|
|
|
|
651 |
|
652 |
-
if (newRes > currentRes || currentUrl === window.sbi.options.placeholder || forceChange) {
|
653 |
-
if (feed.settings.debugEnabled) {
|
654 |
-
var reason = currentUrl === window.sbi.options.placeholder ? 'was placeholder' : 'too small';
|
655 |
-
console.log('rais res for ' + currentUrl, reason);
|
656 |
-
}
|
657 |
-
var newUrl = imgSrcSet[newRes].split("?ig_cache_key")[0];
|
658 |
-
if (currentUrl !== newUrl) {
|
659 |
-
$item.find('.sbi_photo img').attr('src', newUrl);
|
660 |
-
$item.find('.sbi_photo').css('background-image', 'url("' + newUrl + '")');
|
661 |
-
}
|
662 |
-
currentRes = newRes;
|
663 |
-
|
664 |
-
if (feed.settings.imgRes === 'auto') {
|
665 |
-
var checked = false;
|
666 |
-
$item.find('.sbi_photo img').on('load', function () {
|
667 |
-
|
668 |
-
var $this_image = $(this);
|
669 |
-
var newAspectRatio = ($this_image.get(0).naturalWidth / $this_image.get(0).naturalHeight);
|
670 |
-
|
671 |
-
if ($this_image.get(0).naturalWidth !== 1000 && newAspectRatio > aspectRatio && !checked) {
|
672 |
-
if (feed.settings.debugEnabled) {
|
673 |
-
console.log('rais res again for aspect ratio change ' + currentUrl);
|
674 |
-
}
|
675 |
-
checked = true;
|
676 |
-
minImageWidth = $item.find('.sbi_photo').innerWidth();
|
677 |
-
thisImageReplace = feed.getBestResolutionForAuto(minImageWidth, newAspectRatio, $item);
|
678 |
-
newRes = 640;
|
679 |
-
|
680 |
-
switch (thisImageReplace) {
|
681 |
-
case 320:
|
682 |
-
newRes = 320;
|
683 |
-
break;
|
684 |
-
case 150:
|
685 |
-
newRes = 150;
|
686 |
-
break;
|
687 |
-
}
|
688 |
-
|
689 |
-
if (newRes > currentRes) {
|
690 |
-
newUrl = imgSrcSet[newRes].split("?ig_cache_key")[0];
|
691 |
-
$this_image.attr('src', newUrl);
|
692 |
-
$this_image.closest('.sbi_photo').css('background-image', 'url("' + newUrl + '")');
|
693 |
-
}
|
694 |
-
if (feed.layout === 'masonry' || feed.layout === 'highlight') {
|
695 |
-
$(feed.el).find('#sbi_images').smashotope(feed.isotopeArgs);
|
696 |
-
setTimeout(function() {
|
697 |
-
$(feed.el).find('#sbi_images').smashotope(feed.isotopeArgs);
|
698 |
-
},500)
|
699 |
-
}
|
700 |
-
} else {
|
701 |
-
if (feed.settings.debugEnabled) {
|
702 |
-
var reason = checked ? 'already checked' : 'no aspect ratio change';
|
703 |
-
console.log('not raising res for replacement ' + currentUrl, reason);
|
704 |
-
}
|
705 |
-
}
|
706 |
-
});
|
707 |
-
}
|
708 |
|
|
|
709 |
|
710 |
-
|
|
|
|
|
|
|
711 |
|
712 |
-
|
713 |
-
if (!$(this).hasClass('sbi_img_error')) {
|
714 |
-
$(this).addClass('sbi_img_error');
|
715 |
-
var sourceFromAPI = ($(this).attr('src').indexOf('media/?size=') > -1 || $(this).attr('src').indexOf('cdninstagram') > -1 || $(this).attr('src').indexOf('fbcdn') > -1)
|
716 |
-
|
717 |
-
if (!sourceFromAPI && feed.settings.consentGiven) {
|
718 |
-
|
719 |
-
if ($(this).closest('.sbi_photo').attr('data-img-src-set') !== 'undefined') {
|
720 |
-
var srcSet = JSON.parse($(this).closest('.sbi_photo').attr('data-img-src-set').replace(/\\\//g, '/'));
|
721 |
-
if (typeof srcSet.d !== 'undefined') {
|
722 |
-
$(this).attr('src', srcSet.d);
|
723 |
-
$(this).closest('.sbi_photo').css('background-image', 'url(' + srcSet.d + ')');
|
724 |
-
$(this).closest('.sbi_item').addClass('sbi_had_error').find('.sbi_link_area').attr('href', srcSet[640]).addClass('sbi_had_error');
|
725 |
-
}
|
726 |
-
}
|
727 |
-
} else {
|
728 |
-
feed.settings.favorLocal = true;
|
729 |
-
var srcSet = feed.getImageUrls($(this).closest('.sbi_item'));
|
730 |
-
if (typeof srcSet[640] !== 'undefined') {
|
731 |
-
$(this).attr('src', srcSet[640]);
|
732 |
-
$(this).closest('.sbi_photo').css('background-image', 'url(' + srcSet[640] + ')');
|
733 |
-
$(this).closest('.sbi_item').addClass('sbi_had_error').find('.sbi_link_area').attr('href', srcSet[640]).addClass('sbi_had_error');
|
734 |
-
}
|
735 |
-
}
|
736 |
-
setTimeout(function() {
|
737 |
-
feed.afterResize();
|
738 |
-
}, 1500)
|
739 |
-
} else {
|
740 |
-
console.log('unfixed error ' + $(this).attr('src'));
|
741 |
-
}
|
742 |
-
});
|
743 |
-
},
|
744 |
-
maybeRaiseImageResolution: function (justNew) {
|
745 |
-
var feed = this,
|
746 |
-
itemsSelector = typeof justNew !== 'undefined' && justNew === true ? '.sbi_item.sbi_new' : '.sbi_item',
|
747 |
-
forceChange = !feed.isInitialized ? true : false;
|
748 |
-
$(feed.el).find(itemsSelector).each(function (index) {
|
749 |
-
if (!$(this).hasClass('sbi_num_diff_hide')
|
750 |
-
&& $(this).find('.sbi_photo').length
|
751 |
-
&& typeof $(this).find('.sbi_photo').attr('data-img-src-set') !== 'undefined') {
|
752 |
-
feed.maybeRaiseSingleImageResolution($(this),index,forceChange);
|
753 |
-
}
|
754 |
-
}); //End .sbi_item each
|
755 |
-
feed.isInitialized = true;
|
756 |
-
},
|
757 |
-
getBestResolutionForAuto: function(colWidth, aspectRatio, $item) {
|
758 |
-
if (isNaN(aspectRatio) || aspectRatio < 1) {
|
759 |
-
aspectRatio = 1;
|
760 |
-
}
|
761 |
-
var bestWidth = colWidth * aspectRatio,
|
762 |
-
bestWidthRounded = Math.ceil(bestWidth / 10) * 10,
|
763 |
-
customSizes = [150, 320, 640];
|
764 |
|
765 |
-
|
766 |
-
|
|
|
|
|
|
|
|
|
767 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
768 |
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
if (item > parseInt(bestWidthRounded) && !done) {
|
773 |
-
bestWidthRounded = item;
|
774 |
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
|
|
779 |
|
780 |
-
|
781 |
-
}
|
782 |
-
|
783 |
-
|
784 |
-
return;
|
785 |
-
}
|
786 |
-
var $self = $(this.el),
|
787 |
-
num = typeof $self.attr('data-num') !== 'undefined' && $self.attr('data-num') !== '' ? parseInt($self.attr('data-num')) : 1,
|
788 |
-
nummobile = typeof $self.attr('data-nummobile') !== 'undefined' && $self.attr('data-nummobile') !== '' ? parseInt($self.attr('data-nummobile')) : num;
|
789 |
-
|
790 |
-
if ($(window).width() < 480) {
|
791 |
-
if (nummobile < $self.find('.sbi_item').length) {
|
792 |
-
$self.find('.sbi_item').slice(nummobile - $self.find('.sbi_item').length).addClass('sbi_num_diff_hide');
|
793 |
-
}
|
794 |
-
} else {
|
795 |
-
if (num < $self.find('.sbi_item').length) {
|
796 |
-
$self.find('.sbi_item').slice(num - $self.find('.sbi_item').length).addClass('sbi_num_diff_hide');
|
797 |
-
}
|
798 |
-
}
|
799 |
-
},
|
800 |
-
setImageSizeClass: function () {
|
801 |
-
var $self = $(this.el);
|
802 |
-
$self.removeClass('sbi_small sbi_medium');
|
803 |
-
var feedWidth = $self.innerWidth(),
|
804 |
-
photoPadding = parseInt(($self.find('#sbi_images').outerWidth() - $self.find('#sbi_images').width())) / 2,
|
805 |
-
cols = this.getColumnCount(),
|
806 |
-
feedWidthSansPadding = feedWidth - (photoPadding * (cols+2)),
|
807 |
-
colWidth = (feedWidthSansPadding / cols);
|
808 |
-
if (colWidth > 120 && colWidth < 240) {
|
809 |
-
$self.addClass('sbi_medium');
|
810 |
-
} else if (colWidth <= 120) {
|
811 |
-
$self.addClass('sbi_small');
|
812 |
-
}
|
813 |
-
},
|
814 |
-
setMinImageWidth: function () {
|
815 |
-
if ($(this.el).find('.sbi_item .sbi_photo').first().length) {
|
816 |
-
this.minImageWidth = $(this.el).find('.sbi_item .sbi_photo').first().innerWidth();
|
817 |
-
} else {
|
818 |
-
this.minImageWidth = 150;
|
819 |
-
}
|
820 |
-
},
|
821 |
-
setImageResolution: function () {
|
822 |
-
if (this.settings.imgRes === 'auto') {
|
823 |
-
this.imageResolution = 'auto';
|
824 |
-
} else {
|
825 |
-
switch (this.settings.imgRes) {
|
826 |
-
case 'thumb':
|
827 |
-
this.imageResolution = 150;
|
828 |
-
break;
|
829 |
-
case 'medium':
|
830 |
-
this.imageResolution = 320;
|
831 |
-
break;
|
832 |
-
default:
|
833 |
-
this.imageResolution = 640;
|
834 |
-
}
|
835 |
-
}
|
836 |
-
},
|
837 |
-
getImageUrls: function ($item) {
|
838 |
-
var srcSet = JSON.parse($item.find('.sbi_photo').attr('data-img-src-set').replace(/\\\//g, '/')),
|
839 |
-
id = $item.attr('id').replace('sbi_', '');
|
840 |
-
if (!this.settings.consentGiven && !this.settings.overrideBlockCDN) {
|
841 |
-
srcSet = [];
|
842 |
-
}
|
843 |
-
if (typeof this.resizedImages[id] !== 'undefined'
|
844 |
-
&& this.resizedImages[id] !== 'video'
|
845 |
-
&& this.resizedImages[id] !== 'pending'
|
846 |
-
&& this.resizedImages[id].id !== 'error'
|
847 |
-
&& this.resizedImages[id].id !== 'video'
|
848 |
-
&& this.resizedImages[id].id !== 'pending') {
|
849 |
-
|
850 |
-
if (typeof this.resizedImages[id]['sizes'] !== 'undefined') {
|
851 |
-
var foundSizes = [];
|
852 |
-
if (typeof this.resizedImages[id]['sizes']['full'] !== 'undefined') {
|
853 |
-
srcSet[640] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
854 |
-
foundSizes.push(640);
|
855 |
-
}
|
856 |
-
if (typeof this.resizedImages[id]['sizes']['low'] !== 'undefined') {
|
857 |
-
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
858 |
-
foundSizes.push(320);
|
859 |
-
}
|
860 |
-
if (typeof this.resizedImages[id]['sizes']['thumb'] !== 'undefined') {
|
861 |
-
foundSizes.push(150);
|
862 |
-
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'thumb.jpg';
|
863 |
-
}
|
864 |
-
if (this.settings.favorLocal) {
|
865 |
-
if (foundSizes.indexOf(640) === -1) {
|
866 |
-
if (foundSizes.indexOf(320) > -1) {
|
867 |
-
srcSet[640] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
868 |
-
}
|
869 |
-
}
|
870 |
-
if (foundSizes.indexOf(320) === -1) {
|
871 |
-
if (foundSizes.indexOf(640) > -1) {
|
872 |
-
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
873 |
-
} else if (foundSizes.indexOf(150) > -1) {
|
874 |
-
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'thumb.jpg';
|
875 |
-
}
|
876 |
-
}
|
877 |
-
if (foundSizes.indexOf(150) === -1) {
|
878 |
-
if (foundSizes.indexOf(320) > -1) {
|
879 |
-
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
880 |
-
} else if (foundSizes.indexOf(640) > -1) {
|
881 |
-
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
882 |
-
}
|
883 |
-
}
|
884 |
-
}
|
885 |
-
}
|
886 |
-
} else if (typeof this.resizedImages[id] === 'undefined'
|
887 |
-
|| (typeof this.resizedImages[id]['id'] !== 'undefined' && this.resizedImages[id]['id'] !== 'pending' && this.resizedImages[id]['id'] !== 'error')) {
|
888 |
-
this.addToNeedsResizing(id);
|
889 |
-
}
|
890 |
-
|
891 |
-
return srcSet;
|
892 |
-
},
|
893 |
-
getAvatarUrl: function (username,favorType) {
|
894 |
-
if (username === '') {
|
895 |
-
return '';
|
896 |
-
}
|
897 |
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
942 |
}
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
sbiWindowWidth = window.innerWidth;
|
950 |
-
|
951 |
-
if ($self.hasClass('sbi_mob_col_auto')) {
|
952 |
-
if (sbiWindowWidth < 640 && (parseInt(cols) > 2 && parseInt(cols) < 7)) returnCols = 2;
|
953 |
-
if (sbiWindowWidth < 640 && (parseInt(cols) > 6 && parseInt(cols) < 11)) returnCols = 4;
|
954 |
-
if (sbiWindowWidth <= 480 && parseInt(cols) > 2) returnCols = 1;
|
955 |
-
} else if (sbiWindowWidth <= 480) {
|
956 |
-
returnCols = colsmobile;
|
957 |
}
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
if (
|
963 |
-
|
964 |
}
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
if (CLI_Cookie.read('cookielawinfo-checkbox-necessary') !== null) {
|
974 |
-
this.settings.consentGiven = CLI_Cookie.read('cookielawinfo-checkbox-necessary') === 'yes';
|
975 |
-
}
|
976 |
-
}
|
977 |
-
|
978 |
-
} else if (typeof window.cnArgs !== "undefined") { // Cookie Notice by dFactory
|
979 |
-
var value = "; " + document.cookie,
|
980 |
-
parts = value.split( '; cookie_notice_accepted=' );
|
981 |
-
|
982 |
-
if ( parts.length === 2 ) {
|
983 |
-
var val = parts.pop().split( ';' ).shift();
|
984 |
-
|
985 |
-
this.settings.consentGiven = (val === 'true');
|
986 |
-
}
|
987 |
-
} else if (typeof window.cookieconsent !== 'undefined') { // Complianz by Really Simple Plugins
|
988 |
-
this.settings.consentGiven = sbiCmplzGetCookie('complianz_consent_status') === 'allow';
|
989 |
-
} else if (typeof window.Cookiebot !== "undefined") { // Cookiebot by Cybot A/S
|
990 |
-
this.settings.consentGiven = Cookiebot.consented;
|
991 |
-
} else if (typeof window.BorlabsCookie !== 'undefined') { // Borlabs Cookie by Borlabs
|
992 |
-
this.settings.consentGiven = window.BorlabsCookie.checkCookieConsent('instagram');
|
993 |
-
}
|
994 |
-
|
995 |
-
var evt = jQuery.Event('sbicheckconsent');
|
996 |
-
evt.feed = this;
|
997 |
-
jQuery(window).trigger(evt);
|
998 |
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
setTimeout(function() {
|
1007 |
-
feed.afterResize();
|
1008 |
-
},500);
|
1009 |
-
}
|
1010 |
-
},
|
1011 |
-
locationGuess: function() {
|
1012 |
-
var $feed = $(this.el),
|
1013 |
-
location = 'content';
|
1014 |
-
|
1015 |
-
if ($feed.closest('footer').length) {
|
1016 |
-
location = 'footer';
|
1017 |
-
} else if ($feed.closest('.header').length
|
1018 |
-
|| $feed.closest('header').length) {
|
1019 |
-
location = 'header';
|
1020 |
-
} else if ($feed.closest('.sidebar').length
|
1021 |
-
|| $feed.closest('aside').length) {
|
1022 |
-
location = 'sidebar';
|
1023 |
-
}
|
1024 |
|
1025 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1026 |
},
|
1027 |
-
|
1028 |
-
|
1029 |
-
window.sbi_init = function() {
|
1030 |
-
window.sbi = new Sbi();
|
1031 |
-
window.sbi.createPage( window.sbi.createFeeds, {whenFeedsCreated: window.sbi.afterFeedsCreated});
|
1032 |
-
};
|
1033 |
-
|
1034 |
-
function sbiGetNewFeed(feed,index,feedOptions) {
|
1035 |
-
return new SbiFeed(feed,index,feedOptions);
|
1036 |
}
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1045 |
}
|
1046 |
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
|
|
|
|
|
|
|
|
|
|
1050 |
|
1051 |
-
//
|
1052 |
-
|
1053 |
-
|
1054 |
-
//If the name is the cookie string at position 0, we found the cookie and return the cookie value
|
1055 |
-
if (c.indexOf(name) == 0)
|
1056 |
-
return c.substring(name.length, c.length);
|
1057 |
}
|
1058 |
|
1059 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1060 |
}
|
1061 |
|
1062 |
-
|
|
|
|
|
1063 |
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
|
|
|
|
|
|
1071 |
}
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1078 |
}
|
1079 |
-
sbi_init();
|
1080 |
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1088 |
});
|
|
|
|
|
1089 |
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
});
|
1096 |
-
},1000);
|
1097 |
});
|
|
|
|
|
1098 |
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
});
|
1106 |
-
},1000);
|
1107 |
});
|
|
|
|
|
1108 |
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
});
|
1140 |
});
|
|
|
1141 |
|
1142 |
-
} // if sbi_js_exists
|
1 |
var sbi_js_exists = (typeof sbi_js_exists !== 'undefined') ? true : false;
|
2 |
if(!sbi_js_exists) {
|
3 |
+
(function($){
|
4 |
+
|
5 |
+
function sbiAddImgLiquid() {
|
6 |
+
/*! imgLiquid v0.9.944 / 03-05-2013 https://github.com/karacas/imgLiquid */
|
7 |
+
var sbi_imgLiquid = sbi_imgLiquid || {VER: "0.9.944"};
|
8 |
+
sbi_imgLiquid.bgs_Available = !1, sbi_imgLiquid.bgs_CheckRunned = !1, function (i) {
|
9 |
+
function t() {
|
10 |
+
if (!sbi_imgLiquid.bgs_CheckRunned) {
|
11 |
+
sbi_imgLiquid.bgs_CheckRunned = !0;
|
12 |
+
var t = i('<span style="background-size:cover" />');
|
13 |
+
i("body").append(t), !function () {
|
14 |
+
var i = t[0];
|
15 |
+
if (i && window.getComputedStyle) {
|
16 |
+
var e = window.getComputedStyle(i, null);
|
17 |
+
e && e.backgroundSize && (sbi_imgLiquid.bgs_Available = "cover" === e.backgroundSize)
|
18 |
+
}
|
19 |
+
}(), t.remove()
|
20 |
+
}
|
21 |
+
}
|
22 |
|
23 |
+
i.fn.extend({
|
24 |
+
sbi_imgLiquid: function (e) {
|
25 |
+
this.defaults = {
|
26 |
+
fill: !0,
|
27 |
+
verticalAlign: "center",
|
28 |
+
horizontalAlign: "center",
|
29 |
+
useBackgroundSize: !0,
|
30 |
+
useDataHtmlAttr: !0,
|
31 |
+
responsive: !0,
|
32 |
+
delay: 0,
|
33 |
+
fadeInTime: 0,
|
34 |
+
removeBoxBackground: !0,
|
35 |
+
hardPixels: !0,
|
36 |
+
responsiveCheckTime: 500,
|
37 |
+
timecheckvisibility: 500,
|
38 |
+
onStart: null,
|
39 |
+
onFinish: null,
|
40 |
+
onItemStart: null,
|
41 |
+
onItemFinish: null,
|
42 |
+
onItemError: null
|
43 |
+
}, t();
|
44 |
+
var a = this;
|
45 |
+
return this.options = e, this.settings = i.extend({}, this.defaults, this.options), this.settings.onStart && this.settings.onStart(), this.each(function (t) {
|
46 |
+
function e() {
|
47 |
+
-1 === u.css("background-image").indexOf(encodeURI(c.attr("src"))) && u.css({"background-image": 'url("' + encodeURI(c.attr("src")) + '")'}), u.css({
|
48 |
+
"background-size": g.fill ? "cover" : "contain",
|
49 |
+
"background-position": (g.horizontalAlign + " " + g.verticalAlign).toLowerCase(),
|
50 |
+
"background-repeat": "no-repeat"
|
51 |
+
}), i("a:first", u).css({
|
52 |
+
display: "block",
|
53 |
+
width: "100%",
|
54 |
+
height: "100%"
|
55 |
+
}), i("img", u).css({display: "none"}), g.onItemFinish && g.onItemFinish(t, u, c), u.addClass("sbi_imgLiquid_bgSize"), u.addClass("sbi_imgLiquid_ready"), l()
|
56 |
+
}
|
57 |
+
|
58 |
+
function o() {
|
59 |
+
function e() {
|
60 |
+
c.data("sbi_imgLiquid_error") || c.data("sbi_imgLiquid_loaded") || c.data("sbi_imgLiquid_oldProcessed") || (u.is(":visible") && c[0].complete && c[0].width > 0 && c[0].height > 0 ? (c.data("sbi_imgLiquid_loaded", !0), setTimeout(r, t * g.delay)) : setTimeout(e, g.timecheckvisibility))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
|
|
|
|
|
|
62 |
|
63 |
+
if (c.data("oldSrc") && c.data("oldSrc") !== c.attr("src")) {
|
64 |
+
var a = c.clone().removeAttr("style");
|
65 |
+
return a.data("sbi_imgLiquid_settings", c.data("sbi_imgLiquid_settings")), c.parent().prepend(a), c.remove(), c = a, c[0].width = 0, void setTimeout(o, 10)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
+
return c.data("sbi_imgLiquid_oldProcessed") ? void r() : (c.data("sbi_imgLiquid_oldProcessed", !1), c.data("oldSrc", c.attr("src")), i("img:not(:first)", u).css("display", "none"), u.css({overflow: "hidden"}), c.fadeTo(0, 0).removeAttr("width").removeAttr("height").css({
|
68 |
+
visibility: "visible",
|
69 |
+
"max-width": "none",
|
70 |
+
"max-height": "none",
|
71 |
+
width: "auto",
|
72 |
+
height: "auto",
|
73 |
+
display: "block"
|
74 |
+
}), c.on("error", n), c[0].onerror = n, e(), void d())
|
75 |
+
}
|
76 |
+
|
77 |
+
function d() {
|
78 |
+
(g.responsive || c.data("sbi_imgLiquid_oldProcessed")) && c.data("sbi_imgLiquid_settings") && (g = c.data("sbi_imgLiquid_settings"), u.actualSize = u.get(0).offsetWidth + u.get(0).offsetHeight / 1e4, u.sizeOld && u.actualSize !== u.sizeOld && r(), u.sizeOld = u.actualSize, setTimeout(d, g.responsiveCheckTime))
|
79 |
+
}
|
80 |
+
|
81 |
+
function n() {
|
82 |
+
c.data("sbi_imgLiquid_error", !0), u.addClass("sbi_imgLiquid_error"), g.onItemError && g.onItemError(t, u, c), l()
|
83 |
+
}
|
84 |
+
|
85 |
+
function s() {
|
86 |
+
var i = {};
|
87 |
+
if (a.settings.useDataHtmlAttr) {
|
88 |
+
var t = u.attr("data-sbi_imgLiquid-fill"),
|
89 |
+
e = u.attr("data-sbi_imgLiquid-horizontalAlign"),
|
90 |
+
o = u.attr("data-sbi_imgLiquid-verticalAlign");
|
91 |
+
("true" === t || "false" === t) && (i.fill = Boolean("true" === t)), void 0 === e || "left" !== e && "center" !== e && "right" !== e && -1 === e.indexOf("%") || (i.horizontalAlign = e), void 0 === o || "top" !== o && "bottom" !== o && "center" !== o && -1 === o.indexOf("%") || (i.verticalAlign = o)
|
92 |
+
}
|
93 |
+
return sbi_imgLiquid.isIE && a.settings.ieFadeInDisabled && (i.fadeInTime = 0), i
|
94 |
+
}
|
95 |
+
|
96 |
+
function r() {
|
97 |
+
var i, e, a, o, d, n, s, r, m = 0, h = 0, f = u.width(), v = u.height();
|
98 |
+
void 0 === c.data("owidth") && c.data("owidth", c[0].width), void 0 === c.data("oheight") && c.data("oheight", c[0].height), g.fill === f / v >= c.data("owidth") / c.data("oheight") ? (i = "100%", e = "auto", a = Math.floor(f), o = Math.floor(f * (c.data("oheight") / c.data("owidth")))) : (i = "auto", e = "100%", a = Math.floor(v * (c.data("owidth") / c.data("oheight"))), o = Math.floor(v)), d = g.horizontalAlign.toLowerCase(), s = f - a, "left" === d && (h = 0), "center" === d && (h = .5 * s), "right" === d && (h = s), -1 !== d.indexOf("%") && (d = parseInt(d.replace("%", ""), 10), d > 0 && (h = s * d * .01)), n = g.verticalAlign.toLowerCase(), r = v - o, "left" === n && (m = 0), "center" === n && (m = .5 * r), "bottom" === n && (m = r), -1 !== n.indexOf("%") && (n = parseInt(n.replace("%", ""), 10), n > 0 && (m = r * n * .01)), g.hardPixels && (i = a, e = o), c.css({
|
99 |
+
width: i,
|
100 |
+
height: e,
|
101 |
+
"margin-left": Math.floor(h),
|
102 |
+
"margin-top": Math.floor(m)
|
103 |
+
}), c.data("sbi_imgLiquid_oldProcessed") || (c.fadeTo(g.fadeInTime, 1), c.data("sbi_imgLiquid_oldProcessed", !0), g.removeBoxBackground && u.css("background-image", "none"), u.addClass("sbi_imgLiquid_nobgSize"), u.addClass("sbi_imgLiquid_ready")), g.onItemFinish && g.onItemFinish(t, u, c), l()
|
104 |
+
}
|
105 |
+
|
106 |
+
function l() {
|
107 |
+
t === a.length - 1 && a.settings.onFinish && a.settings.onFinish()
|
108 |
+
}
|
109 |
+
|
110 |
+
var g = a.settings, u = i(this), c = i("img:first", u);
|
111 |
+
return c.length ? (c.data("sbi_imgLiquid_settings") ? (u.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"), g = i.extend({}, c.data("sbi_imgLiquid_settings"), a.options)) : g = i.extend({}, a.settings, s()), c.data("sbi_imgLiquid_settings", g), g.onItemStart && g.onItemStart(t, u, c), void (sbi_imgLiquid.bgs_Available && g.useBackgroundSize ? e() : o())) : void n()
|
112 |
+
})
|
113 |
+
}
|
114 |
+
})
|
115 |
+
}(jQuery);
|
116 |
+
|
117 |
+
// Use imagefill to set the images as backgrounds so they can be square
|
118 |
+
!function () {
|
119 |
+
var css = sbi_imgLiquid.injectCss,
|
120 |
+
head = document.getElementsByTagName('head')[0],
|
121 |
+
style = document.createElement('style');
|
122 |
+
style.type = 'text/css';
|
123 |
+
if (style.styleSheet) {
|
124 |
+
style.styleSheet.cssText = css;
|
125 |
+
} else {
|
126 |
+
style.appendChild(document.createTextNode(css));
|
127 |
+
}
|
128 |
+
head.appendChild(style);
|
129 |
+
}();
|
130 |
+
}
|
131 |
+
|
132 |
+
function sbiAddVisibilityListener() {
|
133 |
+
/* Detect when element becomes visible. Used for when the feed is initially hidden, in a tab for example. https://github.com/shaunbowe/jquery.visibilityChanged */
|
134 |
+
!function (i) {
|
135 |
+
var n = { runOnLoad: !0, frequency: 100, sbiPreviousVisibility: null
|
136 |
+
}, c = {};
|
137 |
+
c.sbiCheckVisibility = function (i, n) {
|
138 |
+
if (jQuery.contains(document, i[0])) {
|
139 |
+
var e = n.sbiPreviousVisibility, t = i.is(":visible");
|
140 |
+
n.sbiPreviousVisibility = t, null == e ? n.runOnLoad && n.callback(i, t) : e !== t && n.callback(i, t), setTimeout(function () {
|
141 |
+
c.sbiCheckVisibility(i, n)
|
142 |
+
}, n.frequency)
|
143 |
+
}
|
144 |
+
}, i.fn.sbiVisibilityChanged = function (e) {
|
145 |
+
var t = i.extend({}, n, e);
|
146 |
+
return this.each(function () {
|
147 |
+
c.sbiCheckVisibility(i(this), t)
|
148 |
+
})
|
149 |
+
}
|
150 |
+
}(jQuery);
|
151 |
+
}
|
152 |
+
|
153 |
+
function Sbi() {
|
154 |
+
this.feeds = {};
|
155 |
+
this.options = sb_instagram_js_options;
|
156 |
+
}
|
157 |
+
|
158 |
+
Sbi.prototype = {
|
159 |
+
createPage: function (createFeeds, createFeedsArgs) {
|
160 |
+
if (typeof window.sbiajaxurl === 'undefined' || window.sbiajaxurl.indexOf(window.location.hostname) === -1) {
|
161 |
+
window.sbiajaxurl = location.protocol + '//'+ window.location.hostname + '/wp-admin/admin-ajax.php';
|
162 |
}
|
163 |
|
164 |
+
$('.sbi_no_js_error_message').remove();
|
165 |
+
$('.sbi_no_js').removeClass('sbi_no_js');
|
166 |
+
createFeeds(createFeedsArgs);
|
167 |
+
},
|
168 |
+
createFeeds: function (args) {
|
169 |
+
args.whenFeedsCreated(
|
170 |
+
$('.sbi').each(function (index) {
|
171 |
+
$(this).attr('data-sbi-index', index + 1);
|
172 |
+
var $self = $(this),
|
173 |
+
flags = typeof $self.attr('data-sbi-flags') !== 'undefined' ? $self.attr('data-sbi-flags').split(',') : [],
|
174 |
+
general = typeof $self.attr('data-options') !== 'undefined' ? JSON.parse($self.attr('data-options')) : {};
|
175 |
+
if (flags.indexOf('testAjax') > -1) {
|
176 |
+
window.sbi.triggeredTest = true;
|
177 |
+
var submitData = {
|
178 |
+
'action' : 'sbi_on_ajax_test_trigger'
|
179 |
+
},
|
180 |
+
onSuccess = function(data) {
|
181 |
+
console.log('did test');
|
182 |
+
};
|
183 |
+
sbiAjax(submitData,onSuccess)
|
184 |
+
}
|
185 |
+
var feedOptions = {
|
186 |
+
cols : $self.attr('data-cols'),
|
187 |
+
colsmobile : typeof $self.attr('data-colsmobile') !== 'undefined' && $self.attr('data-colsmobile') !== 'same' ? $self.attr('data-colsmobile') : $self.attr('data-cols'),
|
188 |
+
num : $self.attr('data-num'),
|
189 |
+
imgRes : $self.attr('data-res'),
|
190 |
+
feedID : $self.attr('data-feedid'),
|
191 |
+
postID : typeof $self.attr( 'data-postid' ) !== 'undefind' ? $self.attr( 'data-postid' ) : 'unknown',
|
192 |
+
shortCodeAtts : $self.attr('data-shortcode-atts'),
|
193 |
+
resizingEnabled : (flags.indexOf('resizeDisable') === -1),
|
194 |
+
imageLoadEnabled : (flags.indexOf('imageLoadDisable') === -1),
|
195 |
+
debugEnabled : (flags.indexOf('debug') > -1),
|
196 |
+
favorLocal : (flags.indexOf('favorLocal') > -1),
|
197 |
+
ajaxPostLoad : (flags.indexOf('ajaxPostLoad') > -1),
|
198 |
+
gdpr : (flags.indexOf('gdpr') > -1),
|
199 |
+
overrideBlockCDN : (flags.indexOf('overrideBlockCDN') > -1),
|
200 |
+
consentGiven : false,
|
201 |
+
locator : (flags.indexOf('locator') > -1),
|
202 |
+
autoMinRes : 1,
|
203 |
+
general : general
|
204 |
+
};
|
205 |
+
|
206 |
+
window.sbi.feeds[index] = sbiGetNewFeed(this, index, feedOptions);
|
207 |
+
window.sbi.feeds[index].setResizedImages();
|
208 |
+
window.sbi.feeds[index].init();
|
209 |
+
|
210 |
+
var evt = jQuery.Event('sbiafterfeedcreate');
|
211 |
+
evt.feed = window.sbi.feeds[index];
|
212 |
+
jQuery(window).trigger(evt);
|
213 |
+
|
214 |
+
})
|
215 |
+
);
|
216 |
+
},
|
217 |
+
afterFeedsCreated: function () {
|
218 |
+
// enable header hover action
|
219 |
+
$('.sb_instagram_header').each(function () {
|
220 |
+
var $thisHeader = $(this);
|
221 |
+
$thisHeader.find('.sbi_header_link').on('mouseenter mouseleave', function(e) {
|
222 |
+
switch(e.type) {
|
223 |
+
case 'mouseenter':
|
224 |
+
$thisHeader.find('.sbi_header_img_hover').addClass('sbi_fade_in');
|
225 |
+
break;
|
226 |
+
case 'mouseleave':
|
227 |
+
$thisHeader.find('.sbi_header_img_hover').removeClass('sbi_fade_in');
|
228 |
+
break;
|
229 |
+
}
|
230 |
+
});
|
231 |
+
});
|
232 |
+
|
233 |
+
},
|
234 |
+
encodeHTML: function(raw) {
|
235 |
+
// make sure passed variable is defined
|
236 |
+
if (typeof raw === 'undefined') {
|
237 |
+
return '';
|
238 |
+
}
|
239 |
+
// replace greater than and less than symbols with html entity to disallow html in comments
|
240 |
+
var encoded = raw.replace(/(>)/g,'>'),
|
241 |
+
encoded = encoded.replace(/(<)/g,'<');
|
242 |
+
encoded = encoded.replace(/(<br\/>)/g,'<br>');
|
243 |
+
encoded = encoded.replace(/(<br>)/g,'<br>');
|
244 |
+
|
245 |
+
return encoded;
|
246 |
+
},
|
247 |
+
urlDetect: function(text) {
|
248 |
+
var urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g;
|
249 |
+
return text.match(urlRegex);
|
250 |
+
}
|
251 |
+
};
|
252 |
+
|
253 |
+
function SbiFeed(el, index, settings) {
|
254 |
+
this.el = el;
|
255 |
+
this.index = index;
|
256 |
+
this.settings = settings;
|
257 |
+
this.minImageWidth = 0;
|
258 |
+
this.imageResolution = 150;
|
259 |
+
this.resizedImages = {};
|
260 |
+
this.needsResizing = [];
|
261 |
+
this.outOfPages = false;
|
262 |
+
this.page = 1;
|
263 |
+
this.isInitialized = false;
|
264 |
+
}
|
265 |
+
|
266 |
+
SbiFeed.prototype = {
|
267 |
+
init: function() {
|
268 |
+
var feed = this;
|
269 |
+
feed.settings.consentGiven = feed.checkConsent();
|
270 |
+
if ($(this.el).find('.sbi_photo').parent('p').length) {
|
271 |
+
$(this.el).addClass('sbi_no_autop');
|
272 |
+
}
|
273 |
+
if ($(this.el).find('#sbi_mod_error').length) {
|
274 |
+
$(this.el).prepend($(this.el).find('#sbi_mod_error'));
|
275 |
+
}
|
276 |
+
if (this.settings.ajaxPostLoad) {
|
277 |
+
this.getNewPostSet();
|
278 |
+
} else {
|
279 |
+
this.afterInitialImagesLoaded();
|
280 |
+
//Only check the width once the resize event is over
|
281 |
}
|
282 |
+
var sbi_delay = (function () {
|
283 |
+
var sbi_timer = 0;
|
284 |
+
return function (sbi_callback, sbi_ms) {
|
285 |
+
clearTimeout(sbi_timer);
|
286 |
+
sbi_timer = setTimeout(sbi_callback, sbi_ms);
|
287 |
+
};
|
288 |
+
})();
|
289 |
+
jQuery(window).on('resize',function () {
|
290 |
+
sbi_delay(function () {
|
291 |
+
feed.afterResize();
|
292 |
+
}, 500);
|
293 |
+
});
|
294 |
|
295 |
+
$(this.el).find('.sbi_item').each(function() {
|
296 |
+
feed.lazyLoadCheck($(this));
|
297 |
+
});
|
298 |
+
},
|
299 |
+
afterInitialImagesLoaded: function() {
|
300 |
+
this.loadMoreButtonInit();
|
301 |
+
this.hideExtraImagesForWidth();
|
302 |
+
this.beforeNewImagesRevealed();
|
303 |
+
this.revealNewImages();
|
304 |
+
this.afterNewImagesRevealed();
|
305 |
+
},
|
306 |
+
afterResize: function() {
|
307 |
+
this.setImageHeight();
|
308 |
+
this.setImageResolution();
|
309 |
+
this.maybeRaiseImageResolution();
|
310 |
+
this.setImageSizeClass();
|
311 |
+
},
|
312 |
+
afterLoadMoreClicked: function($button) {
|
313 |
+
$button.find('.sbi_loader').removeClass('sbi_hidden');
|
314 |
+
$button.find('.sbi_btn_text').addClass('sbi_hidden');
|
315 |
+
$button.closest('.sbi').find('.sbi_num_diff_hide').addClass('sbi_transition').removeClass('sbi_num_diff_hide');
|
316 |
+
},
|
317 |
+
afterNewImagesLoaded: function() {
|
318 |
+
var $self = $(this.el),
|
319 |
+
feed = this;
|
320 |
+
this.beforeNewImagesRevealed();
|
321 |
+
this.revealNewImages();
|
322 |
+
this.afterNewImagesRevealed();
|
323 |
+
setTimeout(function () {
|
324 |
+
//Hide the loader in the load more button
|
325 |
+
$self.find('.sbi_loader').addClass('sbi_hidden');
|
326 |
+
$self.find('.sbi_btn_text').removeClass('sbi_hidden');
|
327 |
+
feed.maybeRaiseImageResolution();
|
328 |
+
}, 500);
|
329 |
+
},
|
330 |
+
beforeNewImagesRevealed: function() {
|
331 |
+
this.setImageHeight();
|
332 |
+
this.maybeRaiseImageResolution(true);
|
333 |
+
this.setImageSizeClass();
|
334 |
+
},
|
335 |
+
revealNewImages: function() {
|
336 |
+
var $self = $(this.el);
|
337 |
+
|
338 |
+
$self.find('.sbi-screenreader').each(function() {
|
339 |
+
$(this).find('img').remove();
|
340 |
+
});
|
341 |
|
342 |
+
// Call Custom JS if it exists
|
343 |
+
if (typeof sbi_custom_js == 'function') setTimeout(function(){ sbi_custom_js(); }, 100);
|
344 |
+
|
345 |
+
this.applyImageLiquid();
|
346 |
+
$self.find('.sbi_item').each(function (index) {
|
347 |
+
var $self = jQuery(this);
|
348 |
+
|
349 |
+
//Photo links
|
350 |
+
$self.find('.sbi_photo').on('mouseenter mouseleave', function(e) {
|
351 |
+
switch(e.type) {
|
352 |
+
case 'mouseenter':
|
353 |
+
jQuery(this).fadeTo(200, 0.85);
|
354 |
+
break;
|
355 |
+
case 'mouseleave':
|
356 |
+
jQuery(this).stop().fadeTo(500, 1);
|
357 |
+
break;
|
358 |
+
}
|
359 |
+
});
|
360 |
+
}); //End .sbi_item each
|
361 |
+
|
362 |
+
//Remove the new class after 500ms, once the sorting is done
|
363 |
+
setTimeout(function () {
|
364 |
+
jQuery('#sbi_images .sbi_item.sbi_new').removeClass('sbi_new');
|
365 |
+
//Loop through items and remove class to reveal them
|
366 |
+
var time = 10;
|
367 |
+
$self.find('.sbi_transition').each(function() {
|
368 |
+
var $sbi_item_transition_el = jQuery(this);
|
369 |
+
|
370 |
+
setTimeout( function(){
|
371 |
+
$sbi_item_transition_el.removeClass('sbi_transition');
|
372 |
+
}, time);
|
373 |
+
time += 10;
|
374 |
+
});
|
375 |
+
}, 500);
|
376 |
+
},
|
377 |
+
lazyLoadCheck: function($item){
|
378 |
+
var feed = this;
|
379 |
+
if ($item.find('.sbi_photo').length && !$item.closest('.sbi').hasClass('sbi-no-ll-check')) {
|
380 |
+
var imgSrcSet = feed.getImageUrls($item),
|
381 |
+
maxResImage = typeof imgSrcSet[640] !== 'undefined' ? imgSrcSet[640] : $item.find('.sbi_photo').attr('data-full-res');
|
382 |
+
|
383 |
+
if (!feed.settings.consentGiven) {
|
384 |
+
if (maxResImage.indexOf('scontent') > -1) {
|
385 |
+
return;
|
386 |
+
}
|
387 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
|
389 |
+
$item.find('.sbi_photo img').each(function() {
|
390 |
+
if (maxResImage && typeof $(this).attr('data-src') !== 'undefined') {
|
391 |
+
$(this).attr('data-src',maxResImage);
|
392 |
+
}
|
393 |
+
if (maxResImage && typeof $(this).attr('data-orig-src') !== 'undefined') {
|
394 |
+
$(this).attr('data-orig-src',maxResImage);
|
395 |
+
}
|
396 |
+
$(this).on('load',function() {
|
397 |
+
if (!$(this).hasClass('sbi-replaced')
|
398 |
+
&& $(this).attr('src').indexOf('placeholder') > -1) {
|
399 |
+
$(this).addClass('sbi-replaced');
|
400 |
+
if (maxResImage) {
|
401 |
+
$(this).attr('src',maxResImage);
|
402 |
+
if ($(this).closest('.sbi_imgLiquid_bgSize').length) {
|
403 |
+
$(this).closest('.sbi_imgLiquid_bgSize').css('background-image', 'url(' + maxResImage + ')');
|
404 |
+
}
|
405 |
}
|
406 |
+
}
|
407 |
+
});
|
408 |
+
});
|
409 |
+
}
|
410 |
+
},
|
411 |
+
afterNewImagesRevealed: function() {
|
412 |
+
this.listenForVisibilityChange();
|
413 |
+
this.sendNeedsResizingToServer();
|
414 |
+
if (!this.settings.imageLoadEnabled) {
|
415 |
+
$('.sbi_no_resraise').removeClass('sbi_no_resraise');
|
416 |
+
}
|
417 |
|
418 |
+
var evt = $.Event('sbiafterimagesloaded');
|
419 |
+
evt.el = $(this.el);
|
420 |
+
$(window).trigger(evt);
|
421 |
+
},
|
422 |
+
setResizedImages: function () {
|
423 |
+
if ($(this.el).find('.sbi_resized_image_data').length
|
424 |
+
&& typeof $(this.el).find('.sbi_resized_image_data').attr('data-resized') !== 'undefined'
|
425 |
+
&& $(this.el).find('.sbi_resized_image_data').attr('data-resized').indexOf('{"') === 0) {
|
426 |
+
this.resizedImages = JSON.parse($(this.el).find('.sbi_resized_image_data').attr('data-resized'));
|
427 |
+
$(this.el).find('.sbi_resized_image_data').remove();
|
428 |
+
}
|
429 |
+
},
|
430 |
+
sendNeedsResizingToServer: function() {
|
431 |
+
var feed = this,
|
432 |
+
$self = $(this.el);
|
433 |
+
if (feed.needsResizing.length > 0 && feed.settings.resizingEnabled) {
|
434 |
+
var itemOffset = $(this.el).find('.sbi_item').length,
|
435 |
+
cacheAll = typeof feed.settings.general.cache_all !== 'undefined' ? feed.settings.general.cache_all : false;
|
436 |
+
var locatorNonce = '';
|
437 |
+
if ( typeof $self.attr( 'data-locatornonce' ) !== 'undefined' ) {
|
438 |
+
locatorNonce = $self.attr( 'data-locatornonce' );
|
439 |
+
}
|
440 |
+
var submitData = {
|
441 |
+
action: 'sbi_resized_images_submit',
|
442 |
+
needs_resizing: feed.needsResizing,
|
443 |
+
offset: itemOffset,
|
444 |
+
feed_id: feed.settings.feedID,
|
445 |
+
atts: feed.settings.shortCodeAtts,
|
446 |
+
location: feed.locationGuess(),
|
447 |
+
post_id: feed.settings.postID,
|
448 |
+
cache_all: cacheAll,
|
449 |
+
locator_nonce: locatorNonce
|
450 |
+
};
|
451 |
+
var onSuccess = function(data) {
|
452 |
+
var response = data;
|
453 |
+
|
454 |
+
if (typeof data !== 'object' && data.trim().indexOf('{') === 0) {
|
455 |
+
response = JSON.parse(data.trim());
|
456 |
}
|
457 |
+
if (feed.settings.debugEnabled) {
|
458 |
+
console.log(response);
|
459 |
+
}
|
460 |
+
for (var property in response) {
|
461 |
+
if (response.hasOwnProperty(property)) {
|
462 |
+
feed.resizedImages[property] = response[property];
|
463 |
+
}
|
464 |
+
}
|
465 |
+
feed.maybeRaiseImageResolution();
|
466 |
|
467 |
+
setTimeout(function() {
|
468 |
+
feed.afterResize();
|
469 |
+
},500);
|
470 |
+
|
471 |
+
};
|
472 |
+
sbiAjax(submitData,onSuccess);
|
473 |
+
} else if (feed.settings.locator) {
|
474 |
+
var locatorNonce = '';
|
475 |
+
if ( typeof $self.attr( 'data-locatornonce' ) !== 'undefined' ) {
|
476 |
+
locatorNonce = $self.attr( 'data-locatornonce' );
|
477 |
+
}
|
478 |
+
var submitData = {
|
479 |
+
action: 'sbi_do_locator',
|
480 |
+
feed_id: feed.settings.feedID,
|
481 |
+
atts: feed.settings.shortCodeAtts,
|
482 |
+
location: feed.locationGuess(),
|
483 |
+
post_id: feed.settings.postID,
|
484 |
+
locator_nonce: locatorNonce
|
485 |
+
};
|
486 |
+
var onSuccess = function(data) {
|
487 |
+
|
488 |
+
};
|
489 |
+
sbiAjax(submitData,onSuccess);
|
490 |
+
}
|
491 |
+
},
|
492 |
+
loadMoreButtonInit: function () {
|
493 |
+
var $self = $(this.el),
|
494 |
+
feed = this;
|
495 |
+
$self.find('#sbi_load .sbi_load_btn').off().on('click', function () {
|
496 |
+
|
497 |
+
feed.afterLoadMoreClicked(jQuery(this));
|
498 |
+
feed.getNewPostSet();
|
499 |
+
|
500 |
+
}); //End click event
|
501 |
+
},
|
502 |
+
getNewPostSet: function () {
|
503 |
+
var $self = $(this.el),
|
504 |
+
feed = this;
|
505 |
+
feed.page ++;
|
506 |
+
|
507 |
+
var locatorNonce = '';
|
508 |
+
if ( typeof $self.attr( 'data-locatornonce' ) !== 'undefined' ) {
|
509 |
+
locatorNonce = $self.attr( 'data-locatornonce' );
|
510 |
}
|
511 |
|
512 |
+
var itemOffset = $self.find('.sbi_item').length,
|
513 |
+
submitData = {
|
514 |
+
action: 'sbi_load_more_clicked',
|
515 |
+
offset: itemOffset,
|
516 |
+
page: feed.page,
|
517 |
+
feed_id: feed.settings.feedID,
|
518 |
+
atts: feed.settings.shortCodeAtts,
|
519 |
+
location: feed.locationGuess(),
|
520 |
+
post_id: feed.settings.postID,
|
521 |
+
current_resolution: feed.imageResolution,
|
522 |
+
locator_nonce: locatorNonce
|
523 |
+
};
|
524 |
+
var onSuccess = function (data) {
|
525 |
+
var response = data;
|
526 |
+
|
527 |
+
if (typeof data !== 'object' && data.trim().indexOf('{') === 0) {
|
528 |
+
response = JSON.parse(data.trim());
|
529 |
+
}
|
530 |
+
if (feed.settings.debugEnabled) {
|
531 |
+
console.log(response);
|
532 |
+
}
|
533 |
+
feed.appendNewPosts(response.html);
|
534 |
+
feed.addResizedImages(response.resizedImages);
|
535 |
+
if (feed.settings.ajaxPostLoad) {
|
536 |
+
feed.settings.ajaxPostLoad = false;
|
537 |
+
feed.afterInitialImagesLoaded();
|
538 |
+
} else {
|
539 |
+
feed.afterNewImagesLoaded();
|
540 |
+
}
|
541 |
+
|
542 |
+
if (!response.feedStatus.shouldPaginate) {
|
543 |
+
feed.outOfPages = true;
|
544 |
+
$self.find('.sbi_load_btn').hide();
|
545 |
+
} else {
|
546 |
+
feed.outOfPages = false;
|
547 |
+
}
|
548 |
+
$('.sbi_no_js').removeClass('sbi_no_js');
|
549 |
+
};
|
550 |
+
sbiAjax(submitData, onSuccess);
|
551 |
+
},
|
552 |
+
appendNewPosts: function (newPostsHtml) {
|
553 |
+
var $self = $(this.el);
|
554 |
+
if ($self.find('#sbi_images .sbi_item').length) {
|
555 |
+
$self.find('#sbi_images .sbi_item').last().after(newPostsHtml);
|
556 |
+
} else {
|
557 |
+
$self.find('#sbi_images').append(newPostsHtml);
|
558 |
+
}
|
559 |
+
},
|
560 |
+
addResizedImages: function (resizedImagesToAdd) {
|
561 |
+
for (var imageID in resizedImagesToAdd) {
|
562 |
+
this.resizedImages[imageID] = resizedImagesToAdd[imageID];
|
563 |
+
}
|
564 |
+
},
|
565 |
+
setImageHeight: function() {
|
566 |
+
var $self = $(this.el);
|
567 |
+
|
568 |
+
var sbi_photo_width = $self.find('.sbi_photo').eq(0).innerWidth();
|
569 |
+
|
570 |
+
//Figure out number of columns for either desktop or mobile
|
571 |
+
var sbi_num_cols = this.getColumnCount();
|
572 |
+
|
573 |
+
//Figure out what the width should be using the number of cols
|
574 |
+
//Figure out what the width should be using the number of cols
|
575 |
+
var imagesPadding = $self.find('#sbi_images').innerWidth() - $self.find('#sbi_images').width(),
|
576 |
+
imagepadding = imagesPadding / 2,
|
577 |
+
sbi_photo_width_manual = ( $self.find('#sbi_images').width() / sbi_num_cols ) - imagesPadding;
|
578 |
+
//If the width is less than it should be then set it manually
|
579 |
+
//if( sbi_photo_width <= (sbi_photo_width_manual) ) sbi_photo_width = sbi_photo_width_manual;
|
580 |
+
|
581 |
+
$self.find('.sbi_photo').css('height', sbi_photo_width);
|
582 |
+
|
583 |
+
//Set the position of the carousel arrows
|
584 |
+
if ($self.find('.sbi-owl-nav').length) {
|
585 |
+
setTimeout(function(){
|
586 |
+
//If there's 2 rows then adjust position
|
587 |
+
var sbi_ratio = 2;
|
588 |
+
if( $self.find('.sbi_owl2row-item').length ) sbi_ratio = 1;
|
589 |
+
|
590 |
+
var sbi_arrows_top = ($self.find('.sbi_photo').eq(0).innerWidth()/sbi_ratio);
|
591 |
+
sbi_arrows_top += parseInt(imagepadding)*(2+(2-sbi_ratio));
|
592 |
+
$self.find('.sbi-owl-nav div').css('top', sbi_arrows_top);
|
593 |
+
}, 100);
|
594 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
595 |
|
596 |
+
},
|
597 |
+
maybeRaiseSingleImageResolution: function ($item, index, forceChange) {
|
598 |
+
var feed = this,
|
599 |
+
imgSrcSet = feed.getImageUrls($item),
|
600 |
+
currentUrl = $item.find('.sbi_photo img').attr('src'),
|
601 |
+
currentRes = 150,
|
602 |
+
imagEl = $item.find('img').get(0),
|
603 |
+
aspectRatio = currentUrl === window.sbi.options.placeholder ? 1 : imagEl.naturalWidth/imagEl.naturalHeight,
|
604 |
+
forceChange = typeof forceChange !== 'undefined' ? forceChange : false;
|
605 |
+
|
606 |
+
if ($item.hasClass('sbi_no_resraise') || $item.hasClass('sbi_had_error') || ($item.find('.sbi_link_area').length && $item.find('.sbi_link_area').hasClass('sbi_had_error'))) {
|
607 |
+
return;
|
608 |
+
}
|
609 |
|
610 |
+
if (imgSrcSet.length < 1) {
|
611 |
+
if ($item.find('.sbi_link_area').length) {
|
612 |
+
$item.find('.sbi_link_area').attr('href',window.sbi.options.placeholder.replace('placeholder.png','thumb-placeholder.png'))
|
613 |
+
}
|
614 |
+
return;
|
615 |
+
} else if ($item.find('.sbi_link_area').length && $item.find('.sbi_link_area').attr('href') === window.sbi.options.placeholder.replace('placeholder.png','thumb-placeholder.png')
|
616 |
+
|| !feed.settings.consentGiven) {
|
617 |
+
$item.find('.sbi_link_area').attr('href',imgSrcSet[imgSrcSet.length - 1])
|
618 |
+
}
|
619 |
+
if (typeof imgSrcSet[640] !== 'undefined') {
|
620 |
+
$item.find('.sbi_photo').attr('data-full-res',imgSrcSet[640]);
|
621 |
+
}
|
622 |
|
623 |
+
$.each(imgSrcSet, function (index, value) {
|
624 |
+
if (value === currentUrl) {
|
625 |
+
currentRes = parseInt(index);
|
626 |
+
// If the image has already been changed to an existing real source, don't force the change
|
627 |
+
forceChange = false;
|
628 |
+
}
|
629 |
+
});
|
630 |
+
//Image res
|
631 |
+
var newRes = 640;
|
632 |
+
switch (feed.settings.imgRes) {
|
633 |
+
case 'thumb':
|
634 |
+
newRes = 150;
|
635 |
+
break;
|
636 |
+
case 'medium':
|
637 |
+
newRes = 320;
|
638 |
+
break;
|
639 |
+
case 'full':
|
640 |
+
newRes = 640;
|
641 |
+
break;
|
642 |
+
default:
|
643 |
+
var minImageWidth = Math.max(feed.settings.autoMinRes,$item.find('.sbi_photo').innerWidth()),
|
644 |
+
thisImageReplace = feed.getBestResolutionForAuto(minImageWidth, aspectRatio, $item);
|
645 |
+
switch (thisImageReplace) {
|
646 |
+
case 320:
|
647 |
+
newRes = 320;
|
648 |
+
break;
|
649 |
+
case 150:
|
650 |
+
newRes = 150;
|
651 |
+
break;
|
652 |
+
}
|
653 |
+
break;
|
654 |
+
}
|
|
|
|
|
|
|
655 |
|
656 |
+
if (newRes > currentRes || currentUrl === window.sbi.options.placeholder || forceChange) {
|
657 |
+
if (feed.settings.debugEnabled) {
|
658 |
+
var reason = currentUrl === window.sbi.options.placeholder ? 'was placeholder' : 'too small';
|
659 |
+
console.log('rais res for ' + currentUrl, reason);
|
660 |
+
}
|
661 |
+
var newUrl = imgSrcSet[newRes].split("?ig_cache_key")[0];
|
662 |
+
if (currentUrl !== newUrl) {
|
663 |
+
$item.find('.sbi_photo img').attr('src', newUrl);
|
664 |
+
$item.find('.sbi_photo').css('background-image', 'url("' + newUrl + '")');
|
665 |
+
}
|
666 |
+
currentRes = newRes;
|
667 |
+
|
668 |
+
if (feed.settings.imgRes === 'auto') {
|
669 |
+
var checked = false;
|
670 |
+
$item.find('.sbi_photo img').on('load', function () {
|
671 |
+
|
672 |
+
var $this_image = $(this);
|
673 |
+
var newAspectRatio = ($this_image.get(0).naturalWidth / $this_image.get(0).naturalHeight);
|
674 |
+
|
675 |
+
if ($this_image.get(0).naturalWidth !== 1000 && newAspectRatio > aspectRatio && !checked) {
|
676 |
+
if (feed.settings.debugEnabled) {
|
677 |
+
console.log('rais res again for aspect ratio change ' + currentUrl);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
678 |
}
|
679 |
+
checked = true;
|
680 |
+
minImageWidth = $item.find('.sbi_photo').innerWidth();
|
681 |
+
thisImageReplace = feed.getBestResolutionForAuto(minImageWidth, newAspectRatio, $item);
|
682 |
+
newRes = 640;
|
683 |
+
|
684 |
+
switch (thisImageReplace) {
|
685 |
+
case 320:
|
686 |
+
newRes = 320;
|
687 |
+
break;
|
688 |
+
case 150:
|
689 |
+
newRes = 150;
|
690 |
+
break;
|
|
|
691 |
}
|
692 |
|
693 |
+
if (newRes > currentRes) {
|
694 |
+
newUrl = imgSrcSet[newRes].split("?ig_cache_key")[0];
|
695 |
+
$this_image.attr('src', newUrl);
|
696 |
+
$this_image.closest('.sbi_photo').css('background-image', 'url("' + newUrl + '")');
|
|
|
|
|
|
|
|
|
697 |
}
|
698 |
+
if (feed.layout === 'masonry' || feed.layout === 'highlight') {
|
699 |
+
$(feed.el).find('#sbi_images').smashotope(feed.isotopeArgs);
|
700 |
+
setTimeout(function() {
|
701 |
+
$(feed.el).find('#sbi_images').smashotope(feed.isotopeArgs);
|
702 |
+
},500)
|
703 |
}
|
704 |
+
} else {
|
705 |
+
if (feed.settings.debugEnabled) {
|
706 |
+
var reason = checked ? 'already checked' : 'no aspect ratio change';
|
707 |
+
console.log('not raising res for replacement ' + currentUrl, reason);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
708 |
}
|
709 |
+
}
|
710 |
+
});
|
711 |
+
}
|
712 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
713 |
|
714 |
+
}
|
715 |
|
716 |
+
$item.find('img').on('error', function () {
|
717 |
+
if (!$(this).hasClass('sbi_img_error')) {
|
718 |
+
$(this).addClass('sbi_img_error');
|
719 |
+
var sourceFromAPI = ($(this).attr('src').indexOf('media/?size=') > -1 || $(this).attr('src').indexOf('cdninstagram') > -1 || $(this).attr('src').indexOf('fbcdn') > -1)
|
720 |
|
721 |
+
if (!sourceFromAPI && feed.settings.consentGiven) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
722 |
|
723 |
+
if ($(this).closest('.sbi_photo').attr('data-img-src-set') !== 'undefined') {
|
724 |
+
var srcSet = JSON.parse($(this).closest('.sbi_photo').attr('data-img-src-set').replace(/\\\//g, '/'));
|
725 |
+
if (typeof srcSet.d !== 'undefined') {
|
726 |
+
$(this).attr('src', srcSet.d);
|
727 |
+
$(this).closest('.sbi_photo').css('background-image', 'url(' + srcSet.d + ')');
|
728 |
+
$(this).closest('.sbi_item').addClass('sbi_had_error').find('.sbi_link_area').attr('href', srcSet[640]).addClass('sbi_had_error');
|
729 |
}
|
730 |
+
}
|
731 |
+
} else {
|
732 |
+
feed.settings.favorLocal = true;
|
733 |
+
var srcSet = feed.getImageUrls($(this).closest('.sbi_item'));
|
734 |
+
if (typeof srcSet[640] !== 'undefined') {
|
735 |
+
$(this).attr('src', srcSet[640]);
|
736 |
+
$(this).closest('.sbi_photo').css('background-image', 'url(' + srcSet[640] + ')');
|
737 |
+
$(this).closest('.sbi_item').addClass('sbi_had_error').find('.sbi_link_area').attr('href', srcSet[640]).addClass('sbi_had_error');
|
738 |
+
}
|
739 |
+
}
|
740 |
+
setTimeout(function() {
|
741 |
+
feed.afterResize();
|
742 |
+
}, 1500)
|
743 |
+
} else {
|
744 |
+
console.log('unfixed error ' + $(this).attr('src'));
|
745 |
+
}
|
746 |
+
});
|
747 |
+
},
|
748 |
+
maybeRaiseImageResolution: function (justNew) {
|
749 |
+
var feed = this,
|
750 |
+
itemsSelector = typeof justNew !== 'undefined' && justNew === true ? '.sbi_item.sbi_new' : '.sbi_item',
|
751 |
+
forceChange = !feed.isInitialized ? true : false;
|
752 |
+
$(feed.el).find(itemsSelector).each(function (index) {
|
753 |
+
if (!$(this).hasClass('sbi_num_diff_hide')
|
754 |
+
&& $(this).find('.sbi_photo').length
|
755 |
+
&& typeof $(this).find('.sbi_photo').attr('data-img-src-set') !== 'undefined') {
|
756 |
+
feed.maybeRaiseSingleImageResolution($(this),index,forceChange);
|
757 |
+
}
|
758 |
+
}); //End .sbi_item each
|
759 |
+
feed.isInitialized = true;
|
760 |
+
},
|
761 |
+
getBestResolutionForAuto: function(colWidth, aspectRatio, $item) {
|
762 |
+
if (isNaN(aspectRatio) || aspectRatio < 1) {
|
763 |
+
aspectRatio = 1;
|
764 |
+
}
|
765 |
+
var bestWidth = colWidth * aspectRatio,
|
766 |
+
bestWidthRounded = Math.ceil(bestWidth / 10) * 10,
|
767 |
+
customSizes = [150, 320, 640];
|
768 |
|
769 |
+
if ($item.hasClass('sbi_highlighted')) {
|
770 |
+
bestWidthRounded = bestWidthRounded *2;
|
771 |
+
}
|
|
|
|
|
772 |
|
773 |
+
if (customSizes.indexOf(parseInt(bestWidthRounded)) === -1) {
|
774 |
+
var done = false;
|
775 |
+
$.each(customSizes, function (index, item) {
|
776 |
+
if (item > parseInt(bestWidthRounded) && !done) {
|
777 |
+
bestWidthRounded = item;
|
778 |
|
779 |
+
done = true;
|
780 |
+
}
|
781 |
+
});
|
782 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
783 |
|
784 |
+
return bestWidthRounded;
|
785 |
+
},
|
786 |
+
hideExtraImagesForWidth: function() {
|
787 |
+
if (this.layout === 'carousel') {
|
788 |
+
return;
|
789 |
+
}
|
790 |
+
var $self = $(this.el),
|
791 |
+
num = typeof $self.attr('data-num') !== 'undefined' && $self.attr('data-num') !== '' ? parseInt($self.attr('data-num')) : 1,
|
792 |
+
nummobile = typeof $self.attr('data-nummobile') !== 'undefined' && $self.attr('data-nummobile') !== '' ? parseInt($self.attr('data-nummobile')) : num;
|
793 |
+
|
794 |
+
if ($(window).width() < 480) {
|
795 |
+
if (nummobile < $self.find('.sbi_item').length) {
|
796 |
+
$self.find('.sbi_item').slice(nummobile - $self.find('.sbi_item').length).addClass('sbi_num_diff_hide');
|
797 |
+
}
|
798 |
+
} else {
|
799 |
+
if (num < $self.find('.sbi_item').length) {
|
800 |
+
$self.find('.sbi_item').slice(num - $self.find('.sbi_item').length).addClass('sbi_num_diff_hide');
|
801 |
+
}
|
802 |
+
}
|
803 |
+
},
|
804 |
+
setImageSizeClass: function () {
|
805 |
+
var $self = $(this.el);
|
806 |
+
$self.removeClass('sbi_small sbi_medium');
|
807 |
+
var feedWidth = $self.innerWidth(),
|
808 |
+
photoPadding = parseInt(($self.find('#sbi_images').outerWidth() - $self.find('#sbi_images').width())) / 2,
|
809 |
+
cols = this.getColumnCount(),
|
810 |
+
feedWidthSansPadding = feedWidth - (photoPadding * (cols+2)),
|
811 |
+
colWidth = (feedWidthSansPadding / cols);
|
812 |
+
if (colWidth > 120 && colWidth < 240) {
|
813 |
+
$self.addClass('sbi_medium');
|
814 |
+
} else if (colWidth <= 120) {
|
815 |
+
$self.addClass('sbi_small');
|
816 |
+
}
|
817 |
+
},
|
818 |
+
setMinImageWidth: function () {
|
819 |
+
if ($(this.el).find('.sbi_item .sbi_photo').first().length) {
|
820 |
+
this.minImageWidth = $(this.el).find('.sbi_item .sbi_photo').first().innerWidth();
|
821 |
+
} else {
|
822 |
+
this.minImageWidth = 150;
|
823 |
+
}
|
824 |
+
},
|
825 |
+
setImageResolution: function () {
|
826 |
+
if (this.settings.imgRes === 'auto') {
|
827 |
+
this.imageResolution = 'auto';
|
828 |
+
} else {
|
829 |
+
switch (this.settings.imgRes) {
|
830 |
+
case 'thumb':
|
831 |
+
this.imageResolution = 150;
|
832 |
+
break;
|
833 |
+
case 'medium':
|
834 |
+
this.imageResolution = 320;
|
835 |
+
break;
|
836 |
+
default:
|
837 |
+
this.imageResolution = 640;
|
838 |
+
}
|
839 |
+
}
|
840 |
+
},
|
841 |
+
getImageUrls: function ($item) {
|
842 |
+
var srcSet = JSON.parse($item.find('.sbi_photo').attr('data-img-src-set').replace(/\\\//g, '/')),
|
843 |
+
id = $item.attr('id').replace('sbi_', '');
|
844 |
+
if (!this.settings.consentGiven && !this.settings.overrideBlockCDN) {
|
845 |
+
srcSet = [];
|
846 |
+
}
|
847 |
+
if (typeof this.resizedImages[id] !== 'undefined'
|
848 |
+
&& this.resizedImages[id] !== 'video'
|
849 |
+
&& this.resizedImages[id] !== 'pending'
|
850 |
+
&& this.resizedImages[id].id !== 'error'
|
851 |
+
&& this.resizedImages[id].id !== 'video'
|
852 |
+
&& this.resizedImages[id].id !== 'pending') {
|
853 |
+
|
854 |
+
if (typeof this.resizedImages[id]['sizes'] !== 'undefined') {
|
855 |
+
var foundSizes = [];
|
856 |
+
if (typeof this.resizedImages[id]['sizes']['full'] !== 'undefined') {
|
857 |
+
srcSet[640] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
858 |
+
foundSizes.push(640);
|
859 |
+
}
|
860 |
+
if (typeof this.resizedImages[id]['sizes']['low'] !== 'undefined') {
|
861 |
+
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
862 |
+
foundSizes.push(320);
|
863 |
+
}
|
864 |
+
if (typeof this.resizedImages[id]['sizes']['thumb'] !== 'undefined') {
|
865 |
+
foundSizes.push(150);
|
866 |
+
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'thumb.jpg';
|
867 |
+
}
|
868 |
+
if (this.settings.favorLocal) {
|
869 |
+
if (foundSizes.indexOf(640) === -1) {
|
870 |
+
if (foundSizes.indexOf(320) > -1) {
|
871 |
+
srcSet[640] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
872 |
}
|
873 |
+
}
|
874 |
+
if (foundSizes.indexOf(320) === -1) {
|
875 |
+
if (foundSizes.indexOf(640) > -1) {
|
876 |
+
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
877 |
+
} else if (foundSizes.indexOf(150) > -1) {
|
878 |
+
srcSet[320] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'thumb.jpg';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
879 |
}
|
880 |
+
}
|
881 |
+
if (foundSizes.indexOf(150) === -1) {
|
882 |
+
if (foundSizes.indexOf(320) > -1) {
|
883 |
+
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'low.jpg';
|
884 |
+
} else if (foundSizes.indexOf(640) > -1) {
|
885 |
+
srcSet[150] = sb_instagram_js_options.resized_url + this.resizedImages[id].id + 'full.jpg';
|
886 |
}
|
887 |
+
}
|
888 |
+
}
|
889 |
+
}
|
890 |
+
} else if (typeof this.resizedImages[id] === 'undefined'
|
891 |
+
|| (typeof this.resizedImages[id]['id'] !== 'undefined' && this.resizedImages[id]['id'] !== 'pending' && this.resizedImages[id]['id'] !== 'error')) {
|
892 |
+
this.addToNeedsResizing(id);
|
893 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
894 |
|
895 |
+
return srcSet;
|
896 |
+
},
|
897 |
+
getAvatarUrl: function (username,favorType) {
|
898 |
+
if (username === '') {
|
899 |
+
return '';
|
900 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
901 |
|
902 |
+
var availableAvatars = this.settings.general.avatars,
|
903 |
+
favorType = typeof favorType !== 'undefined' ? favorType : 'local';
|
904 |
+
|
905 |
+
if (favorType === 'local') {
|
906 |
+
if (typeof availableAvatars['LCL'+username] !== 'undefined' && parseInt(availableAvatars['LCL'+username]) === 1) {
|
907 |
+
return sb_instagram_js_options.resized_url + username + '.jpg';
|
908 |
+
} else if (typeof availableAvatars[username] !== 'undefined') {
|
909 |
+
return availableAvatars[username];
|
910 |
+
} else {
|
911 |
+
return '';
|
912 |
+
}
|
913 |
+
} else {
|
914 |
+
if (typeof availableAvatars[username] !== 'undefined') {
|
915 |
+
return availableAvatars[username];
|
916 |
+
} else if (typeof availableAvatars['LCL'+username] !== 'undefined' && parseInt(availableAvatars['LCL'+username]) === 1) {
|
917 |
+
return sb_instagram_js_options.resized_url + username + '.jpg';
|
918 |
+
} else {
|
919 |
+
return '';
|
920 |
+
}
|
921 |
+
}
|
922 |
+
},
|
923 |
+
addToNeedsResizing: function (id) {
|
924 |
+
if (this.needsResizing.indexOf(id) === -1) {
|
925 |
+
this.needsResizing.push(id);
|
926 |
+
}
|
927 |
+
},
|
928 |
+
applyImageLiquid: function () {
|
929 |
+
var $self = $(this.el);
|
930 |
+
sbiAddImgLiquid();
|
931 |
+
if (typeof $self.find(".sbi_photo").sbi_imgLiquid == 'function') {
|
932 |
+
$self.find(".sbi_photo").sbi_imgLiquid({fill: true});
|
933 |
+
}
|
934 |
+
},
|
935 |
+
listenForVisibilityChange: function() {
|
936 |
+
var feed = this;
|
937 |
+
sbiAddVisibilityListener();
|
938 |
+
if (typeof $(this.el).filter(':hidden').sbiVisibilityChanged == 'function') {
|
939 |
+
//If the feed is initially hidden (in a tab for example) then check for when it becomes visible and set then set the height
|
940 |
+
$(this.el).filter(':hidden').sbiVisibilityChanged({
|
941 |
+
callback: function (element, visible) {
|
942 |
+
feed.afterResize();
|
943 |
},
|
944 |
+
runOnLoad: false
|
945 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
946 |
}
|
947 |
+
},
|
948 |
+
getColumnCount: function() {
|
949 |
+
var $self = $(this.el),
|
950 |
+
cols = this.settings.cols,
|
951 |
+
colsmobile = this.settings.colsmobile,
|
952 |
+
returnCols = cols,
|
953 |
+
sbiWindowWidth = window.innerWidth;
|
954 |
+
|
955 |
+
if ($self.hasClass('sbi_mob_col_auto')) {
|
956 |
+
if (sbiWindowWidth < 640 && (parseInt(cols) > 2 && parseInt(cols) < 7)) returnCols = 2;
|
957 |
+
if (sbiWindowWidth < 640 && (parseInt(cols) > 6 && parseInt(cols) < 11)) returnCols = 4;
|
958 |
+
if (sbiWindowWidth <= 480 && parseInt(cols) > 2) returnCols = 1;
|
959 |
+
} else if (sbiWindowWidth <= 480) {
|
960 |
+
returnCols = colsmobile;
|
961 |
}
|
962 |
|
963 |
+
return parseInt(returnCols);
|
964 |
+
},
|
965 |
+
checkConsent: function() {
|
966 |
+
if (this.settings.consentGiven || !this.settings.gdpr) {
|
967 |
+
return true;
|
968 |
+
}
|
969 |
+
if (typeof CLI_Cookie !== "undefined") { // GDPR Cookie Consent by WebToffee
|
970 |
+
if (CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) !== null) {
|
971 |
|
972 |
+
// WebToffee no longer uses this cookie but being left here to maintain backwards compatibility
|
973 |
+
if (CLI_Cookie.read('cookielawinfo-checkbox-non-necessary') !== null) {
|
974 |
+
this.settings.consentGiven = CLI_Cookie.read('cookielawinfo-checkbox-non-necessary') === 'yes';
|
|
|
|
|
|
|
975 |
}
|
976 |
|
977 |
+
if (CLI_Cookie.read('cookielawinfo-checkbox-necessary') !== null) {
|
978 |
+
this.settings.consentGiven = CLI_Cookie.read('cookielawinfo-checkbox-necessary') === 'yes';
|
979 |
+
}
|
980 |
+
}
|
981 |
+
|
982 |
+
} else if (typeof window.cnArgs !== "undefined") { // Cookie Notice by dFactory
|
983 |
+
var value = "; " + document.cookie,
|
984 |
+
parts = value.split( '; cookie_notice_accepted=' );
|
985 |
+
|
986 |
+
if ( parts.length === 2 ) {
|
987 |
+
var val = parts.pop().split( ';' ).shift();
|
988 |
+
|
989 |
+
this.settings.consentGiven = (val === 'true');
|
990 |
+
}
|
991 |
+
} else if (typeof window.cookieconsent !== 'undefined') { // Complianz by Really Simple Plugins
|
992 |
+
this.settings.consentGiven = sbiCmplzGetCookie('complianz_consent_status') === 'allow';
|
993 |
+
} else if (typeof window.Cookiebot !== "undefined") { // Cookiebot by Cybot A/S
|
994 |
+
this.settings.consentGiven = Cookiebot.consented;
|
995 |
+
} else if (typeof window.BorlabsCookie !== 'undefined') { // Borlabs Cookie by Borlabs
|
996 |
+
this.settings.consentGiven = window.BorlabsCookie.checkCookieConsent('instagram');
|
997 |
}
|
998 |
|
999 |
+
var evt = jQuery.Event('sbicheckconsent');
|
1000 |
+
evt.feed = this;
|
1001 |
+
jQuery(window).trigger(evt);
|
1002 |
|
1003 |
+
return this.settings.consentGiven; // GDPR not enabled
|
1004 |
+
},
|
1005 |
+
afterConsentToggled: function() {
|
1006 |
+
if (this.checkConsent()) {
|
1007 |
+
var feed = this;
|
1008 |
+
feed.maybeRaiseImageResolution();
|
1009 |
+
|
1010 |
+
setTimeout(function() {
|
1011 |
+
feed.afterResize();
|
1012 |
+
},500);
|
1013 |
}
|
1014 |
+
},
|
1015 |
+
locationGuess: function() {
|
1016 |
+
var $feed = $(this.el),
|
1017 |
+
location = 'content';
|
1018 |
+
|
1019 |
+
if ($feed.closest('footer').length) {
|
1020 |
+
location = 'footer';
|
1021 |
+
} else if ($feed.closest('.header').length
|
1022 |
+
|| $feed.closest('header').length) {
|
1023 |
+
location = 'header';
|
1024 |
+
} else if ($feed.closest('.sidebar').length
|
1025 |
+
|| $feed.closest('aside').length) {
|
1026 |
+
location = 'sidebar';
|
1027 |
}
|
|
|
1028 |
|
1029 |
+
return location;
|
1030 |
+
},
|
1031 |
+
};
|
1032 |
+
|
1033 |
+
window.sbi_init = function() {
|
1034 |
+
window.sbi = new Sbi();
|
1035 |
+
window.sbi.createPage( window.sbi.createFeeds, {whenFeedsCreated: window.sbi.afterFeedsCreated});
|
1036 |
+
};
|
1037 |
+
|
1038 |
+
function sbiGetNewFeed(feed,index,feedOptions) {
|
1039 |
+
return new SbiFeed(feed,index,feedOptions);
|
1040 |
+
}
|
1041 |
+
|
1042 |
+
function sbiAjax(submitData,onSuccess) {
|
1043 |
+
$.ajax({
|
1044 |
+
url: sbiajaxurl,
|
1045 |
+
type: 'post',
|
1046 |
+
data: submitData,
|
1047 |
+
success: onSuccess
|
1048 |
+
});
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
function sbiCmplzGetCookie(cname) {
|
1052 |
+
var name = cname + "="; //Create the cookie name variable with cookie name concatenate with = sign
|
1053 |
+
var cArr = window.document.cookie.split(';'); //Create cookie array by split the cookie by ';'
|
1054 |
+
|
1055 |
+
//Loop through the cookies and return the cookie value if it find the cookie name
|
1056 |
+
for (var i = 0; i < cArr.length; i++) {
|
1057 |
+
var c = cArr[i].trim();
|
1058 |
+
//If the name is the cookie string at position 0, we found the cookie and return the cookie value
|
1059 |
+
if (c.indexOf(name) == 0)
|
1060 |
+
return c.substring(name.length, c.length);
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
return "";
|
1064 |
+
}
|
1065 |
+
|
1066 |
+
})(jQuery);
|
1067 |
+
|
1068 |
+
jQuery(document).ready(function($) {
|
1069 |
+
if (typeof window.sb_instagram_js_options === 'undefined') {
|
1070 |
+
window.sb_instagram_js_options = {
|
1071 |
+
font_method: "svg",
|
1072 |
+
resized_url: location.protocol + '//' + window.location.hostname + "/wp-content/uploads/sb-instagram-feed-images/",
|
1073 |
+
placeholder: location.protocol + '//' + window.location.hostname + "/wp-content/plugins/instagram-feed/img/placeholder.png"
|
1074 |
+
};
|
1075 |
+
}
|
1076 |
+
if (typeof window.sb_instagram_js_options.resized_url !== 'undefined' && window.sb_instagram_js_options.resized_url.indexOf(location.protocol) === -1) {
|
1077 |
+
if (location.protocol === 'http:') {
|
1078 |
+
window.sb_instagram_js_options.resized_url = window.sb_instagram_js_options.resized_url.replace('https:','http:');
|
1079 |
+
} else {
|
1080 |
+
window.sb_instagram_js_options.resized_url = window.sb_instagram_js_options.resized_url.replace('http:','https:');
|
1081 |
+
}
|
1082 |
+
}
|
1083 |
+
sbi_init();
|
1084 |
+
|
1085 |
+
// Cookie Notice by dFactory
|
1086 |
+
$('#cookie-notice a').on('click',function() {
|
1087 |
+
setTimeout(function() {
|
1088 |
+
$.each(window.sbi.feeds,function(index){
|
1089 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
1090 |
});
|
1091 |
+
},1000);
|
1092 |
+
});
|
1093 |
|
1094 |
+
// GDPR Cookie Consent by WebToffee
|
1095 |
+
$('#cookie-law-info-bar a').on('click',function() {
|
1096 |
+
setTimeout(function() {
|
1097 |
+
$.each(window.sbi.feeds,function(index){
|
1098 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
|
|
|
|
1099 |
});
|
1100 |
+
},1000);
|
1101 |
+
});
|
1102 |
|
1103 |
+
// GDPR Cookie Consent by WebToffee
|
1104 |
+
$('.cli-user-preference-checkbox').on('click',function(){
|
1105 |
+
setTimeout(function() {
|
1106 |
+
$.each(window.sbi.feeds,function(index){
|
1107 |
+
window.sbi.feeds[ index ].settings.consentGiven = false;
|
1108 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
|
|
|
|
1109 |
});
|
1110 |
+
},1000);
|
1111 |
+
});
|
1112 |
|
1113 |
+
// Cookiebot
|
1114 |
+
$(window).on('CookiebotOnAccept', function (event) {
|
1115 |
+
$.each(window.sbi.feeds,function(index){
|
1116 |
+
window.sbi.feeds[ index ].settings.consentGiven = true;
|
1117 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
1118 |
+
});
|
1119 |
+
});
|
1120 |
|
1121 |
+
// Complianz by Really Simple Plugins
|
1122 |
+
$(document).on('cmplzAcceptAll', function (event) {
|
1123 |
+
$.each(window.sbi.feeds,function(index){
|
1124 |
+
window.sbi.feeds[ index ].settings.consentGiven = true;
|
1125 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
1126 |
+
});
|
1127 |
+
});
|
1128 |
|
1129 |
+
// Complianz by Really Simple Plugins
|
1130 |
+
$(document).on('cmplzRevoke', function (event) {
|
1131 |
+
$.each(window.sbi.feeds,function(index){
|
1132 |
+
window.sbi.feeds[ index ].settings.consentGiven = false;
|
1133 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
1134 |
+
});
|
1135 |
+
});
|
1136 |
|
1137 |
+
// Borlabs Cookie by Borlabs
|
1138 |
+
$(document).on('borlabs-cookie-consent-saved', function (event) {
|
1139 |
+
$.each(window.sbi.feeds,function(index){
|
1140 |
+
window.sbi.feeds[ index ].settings.consentGiven = false;
|
1141 |
+
window.sbi.feeds[ index ].afterConsentToggled();
|
1142 |
+
});
|
|
|
1143 |
});
|
1144 |
+
});
|
1145 |
|
1146 |
+
} // if sbi_js_exists
|
js/sbi-scripts.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var sbi_js_exists=void 0!==sbi_js_exists;sbi_js_exists||(!function(i){function e(){var i,e,t,s=s||{VER:"0.9.944"};s.bgs_Available=!1,s.bgs_CheckRunned=!1,function(i){i.fn.extend({sbi_imgLiquid:function(e){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},function(){if(!s.bgs_CheckRunned){s.bgs_CheckRunned=!0;var e=i('<span style="background-size:cover" />');i("body").append(e),function(){var i=e[0];if(i&&window.getComputedStyle){var t=window.getComputedStyle(i,null);t&&t.backgroundSize&&(s.bgs_Available="cover"===t.backgroundSize)}}(),e.remove()}}();var t=this;return this.options=e,this.settings=i.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(e){function n(){(r.responsive||c.data("sbi_imgLiquid_oldProcessed"))&&c.data("sbi_imgLiquid_settings")&&(r=c.data("sbi_imgLiquid_settings"),l.actualSize=l.get(0).offsetWidth+l.get(0).offsetHeight/1e4,l.sizeOld&&l.actualSize!==l.sizeOld&&a(),l.sizeOld=l.actualSize,setTimeout(n,r.responsiveCheckTime))}function o(){c.data("sbi_imgLiquid_error",!0),l.addClass("sbi_imgLiquid_error"),r.onItemError&&r.onItemError(e,l,c),d()}function a(){var i,t,s,n,o,a,h,g,f=0,u=0,b=l.width(),_=l.height();void 0===c.data("owidth")&&c.data("owidth",c[0].width),void 0===c.data("oheight")&&c.data("oheight",c[0].height),r.fill===b/_>=c.data("owidth")/c.data("oheight")?(i="100%",t="auto",s=Math.floor(b),n=Math.floor(b*(c.data("oheight")/c.data("owidth")))):(i="auto",t="100%",s=Math.floor(_*(c.data("owidth")/c.data("oheight"))),n=Math.floor(_)),h=b-s,"left"===(o=r.horizontalAlign.toLowerCase())&&(u=0),"center"===o&&(u=.5*h),"right"===o&&(u=h),-1!==o.indexOf("%")&&((o=parseInt(o.replace("%",""),10))>0&&(u=h*o*.01)),g=_-n,"left"===(a=r.verticalAlign.toLowerCase())&&(f=0),"center"===a&&(f=.5*g),"bottom"===a&&(f=g),-1!==a.indexOf("%")&&((a=parseInt(a.replace("%",""),10))>0&&(f=g*a*.01)),r.hardPixels&&(i=s,t=n),c.css({width:i,height:t,"margin-left":Math.floor(u),"margin-top":Math.floor(f)}),c.data("sbi_imgLiquid_oldProcessed")||(c.fadeTo(r.fadeInTime,1),c.data("sbi_imgLiquid_oldProcessed",!0),r.removeBoxBackground&&l.css("background-image","none"),l.addClass("sbi_imgLiquid_nobgSize"),l.addClass("sbi_imgLiquid_ready")),r.onItemFinish&&r.onItemFinish(e,l,c),d()}function d(){e===t.length-1&&t.settings.onFinish&&t.settings.onFinish()}var r=t.settings,l=i(this),c=i("img:first",l);return c.length?(c.data("sbi_imgLiquid_settings")?(l.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"),r=i.extend({},c.data("sbi_imgLiquid_settings"),t.options)):r=i.extend({},t.settings,function(){var i={};if(t.settings.useDataHtmlAttr){var e=l.attr("data-sbi_imgLiquid-fill"),n=l.attr("data-sbi_imgLiquid-horizontalAlign"),o=l.attr("data-sbi_imgLiquid-verticalAlign");("true"===e||"false"===e)&&(i.fill=Boolean("true"===e)),void 0===n||"left"!==n&&"center"!==n&&"right"!==n&&-1===n.indexOf("%")||(i.horizontalAlign=n),void 0===o||"top"!==o&&"bottom"!==o&&"center"!==o&&-1===o.indexOf("%")||(i.verticalAlign=o)}return s.isIE&&t.settings.ieFadeInDisabled&&(i.fadeInTime=0),i}()),c.data("sbi_imgLiquid_settings",r),r.onItemStart&&r.onItemStart(e,l,c),void(s.bgs_Available&&r.useBackgroundSize?(-1===l.css("background-image").indexOf(encodeURI(c.attr("src")))&&l.css({"background-image":'url("'+encodeURI(c.attr("src"))+'")'}),l.css({"background-size":r.fill?"cover":"contain","background-position":(r.horizontalAlign+" "+r.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),i("a:first",l).css({display:"block",width:"100%",height:"100%"}),i("img",l).css({display:"none"}),r.onItemFinish&&r.onItemFinish(e,l,c),l.addClass("sbi_imgLiquid_bgSize"),l.addClass("sbi_imgLiquid_ready"),d()):function t(){if(c.data("oldSrc")&&c.data("oldSrc")!==c.attr("src")){var s=c.clone().removeAttr("style");return s.data("sbi_imgLiquid_settings",c.data("sbi_imgLiquid_settings")),c.parent().prepend(s),c.remove(),(c=s)[0].width=0,void setTimeout(t,10)}return c.data("sbi_imgLiquid_oldProcessed")?void a():(c.data("sbi_imgLiquid_oldProcessed",!1),c.data("oldSrc",c.attr("src")),i("img:not(:first)",l).css("display","none"),l.css({overflow:"hidden"}),c.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),c.on("error",o),c[0].onerror=o,function i(){c.data("sbi_imgLiquid_error")||c.data("sbi_imgLiquid_loaded")||c.data("sbi_imgLiquid_oldProcessed")||(l.is(":visible")&&c[0].complete&&c[0].width>0&&c[0].height>0?(c.data("sbi_imgLiquid_loaded",!0),setTimeout(a,e*r.delay)):setTimeout(i,r.timecheckvisibility))}(),void n())}())):void o()})}})}(jQuery),i=s.injectCss,e=document.getElementsByTagName("head")[0],(t=document.createElement("style")).type="text/css",t.styleSheet?t.styleSheet.cssText=i:t.appendChild(document.createTextNode(i)),e.appendChild(t)}function t(){this.feeds={},this.options=sb_instagram_js_options}function s(i,e,t){this.el=i,this.index=e,this.settings=t,this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.page=1,this.isInitialized=!1}function n(e,t){i.ajax({url:sbiajaxurl,type:"post",data:e,success:t})}t.prototype={createPage:function(e,t){void 0!==window.sbiajaxurl&&-1!==window.sbiajaxurl.indexOf(window.location.hostname)||(window.sbiajaxurl=location.protocol+"//"+window.location.hostname+"/wp-admin/admin-ajax.php"),i(".sbi_no_js_error_message").remove(),i(".sbi_no_js").removeClass("sbi_no_js"),e(t)},createFeeds:function(e){e.whenFeedsCreated(i(".sbi").each(function(e){i(this).attr("data-sbi-index",e+1);var t=i(this),o=void 0!==t.attr("data-sbi-flags")?t.attr("data-sbi-flags").split(","):[],a=void 0!==t.attr("data-options")?JSON.parse(t.attr("data-options")):{};if(o.indexOf("testAjax")>-1){window.sbi.triggeredTest=!0;n({action:"sbi_on_ajax_test_trigger"},function(i){console.log("did test")})}var d={cols:t.attr("data-cols"),colsmobile:void 0!==t.attr("data-colsmobile")&&"same"!==t.attr("data-colsmobile")?t.attr("data-colsmobile"):t.attr("data-cols"),num:t.attr("data-num"),imgRes:t.attr("data-res"),feedID:t.attr("data-feedid"),postID:"undefind"!=typeof t.attr("data-postid")?t.attr("data-postid"):"unknown",shortCodeAtts:t.attr("data-shortcode-atts"),resizingEnabled:-1===o.indexOf("resizeDisable"),imageLoadEnabled:-1===o.indexOf("imageLoadDisable"),debugEnabled:o.indexOf("debug")>-1,favorLocal:o.indexOf("favorLocal")>-1,ajaxPostLoad:o.indexOf("ajaxPostLoad")>-1,gdpr:o.indexOf("gdpr")>-1,overrideBlockCDN:o.indexOf("overrideBlockCDN")>-1,consentGiven:!1,locator:o.indexOf("locator")>-1,autoMinRes:1,general:a};window.sbi.feeds[e]=function(i,e,t){return new s(i,e,t)}(this,e,d),window.sbi.feeds[e].setResizedImages(),window.sbi.feeds[e].init();var r=jQuery.Event("sbiafterfeedcreate");r.feed=window.sbi.feeds[e],jQuery(window).trigger(r)}))},afterFeedsCreated:function(){i(".sb_instagram_header").each(function(){var e=i(this);e.find(".sbi_header_link").on("mouseenter mouseleave",function(i){switch(i.type){case"mouseenter":e.find(".sbi_header_img_hover").addClass("sbi_fade_in");break;case"mouseleave":e.find(".sbi_header_img_hover").removeClass("sbi_fade_in")}})})},encodeHTML:function(i){return void 0===i?"":i.replace(/(>)/g,">").replace(/(<)/g,"<").replace(/(<br\/>)/g,"<br>").replace(/(<br>)/g,"<br>")},urlDetect:function(i){return i.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g)}},s.prototype={init:function(){var e=this;e.settings.consentGiven=e.checkConsent(),i(this.el).find(".sbi_photo").parent("p").length&&i(this.el).addClass("sbi_no_autop"),i(this.el).find("#sbi_mod_error").length&&i(this.el).prepend(i(this.el).find("#sbi_mod_error")),this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var t,s=(t=0,function(i,e){clearTimeout(t),t=setTimeout(i,e)});jQuery(window).on("resize",function(){s(function(){e.afterResize()},500)}),i(this.el).find(".sbi_item").each(function(){e.lazyLoadCheck(i(this))})},initLayout:function(){},afterInitialImagesLoaded:function(){this.initLayout(),this.loadMoreButtonInit(),this.hideExtraImagesForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass()},afterLoadMoreClicked:function(i){i.find(".sbi_loader").removeClass("sbi_hidden"),i.find(".sbi_btn_text").addClass("sbi_hidden"),i.closest(".sbi").find(".sbi_num_diff_hide").addClass("sbi_transition").removeClass("sbi_num_diff_hide")},afterNewImagesLoaded:function(){var e=i(this.el),t=this;this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),setTimeout(function(){e.find(".sbi_loader").addClass("sbi_hidden"),e.find(".sbi_btn_text").removeClass("sbi_hidden"),t.maybeRaiseImageResolution()},500)},beforeNewImagesRevealed:function(){this.setImageHeight(),this.maybeRaiseImageResolution(!0),this.setImageSizeClass()},revealNewImages:function(){var e=i(this.el);e.find(".sbi-screenreader").each(function(){i(this).find("img").remove()}),"function"==typeof sbi_custom_js&&setTimeout(function(){sbi_custom_js()},100),this.applyImageLiquid(),e.find(".sbi_item").each(function(i){jQuery(this).find(".sbi_photo").on("mouseenter mouseleave",function(i){switch(i.type){case"mouseenter":jQuery(this).fadeTo(200,.85);break;case"mouseleave":jQuery(this).stop().fadeTo(500,1)}})}),setTimeout(function(){jQuery("#sbi_images .sbi_item.sbi_new").removeClass("sbi_new");var i=10;e.find(".sbi_transition").each(function(){var e=jQuery(this);setTimeout(function(){e.removeClass("sbi_transition")},i),i+=10})},500)},lazyLoadCheck:function(e){if(e.find(".sbi_photo").length&&!e.closest(".sbi").hasClass("sbi-no-ll-check")){var t=this.getImageUrls(e),s=void 0!==t[640]?t[640]:e.find(".sbi_photo").attr("data-full-res");if(!this.settings.consentGiven&&s.indexOf("scontent")>-1)return;e.find(".sbi_photo img").each(function(){s&&void 0!==i(this).attr("data-src")&&i(this).attr("data-src",s),s&&void 0!==i(this).attr("data-orig-src")&&i(this).attr("data-orig-src",s),i(this).on("load",function(){!i(this).hasClass("sbi-replaced")&&i(this).attr("src").indexOf("placeholder")>-1&&(i(this).addClass("sbi-replaced"),s&&(i(this).attr("src",s),i(this).closest(".sbi_imgLiquid_bgSize").length&&i(this).closest(".sbi_imgLiquid_bgSize").css("background-image","url("+s+")")))})})}},afterNewImagesRevealed:function(){this.listenForVisibilityChange(),this.sendNeedsResizingToServer(),this.settings.imageLoadEnabled||i(".sbi_no_resraise").removeClass("sbi_no_resraise");var e=i.Event("sbiafterimagesloaded");e.el=i(this.el),i(window).trigger(e)},setResizedImages:function(){i(this.el).find(".sbi_resized_image_data").length&&void 0!==i(this.el).find(".sbi_resized_image_data").attr("data-resized")&&0===i(this.el).find(".sbi_resized_image_data").attr("data-resized").indexOf('{"')&&(this.resizedImages=JSON.parse(i(this.el).find(".sbi_resized_image_data").attr("data-resized")),i(this.el).find(".sbi_resized_image_data").remove())},sendNeedsResizingToServer:function(){var e=this,t=i(this.el);if(e.needsResizing.length>0&&e.settings.resizingEnabled){var s=i(this.el).find(".sbi_item").length,o=void 0!==e.settings.general.cache_all&&e.settings.general.cache_all,a="";void 0!==t.attr("data-locatornonce")&&(a=t.attr("data-locatornonce")),n({action:"sbi_resized_images_submit",needs_resizing:e.needsResizing,offset:s,feed_id:e.settings.feedID,atts:e.settings.shortCodeAtts,location:e.locationGuess(),post_id:e.settings.postID,cache_all:o,locator_nonce:a},function(i){if(0===i.trim().indexOf("{")){var t=JSON.parse(i);for(var s in e.settings.debugEnabled&&console.log(t),t)t.hasOwnProperty(s)&&(e.resizedImages[s]=t[s]);e.maybeRaiseImageResolution(),setTimeout(function(){e.afterResize()},500)}})}else if(e.settings.locator){a="";void 0!==t.attr("data-locatornonce")&&(a=t.attr("data-locatornonce")),n({action:"sbi_do_locator",feed_id:e.settings.feedID,atts:e.settings.shortCodeAtts,location:e.locationGuess(),post_id:e.settings.postID,locator_nonce:a},function(i){})}},loadMoreButtonInit:function(){var e=i(this.el),t=this;e.find("#sbi_load .sbi_load_btn").off().on("click",function(){t.afterLoadMoreClicked(jQuery(this)),t.getNewPostSet()})},getNewPostSet:function(){var e=i(this.el),t=this;t.page++;var s="";void 0!==e.attr("data-locatornonce")&&(s=e.attr("data-locatornonce"));n({action:"sbi_load_more_clicked",offset:e.find(".sbi_item").length,page:t.page,feed_id:t.settings.feedID,atts:t.settings.shortCodeAtts,location:t.locationGuess(),post_id:t.settings.postID,current_resolution:t.imageResolution,locator_nonce:s},function(s){if(0===s.trim().indexOf("{")){var n=JSON.parse(s);t.settings.debugEnabled&&console.log(n),t.appendNewPosts(n.html),t.addResizedImages(n.resizedImages),t.settings.ajaxPostLoad?(t.settings.ajaxPostLoad=!1,t.afterInitialImagesLoaded()):t.afterNewImagesLoaded(),n.feedStatus.shouldPaginate?t.outOfPages=!1:(t.outOfPages=!0,e.find(".sbi_load_btn").hide()),i(".sbi_no_js").removeClass("sbi_no_js")}})},appendNewPosts:function(e){var t=i(this.el);t.find("#sbi_images .sbi_item").length?t.find("#sbi_images .sbi_item").last().after(e):t.find("#sbi_images").append(e)},addResizedImages:function(i){for(var e in i)this.resizedImages[e]=i[e]},setImageHeight:function(){var e=i(this.el),t=e.find(".sbi_photo").eq(0).innerWidth(),s=this.getColumnCount(),n=e.find("#sbi_images").innerWidth()-e.find("#sbi_images").width(),o=n/2;sbi_photo_width_manual=e.find("#sbi_images").width()/s-n,e.find(".sbi_photo").css("height",t),e.find(".sbi-owl-nav").length&&setTimeout(function(){var i=2;e.find(".sbi_owl2row-item").length&&(i=1);var t=e.find(".sbi_photo").eq(0).innerWidth()/i;t+=parseInt(o)*(2-i+2),e.find(".sbi-owl-nav div").css("top",t)},100)},maybeRaiseSingleImageResolution:function(e,t,s){var n=this,o=n.getImageUrls(e),a=e.find(".sbi_photo img").attr("src"),d=150,r=e.find("img").get(0),l=a===window.sbi.options.placeholder?1:r.naturalWidth/r.naturalHeight;s=void 0!==s&&s;if(!(e.hasClass("sbi_no_resraise")||e.hasClass("sbi_had_error")||e.find(".sbi_link_area").length&&e.find(".sbi_link_area").hasClass("sbi_had_error")))if(o.length<1)e.find(".sbi_link_area").length&&e.find(".sbi_link_area").attr("href",window.sbi.options.placeholder.replace("placeholder.png","thumb-placeholder.png"));else{(e.find(".sbi_link_area").length&&e.find(".sbi_link_area").attr("href")===window.sbi.options.placeholder.replace("placeholder.png","thumb-placeholder.png")||!n.settings.consentGiven)&&e.find(".sbi_link_area").attr("href",o[o.length-1]),void 0!==o[640]&&e.find(".sbi_photo").attr("data-full-res",o[640]),i.each(o,function(i,e){e===a&&(d=parseInt(i),s=!1)});var c=640;switch(n.settings.imgRes){case"thumb":c=150;break;case"medium":c=320;break;case"full":c=640;break;default:var h=Math.max(n.settings.autoMinRes,e.find(".sbi_photo").innerWidth()),g=n.getBestResolutionForAuto(h,l,e);switch(g){case 320:c=320;break;case 150:c=150}}if(c>d||a===window.sbi.options.placeholder||s){if(n.settings.debugEnabled){var f=a===window.sbi.options.placeholder?"was placeholder":"too small";console.log("rais res for "+a,f)}var u=o[c].split("?ig_cache_key")[0];if(a!==u&&(e.find(".sbi_photo img").attr("src",u),e.find(".sbi_photo").css("background-image",'url("'+u+'")')),d=c,"auto"===n.settings.imgRes){var b=!1;e.find(".sbi_photo img").on("load",function(){var t=i(this),s=t.get(0).naturalWidth/t.get(0).naturalHeight;if(1e3!==t.get(0).naturalWidth&&s>l&&!b){switch(n.settings.debugEnabled&&console.log("rais res again for aspect ratio change "+a),b=!0,h=e.find(".sbi_photo").innerWidth(),g=n.getBestResolutionForAuto(h,s,e),c=640,g){case 320:c=320;break;case 150:c=150}c>d&&(u=o[c].split("?ig_cache_key")[0],t.attr("src",u),t.closest(".sbi_photo").css("background-image",'url("'+u+'")')),"masonry"!==n.layout&&"highlight"!==n.layout||(i(n.el).find("#sbi_images").smashotope(n.isotopeArgs),setTimeout(function(){i(n.el).find("#sbi_images").smashotope(n.isotopeArgs)},500))}else if(n.settings.debugEnabled){var r=b?"already checked":"no aspect ratio change";console.log("not raising res for replacement "+a,r)}})}}e.find("img").on("error",function(){if(i(this).hasClass("sbi_img_error"))console.log("unfixed error "+i(this).attr("src"));else{var e;if(i(this).addClass("sbi_img_error"),!(i(this).attr("src").indexOf("media/?size=")>-1||i(this).attr("src").indexOf("cdninstagram")>-1||i(this).attr("src").indexOf("fbcdn")>-1)&&n.settings.consentGiven){if("undefined"!==i(this).closest(".sbi_photo").attr("data-img-src-set"))void 0!==(e=JSON.parse(i(this).closest(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/"))).d&&(i(this).attr("src",e.d),i(this).closest(".sbi_photo").css("background-image","url("+e.d+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"))}else n.settings.favorLocal=!0,void 0!==(e=n.getImageUrls(i(this).closest(".sbi_item")))[640]&&(i(this).attr("src",e[640]),i(this).closest(".sbi_photo").css("background-image","url("+e[640]+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"));setTimeout(function(){n.afterResize()},1500)}})}},maybeRaiseImageResolution:function(e){var t=this,s=void 0!==e&&!0===e?".sbi_item.sbi_new":".sbi_item",n=!t.isInitialized;i(t.el).find(s).each(function(e){!i(this).hasClass("sbi_num_diff_hide")&&i(this).find(".sbi_photo").length&&void 0!==i(this).find(".sbi_photo").attr("data-img-src-set")&&t.maybeRaiseSingleImageResolution(i(this),e,n)}),t.isInitialized=!0},getBestResolutionForAuto:function(e,t,s){(isNaN(t)||t<1)&&(t=1);var n=e*t,o=10*Math.ceil(n/10),a=[150,320,640];if(s.hasClass("sbi_highlighted")&&(o*=2),-1===a.indexOf(parseInt(o))){var d=!1;i.each(a,function(i,e){e>parseInt(o)&&!d&&(o=e,d=!0)})}return o},hideExtraImagesForWidth:function(){if("carousel"!==this.layout){var e=i(this.el),t=void 0!==e.attr("data-num")&&""!==e.attr("data-num")?parseInt(e.attr("data-num")):1,s=void 0!==e.attr("data-nummobile")&&""!==e.attr("data-nummobile")?parseInt(e.attr("data-nummobile")):t;i(window).width()<480?s<e.find(".sbi_item").length&&e.find(".sbi_item").slice(s-e.find(".sbi_item").length).addClass("sbi_num_diff_hide"):t<e.find(".sbi_item").length&&e.find(".sbi_item").slice(t-e.find(".sbi_item").length).addClass("sbi_num_diff_hide")}},setImageSizeClass:function(){var e=i(this.el);e.removeClass("sbi_small sbi_medium");var t=e.innerWidth(),s=parseInt(e.find("#sbi_images").outerWidth()-e.find("#sbi_images").width())/2,n=this.getColumnCount(),o=(t-s*(n+2))/n;o>120&&o<240?e.addClass("sbi_medium"):o<=120&&e.addClass("sbi_small")},setMinImageWidth:function(){i(this.el).find(".sbi_item .sbi_photo").first().length?this.minImageWidth=i(this.el).find(".sbi_item .sbi_photo").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(i){var e=JSON.parse(i.find(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/")),t=i.attr("id").replace("sbi_","");if(this.settings.consentGiven||this.settings.overrideBlockCDN||(e=[]),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&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"full.jpg",s.push(640)),void 0!==this.resizedImages[t].sizes.low&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"low.jpg",s.push(320)),void 0!==this.resizedImages[t].sizes.thumb&&(s.push(150),e[150]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"thumb.jpg"),this.settings.favorLocal&&(-1===s.indexOf(640)&&s.indexOf(320)>-1&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"low.jpg"),-1===s.indexOf(320)&&(s.indexOf(640)>-1?e[320]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"full.jpg":s.indexOf(150)>-1&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"thumb.jpg")),-1===s.indexOf(150)&&(s.indexOf(320)>-1?e[150]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"low.jpg":s.indexOf(640)>-1&&(e[150]=sb_instagram_js_options.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 e},getAvatarUrl:function(i,e){if(""===i)return"";var t=this.settings.general.avatars;return"local"===(e=void 0!==e?e:"local")?void 0!==t["LCL"+i]&&1===parseInt(t["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":void 0!==t[i]?t[i]:"":void 0!==t[i]?t[i]:void 0!==t["LCL"+i]&&1===parseInt(t["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":""},addToNeedsResizing:function(i){-1===this.needsResizing.indexOf(i)&&this.needsResizing.push(i)},applyImageLiquid:function(){var t=i(this.el);e(),"function"==typeof t.find(".sbi_photo").sbi_imgLiquid&&t.find(".sbi_photo").sbi_imgLiquid({fill:!0})},listenForVisibilityChange:function(){var e,t,s,n=this;e=jQuery,t={callback:function(){},runOnLoad:!0,frequency:100,sbiPreviousVisibility:null},s={sbiCheckVisibility:function(i,e){if(jQuery.contains(document,i[0])){var t=e.sbiPreviousVisibility,n=i.is(":visible");e.sbiPreviousVisibility=n,null==t?e.runOnLoad&&e.callback(i,n):t!==n&&e.callback(i,n),setTimeout(function(){s.sbiCheckVisibility(i,e)},e.frequency)}}},e.fn.sbiVisibilityChanged=function(i){var n=e.extend({},t,i);return this.each(function(){s.sbiCheckVisibility(e(this),n)})},"function"==typeof i(this.el).filter(":hidden").sbiVisibilityChanged&&i(this.el).filter(":hidden").sbiVisibilityChanged({callback:function(i,e){n.afterResize()},runOnLoad:!1})},getColumnCount:function(){var e=i(this.el),t=this.settings.cols,s=this.settings.colsmobile,n=t;return sbiWindowWidth=window.innerWidth,e.hasClass("sbi_mob_col_auto")?(sbiWindowWidth<640&&parseInt(t)>2&&parseInt(t)<7&&(n=2),sbiWindowWidth<640&&parseInt(t)>6&&parseInt(t)<11&&(n=4),sbiWindowWidth<=480&&parseInt(t)>2&&(n=1)):sbiWindowWidth<=480&&(n=s),parseInt(n)},checkConsent:function(){if(this.settings.consentGiven||!this.settings.gdpr)return!0;if("undefined"!=typeof CLI_Cookie)null!==CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)&&(null!==CLI_Cookie.read("cookielawinfo-checkbox-non-necessary")&&(this.settings.consentGiven="yes"===CLI_Cookie.read("cookielawinfo-checkbox-non-necessary")),null!==CLI_Cookie.read("cookielawinfo-checkbox-necessary")&&(this.settings.consentGiven="yes"===CLI_Cookie.read("cookielawinfo-checkbox-necessary")));else if(void 0!==window.cnArgs){var i=("; "+document.cookie).split("; cookie_notice_accepted=");if(2===i.length){var e=i.pop().split(";").shift();this.settings.consentGiven="true"===e}}else void 0!==window.cookieconsent?this.settings.consentGiven="allow"===function(i){for(var e=i+"=",t=window.document.cookie.split(";"),s=0;s<t.length;s++){var n=t[s].trim();if(0==n.indexOf(e))return n.substring(e.length,n.length)}return""}("complianz_consent_status"):void 0!==window.Cookiebot?this.settings.consentGiven=Cookiebot.consented:void 0!==window.BorlabsCookie&&(this.settings.consentGiven=window.BorlabsCookie.checkCookieConsent("instagram"));var t=jQuery.Event("sbicheckconsent");return t.feed=this,jQuery(window).trigger(t),this.settings.consentGiven},afterConsentToggled:function(){if(this.checkConsent()){var i=this;i.maybeRaiseImageResolution(),setTimeout(function(){i.afterResize()},500)}},locationGuess:function(){var e=i(this.el),t="content";return e.closest("footer").length?t="footer":e.closest(".header").length||e.closest("header").length?t="header":(e.closest(".sidebar").length||e.closest("aside").length)&&(t="sidebar"),t}},window.sbi_init=function(){window.sbi=new t,window.sbi.createPage(window.sbi.createFeeds,{whenFeedsCreated:window.sbi.afterFeedsCreated})}}(jQuery),jQuery(document).ready(function(i){void 0===window.sb_instagram_js_options&&(window.sb_instagram_js_options={font_method:"svg",resized_url:location.protocol+"//"+window.location.hostname+"/wp-content/uploads/sb-instagram-feed-images/",placeholder:location.protocol+"//"+window.location.hostname+"/wp-content/plugins/instagram-feed/img/placeholder.png"}),void 0!==window.sb_instagram_js_options.resized_url&&-1===window.sb_instagram_js_options.resized_url.indexOf(location.protocol)&&("http:"===location.protocol?window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("https:","http:"):window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("http:","https:")),sbi_init(),i("#cookie-notice a").on("click",function(){setTimeout(function(){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].afterConsentToggled()})},1e3)}),i("#cookie-law-info-bar a").on("click",function(){setTimeout(function(){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].afterConsentToggled()})},1e3)}),i(".cli-user-preference-checkbox").on("click",function(){setTimeout(function(){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!1,window.sbi.feeds[i].afterConsentToggled()})},1e3)}),i(window).on("CookiebotOnAccept",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!0,window.sbi.feeds[i].afterConsentToggled()})}),i(document).on("cmplzAcceptAll",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!0,window.sbi.feeds[i].afterConsentToggled()})}),i(document).on("cmplzRevoke",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!1,window.sbi.feeds[i].afterConsentToggled()})}),i(document).on("borlabs-cookie-consent-saved",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!1,window.sbi.feeds[i].afterConsentToggled()})})}));
|
1 |
+
var sbi_js_exists=void 0!==sbi_js_exists;sbi_js_exists||(!function(i){function e(){var i,e,t,s=s||{VER:"0.9.944"};s.bgs_Available=!1,s.bgs_CheckRunned=!1,function(i){i.fn.extend({sbi_imgLiquid:function(e){this.defaults={fill:!0,verticalAlign:"center",horizontalAlign:"center",useBackgroundSize:!0,useDataHtmlAttr:!0,responsive:!0,delay:0,fadeInTime:0,removeBoxBackground:!0,hardPixels:!0,responsiveCheckTime:500,timecheckvisibility:500,onStart:null,onFinish:null,onItemStart:null,onItemFinish:null,onItemError:null},function(){if(!s.bgs_CheckRunned){s.bgs_CheckRunned=!0;var e=i('<span style="background-size:cover" />');i("body").append(e),function(){var i=e[0];if(i&&window.getComputedStyle){var t=window.getComputedStyle(i,null);t&&t.backgroundSize&&(s.bgs_Available="cover"===t.backgroundSize)}}(),e.remove()}}();var t=this;return this.options=e,this.settings=i.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(e){function n(){(r.responsive||c.data("sbi_imgLiquid_oldProcessed"))&&c.data("sbi_imgLiquid_settings")&&(r=c.data("sbi_imgLiquid_settings"),l.actualSize=l.get(0).offsetWidth+l.get(0).offsetHeight/1e4,l.sizeOld&&l.actualSize!==l.sizeOld&&a(),l.sizeOld=l.actualSize,setTimeout(n,r.responsiveCheckTime))}function o(){c.data("sbi_imgLiquid_error",!0),l.addClass("sbi_imgLiquid_error"),r.onItemError&&r.onItemError(e,l,c),d()}function a(){var i,t,s,n,o,a,h,g,f=0,u=0,b=l.width(),_=l.height();void 0===c.data("owidth")&&c.data("owidth",c[0].width),void 0===c.data("oheight")&&c.data("oheight",c[0].height),r.fill===b/_>=c.data("owidth")/c.data("oheight")?(i="100%",t="auto",s=Math.floor(b),n=Math.floor(b*(c.data("oheight")/c.data("owidth")))):(i="auto",t="100%",s=Math.floor(_*(c.data("owidth")/c.data("oheight"))),n=Math.floor(_)),h=b-s,"left"===(o=r.horizontalAlign.toLowerCase())&&(u=0),"center"===o&&(u=.5*h),"right"===o&&(u=h),-1!==o.indexOf("%")&&((o=parseInt(o.replace("%",""),10))>0&&(u=h*o*.01)),g=_-n,"left"===(a=r.verticalAlign.toLowerCase())&&(f=0),"center"===a&&(f=.5*g),"bottom"===a&&(f=g),-1!==a.indexOf("%")&&((a=parseInt(a.replace("%",""),10))>0&&(f=g*a*.01)),r.hardPixels&&(i=s,t=n),c.css({width:i,height:t,"margin-left":Math.floor(u),"margin-top":Math.floor(f)}),c.data("sbi_imgLiquid_oldProcessed")||(c.fadeTo(r.fadeInTime,1),c.data("sbi_imgLiquid_oldProcessed",!0),r.removeBoxBackground&&l.css("background-image","none"),l.addClass("sbi_imgLiquid_nobgSize"),l.addClass("sbi_imgLiquid_ready")),r.onItemFinish&&r.onItemFinish(e,l,c),d()}function d(){e===t.length-1&&t.settings.onFinish&&t.settings.onFinish()}var r=t.settings,l=i(this),c=i("img:first",l);return c.length?(c.data("sbi_imgLiquid_settings")?(l.removeClass("sbi_imgLiquid_error").removeClass("sbi_imgLiquid_ready"),r=i.extend({},c.data("sbi_imgLiquid_settings"),t.options)):r=i.extend({},t.settings,function(){var i={};if(t.settings.useDataHtmlAttr){var e=l.attr("data-sbi_imgLiquid-fill"),n=l.attr("data-sbi_imgLiquid-horizontalAlign"),o=l.attr("data-sbi_imgLiquid-verticalAlign");("true"===e||"false"===e)&&(i.fill=Boolean("true"===e)),void 0===n||"left"!==n&&"center"!==n&&"right"!==n&&-1===n.indexOf("%")||(i.horizontalAlign=n),void 0===o||"top"!==o&&"bottom"!==o&&"center"!==o&&-1===o.indexOf("%")||(i.verticalAlign=o)}return s.isIE&&t.settings.ieFadeInDisabled&&(i.fadeInTime=0),i}()),c.data("sbi_imgLiquid_settings",r),r.onItemStart&&r.onItemStart(e,l,c),void(s.bgs_Available&&r.useBackgroundSize?(-1===l.css("background-image").indexOf(encodeURI(c.attr("src")))&&l.css({"background-image":'url("'+encodeURI(c.attr("src"))+'")'}),l.css({"background-size":r.fill?"cover":"contain","background-position":(r.horizontalAlign+" "+r.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),i("a:first",l).css({display:"block",width:"100%",height:"100%"}),i("img",l).css({display:"none"}),r.onItemFinish&&r.onItemFinish(e,l,c),l.addClass("sbi_imgLiquid_bgSize"),l.addClass("sbi_imgLiquid_ready"),d()):function t(){if(c.data("oldSrc")&&c.data("oldSrc")!==c.attr("src")){var s=c.clone().removeAttr("style");return s.data("sbi_imgLiquid_settings",c.data("sbi_imgLiquid_settings")),c.parent().prepend(s),c.remove(),(c=s)[0].width=0,void setTimeout(t,10)}return c.data("sbi_imgLiquid_oldProcessed")?void a():(c.data("sbi_imgLiquid_oldProcessed",!1),c.data("oldSrc",c.attr("src")),i("img:not(:first)",l).css("display","none"),l.css({overflow:"hidden"}),c.fadeTo(0,0).removeAttr("width").removeAttr("height").css({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),c.on("error",o),c[0].onerror=o,function i(){c.data("sbi_imgLiquid_error")||c.data("sbi_imgLiquid_loaded")||c.data("sbi_imgLiquid_oldProcessed")||(l.is(":visible")&&c[0].complete&&c[0].width>0&&c[0].height>0?(c.data("sbi_imgLiquid_loaded",!0),setTimeout(a,e*r.delay)):setTimeout(i,r.timecheckvisibility))}(),void n())}())):void o()})}})}(jQuery),i=s.injectCss,e=document.getElementsByTagName("head")[0],(t=document.createElement("style")).type="text/css",t.styleSheet?t.styleSheet.cssText=i:t.appendChild(document.createTextNode(i)),e.appendChild(t)}function t(){this.feeds={},this.options=sb_instagram_js_options}function s(i,e,t){this.el=i,this.index=e,this.settings=t,this.minImageWidth=0,this.imageResolution=150,this.resizedImages={},this.needsResizing=[],this.outOfPages=!1,this.page=1,this.isInitialized=!1}function n(e,t){i.ajax({url:sbiajaxurl,type:"post",data:e,success:t})}t.prototype={createPage:function(e,t){void 0!==window.sbiajaxurl&&-1!==window.sbiajaxurl.indexOf(window.location.hostname)||(window.sbiajaxurl=location.protocol+"//"+window.location.hostname+"/wp-admin/admin-ajax.php"),i(".sbi_no_js_error_message").remove(),i(".sbi_no_js").removeClass("sbi_no_js"),e(t)},createFeeds:function(e){e.whenFeedsCreated(i(".sbi").each(function(e){i(this).attr("data-sbi-index",e+1);var t=i(this),o=void 0!==t.attr("data-sbi-flags")?t.attr("data-sbi-flags").split(","):[],a=void 0!==t.attr("data-options")?JSON.parse(t.attr("data-options")):{};if(o.indexOf("testAjax")>-1){window.sbi.triggeredTest=!0;n({action:"sbi_on_ajax_test_trigger"},function(i){console.log("did test")})}var d={cols:t.attr("data-cols"),colsmobile:void 0!==t.attr("data-colsmobile")&&"same"!==t.attr("data-colsmobile")?t.attr("data-colsmobile"):t.attr("data-cols"),num:t.attr("data-num"),imgRes:t.attr("data-res"),feedID:t.attr("data-feedid"),postID:"undefind"!=typeof t.attr("data-postid")?t.attr("data-postid"):"unknown",shortCodeAtts:t.attr("data-shortcode-atts"),resizingEnabled:-1===o.indexOf("resizeDisable"),imageLoadEnabled:-1===o.indexOf("imageLoadDisable"),debugEnabled:o.indexOf("debug")>-1,favorLocal:o.indexOf("favorLocal")>-1,ajaxPostLoad:o.indexOf("ajaxPostLoad")>-1,gdpr:o.indexOf("gdpr")>-1,overrideBlockCDN:o.indexOf("overrideBlockCDN")>-1,consentGiven:!1,locator:o.indexOf("locator")>-1,autoMinRes:1,general:a};window.sbi.feeds[e]=function(i,e,t){return new s(i,e,t)}(this,e,d),window.sbi.feeds[e].setResizedImages(),window.sbi.feeds[e].init();var r=jQuery.Event("sbiafterfeedcreate");r.feed=window.sbi.feeds[e],jQuery(window).trigger(r)}))},afterFeedsCreated:function(){i(".sb_instagram_header").each(function(){var e=i(this);e.find(".sbi_header_link").on("mouseenter mouseleave",function(i){switch(i.type){case"mouseenter":e.find(".sbi_header_img_hover").addClass("sbi_fade_in");break;case"mouseleave":e.find(".sbi_header_img_hover").removeClass("sbi_fade_in")}})})},encodeHTML:function(i){return void 0===i?"":i.replace(/(>)/g,">").replace(/(<)/g,"<").replace(/(<br\/>)/g,"<br>").replace(/(<br>)/g,"<br>")},urlDetect:function(i){return i.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g)}},s.prototype={init:function(){var e=this;e.settings.consentGiven=e.checkConsent(),i(this.el).find(".sbi_photo").parent("p").length&&i(this.el).addClass("sbi_no_autop"),i(this.el).find("#sbi_mod_error").length&&i(this.el).prepend(i(this.el).find("#sbi_mod_error")),this.settings.ajaxPostLoad?this.getNewPostSet():this.afterInitialImagesLoaded();var t,s=(t=0,function(i,e){clearTimeout(t),t=setTimeout(i,e)});jQuery(window).on("resize",function(){s(function(){e.afterResize()},500)}),i(this.el).find(".sbi_item").each(function(){e.lazyLoadCheck(i(this))})},afterInitialImagesLoaded:function(){this.loadMoreButtonInit(),this.hideExtraImagesForWidth(),this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed()},afterResize:function(){this.setImageHeight(),this.setImageResolution(),this.maybeRaiseImageResolution(),this.setImageSizeClass()},afterLoadMoreClicked:function(i){i.find(".sbi_loader").removeClass("sbi_hidden"),i.find(".sbi_btn_text").addClass("sbi_hidden"),i.closest(".sbi").find(".sbi_num_diff_hide").addClass("sbi_transition").removeClass("sbi_num_diff_hide")},afterNewImagesLoaded:function(){var e=i(this.el),t=this;this.beforeNewImagesRevealed(),this.revealNewImages(),this.afterNewImagesRevealed(),setTimeout(function(){e.find(".sbi_loader").addClass("sbi_hidden"),e.find(".sbi_btn_text").removeClass("sbi_hidden"),t.maybeRaiseImageResolution()},500)},beforeNewImagesRevealed:function(){this.setImageHeight(),this.maybeRaiseImageResolution(!0),this.setImageSizeClass()},revealNewImages:function(){var e=i(this.el);e.find(".sbi-screenreader").each(function(){i(this).find("img").remove()}),"function"==typeof sbi_custom_js&&setTimeout(function(){sbi_custom_js()},100),this.applyImageLiquid(),e.find(".sbi_item").each(function(i){jQuery(this).find(".sbi_photo").on("mouseenter mouseleave",function(i){switch(i.type){case"mouseenter":jQuery(this).fadeTo(200,.85);break;case"mouseleave":jQuery(this).stop().fadeTo(500,1)}})}),setTimeout(function(){jQuery("#sbi_images .sbi_item.sbi_new").removeClass("sbi_new");var i=10;e.find(".sbi_transition").each(function(){var e=jQuery(this);setTimeout(function(){e.removeClass("sbi_transition")},i),i+=10})},500)},lazyLoadCheck:function(e){if(e.find(".sbi_photo").length&&!e.closest(".sbi").hasClass("sbi-no-ll-check")){var t=this.getImageUrls(e),s=void 0!==t[640]?t[640]:e.find(".sbi_photo").attr("data-full-res");if(!this.settings.consentGiven&&s.indexOf("scontent")>-1)return;e.find(".sbi_photo img").each(function(){s&&void 0!==i(this).attr("data-src")&&i(this).attr("data-src",s),s&&void 0!==i(this).attr("data-orig-src")&&i(this).attr("data-orig-src",s),i(this).on("load",function(){!i(this).hasClass("sbi-replaced")&&i(this).attr("src").indexOf("placeholder")>-1&&(i(this).addClass("sbi-replaced"),s&&(i(this).attr("src",s),i(this).closest(".sbi_imgLiquid_bgSize").length&&i(this).closest(".sbi_imgLiquid_bgSize").css("background-image","url("+s+")")))})})}},afterNewImagesRevealed:function(){this.listenForVisibilityChange(),this.sendNeedsResizingToServer(),this.settings.imageLoadEnabled||i(".sbi_no_resraise").removeClass("sbi_no_resraise");var e=i.Event("sbiafterimagesloaded");e.el=i(this.el),i(window).trigger(e)},setResizedImages:function(){i(this.el).find(".sbi_resized_image_data").length&&void 0!==i(this.el).find(".sbi_resized_image_data").attr("data-resized")&&0===i(this.el).find(".sbi_resized_image_data").attr("data-resized").indexOf('{"')&&(this.resizedImages=JSON.parse(i(this.el).find(".sbi_resized_image_data").attr("data-resized")),i(this.el).find(".sbi_resized_image_data").remove())},sendNeedsResizingToServer:function(){var e=this,t=i(this.el);if(e.needsResizing.length>0&&e.settings.resizingEnabled){var s=i(this.el).find(".sbi_item").length,o=void 0!==e.settings.general.cache_all&&e.settings.general.cache_all,a="";void 0!==t.attr("data-locatornonce")&&(a=t.attr("data-locatornonce")),n({action:"sbi_resized_images_submit",needs_resizing:e.needsResizing,offset:s,feed_id:e.settings.feedID,atts:e.settings.shortCodeAtts,location:e.locationGuess(),post_id:e.settings.postID,cache_all:o,locator_nonce:a},function(i){var t=i;for(var s in"object"!=typeof i&&0===i.trim().indexOf("{")&&(t=JSON.parse(i.trim())),e.settings.debugEnabled&&console.log(t),t)t.hasOwnProperty(s)&&(e.resizedImages[s]=t[s]);e.maybeRaiseImageResolution(),setTimeout(function(){e.afterResize()},500)})}else if(e.settings.locator){a="";void 0!==t.attr("data-locatornonce")&&(a=t.attr("data-locatornonce")),n({action:"sbi_do_locator",feed_id:e.settings.feedID,atts:e.settings.shortCodeAtts,location:e.locationGuess(),post_id:e.settings.postID,locator_nonce:a},function(i){})}},loadMoreButtonInit:function(){var e=i(this.el),t=this;e.find("#sbi_load .sbi_load_btn").off().on("click",function(){t.afterLoadMoreClicked(jQuery(this)),t.getNewPostSet()})},getNewPostSet:function(){var e=i(this.el),t=this;t.page++;var s="";void 0!==e.attr("data-locatornonce")&&(s=e.attr("data-locatornonce"));n({action:"sbi_load_more_clicked",offset:e.find(".sbi_item").length,page:t.page,feed_id:t.settings.feedID,atts:t.settings.shortCodeAtts,location:t.locationGuess(),post_id:t.settings.postID,current_resolution:t.imageResolution,locator_nonce:s},function(s){var n=s;"object"!=typeof s&&0===s.trim().indexOf("{")&&(n=JSON.parse(s.trim())),t.settings.debugEnabled&&console.log(n),t.appendNewPosts(n.html),t.addResizedImages(n.resizedImages),t.settings.ajaxPostLoad?(t.settings.ajaxPostLoad=!1,t.afterInitialImagesLoaded()):t.afterNewImagesLoaded(),n.feedStatus.shouldPaginate?t.outOfPages=!1:(t.outOfPages=!0,e.find(".sbi_load_btn").hide()),i(".sbi_no_js").removeClass("sbi_no_js")})},appendNewPosts:function(e){var t=i(this.el);t.find("#sbi_images .sbi_item").length?t.find("#sbi_images .sbi_item").last().after(e):t.find("#sbi_images").append(e)},addResizedImages:function(i){for(var e in i)this.resizedImages[e]=i[e]},setImageHeight:function(){var e=i(this.el),t=e.find(".sbi_photo").eq(0).innerWidth(),s=this.getColumnCount(),n=e.find("#sbi_images").innerWidth()-e.find("#sbi_images").width(),o=n/2;e.find("#sbi_images").width();e.find(".sbi_photo").css("height",t),e.find(".sbi-owl-nav").length&&setTimeout(function(){var i=2;e.find(".sbi_owl2row-item").length&&(i=1);var t=e.find(".sbi_photo").eq(0).innerWidth()/i;t+=parseInt(o)*(2-i+2),e.find(".sbi-owl-nav div").css("top",t)},100)},maybeRaiseSingleImageResolution:function(e,t,s){var n=this,o=n.getImageUrls(e),a=e.find(".sbi_photo img").attr("src"),d=150,r=e.find("img").get(0),l=a===window.sbi.options.placeholder?1:r.naturalWidth/r.naturalHeight;s=void 0!==s&&s;if(!(e.hasClass("sbi_no_resraise")||e.hasClass("sbi_had_error")||e.find(".sbi_link_area").length&&e.find(".sbi_link_area").hasClass("sbi_had_error")))if(o.length<1)e.find(".sbi_link_area").length&&e.find(".sbi_link_area").attr("href",window.sbi.options.placeholder.replace("placeholder.png","thumb-placeholder.png"));else{(e.find(".sbi_link_area").length&&e.find(".sbi_link_area").attr("href")===window.sbi.options.placeholder.replace("placeholder.png","thumb-placeholder.png")||!n.settings.consentGiven)&&e.find(".sbi_link_area").attr("href",o[o.length-1]),void 0!==o[640]&&e.find(".sbi_photo").attr("data-full-res",o[640]),i.each(o,function(i,e){e===a&&(d=parseInt(i),s=!1)});var c=640;switch(n.settings.imgRes){case"thumb":c=150;break;case"medium":c=320;break;case"full":c=640;break;default:var h=Math.max(n.settings.autoMinRes,e.find(".sbi_photo").innerWidth()),g=n.getBestResolutionForAuto(h,l,e);switch(g){case 320:c=320;break;case 150:c=150}}if(c>d||a===window.sbi.options.placeholder||s){if(n.settings.debugEnabled){var f=a===window.sbi.options.placeholder?"was placeholder":"too small";console.log("rais res for "+a,f)}var u=o[c].split("?ig_cache_key")[0];if(a!==u&&(e.find(".sbi_photo img").attr("src",u),e.find(".sbi_photo").css("background-image",'url("'+u+'")')),d=c,"auto"===n.settings.imgRes){var b=!1;e.find(".sbi_photo img").on("load",function(){var t=i(this),s=t.get(0).naturalWidth/t.get(0).naturalHeight;if(1e3!==t.get(0).naturalWidth&&s>l&&!b){switch(n.settings.debugEnabled&&console.log("rais res again for aspect ratio change "+a),b=!0,h=e.find(".sbi_photo").innerWidth(),g=n.getBestResolutionForAuto(h,s,e),c=640,g){case 320:c=320;break;case 150:c=150}c>d&&(u=o[c].split("?ig_cache_key")[0],t.attr("src",u),t.closest(".sbi_photo").css("background-image",'url("'+u+'")')),"masonry"!==n.layout&&"highlight"!==n.layout||(i(n.el).find("#sbi_images").smashotope(n.isotopeArgs),setTimeout(function(){i(n.el).find("#sbi_images").smashotope(n.isotopeArgs)},500))}else if(n.settings.debugEnabled){var r=b?"already checked":"no aspect ratio change";console.log("not raising res for replacement "+a,r)}})}}e.find("img").on("error",function(){if(i(this).hasClass("sbi_img_error"))console.log("unfixed error "+i(this).attr("src"));else{var e;if(i(this).addClass("sbi_img_error"),!(i(this).attr("src").indexOf("media/?size=")>-1||i(this).attr("src").indexOf("cdninstagram")>-1||i(this).attr("src").indexOf("fbcdn")>-1)&&n.settings.consentGiven){if("undefined"!==i(this).closest(".sbi_photo").attr("data-img-src-set"))void 0!==(e=JSON.parse(i(this).closest(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/"))).d&&(i(this).attr("src",e.d),i(this).closest(".sbi_photo").css("background-image","url("+e.d+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"))}else n.settings.favorLocal=!0,void 0!==(e=n.getImageUrls(i(this).closest(".sbi_item")))[640]&&(i(this).attr("src",e[640]),i(this).closest(".sbi_photo").css("background-image","url("+e[640]+")"),i(this).closest(".sbi_item").addClass("sbi_had_error").find(".sbi_link_area").attr("href",e[640]).addClass("sbi_had_error"));setTimeout(function(){n.afterResize()},1500)}})}},maybeRaiseImageResolution:function(e){var t=this,s=void 0!==e&&!0===e?".sbi_item.sbi_new":".sbi_item",n=!t.isInitialized;i(t.el).find(s).each(function(e){!i(this).hasClass("sbi_num_diff_hide")&&i(this).find(".sbi_photo").length&&void 0!==i(this).find(".sbi_photo").attr("data-img-src-set")&&t.maybeRaiseSingleImageResolution(i(this),e,n)}),t.isInitialized=!0},getBestResolutionForAuto:function(e,t,s){(isNaN(t)||t<1)&&(t=1);var n=e*t,o=10*Math.ceil(n/10),a=[150,320,640];if(s.hasClass("sbi_highlighted")&&(o*=2),-1===a.indexOf(parseInt(o))){var d=!1;i.each(a,function(i,e){e>parseInt(o)&&!d&&(o=e,d=!0)})}return o},hideExtraImagesForWidth:function(){if("carousel"!==this.layout){var e=i(this.el),t=void 0!==e.attr("data-num")&&""!==e.attr("data-num")?parseInt(e.attr("data-num")):1,s=void 0!==e.attr("data-nummobile")&&""!==e.attr("data-nummobile")?parseInt(e.attr("data-nummobile")):t;i(window).width()<480?s<e.find(".sbi_item").length&&e.find(".sbi_item").slice(s-e.find(".sbi_item").length).addClass("sbi_num_diff_hide"):t<e.find(".sbi_item").length&&e.find(".sbi_item").slice(t-e.find(".sbi_item").length).addClass("sbi_num_diff_hide")}},setImageSizeClass:function(){var e=i(this.el);e.removeClass("sbi_small sbi_medium");var t=e.innerWidth(),s=parseInt(e.find("#sbi_images").outerWidth()-e.find("#sbi_images").width())/2,n=this.getColumnCount(),o=(t-s*(n+2))/n;o>120&&o<240?e.addClass("sbi_medium"):o<=120&&e.addClass("sbi_small")},setMinImageWidth:function(){i(this.el).find(".sbi_item .sbi_photo").first().length?this.minImageWidth=i(this.el).find(".sbi_item .sbi_photo").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(i){var e=JSON.parse(i.find(".sbi_photo").attr("data-img-src-set").replace(/\\\//g,"/")),t=i.attr("id").replace("sbi_","");if(this.settings.consentGiven||this.settings.overrideBlockCDN||(e=[]),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&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"full.jpg",s.push(640)),void 0!==this.resizedImages[t].sizes.low&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"low.jpg",s.push(320)),void 0!==this.resizedImages[t].sizes.thumb&&(s.push(150),e[150]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"thumb.jpg"),this.settings.favorLocal&&(-1===s.indexOf(640)&&s.indexOf(320)>-1&&(e[640]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"low.jpg"),-1===s.indexOf(320)&&(s.indexOf(640)>-1?e[320]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"full.jpg":s.indexOf(150)>-1&&(e[320]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"thumb.jpg")),-1===s.indexOf(150)&&(s.indexOf(320)>-1?e[150]=sb_instagram_js_options.resized_url+this.resizedImages[t].id+"low.jpg":s.indexOf(640)>-1&&(e[150]=sb_instagram_js_options.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 e},getAvatarUrl:function(i,e){if(""===i)return"";var t=this.settings.general.avatars;return"local"===(e=void 0!==e?e:"local")?void 0!==t["LCL"+i]&&1===parseInt(t["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":void 0!==t[i]?t[i]:"":void 0!==t[i]?t[i]:void 0!==t["LCL"+i]&&1===parseInt(t["LCL"+i])?sb_instagram_js_options.resized_url+i+".jpg":""},addToNeedsResizing:function(i){-1===this.needsResizing.indexOf(i)&&this.needsResizing.push(i)},applyImageLiquid:function(){var t=i(this.el);e(),"function"==typeof t.find(".sbi_photo").sbi_imgLiquid&&t.find(".sbi_photo").sbi_imgLiquid({fill:!0})},listenForVisibilityChange:function(){var e,t,s,n=this;e=jQuery,t={runOnLoad:!0,frequency:100,sbiPreviousVisibility:null},s={sbiCheckVisibility:function(i,e){if(jQuery.contains(document,i[0])){var t=e.sbiPreviousVisibility,n=i.is(":visible");e.sbiPreviousVisibility=n,null==t?e.runOnLoad&&e.callback(i,n):t!==n&&e.callback(i,n),setTimeout(function(){s.sbiCheckVisibility(i,e)},e.frequency)}}},e.fn.sbiVisibilityChanged=function(i){var n=e.extend({},t,i);return this.each(function(){s.sbiCheckVisibility(e(this),n)})},"function"==typeof i(this.el).filter(":hidden").sbiVisibilityChanged&&i(this.el).filter(":hidden").sbiVisibilityChanged({callback:function(i,e){n.afterResize()},runOnLoad:!1})},getColumnCount:function(){var e=i(this.el),t=this.settings.cols,s=this.settings.colsmobile,n=t,o=window.innerWidth;return e.hasClass("sbi_mob_col_auto")?(o<640&&parseInt(t)>2&&parseInt(t)<7&&(n=2),o<640&&parseInt(t)>6&&parseInt(t)<11&&(n=4),o<=480&&parseInt(t)>2&&(n=1)):o<=480&&(n=s),parseInt(n)},checkConsent:function(){if(this.settings.consentGiven||!this.settings.gdpr)return!0;if("undefined"!=typeof CLI_Cookie)null!==CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)&&(null!==CLI_Cookie.read("cookielawinfo-checkbox-non-necessary")&&(this.settings.consentGiven="yes"===CLI_Cookie.read("cookielawinfo-checkbox-non-necessary")),null!==CLI_Cookie.read("cookielawinfo-checkbox-necessary")&&(this.settings.consentGiven="yes"===CLI_Cookie.read("cookielawinfo-checkbox-necessary")));else if(void 0!==window.cnArgs){var i=("; "+document.cookie).split("; cookie_notice_accepted=");if(2===i.length){var e=i.pop().split(";").shift();this.settings.consentGiven="true"===e}}else void 0!==window.cookieconsent?this.settings.consentGiven="allow"===function(i){for(var e=i+"=",t=window.document.cookie.split(";"),s=0;s<t.length;s++){var n=t[s].trim();if(0==n.indexOf(e))return n.substring(e.length,n.length)}return""}("complianz_consent_status"):void 0!==window.Cookiebot?this.settings.consentGiven=Cookiebot.consented:void 0!==window.BorlabsCookie&&(this.settings.consentGiven=window.BorlabsCookie.checkCookieConsent("instagram"));var t=jQuery.Event("sbicheckconsent");return t.feed=this,jQuery(window).trigger(t),this.settings.consentGiven},afterConsentToggled:function(){if(this.checkConsent()){var i=this;i.maybeRaiseImageResolution(),setTimeout(function(){i.afterResize()},500)}},locationGuess:function(){var e=i(this.el),t="content";return e.closest("footer").length?t="footer":e.closest(".header").length||e.closest("header").length?t="header":(e.closest(".sidebar").length||e.closest("aside").length)&&(t="sidebar"),t}},window.sbi_init=function(){window.sbi=new t,window.sbi.createPage(window.sbi.createFeeds,{whenFeedsCreated:window.sbi.afterFeedsCreated})}}(jQuery),jQuery(document).ready(function(i){void 0===window.sb_instagram_js_options&&(window.sb_instagram_js_options={font_method:"svg",resized_url:location.protocol+"//"+window.location.hostname+"/wp-content/uploads/sb-instagram-feed-images/",placeholder:location.protocol+"//"+window.location.hostname+"/wp-content/plugins/instagram-feed/img/placeholder.png"}),void 0!==window.sb_instagram_js_options.resized_url&&-1===window.sb_instagram_js_options.resized_url.indexOf(location.protocol)&&("http:"===location.protocol?window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("https:","http:"):window.sb_instagram_js_options.resized_url=window.sb_instagram_js_options.resized_url.replace("http:","https:")),sbi_init(),i("#cookie-notice a").on("click",function(){setTimeout(function(){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].afterConsentToggled()})},1e3)}),i("#cookie-law-info-bar a").on("click",function(){setTimeout(function(){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].afterConsentToggled()})},1e3)}),i(".cli-user-preference-checkbox").on("click",function(){setTimeout(function(){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!1,window.sbi.feeds[i].afterConsentToggled()})},1e3)}),i(window).on("CookiebotOnAccept",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!0,window.sbi.feeds[i].afterConsentToggled()})}),i(document).on("cmplzAcceptAll",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!0,window.sbi.feeds[i].afterConsentToggled()})}),i(document).on("cmplzRevoke",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!1,window.sbi.feeds[i].afterConsentToggled()})}),i(document).on("borlabs-cookie-consent-saved",function(e){i.each(window.sbi.feeds,function(i){window.sbi.feeds[i].settings.consentGiven=!1,window.sbi.feeds[i].afterConsentToggled()})})}));
|