Version Description
- New: Added feed caching to limit the number of API requests. Use the setting on the "Configure" tab "Check for new posts every" to set how long feed data will be cached before refreshing.
- New: Added backup caching for all feeds. If the feed is unable to display then a backup feed will be shown to visitors if one is available. The backup cache can be disabled or cleared by using the following setting:
Customize > Misc > Enable Backup Caching
. - New: Icons are now generated as SVGs for a sharper look and more semantic markup
- New: Carousel posts include an icon to indicate that they are carousel posts
- Tweak: Using the "sort posts by random" feature will include the most recent 33 posts instead of just the posts shown in the feed
- Fix: links back to instagram.com will use the "www" prefix
Download this release
Release Info
Developer | smashballoon |
Plugin | Instagram Feed |
Version | 1.7 |
Comparing to | |
See all releases |
Code changes from version 1.6.2 to 1.7
- README.txt +9 -1
- css/sb-instagram-admin.css +4 -0
- css/sb-instagram.css +45 -11
- css/sb-instagram.min.css +1 -1
- instagram-feed-admin.php +183 -6
- instagram-feed.php +376 -31
- js/sb-instagram-admin.js +18 -0
- js/sb-instagram.js +1358 -428
- js/sb-instagram.min.js +67 -23
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.0
|
5 |
Tested up to: 4.9
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -310,6 +310,14 @@ We understand that sometimes you need help, have issues or just have questions.
|
|
310 |
* Plus more customization options added all the time!
|
311 |
|
312 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
= 1.6.2 =
|
314 |
* Fix: Fixed a rare issue where the Load More button wouldn't be displayed after the last update if the Instagram account didn't have many posts
|
315 |
|
3 |
Tags: Instagram, Instagram feed, Instagram photos, Instagram widget, Instagram gallery
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 4.9
|
6 |
+
Stable tag: 1.7
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
310 |
* Plus more customization options added all the time!
|
311 |
|
312 |
== Changelog ==
|
313 |
+
= 1.7 =
|
314 |
+
* New: Added feed caching to limit the number of API requests. Use the setting on the "Configure" tab "Check for new posts every" to set how long feed data will be cached before refreshing.
|
315 |
+
* New: Added backup caching for all feeds. If the feed is unable to display then a backup feed will be shown to visitors if one is available. The backup cache can be disabled or cleared by using the following setting: `Customize > Misc > Enable Backup Caching`.
|
316 |
+
* New: Icons are now generated as SVGs for a sharper look and more semantic markup
|
317 |
+
* New: Carousel posts include an icon to indicate that they are carousel posts
|
318 |
+
* Tweak: Using the "sort posts by random" feature will include the most recent 33 posts instead of just the posts shown in the feed
|
319 |
+
* Fix: links back to instagram.com will use the "www" prefix
|
320 |
+
|
321 |
= 1.6.2 =
|
322 |
* Fix: Fixed a rare issue where the Load More button wouldn't be displayed after the last update if the Instagram account didn't have many posts
|
323 |
|
css/sb-instagram-admin.css
CHANGED
@@ -41,6 +41,7 @@
|
|
41 |
margin: 15px 0;
|
42 |
border-bottom: 1px solid #ccc;
|
43 |
}
|
|
|
44 |
/* Instagram btn */
|
45 |
#sbi_admin .sbi_admin_btn{
|
46 |
display: block;
|
@@ -92,6 +93,9 @@
|
|
92 |
margin-left: 5px;
|
93 |
border-radius: 3px;
|
94 |
}
|
|
|
|
|
|
|
95 |
#sbi_admin .sbi_note{
|
96 |
font-size: 12px;
|
97 |
font-style: italic;
|
41 |
margin: 15px 0;
|
42 |
border-bottom: 1px solid #ccc;
|
43 |
}
|
44 |
+
|
45 |
/* Instagram btn */
|
46 |
#sbi_admin .sbi_admin_btn{
|
47 |
display: block;
|
93 |
margin-left: 5px;
|
94 |
border-radius: 3px;
|
95 |
}
|
96 |
+
#sbi_admin .sbi-customize-tab-opt .sbi-success {
|
97 |
+
top: 5px;
|
98 |
+
}
|
99 |
#sbi_admin .sbi_note{
|
100 |
font-size: 12px;
|
101 |
font-style: italic;
|
css/sb-instagram.css
CHANGED
@@ -142,20 +142,41 @@
|
|
142 |
}
|
143 |
|
144 |
/* Videos */
|
145 |
-
#sb_instagram .sbi_type_video .sbi_playbtn
|
|
|
|
|
|
|
|
|
146 |
display: block !important;
|
147 |
position: absolute;
|
148 |
z-index: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
top: 50%;
|
150 |
left: 50%;
|
151 |
margin-top: -24px;
|
152 |
margin-left: -19px;
|
153 |
padding: 0;
|
154 |
font-size: 48px;
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
}
|
160 |
|
161 |
/* Loader */
|
@@ -344,8 +365,9 @@
|
|
344 |
filter: alpha(opacity=85);
|
345 |
opacity: 0.85;
|
346 |
}
|
347 |
-
#sb_instagram #sbi_load .fa,
|
348 |
-
#sb_instagram .sbi_follow_btn .fa
|
|
|
349 |
margin-bottom: -1px;
|
350 |
margin-right: 7px;
|
351 |
font-size: 15px;
|
@@ -394,16 +416,28 @@
|
|
394 |
}
|
395 |
|
396 |
/* Medium */
|
397 |
-
#sb_instagram.sbi_medium .sbi_playbtn
|
398 |
-
|
399 |
margin-top: -12px;
|
400 |
margin-left: -9px;
|
|
|
401 |
}
|
402 |
-
|
403 |
-
|
|
|
404 |
font-size: 18px;
|
|
|
|
|
|
|
|
|
405 |
margin-top: -9px;
|
406 |
margin-left: -7px;
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
}
|
408 |
|
409 |
/* Media queries */
|
142 |
}
|
143 |
|
144 |
/* Videos */
|
145 |
+
#sb_instagram .sbi_type_video .sbi_playbtn,
|
146 |
+
#sb_instagram .sbi_type_carousel .sbi_playbtn,
|
147 |
+
.sbi_type_carousel .fa-clone,
|
148 |
+
#sb_instagram .sbi_type_carousel .svg-inline--fa.fa-play,
|
149 |
+
#sb_instagram .sbi_type_video .svg-inline--fa.fa-play{
|
150 |
display: block !important;
|
151 |
position: absolute;
|
152 |
z-index: 0;
|
153 |
+
|
154 |
+
color: #fff;
|
155 |
+
color: rgba(255,255,255,0.9);
|
156 |
+
font-style: normal !important;
|
157 |
+
text-shadow: 0 0 8px rgba(0,0,0,0.8);
|
158 |
+
}
|
159 |
+
#sb_instagram .sbi_type_video .sbi_playbtn,
|
160 |
+
#sb_instagram .sbi_type_carousel .sbi_playbtn {
|
161 |
+
z-index: 2;
|
162 |
top: 50%;
|
163 |
left: 50%;
|
164 |
margin-top: -24px;
|
165 |
margin-left: -19px;
|
166 |
padding: 0;
|
167 |
font-size: 48px;
|
168 |
+
}
|
169 |
+
#sb_instagram .sbi_type_carousel .fa-clone{
|
170 |
+
right: 12px;
|
171 |
+
top: 12px;
|
172 |
+
font-size: 24px;
|
173 |
+
text-shadow: 0 0 8px rgba(0,0,0,0.3);
|
174 |
+
}
|
175 |
+
.sbi_type_carousel svg.fa-clone,
|
176 |
+
#sb_instagram .sbi_type_video .svg-inline--fa.fa-play,
|
177 |
+
#sb_instagram .sbi_type_carousel .svg-inline--fa.fa-play{
|
178 |
+
-webkit-filter: drop-shadow( 0px 0px 2px rgba(0,0,0,.4) );
|
179 |
+
filter: drop-shadow( 0px 0px 2px rgba(0,0,0,.4) );
|
180 |
}
|
181 |
|
182 |
/* Loader */
|
365 |
filter: alpha(opacity=85);
|
366 |
opacity: 0.85;
|
367 |
}
|
368 |
+
#sb_instagram #sbi_load .fa-spinner,
|
369 |
+
#sb_instagram .sbi_follow_btn .fa,
|
370 |
+
#sb_instagram .sbi_follow_btn svg{
|
371 |
margin-bottom: -1px;
|
372 |
margin-right: 7px;
|
373 |
font-size: 15px;
|
416 |
}
|
417 |
|
418 |
/* Medium */
|
419 |
+
#sb_instagram.sbi_medium .sbi_playbtn,
|
420 |
+
#sb_instagram.sbi_medium .sbi_photo_wrap .svg-inline--fa.fa-play{
|
421 |
margin-top: -12px;
|
422 |
margin-left: -9px;
|
423 |
+
font-size: 23px;
|
424 |
}
|
425 |
+
#sb_instagram.sbi_medium .sbi_type_carousel .sbi_photo_wrap .fa-clone{
|
426 |
+
right: 8px;
|
427 |
+
top: 8px;
|
428 |
font-size: 18px;
|
429 |
+
}
|
430 |
+
/* Small */
|
431 |
+
#sb_instagram.sbi_small .sbi_playbtn,
|
432 |
+
#sb_instagram.sbi_small .sbi_photo_wrap .svg-inline--fa.fa-play{
|
433 |
margin-top: -9px;
|
434 |
margin-left: -7px;
|
435 |
+
font-size: 18px;
|
436 |
+
}
|
437 |
+
#sb_instagram.sbi_small .sbi_type_carousel .sbi_photo_wrap .fa-clone{
|
438 |
+
right: 5px;
|
439 |
+
top: 5px;
|
440 |
+
font-size: 12px;
|
441 |
}
|
442 |
|
443 |
/* Media queries */
|
css/sb-instagram.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#sb_instagram{width:100%;margin:0 auto;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram:after{content:"";display:table;clear:both}#sb_instagram.sbi_fixed_height{overflow:hidden;overflow-y:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram #sbi_images{width:100%;float:left;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram #sbi_images .sbi_item{display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;*display:inline;padding:inherit!important;margin:0!important;text-decoration:none;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram.sbi_col_1 #sbi_images .sbi_item{width:100%}#sb_instagram.sbi_col_2 #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_3 #sbi_images .sbi_item{width:33.33%}#sb_instagram.sbi_col_4 #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_col_5 #sbi_images .sbi_item{width:20%}#sb_instagram.sbi_col_6 #sbi_images .sbi_item{width:16.66%}#sb_instagram.sbi_col_7 #sbi_images .sbi_item{width:14.28%}#sb_instagram.sbi_col_8 #sbi_images .sbi_item{width:12.5%}#sb_instagram.sbi_col_9 #sbi_images .sbi_item{width:11.11%}#sb_instagram.sbi_col_10 #sbi_images .sbi_item{width:10%}#sb_instagram.sbi_col_1.sbi_disable_mobile #sbi_images .sbi_item{width:100%}#sb_instagram.sbi_col_2.sbi_disable_mobile #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_3.sbi_disable_mobile #sbi_images .sbi_item{width:33.33%}#sb_instagram.sbi_col_4.sbi_disable_mobile #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_col_5.sbi_disable_mobile #sbi_images .sbi_item{width:20%}#sb_instagram.sbi_col_6.sbi_disable_mobile #sbi_images .sbi_item{width:16.66%}#sb_instagram.sbi_col_7.sbi_disable_mobile #sbi_images .sbi_item{width:14.28%}#sb_instagram.sbi_col_8.sbi_disable_mobile #sbi_images .sbi_item{width:12.5%}#sb_instagram.sbi_col_9.sbi_disable_mobile #sbi_images .sbi_item{width:11.11%}#sb_instagram.sbi_col_10.sbi_disable_mobile #sbi_images .sbi_item{width:10%}#sb_instagram .sbi_photo_wrap{position:relative}#sb_instagram .sbi_photo{display:block;text-decoration:none}#sb_instagram .sbi_photo img{width:100%;height:auto}#sb_instagram a,#sb_instagram a:hover,#sb_instagram a:focus,#sb_instagram a:active{outline:none}#sb_instagram img{display:block;padding:0!important;margin:0!important;max-width:100%!important;opacity:1!important}#sb_instagram .sbi_link{display:none;position:absolute;bottom:0;right:0;width:100%;padding:10px 0;background:rgba(0,0,0,.5);text-align:center;color:#fff;font-size:12px;line-height:1.1}#sb_instagram .sbi_link a{padding:0 6px;text-decoration:none;color:#fff;font-size:12px;line-height:1.1;display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;*display:inline}#sb_instagram .sbi_link .sbi_lightbox_link{padding-bottom:5px}#sb_instagram .sbi_link a:hover,#sb_instagram .sbi_link a:focus{text-decoration:underline}#sb_instagram .sbi_photo_wrap:hover .sbi_link,#sb_instagram .sbi_photo_wrap:focus .sbi_link{display:block}#sb_instagram .sbi_type_video .sbi_playbtn{display:block!important;position:absolute;z-index:0;top:50%;left:50%;margin-top:-24px;margin-left:-19px;padding:0;font-size:48px;
|
1 |
+
#sb_instagram{width:100%;margin:0 auto;padding:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram:after{content:"";display:table;clear:both}#sb_instagram.sbi_fixed_height{overflow:hidden;overflow-y:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram #sbi_images{width:100%;float:left;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram #sbi_images .sbi_item{display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;*display:inline;padding:inherit!important;margin:0!important;text-decoration:none;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram.sbi_col_1 #sbi_images .sbi_item{width:100%}#sb_instagram.sbi_col_2 #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_3 #sbi_images .sbi_item{width:33.33%}#sb_instagram.sbi_col_4 #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_col_5 #sbi_images .sbi_item{width:20%}#sb_instagram.sbi_col_6 #sbi_images .sbi_item{width:16.66%}#sb_instagram.sbi_col_7 #sbi_images .sbi_item{width:14.28%}#sb_instagram.sbi_col_8 #sbi_images .sbi_item{width:12.5%}#sb_instagram.sbi_col_9 #sbi_images .sbi_item{width:11.11%}#sb_instagram.sbi_col_10 #sbi_images .sbi_item{width:10%}#sb_instagram.sbi_col_1.sbi_disable_mobile #sbi_images .sbi_item{width:100%}#sb_instagram.sbi_col_2.sbi_disable_mobile #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_3.sbi_disable_mobile #sbi_images .sbi_item{width:33.33%}#sb_instagram.sbi_col_4.sbi_disable_mobile #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_col_5.sbi_disable_mobile #sbi_images .sbi_item{width:20%}#sb_instagram.sbi_col_6.sbi_disable_mobile #sbi_images .sbi_item{width:16.66%}#sb_instagram.sbi_col_7.sbi_disable_mobile #sbi_images .sbi_item{width:14.28%}#sb_instagram.sbi_col_8.sbi_disable_mobile #sbi_images .sbi_item{width:12.5%}#sb_instagram.sbi_col_9.sbi_disable_mobile #sbi_images .sbi_item{width:11.11%}#sb_instagram.sbi_col_10.sbi_disable_mobile #sbi_images .sbi_item{width:10%}#sb_instagram .sbi_photo_wrap{position:relative}#sb_instagram .sbi_photo{display:block;text-decoration:none}#sb_instagram .sbi_photo img{width:100%;height:auto}#sb_instagram a,#sb_instagram a:hover,#sb_instagram a:focus,#sb_instagram a:active{outline:none}#sb_instagram img{display:block;padding:0!important;margin:0!important;max-width:100%!important;opacity:1!important}#sb_instagram .sbi_link{display:none;position:absolute;bottom:0;right:0;width:100%;padding:10px 0;background:rgba(0,0,0,.5);text-align:center;color:#fff;font-size:12px;line-height:1.1}#sb_instagram .sbi_link a{padding:0 6px;text-decoration:none;color:#fff;font-size:12px;line-height:1.1;display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;*display:inline}#sb_instagram .sbi_link .sbi_lightbox_link{padding-bottom:5px}#sb_instagram .sbi_link a:hover,#sb_instagram .sbi_link a:focus{text-decoration:underline}#sb_instagram .sbi_photo_wrap:hover .sbi_link,#sb_instagram .sbi_photo_wrap:focus .sbi_link{display:block}#sb_instagram .sbi_type_video .sbi_playbtn,#sb_instagram .sbi_type_carousel .sbi_playbtn,.sbi_type_carousel .fa-clone,#sb_instagram .sbi_type_carousel .svg-inline--fa.fa-play,#sb_instagram .sbi_type_video .svg-inline--fa.fa-play{display:block!important;position:absolute;z-index:1;color:#fff;color:rgba(255,255,255,.9);font-style:normal!important;text-shadow:0 0 8px rgba(0,0,0,.8)}#sb_instagram .sbi_type_video .sbi_playbtn,#sb_instagram .sbi_type_carousel .sbi_playbtn{z-index:1;top:50%;left:50%;margin-top:-24px;margin-left:-19px;padding:0;font-size:48px}#sb_instagram .sbi_type_carousel .fa-clone{right:12px;top:12px;font-size:24px;text-shadow:0 0 8px rgba(0,0,0,.3)}.sbi_type_carousel svg.fa-clone,#sb_instagram .sbi_type_video .svg-inline--fa.fa-play,#sb_instagram .sbi_type_carousel .svg-inline--fa.fa-play{-webkit-filter:drop-shadow(0 0 2px rgba(0,0,0,.4));filter:drop-shadow(0 0 2px rgba(0,0,0,.4))}#sb_instagram .sbi_loader{position:relative;left:50%;width:16px;height:16px;margin:10px 0 10px -8px;background:url(../img/loader.png) no-repeat}#sb_instagram .sb_instagram_header{float:left;clear:both;margin:0 0 15px 0;padding:0;line-height:1.2;width:100%}#sb_instagram .sb_instagram_header a{float:left;display:block;min-width:100%\9}#sb_instagram .sbi_header_img{float:left;position:relative;width:50px;margin:0 0 0 -100%!important;overflow:hidden;-moz-border-radius:40px;-webkit-border-radius:40px;border-radius:40px}#sb_instagram .sbi_header_img img{float:left;margin:0!important;padding:0!important;border:none!important;-moz-border-radius:40px;-webkit-border-radius:40px;border-radius:40px}#sb_instagram .sbi_header_img_hover{position:absolute;width:100%;top:0;bottom:0;left:0;text-align:center;color:#fff;background:rgba(0,0,0,.75);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity:0;opacity:0;border-radius:40px;transition:opacity 0.2s}#sb_instagram .sb_instagram_header a:hover .sbi_header_img_hover,#sb_instagram .sb_instagram_header a:focus .sbi_header_img_hover{opacity:1}#sb_instagram .sbi_header_img_hover i{position:absolute;top:50%;left:50%;margin-top:-12px;margin-left:-12px;width:24px;height:24px;overflow:hidden;background:url(../img/small-logo.png) no-repeat 0 0}#sb_instagram .sbi_header_text{float:left;width:100%;padding-top:5px}#sb_instagram .sb_instagram_header a{text-decoration:none}#sb_instagram .sbi_header_text .sbi_bio,#sb_instagram .sbi_header_text h3{float:left;clear:both;width:auto;margin:0 0 0 60px!important;padding:0!important}#sb_instagram .sb_instagram_header h3{font-size:16px;line-height:1.3}#sb_instagram .sb_instagram_header p{font-size:13px;line-height:1.3}#sb_instagram .sb_instagram_header h3.sbi_no_bio{padding-top:9px!important}#sb_instagram .sbi_header_text img.emoji{margin-right:3px!important}#sb_instagram #sbi_load{float:left;clear:both;width:100%;text-align:center}#sb_instagram #sbi_load .fa-spinner{display:none;position:absolute;top:50%;left:50%;margin:-8px 0 0 -7px;font-size:15px}#sb_instagram #sbi_load .sbi_load_btn,#sb_instagram .sbi_follow_btn a{display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;*display:inline;padding:7px 14px;margin:5px auto 0 auto;background:#333;color:#eee;border:none;color:#fff;text-decoration:none;font-size:13px;line-height:1.5;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#sb_instagram #sbi_load .sbi_load_btn{position:relative}#sb_instagram .sbi_follow_btn{display:-moz-inline-stack;display:inline-block;vertical-align:top;zoom:1;*display:inline;text-align:center}#sb_instagram #sbi_load .sbi_follow_btn svg.fa-instagram{margin-right:7px}#sb_instagram .sbi_follow_btn.sbi_top{display:block;margin-bottom:5px}#sb_instagram .sbi_follow_btn a{background:#517fa4;color:#fff}#sb_instagram .sbi_follow_btn a:hover,#sb_instagram .sbi_follow_btn a:focus,#sb_instagram #sbi_load .sbi_load_btn:hover,#sb_instagram #sbi_load .sbi_load_btn:focus{filter:alpha(opacity=85);opacity:.85}#sb_instagram #sbi_load .fa-spinner,#sb_instagram .sbi_follow_btn .fa,#sb_instagram .sbi_follow_btn svg{margin-bottom:-1px;margin-right:7px;font-size:15px}#sb_instagram #sbi_load .sbi_follow_btn{margin-left:5px}#sb_instagram .sb_instagram_error{width:100%;text-align:center}#sbi_mod_error{display:none;border:1px solid #ddd;background:#eee;color:#333;margin:0;padding:10px 15px;font-size:13px;text-align:center;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}#sbi_mod_error p{padding:5px 0!important;margin:0!important;line-height:1.3!important}#sbi_mod_error ol,#sbi_mod_error ul{padding:5px 0 5px 20px!important;margin:0!important}#sbi_mod_error li{padding:1px 0!important;margin:0!important}#sbi_mod_error span{font-size:12px}#sb_instagram.sbi_medium .sbi_playbtn,#sb_instagram.sbi_medium .sbi_photo_wrap .svg-inline--fa.fa-play{margin-top:-12px;margin-left:-9px;font-size:23px}#sb_instagram.sbi_medium .sbi_type_carousel .sbi_photo_wrap .fa-clone{right:8px;top:8px;font-size:18px}#sb_instagram.sbi_small .sbi_playbtn,#sb_instagram.sbi_small .sbi_photo_wrap .svg-inline--fa.fa-play{margin-top:-9px;margin-left:-7px;font-size:18px}#sb_instagram.sbi_small .sbi_type_carousel .sbi_photo_wrap .fa-clone{right:5px;top:5px;font-size:12px}@media all and (max-width:640px){#sb_instagram.sbi_col_3 #sbi_images .sbi_item,#sb_instagram.sbi_col_4 #sbi_images .sbi_item,#sb_instagram.sbi_col_5 #sbi_images .sbi_item,#sb_instagram.sbi_col_6 #sbi_images .sbi_item{width:50%}#sb_instagram.sbi_col_7 #sbi_images .sbi_item,#sb_instagram.sbi_col_8 #sbi_images .sbi_item,#sb_instagram.sbi_col_9 #sbi_images .sbi_item,#sb_instagram.sbi_col_10 #sbi_images .sbi_item{width:25%}#sb_instagram.sbi_width_resp{width:100%!important}}@media all and (max-width:480px){#sb_instagram.sbi_col_3 #sbi_images .sbi_item,#sb_instagram.sbi_col_4 #sbi_images .sbi_item,#sb_instagram.sbi_col_5 #sbi_images .sbi_item,#sb_instagram.sbi_col_6 #sbi_images .sbi_item,#sb_instagram.sbi_col_7 #sbi_images .sbi_item,#sb_instagram.sbi_col_8 #sbi_images .sbi_item,#sb_instagram.sbi_col_9 #sbi_images .sbi_item,#sb_instagram.sbi_col_10 #sbi_images .sbi_item{width:100%}}
|
instagram-feed-admin.php
CHANGED
@@ -33,6 +33,8 @@ function sb_instagram_settings_page() {
|
|
33 |
'sb_instagram_user_id' => '',
|
34 |
'sb_instagram_preserve_settings' => '',
|
35 |
'sb_instagram_ajax_theme' => false,
|
|
|
|
|
36 |
'sb_instagram_width' => '100',
|
37 |
'sb_instagram_width_unit' => '%',
|
38 |
'sb_instagram_feed_width_resp' => false,
|
@@ -61,6 +63,12 @@ function sb_instagram_settings_page() {
|
|
61 |
//Misc
|
62 |
'sb_instagram_custom_css' => '',
|
63 |
'sb_instagram_custom_js' => '',
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
'sb_instagram_disable_awesome' => false
|
65 |
);
|
66 |
//Save defaults in an array
|
@@ -72,7 +80,10 @@ function sb_instagram_settings_page() {
|
|
72 |
$sb_instagram_user_id = $options[ 'sb_instagram_user_id' ];
|
73 |
$sb_instagram_preserve_settings = $options[ 'sb_instagram_preserve_settings' ];
|
74 |
$sb_instagram_ajax_theme = $options[ 'sb_instagram_ajax_theme' ];
|
75 |
-
|
|
|
|
|
|
|
76 |
$sb_instagram_width_unit = $options[ 'sb_instagram_width_unit' ];
|
77 |
$sb_instagram_feed_width_resp = $options[ 'sb_instagram_feed_width_resp' ];
|
78 |
$sb_instagram_height = $options[ 'sb_instagram_height' ];
|
@@ -101,7 +112,11 @@ function sb_instagram_settings_page() {
|
|
101 |
//Misc
|
102 |
$sb_instagram_custom_css = $options[ 'sb_instagram_custom_css' ];
|
103 |
$sb_instagram_custom_js = $options[ 'sb_instagram_custom_js' ];
|
104 |
-
|
|
|
|
|
|
|
|
|
105 |
|
106 |
|
107 |
//Check nonce before saving data
|
@@ -118,11 +133,40 @@ function sb_instagram_settings_page() {
|
|
118 |
|
119 |
isset($_POST[ 'sb_instagram_preserve_settings' ]) ? $sb_instagram_preserve_settings = sanitize_text_field( $_POST[ 'sb_instagram_preserve_settings' ] ) : $sb_instagram_preserve_settings = '';
|
120 |
isset($_POST[ 'sb_instagram_ajax_theme' ]) ? $sb_instagram_ajax_theme = sanitize_text_field( $_POST[ 'sb_instagram_ajax_theme' ] ) : $sb_instagram_ajax_theme = '';
|
|
|
|
|
121 |
|
122 |
$options[ 'sb_instagram_at' ] = $sb_instagram_at;
|
123 |
$options[ 'sb_instagram_user_id' ] = $sb_instagram_user_id;
|
124 |
$options[ 'sb_instagram_preserve_settings' ] = $sb_instagram_preserve_settings;
|
125 |
$options[ 'sb_instagram_ajax_theme' ] = $sb_instagram_ajax_theme;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
} //End config tab post
|
127 |
|
128 |
if( isset($_POST[ $sb_instagram_customize_hidden_field ]) && $_POST[ $sb_instagram_customize_hidden_field ] == 'Y' ) {
|
@@ -180,7 +224,11 @@ function sb_instagram_settings_page() {
|
|
180 |
//Misc
|
181 |
$sb_instagram_custom_css = $_POST[ 'sb_instagram_custom_css' ];
|
182 |
$sb_instagram_custom_js = $_POST[ 'sb_instagram_custom_js' ];
|
183 |
-
|
|
|
|
|
|
|
|
|
184 |
|
185 |
$options[ 'sb_instagram_width' ] = $sb_instagram_width;
|
186 |
$options[ 'sb_instagram_width_unit' ] = $sb_instagram_width_unit;
|
@@ -211,7 +259,55 @@ function sb_instagram_settings_page() {
|
|
211 |
//Misc
|
212 |
$options[ 'sb_instagram_custom_css' ] = $sb_instagram_custom_css;
|
213 |
$options[ 'sb_instagram_custom_js' ] = $sb_instagram_custom_js;
|
214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
} //End customize tab post
|
217 |
|
@@ -339,6 +435,20 @@ function sb_instagram_settings_page() {
|
|
339 |
<p class="sbi_tooltip"><?php _e("When navigating your site, if your theme uses Ajax to load content into your pages (meaning your page doesn't refresh) then check this setting. If you're not sure then please check with the theme author.", 'instagram-feed'); ?></p>
|
340 |
</td>
|
341 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
</tbody>
|
343 |
</table>
|
344 |
|
@@ -1066,14 +1176,61 @@ function sb_instagram_settings_page() {
|
|
1066 |
</tr>
|
1067 |
</tbody>
|
1068 |
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1069 |
<table class="form-table">
|
1070 |
<tbody>
|
1071 |
<tr valign="top">
|
1072 |
-
<th scope="row"><label><?php _e("Disable Font
|
1073 |
<td>
|
1074 |
<input type="checkbox" name="sb_instagram_disable_awesome" id="sb_instagram_disable_awesome" <?php if($sb_instagram_disable_awesome == true) echo 'checked="checked"' ?> /> <?php _e( 'Yes', 'instagram-feed' ); ?>
|
1075 |
</td>
|
1076 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1077 |
</tbody>
|
1078 |
</table>
|
1079 |
|
@@ -1680,7 +1837,27 @@ function sbi_rating_notice_html() {
|
|
1680 |
|
1681 |
}
|
1682 |
}
|
1683 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1684 |
/**
|
1685 |
* Called via ajax to automatically save access token and access token secret
|
1686 |
* retrieved with the big blue button
|
33 |
'sb_instagram_user_id' => '',
|
34 |
'sb_instagram_preserve_settings' => '',
|
35 |
'sb_instagram_ajax_theme' => false,
|
36 |
+
'sb_instagram_cache_time' => 1,
|
37 |
+
'sb_instagram_cache_time_unit' => 'hours',
|
38 |
'sb_instagram_width' => '100',
|
39 |
'sb_instagram_width_unit' => '%',
|
40 |
'sb_instagram_feed_width_resp' => false,
|
63 |
//Misc
|
64 |
'sb_instagram_custom_css' => '',
|
65 |
'sb_instagram_custom_js' => '',
|
66 |
+
'sb_instagram_cron' => 'no',
|
67 |
+
'check_api' => false,
|
68 |
+
'sb_instagram_backup' => true,
|
69 |
+
'enqueue_css_in_shortcode' => false,
|
70 |
+
'sb_instagram_disable_mob_swipe' => false,
|
71 |
+
'sbi_font_method' => 'svg',
|
72 |
'sb_instagram_disable_awesome' => false
|
73 |
);
|
74 |
//Save defaults in an array
|
80 |
$sb_instagram_user_id = $options[ 'sb_instagram_user_id' ];
|
81 |
$sb_instagram_preserve_settings = $options[ 'sb_instagram_preserve_settings' ];
|
82 |
$sb_instagram_ajax_theme = $options[ 'sb_instagram_ajax_theme' ];
|
83 |
+
$sb_instagram_cache_time = $options[ 'sb_instagram_cache_time' ];
|
84 |
+
$sb_instagram_cache_time_unit = $options[ 'sb_instagram_cache_time_unit' ];
|
85 |
+
|
86 |
+
$sb_instagram_width = $options[ 'sb_instagram_width' ];
|
87 |
$sb_instagram_width_unit = $options[ 'sb_instagram_width_unit' ];
|
88 |
$sb_instagram_feed_width_resp = $options[ 'sb_instagram_feed_width_resp' ];
|
89 |
$sb_instagram_height = $options[ 'sb_instagram_height' ];
|
112 |
//Misc
|
113 |
$sb_instagram_custom_css = $options[ 'sb_instagram_custom_css' ];
|
114 |
$sb_instagram_custom_js = $options[ 'sb_instagram_custom_js' ];
|
115 |
+
$sb_instagram_cron = $options[ 'sb_instagram_cron' ];
|
116 |
+
$check_api = $options[ 'check_api' ];
|
117 |
+
$sb_instagram_backup = $options[ 'sb_instagram_backup' ];
|
118 |
+
$sbi_font_method = $options[ 'sbi_font_method' ];
|
119 |
+
$sb_instagram_disable_awesome = $options[ 'sb_instagram_disable_awesome' ];
|
120 |
|
121 |
|
122 |
//Check nonce before saving data
|
133 |
|
134 |
isset($_POST[ 'sb_instagram_preserve_settings' ]) ? $sb_instagram_preserve_settings = sanitize_text_field( $_POST[ 'sb_instagram_preserve_settings' ] ) : $sb_instagram_preserve_settings = '';
|
135 |
isset($_POST[ 'sb_instagram_ajax_theme' ]) ? $sb_instagram_ajax_theme = sanitize_text_field( $_POST[ 'sb_instagram_ajax_theme' ] ) : $sb_instagram_ajax_theme = '';
|
136 |
+
isset($_POST[ 'sb_instagram_cache_time' ]) ? $sb_instagram_cache_time = sanitize_text_field( $_POST[ 'sb_instagram_cache_time' ] ) : $sb_instagram_cache_time = '';
|
137 |
+
isset($_POST[ 'sb_instagram_cache_time_unit' ]) ? $sb_instagram_cache_time_unit = sanitize_text_field( $_POST[ 'sb_instagram_cache_time_unit' ] ) : $sb_instagram_cache_time_unit = '';
|
138 |
|
139 |
$options[ 'sb_instagram_at' ] = $sb_instagram_at;
|
140 |
$options[ 'sb_instagram_user_id' ] = $sb_instagram_user_id;
|
141 |
$options[ 'sb_instagram_preserve_settings' ] = $sb_instagram_preserve_settings;
|
142 |
$options[ 'sb_instagram_ajax_theme' ] = $sb_instagram_ajax_theme;
|
143 |
+
|
144 |
+
$options[ 'sb_instagram_cache_time' ] = $sb_instagram_cache_time;
|
145 |
+
$options[ 'sb_instagram_cache_time_unit' ] = $sb_instagram_cache_time_unit;
|
146 |
+
|
147 |
+
//Delete all SBI transients
|
148 |
+
global $wpdb;
|
149 |
+
$table_name = $wpdb->prefix . "options";
|
150 |
+
$wpdb->query( "
|
151 |
+
DELETE
|
152 |
+
FROM $table_name
|
153 |
+
WHERE `option_name` LIKE ('%\_transient\_sbi\_%')
|
154 |
+
" );
|
155 |
+
$wpdb->query( "
|
156 |
+
DELETE
|
157 |
+
FROM $table_name
|
158 |
+
WHERE `option_name` LIKE ('%\_transient\_timeout\_sbi\_%')
|
159 |
+
" );
|
160 |
+
$wpdb->query( "
|
161 |
+
DELETE
|
162 |
+
FROM $table_name
|
163 |
+
WHERE `option_name` LIKE ('%\_transient\_&sbi\_%')
|
164 |
+
" );
|
165 |
+
$wpdb->query( "
|
166 |
+
DELETE
|
167 |
+
FROM $table_name
|
168 |
+
WHERE `option_name` LIKE ('%\_transient\_timeout\_&sbi\_%')
|
169 |
+
" );
|
170 |
} //End config tab post
|
171 |
|
172 |
if( isset($_POST[ $sb_instagram_customize_hidden_field ]) && $_POST[ $sb_instagram_customize_hidden_field ] == 'Y' ) {
|
224 |
//Misc
|
225 |
$sb_instagram_custom_css = $_POST[ 'sb_instagram_custom_css' ];
|
226 |
$sb_instagram_custom_js = $_POST[ 'sb_instagram_custom_js' ];
|
227 |
+
if (isset($_POST[ 'sb_instagram_cron' ]) ) $sb_instagram_cron = $_POST[ 'sb_instagram_cron' ];
|
228 |
+
isset($_POST[ 'check_api' ]) ? $check_api = $_POST[ 'check_api' ] : $check_api = '';
|
229 |
+
isset($_POST[ 'sb_instagram_backup' ]) ? $sb_instagram_backup = $_POST[ 'sb_instagram_backup' ] : $sb_instagram_backup = '';
|
230 |
+
isset($_POST[ 'sbi_font_method' ]) ? $sbi_font_method = $_POST[ 'sbi_font_method' ] : $sbi_font_method = 'svg';
|
231 |
+
isset($_POST[ 'sb_instagram_disable_awesome' ]) ? $sb_instagram_disable_awesome = sanitize_text_field( $_POST[ 'sb_instagram_disable_awesome' ] ) : $sb_instagram_disable_awesome = '';
|
232 |
|
233 |
$options[ 'sb_instagram_width' ] = $sb_instagram_width;
|
234 |
$options[ 'sb_instagram_width_unit' ] = $sb_instagram_width_unit;
|
259 |
//Misc
|
260 |
$options[ 'sb_instagram_custom_css' ] = $sb_instagram_custom_css;
|
261 |
$options[ 'sb_instagram_custom_js' ] = $sb_instagram_custom_js;
|
262 |
+
$options[ 'sb_instagram_cron' ] = $sb_instagram_cron;
|
263 |
+
$options[ 'check_api' ] = $check_api;
|
264 |
+
$options['sb_instagram_backup'] = $sb_instagram_backup;
|
265 |
+
$options['sbi_font_method'] = $sbi_font_method;
|
266 |
+
$options[ 'sb_instagram_disable_awesome' ] = $sb_instagram_disable_awesome;
|
267 |
+
|
268 |
+
//Delete all SBI transients
|
269 |
+
global $wpdb;
|
270 |
+
$table_name = $wpdb->prefix . "options";
|
271 |
+
$wpdb->query( "
|
272 |
+
DELETE
|
273 |
+
FROM $table_name
|
274 |
+
WHERE `option_name` LIKE ('%\_transient\_sbi\_%')
|
275 |
+
" );
|
276 |
+
$wpdb->query( "
|
277 |
+
DELETE
|
278 |
+
FROM $table_name
|
279 |
+
WHERE `option_name` LIKE ('%\_transient\_timeout\_sbi\_%')
|
280 |
+
" );
|
281 |
+
$wpdb->query( "
|
282 |
+
DELETE
|
283 |
+
FROM $table_name
|
284 |
+
WHERE `option_name` LIKE ('%\_transient\_&sbi\_%')
|
285 |
+
" );
|
286 |
+
$wpdb->query( "
|
287 |
+
DELETE
|
288 |
+
FROM $table_name
|
289 |
+
WHERE `option_name` LIKE ('%\_transient\_timeout\_&sbi\_%')
|
290 |
+
" );
|
291 |
+
|
292 |
+
if( $sb_instagram_cron == 'no' ) wp_clear_scheduled_hook('sb_instagram_cron_job');
|
293 |
+
|
294 |
+
//Run cron when Misc settings are saved
|
295 |
+
if( $sb_instagram_cron == 'yes' ){
|
296 |
+
//Clear the existing cron event
|
297 |
+
wp_clear_scheduled_hook('sb_instagram_cron_job');
|
298 |
+
|
299 |
+
$sb_instagram_cache_time = $options[ 'sb_instagram_cache_time' ];
|
300 |
+
$sb_instagram_cache_time_unit = $options[ 'sb_instagram_cache_time_unit' ];
|
301 |
+
|
302 |
+
//Set the event schedule based on what the caching time is set to
|
303 |
+
$sb_instagram_cron_schedule = 'hourly';
|
304 |
+
if( $sb_instagram_cache_time_unit == 'hours' && $sb_instagram_cache_time > 5 ) $sb_instagram_cron_schedule = 'twicedaily';
|
305 |
+
if( $sb_instagram_cache_time_unit == 'days' ) $sb_instagram_cron_schedule = 'daily';
|
306 |
+
|
307 |
+
wp_schedule_event(time(), $sb_instagram_cron_schedule, 'sb_instagram_cron_job');
|
308 |
+
|
309 |
+
sb_instagram_clear_page_caches();
|
310 |
+
}
|
311 |
|
312 |
} //End customize tab post
|
313 |
|
435 |
<p class="sbi_tooltip"><?php _e("When navigating your site, if your theme uses Ajax to load content into your pages (meaning your page doesn't refresh) then check this setting. If you're not sure then please check with the theme author.", 'instagram-feed'); ?></p>
|
436 |
</td>
|
437 |
</tr>
|
438 |
+
|
439 |
+
<tr valign="top">
|
440 |
+
<th scope="row"><label><?php _e('Check for new posts every'); ?></label></th>
|
441 |
+
<td>
|
442 |
+
<input name="sb_instagram_cache_time" type="text" value="<?php esc_attr_e( $sb_instagram_cache_time ); ?>" size="4" />
|
443 |
+
<select name="sb_instagram_cache_time_unit">
|
444 |
+
<option value="minutes" <?php if($sb_instagram_cache_time_unit == "minutes") echo 'selected="selected"' ?> ><?php _e('Minutes'); ?></option>
|
445 |
+
<option value="hours" <?php if($sb_instagram_cache_time_unit == "hours") echo 'selected="selected"' ?> ><?php _e('Hours'); ?></option>
|
446 |
+
<option value="days" <?php if($sb_instagram_cache_time_unit == "days") echo 'selected="selected"' ?> ><?php _e('Days'); ?></option>
|
447 |
+
</select>
|
448 |
+
<a class="sbi_tooltip_link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?></a>
|
449 |
+
<p class="sbi_tooltip"><?php _e('Your Instagram posts are temporarily cached by the plugin in your WordPress database. You can choose how long the posts should be cached for. If you set the time to 1 hour then the plugin will clear the cache after that length of time and check Instagram for posts again.'); ?></p>
|
450 |
+
</td>
|
451 |
+
</tr>
|
452 |
</tbody>
|
453 |
</table>
|
454 |
|
1176 |
</tr>
|
1177 |
</tbody>
|
1178 |
</table>
|
1179 |
+
<table class="form-table">
|
1180 |
+
<tbody>
|
1181 |
+
<tr valign="top">
|
1182 |
+
<th scope="row"><label><?php _e('Cache error API recheck'); ?></label></th>
|
1183 |
+
<td>
|
1184 |
+
<input type="checkbox" name="check_api" id="sb_instagram_check_api" <?php if($check_api == true) echo 'checked="checked"' ?> />
|
1185 |
+
<a class="sbi_tooltip_link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?></a>
|
1186 |
+
<p class="sbi_tooltip"><?php _e("If your site uses caching, minification, or JavaScript concatenation, this option can help prevent missing cache problems with the feed."); ?></p>
|
1187 |
+
</td>
|
1188 |
+
</tr>
|
1189 |
+
<tr valign="top">
|
1190 |
+
<th><label><?php _e("Enable Backup Caching"); ?></label></th>
|
1191 |
+
<td class="sbi-customize-tab-opt">
|
1192 |
+
<input name="sb_instagram_backup" type="checkbox" id="sb_instagram_backup" <?php if($sb_instagram_backup == true) echo "checked"; ?> />
|
1193 |
+
<input id="sbi_clear_backups" class="button-secondary" type="submit" style="position: relative; top: -4px;" value="<?php esc_attr_e( 'Clear Backup Cache' ); ?>" />
|
1194 |
+
<a class="sbi_tooltip_link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?></a>
|
1195 |
+
<p class="sbi_tooltip"><?php _e('Every feed will save a duplicate version of itself in the database to be used if the normal cache is not available.'); ?></p>
|
1196 |
+
</td>
|
1197 |
+
</tr>
|
1198 |
+
<tr>
|
1199 |
+
<th class="bump-left">
|
1200 |
+
<label for="sb_instagram_cron" class="bump-left"><?php _e("Force cache to clear on interval"); ?></label>
|
1201 |
+
</th>
|
1202 |
+
<td>
|
1203 |
+
<select name="sb_instagram_cron">
|
1204 |
+
<option value="unset" <?php if($sb_instagram_cron == "unset") echo 'selected="selected"' ?> ><?php _e(' - '); ?></option>
|
1205 |
+
<option value="yes" <?php if($sb_instagram_cron == "yes") echo 'selected="selected"' ?> ><?php _e('Yes'); ?></option>
|
1206 |
+
<option value="no" <?php if($sb_instagram_cron == "no") echo 'selected="selected"' ?> ><?php _e('No'); ?></option>
|
1207 |
+
</select>
|
1208 |
+
|
1209 |
+
<a class="sbi_tooltip_link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?></a>
|
1210 |
+
<p class="sbi_tooltip"><?php _e("If you're experiencing an issue with the plugin not auto-updating then you can set this to 'Yes' to run a scheduled event behind the scenes which forces the plugin cache to clear on a regular basis and retrieve new data from Instagram."); ?></p>
|
1211 |
+
</td>
|
1212 |
+
</tr>
|
1213 |
+
</tbody>
|
1214 |
+
</table>
|
1215 |
<table class="form-table">
|
1216 |
<tbody>
|
1217 |
<tr valign="top">
|
1218 |
+
<th scope="row"><label><?php _e("Disable Icon Font", 'instagram-feed'); ?></label></th>
|
1219 |
<td>
|
1220 |
<input type="checkbox" name="sb_instagram_disable_awesome" id="sb_instagram_disable_awesome" <?php if($sb_instagram_disable_awesome == true) echo 'checked="checked"' ?> /> <?php _e( 'Yes', 'instagram-feed' ); ?>
|
1221 |
</td>
|
1222 |
</tr>
|
1223 |
+
<tr>
|
1224 |
+
<th scope="row"><label for="sbi_font_method"><?php _e("Icon Method"); ?></label></th>
|
1225 |
+
<td>
|
1226 |
+
<select name="sbi_font_method" id="sbi_font_method" class="default-text">
|
1227 |
+
<option value="svg" id="sbi-font_method" class="default-text" <?php if($sbi_font_method == 'svg') echo 'selected="selected"' ?>>SVG</option>
|
1228 |
+
<option value="fontfile" id="sbi-font_method" class="default-text" <?php if($sbi_font_method == 'fontfile') echo 'selected="selected"' ?>><?php _e("Font File"); ?></option>
|
1229 |
+
</select>
|
1230 |
+
<a class="sbi_tooltip_link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?></a>
|
1231 |
+
<p class="sbi_tooltip"><?php _e("This plugin uses SVGs for all icons in the feed. Use this setting to switch to font icons."); ?></p>
|
1232 |
+
</td>
|
1233 |
+
</tr>
|
1234 |
</tbody>
|
1235 |
</table>
|
1236 |
|
1837 |
|
1838 |
}
|
1839 |
}
|
1840 |
+
function sb_instagram_clear_page_caches() {
|
1841 |
+
if ( isset( $GLOBALS['wp_fastest_cache'] ) && method_exists( $GLOBALS['wp_fastest_cache'], 'deleteCache' ) ){
|
1842 |
+
/* Clear WP fastest cache*/
|
1843 |
+
$GLOBALS['wp_fastest_cache']->deleteCache();
|
1844 |
+
}
|
1845 |
+
|
1846 |
+
if ( function_exists( 'wp_cache_clear_cache' ) ) {
|
1847 |
+
wp_cache_clear_cache();
|
1848 |
+
}
|
1849 |
+
|
1850 |
+
if ( class_exists('W3_Plugin_TotalCacheAdmin') ) {
|
1851 |
+
$plugin_totalcacheadmin = & w3_instance('W3_Plugin_TotalCacheAdmin');
|
1852 |
+
|
1853 |
+
$plugin_totalcacheadmin->flush_all();
|
1854 |
+
}
|
1855 |
+
|
1856 |
+
if ( class_exists( 'autoptimizeCache' ) ) {
|
1857 |
+
/* Clear autoptimize */
|
1858 |
+
autoptimizeCache::clearall();
|
1859 |
+
}
|
1860 |
+
}
|
1861 |
/**
|
1862 |
* Called via ajax to automatically save access token and access token secret
|
1863 |
* retrieved with the big blue button
|
instagram-feed.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Instagram Feed
|
4 |
Plugin URI: https://smashballoon.com/instagram-feed
|
5 |
Description: Display beautifully clean, customizable, and responsive Instagram feeds
|
6 |
-
Version: 1.
|
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 |
|
26 |
-
define( 'SBIVER', '1.
|
27 |
|
28 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
|
@@ -67,7 +67,9 @@ function display_instagram($atts, $content = null) {
|
|
67 |
'showbio' => isset($options[ 'sb_instagram_show_bio' ]) ? $options[ 'sb_instagram_show_bio' ] : '',
|
68 |
'headercolor' => isset($options[ 'sb_instagram_header_color' ]) ? $options[ 'sb_instagram_header_color' ] : '',
|
69 |
'class' => '',
|
70 |
-
'ajaxtheme' => isset($options[ 'sb_instagram_ajax_theme' ]) ? $options[ 'sb_instagram_ajax_theme' ] : ''
|
|
|
|
|
71 |
), $atts);
|
72 |
|
73 |
|
@@ -113,6 +115,9 @@ function display_instagram($atts, $content = null) {
|
|
113 |
if( $atts[ 'showheader' ] === 'false' ) $sb_instagram_show_header = false;
|
114 |
$sb_instagram_header_color = str_replace('#', '', $atts['headercolor']);
|
115 |
|
|
|
|
|
|
|
116 |
$sb_instagram_show_bio = $atts['showbio'];
|
117 |
( $sb_instagram_show_bio == 'on' || $sb_instagram_show_bio == 'true' || $sb_instagram_show_bio ) ? $sb_instagram_show_bio = 'true' : $sb_instagram_show_bio = 'false';
|
118 |
if( $atts[ 'showbio' ] === 'false' ) $sb_instagram_show_bio = false;
|
@@ -121,8 +126,6 @@ function display_instagram($atts, $content = null) {
|
|
121 |
$sb_instagram_follow_btn_text = __( $atts['followtext'], 'instagram-feed' );
|
122 |
$sb_instagram_load_btn_text = __( $atts['buttontext'], 'instagram-feed' );
|
123 |
|
124 |
-
//As this is a new option in the update then set it to be true if it doesn't exist yet
|
125 |
-
if ( !array_key_exists( 'sb_instagram_show_bio', $options ) ) $sb_instagram_show_bio = 'true';
|
126 |
//Load more button
|
127 |
$sb_instagram_show_btn = $atts['showbutton'];
|
128 |
( $sb_instagram_show_btn == 'on' || $sb_instagram_show_btn == 'true' || $sb_instagram_show_btn == true ) ? $sb_instagram_show_btn = true : $sb_instagram_show_btn = false;
|
@@ -147,14 +150,104 @@ function display_instagram($atts, $content = null) {
|
|
147 |
if ( !empty($sb_instagram_follow_btn_text_color) ) $sb_instagram_follow_btn_styles .= 'color: #'.$sb_instagram_follow_btn_text_color.';';
|
148 |
$sb_instagram_follow_btn_styles .= '"';
|
149 |
//Follow button HTML
|
150 |
-
$sb_instagram_follow_btn_html = '<div class="sbi_follow_btn"><a href="https://instagram.com/" '.$sb_instagram_follow_btn_styles.' target="_blank"><i class="fa fab fa-instagram"></i>'.esc_html( stripslashes( $sb_instagram_follow_btn_text ) ).'</a></div>';
|
151 |
-
|
152 |
|
153 |
//Mobile
|
154 |
$sb_instagram_disable_mobile = $atts['disablemobile'];
|
155 |
-
( $sb_instagram_disable_mobile == 'on' || $sb_instagram_disable_mobile == 'true' || $sb_instagram_disable_mobile == true ) ? $sb_instagram_disable_mobile = ' sbi_disable_mobile' : $sb_instagram_disable_mobile = '';
|
156 |
-
if( $atts[ 'disablemobile' ] === 'false' ) $sb_instagram_disable_mobile = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
//Class
|
159 |
!empty( $atts['class'] ) ? $sbi_class = ' ' . trim($atts['class']) : $sbi_class = '';
|
160 |
|
@@ -170,7 +263,7 @@ function display_instagram($atts, $content = null) {
|
|
170 |
if ( !empty($sb_instagram_height) ) $sb_instagram_content .= ' sbi_fixed_height ';
|
171 |
$sb_instagram_content .= ' sbi_col_' . trim($sb_instagram_cols);
|
172 |
if ( $sb_instagram_width_resp ) $sb_instagram_content .= ' sbi_width_resp';
|
173 |
-
$sb_instagram_content .= '" '.$sb_instagram_styles .' data-id="' . $sb_instagram_user_id . '" data-num="' . trim($atts['num']) . '" data-res="' . trim($atts['imageres']) . '" data-cols="' . trim($sb_instagram_cols) . '" data-options=\'{"sortby": "'.$atts['sortby'].'", "showbio": "'.$sb_instagram_show_bio.'", "headercolor": "'.$sb_instagram_header_color.'", "imagepadding": "'.$sb_instagram_image_padding.'"}\'>';
|
174 |
|
175 |
//Header
|
176 |
if( $sb_instagram_show_header ) $sb_instagram_content .= '<div class="sb_instagram_header" style="padding: '.(2*intval($sb_instagram_image_padding)) . $sb_instagram_image_padding_unit .'; padding-bottom: 0;"></div>';
|
@@ -226,6 +319,229 @@ function display_instagram($atts, $content = null) {
|
|
226 |
//Allows shortcodes in theme
|
227 |
add_filter('widget_text', 'do_shortcode');
|
228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
//Enqueue stylesheet
|
230 |
add_action( 'wp_enqueue_scripts', 'sb_instagram_styles_enqueue' );
|
231 |
function sb_instagram_styles_enqueue() {
|
@@ -250,9 +566,15 @@ function sb_instagram_scripts_enqueue() {
|
|
250 |
|
251 |
//Access token
|
252 |
isset($sb_instagram_settings[ 'sb_instagram_at' ]) ? $sb_instagram_at = trim($sb_instagram_settings['sb_instagram_at']) : $sb_instagram_at = '';
|
|
|
|
|
253 |
|
|
|
|
|
|
|
254 |
$data = array(
|
255 |
-
'sb_instagram_at' => $sb_instagram_at
|
|
|
256 |
);
|
257 |
|
258 |
isset($sb_instagram_settings[ 'sb_instagram_ajax_theme' ]) ? $sb_instagram_ajax_theme = trim($sb_instagram_settings['sb_instagram_ajax_theme']) : $sb_instagram_ajax_theme = '';
|
@@ -286,7 +608,7 @@ function sb_instagram_custom_css() {
|
|
286 |
|
287 |
if( current_user_can( 'manage_options' ) ){
|
288 |
echo "\r\n";
|
289 |
-
echo "#sbi_mod_error{ display: block; }";
|
290 |
}
|
291 |
|
292 |
if( $sbi_show_css ) echo "\r\n";
|
@@ -298,25 +620,30 @@ function sb_instagram_custom_css() {
|
|
298 |
//Custom JS
|
299 |
add_action( 'wp_footer', 'sb_instagram_custom_js' );
|
300 |
function sb_instagram_custom_js() {
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
|
|
|
|
320 |
}
|
321 |
|
322 |
if ( ! function_exists( 'sb_remove_style_version' ) ) {
|
@@ -362,5 +689,23 @@ function sb_instagram_uninstall()
|
|
362 |
|
363 |
//Settings
|
364 |
delete_option( 'sb_instagram_settings' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
}
|
366 |
register_uninstall_hook( __FILE__, 'sb_instagram_uninstall' );
|
3 |
Plugin Name: Instagram Feed
|
4 |
Plugin URI: https://smashballoon.com/instagram-feed
|
5 |
Description: Display beautifully clean, customizable, and responsive Instagram feeds
|
6 |
+
Version: 1.7
|
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 |
|
26 |
+
define( 'SBIVER', '1.7' );
|
27 |
|
28 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
|
67 |
'showbio' => isset($options[ 'sb_instagram_show_bio' ]) ? $options[ 'sb_instagram_show_bio' ] : '',
|
68 |
'headercolor' => isset($options[ 'sb_instagram_header_color' ]) ? $options[ 'sb_instagram_header_color' ] : '',
|
69 |
'class' => '',
|
70 |
+
'ajaxtheme' => isset($options[ 'sb_instagram_ajax_theme' ]) ? $options[ 'sb_instagram_ajax_theme' ] : '',
|
71 |
+
'cachetime' => isset($options[ 'sb_instagram_cache_time' ]) ? $options[ 'sb_instagram_cache_time' ] : '',
|
72 |
+
'media' => isset($options[ 'sb_instagram_media_type' ]) ? $options[ 'sb_instagram_media_type' ] : ''
|
73 |
), $atts);
|
74 |
|
75 |
|
115 |
if( $atts[ 'showheader' ] === 'false' ) $sb_instagram_show_header = false;
|
116 |
$sb_instagram_header_color = str_replace('#', '', $atts['headercolor']);
|
117 |
|
118 |
+
//As this is a new option in the update then set it to be true if it doesn't exist yet
|
119 |
+
if ( !array_key_exists( 'sb_instagram_show_bio', $options ) ) $sb_instagram_show_bio = 'true';
|
120 |
+
|
121 |
$sb_instagram_show_bio = $atts['showbio'];
|
122 |
( $sb_instagram_show_bio == 'on' || $sb_instagram_show_bio == 'true' || $sb_instagram_show_bio ) ? $sb_instagram_show_bio = 'true' : $sb_instagram_show_bio = 'false';
|
123 |
if( $atts[ 'showbio' ] === 'false' ) $sb_instagram_show_bio = false;
|
126 |
$sb_instagram_follow_btn_text = __( $atts['followtext'], 'instagram-feed' );
|
127 |
$sb_instagram_load_btn_text = __( $atts['buttontext'], 'instagram-feed' );
|
128 |
|
|
|
|
|
129 |
//Load more button
|
130 |
$sb_instagram_show_btn = $atts['showbutton'];
|
131 |
( $sb_instagram_show_btn == 'on' || $sb_instagram_show_btn == 'true' || $sb_instagram_show_btn == true ) ? $sb_instagram_show_btn = true : $sb_instagram_show_btn = false;
|
150 |
if ( !empty($sb_instagram_follow_btn_text_color) ) $sb_instagram_follow_btn_styles .= 'color: #'.$sb_instagram_follow_btn_text_color.';';
|
151 |
$sb_instagram_follow_btn_styles .= '"';
|
152 |
//Follow button HTML
|
153 |
+
$sb_instagram_follow_btn_html = '<div class="sbi_follow_btn"><a href="https://www.instagram.com/" '.$sb_instagram_follow_btn_styles.' target="_blank"><i class="fa fab fa-instagram"></i>'.esc_html( stripslashes( $sb_instagram_follow_btn_text ) ).'</a></div>';
|
|
|
154 |
|
155 |
//Mobile
|
156 |
$sb_instagram_disable_mobile = $atts['disablemobile'];
|
157 |
+
( $sb_instagram_disable_mobile == 'on' || $sb_instagram_disable_mobile == 'true' || $sb_instagram_disable_mobile == true ) ? $sb_instagram_disable_mobile = ' sbi_disable_mobile' : $sb_instagram_disable_mobile = ' sbi_mob_col_auto';
|
158 |
+
if( $atts[ 'disablemobile' ] === 'false' ) $sb_instagram_disable_mobile = ' sbi_mob_col_auto';
|
159 |
+
|
160 |
+
//Caching
|
161 |
+
$sb_instagram_cache_time = trim($atts['cachetime']);
|
162 |
+
if ( !array_key_exists( 'sb_instagram_cache_time', $options ) || $sb_instagram_cache_time == '' ) $sb_instagram_cache_time = '1';
|
163 |
+
($sb_instagram_cache_time == 0 || $sb_instagram_cache_time == '0') ? $sb_instagram_disable_cache = 'true' : $sb_instagram_disable_cache = 'false';
|
164 |
+
//Figure out how long the first part of the caching string should be
|
165 |
+
$sbi_cache_string_include_length = 0;
|
166 |
+
$sbi_cache_string_exclude_length = 0;
|
167 |
+
$sbi_cache_string_length = 40 - min($sbi_cache_string_include_length + $sbi_cache_string_exclude_length, 20);
|
168 |
+
|
169 |
+
//Create the first part of the caching string
|
170 |
+
$sbi_transient_name = 'sbi_';
|
171 |
+
$sb_instagram_white_list = '';
|
172 |
+
$sb_instagram_show_users = '';
|
173 |
+
$sbi_transient_name .= substr( $sb_instagram_white_list, 0, 3 ) . substr( $sb_instagram_show_users, 0, 3 );
|
174 |
+
|
175 |
+
$feed_is_filtered = ($sb_instagram_white_list !== '' || $sb_instagram_show_users !== '');
|
176 |
+
//Media type
|
177 |
+
$sb_instagram_media_type = $atts['media'];
|
178 |
+
if( !isset($sb_instagram_media_type) || empty($sb_instagram_media_type) ) $sb_instagram_media_type = 'all';
|
179 |
+
|
180 |
+
if ( $sb_instagram_media_type !== 'all' ) {
|
181 |
+
$sbi_transient_name .= substr( $sb_instagram_media_type, 0, 1 );
|
182 |
+
}
|
183 |
+
if( true ) $sbi_transient_name .= substr( str_replace(str_split(', '), '', $sb_instagram_user_id), 0, $sbi_cache_string_length); //Remove commas and spaces and limit chars
|
184 |
+
|
185 |
+
//Find the length of the string so far, and then however many chars are left we can use this for filters
|
186 |
+
$sbi_cache_string_length = strlen($sbi_transient_name);
|
187 |
+
$sbi_cache_string_length = 44 - intval($sbi_cache_string_length);
|
188 |
+
|
189 |
+
//Add both parts of the caching string together and make sure it doesn't exceed 45
|
190 |
+
$sbi_transient_name = substr($sbi_transient_name, 0, 45);
|
191 |
+
// delete_transient($sbi_transient_name);
|
192 |
+
|
193 |
+
//Check whether the cache transient exists in the database
|
194 |
+
( false === ( $sbi_cache_exists = get_transient( $sbi_transient_name ) ) ) ? $sbi_cache_exists = false : $sbi_cache_exists = true;
|
195 |
+
($sbi_cache_exists) ? $sbi_cache_exists = 'true' : $sbi_cache_exists = 'false';
|
196 |
+
|
197 |
+
$sbiHeaderCache = 'false';
|
198 |
+
//If it's a user then add the header cache check to the feed
|
199 |
+
$sb_instagram_user_id_arr = explode(',', $sb_instagram_user_id);
|
200 |
+
$sbi_header_transient_name = 'sbi_header_' . trim($sb_instagram_user_id_arr[0]);
|
201 |
+
$sbi_header_transient_name = substr($sbi_header_transient_name, 0, 45);
|
202 |
+
|
203 |
+
//Check for the header cache
|
204 |
+
( false === ( $sbi_header_cache_exists = get_transient( $sbi_header_transient_name ) ) ) ? $sbi_header_cache_exists = false : $sbi_header_cache_exists = true;
|
205 |
|
206 |
+
($sbi_header_cache_exists) ? $sbiHeaderCache = 'true' : $sbiHeaderCache = 'false';
|
207 |
+
|
208 |
+
if ( isset( $options['check_api'] ) && ( $options['check_api'] === 'on' || $options['check_api']) && ( !isset( $options['sb_instagram_cache_time'] ) || ( isset( $options['sb_instagram_cache_time'] ) && (int)$options['sb_instagram_cache_time'] > 0 ) ) ) {
|
209 |
+
$sbi_cache_exists = 'true';
|
210 |
+
$sbiHeaderCache = 'true';
|
211 |
+
}
|
212 |
+
|
213 |
+
$use_backup_json = '';
|
214 |
+
$use_header_backup = false;
|
215 |
+
$always_use_backup = isset( $atts['permanent'] ) ? ($atts['permanent'] === 'true') : false;
|
216 |
+
$backups_enabled = isset( $options['sb_instagram_backup'] ) ? $options['sb_instagram_backup'] !== '' : true;
|
217 |
+
if ( !$always_use_backup ) {
|
218 |
+
$always_use_backup = false;
|
219 |
+
}
|
220 |
+
$still_using_backup = false;
|
221 |
+
if ( $sbiHeaderCache == 'false' && true ) {
|
222 |
+
$still_using_backup = get_transient( '&'.$sbi_header_transient_name, false );
|
223 |
+
}
|
224 |
+
|
225 |
+
if ( ($sbiHeaderCache == 'false' && $still_using_backup) || ($always_use_backup && isset( $sbi_header_transient_name )) ) {
|
226 |
+
$use_header_backup = sbi_should_use_backup_cache( $options['sb_instagram_at'], $sbi_header_transient_name, $feed_is_filtered, $always_use_backup, $sb_instagram_white_list, $backups_enabled);
|
227 |
+
if ( $use_header_backup ) {
|
228 |
+
$sbiHeaderCache = 'true';
|
229 |
+
$use_backup_json = ', "useBackup": "header"';
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
$still_using_backup = false;
|
234 |
+
if ( $sbi_cache_exists == 'false' ) {
|
235 |
+
$still_using_backup = get_transient( '&'.$sbi_transient_name, false );
|
236 |
+
}
|
237 |
+
if ( ($sbi_cache_exists == 'false' && $still_using_backup) || $always_use_backup ) {
|
238 |
+
$use_feed_backup = sbi_should_use_backup_cache( $options['sb_instagram_at'], $sbi_transient_name, $feed_is_filtered, $always_use_backup, $sb_instagram_white_list, $backups_enabled );
|
239 |
+
|
240 |
+
if ( $use_feed_backup ) {
|
241 |
+
$sbi_cache_exists = 'true';
|
242 |
+
if ( $use_header_backup ) {
|
243 |
+
$use_backup_json = ', "useBackup": "header,feed"';
|
244 |
+
} else {
|
245 |
+
$use_backup_json = ', "useBackup": "feed"';
|
246 |
+
}
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
/* END CACHING */
|
251 |
//Class
|
252 |
!empty( $atts['class'] ) ? $sbi_class = ' ' . trim($atts['class']) : $sbi_class = '';
|
253 |
|
263 |
if ( !empty($sb_instagram_height) ) $sb_instagram_content .= ' sbi_fixed_height ';
|
264 |
$sb_instagram_content .= ' sbi_col_' . trim($sb_instagram_cols);
|
265 |
if ( $sb_instagram_width_resp ) $sb_instagram_content .= ' sbi_width_resp';
|
266 |
+
$sb_instagram_content .= '" '.$sb_instagram_styles .' data-id="' . $sb_instagram_user_id . '" data-num="' . trim($atts['num']) . '" data-res="' . trim($atts['imageres']) . '" data-cols="' . trim($sb_instagram_cols) . '" data-options=\'{"sortby": "'.$atts['sortby'].'", "showbio": "'.$sb_instagram_show_bio.'", "headercolor": "'.$sb_instagram_header_color.'", "imagepadding": "'.$sb_instagram_image_padding.'", "disablecache": "'.$sb_instagram_disable_cache.'", "sbiCacheExists": "'.$sbi_cache_exists.'", "sbiHeaderCache": "'.$sbiHeaderCache.'"'.$use_backup_json.'}\'>';
|
267 |
|
268 |
//Header
|
269 |
if( $sb_instagram_show_header ) $sb_instagram_content .= '<div class="sb_instagram_header" style="padding: '.(2*intval($sb_instagram_image_padding)) . $sb_instagram_image_padding_unit .'; padding-bottom: 0;"></div>';
|
319 |
//Allows shortcodes in theme
|
320 |
add_filter('widget_text', 'do_shortcode');
|
321 |
|
322 |
+
function sbi_should_use_backup_cache( $token, $cache_name, $is_filtered, $always_use_backup = false, $white_list_id = '', $backups_enabled = true ) {
|
323 |
+
if ( ! $backups_enabled ) {
|
324 |
+
return false;
|
325 |
+
}
|
326 |
+
|
327 |
+
$expired_tokens = get_option( 'sb_expired_tokens', array() );
|
328 |
+
$still_using_backup = get_transient( '&'.$cache_name, false );
|
329 |
+
$backup_cache_exists = get_option( '!' . $cache_name );
|
330 |
+
$white_list_updated = get_transient( 'sb_wlupdated_'.$white_list_id );
|
331 |
+
|
332 |
+
if ( $always_use_backup ) {
|
333 |
+
if ( !$backup_cache_exists || $white_list_updated ) {
|
334 |
+
return false;
|
335 |
+
}
|
336 |
+
return true;
|
337 |
+
} elseif ( $white_list_updated == 'true' ) {
|
338 |
+
return false;
|
339 |
+
}
|
340 |
+
|
341 |
+
if ( in_array( $token, $expired_tokens, true ) && $backup_cache_exists ) {
|
342 |
+
|
343 |
+
if ( !strpos( $cache_name, '_header' ) ) {
|
344 |
+
echo '<div id="sbi_mod_error">';
|
345 |
+
echo '<p><b>' . __( 'Error: Access Token is not valid or has expired.', 'instagram-feed' ) . ' ' . __( 'Feed will not update.', 'instagram-feed' ) . '</b><br /><span>' . __(' This error message is only visible to WordPress admins</span>', 'instagram-feed' );
|
346 |
+
echo '<p>' . __( 'There\'s an issue with the Instagram Access Token that you are using. Please obtain a new Access Token on the plugin\'s Settings page.<br />If you continue to have an issue with your Access Token then please see <a href="https://smashballoon.com/my-instagram-access-token-keep-expiring/" target="_blank">this FAQ</a> for more information.', 'instagram-feed' );
|
347 |
+
echo '</div>';
|
348 |
+
}
|
349 |
+
|
350 |
+
return true;
|
351 |
+
} elseif ( $still_using_backup && $backup_cache_exists ) {
|
352 |
+
return true;
|
353 |
+
}
|
354 |
+
|
355 |
+
return false;
|
356 |
+
}
|
357 |
+
|
358 |
+
function sbi_cache_photos() {
|
359 |
+
$sb_instagram_settings = get_option('sb_instagram_settings');
|
360 |
+
|
361 |
+
//If the caching time doesn't exist in the database then set it to be 1 hour
|
362 |
+
( !array_key_exists( 'sb_instagram_cache_time', $sb_instagram_settings ) ) ? $sb_instagram_cache_time = 1 : $sb_instagram_cache_time = $sb_instagram_settings['sb_instagram_cache_time'];
|
363 |
+
( !array_key_exists( 'sb_instagram_cache_time_unit', $sb_instagram_settings ) ) ? $sb_instagram_cache_time_unit = 'minutes' : $sb_instagram_cache_time_unit = $sb_instagram_settings['sb_instagram_cache_time_unit'];
|
364 |
+
|
365 |
+
//Calculate the cache time in seconds
|
366 |
+
if($sb_instagram_cache_time_unit == 'minutes') $sb_instagram_cache_time_unit = 60;
|
367 |
+
if($sb_instagram_cache_time_unit == 'hours') $sb_instagram_cache_time_unit = 60*60;
|
368 |
+
if($sb_instagram_cache_time_unit == 'days') $sb_instagram_cache_time_unit = 60*60*24;
|
369 |
+
$cache_seconds = intval($sb_instagram_cache_time) * intval($sb_instagram_cache_time_unit);
|
370 |
+
|
371 |
+
$transient_name = $_POST['transientName'];
|
372 |
+
if ( is_array( $transient_name ) ) {
|
373 |
+
$transient_name = isset( $transient_name['feed'] ) ? sanitize_text_field( $transient_name['feed'] ) : 'sbi_other';
|
374 |
+
}
|
375 |
+
|
376 |
+
if ( strpos( $_POST['photos'], "%7B%22" ) === 0
|
377 |
+
&& ( strpos( "%22standard_resolution%22", $_POST['photos'] ) && strpos( "%22https://scontent.cdninstagram.com", $_POST['photos'] ) || ! strpos( "%22standard_resolution%22", $_POST['photos'] ) ) ) {
|
378 |
+
|
379 |
+
$stripped_json_string = wp_strip_all_tags( $_POST['photos'] );
|
380 |
+
set_transient( $transient_name, $stripped_json_string, $cache_seconds );
|
381 |
+
|
382 |
+
$backups_enabled = isset( $sb_instagram_settings['sb_instagram_backup'] ) ? $sb_instagram_settings['sb_instagram_backup'] !== '' : true;
|
383 |
+
|
384 |
+
if ( $backups_enabled ) {
|
385 |
+
if ( strlen( $stripped_json_string ) > 1999 && strpos( $transient_name, 'sbi_header_' ) !== 0 ) {
|
386 |
+
update_option( '!'.$transient_name, $stripped_json_string, false );
|
387 |
+
} elseif ( strpos( $transient_name, 'sbi_header_' ) === 0 ) {
|
388 |
+
update_option( '!'.$transient_name, $stripped_json_string, false );
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
}
|
393 |
+
|
394 |
+
if ( strlen( $stripped_json_string ) < 2000 && strpos( $transient_name, 'sbi_header_' ) !== 0 && get_option( '!'.$transient_name ) ) {
|
395 |
+
echo 'too much filtering';
|
396 |
+
}
|
397 |
+
|
398 |
+
}
|
399 |
+
add_action('wp_ajax_cache_photos', 'sbi_cache_photos');
|
400 |
+
add_action('wp_ajax_nopriv_cache_photos', 'sbi_cache_photos');
|
401 |
+
|
402 |
+
function sbi_set_expired_token() {
|
403 |
+
$access_token = isset( $_POST['access_token'] ) ? sanitize_text_field( $_POST['access_token'] ) : false;
|
404 |
+
|
405 |
+
if ( $access_token !== false ) {
|
406 |
+
$expired_tokens = get_option( 'sb_expired_tokens', array() );
|
407 |
+
$expired_tokens[] = $access_token;
|
408 |
+
|
409 |
+
update_option( 'sb_expired_tokens', $expired_tokens, false );
|
410 |
+
sbi_set_use_backup();
|
411 |
+
}
|
412 |
+
|
413 |
+
die();
|
414 |
+
}
|
415 |
+
add_action('wp_ajax_sbi_set_expired_token', 'sbi_set_expired_token');
|
416 |
+
add_action('wp_ajax_nopriv_sbi_set_expired_token', 'sbi_set_expired_token');
|
417 |
+
|
418 |
+
function sbi_set_use_backup() {
|
419 |
+
$sb_instagram_settings = get_option('sb_instagram_settings');
|
420 |
+
$backups_enabled = isset( $sb_instagram_settings['sb_instagram_backup'] ) ? $sb_instagram_settings['sb_instagram_backup'] !== '' : true;
|
421 |
+
$context = isset( $_POST['context'] ) ? sanitize_text_field( $_POST['context'] ) : 'use_backup';
|
422 |
+
|
423 |
+
if ( $backups_enabled ) {
|
424 |
+
$transient_name = $_POST['transientName'];
|
425 |
+
|
426 |
+
if ( is_array( $transient_name ) ) {
|
427 |
+
$transient_name = isset( $transient_name['feed'] ) ? sanitize_text_field( $transient_name['feed'] ) : 'sbi_other';
|
428 |
+
}
|
429 |
+
$backup_exists = get_option( '!' . $transient_name, false );
|
430 |
+
|
431 |
+
if ( ! get_transient( '&' . $transient_name ) && $backup_exists !== false ) {
|
432 |
+
set_transient( '&' . $transient_name, $context, 86400 );
|
433 |
+
}
|
434 |
+
|
435 |
+
}
|
436 |
+
|
437 |
+
die();
|
438 |
+
}
|
439 |
+
add_action('wp_ajax_sbi_set_use_backup', 'sbi_set_use_backup');
|
440 |
+
add_action('wp_ajax_nopriv_sbi_set_use_backup', 'sbi_set_use_backup');
|
441 |
+
|
442 |
+
function sbi_encode_uri( $uri )
|
443 |
+
{
|
444 |
+
$unescaped = array(
|
445 |
+
'%2D'=>'-','%5F'=>'_','%2E'=>'.','%21'=>'!', '%7E'=>'~',
|
446 |
+
'%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')'
|
447 |
+
);
|
448 |
+
$reserved = array(
|
449 |
+
'%3B'=>';','%2C'=>',','%2F'=>'/','%3F'=>'?','%3A'=>':',
|
450 |
+
'%40'=>'@','%26'=>'&','%3D'=>'=','%2B'=>'+','%24'=>'$'
|
451 |
+
);
|
452 |
+
$score = array(
|
453 |
+
'%23'=>'#'
|
454 |
+
);
|
455 |
+
|
456 |
+
return strtr( rawurlencode( $uri ), array_merge( $reserved,$unescaped,$score ) );
|
457 |
+
}
|
458 |
+
|
459 |
+
function sbi_get_cache() {
|
460 |
+
$options = get_option( 'sb_instagram_settings' );
|
461 |
+
|
462 |
+
$transient_names = json_decode(str_replace( array( '\"', "\\'" ), array( '"', "'" ), sanitize_text_field( $_POST['transientName'] ) ), true);
|
463 |
+
$header_cache_data_transient_data = get_transient( $transient_names['header'] );
|
464 |
+
$should_use_backup_header = isset( $_POST['useBackupHeader'] ) && sanitize_text_field( $_POST['useBackupHeader'] ) == 'true' ? true : false;
|
465 |
+
$should_use_backup_feed = isset( $_POST['useBackupFeed'] ) && sanitize_text_field( $_POST['useBackupFeed'] ) == 'true' ? true : false;
|
466 |
+
$feed_cache_transient_data = get_transient( $transient_names['feed'] );
|
467 |
+
$warning_message_data = '';
|
468 |
+
|
469 |
+
if ( ! empty( $feed_cache_transient_data ) ) {
|
470 |
+
$feed_cache_data = $feed_cache_transient_data;
|
471 |
+
} elseif ( isset( $options['check_api'] ) && $options['check_api'] === 'on' || $options['check_api'] ) {
|
472 |
+
$feed_cache_data = '{%22error%22:%22tryfetch%22}';
|
473 |
+
} else {
|
474 |
+
$feed_cache_data = '{%22error%22:%22nocache%22}';
|
475 |
+
}
|
476 |
+
|
477 |
+
if ( $transient_names['comments'] === 'need' ) {
|
478 |
+
$comment_cache_data = get_transient( 'sbinst_comment_cache' );
|
479 |
+
$comment_cache_data = ! empty( $comment_cache_data ) ? sbi_encode_uri( $comment_cache_data ) : '{%22error%22:%22nocache%22}';
|
480 |
+
} else {
|
481 |
+
$comment_cache_data = '{%22error%22:%22nocache%22}';
|
482 |
+
}
|
483 |
+
|
484 |
+
// maybe use backup cache
|
485 |
+
$still_using_backup = get_transient( '&'.$transient_names['feed'], false );
|
486 |
+
$doing_tryfetch = (isset( $options['check_api'] ) && $options['check_api'] === 'on' || $options['check_api']);
|
487 |
+
if ( ! empty( $header_cache_data_transient_data ) ) {
|
488 |
+
$header_cache_data = $header_cache_data_transient_data;
|
489 |
+
} elseif ( $doing_tryfetch ) {
|
490 |
+
$header_cache_data = '{%22error%22:%22tryfetch%22}';
|
491 |
+
} elseif ( empty( $header_cache_data_transient_data ) || $still_using_backup ) {
|
492 |
+
$backup_header_cache = get_option( '!' . $transient_names['header'] );
|
493 |
+
$header_cache_data = ! empty( $backup_header_cache ) ? $backup_header_cache : '{%22error%22:%22nocache%22}';
|
494 |
+
if ( $still_using_backup === 'falsecache' ) {
|
495 |
+
$warning_message_data = ',%22warning%22:{%22warning%22:%22falsecache%22}';
|
496 |
+
}
|
497 |
+
} else {
|
498 |
+
$header_cache_data = ! empty( $header_cache_data ) ? $header_cache_data : '{%22error%22:%22nocache%22}';
|
499 |
+
}
|
500 |
+
|
501 |
+
// maybe use backup cache
|
502 |
+
if ( (empty( $feed_cache_transient_data ) && $should_use_backup_feed) || $still_using_backup ) {
|
503 |
+
$backup_feed_cache = get_option( '!' . $transient_names['feed'] );
|
504 |
+
$feed_cache_data = ! empty( $backup_feed_cache ) ? $backup_feed_cache : $feed_cache_data;
|
505 |
+
if ( $still_using_backup === 'falsecache' ) {
|
506 |
+
$warning_message_data = ',%22warning%22:{%22warning%22:%22falsecache%22}';
|
507 |
+
}
|
508 |
+
}
|
509 |
+
|
510 |
+
$data = '{%22header%22:' . $header_cache_data .',%22feed%22:' . $feed_cache_data . ',%22comments%22:' . $comment_cache_data . $warning_message_data . '}';
|
511 |
+
|
512 |
+
echo $data;
|
513 |
+
|
514 |
+
die();
|
515 |
+
}
|
516 |
+
add_action('wp_ajax_get_cache', 'sbi_get_cache');
|
517 |
+
add_action('wp_ajax_nopriv_get_cache', 'sbi_get_cache');
|
518 |
+
|
519 |
+
//sbi_clear_backups
|
520 |
+
function sbi_clear_backups() {
|
521 |
+
if ( current_user_can( 'edit_posts' ) ) {
|
522 |
+
//Delete all transients
|
523 |
+
global $wpdb;
|
524 |
+
$table_name = $wpdb->prefix . "options";
|
525 |
+
$wpdb->query( "
|
526 |
+
DELETE
|
527 |
+
FROM $table_name
|
528 |
+
WHERE `option_name` LIKE ('%!sbi\_%')
|
529 |
+
" );
|
530 |
+
$wpdb->query( "
|
531 |
+
DELETE
|
532 |
+
FROM $table_name
|
533 |
+
WHERE `option_name` LIKE ('%\_transient\_&sbi\_%')
|
534 |
+
" );
|
535 |
+
$wpdb->query( "
|
536 |
+
DELETE
|
537 |
+
FROM $table_name
|
538 |
+
WHERE `option_name` LIKE ('%\_transient\_timeout\_&sbi\_%')
|
539 |
+
" );
|
540 |
+
}
|
541 |
+
die();
|
542 |
+
}
|
543 |
+
add_action( 'wp_ajax_sbi_clear_backups', 'sbi_clear_backups' );
|
544 |
+
|
545 |
//Enqueue stylesheet
|
546 |
add_action( 'wp_enqueue_scripts', 'sb_instagram_styles_enqueue' );
|
547 |
function sb_instagram_styles_enqueue() {
|
566 |
|
567 |
//Access token
|
568 |
isset($sb_instagram_settings[ 'sb_instagram_at' ]) ? $sb_instagram_at = trim($sb_instagram_settings['sb_instagram_at']) : $sb_instagram_at = '';
|
569 |
+
$font_method = isset( $sb_instagram_settings['sbi_font_method'] ) ? $sb_instagram_settings['sbi_font_method'] : 'svg';
|
570 |
+
$disable_font_awesome = isset($sb_instagram_settings['sb_instagram_disable_awesome']) ? $sb_instagram_settings['sb_instagram_disable_awesome'] : false;
|
571 |
|
572 |
+
if ( $font_method === 'fontfile' && ! $disable_font_awesome ) {
|
573 |
+
wp_enqueue_style( 'sb-font-awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' );
|
574 |
+
}
|
575 |
$data = array(
|
576 |
+
'sb_instagram_at' => $sb_instagram_at,
|
577 |
+
'font_method' => $font_method,
|
578 |
);
|
579 |
|
580 |
isset($sb_instagram_settings[ 'sb_instagram_ajax_theme' ]) ? $sb_instagram_ajax_theme = trim($sb_instagram_settings['sb_instagram_ajax_theme']) : $sb_instagram_ajax_theme = '';
|
608 |
|
609 |
if( current_user_can( 'manage_options' ) ){
|
610 |
echo "\r\n";
|
611 |
+
echo "#sbi_mod_error{ display: block !important; }";
|
612 |
}
|
613 |
|
614 |
if( $sbi_show_css ) echo "\r\n";
|
620 |
//Custom JS
|
621 |
add_action( 'wp_footer', 'sb_instagram_custom_js' );
|
622 |
function sb_instagram_custom_js() {
|
623 |
+
$options = get_option('sb_instagram_settings');
|
624 |
+
isset($options[ 'sb_instagram_custom_js' ]) ? $sb_instagram_custom_js = trim($options['sb_instagram_custom_js']) : $sb_instagram_custom_js = '';
|
625 |
+
|
626 |
+
echo '<!-- Instagram Feed JS -->';
|
627 |
+
echo "\r\n";
|
628 |
+
echo '<script type="text/javascript">';
|
629 |
+
echo "\r\n";
|
630 |
+
echo 'var sbiajaxurl = "' . admin_url('admin-ajax.php') . '";';
|
631 |
+
|
632 |
+
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
|
633 |
+
if( !empty($sb_instagram_custom_js) ) echo "jQuery( document ).ready(function($) {";
|
634 |
+
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
|
635 |
+
if( !empty($sb_instagram_custom_js) ) echo "window.sbi_custom_js = function(){";
|
636 |
+
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
|
637 |
+
if( !empty($sb_instagram_custom_js) ) echo stripslashes($sb_instagram_custom_js);
|
638 |
+
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
|
639 |
+
if( !empty($sb_instagram_custom_js) ) echo "}";
|
640 |
+
if( !empty($sb_instagram_custom_js) ) echo "\r\n";
|
641 |
+
if( !empty($sb_instagram_custom_js) ) echo "});";
|
642 |
+
|
643 |
+
echo "\r\n";
|
644 |
+
echo '</script>';
|
645 |
+
echo "\r\n";
|
646 |
+
|
647 |
}
|
648 |
|
649 |
if ( ! function_exists( 'sb_remove_style_version' ) ) {
|
689 |
|
690 |
//Settings
|
691 |
delete_option( 'sb_instagram_settings' );
|
692 |
+
|
693 |
+
global $wpdb;
|
694 |
+
$table_name = $wpdb->prefix . "options";
|
695 |
+
$wpdb->query( "
|
696 |
+
DELETE
|
697 |
+
FROM $table_name
|
698 |
+
WHERE `option_name` LIKE ('%!sbi\_%')
|
699 |
+
" );
|
700 |
+
$wpdb->query( "
|
701 |
+
DELETE
|
702 |
+
FROM $table_name
|
703 |
+
WHERE `option_name` LIKE ('%\_transient\_&sbi\_%')
|
704 |
+
" );
|
705 |
+
$wpdb->query( "
|
706 |
+
DELETE
|
707 |
+
FROM $table_name
|
708 |
+
WHERE `option_name` LIKE ('%\_transient\_timeout\_&sbi\_%')
|
709 |
+
" );
|
710 |
}
|
711 |
register_uninstall_hook( __FILE__, 'sb_instagram_uninstall' );
|
js/sb-instagram-admin.js
CHANGED
@@ -39,6 +39,24 @@ jQuery(document).ready(function($) {
|
|
39 |
jQuery('#sb_instagram_at').val(token);
|
40 |
sbSaveToken(token);
|
41 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
//Tooltips
|
44 |
jQuery('#sbi_admin .sbi_tooltip_link').click(function(){
|
39 |
jQuery('#sb_instagram_at').val(token);
|
40 |
sbSaveToken(token);
|
41 |
});
|
42 |
+
|
43 |
+
//clear backup caches
|
44 |
+
jQuery('#sbi_clear_backups').click(function(event) {
|
45 |
+
jQuery('.sbi-success').remove();
|
46 |
+
event.preventDefault();
|
47 |
+
jQuery.ajax({
|
48 |
+
url: sbiA.ajax_url,
|
49 |
+
type: 'post',
|
50 |
+
data: {
|
51 |
+
action: 'sbi_clear_backups',
|
52 |
+
access_token: token,
|
53 |
+
just_tokens: true
|
54 |
+
},
|
55 |
+
success: function (data) {
|
56 |
+
jQuery('#sbi_clear_backups').after('<span class="sbi-success"><i class="fa fa-check-circle"></i></span>');
|
57 |
+
}
|
58 |
+
});
|
59 |
+
});
|
60 |
|
61 |
//Tooltips
|
62 |
jQuery('#sbi_admin .sbi_tooltip_link').click(function(){
|
js/sb-instagram.js
CHANGED
@@ -1,500 +1,1430 @@
|
|
1 |
var sbi_js_exists = (typeof sbi_js_exists !== 'undefined') ? true : false;
|
2 |
if(!sbi_js_exists){
|
3 |
|
4 |
-
(function() {
|
5 |
-
var e, t;
|
6 |
-
e = function() {
|
7 |
-
function e(e, t) {
|
8 |
-
var n, r;
|
9 |
-
this.options = {
|
10 |
-
target: "instafeed",
|
11 |
-
get: "popular",
|
12 |
-
resolution: "thumbnail",
|
13 |
-
sortBy: "none",
|
14 |
-
links: !0,
|
15 |
-
mock: !1,
|
16 |
-
useHttp: !1
|
17 |
-
};
|
18 |
-
if (typeof e == "object")
|
19 |
-
for (n in e) r = e[n], this.options[n] = r;
|
20 |
-
this.context = t != null ? t : this, this.unique = this._genKey()
|
21 |
-
}
|
22 |
-
return e.prototype.hasNext = function() {
|
23 |
-
return typeof this.context.nextUrl == "string" && this.context.nextUrl.length > 0
|
24 |
-
}, e.prototype.next = function() {
|
25 |
-
return this.hasNext() ? this.run(this.context.nextUrl) : !1
|
26 |
-
}, e.prototype.run = function(t) {
|
27 |
-
var n, r, i;
|
28 |
-
if (typeof this.options.clientId != "string" && typeof this.options.accessToken != "string") throw new Error("Missing clientId or accessToken.");
|
29 |
-
if (typeof this.options.accessToken != "string" && typeof this.options.clientId != "string") throw new Error("Missing clientId or accessToken.");
|
30 |
-
return this.options.before != null && typeof this.options.before == "function" && this.options.before.call(this), typeof document != "undefined" && document !== null && (i = document.createElement("script"), i.id = "instafeed-fetcher", i.src = t || this._buildUrl(), n = document.getElementsByTagName("head"), n[0].appendChild(i), r = "instafeedCache" + this.unique, window[r] = new e(this.options, this), window[r].unique = this.unique), !0
|
31 |
-
}, e.prototype.parse = function(e) {
|
32 |
-
var t, n, r, i, s, o, u, a, f, l, c, h, p, d, v, m, g, y, b, w, E, S;
|
33 |
-
if (typeof e != "object") {
|
34 |
-
if (this.options.error != null && typeof this.options.error == "function") return this.options.error.call(this, "Invalid JSON data"), !1;
|
35 |
-
throw new Error("Invalid JSON response")
|
36 |
-
}
|
37 |
-
if (e.meta.code !== 200) {
|
38 |
-
if (this.options.error != null && typeof this.options.error == "function") return this.options.error.call(this, e.meta.error_message), !1;
|
39 |
-
throw new Error("Error from Instagram: " + e.meta.error_message)
|
40 |
-
}
|
41 |
-
if (e.data.length === 0) {
|
42 |
-
if (this.options.error != null && typeof this.options.error == "function") return this.options.error.call(this, "No images were returned from Instagram"), !1;
|
43 |
-
throw new Error("No images were returned from Instagram")
|
44 |
-
}
|
45 |
-
this.options.success != null && typeof this.options.success == "function" && this.options.success.call(this, e), this.context.nextUrl = "", e.pagination != null && (this.context.nextUrl = e.pagination.next_url);
|
46 |
-
var lastVisiblePost = typeof e.data[Math.min(this.options.limit - 1,e.data.length-1)] !== 'undefined' ? e.data[Math.min(this.options.limit - 1,e.data.length-1)] : e.data[e.data.length],
|
47 |
-
lastRetrievedPost = e.data[e.data.length-1],
|
48 |
-
hasMorePosts = (typeof e.data[this.options.limit] !== 'undefined');
|
49 |
-
if (typeof e.pagination.next_url !== 'undefined') {
|
50 |
-
this.context.nextUrl = e.pagination.next_url.replace(lastRetrievedPost.id, lastVisiblePost.id);
|
51 |
-
} else if (hasMorePosts) {
|
52 |
-
this.context.nextUrl = "https://api.instagram.com/v1/users/"+this.options.userId+"/media/recent?access_token="+this.options.accessToken+"&count=33&callback=instafeedCache"+this.unique+".parse&max_id=" + lastVisiblePost.id;
|
53 |
-
e.pagination.next_url = this.context.nextUrl;
|
54 |
-
e.pagination.next_max_id = lastVisiblePost.id;
|
55 |
-
}
|
56 |
-
if (e.data.length > this.options.limit) {
|
57 |
-
e.data = e.data.slice(0,this.options.limit);
|
58 |
-
}
|
59 |
-
if (this.options.sortBy !== "none") {
|
60 |
-
this.options.sortBy === "random" ? d = ["", "random"] : d = this.options.sortBy.split("-"), p = d[0] === "least" ? !0 : !1;
|
61 |
-
switch (d[1]) {
|
62 |
-
case "random":
|
63 |
-
e.data.sort(function() {
|
64 |
-
return .5 - Math.random()
|
65 |
-
});
|
66 |
-
break;
|
67 |
-
case "recent":
|
68 |
-
e.data = this._sortBy(e.data, "created_time", p);
|
69 |
-
break;
|
70 |
-
case "liked":
|
71 |
-
e.data = this._sortBy(e.data, "likes.count", p);
|
72 |
-
break;
|
73 |
-
case "commented":
|
74 |
-
e.data = this._sortBy(e.data, "comments.count", p);
|
75 |
-
break;
|
76 |
-
default:
|
77 |
-
throw new Error("Invalid option for sortBy: '" + this.options.sortBy + "'.")
|
78 |
-
}
|
79 |
-
}
|
80 |
-
if (typeof document != "undefined" && document !== null && this.options.mock === !1) {
|
81 |
-
a = e.data, this.options.limit != null && a.length > this.options.limit && (a = a.slice(0, this.options.limit + 1 || 9e9)), n = document.createDocumentFragment(), this.options.filter != null && typeof this.options.filter == "function" && (a = this._filter(a, this.options.filter));
|
82 |
-
if (this.options.template != null && typeof this.options.template == "string") {
|
83 |
-
i = "", o = "", l = "", v = document.createElement("div");
|
84 |
-
for (m = 0, b = a.length; m < b; m++) s = a[m], u = s.images[this.options.resolution].url, this.options.useHttp || (u = u.replace("http://", "//")), o = this._makeTemplate(this.options.template, {
|
85 |
-
model: s,
|
86 |
-
id: s.id,
|
87 |
-
link: s.link,
|
88 |
-
image: u,
|
89 |
-
caption: this._getObjectProperty(s, "caption.text"),
|
90 |
-
likes: s.likes.count,
|
91 |
-
comments: s.comments.count,
|
92 |
-
location: this._getObjectProperty(s, "location.name")
|
93 |
-
}), i += o;
|
94 |
-
v.innerHTML = i, S = [].slice.call(v.childNodes);
|
95 |
-
for (g = 0, w = S.length; g < w; g++) h = S[g], n.appendChild(h)
|
96 |
-
} else
|
97 |
-
for (y = 0, E = a.length; y < E; y++) s = a[y], f = document.createElement("img"), u = s.images[this.options.resolution].url, this.options.useHttp || (u = u.replace("http://", "//")), f.src = u, this.options.links === !0 ? (t = document.createElement("a"), t.href = s.link, t.appendChild(f), n.appendChild(t)) : n.appendChild(f);
|
98 |
-
this.options.target.append(n), r = document.getElementsByTagName("head")[0], r.removeChild(document.getElementById("instafeed-fetcher")), c = "instafeedCache" + this.unique, window[c] = void 0;
|
99 |
-
try {
|
100 |
-
delete window[c]
|
101 |
-
} catch (x) {}
|
102 |
-
}
|
103 |
-
return this.options.after != null && typeof this.options.after == "function" && this.options.after.call(this), !0
|
104 |
-
}, e.prototype._buildUrl = function() {
|
105 |
-
var e, t, n;
|
106 |
-
e = "https://api.instagram.com/v1";
|
107 |
-
switch (this.options.get) {
|
108 |
-
case "popular":
|
109 |
-
t = "media/popular";
|
110 |
-
break;
|
111 |
-
case "tagged":
|
112 |
-
if (typeof this.options.tagName != "string") throw new Error("No tag name specified. Use the 'tagName' option.");
|
113 |
-
t = "tags/" + this.options.tagName + "/media/recent";
|
114 |
-
break;
|
115 |
-
case "location":
|
116 |
-
if (typeof this.options.locationId != "number") throw new Error("No location specified. Use the 'locationId' option.");
|
117 |
-
t = "locations/" + this.options.locationId + "/media/recent";
|
118 |
-
break;
|
119 |
-
case "user":
|
120 |
-
if (typeof this.options.userId != "number") throw new Error("No user specified. Use the 'userId' option.");
|
121 |
-
if (typeof this.options.accessToken != "string") throw new Error("No access token. Use the 'accessToken' option.");
|
122 |
-
t = "users/" + this.options.userId + "/media/recent";
|
123 |
-
break;
|
124 |
-
default:
|
125 |
-
throw new Error("Invalid option for get: '" + this.options.get + "'.")
|
126 |
-
}
|
127 |
-
return n = "" + e + "/" + t, this.options.accessToken != null ? n += "?access_token=" + this.options.accessToken : n += "?client_id=" + this.options.clientId, this.options.limit != null && (n += "&count=33"), n += "&callback=instafeedCache" + this.unique + ".parse", n
|
128 |
-
}, e.prototype._genKey = function() {
|
129 |
-
var e;
|
130 |
-
return e = function() {
|
131 |
-
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1)
|
132 |
-
}, "" + e() + e() + e() + e()
|
133 |
-
}, e.prototype._makeTemplate = function(e, t) {
|
134 |
-
var n, r, i, s, o;
|
135 |
-
r = /(?:\{{2})([\w\[\]\.]+)(?:\}{2})/, n = e;
|
136 |
-
while (r.test(n)) i = n.match(r)[1], s = (o = this._getObjectProperty(t, i)) != null ? o : "", n = n.replace(r, "" + s);
|
137 |
-
return n
|
138 |
-
}, e.prototype._getObjectProperty = function(e, t) {
|
139 |
-
var n, r;
|
140 |
-
t = t.replace(/\[(\w+)\]/g, ".$1"), r = t.split(".");
|
141 |
-
while (r.length) {
|
142 |
-
n = r.shift();
|
143 |
-
if (!(e != null && n in e)) return null;
|
144 |
-
e = e[n]
|
145 |
-
}
|
146 |
-
return e
|
147 |
-
}, e.prototype._sortBy = function(e, t, n) {
|
148 |
-
var r;
|
149 |
-
return r = function(e, r) {
|
150 |
-
var i, s;
|
151 |
-
return i = this._getObjectProperty(e, t), s = this._getObjectProperty(r, t), n ? i > s ? 1 : -1 : i < s ? 1 : -1
|
152 |
-
}, e.sort(r.bind(this)), e
|
153 |
-
}, e.prototype._filter = function(e, t) {
|
154 |
-
var n, r, i, s, o;
|
155 |
-
n = [], i = function(e) {
|
156 |
-
if (t(e)) return n.push(e)
|
157 |
-
};
|
158 |
-
for (s = 0, o = e.length; s < o; s++) r = e[s], i(r);
|
159 |
-
return n
|
160 |
-
}, e
|
161 |
-
}(), t = typeof exports != "undefined" && exports !== null ? exports : window, t.instagramfeed = e
|
162 |
-
}).call(this);
|
163 |
-
|
164 |
//Shim for "fixing" IE's lack of support (IE < 9) for applying slice on host objects like NamedNodeMap, NodeList, and HTMLCollection) https://github.com/stevenschobert/instafeed.js/issues/84
|
165 |
(function(){"use strict";var e=Array.prototype.slice;try{e.call(document.documentElement)}catch(t){Array.prototype.slice=function(t,n){n=typeof n!=="undefined"?n:this.length;if(Object.prototype.toString.call(this)==="[object Array]"){return e.call(this,t,n)}var r,i=[],s,o=this.length;var u=t||0;u=u>=0?u:o+u;var a=n?n:o;if(n<0){a=o+n}s=a-u;if(s>0){i=new Array(s);if(this.charAt){for(r=0;r<s;r++){i[r]=this.charAt(u+r)}}else{for(r=0;r<s;r++){i[r]=this[u+r]}}}return i}}})()
|
166 |
|
167 |
//IE8 also doesn't offer the .bind() method triggered by the 'sortBy' property. Copy and paste the polyfill offered here:
|
168 |
if(!Function.prototype.bind){Function.prototype.bind=function(e){if(typeof this!=="function"){throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable")}var t=Array.prototype.slice.call(arguments,1),n=this,r=function(){},i=function(){return n.apply(this instanceof r&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};r.prototype=this.prototype;i.prototype=new r;return i}}
|
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 |
-
var feedWidth = $self.innerWidth(),
|
203 |
-
colWidth = $self.innerWidth() / cols;
|
204 |
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
//Need this for mobile so that image res is right on mobile, as the number of cols isn't always accurate on mobile as they are changed using CSS
|
209 |
-
if( feedWidth < 640 && $self.is('.sbi_col_3, .sbi_col_4, .sbi_col_5, .sbi_col_6') ) colWidth = 300; //Use medium images
|
210 |
-
if( feedWidth < 640 && $self.is('.sbi_col_7, .sbi_col_8, .sbi_col_9, .sbi_col_10') ) colWidth = 100; //Use thumbnail images
|
211 |
-
if( (feedWidth > 320 && feedWidth < 480) && sbiWindowWidth < 480 ) colWidth = 480; //Use full size images
|
212 |
-
if( feedWidth < 320 && sbiWindowWidth < 480 ) colWidth = 300; //Use medium size images
|
213 |
-
}
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
219 |
} else {
|
220 |
-
|
221 |
}
|
|
|
|
|
|
|
|
|
|
|
222 |
|
223 |
-
|
224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
|
|
|
|
235 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
|
|
|
|
|
|
|
|
|
|
|
247 |
jQuery.ajax({
|
248 |
method: "GET",
|
249 |
-
url:
|
250 |
dataType: "jsonp",
|
251 |
success: function(data) {
|
252 |
-
var
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
$header += '>@' + data.data.username + '</h3>';
|
259 |
-
if (data.data.bio.length && feedOptions.showbio === "true") $header += '<p class="sbi_bio" ' + headerStyles + '>' + data.data.bio + '</p>';
|
260 |
-
$header += '</div>';
|
261 |
-
$header += '<div class="sbi_header_img">';
|
262 |
-
$header += '<div class="sbi_header_img_hover"><i></i></div>';
|
263 |
-
$header += '<img src="' + data.data.profile_picture + '" alt="' + data.data.full_name + '" width="50" height="50">';
|
264 |
-
$header += '</div>';
|
265 |
-
$header += '</a>';
|
266 |
-
//Add the header
|
267 |
-
$self.find('.sb_instagram_header').prepend($header);
|
268 |
-
//Change the URL of the follow button
|
269 |
-
if ($self.find('.sbi_follow_btn').length) $self.find('.sbi_follow_btn a').attr('href', 'https://instagram.com/' + data.data.username)
|
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 |
$loadBtn.show();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
} else {
|
315 |
-
|
316 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
}
|
318 |
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
} else {
|
336 |
-
|
|
|
337 |
}
|
338 |
-
|
339 |
-
}();
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
return function(sbi_callback, sbi_ms){
|
347 |
-
clearTimeout (sbi_timer);
|
348 |
-
sbi_timer = setTimeout(sbi_callback, sbi_ms);
|
349 |
-
};
|
350 |
-
})();
|
351 |
-
|
352 |
-
jQuery(window).resize(function(){
|
353 |
-
sbi_delay(function(){
|
354 |
-
sbiSetPhotoHeight();
|
355 |
}, 500);
|
356 |
-
});
|
357 |
|
358 |
-
|
359 |
-
function sbiSetPhotoHeight(){
|
360 |
|
361 |
-
|
362 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
|
364 |
-
|
365 |
-
|
366 |
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
|
|
|
|
372 |
}
|
373 |
|
374 |
-
//Figure out what the width should be using the number of cols
|
375 |
-
var sbi_photo_width_manual = ( $self.find('#sbi_images').width() / sbi_num_cols ) - (feedOptions.imagepadding*2);
|
376 |
|
377 |
-
|
378 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
|
380 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
}
|
382 |
|
383 |
-
|
384 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
|
386 |
-
|
387 |
-
|
|
|
|
|
388 |
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
|
398 |
-
|
399 |
-
jQuery('#sb_instagram .sbi_photo').each(function(){
|
400 |
-
$sbi_photo = jQuery(this);
|
401 |
-
$sbi_photo.hover(function(){
|
402 |
-
jQuery(this).fadeTo(200, 0.85);
|
403 |
-
}, function(){
|
404 |
-
jQuery(this).stop().fadeTo(500, 1);
|
405 |
});
|
406 |
|
407 |
-
//
|
408 |
-
|
409 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
}
|
411 |
-
|
412 |
|
413 |
-
|
414 |
-
|
415 |
-
$self.find('#sbi_images .sbi_item.sbi_new').sort(function (a, b) {
|
416 |
-
var aComp = jQuery(a).data('date'),
|
417 |
-
bComp = jQuery(b).data('date');
|
418 |
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
}
|
426 |
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
//Reset the morePosts variable so we can check whether there are more posts every time the Load More button is clicked
|
433 |
-
morePosts = [];
|
434 |
-
}, 500);
|
435 |
-
|
436 |
-
function sbiGetItemSize(){
|
437 |
-
$self.removeClass('sbi_small sbi_medium');
|
438 |
-
var sbiItemWidth = $self.find('.sbi_item').innerWidth();
|
439 |
-
if( sbiItemWidth > 120 && sbiItemWidth < 240 ){
|
440 |
-
$self.addClass('sbi_medium');
|
441 |
-
} else if( sbiItemWidth <= 120 ){
|
442 |
-
$self.addClass('sbi_small');
|
443 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
}
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
}
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
478 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
}
|
480 |
-
});
|
481 |
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
|
488 |
-
|
|
|
|
|
489 |
|
490 |
-
|
|
|
|
|
|
|
|
|
|
|
491 |
|
492 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
}
|
495 |
|
496 |
jQuery( document ).ready(function() {
|
497 |
-
|
|
|
|
|
|
|
498 |
});
|
499 |
|
500 |
} // end sbi_js_exists check
|
1 |
var sbi_js_exists = (typeof sbi_js_exists !== 'undefined') ? true : false;
|
2 |
if(!sbi_js_exists){
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
//Shim for "fixing" IE's lack of support (IE < 9) for applying slice on host objects like NamedNodeMap, NodeList, and HTMLCollection) https://github.com/stevenschobert/instafeed.js/issues/84
|
5 |
(function(){"use strict";var e=Array.prototype.slice;try{e.call(document.documentElement)}catch(t){Array.prototype.slice=function(t,n){n=typeof n!=="undefined"?n:this.length;if(Object.prototype.toString.call(this)==="[object Array]"){return e.call(this,t,n)}var r,i=[],s,o=this.length;var u=t||0;u=u>=0?u:o+u;var a=n?n:o;if(n<0){a=o+n}s=a-u;if(s>0){i=new Array(s);if(this.charAt){for(r=0;r<s;r++){i[r]=this.charAt(u+r)}}else{for(r=0;r<s;r++){i[r]=this[u+r]}}}return i}}})()
|
6 |
|
7 |
//IE8 also doesn't offer the .bind() method triggered by the 'sortBy' property. Copy and paste the polyfill offered here:
|
8 |
if(!Function.prototype.bind){Function.prototype.bind=function(e){if(typeof this!=="function"){throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable")}var t=Array.prototype.slice.call(arguments,1),n=this,r=function(){},i=function(){return n.apply(this instanceof r&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};r.prototype=this.prototype;i.prototype=new r;return i}}
|
9 |
|
10 |
+
/* Font Awesome SVG implementation */
|
11 |
+
var sbIconSVG = {
|
12 |
+
'fa-clock' : 'class="svg-inline--fa fa-clock fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="far" data-icon="clock" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm61.8-104.4l-84.9-61.7c-3.1-2.3-4.9-5.9-4.9-9.7V116c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v141.7l66.8 48.6c5.4 3.9 6.5 11.4 2.6 16.8L334.6 349c-3.9 5.3-11.4 6.5-16.8 2.6z"></path></svg>',
|
13 |
+
'fa-play' : 'class="svg-inline--fa fa-play fa-w-14 sbi_playbtn" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="play" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"></path></svg>',
|
14 |
+
'fa-image' : 'class="svg-inline--fa fa-image fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="far" data-icon="image" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"></path></svg>',
|
15 |
+
'fa-user' : 'class="svg-inline--fa fa-user fa-w-16" style="margin-right: 3px;" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="user" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M96 160C96 71.634 167.635 0 256 0s160 71.634 160 160-71.635 160-160 160S96 248.366 96 160zm304 192h-28.556c-71.006 42.713-159.912 42.695-230.888 0H112C50.144 352 0 402.144 0 464v24c0 13.255 10.745 24 24 24h464c13.255 0 24-10.745 24-24v-24c0-61.856-50.144-112-112-112z"></path></svg>',
|
16 |
+
'fa-comment' : 'class="svg-inline--fa fa-comment fa-w-18" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="comment" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M576 240c0 115-129 208-288 208-48.3 0-93.9-8.6-133.9-23.8-40.3 31.2-89.8 50.3-142.4 55.7-5.2.6-10.2-2.8-11.5-7.7-1.3-5 2.7-8.1 6.6-11.8 19.3-18.4 42.7-32.8 51.9-94.6C21.9 330.9 0 287.3 0 240 0 125.1 129 32 288 32s288 93.1 288 208z"></path></svg>',
|
17 |
+
'fa-heart' : 'class="svg-inline--fa fa-heart fa-w-18" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="heart" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M414.9 24C361.8 24 312 65.7 288 89.3 264 65.7 214.2 24 161.1 24 70.3 24 16 76.9 16 165.5c0 72.6 66.8 133.3 69.2 135.4l187 180.8c8.8 8.5 22.8 8.5 31.6 0l186.7-180.2c2.7-2.7 69.5-63.5 69.5-136C560 76.9 505.7 24 414.9 24z"></path></svg>',
|
18 |
+
'fa-check' : 'class="svg-inline--fa fa-check fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="check" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"></path></svg>',
|
19 |
+
'fa-exclamation-circle' : 'class="svg-inline--fa fa-exclamation-circle fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="exclamation-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"></path></svg>',
|
20 |
+
'fa-map-marker' : 'class="svg-inline--fa fa-map-marker fa-w-12" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="map-marker" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0z"></path></svg>',
|
21 |
+
'fa-clone' : 'class="svg-inline--fa fa-clone fa-w-16 sbi_lightbox_carousel_icon" aria-hidden="true" data-fa-processed="" data-prefix="far" data-icon="clone" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M464 0H144c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h320c26.51 0 48-21.49 48-48v-48h48c26.51 0 48-21.49 48-48V48c0-26.51-21.49-48-48-48zM362 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h42v224c0 26.51 21.49 48 48 48h224v42a6 6 0 0 1-6 6zm96-96H150a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h308a6 6 0 0 1 6 6v308a6 6 0 0 1-6 6z"></path></svg>',
|
22 |
+
'fa-chevron-right' : 'class="svg-inline--fa fa-chevron-right fa-w-10" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="chevron-right" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"></path></svg>',
|
23 |
+
'fa-chevron-left' : 'class="svg-inline--fa fa-chevron-left fa-w-10" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="chevron-left" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"></path></svg>',
|
24 |
+
'fa-share' : 'class="svg-inline--fa fa-share fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="share" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M503.691 189.836L327.687 37.851C312.281 24.546 288 35.347 288 56.015v80.053C127.371 137.907 0 170.1 0 322.326c0 61.441 39.581 122.309 83.333 154.132 13.653 9.931 33.111-2.533 28.077-18.631C66.066 312.814 132.917 274.316 288 272.085V360c0 20.7 24.3 31.453 39.687 18.164l176.004-152c11.071-9.562 11.086-26.753 0-36.328z"></path></svg>',
|
25 |
+
'fa-times' : 'class="svg-inline--fa fa-times fa-w-12" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="times" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M323.1 441l53.9-53.9c9.4-9.4 9.4-24.5 0-33.9L279.8 256l97.2-97.2c9.4-9.4 9.4-24.5 0-33.9L323.1 71c-9.4-9.4-24.5-9.4-33.9 0L192 168.2 94.8 71c-9.4-9.4-24.5-9.4-33.9 0L7 124.9c-9.4 9.4-9.4 24.5 0 33.9l97.2 97.2L7 353.2c-9.4 9.4-9.4 24.5 0 33.9L60.9 441c9.4 9.4 24.5 9.4 33.9 0l97.2-97.2 97.2 97.2c9.3 9.3 24.5 9.3 33.9 0z"></path></svg>',
|
26 |
+
'fa-envelope' : 'class="svg-inline--fa fa-envelope fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="envelope" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg>',
|
27 |
+
'fa-edit' : 'class="svg-inline--fa fa-edit fa-w-18" aria-hidden="true" data-fa-processed="" data-prefix="far" data-icon="edit" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M402.3 344.9l32-32c5-5 13.7-1.5 13.7 5.7V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h273.5c7.1 0 10.7 8.6 5.7 13.7l-32 32c-1.5 1.5-3.5 2.3-5.7 2.3H48v352h352V350.5c0-2.1.8-4.1 2.3-5.6zm156.6-201.8L296.3 405.7l-90.4 10c-26.2 2.9-48.5-19.2-45.6-45.6l10-90.4L432.9 17.1c22.9-22.9 59.9-22.9 82.7 0l43.2 43.2c22.9 22.9 22.9 60 .1 82.8zM460.1 174L402 115.9 216.2 301.8l-7.3 65.3 65.3-7.3L460.1 174zm64.8-79.7l-43.2-43.2c-4.1-4.1-10.8-4.1-14.8 0L436 82l58.1 58.1 30.9-30.9c4-4.2 4-10.8-.1-14.9z"></path></svg>',
|
28 |
+
'fa-arrows-alt' : 'class="svg-inline--fa fa-arrows-alt fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="arrows-alt" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"></path></svg>',
|
29 |
+
'fa-check-circle' : 'class="svg-inline--fa fa-check-circle fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="check-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"></path></svg>',
|
30 |
+
'fa-ban' : 'class="svg-inline--fa fa-ban fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="ban" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 8C119.034 8 8 119.033 8 256s111.034 248 248 248 248-111.034 248-248S392.967 8 256 8zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676zM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676z"></path></svg>',
|
31 |
+
'fa-facebook-square' : 'class="svg-inline--fa fa-facebook-square fa-w-14" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="facebook-square" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M448 80v352c0 26.5-21.5 48-48 48h-85.3V302.8h60.6l8.7-67.6h-69.3V192c0-19.6 5.4-32.9 33.5-32.9H384V98.7c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9H184v67.6h60.9V480H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48z"></path></svg>',
|
32 |
+
'fa-twitter' : 'class="svg-inline--fa fa-twitter fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path></svg>',
|
33 |
+
'fa-google-plus' : 'class="svg-inline--fa fa-google-plus fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="google-plus" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8zm-70.7 372c-68.8 0-124-55.5-124-124s55.2-124 124-124c31.3 0 60.1 11 83 32.3l-33.6 32.6c-13.2-12.9-31.3-19.1-49.4-19.1-42.9 0-77.2 35.5-77.2 78.1s34.2 78.1 77.2 78.1c32.6 0 64.9-19.1 70.1-53.3h-70.1v-42.6h116.9c1.3 6.8 1.9 13.6 1.9 20.7 0 70.8-47.5 121.2-118.8 121.2zm230.2-106.2v35.5H372v-35.5h-35.5v-35.5H372v-35.5h35.5v35.5h35.2v35.5h-35.2z"></path></svg>',
|
34 |
+
'fa-instagram' : 'class="svg-inline--fa fa-instagram fa-w-14" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg>',
|
35 |
+
'fa-linkedin' : 'class="svg-inline--fa fa-linkedin fa-w-14" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"></path></svg>',
|
36 |
+
'fa-pinterest' : 'class="svg-inline--fa fa-pinterest fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="pinterest" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M496 256c0 137-111 248-248 248-25.6 0-50.2-3.9-73.4-11.1 10.1-16.5 25.2-43.5 30.8-65 3-11.6 15.4-59 15.4-59 8.1 15.4 31.7 28.5 56.8 28.5 74.8 0 128.7-68.8 128.7-154.3 0-81.9-66.9-143.2-152.9-143.2-107 0-163.9 71.8-163.9 150.1 0 36.4 19.4 81.7 50.3 96.1 4.7 2.2 7.2 1.2 8.3-3.3.8-3.4 5-20.3 6.9-28.1.6-2.5.3-4.7-1.7-7.1-10.1-12.5-18.3-35.3-18.3-56.6 0-54.7 41.4-107.6 112-107.6 60.9 0 103.6 41.5 103.6 100.9 0 67.1-33.9 113.6-78 113.6-24.3 0-42.6-20.1-36.7-44.8 7-29.5 20.5-61.3 20.5-82.6 0-19-10.2-34.9-31.4-34.9-24.9 0-44.9 25.7-44.9 60.2 0 22 7.4 36.8 7.4 36.8s-24.5 103.8-29 123.2c-5 21.4-3 51.6-.9 71.2C65.4 450.9 0 361.1 0 256 0 119 111 8 248 8s248 111 248 248z"></path></svg>',
|
37 |
+
'fa-spinner' : 'class="svg-inline--fa fa-spinner fa-w-16 fa-pulse" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="spinner" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"></path></svg>',
|
38 |
+
'fa-spin' : 'class="svg-inline--fa fa-spin fa-w-16 fa-pulse" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="spinner" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"></path></svg>'
|
39 |
+
};
|
40 |
|
41 |
+
function sbSVGify(elem) {
|
42 |
+
if (sb_instagram_js_options.font_method != 'fontfile') {
|
|
|
|
|
43 |
|
44 |
+
if (typeof elem === 'undefined') {
|
45 |
+
elem = jQuery('.sbi');
|
46 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
elem.each(function() {
|
49 |
+
jQuery(this).find('i.fa').each(function() {
|
50 |
+
var faClass = jQuery(this).attr('class').match(/fa-[a-z-]+/),
|
51 |
+
styles = jQuery(this).attr('style');
|
52 |
+
if (faClass && typeof sbIconSVG[faClass[0]] !== 'undefined') {
|
53 |
+
var theStyle = typeof styles !== 'undefined' ? 'style="'+styles+'" ' : '';
|
54 |
+
jQuery(this).replaceWith('<svg '+theStyle+sbIconSVG[faClass[0]]);
|
55 |
} else {
|
56 |
+
console.log(faClass,'missing');
|
57 |
}
|
58 |
+
})
|
59 |
+
});
|
60 |
+
sbiSizeSVG(elem);
|
61 |
+
}
|
62 |
+
}
|
63 |
|
64 |
+
// backup for themes/plugins that won't clear CSS cache
|
65 |
+
function sbiSizeSVG(elem) {
|
66 |
+
if (elem.find('svg').innerWidth() > 48 || elem.find('.sbi_follow_btn svg').innerWidth() > 30 || elem.find('.fa-clone').last().innerWidth() > 24 || elem.find('.fa-play').last().innerWidth() > 48) {
|
67 |
+
jQuery('.sbi_follow_btn svg').css({
|
68 |
+
'margin-bottom': '-4px',
|
69 |
+
'margin-right': '7px',
|
70 |
+
'font-size': '15px',
|
71 |
+
'width': '15px'
|
72 |
+
});
|
73 |
+
elem.find('.fa-spinner').css({
|
74 |
+
'font-size': '15px',
|
75 |
+
'width': '15px'
|
76 |
+
});
|
77 |
+
if (elem.find('.sbi_type_carousel .fa-clone').length){
|
78 |
+
elem.find('.sbi_type_carousel .fa-clone').each(function() {
|
79 |
+
var size = '24px',
|
80 |
+
offset = '8px';
|
81 |
+
if (elem.hasClass('sbi_small')) {
|
82 |
+
size = '12px';
|
83 |
+
offset = '5px';
|
84 |
+
} else if (elem.hasClass('sbi_medium')){
|
85 |
+
size = '18px';
|
86 |
+
offset = '5px';
|
87 |
+
}
|
88 |
|
89 |
+
jQuery(this).css({
|
90 |
+
'top': offset,
|
91 |
+
'right': offset,
|
92 |
+
'position': 'absolute',
|
93 |
+
'font-size': size,
|
94 |
+
'width': size,
|
95 |
+
'color': '#fff',
|
96 |
+
'-webkit-filter' : 'drop-shadow( 0px 0px 2px rgba(0,0,0,.4) )',
|
97 |
+
'filter' : 'drop-shadow( 0px 0px 2px rgba(0,0,0,.4) )'
|
98 |
+
});
|
99 |
+
});
|
100 |
}
|
101 |
+
if (elem.find('.sbi_item .fa-play').length){
|
102 |
+
elem.find('.sbi_item .fa-play').each(function() {
|
103 |
+
var size = '48px',
|
104 |
+
margintop = '-24px',
|
105 |
+
marginleft = '-19px';
|
106 |
+
if (jQuery(this).closest('.sbi').hasClass('sbi_small')) {
|
107 |
+
size = '18px';
|
108 |
+
margintop = '-9px';
|
109 |
+
marginleft = '-7px';
|
110 |
+
} else if (jQuery(this).closest('.sbi').hasClass('sbi_medium')){
|
111 |
+
size = '23px';
|
112 |
+
margintop = '-12px';
|
113 |
+
marginleft = '-10px';
|
114 |
+
}
|
115 |
|
116 |
+
jQuery(this).css({
|
117 |
+
'top': '50%',
|
118 |
+
'right': '50%',
|
119 |
+
'position': 'absolute',
|
120 |
+
'font-size': size,
|
121 |
+
'width': size,
|
122 |
+
'margin-top': margintop,
|
123 |
+
'margin-left': marginleft,
|
124 |
+
'color': '#fff',
|
125 |
+
'-webkit-filter' : 'drop-shadow( 0px 0px 2px rgba(0,0,0,.4) )',
|
126 |
+
'filter' : 'drop-shadow( 0px 0px 2px rgba(0,0,0,.4) )'
|
127 |
+
});
|
128 |
+
});
|
129 |
+
}
|
130 |
+
}
|
131 |
+
}
|
132 |
|
133 |
+
//Start plugin code
|
134 |
+
function sbi_init(_cache){
|
135 |
+
// used in case user name is used instead of id
|
136 |
+
function sbiSetUserApiUrl(user_id, at, before, extra, handleData) {
|
137 |
+
var url = 'https://api.instagram.com/v1/users/search?q=' + user_id + '&access_token=' + at;
|
138 |
jQuery.ajax({
|
139 |
method: "GET",
|
140 |
+
url: url,
|
141 |
dataType: "jsonp",
|
142 |
success: function(data) {
|
143 |
+
var matchingID = data.data[0].id;
|
144 |
+
jQuery.each(data.data, function() {
|
145 |
+
if(this.username === user_id){
|
146 |
+
matchingID = this.id;
|
147 |
+
}
|
148 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
|
150 |
+
var apiCall = "https://api.instagram.com/v1/users/"+ matchingID + before + "?access_token=" + at + extra;
|
151 |
+
handleData(apiCall,matchingID);
|
152 |
}
|
153 |
});
|
154 |
+
}
|
155 |
+
|
156 |
+
var $i = 0, //Used for iterating lightbox
|
157 |
+
sbi_time = 0;
|
158 |
+
|
159 |
+
sbiCreatePage( function() {
|
160 |
+
// using this code as the callback to make sure we know if includewords is being used
|
161 |
+
// and we need to stagger the loading of the feeds
|
162 |
+
jQuery('#sb_instagram.sbi').each(function () {
|
163 |
+
var feedOptions = JSON.parse( this.getAttribute('data-options') );
|
164 |
+
});
|
165 |
+
|
166 |
+
});
|
167 |
+
|
168 |
+
//Wrapped in a function to delay the feeds being loaded until includewords feeds are detected
|
169 |
+
function sbiCreatePage(_callback) {
|
170 |
+
|
171 |
+
// forces the function to wait until the includewords detecting code is run
|
172 |
+
_callback();
|
173 |
+
window.sbiCacheStatuses = {};
|
174 |
+
window.sbiFeedMeta = {};
|
175 |
+
window.sbiUseBackup = {};
|
176 |
+
|
177 |
+
jQuery('#sb_instagram.sbi').each(function(){ //Ends on line 1676
|
178 |
+
|
179 |
+
var var_this = this,
|
180 |
+
feedOptions = JSON.parse( var_this.getAttribute('data-options') );
|
181 |
+
|
182 |
+
//Add feed index attr (for lightbox iteration)
|
183 |
+
$i++;
|
184 |
+
jQuery(this).attr('data-sbi-index', $i);
|
185 |
+
// setting up some global objects to keep track of various statuses used for the caching system
|
186 |
+
feedOptions.feedIndex = $i;
|
187 |
+
window.sbiCacheStatuses[$i] = {
|
188 |
+
'header' : ( feedOptions.sbiHeaderCache == 'true' ),
|
189 |
+
'feed' : ( feedOptions.sbiCacheExists == 'true' )
|
190 |
+
};
|
191 |
+
var useBackUpJson = (typeof feedOptions.useBackup !== 'undefined') ? feedOptions.useBackup : '';
|
192 |
+
window.sbiUseBackup[$i] = {
|
193 |
+
'header' : ( useBackUpJson.indexOf( 'header' ) > -1 ),
|
194 |
+
'feed' : ( useBackUpJson.indexOf( 'feed' ) > -1 )
|
195 |
+
};
|
196 |
+
window.sbiFeedMeta[$i] = {
|
197 |
+
'error' : {},
|
198 |
+
'idsInFeed' : [],
|
199 |
+
'postsInFeed' : [] //Keeps track of photo IDs for removing duplicates
|
200 |
+
};
|
201 |
+
setTimeout(function() {
|
202 |
+
sbiCreateFeed(var_this,feedOptions);
|
203 |
+
},sbi_time);
|
204 |
+
|
205 |
+
function sbiCreateFeed(var_this,feedOptions) {
|
206 |
+
|
207 |
+
var imagesArrCount = 0;
|
208 |
+
|
209 |
+
var $self = jQuery(var_this),
|
210 |
+
imgRes = 'standard_resolution',
|
211 |
+
cols = parseInt( var_this.getAttribute('data-cols') ),
|
212 |
+
//Convert styles JSON string to an object
|
213 |
+
getType = 'user',
|
214 |
+
sortby = 'none',
|
215 |
+
num = var_this.getAttribute('data-num'),
|
216 |
+
user_id = var_this.getAttribute('data-id'),
|
217 |
+
$header = '',
|
218 |
+
morePosts = [], //Used to determine whether to show the Load More button when displaying posts from more than one id/hashtag. If one of the ids/hashtags has more posts then still show button.
|
219 |
+
sbiHeaderCache = feedOptions.sbiHeaderCache,
|
220 |
+
media = 'all';
|
221 |
+
//media = feedOptions.media;
|
222 |
+
|
223 |
+
feedOptions.disablecache = (feedOptions.disablecache == 'true');
|
224 |
+
feedOptions.media = 'all';
|
225 |
+
|
226 |
+
if( feedOptions.sortby !== '' ) sortby = feedOptions.sortby;
|
227 |
+
|
228 |
+
imgRes = sbiGetResolutionSettings( $self, var_this.getAttribute('data-res'), cols, cols, $i );
|
229 |
+
//Split comma separated hashtags into array
|
230 |
+
var ids_arr = user_id.replace(/ /g,'').split(","),
|
231 |
+
looparray = ids_arr;
|
232 |
+
|
233 |
+
//START FEED
|
234 |
+
var apiURLs = [],
|
235 |
+
apiCall = '';
|
236 |
+
|
237 |
+
//Loop through ids or hashtags
|
238 |
+
jQuery.each( looparray, function( index, entry ) {
|
239 |
+
|
240 |
+
//Create an array of API URLs to pass to the fetchData function
|
241 |
+
apiCall = "https://api.instagram.com/v1/users/"+ entry +"/media/recent?access_token=" + sb_instagram_js_options.sb_instagram_at+"&count=33";
|
242 |
+
window.sbiFeedMeta[$i].idsInFeed.push(entry);
|
243 |
+
apiURLs.push( apiCall );
|
244 |
+
|
245 |
+
}); //End hashtag array loop
|
246 |
|
247 |
+
//Create an object of the settings so that they can be passed to the buildFeed function
|
248 |
+
var sbiSettings = {num:num, getType:getType, user_id:user_id, cols:cols, imgRes:imgRes, sortby:sortby, feedOptions:feedOptions, looparray: looparray};
|
249 |
+
|
250 |
+
var sbi_cache_string_include = '';
|
251 |
+
var sbi_cache_string_exclude = '';
|
252 |
+
var sbiTransientNames = {
|
253 |
+
'header' : '',
|
254 |
+
'feed' : ''
|
255 |
+
};
|
256 |
+
|
257 |
+
//Figure out how long the first part of the caching string should be
|
258 |
+
var sbi_cache_string_include_length = sbi_cache_string_include.length;
|
259 |
+
var sbi_cache_string_exclude_length = sbi_cache_string_exclude.length;
|
260 |
+
var sbi_cache_string_length = 40 - Math.min(sbi_cache_string_include_length + sbi_cache_string_exclude_length, 20);
|
261 |
+
|
262 |
+
var transientName = 'sbi_';
|
263 |
+
looparray = looparray.join().replace(/[.,-\/#!$%\^&\*;:{}=\-_`~()]/g,"");
|
264 |
+
// include the white list name in the transient name
|
265 |
+
if (feedOptions.media !== 'all') transientName += feedOptions.media.substring(0, 1);
|
266 |
+
transientName += looparray.substring(0, sbi_cache_string_length);
|
267 |
+
|
268 |
+
//Find the length of the string so far, and then however many chars are left we can use this for filters
|
269 |
+
sbi_cache_string_length = transientName.length;
|
270 |
+
sbi_cache_string_length = 44 - sbi_cache_string_length;
|
271 |
+
|
272 |
+
//Set the length of each filter string
|
273 |
+
if( sbi_cache_string_exclude_length < sbi_cache_string_length/2 ){
|
274 |
+
sbi_cache_string_include = sbi_cache_string_include.substring(0, sbi_cache_string_length - sbi_cache_string_exclude_length);
|
275 |
+
} else {
|
276 |
+
//Exclude string
|
277 |
+
if( sbi_cache_string_exclude.length == 0 ){
|
278 |
+
sbi_cache_string_include = sbi_cache_string_include.substring(0, sbi_cache_string_length);
|
279 |
+
} else {
|
280 |
+
sbi_cache_string_include = sbi_cache_string_include.substring(0, sbi_cache_string_length/2);
|
281 |
+
}
|
282 |
+
//Include string
|
283 |
+
if( sbi_cache_string_include.length == 0 ){
|
284 |
+
sbi_cache_string_exclude = sbi_cache_string_exclude.substring(0, sbi_cache_string_length);
|
285 |
+
} else {
|
286 |
+
sbi_cache_string_exclude = sbi_cache_string_exclude.substring(0, sbi_cache_string_length/2);
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
function getHeaderTransientName(looparrayZero) {
|
291 |
+
var headerTransientName = 'sbi_header_' + looparrayZero;
|
292 |
+
headerTransientName = headerTransientName.substring(0, 45);
|
293 |
+
|
294 |
+
return headerTransientName;
|
295 |
+
}
|
296 |
+
|
297 |
+
//Add both parts of the caching string together and make sure it doesn't exceed 45
|
298 |
+
transientName += sbi_cache_string_include + sbi_cache_string_exclude;
|
299 |
+
sbiTransientNames.feed = transientName.substring(0, 45);
|
300 |
+
sbiTransientNames.header = getHeaderTransientName(sbiSettings.looparray[0]);
|
301 |
+
|
302 |
+
// check to see if comments need to be retrieved
|
303 |
+
if (!sb_instagram_js_options.sbiPageCommentCache && window.sbiCommentCacheStatus === 1 && window.sbiStandalone.noDB !== true) {
|
304 |
+
sbiTransientNames.comments = 'need';
|
305 |
+
} else {
|
306 |
+
sbiTransientNames.comments = 'no';
|
307 |
+
}
|
308 |
+
//1. Does the transient/cache exist in the db?
|
309 |
+
if( ( window.sbiCacheStatuses[feedOptions.feedIndex].feed === true || window.sbiCacheStatuses[feedOptions.feedIndex].header === true || sbiTransientNames.comments === 'need' ) && !feedOptions.disablecache && typeof feedOptions.tryFetch === 'undefined'){
|
310 |
+
//Use ajax to get the cache
|
311 |
+
var images = sbiGetCache(sbiTransientNames, sbiSettings, $self, 'all', apiURLs);
|
312 |
+
sbiTransientNames.comments = 'no';
|
313 |
+
}
|
314 |
+
|
315 |
+
// if the user didn't use the account id, this attempts to use the user name
|
316 |
+
if(getType == 'user' && isNaN(ids_arr[0])){
|
317 |
+
sbiSetUserApiUrl(ids_arr[0], sb_instagram_js_options.sb_instagram_at, '/media/recent', '&count=33', function(apiURL,newFeedID){
|
318 |
+
sbiSettings.user_id = newFeedID;
|
319 |
+
sbiFetchData([apiURL], sbiTransientNames.feed, sbiSettings, $self);
|
320 |
+
});
|
321 |
+
} else {
|
322 |
+
// if the process of retrieving remote posts hasn't started yet, do so here
|
323 |
+
if ( window.sbiCacheStatuses[feedOptions.feedIndex].feed === false && window.sbiCacheStatuses[feedOptions.feedIndex].feed !== 'fetched') {
|
324 |
+
window.sbiCacheStatuses[feedOptions.feedIndex].feed = 'fetched';
|
325 |
+
window.sbiCacheStatuses[feedOptions.feedIndex].tryFetch = 'done';
|
326 |
+
sbiFetchData(apiURLs, sbiTransientNames.feed, sbiSettings, $self);
|
327 |
+
}
|
328 |
+
|
329 |
+
if ( !window.sbiCacheStatuses[feedOptions.feedIndex].header && window.sbiCacheStatuses[feedOptions.feedIndex].header !== 'fetched' && sbiSettings.getType === 'user') {
|
330 |
+
window.sbiCacheStatuses[feedOptions.feedIndex].header = 'fetched';
|
331 |
+
// Make the ajax request here
|
332 |
+
var sbi_page_url = 'https://api.instagram.com/v1/users/' + sbiSettings.user_id + '?access_token=' + sb_instagram_js_options.sb_instagram_at;
|
333 |
+
|
334 |
+
jQuery.ajax({
|
335 |
+
method: "GET",
|
336 |
+
url: sbi_page_url,
|
337 |
+
dataType: "jsonp",
|
338 |
+
success: function(data) {
|
339 |
+
sbiBuildHeader(data, sbiSettings);
|
340 |
+
if(!feedOptions.disablecache && window.sbiCacheStatuses[feedOptions.feedIndex].header !== 'cached' && typeof data.data.username !== 'undefined' && typeof data.data.pagination === 'undefined') {
|
341 |
+
window.sbiCacheStatuses[feedOptions.feedIndex].header = 'cached';
|
342 |
+
sbiCachePhotos(data, sbiTransientNames.header);
|
343 |
+
}
|
344 |
+
}
|
345 |
+
});
|
346 |
+
//sbiFetchData(apiURLs, sbiTransientNames.header, sbiSettings, $self);
|
347 |
+
}
|
348 |
+
}
|
349 |
+
|
350 |
+
|
351 |
+
//This is the arr that we'll keep adding the new images to
|
352 |
+
var imagesArr = '',
|
353 |
+
sbiNewData = false,
|
354 |
+
noMoreData = false,
|
355 |
+
photoIds = [],
|
356 |
+
imagesHTML = '',
|
357 |
+
photosAvailable = 0, //How many photos are available to be displayed
|
358 |
+
apiRequests = 1;
|
359 |
+
|
360 |
+
//Build the HTML for the feed
|
361 |
+
function sbiBuildFeed(images, transientName, sbiSettings, $self){
|
362 |
+
|
363 |
+
//VARS:
|
364 |
+
var $loadBtn = $self.find("#sbi_load .sbi_load_btn"),
|
365 |
+
num = parseInt(sbiSettings.num),
|
366 |
+
cols = parseInt(sbiSettings.cols),
|
367 |
+
feedOptions = sbiSettings.feedOptions,
|
368 |
+
itemCount = 0,
|
369 |
+
imgRes = sbiSettings.imgRes,
|
370 |
+
getType = feedOptions.type,
|
371 |
+
maxRequests = parseInt(feedOptions.maxrequests),
|
372 |
+
imagepadding = feedOptions.imagepadding,
|
373 |
+
imagepaddingunit = feedOptions.imagepaddingunit,
|
374 |
+
looparray = sbiSettings.looparray,
|
375 |
+
headerstyle = feedOptions.headerstyle,
|
376 |
+
headerprimarycolor = feedOptions.headerprimarycolor,
|
377 |
+
headersecondarycolor = feedOptions.headersecondarycolor,
|
378 |
+
media = feedOptions.media;
|
379 |
+
|
380 |
+
//On first load imagesArr is empty so set it to be the images
|
381 |
+
if(imagesArr == ''){
|
382 |
+
imagesArr = images;
|
383 |
+
|
384 |
+
//On all subsequent loads add the new images to the imagesArr
|
385 |
+
} else if( sbiNewData == true ) {
|
386 |
+
jQuery.each( images.data, function( index, entry ) {
|
387 |
+
//Add the images to the imagesArr
|
388 |
+
imagesArr.data.push( entry );
|
389 |
+
});
|
390 |
+
sbiNewData = false;
|
391 |
+
}
|
392 |
+
var imagesNextUrl = images.pagination.next_url;
|
393 |
+
|
394 |
+
if( typeof imagesNextUrl === 'undefined' || imagesNextUrl.length == 0 ){
|
395 |
+
noMoreData = true;
|
396 |
+
} else {
|
397 |
$loadBtn.show();
|
398 |
+
}
|
399 |
+
|
400 |
+
//If the next url exists then update the pagination object in the imagesArr with the next pagination info
|
401 |
+
if( typeof images.pagination !== 'undefined' ) imagesArr["pagination"] = images.pagination;
|
402 |
+
|
403 |
+
if( feedOptions.sortby !== '' ) sortby = feedOptions.sortby;
|
404 |
+
//If the user hasn't changed the background color then set a "default" class on the hover tile so we can add a text shadow
|
405 |
+
var sbiDefaultClass = ( feedOptions.hovercolor == '0,0,0' ) ? " sbi_default" : "";
|
406 |
+
|
407 |
+
var imagesArrCountOrig = imagesArrCount,
|
408 |
+
removePhotoIndexes = []; //This is used to keep track of the indexes of the photos which should be removed so that they can be removed from imagesArr after the loop below has finished and then resultantly not cached.
|
409 |
+
|
410 |
+
//BUILD HEADER
|
411 |
+
if( $self.find('.sbi_header_link').length == 0 ){
|
412 |
+
|
413 |
+
//Get page info for first User ID
|
414 |
+
var sbi_page_url = 'https://api.instagram.com/v1/users/' + looparray[0] + '?access_token=' + sb_instagram_js_options.sb_instagram_at;
|
415 |
+
if(isNaN(looparray[0])){
|
416 |
+
sbiSetUserApiUrl(looparray[0], sb_instagram_js_options.sb_instagram_at, '', '', function(apiURL){
|
417 |
+
sbi_page_url = apiURL;
|
418 |
+
|
419 |
+
if(sbiHeaderCache == 'true' && !feedOptions.disablecache){
|
420 |
+
//Use ajax to get the cache
|
421 |
+
//sbiGetCache(headerTransientName, sbiSettings, $self, 'header');
|
422 |
+
} else {
|
423 |
+
// Make the ajax request here
|
424 |
+
jQuery.ajax({
|
425 |
+
method: "GET",
|
426 |
+
url: sbi_page_url,
|
427 |
+
dataType: "jsonp",
|
428 |
+
success: function(data) {
|
429 |
+
sbiBuildHeader(data, sbiSettings);
|
430 |
+
if(!feedOptions.disablecache && window.sbiCacheStatuses[feedOptions.feedIndex].header !== 'cached' && typeof data.data.username !== 'undefined' && typeof data.data.pagination === 'undefined') {
|
431 |
+
window.sbiCacheStatuses[feedOptions.feedIndex].header = 'cached';
|
432 |
+
sbiCachePhotos(data, headerTransientName);
|
433 |
+
}
|
434 |
+
}
|
435 |
+
});
|
436 |
+
}
|
437 |
+
});
|
438 |
+
} else {
|
439 |
+
//Create header transient name
|
440 |
+
var headerTransientName = 'sbi_header_' + looparray[0];
|
441 |
+
headerTransientName = headerTransientName.substring(0, 45);
|
442 |
+
|
443 |
+
//Check whether header cache exists
|
444 |
+
if(sbiHeaderCache == 'true' && !feedOptions.disablecache){
|
445 |
+
//Use ajax to get the cache
|
446 |
+
//sbiGetCache(headerTransientName, sbiSettings, $self, 'header');
|
447 |
+
} else if ($self.find('.sb_instagram_header').length) {
|
448 |
+
// Make the ajax request here
|
449 |
+
jQuery.ajax({
|
450 |
+
method: "GET",
|
451 |
+
url: sbi_page_url,
|
452 |
+
dataType: "jsonp",
|
453 |
+
success: function (data) {
|
454 |
+
sbiBuildHeader(data, sbiSettings);
|
455 |
+
|
456 |
+
if(!feedOptions.disablecache && window.sbiCacheStatuses[feedOptions.feedIndex].header !== 'cached' && typeof data.data !== 'undefined' && typeof data.data.username !== 'undefined' && typeof data.data.pagination === 'undefined') {
|
457 |
+
window.sbiCacheStatuses[feedOptions.feedIndex].header = 'cached';
|
458 |
+
sbiCachePhotos(data, headerTransientName);
|
459 |
+
}
|
460 |
+
}
|
461 |
+
});
|
462 |
+
}
|
463 |
+
}
|
464 |
+
} // End header
|
465 |
+
|
466 |
+
//LOOP THROUGH ITEMS:
|
467 |
+
jQuery.each( imagesArr.data, function( itemNumber, item ) { // itemNumber = index, item = value
|
468 |
+
|
469 |
+
//Hide photos or videos
|
470 |
+
if( media == 'videos' && item.type !== 'video' ) removePhoto = true;
|
471 |
+
if( media == 'photos' && item.type !== 'image' && item.type !== 'carousel' ) removePhoto = true;
|
472 |
+
|
473 |
+
//Used to make sure we display the right amount of photos
|
474 |
+
itemCount++;
|
475 |
+
|
476 |
+
//This makes sure that only the correct number of photos is shown. So if num is set to 10 then it only shows the next 10 in the array. photosAvailable is subtracted from imagesArrCountOrig as imagesArrCountOrig is updated every time and we need to calculate how many photos are currently displayed in the feed in order to calculate how many to show.
|
477 |
+
if( itemCount > ( (imagesArrCountOrig-photosAvailable )+num) || itemCount <= imagesArrCountOrig ) return;
|
478 |
+
|
479 |
+
imagesArrCount++; //Keeps track of where we are in the images array
|
480 |
+
|
481 |
+
//Prevent duplicates
|
482 |
+
$i = $self.attr('data-sbi-index');
|
483 |
+
if( jQuery.inArray(item.id, window.sbiFeedMeta[$i].postsInFeed) > -1 ){
|
484 |
+
return; //Don't add image
|
485 |
+
} else {
|
486 |
+
//Store the IDs of the images added to the feed so we can prevent duplicates
|
487 |
+
window.sbiFeedMeta[$i].postsInFeed.push(item.id);
|
488 |
+
}
|
489 |
+
|
490 |
+
var videoIsFirstCarouselItem = false;
|
491 |
+
if ( item.type === 'carousel' && typeof item.carousel_media !== 'undefined') {
|
492 |
+
jQuery.each(item.carousel_media,function(index,value) {
|
493 |
+
if (typeof value.videos !== 'undefined') {
|
494 |
+
if (index === 0) {
|
495 |
+
videoIsFirstCarouselItem = true;
|
496 |
+
}
|
497 |
+
}
|
498 |
+
});
|
499 |
+
}
|
500 |
+
|
501 |
+
//Image res
|
502 |
+
var data_image = item.images.standard_resolution.url;
|
503 |
+
switch( imgRes.type ){
|
504 |
+
case 'thumbnail':
|
505 |
+
data_image = item.images.thumbnail.url;
|
506 |
+
break;
|
507 |
+
case 'low_resolution':
|
508 |
+
data_image = item.images.low_resolution.url;
|
509 |
+
break;
|
510 |
+
case 'custom':
|
511 |
+
data_image = item.images.standard_resolution.url.replace('640x640/',imgRes.width+'x'+imgRes.width+'/');
|
512 |
+
break;
|
513 |
+
case 'autocustom':
|
514 |
+
var thisImageReplace = sbiGetBestResolutionForCustom(imgRes.width,item.images.standard_resolution.width,item.images.standard_resolution.height)
|
515 |
+
data_image = item.images.standard_resolution.url.replace('640x640/',thisImageReplace+'x'+thisImageReplace+'/');
|
516 |
+
break;
|
517 |
+
}
|
518 |
+
data_image = data_image.split("?ig_cache_key")[0];
|
519 |
+
|
520 |
+
//Caption
|
521 |
+
var captionText = '',
|
522 |
+
created_time_raw = item.created_time;;
|
523 |
+
/*
|
524 |
+
var sbiInstagramHTML = '';
|
525 |
+
if(showHoverInstagram){
|
526 |
+
sbiInstagramHTML = '<a class="sbi_instagram_link" href="'+item.link+'" target="_blank" title="Instagram" '+hovertextstyles+'><span class="sbi-screenreader">View on Instagram</span><i class="fa fa-instagram"></i></a>';
|
527 |
+
}
|
528 |
+
|
529 |
+
// var sbiHoverEffect = 'sbi_' + feedOptions.hovereffect;
|
530 |
+
var sbiHoverEffect = 'sbi_fade';
|
531 |
+
|
532 |
+
//If it's a carousel feed then set the image padding directly on the sbi_item as the inherit in the CSS file doesn't work
|
533 |
+
var carouselPadding = (carousel == true) ? ' style="padding: '+imagepadding+imagepaddingunit+' !important;"' : '';
|
534 |
+
*/
|
535 |
+
var videoIsFirstCarouselItemClass = videoIsFirstCarouselItem ? ' sbi_carousel_vid_first' : '',
|
536 |
+
carouselTypeIcon = item.type === 'carousel' ? '<i class="fa fa-clone sbi_carousel_icon" aria-hidden="true"></i>': '';
|
537 |
+
|
538 |
+
var playBtnHtml = item.type === 'video' || videoIsFirstCarouselItemClass ? '<i class="fa fa-play sbi_playbtn"></i>' : '';
|
539 |
+
|
540 |
+
//TEMPLATE:
|
541 |
+
|
542 |
+
imagesHTML += '<div class="sbi_item sbi_type_'+item.type+' sbi_new" id="sbi_'+item.id+'" data-date="'+created_time_raw+'">' +
|
543 |
+
'<div class="sbi_photo_wrap">'+carouselTypeIcon+playBtnHtml +
|
544 |
+
'<a class="sbi_photo" href="'+item.link+'" target="_blank">' +
|
545 |
+
'<img src="'+data_image+'" alt="'+captionText+'" width="200" height="200" />' +
|
546 |
+
'</a>' +
|
547 |
+
'</div>' +
|
548 |
+
'</div>';
|
549 |
+
}); //End images.data forEach loop
|
550 |
+
|
551 |
+
//Loop through and remove any photos from imagesArr which are hidden so that they're not cached
|
552 |
+
removePhotoIndexes.reverse(); //Reverse the indexes in the array so that it takes out the last items first and doesn't affect the order
|
553 |
+
jQuery.each( removePhotoIndexes, function( index, itemNumber ) {
|
554 |
+
imagesArr.data.splice(itemNumber, 1);
|
555 |
+
});
|
556 |
+
|
557 |
+
if( (imagesArrCount - imagesArrCountOrig) < num ) photosAvailable += imagesArrCount - imagesArrCountOrig;
|
558 |
+
|
559 |
+
//CACHE all of the photos in the imagesArr using ajax call to db after the photos have been displayed
|
560 |
+
//if(!feedOptions.disablecache && !sbiCacheStatuses.feed) sbiCachePhotos(imagesArr, transientName);
|
561 |
+
if( ((imagesArrCount - imagesArrCountOrig) < num) && (photosAvailable < num) /*&& (numberOfPhotosDisplayed < num)*/ && (apiRequests < maxRequests) && !noMoreData ){ //Also check here whether next_url is available. If it's not then don't try to get more photos.
|
562 |
+
//Get more photos
|
563 |
+
var sbiFetchURL = imagesArr.pagination.next_url;
|
564 |
+
|
565 |
+
window.sbiCacheStatuses[feedOptions.feedIndex].feed = 'fetched';
|
566 |
+
|
567 |
+
sbiFetchData(sbiFetchURL, sbiTransientNames.feed, sbiSettings, $self);
|
568 |
+
//Set the flag so that we know to add the new photos to the imagesArr
|
569 |
+
sbiNewData = true;
|
570 |
} else {
|
571 |
+
|
572 |
+
//If there are enough photos
|
573 |
+
//Add the images to the feed
|
574 |
+
$self.find('#sbi_images').append(imagesHTML);
|
575 |
+
sbiAfterImagesLoaded(imagesArr,sbiTransientNames.feed);
|
576 |
+
|
577 |
+
imagesHTML = '';
|
578 |
+
|
579 |
+
//Remove the initial loader
|
580 |
+
$self.find('.sbi_loader').remove();
|
581 |
+
|
582 |
+
//Hide the spinner in the load more button
|
583 |
+
$loadBtn.find('.fa-spinner').hide();
|
584 |
+
$loadBtn.find('.sbi_btn_text').css('opacity', 1);
|
585 |
}
|
586 |
|
587 |
+
|
588 |
+
//AFTER:
|
589 |
+
//Things to add after the photos have been added
|
590 |
+
function sbiAfterImagesLoaded(imagesArr,transientName){
|
591 |
+
sbiSizeSVG($self);
|
592 |
+
/* Scripts for each feed */
|
593 |
+
$self.find('.sbi_item').each(function(){
|
594 |
+
|
595 |
+
var $self = jQuery(this);
|
596 |
+
|
597 |
+
//Photo links
|
598 |
+
//If lightbox is disabled
|
599 |
+
$self.find('.sbi_photo').hover(function(){
|
600 |
+
jQuery(this).fadeTo(200, 0.85);
|
601 |
+
}, function(){
|
602 |
+
jQuery(this).stop().fadeTo(500, 1);
|
603 |
+
});
|
604 |
+
|
605 |
+
}); //End .sbi_item each
|
606 |
+
|
607 |
+
|
608 |
+
//Sort posts by date
|
609 |
+
//only sort the new posts that are loaded in, not the whole feed, otherwise some photos will switch positions due to dates
|
610 |
+
$self.find('#sbi_images .sbi_item.sbi_new').sort(function (a, b) {
|
611 |
+
var aComp = jQuery(a).attr("data-date"),
|
612 |
+
bComp = jQuery(b).attr("data-date");
|
613 |
+
|
614 |
+
if(sortby == 'none'){
|
615 |
+
//Order by date
|
616 |
+
return bComp - aComp;
|
617 |
} else {
|
618 |
+
//Randomize
|
619 |
+
return (Math.round(Math.random())-0.5);
|
620 |
}
|
621 |
+
|
622 |
+
}).appendTo( $self.find("#sbi_images") );
|
623 |
+
|
624 |
+
//Remove the new class after 500ms, once the sorting is done
|
625 |
+
setTimeout(function(){
|
626 |
+
jQuery('#sbi_images .sbi_item.sbi_new').removeClass('sbi_new');
|
627 |
+
//Reset the morePosts variable so we can check whether there are more posts every time the Load More button is clicked
|
628 |
+
morePosts = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
}, 500);
|
|
|
630 |
|
631 |
+
var imagesArrLength = imagesArr.data.length;
|
|
|
632 |
|
633 |
+
//Adjust the imagesArr length to account for the hidden photos
|
634 |
+
// imagesArrLength = parseInt(imagesArrLength) - parseInt(removedPhotosCount); //June 13 2016 - the imagesArr length is already adjusted earlier and so don't need to adjust it again here
|
635 |
+
//Check initially whether we should show the Load More button. If it's coordinates then if the last API request returns no photos then there are no more to show.
|
636 |
+
if( ( (imagesArrCount >= imagesArrLength) && noMoreData ) ){
|
637 |
+
$loadBtn.hide();
|
638 |
+
}
|
639 |
+
|
640 |
+
//Load More button
|
641 |
+
$self.find('#sbi_load .sbi_load_btn').off().on('click', function(){
|
642 |
+
|
643 |
+
$loadBtn.find('.fa-spinner').show();
|
644 |
+
$loadBtn.find('.sbi_btn_text').css('opacity', 0);
|
645 |
+
//Reset the photosAvailable var so it can be used again
|
646 |
+
photosAvailable = 0;
|
647 |
+
|
648 |
+
//Check the global var to see where we are in the array
|
649 |
+
imagesArrCount = parseInt(imagesArrCount);
|
650 |
+
|
651 |
+
//Adjust the imagesArr length to account for the hidden photos
|
652 |
+
imagesArrLength = imagesArr.data.length;
|
653 |
+
|
654 |
+
//If there are enough photos left in the array then display them
|
655 |
+
if( (imagesArrCount + num) < imagesArrLength || noMoreData ){
|
656 |
+
|
657 |
+
if(photosAvailable !== 'finished') sbiBuildFeed(images, transientName, sbiSettings, $self);
|
658 |
+
//Unset the flag so that we know not to add these photos to the imagesArr again
|
659 |
+
sbiNewData = false;
|
660 |
+
|
661 |
+
//If there are no photos left in the array and there's no more data to load then hide the load more button
|
662 |
+
if( (imagesArrCount >= imagesArrLength) && noMoreData ){
|
663 |
+
$loadBtn.hide();
|
664 |
+
}
|
665 |
|
666 |
+
//Else if there aren't enough photos left then hit the api again
|
667 |
+
} else {
|
668 |
|
669 |
+
sbiFetchURL = imagesArr.pagination.next_url;
|
670 |
+
window.sbiCacheStatuses[feedOptions.feedIndex].feed = 'fetched';
|
671 |
+
sbiFetchData(sbiFetchURL, transientName, sbiSettings, $self);
|
672 |
+
//Set the flag so that we know to add the new photos to the imagesArr
|
673 |
+
sbiNewData = true;
|
674 |
+
//Reset this to zero so that we can limit requests to 3 per button click
|
675 |
+
apiRequests = 0;
|
676 |
}
|
677 |
|
|
|
|
|
678 |
|
679 |
+
}); //End click event
|
680 |
+
|
681 |
+
// Call Custom JS if it exists
|
682 |
+
if (typeof sbi_custom_js == 'function') setTimeout(function(){ sbi_custom_js(); }, 100);
|
683 |
+
|
684 |
+
if( imgRes !== 'thumbnail' ){
|
685 |
+
//This needs to be here otherwise it results in the following error for some sites: $self.find(...).sbi_imgLiquid() is not a function.
|
686 |
+
/*! imgLiquid v0.9.944 / 03-05-2013 https://github.com/karacas/imgLiquid */
|
687 |
+
var sbi_imgLiquid=sbi_imgLiquid||{VER:"0.9.944"};sbi_imgLiquid.bgs_Available=!1,sbi_imgLiquid.bgs_CheckRunned=!1,function(i){function t(){if(!sbi_imgLiquid.bgs_CheckRunned){sbi_imgLiquid.bgs_CheckRunned=!0;var t=i('<span style="background-size:cover" />');i("body").append(t),!function(){var i=t[0];if(i&&window.getComputedStyle){var e=window.getComputedStyle(i,null);e&&e.backgroundSize&&(sbi_imgLiquid.bgs_Available="cover"===e.backgroundSize)}}(),t.remove()}}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},t();var a=this;return this.options=e,this.settings=i.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(t){function e(){-1===u.css("background-image").indexOf(encodeURI(c.attr("src")))&&u.css({"background-image":'url("'+encodeURI(c.attr("src"))+'")'}),u.css({"background-size":g.fill?"cover":"contain","background-position":(g.horizontalAlign+" "+g.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),i("a:first",u).css({display:"block",width:"100%",height:"100%"}),i("img",u).css({display:"none"}),g.onItemFinish&&g.onItemFinish(t,u,c),u.addClass("sbi_imgLiquid_bgSize"),u.addClass("sbi_imgLiquid_ready"),l()}function o(){function e(){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))}if(c.data("oldSrc")&&c.data("oldSrc")!==c.attr("src")){var a=c.clone().removeAttr("style");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)}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({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),c.on("error",n),c[0].onerror=n,e(),void d())}function d(){(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))}function n(){c.data("sbi_imgLiquid_error",!0),u.addClass("sbi_imgLiquid_error"),g.onItemError&&g.onItemError(t,u,c),l()}function s(){var i={};if(a.settings.useDataHtmlAttr){var t=u.attr("data-sbi_imgLiquid-fill"),e=u.attr("data-sbi_imgLiquid-horizontalAlign"),o=u.attr("data-sbi_imgLiquid-verticalAlign");("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)}return sbi_imgLiquid.isIE&&a.settings.ieFadeInDisabled&&(i.fadeInTime=0),i}function r(){var i,e,a,o,d,n,s,r,m=0,h=0,f=u.width(),v=u.height();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({width:i,height:e,"margin-left":Math.floor(h),"margin-top":Math.floor(m)}),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()}function l(){t===a.length-1&&a.settings.onFinish&&a.settings.onFinish()}var g=a.settings,u=i(this),c=i("img:first",u);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()})}})}(jQuery);
|
688 |
|
689 |
+
// Use imagefill to set the images as backgrounds so they can be square
|
690 |
+
!function () {
|
691 |
+
var css = sbi_imgLiquid.injectCss,
|
692 |
+
head = document.getElementsByTagName('head')[0],
|
693 |
+
style = document.createElement('style');
|
694 |
+
style.type = 'text/css';
|
695 |
+
if (style.styleSheet) {
|
696 |
+
style.styleSheet.cssText = css;
|
697 |
+
} else {
|
698 |
+
style.appendChild(document.createTextNode(css));
|
699 |
+
}
|
700 |
+
head.appendChild(style);
|
701 |
+
}();
|
702 |
+
$self.find(".sbi_photo").sbi_imgLiquid({fill:true});
|
703 |
}
|
704 |
|
705 |
+
//Only check the width once the resize event is over
|
706 |
+
var sbi_delay = (function(){
|
707 |
+
var sbi_timer = 0;
|
708 |
+
return function(sbi_callback, sbi_ms){
|
709 |
+
clearTimeout (sbi_timer);
|
710 |
+
sbi_timer = setTimeout(sbi_callback, sbi_ms);
|
711 |
+
};
|
712 |
+
})();
|
713 |
|
714 |
+
jQuery(window).resize(function(){
|
715 |
+
sbi_delay(function(){
|
716 |
+
sbiSetPhotoHeight();
|
717 |
+
sbiGetItemSize();
|
718 |
|
719 |
+
jQuery('.sbi').each(function() {
|
720 |
+
var $sbiSelf = jQuery(this),
|
721 |
+
$i = jQuery(this).attr('data-sbi-index');
|
722 |
+
sbiSizeSVG($sbiSelf);
|
723 |
+
if ($sbiSelf.attr('data-res') ==='autocustom') {
|
724 |
+
var oldRes = window.sbiFeedMeta[$i].minRes;
|
725 |
+
var imageSize = sbiGetResolutionSettings($sbiSelf, 'autocustom', cols, colsmobile, $i),
|
726 |
+
width = imageSize.width !== '' ? imageSize.width : sbiGetWidthForResType(imageSize.type);
|
727 |
+
|
728 |
+
if (sbiNeedToRaiseRes(width,oldRes)) {
|
729 |
+
window.sbiFeedMeta[$i].minRes = 640;
|
730 |
+
$sbiSelf.find('.sbi_item').each(function() {
|
731 |
+
var newUrl = jQuery(this).find('.sbi_link_area').length ? jQuery(this).find('.sbi_link_area').attr('href') : '';
|
732 |
+
var oldUrl = jQuery(this).find('.sbi_photo img').attr('src'),
|
733 |
+
newRes = 640,
|
734 |
+
$photo = jQuery(this);
|
735 |
+
if (newUrl === '') {
|
736 |
+
if (oldUrl.indexOf('p'+oldRes+'x'+oldRes) > -1) {
|
737 |
+
newUrl = oldUrl.replace('p'+oldRes+'x'+oldRes,'p'+newRes+'x'+newRes);
|
738 |
+
} else if(oldUrl.indexOf('s'+oldRes+'x'+oldRes) > -1) {
|
739 |
+
newUrl = oldUrl.replace('s'+oldRes+'x'+oldRes,'s'+newRes+'x'+newRes);
|
740 |
+
}
|
741 |
+
}
|
742 |
|
743 |
+
$photo.find('.sbi_photo img').attr('src',newUrl);
|
744 |
+
$photo.find('.sbi_photo').css('background-image','url("'+newUrl+'")');
|
745 |
+
});
|
746 |
+
}
|
747 |
+
}
|
748 |
+
});
|
749 |
|
750 |
+
}, 500);
|
|
|
|
|
|
|
|
|
|
|
|
|
751 |
});
|
752 |
|
753 |
+
//Resize image height
|
754 |
+
function sbiSetPhotoHeight(){
|
755 |
+
|
756 |
+
if( imgRes !== 'thumbnail' ){
|
757 |
+
var sbi_photo_width = $self.find('.sbi_photo').eq(0).innerWidth();
|
758 |
+
|
759 |
+
//Figure out number of columns for either desktop or mobile
|
760 |
+
var sbi_num_cols = sbiGetColumnCount($self, parseInt(cols), parseInt(cols));
|
761 |
+
|
762 |
+
//Figure out what the width should be using the number of cols
|
763 |
+
var sbi_photo_width_manual = ( $self.find('#sbi_images').width() / sbi_num_cols ) - (imagepadding*2);
|
764 |
+
|
765 |
+
//If the width is less than it should be then set it manually
|
766 |
+
if( sbi_photo_width <= (sbi_photo_width_manual) ) sbi_photo_width = sbi_photo_width_manual;
|
767 |
+
|
768 |
+
$self.find('.sbi_photo').css('height', sbi_photo_width);
|
769 |
+
|
770 |
+
//Set the position of the arrows
|
771 |
+
var sbi_arrows_top = ($self.find('.sbi_photo').eq(0).innerWidth()/2);
|
772 |
+
if(imagepaddingunit == 'px') sbi_arrows_top += parseInt(imagepadding)*2;
|
773 |
+
$self.find('.sbi_owl-buttons div').css('top', sbi_arrows_top);
|
774 |
+
}
|
775 |
+
|
776 |
}
|
777 |
+
sbiSetPhotoHeight();
|
778 |
|
779 |
+
/* Detect when element becomes visible. Used for when the feed is initially hidden, in a tab for example. https://github.com/shaunbowe/jquery.visibilityChanged */
|
780 |
+
!function(i){var n={callback:function(){},runOnLoad:!0,frequency:100,sbiPreviousVisibility:null},c={};c.sbiCheckVisibility=function(i,n){if(jQuery.contains(document,i[0])){var e=n.sbiPreviousVisibility,t=i.is(":visible");n.sbiPreviousVisibility=t,null==e?n.runOnLoad&&n.callback(i,t):e!==t&&n.callback(i,t),setTimeout(function(){c.sbiCheckVisibility(i,n)},n.frequency)}},i.fn.sbiVisibilityChanged=function(e){var t=i.extend({},n,e);return this.each(function(){c.sbiCheckVisibility(i(this),t)})}}(jQuery);
|
|
|
|
|
|
|
781 |
|
782 |
+
//If the feed is initially hidden (in a tab for example) then check for when it becomes visible and set then set the height
|
783 |
+
jQuery(".sbi").filter(':hidden').sbiVisibilityChanged({
|
784 |
+
callback: function(element, visible) {
|
785 |
+
sbiSetPhotoHeight();
|
786 |
+
sbiGetItemSize();
|
787 |
+
},
|
788 |
+
runOnLoad: false
|
789 |
+
});
|
790 |
+
|
791 |
+
function sbiGetItemSize(){
|
792 |
+
$self.removeClass('sbi_small sbi_medium');
|
793 |
+
var sbiItemWidth = $self.find('.sbi_item').innerWidth();
|
794 |
+
if( sbiItemWidth > 120 && sbiItemWidth < 240 ){
|
795 |
+
$self.addClass('sbi_medium');
|
796 |
+
} else if( sbiItemWidth <= 120 ){
|
797 |
+
$self.addClass('sbi_small');
|
798 |
+
}
|
799 |
}
|
800 |
|
801 |
+
sbiGetItemSize();
|
802 |
+
// caching done at the end of all posts in the images Array
|
803 |
+
if(!feedOptions.disablecache && typeof _cache !== 'undefined' && window.sbiCacheStatuses[feedOptions.feedIndex].feed === 'fetched') {
|
804 |
+
_cache(imagesArr,transientName); // cache_all_posts
|
805 |
+
window.sbiCacheStatuses[feedOptions.feedIndex].feed = 'cached';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
806 |
}
|
807 |
+
|
808 |
+
// prevent sbiImagesReady from running code to get and display more posts
|
809 |
+
photosAvailable = 'finished';
|
810 |
+
|
811 |
+
sbSVGify($self);
|
812 |
+
} // End sbiAfterImagesLoaded() function
|
813 |
+
|
814 |
+
|
815 |
+
} //End buildFeed function
|
816 |
+
|
817 |
+
function commaSeparateNumber(val){
|
818 |
+
while (/(\d+)(\d{3})/.test(val.toString())){
|
819 |
+
val = val.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2');
|
820 |
}
|
821 |
+
return val;
|
822 |
+
}
|
823 |
+
|
824 |
+
function sbiBuildHeader(data, sbiSettings){
|
825 |
+
|
826 |
+
if(typeof data.meta.error_message !== 'undefined') return;
|
827 |
+
|
828 |
+
var feedOptions = sbiSettings.feedOptions,
|
829 |
+
headerStyles = '';
|
830 |
+
if(feedOptions.headercolor.length) headerStyles = 'style="color: #'+feedOptions.headercolor+'"';
|
831 |
+
|
832 |
+
$header = '<a href="https://www.instagram.com/'+data.data.username+'" target="_blank" title="@'+data.data.username+'" class="sbi_header_link" '+headerStyles+'>';
|
833 |
+
$header += '<div class="sbi_header_text">';
|
834 |
+
var classheader = '';
|
835 |
+
if( ( typeof data.data.bio !== 'undefined' && data.data.bio.length < 1 ) || feedOptions.showbio != 'true' ) classheader = ' class="sbi_no_bio"';
|
836 |
+
$header += '<h3 '+headerStyles+classheader+'>'+data.data.username+'</h3>';
|
837 |
+
|
838 |
+
//Compile and add the header info
|
839 |
+
var $headerInfo = '<p class="sbi_bio_info" ';
|
840 |
+
if(feedOptions.headerstyle == 'boxed'){
|
841 |
+
$headerInfo += 'style="color: #' + feedOptions.headerprimarycolor + ';"';
|
842 |
+
} else {
|
843 |
+
$headerInfo += headerStyles;
|
844 |
+
}
|
845 |
+
|
846 |
+
//Add the bio
|
847 |
+
if( typeof data.data.bio !== 'undefined' && data.data.bio.length > 1 && feedOptions.showbio != '' && feedOptions.showbio != 'false' ) $header += '<p class="sbi_bio" '+headerStyles+'>'+data.data.bio+'</p>';
|
848 |
+
$header += '</div>';
|
849 |
+
$header += '<div class="sbi_header_img">';
|
850 |
+
$header += '<div class="sbi_header_img_hover"><i class="sbi_new_logo"></i></div>';
|
851 |
+
$header += '<img src="'+data.data.profile_picture+'" alt="'+data.data.full_name+'" width="50" height="50">';
|
852 |
+
$header += '</div>';
|
853 |
+
$header += '</a>';
|
854 |
+
if(feedOptions.headerstyle == 'boxed') {
|
855 |
+
$header += '<div class="sbi_header_bar" style="background: #'+feedOptions.headersecondarycolor+'">';
|
856 |
+
if(feedOptions.showbio != 'false') $header += $headerInfo;
|
857 |
+
$header += '<a class="sbi_header_follow_btn" href="https://www.instagram.com/'+data.data.username+'" target="_blank" style="color: #'+feedOptions.headercolor+'; background: #'+feedOptions.headerprimarycolor+';"><i class="sbi_new_logo"></i><span></span></div></div>';
|
858 |
+
}
|
859 |
+
|
860 |
+
//Add the header to the feed
|
861 |
+
if( $self.find('.sbi_header_link').length == 0 ) $self.find('.sb_instagram_header').prepend( $header );
|
862 |
+
|
863 |
+
//Change the URL of the follow button
|
864 |
+
if( $self.find('.sbi_follow_btn').length ) $self.find('.sbi_follow_btn a').attr('href', 'https://www.instagram.com/' + data.data.username );
|
865 |
+
//Change the text of the header follow button
|
866 |
+
if( feedOptions.headerstyle == 'boxed' && $self.find('.sbi_header_follow_btn').length ) $self.find('.sbi_header_follow_btn span').text( $self.find('.sb_instagram_header').attr('data-follow-text').replace(/\\/g, "") );
|
867 |
+
|
868 |
+
|
869 |
+
//Header profile pic hover
|
870 |
+
$self.find('.sb_instagram_header .sbi_header_link').hover(function(){
|
871 |
+
$self.find('.sb_instagram_header .sbi_header_img_hover').fadeIn(200);
|
872 |
+
}, function(){
|
873 |
+
$self.find('.sb_instagram_header .sbi_header_img_hover').stop().fadeOut(600);
|
874 |
+
});
|
875 |
+
|
876 |
+
sbSVGify($self.find('.sb_instagram_header'));
|
877 |
+
} // End sbiBuildHeader()
|
878 |
+
|
879 |
+
|
880 |
+
function sbiFetchData(next_url, transientName, sbiSettings, $self) {
|
881 |
+
apiURLs = next_url;
|
882 |
+
var urlCount = apiURLs.length,
|
883 |
+
getType = sbiSettings.getType;
|
884 |
+
|
885 |
+
//If the apiURLs array is empty then this means that there's no more next_urls and so hide the load more button
|
886 |
+
if( urlCount == 0 ){
|
887 |
+
|
888 |
+
//Don't hit the API any more
|
889 |
+
//If there's no more photos to retrieve then hide the load more button
|
890 |
+
if( imagesArrCount + parseInt(sbiSettings.num) >= imagesArr.data.length ){
|
891 |
+
//Hide the Load More button
|
892 |
+
jQuery('#sbi_load .sbi_load_btn').hide();
|
893 |
}
|
894 |
+
|
895 |
+
} else {
|
896 |
+
|
897 |
+
var returnedImages = [],
|
898 |
+
numberOfRequests = urlCount;
|
899 |
+
jQuery.each(apiURLs, function(index, entry){
|
900 |
+
|
901 |
+
jQuery.ajax({
|
902 |
+
method: "GET",
|
903 |
+
url: entry,
|
904 |
+
dataType: "jsonp",
|
905 |
+
success: function(data) {
|
906 |
+
//Pretty error messages
|
907 |
+
var sbiErrorResponse = data.meta.error_message,
|
908 |
+
sbiErrorMsg = '',
|
909 |
+
sbiErrorDir = '';
|
910 |
+
|
911 |
+
if(typeof sbiErrorResponse !== 'undefined'){
|
912 |
+
|
913 |
+
if( sbiErrorResponse.indexOf('access_token') > -1 ){
|
914 |
+
sbiErrorMsg += '<p><b>Error: Access Token is not valid or has expired</b><br /><span>This error message is only visible to WordPress admins</span></p>';
|
915 |
+
sbiErrorDir = "<p>There's an issue with the Instagram Access Token that you are using. Please obtain a new Access Token on the plugin's Settings page.<br />If you continue to have an issue with your Access Token then please see <a href='https://smashballoon.com/my-instagram-access-token-keep-expiring/' target='_blank'>this FAQ</a> for more information.</p>";
|
916 |
+
jQuery('#sb_instagram').empty().append( '<p style="text-align: center;">Unable to show Instagram photos</p><div id="sbi_mod_error">' + sbiErrorMsg + sbiErrorDir + '</div>');
|
917 |
+
sbiAddTokenToExpiredList(sb_instagram_js_options.sb_instagram_at,transientName);
|
918 |
+
return;
|
919 |
+
//requests per hour
|
920 |
+
} else if( typeof data.code !== 'undefined' && data.code == '429' ){
|
921 |
+
window.sbiFeedMeta[$i].error = {
|
922 |
+
errorMsg : '<p><b>Error: Rate Limit Reached</b><br /><span>This error is only visible to WordPress admins</span>',
|
923 |
+
errorDir : "<p>Backup cache will be used for 1 hour</p>"
|
924 |
+
};
|
925 |
+
if (!$self.find('#sbi_mod_error').length) {
|
926 |
+
$self.prepend('<div id="sbi_mod_error">'+window.sbiFeedMeta[$i].error.errorMsg+window.sbiFeedMeta[$i].error.errorDir+'</div>');
|
927 |
+
} else if ($self.find('.sbiErrorIds').text().indexOf(window.sbiFeedMeta[$i].idsInFeed[index]) == -1) {
|
928 |
+
$self.find('.sbiErrorIds').append(','+window.sbiFeedMeta[$i].idsInFeed[index]);
|
929 |
+
}
|
930 |
+
var submittedData = {
|
931 |
+
action: 'sbi_set_use_backup',
|
932 |
+
transientName : transientName,
|
933 |
+
context : 'falsecache'
|
934 |
+
};
|
935 |
+
jQuery.ajax({
|
936 |
+
url: sbiajaxurl,
|
937 |
+
type: 'post',
|
938 |
+
data: submittedData,
|
939 |
+
success: function (data) {
|
940 |
+
}
|
941 |
+
}); // ajax
|
942 |
+
data = 'error';
|
943 |
+
} else if( sbiErrorResponse.indexOf('user does not exist') > -1 || sbiErrorResponse.indexOf('you cannot view this resource') > -1 ){
|
944 |
+
window.sbiFeedMeta[$i].error = {
|
945 |
+
errorMsg : '<p><b>Error: User ID <span class="sbiErrorIds">'+window.sbiFeedMeta[$i].idsInFeed[index]+'</span> does not exist, is invalid, or is private</b><br /><span>This error is only visible to WordPress admins</span>',
|
946 |
+
errorDir : "<p>Please double check that the Instagram User ID you are using is valid and not from a private account. To find your User ID simply enter your Instagram user name into this <a href='https://smashballoon.com/instagram-feed/find-instagram-user-id/' target='_blank'>tool</a>.</p>"
|
947 |
+
};
|
948 |
+
if (!$self.find('#sbi_mod_error').length) {
|
949 |
+
$self.prepend('<div id="sbi_mod_error">'+window.sbiFeedMeta[$i].error.errorMsg+window.sbiFeedMeta[$i].error.errorDir+'</div>');
|
950 |
+
} else if ($self.find('.sbiErrorIds').text().indexOf(window.sbiFeedMeta[$i].idsInFeed[index]) == -1) {
|
951 |
+
$self.find('.sbiErrorIds').append(','+window.sbiFeedMeta[$i].idsInFeed[index]);
|
952 |
+
}
|
953 |
+
data = 'error';
|
954 |
+
} else if( sbiErrorResponse.indexOf('invalid media id') > -1 ){
|
955 |
+
window.sbiFeedMeta[$i].error = {
|
956 |
+
errorMsg : '<p><b>Error: Post Id <span class="sbiErrorIds">'+window.sbiFeedMeta[$i].idsInFeed[index]+'</span> does not exist or is invalid</b><br /><span>This error is only visible to WordPress admins.</span>',
|
957 |
+
errorDir : "<p>Please double check the media (post) id is correct.</p>"
|
958 |
+
};
|
959 |
+
if (!$self.find('#sbi_mod_error').length) {
|
960 |
+
$self.prepend('<div id="sbi_mod_error">'+window.sbiFeedMeta[$i].error.errorMsg+window.sbiFeedMeta[$i].error.errorDir+'</div>');
|
961 |
+
} else if ($self.find('.sbiErrorIds').text().indexOf(window.sbiFeedMeta[$i].idsInFeed[index]) == -1) {
|
962 |
+
$self.find('.sbiErrorIds').append(','+window.sbiFeedMeta[$i].idsInFeed[index]);
|
963 |
+
}
|
964 |
+
data = 'error';
|
965 |
+
}
|
966 |
+
|
967 |
+
}
|
968 |
+
|
969 |
+
//If it's a coordinates type then add the existing URL to the object so that we can use it to create the next URL for pagination
|
970 |
+
if( getType == 'coordinates' ) data.pagination = {'previous_url':entry};
|
971 |
+
|
972 |
+
if (data !== 'error') returnedImages.push(data);
|
973 |
+
|
974 |
+
numberOfRequests--;
|
975 |
+
if(numberOfRequests == 0 && photosAvailable !== 'finished') sbiImagesReady(getType);
|
976 |
+
|
977 |
+
}
|
978 |
+
|
979 |
+
})
|
980 |
+
|
981 |
+
});
|
982 |
+
|
983 |
+
//When all of the images have been returned then pass them to the buildFeed function
|
984 |
+
function sbiImagesReady(getType){
|
985 |
+
|
986 |
+
var paginationArr = [],
|
987 |
+
returnedImagesArr = [];
|
988 |
+
|
989 |
+
//Loop through the array of returned sets of data from the Instagram API
|
990 |
+
jQuery.each( returnedImages, function( index, object ) {
|
991 |
+
|
992 |
+
if(getType == 'single') {
|
993 |
+
object.data = [ object.data ] ;
|
994 |
+
}
|
995 |
+
|
996 |
+
if( typeof object.data !== 'undefined' ){ //Check whether the returned object has data in it as error may be returned it
|
997 |
+
//Loop through each image object in the array and add it to the returnedImagesArr for sorting
|
998 |
+
jQuery.each( object.data, function( index, image ) {
|
999 |
+
|
1000 |
+
//Filter out duplicate images here. This is after the items have been counted (used below for coordinates pagination) but before being cached as duplicate images don't need to be cached.
|
1001 |
+
if( jQuery.inArray(image.id, photoIds) > -1 ){
|
1002 |
+
//Duplicate image
|
1003 |
+
} else {
|
1004 |
+
photoIds.push(image.id);
|
1005 |
+
returnedImagesArr.push( image );
|
1006 |
+
}
|
1007 |
+
});
|
1008 |
+
|
1009 |
+
|
1010 |
+
if(getType == 'coordinates'){
|
1011 |
+
//If it's a coordinates then need to create the next_url string manually by using max_timestamp and then push it onto the array
|
1012 |
+
|
1013 |
+
//Get the created_date of the last object so we can use it to create the next_url
|
1014 |
+
var lastCreatedTime = object.data[ object.data.length - 1 ].created_time,
|
1015 |
+
existing_url = object.pagination.previous_url,
|
1016 |
+
existing_url_parts = existing_url.split('max_timestamp='),
|
1017 |
+
new_url = existing_url_parts[0] + 'max_timestamp=' + lastCreatedTime;
|
1018 |
+
|
1019 |
+
//If the number of photos returned (eg: 10) is less than the number the user wants to display (eg: 20) then there are no more photos to load for this coordinates
|
1020 |
+
paginationArr.push( new_url );
|
1021 |
+
|
1022 |
+
} else {
|
1023 |
+
//If there's a next_url then add it to the pagination array
|
1024 |
+
if( typeof object.pagination === 'object' && !!object.pagination && typeof object.pagination.next_url !== 'undefined' ) paginationArr.push( object.pagination.next_url );
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
});
|
1030 |
+
|
1031 |
+
//Sort the images by date if not set to random
|
1032 |
+
if(sortby !== 'random') {
|
1033 |
+
returnedImagesArr.sort(function(x, y){
|
1034 |
+
return y.created_time - x.created_time;
|
1035 |
+
});
|
1036 |
+
} else {
|
1037 |
+
returnedImagesArr.sort(function (a, b) {
|
1038 |
+
//Randomize
|
1039 |
+
return (Math.round(Math.random())-0.5);
|
1040 |
+
});
|
1041 |
+
transientName += '!';
|
1042 |
+
}
|
1043 |
+
|
1044 |
+
//Add the data and pagination objects to the first object in the array so that we can create a super object to send back
|
1045 |
+
if (typeof returnedImages !== 'undefined') returnedImages[0].data = returnedImagesArr;
|
1046 |
+
|
1047 |
+
//Replace the next_url string with an array of URLs
|
1048 |
+
//If it's a coordinates type then we need to create the pagination object here as it doesn't exist yet
|
1049 |
+
if(typeof returnedImages[0].pagination !== 'undefined' && !!returnedImages[0].pagination) {
|
1050 |
+
//if( typeof returnedImages[0].pagination.next_url !== 'undefined' ) {
|
1051 |
+
returnedImages[0].pagination.next_url = paginationArr;
|
1052 |
+
//}
|
1053 |
+
} else {
|
1054 |
+
returnedImages[0].pagination = {
|
1055 |
+
"next_url" : ""
|
1056 |
+
};
|
1057 |
+
}
|
1058 |
+
var allImages = returnedImages[0];
|
1059 |
+
//Pass the returned images to the buildFeed function
|
1060 |
+
|
1061 |
+
if(photosAvailable !== 'finished') sbiBuildFeed(allImages, transientName, sbiSettings, $self);
|
1062 |
+
|
1063 |
+
//Iterate the API request variable so that we can limit of the number of subsequent API requests when the Load More button is clicked
|
1064 |
+
apiRequests++;
|
1065 |
+
|
1066 |
+
} // End sbiImagesReady()
|
1067 |
+
|
1068 |
+
}
|
1069 |
+
|
1070 |
+
} //End sbiFetchData()
|
1071 |
+
|
1072 |
+
//Cache the likes and comments counts by sending an array via ajax to the main plugin file which then stores it in a transient
|
1073 |
+
function sbiGetCache(transientName, sbiSettings, $self, cacheWhat, apiURLs){
|
1074 |
+
var transientData = transientName;
|
1075 |
+
window.sbiCommentCacheStatus = 0;
|
1076 |
+
var thisIndex = $self[0].getAttribute('data-sbi-index');
|
1077 |
+
|
1078 |
+
// our initial request now sends all transient names at once
|
1079 |
+
if (typeof transientName === 'object') {
|
1080 |
+
transientData = JSON.stringify(transientName);
|
1081 |
}
|
1082 |
+
var getCacheOpts = {
|
1083 |
+
url: sbiajaxurl,
|
1084 |
+
type: 'POST',
|
1085 |
+
async: true,
|
1086 |
+
cache: false,
|
1087 |
+
data:{
|
1088 |
+
action: 'get_cache',
|
1089 |
+
transientName: transientData,
|
1090 |
+
useBackupHeader: window.sbiUseBackup[thisIndex].header,
|
1091 |
+
useBackupFeed: window.sbiUseBackup[thisIndex].feed
|
1092 |
+
},
|
1093 |
+
success: function(data) {
|
1094 |
+
|
1095 |
+
//Decode the JSON to that it can be used again
|
1096 |
+
data = decodeURI(data);
|
1097 |
+
data = data.replace(/\\'/g, "'");
|
1098 |
+
|
1099 |
+
//Replace any escaped single quotes as it results in invalid JSON
|
1100 |
+
|
1101 |
+
data = data.replace(/\\'/g, "'");
|
1102 |
+
//Convert the cached JSON string back to a JSON object
|
1103 |
+
var jsonobj = JSON.parse( data );
|
1104 |
+
|
1105 |
+
if ( cacheWhat == 'all' ) {
|
1106 |
+
if (typeof jsonobj.header.error === 'undefined') {
|
1107 |
+
sbiBuildHeader(jsonobj.header, sbiSettings);
|
1108 |
+
}
|
1109 |
+
if (typeof jsonobj.feed.error === 'undefined') {
|
1110 |
+
if(photosAvailable !== 'finished') sbiBuildFeed(jsonobj.feed, transientName, sbiSettings, $self);
|
1111 |
+
if (typeof jsonobj.warning !== 'undefined') {
|
1112 |
+
var sbiErrorMsg = '<p><b>Cache Error: Looking for cache that doesn\'t exist. Now using a backup feed.</b><br /><span>This error is only visible to WordPress admins.</span>';
|
1113 |
+
var sbiErrorDir = "<p>If you are using a caching plugin, try enabling the option on the Customize tab 'Cache error API recheck' or 'Force cache to clear on interval'</p>";
|
1114 |
+
jQuery('#sb_instagram').before('<div id="sbi_mod_error">' + sbiErrorMsg + sbiErrorDir + '</div>');
|
1115 |
+
}
|
1116 |
+
} else {
|
1117 |
+
// get the index of the feed to check what processes have been done already
|
1118 |
+
feedOptions = JSON.parse($self[0].getAttribute('data-options'));
|
1119 |
+
var thisIndex = $self[0].getAttribute('data-sbi-index');
|
1120 |
+
feedOptions.feedIndex = thisIndex;
|
1121 |
+
// if the cache is unavailable and the user has enabled an attempt at the api, "tryfetch" is returned as the error
|
1122 |
+
if (window.sbiCacheStatuses[thisIndex].feed !== false && jsonobj.feed.error === 'tryfetch') {
|
1123 |
+
// on the second try, indicate that the cache isn't available to prevent this endless loop
|
1124 |
+
window.sbiCacheStatuses[thisIndex].feed = false;
|
1125 |
+
if (!$self.find('.sb_instagram_header .sbi_header_text').length) {
|
1126 |
+
window.sbiCacheStatuses[thisIndex].header = false;
|
1127 |
+
}
|
1128 |
+
|
1129 |
+
// comments do not need to be retrieved
|
1130 |
+
window.sbiCacheStatuses[thisIndex].comments = 'no';
|
1131 |
+
// prevents multiple attempts
|
1132 |
+
feedOptions.tryFetch = true;
|
1133 |
+
// start from scratch with updated feed options and statuses
|
1134 |
+
if (typeof window.sbiCacheStatuses[feedOptions.feedIndex].tryFetch === 'undefined') sbiCreateFeed($self[0], feedOptions);
|
1135 |
+
} else if (window.sbiCacheStatuses[thisIndex].feed === true) {
|
1136 |
+
var sbiErrorMsg = '<p><b>Cache Error: Looking for cache that doesn\'t exist</b><br /><span>This error is only visible to WordPress admins.</span>';
|
1137 |
+
var sbiErrorDir = "<p>If you are using a caching plugin, try enabling the option on the Customize tab 'Cache error API recheck' or 'Force cache to clear on interval'</p>";
|
1138 |
+
jQuery('#sb_instagram').empty().append( '<p style="text-align: center;">Unable to show Instagram photos</p><div id="sbi_mod_error">' + sbiErrorMsg + sbiErrorDir + '</div>');
|
1139 |
+
//sbi_set_use_backup
|
1140 |
+
var submittedData = {
|
1141 |
+
action: 'sbi_set_use_backup',
|
1142 |
+
transientName : transientName,
|
1143 |
+
context : 'falsecache'
|
1144 |
+
};
|
1145 |
+
jQuery.ajax({
|
1146 |
+
url: sbiajaxurl,
|
1147 |
+
type: 'post',
|
1148 |
+
data: submittedData,
|
1149 |
+
success: function (data) {
|
1150 |
+
}
|
1151 |
+
}); // ajax
|
1152 |
+
}
|
1153 |
+
}
|
1154 |
+
if (jsonobj.header.error === 'tryfetch') {
|
1155 |
+
feedOptions = JSON.parse($self[0].getAttribute('data-options'));
|
1156 |
+
var thisIndex = $self[0].getAttribute('data-sbi-index');
|
1157 |
+
feedOptions.feedIndex = thisIndex;
|
1158 |
+
if (window.sbiCacheStatuses[thisIndex].header !== false) {
|
1159 |
+
if (!$self.find('.sb_instagram_header .sbi_header_text').length) {
|
1160 |
+
window.sbiCacheStatuses[thisIndex].header = false;
|
1161 |
+
feedOptions.tryFetch = true;
|
1162 |
+
// start from scratch with updated feed options and statuses
|
1163 |
+
if (typeof window.sbiCacheStatuses[feedOptions.feedIndex].tryFetch === 'undefined') sbiCreateFeed($self[0], feedOptions);
|
1164 |
+
|
1165 |
+
}
|
1166 |
+
}
|
1167 |
+
}
|
1168 |
+
if (typeof jsonobj.comments.error === 'undefined') {
|
1169 |
+
sb_instagram_js_options.sbiPageCommentCache = jsonobj.comments;
|
1170 |
+
}
|
1171 |
+
|
1172 |
+
} else {
|
1173 |
+
if( cacheWhat == 'header' ){
|
1174 |
+
sbiBuildHeader(jsonobj, sbiSettings);
|
1175 |
+
} else {
|
1176 |
+
if(photosAvailable !== 'finished') sbiBuildFeed(jsonobj, transientName, sbiSettings, $self);
|
1177 |
+
}
|
1178 |
+
}
|
1179 |
+
//Pass the returned images to the buildFeed function
|
1180 |
+
|
1181 |
+
},
|
1182 |
+
error: function(xhr,textStatus,e) {
|
1183 |
+
console.log(e);
|
1184 |
+
return;
|
1185 |
+
}
|
1186 |
+
};
|
1187 |
+
|
1188 |
+
jQuery.ajax(getCacheOpts);
|
1189 |
+
|
1190 |
}
|
|
|
1191 |
|
1192 |
+
} // sbiCreateFeed
|
1193 |
+
|
1194 |
+
}); // End jQuery('#sb_instagram.sbi').each
|
1195 |
+
|
1196 |
+
}
|
1197 |
+
|
1198 |
+
|
1199 |
+
} // sb_init
|
1200 |
+
|
1201 |
+
function sbiAddTokenToExpiredList(access_token,transientName) {
|
1202 |
+
var accessTokenOpts = {
|
1203 |
+
url: sbiajaxurl,
|
1204 |
+
type: 'POST',
|
1205 |
+
async: true,
|
1206 |
+
cache: false,
|
1207 |
+
data:{
|
1208 |
+
action: 'sbi_set_expired_token',
|
1209 |
+
access_token: access_token,
|
1210 |
+
transientName: transientName
|
1211 |
+
},
|
1212 |
+
success: function(response) {
|
1213 |
+
return;
|
1214 |
+
},
|
1215 |
+
error: function(xhr,textStatus,e) {
|
1216 |
+
console.log(e);
|
1217 |
+
return;
|
1218 |
+
}
|
1219 |
+
};
|
1220 |
+
jQuery.ajax(accessTokenOpts);
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
function sbiCachePhotos(images, transientName){
|
1224 |
+
//Convert the JSON object to a string
|
1225 |
+
var jsonstring = JSON.stringify( images );
|
1226 |
+
//Encode the JSON string so that it can be stored in the database
|
1227 |
+
jsonstring = encodeURI(jsonstring);
|
1228 |
+
|
1229 |
+
if (jsonstring.indexOf('%7B%22') === 0) {
|
1230 |
+
var setCacheOpts = {
|
1231 |
+
url: sbiajaxurl,
|
1232 |
+
type: 'POST',
|
1233 |
+
async: true,
|
1234 |
+
cache: false,
|
1235 |
+
data:{
|
1236 |
+
action: 'cache_photos',
|
1237 |
+
photos: jsonstring,
|
1238 |
+
transientName: transientName,
|
1239 |
+
},
|
1240 |
+
success: function(response) {
|
1241 |
+
if ( response.indexOf('too much filtering') > -1) {
|
1242 |
+
var useBackupOpts = {
|
1243 |
+
url: sbiajaxurl,
|
1244 |
+
type: 'POST',
|
1245 |
+
async: true,
|
1246 |
+
cache: false,
|
1247 |
+
data: {
|
1248 |
+
action: 'set_use_backup',
|
1249 |
+
transientName: transientName,
|
1250 |
+
},
|
1251 |
+
success: function (response) {
|
1252 |
+
console.log(response)
|
1253 |
+
}
|
1254 |
+
};
|
1255 |
+
jQuery.ajax(useBackupOpts);
|
1256 |
+
}
|
1257 |
+
return;
|
1258 |
+
},
|
1259 |
+
error: function(xhr,textStatus,e) {
|
1260 |
+
console.log(e);
|
1261 |
+
return;
|
1262 |
+
}
|
1263 |
+
};
|
1264 |
+
jQuery.ajax(setCacheOpts);
|
1265 |
+
}
|
1266 |
+
|
1267 |
+
}
|
1268 |
+
|
1269 |
+
//function function sbiSetPhotoHeight(){
|
1270 |
+
function sbiGetColumnCount($self, cols, colsmobile) {
|
1271 |
+
var sbi_num_cols = cols,
|
1272 |
+
sbiWindowWidth = window.innerWidth;
|
1273 |
+
|
1274 |
+
if( $self.hasClass('sbi_mob_col_auto') ){
|
1275 |
+
if( sbiWindowWidth < 640 && (parseInt(cols) > 2 && parseInt(cols) < 7 ) ) sbi_num_cols = 2;
|
1276 |
+
if( sbiWindowWidth < 640 && (parseInt(cols) > 6 && parseInt(cols) < 11 ) ) sbi_num_cols = 4;
|
1277 |
+
if( sbiWindowWidth <= 480 && parseInt(cols) > 2 ) sbi_num_cols = 1;
|
1278 |
+
} else if (sbiWindowWidth <= 480){
|
1279 |
+
sbi_num_cols = colsmobile;
|
1280 |
+
}
|
1281 |
+
|
1282 |
+
return sbi_num_cols;
|
1283 |
+
}
|
1284 |
+
|
1285 |
+
function sbiGetWidthForResType(type) {
|
1286 |
+
switch (type) {
|
1287 |
+
case 'thumbnail':
|
1288 |
+
return 150;
|
1289 |
+
case 'low_resolution':
|
1290 |
+
return 320;
|
1291 |
+
default:
|
1292 |
+
return 640;
|
1293 |
+
}
|
1294 |
+
}
|
1295 |
+
|
1296 |
+
function sbiGetBestResolutionForCustom(colWidth,imageWidth,imageHeight) {
|
1297 |
+
var aspectRatio = Math.max(1,imageWidth/imageHeight),
|
1298 |
+
bestWidth = colWidth*aspectRatio,
|
1299 |
+
bestWidthRounded = Math.ceil(bestWidth / 10) * 10,
|
1300 |
+
customSizes = [30,40,50,60,80,90,100,120,130,150,160,180,190,200,240,270,280,320,350,360,390,480,540,600,640,720,750,800,810,960,1280];;
|
1301 |
+
|
1302 |
+
if (customSizes.indexOf(parseInt(bestWidthRounded)) === -1) {
|
1303 |
+
var done = false;
|
1304 |
+
jQuery.each(customSizes, function (index, item) {
|
1305 |
+
if (item > parseInt(bestWidthRounded) && !done) {
|
1306 |
+
bestWidthRounded = item;
|
1307 |
+
|
1308 |
+
done = true;
|
1309 |
+
}
|
1310 |
+
});
|
1311 |
+
}
|
1312 |
+
|
1313 |
+
return bestWidthRounded;
|
1314 |
+
}
|
1315 |
+
|
1316 |
+
function sbiNeedToRaiseRes(width,oldRes) {
|
1317 |
+
return (width > oldRes);
|
1318 |
+
}
|
1319 |
+
|
1320 |
+
function sbiGetResolutionSettings($self, imgRes, cols, colsmobile, $i) {
|
1321 |
+
var feedWidth = $self.innerWidth(),
|
1322 |
+
//colWidth = $self.innerWidth() / cols,
|
1323 |
+
photoPadding = parseInt($self.find('#sbi_images').css('padding')) * 2,
|
1324 |
+
cols = sbiGetColumnCount($self, parseInt(cols), parseInt(colsmobile)),
|
1325 |
+
colWidth = ($self.innerWidth() / cols) - photoPadding,
|
1326 |
+
imgResReturn = {
|
1327 |
+
'type' : 'low_resolution',
|
1328 |
+
'width' : ''
|
1329 |
+
},
|
1330 |
+
customSizes = [30,40,50,60,80,90,100,120,130,150,160,180,190,200,240,270,280,320,350,360,390,480,540,600,640,720,750,800,810,960,1280];
|
1331 |
+
if (!isNaN(imgRes)) {
|
1332 |
+
imgResReturn.type = 'custom';
|
1333 |
+
if (customSizes.indexOf(parseInt(imgRes)) > -1) {
|
1334 |
+
imgResReturn.width = imgRes;
|
1335 |
+
} else {
|
1336 |
+
var done = false;
|
1337 |
+
jQuery.each(customSizes,function(index,item) {
|
1338 |
+
if (item > parseInt(imgRes) && !done) {
|
1339 |
+
imgResReturn.width = item;
|
1340 |
+
done = true;
|
1341 |
+
}
|
1342 |
});
|
1343 |
+
}
|
1344 |
+
} else {
|
1345 |
+
switch(imgRes) {
|
1346 |
+
case 'auto':
|
1347 |
+
colWidth = feedWidth/cols;
|
1348 |
+
//Check if page width is less than 640. If it is then use the script above
|
1349 |
+
var sbiWindowWidth = jQuery(window).width();
|
1350 |
+
if( sbiWindowWidth < 640 && $self.is('.sbi_mob_col_auto') ){
|
1351 |
+
//Need this for mobile so that image res is right on mobile, as the number of cols isn't always accurate on mobile as they are changed using CSS
|
1352 |
+
if( feedWidth < 640 && $self.is('.sbi_col_1') ) colWidth = 480; //Use full size images - this is for carousel as it's always set to sbi_col_1
|
1353 |
+
if( feedWidth < 640 && $self.is('.sbi_col_3, .sbi_col_4, .sbi_col_5, .sbi_col_6') ) colWidth = 300; //Use medium images
|
1354 |
+
if( feedWidth < 640 && $self.is('.sbi_col_7, .sbi_col_8, .sbi_col_9, .sbi_col_10') ) colWidth = 100; //Use thumbnail images
|
1355 |
+
if( (feedWidth > 320 && feedWidth < 480) && sbiWindowWidth < 480 ) colWidth = 480; //Use full size images
|
1356 |
+
if( feedWidth < 320 && sbiWindowWidth < 480 ) colWidth = 300; //Use medium size images
|
1357 |
+
}
|
1358 |
+
|
1359 |
+
if( colWidth < 150 ){
|
1360 |
+
imgResReturn.type = 'thumbnail';
|
1361 |
+
} else if( colWidth < 320 ){
|
1362 |
+
imgResReturn.type = 'low_resolution';
|
1363 |
+
} else {
|
1364 |
+
imgResReturn.type = 'standard_resolution';
|
1365 |
+
}
|
1366 |
|
1367 |
+
break;
|
1368 |
+
case 'autocustom':
|
1369 |
+
//var imageSize = Math.ceil(colWidth / 10) * 10;
|
1370 |
|
1371 |
+
if (colWidth > 960) {
|
1372 |
+
imgResReturn.type = 'custom';
|
1373 |
+
imgResReturn.width = 1280;
|
1374 |
+
} else if((colWidth > 130 && colWidth <= 150)
|
1375 |
+
|| (colWidth > 280 && colWidth <= 320)
|
1376 |
+
|| (colWidth > 600 && colWidth <= 640) ) {
|
1377 |
|
1378 |
+
if( colWidth < 150 ){
|
1379 |
+
imgResReturn.type = 'thumbnail';
|
1380 |
+
imgResReturn.width = 150;
|
1381 |
+
} else if( colWidth <= 320 ){
|
1382 |
+
imgResReturn.type = 'low_resolution';
|
1383 |
+
imgResReturn.width = 320;
|
1384 |
+
} else {
|
1385 |
+
imgResReturn.type = 'standard_resolution';
|
1386 |
+
imgResReturn.width = 640;
|
1387 |
+
}
|
1388 |
+
|
1389 |
+
} else {
|
1390 |
+
imgResReturn.type = 'autocustom';
|
1391 |
+
imgResReturn.width = colWidth;
|
1392 |
+
}
|
1393 |
|
1394 |
+
break;
|
1395 |
+
case 'thumb':
|
1396 |
+
imgResReturn.type = 'thumbnail';
|
1397 |
+
break;
|
1398 |
+
case 'medium':
|
1399 |
+
imgResReturn.type = 'low_resolution';
|
1400 |
+
break;
|
1401 |
+
default:
|
1402 |
+
// do custom sizes if set
|
1403 |
+
imgResReturn.type = 'standard_resolution';
|
1404 |
+
}
|
1405 |
+
}
|
1406 |
+
|
1407 |
+
if ( typeof window.sbiFeedMeta[$i].minRes === 'undefined' ) {
|
1408 |
+
window.sbiFeedMeta[$i].minRes = imgResReturn.type === 'autocustom' ? sbiGetBestResolutionForCustom(colWidth,imgResReturn.width,imgResReturn.width): sbiGetWidthForResType(imgResReturn.type);
|
1409 |
+
}
|
1410 |
+
|
1411 |
+
return imgResReturn;
|
1412 |
+
}
|
1413 |
+
// Called at the very end of the feed creation process
|
1414 |
+
// Takes all of the data retrieved from the API during the feed creation process and caches it
|
1415 |
+
function sbi_cache_all(imagesArr,transientName) {
|
1416 |
+
if (transientName.indexOf('header') && typeof imagesArr.data.pagination === 'undefined') {
|
1417 |
+
sbiCachePhotos(imagesArr,transientName);
|
1418 |
+
} else if (!transientName.indexOf('header') && typeof imagesArr.data.pagination !== 'undefined') {
|
1419 |
+
sbiCachePhotos(imagesArr,transientName);
|
1420 |
+
}
|
1421 |
}
|
1422 |
|
1423 |
jQuery( document ).ready(function() {
|
1424 |
+
window.sbiCommentCacheStatus = 0;
|
1425 |
+
sbi_init(function(imagesArr,transientName) {
|
1426 |
+
sbi_cache_all(imagesArr,transientName);
|
1427 |
+
});
|
1428 |
});
|
1429 |
|
1430 |
} // end sbi_js_exists check
|
js/sb-instagram.min.js
CHANGED
@@ -1,24 +1,68 @@
|
|
1 |
-
var sbi_js_exists=(typeof sbi_js_exists!=='undefined')?!0:!1;if(!sbi_js_exists){(function(){var e
|
2 |
-
for(n in e)r=e[n],this.options[n]=r;this.context=t!=null?t:this,this.unique=this._genKey()}
|
3 |
-
return e.prototype.hasNext=function(){return typeof this.context.nextUrl=="string"&&this.context.nextUrl.length>0},e.prototype.next=function(){return this.hasNext()?this.run(this.context.nextUrl):!1},e.prototype.run=function(t){var n,r,i;if(typeof this.options.clientId!="string"&&typeof this.options.accessToken!="string")throw new Error("Missing clientId or accessToken.");if(typeof this.options.accessToken!="string"&&typeof this.options.clientId!="string")throw new Error("Missing clientId or accessToken.");return this.options.before!=null&&typeof this.options.before=="function"&&this.options.before.call(this),typeof document!="undefined"&&document!==null&&(i=document.createElement("script"),i.id="instafeed-fetcher",i.src=t||this._buildUrl(),n=document.getElementsByTagName("head"),n[0].appendChild(i),r="instafeedCache"+this.unique,window[r]=new e(this.options,this),window[r].unique=this.unique),!0},e.prototype.parse=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S;if(typeof e!="object"){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,"Invalid JSON data"),!1;throw new Error("Invalid JSON response")}
|
4 |
-
if(e.meta.code!==200){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,e.meta.error_message),!1;throw new Error("Error from Instagram: "+e.meta.error_message)}
|
5 |
-
if(e.data.length===0){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,"No images were returned from Instagram"),!1;throw new Error("No images were returned from Instagram")}
|
6 |
-
this.options.success!=null&&typeof this.options.success=="function"&&this.options.success.call(this,e),this.context.nextUrl="",e.pagination!=null&&(this.context.nextUrl=e.pagination.next_url);var lastVisiblePost=typeof e.data[Math.min(this.options.limit-1,e.data.length-1)]!=='undefined'?e.data[Math.min(this.options.limit-1,e.data.length-1)]:e.data[e.data.length],lastRetrievedPost=e.data[e.data.length-1],hasMorePosts=(typeof e.data[this.options.limit]!=='undefined');if(typeof e.pagination.next_url!=='undefined'){this.context.nextUrl=e.pagination.next_url.replace(lastRetrievedPost.id,lastVisiblePost.id)}else if(hasMorePosts){this.context.nextUrl="https://api.instagram.com/v1/users/"+this.options.userId+"/media/recent?access_token="+this.options.accessToken+"&count=33&callback=instafeedCache"+this.unique+".parse&max_id="+lastVisiblePost.id;e.pagination.next_url=this.context.nextUrl;e.pagination.next_max_id=lastVisiblePost.id}
|
7 |
-
if(e.data.length>this.options.limit){e.data=e.data.slice(0,this.options.limit)}
|
8 |
-
if(this.options.sortBy!=="none"){this.options.sortBy==="random"?d=["","random"]:d=this.options.sortBy.split("-"),p=d[0]==="least"?!0:!1;switch(d[1]){case "random":e.data.sort(function(){return.5-Math.random()});break;case "recent":e.data=this._sortBy(e.data,"created_time",p);break;case "liked":e.data=this._sortBy(e.data,"likes.count",p);break;case "commented":e.data=this._sortBy(e.data,"comments.count",p);break;default:throw new Error("Invalid option for sortBy: '"+this.options.sortBy+"'.")}}
|
9 |
-
if(typeof document!="undefined"&&document!==null&&this.options.mock===!1){a=e.data,this.options.limit!=null&&a.length>this.options.limit&&(a=a.slice(0,this.options.limit+1||9e9)),n=document.createDocumentFragment(),this.options.filter!=null&&typeof this.options.filter=="function"&&(a=this._filter(a,this.options.filter));if(this.options.template!=null&&typeof this.options.template=="string"){i="",o="",l="",v=document.createElement("div");for(m=0,b=a.length;m<b;m++)s=a[m],u=s.images[this.options.resolution].url,this.options.useHttp||(u=u.replace("http://","//")),o=this._makeTemplate(this.options.template,{model:s,id:s.id,link:s.link,image:u,caption:this._getObjectProperty(s,"caption.text"),likes:s.likes.count,comments:s.comments.count,location:this._getObjectProperty(s,"location.name")}),i+=o;v.innerHTML=i,S=[].slice.call(v.childNodes);for(g=0,w=S.length;g<w;g++)h=S[g],n.appendChild(h)}else for(y=0,E=a.length;y<E;y++)s=a[y],f=document.createElement("img"),u=s.images[this.options.resolution].url,this.options.useHttp||(u=u.replace("http://","//")),f.src=u,this.options.links===!0?(t=document.createElement("a"),t.href=s.link,t.appendChild(f),n.appendChild(t)):n.appendChild(f);this.options.target.append(n),r=document.getElementsByTagName("head")[0],r.removeChild(document.getElementById("instafeed-fetcher")),c="instafeedCache"+this.unique,window[c]=void 0;try{delete window[c]}catch(x){}}
|
10 |
-
return this.options.after!=null&&typeof this.options.after=="function"&&this.options.after.call(this),!0},e.prototype._buildUrl=function(){var e,t,n;e="https://api.instagram.com/v1";switch(this.options.get){case "popular":t="media/popular";break;case "tagged":if(typeof this.options.tagName!="string")throw new Error("No tag name specified. Use the 'tagName' option.");t="tags/"+this.options.tagName+"/media/recent";break;case "location":if(typeof this.options.locationId!="number")throw new Error("No location specified. Use the 'locationId' option.");t="locations/"+this.options.locationId+"/media/recent";break;case "user":if(typeof this.options.userId!="number")throw new Error("No user specified. Use the 'userId' option.");if(typeof this.options.accessToken!="string")throw new Error("No access token. Use the 'accessToken' option.");t="users/"+this.options.userId+"/media/recent";break;default:throw new Error("Invalid option for get: '"+this.options.get+"'.")}
|
11 |
-
return n=""+e+"/"+t,this.options.accessToken!=null?n+="?access_token="+this.options.accessToken:n+="?client_id="+this.options.clientId,this.options.limit!=null&&(n+="&count=33"),n+="&callback=instafeedCache"+this.unique+".parse",n},e.prototype._genKey=function(){var e;return e=function(){return((1+Math.random())*65536|0).toString(16).substring(1)},""+e()+e()+e()+e()},e.prototype._makeTemplate=function(e,t){var n,r,i,s,o;r=/(?:\{{2})([\w\[\]\.]+)(?:\}{2})/,n=e;while(r.test(n))i=n.match(r)[1],s=(o=this._getObjectProperty(t,i))!=null?o:"",n=n.replace(r,""+s);return n},e.prototype._getObjectProperty=function(e,t){var n,r;t=t.replace(/\[(\w+)\]/g,".$1"),r=t.split(".");while(r.length){n=r.shift();if(!(e!=null&&n in e))return null;e=e[n]}
|
12 |
-
return e},e.prototype._sortBy=function(e,t,n){var r;return r=function(e,r){var i,s;return i=this._getObjectProperty(e,t),s=this._getObjectProperty(r,t),n?i>s?1:-1:i<s?1:-1},e.sort(r.bind(this)),e},e.prototype._filter=function(e,t){var n,r,i,s,o;n=[],i=function(e){if(t(e))return n.push(e)};for(s=0,o=e.length;s<o;s++)r=e[s],i(r);return n},e}(),t=typeof exports!="undefined"&&exports!==null?exports:window,t.instagramfeed=e}).call(this);(function(){"use strict";var e=Array.prototype.slice;try{e.call(document.documentElement)}catch(t){Array.prototype.slice=function(t,n){n=typeof n!=="undefined"?n:this.length;if(Object.prototype.toString.call(this)==="[object Array]"){return e.call(this,t,n)}var r,i=[],s,o=this.length;var u=t||0;u=u>=0?u:o+u;var a=n?n:o;if(n<0){a=o+n}s=a-u;if(s>0){i=new Array(s);if(this.charAt){for(r=0;r<s;r++){i[r]=this.charAt(u+r)}}else{for(r=0;r<s;r++){i[r]=this[u+r]}}}return i}}})()
|
13 |
if(!Function.prototype.bind){Function.prototype.bind=function(e){if(typeof this!=="function"){throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable")}var t=Array.prototype.slice.call(arguments,1),n=this,r=function(){},i=function(){return n.apply(this instanceof r&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};r.prototype=this.prototype;i.prototype=new r;return i}}
|
14 |
-
function sbi_init(){window.sbiFeedMeta={};jQuery('#sb_instagram.sbi').each(function($i){var $self=jQuery(this),$target=$self.find('#sbi_images'),$loadBtn=$self.find("#sbi_load .sbi_load_btn"),imgRes='standard_resolution',cols=parseInt(this.getAttribute('data-cols'),10),feedOptions=JSON.parse(this.getAttribute('data-options')),getType='user',sortby='none',user_id=this.getAttribute('data-id'),num=this.getAttribute('data-num'),$header='',morePosts=[];jQuery(this).attr('data-sbi-index',$i);feedOptions.feedIndex=$i;window.sbiFeedMeta[$i]={'error':{},'idsInFeed':[]};if(feedOptions.sortby!=='')sortby=feedOptions.sortby;switch(this.getAttribute('data-res')){case 'auto':var feedWidth=$self.innerWidth(),colWidth=$self.innerWidth()/cols;var sbiWindowWidth=jQuery(window).width();if(sbiWindowWidth<640){if(feedWidth<640&&$self.is('.sbi_col_3, .sbi_col_4, .sbi_col_5, .sbi_col_6'))colWidth=300;if(feedWidth<640&&$self.is('.sbi_col_7, .sbi_col_8, .sbi_col_9, .sbi_col_10'))colWidth=100;if((feedWidth>320&&feedWidth<480)&&sbiWindowWidth<480)colWidth=480;if(feedWidth<320&&sbiWindowWidth<480)colWidth=300}
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var sbi_js_exists=(typeof sbi_js_exists!=='undefined')?!0:!1;if(!sbi_js_exists){(function(){"use strict";var e=Array.prototype.slice;try{e.call(document.documentElement)}catch(t){Array.prototype.slice=function(t,n){n=typeof n!=="undefined"?n:this.length;if(Object.prototype.toString.call(this)==="[object Array]"){return e.call(this,t,n)}var r,i=[],s,o=this.length;var u=t||0;u=u>=0?u:o+u;var a=n?n:o;if(n<0){a=o+n}s=a-u;if(s>0){i=new Array(s);if(this.charAt){for(r=0;r<s;r++){i[r]=this.charAt(u+r)}}else{for(r=0;r<s;r++){i[r]=this[u+r]}}}return i}}})()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
if(!Function.prototype.bind){Function.prototype.bind=function(e){if(typeof this!=="function"){throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable")}var t=Array.prototype.slice.call(arguments,1),n=this,r=function(){},i=function(){return n.apply(this instanceof r&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};r.prototype=this.prototype;i.prototype=new r;return i}}
|
3 |
+
var sbIconSVG={'fa-clock':'class="svg-inline--fa fa-clock fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="far" data-icon="clock" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm61.8-104.4l-84.9-61.7c-3.1-2.3-4.9-5.9-4.9-9.7V116c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v141.7l66.8 48.6c5.4 3.9 6.5 11.4 2.6 16.8L334.6 349c-3.9 5.3-11.4 6.5-16.8 2.6z"></path></svg>','fa-play':'class="svg-inline--fa fa-play fa-w-14 sbi_playbtn" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="play" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"></path></svg>','fa-image':'class="svg-inline--fa fa-image fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="far" data-icon="image" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"></path></svg>','fa-user':'class="svg-inline--fa fa-user fa-w-16" style="margin-right: 3px;" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="user" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M96 160C96 71.634 167.635 0 256 0s160 71.634 160 160-71.635 160-160 160S96 248.366 96 160zm304 192h-28.556c-71.006 42.713-159.912 42.695-230.888 0H112C50.144 352 0 402.144 0 464v24c0 13.255 10.745 24 24 24h464c13.255 0 24-10.745 24-24v-24c0-61.856-50.144-112-112-112z"></path></svg>','fa-comment':'class="svg-inline--fa fa-comment fa-w-18" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="comment" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M576 240c0 115-129 208-288 208-48.3 0-93.9-8.6-133.9-23.8-40.3 31.2-89.8 50.3-142.4 55.7-5.2.6-10.2-2.8-11.5-7.7-1.3-5 2.7-8.1 6.6-11.8 19.3-18.4 42.7-32.8 51.9-94.6C21.9 330.9 0 287.3 0 240 0 125.1 129 32 288 32s288 93.1 288 208z"></path></svg>','fa-heart':'class="svg-inline--fa fa-heart fa-w-18" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="heart" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M414.9 24C361.8 24 312 65.7 288 89.3 264 65.7 214.2 24 161.1 24 70.3 24 16 76.9 16 165.5c0 72.6 66.8 133.3 69.2 135.4l187 180.8c8.8 8.5 22.8 8.5 31.6 0l186.7-180.2c2.7-2.7 69.5-63.5 69.5-136C560 76.9 505.7 24 414.9 24z"></path></svg>','fa-check':'class="svg-inline--fa fa-check fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="check" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"></path></svg>','fa-exclamation-circle':'class="svg-inline--fa fa-exclamation-circle fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="exclamation-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"></path></svg>','fa-map-marker':'class="svg-inline--fa fa-map-marker fa-w-12" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="map-marker" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0z"></path></svg>','fa-clone':'class="svg-inline--fa fa-clone fa-w-16 sbi_lightbox_carousel_icon" aria-hidden="true" data-fa-processed="" data-prefix="far" data-icon="clone" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M464 0H144c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h320c26.51 0 48-21.49 48-48v-48h48c26.51 0 48-21.49 48-48V48c0-26.51-21.49-48-48-48zM362 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h42v224c0 26.51 21.49 48 48 48h224v42a6 6 0 0 1-6 6zm96-96H150a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h308a6 6 0 0 1 6 6v308a6 6 0 0 1-6 6z"></path></svg>','fa-chevron-right':'class="svg-inline--fa fa-chevron-right fa-w-10" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="chevron-right" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"></path></svg>','fa-chevron-left':'class="svg-inline--fa fa-chevron-left fa-w-10" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="chevron-left" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"></path></svg>','fa-share':'class="svg-inline--fa fa-share fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="share" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M503.691 189.836L327.687 37.851C312.281 24.546 288 35.347 288 56.015v80.053C127.371 137.907 0 170.1 0 322.326c0 61.441 39.581 122.309 83.333 154.132 13.653 9.931 33.111-2.533 28.077-18.631C66.066 312.814 132.917 274.316 288 272.085V360c0 20.7 24.3 31.453 39.687 18.164l176.004-152c11.071-9.562 11.086-26.753 0-36.328z"></path></svg>','fa-times':'class="svg-inline--fa fa-times fa-w-12" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="times" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M323.1 441l53.9-53.9c9.4-9.4 9.4-24.5 0-33.9L279.8 256l97.2-97.2c9.4-9.4 9.4-24.5 0-33.9L323.1 71c-9.4-9.4-24.5-9.4-33.9 0L192 168.2 94.8 71c-9.4-9.4-24.5-9.4-33.9 0L7 124.9c-9.4 9.4-9.4 24.5 0 33.9l97.2 97.2L7 353.2c-9.4 9.4-9.4 24.5 0 33.9L60.9 441c9.4 9.4 24.5 9.4 33.9 0l97.2-97.2 97.2 97.2c9.3 9.3 24.5 9.3 33.9 0z"></path></svg>','fa-envelope':'class="svg-inline--fa fa-envelope fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="envelope" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M502.3 190.8c3.9-3.1 9.7-.2 9.7 4.7V400c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V195.6c0-5 5.7-7.8 9.7-4.7 22.4 17.4 52.1 39.5 154.1 113.6 21.1 15.4 56.7 47.8 92.2 47.6 35.7.3 72-32.8 92.3-47.6 102-74.1 131.6-96.3 154-113.7zM256 320c23.2.4 56.6-29.2 73.4-41.4 132.7-96.3 142.8-104.7 173.4-128.7 5.8-4.5 9.2-11.5 9.2-18.9v-19c0-26.5-21.5-48-48-48H48C21.5 64 0 85.5 0 112v19c0 7.4 3.4 14.3 9.2 18.9 30.6 23.9 40.7 32.4 173.4 128.7 16.8 12.2 50.2 41.8 73.4 41.4z"></path></svg>','fa-edit':'class="svg-inline--fa fa-edit fa-w-18" aria-hidden="true" data-fa-processed="" data-prefix="far" data-icon="edit" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M402.3 344.9l32-32c5-5 13.7-1.5 13.7 5.7V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h273.5c7.1 0 10.7 8.6 5.7 13.7l-32 32c-1.5 1.5-3.5 2.3-5.7 2.3H48v352h352V350.5c0-2.1.8-4.1 2.3-5.6zm156.6-201.8L296.3 405.7l-90.4 10c-26.2 2.9-48.5-19.2-45.6-45.6l10-90.4L432.9 17.1c22.9-22.9 59.9-22.9 82.7 0l43.2 43.2c22.9 22.9 22.9 60 .1 82.8zM460.1 174L402 115.9 216.2 301.8l-7.3 65.3 65.3-7.3L460.1 174zm64.8-79.7l-43.2-43.2c-4.1-4.1-10.8-4.1-14.8 0L436 82l58.1 58.1 30.9-30.9c4-4.2 4-10.8-.1-14.9z"></path></svg>','fa-arrows-alt':'class="svg-inline--fa fa-arrows-alt fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="arrows-alt" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"></path></svg>','fa-check-circle':'class="svg-inline--fa fa-check-circle fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="check-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"></path></svg>','fa-ban':'class="svg-inline--fa fa-ban fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="ban" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 8C119.034 8 8 119.033 8 256s111.034 248 248 248 248-111.034 248-248S392.967 8 256 8zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676zM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676z"></path></svg>','fa-facebook-square':'class="svg-inline--fa fa-facebook-square fa-w-14" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="facebook-square" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M448 80v352c0 26.5-21.5 48-48 48h-85.3V302.8h60.6l8.7-67.6h-69.3V192c0-19.6 5.4-32.9 33.5-32.9H384V98.7c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9H184v67.6h60.9V480H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48z"></path></svg>','fa-twitter':'class="svg-inline--fa fa-twitter fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path></svg>','fa-google-plus':'class="svg-inline--fa fa-google-plus fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="google-plus" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8zm-70.7 372c-68.8 0-124-55.5-124-124s55.2-124 124-124c31.3 0 60.1 11 83 32.3l-33.6 32.6c-13.2-12.9-31.3-19.1-49.4-19.1-42.9 0-77.2 35.5-77.2 78.1s34.2 78.1 77.2 78.1c32.6 0 64.9-19.1 70.1-53.3h-70.1v-42.6h116.9c1.3 6.8 1.9 13.6 1.9 20.7 0 70.8-47.5 121.2-118.8 121.2zm230.2-106.2v35.5H372v-35.5h-35.5v-35.5H372v-35.5h35.5v35.5h35.2v35.5h-35.2z"></path></svg>','fa-instagram':'class="svg-inline--fa fa-instagram fa-w-14" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="instagram" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg>','fa-linkedin':'class="svg-inline--fa fa-linkedin fa-w-14" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="linkedin" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"></path></svg>','fa-pinterest':'class="svg-inline--fa fa-pinterest fa-w-16" aria-hidden="true" data-fa-processed="" data-prefix="fab" data-icon="pinterest" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path fill="currentColor" d="M496 256c0 137-111 248-248 248-25.6 0-50.2-3.9-73.4-11.1 10.1-16.5 25.2-43.5 30.8-65 3-11.6 15.4-59 15.4-59 8.1 15.4 31.7 28.5 56.8 28.5 74.8 0 128.7-68.8 128.7-154.3 0-81.9-66.9-143.2-152.9-143.2-107 0-163.9 71.8-163.9 150.1 0 36.4 19.4 81.7 50.3 96.1 4.7 2.2 7.2 1.2 8.3-3.3.8-3.4 5-20.3 6.9-28.1.6-2.5.3-4.7-1.7-7.1-10.1-12.5-18.3-35.3-18.3-56.6 0-54.7 41.4-107.6 112-107.6 60.9 0 103.6 41.5 103.6 100.9 0 67.1-33.9 113.6-78 113.6-24.3 0-42.6-20.1-36.7-44.8 7-29.5 20.5-61.3 20.5-82.6 0-19-10.2-34.9-31.4-34.9-24.9 0-44.9 25.7-44.9 60.2 0 22 7.4 36.8 7.4 36.8s-24.5 103.8-29 123.2c-5 21.4-3 51.6-.9 71.2C65.4 450.9 0 361.1 0 256 0 119 111 8 248 8s248 111 248 248z"></path></svg>','fa-spinner':'class="svg-inline--fa fa-spinner fa-w-16 fa-pulse" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="spinner" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"></path></svg>','fa-spin':'class="svg-inline--fa fa-spin fa-w-16 fa-pulse" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="spinner" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"></path></svg>'};function sbSVGify(elem){if(sb_instagram_js_options.font_method!='fontfile'){if(typeof elem==='undefined'){elem=jQuery('.sbi')}
|
4 |
+
elem.each(function(){jQuery(this).find('i.fa').each(function(){var faClass=jQuery(this).attr('class').match(/fa-[a-z-]+/),styles=jQuery(this).attr('style');if(faClass&&typeof sbIconSVG[faClass[0]]!=='undefined'){var theStyle=typeof styles!=='undefined'?'style="'+styles+'" ':'';jQuery(this).replaceWith('<svg '+theStyle+sbIconSVG[faClass[0]])}else{console.log(faClass,'missing')}})});sbiSizeSVG(elem)}}
|
5 |
+
function sbiSizeSVG(elem){if(elem.find('svg').innerWidth()>48||elem.find('.sbi_follow_btn svg').innerWidth()>30||elem.find('.fa-clone').last().innerWidth()>24||elem.find('.fa-play').last().innerWidth()>48){jQuery('.sbi_follow_btn svg').css({'margin-bottom':'-4px','margin-right':'7px','font-size':'15px','width':'15px'});elem.find('.fa-spinner').css({'font-size':'15px','width':'15px'});if(elem.find('.sbi_type_carousel .fa-clone').length){elem.find('.sbi_type_carousel .fa-clone').each(function(){var size='24px',offset='8px';if(elem.hasClass('sbi_small')){size='12px';offset='5px'}else if(elem.hasClass('sbi_medium')){size='18px';offset='5px'}
|
6 |
+
jQuery(this).css({'top':offset,'right':offset,'position':'absolute','font-size':size,'width':size,'color':'#fff','-webkit-filter':'drop-shadow( 0px 0px 2px rgba(0,0,0,.4) )','filter':'drop-shadow( 0px 0px 2px rgba(0,0,0,.4) )'})})}
|
7 |
+
if(elem.find('.sbi_item .fa-play').length){elem.find('.sbi_item .fa-play').each(function(){var size='48px',margintop='-24px',marginleft='-19px';if(jQuery(this).closest('.sbi').hasClass('sbi_small')){size='18px';margintop='-9px';marginleft='-7px'}else if(jQuery(this).closest('.sbi').hasClass('sbi_medium')){size='23px';margintop='-12px';marginleft='-10px'}
|
8 |
+
jQuery(this).css({'top':'50%','right':'50%','position':'absolute','font-size':size,'width':size,'margin-top':margintop,'margin-left':marginleft,'color':'#fff','-webkit-filter':'drop-shadow( 0px 0px 2px rgba(0,0,0,.4) )','filter':'drop-shadow( 0px 0px 2px rgba(0,0,0,.4) )'})})}}}
|
9 |
+
function sbi_init(_cache){function sbiSetUserApiUrl(user_id,at,before,extra,handleData){var url='https://api.instagram.com/v1/users/search?q='+user_id+'&access_token='+at;jQuery.ajax({method:"GET",url:url,dataType:"jsonp",success:function(data){var matchingID=data.data[0].id;jQuery.each(data.data,function(){if(this.username===user_id){matchingID=this.id}});var apiCall="https://api.instagram.com/v1/users/"+matchingID+before+"?access_token="+at+extra;handleData(apiCall,matchingID)}})}
|
10 |
+
var $i=0,sbi_time=0;sbiCreatePage(function(){jQuery('#sb_instagram.sbi').each(function(){var feedOptions=JSON.parse(this.getAttribute('data-options'))})});function sbiCreatePage(_callback){_callback();window.sbiCacheStatuses={};window.sbiFeedMeta={};window.sbiUseBackup={};jQuery('#sb_instagram.sbi').each(function(){var var_this=this,feedOptions=JSON.parse(var_this.getAttribute('data-options'));$i++;jQuery(this).attr('data-sbi-index',$i);feedOptions.feedIndex=$i;window.sbiCacheStatuses[$i]={'header':(feedOptions.sbiHeaderCache=='true'),'feed':(feedOptions.sbiCacheExists=='true')};var useBackUpJson=(typeof feedOptions.useBackup!=='undefined')?feedOptions.useBackup:'';window.sbiUseBackup[$i]={'header':(useBackUpJson.indexOf('header')>-1),'feed':(useBackUpJson.indexOf('feed')>-1)};window.sbiFeedMeta[$i]={'error':{},'idsInFeed':[],'postsInFeed':[]};setTimeout(function(){sbiCreateFeed(var_this,feedOptions)},sbi_time);function sbiCreateFeed(var_this,feedOptions){var imagesArrCount=0;var $self=jQuery(var_this),imgRes='standard_resolution',cols=parseInt(var_this.getAttribute('data-cols')),getType='user',sortby='none',num=var_this.getAttribute('data-num'),user_id=var_this.getAttribute('data-id'),$header='',morePosts=[],sbiHeaderCache=feedOptions.sbiHeaderCache,media='all';feedOptions.disablecache=(feedOptions.disablecache=='true');feedOptions.media='all';if(feedOptions.sortby!=='')sortby=feedOptions.sortby;imgRes=sbiGetResolutionSettings($self,var_this.getAttribute('data-res'),cols,cols,$i);var ids_arr=user_id.replace(/ /g,'').split(","),looparray=ids_arr;var apiURLs=[],apiCall='';jQuery.each(looparray,function(index,entry){apiCall="https://api.instagram.com/v1/users/"+entry+"/media/recent?access_token="+sb_instagram_js_options.sb_instagram_at+"&count=33";window.sbiFeedMeta[$i].idsInFeed.push(entry);apiURLs.push(apiCall)});var sbiSettings={num:num,getType:getType,user_id:user_id,cols:cols,imgRes:imgRes,sortby:sortby,feedOptions:feedOptions,looparray:looparray};var sbi_cache_string_include='';var sbi_cache_string_exclude='';var sbiTransientNames={'header':'','feed':''};var sbi_cache_string_include_length=sbi_cache_string_include.length;var sbi_cache_string_exclude_length=sbi_cache_string_exclude.length;var sbi_cache_string_length=40-Math.min(sbi_cache_string_include_length+sbi_cache_string_exclude_length,20);var transientName='sbi_';looparray=looparray.join().replace(/[.,-\/#!$%\^&\*;:{}=\-_`~()]/g,"");if(feedOptions.media!=='all')transientName+=feedOptions.media.substring(0,1);transientName+=looparray.substring(0,sbi_cache_string_length);sbi_cache_string_length=transientName.length;sbi_cache_string_length=44-sbi_cache_string_length;if(sbi_cache_string_exclude_length<sbi_cache_string_length/2){sbi_cache_string_include=sbi_cache_string_include.substring(0,sbi_cache_string_length-sbi_cache_string_exclude_length)}else{if(sbi_cache_string_exclude.length==0){sbi_cache_string_include=sbi_cache_string_include.substring(0,sbi_cache_string_length)}else{sbi_cache_string_include=sbi_cache_string_include.substring(0,sbi_cache_string_length/2)}
|
11 |
+
if(sbi_cache_string_include.length==0){sbi_cache_string_exclude=sbi_cache_string_exclude.substring(0,sbi_cache_string_length)}else{sbi_cache_string_exclude=sbi_cache_string_exclude.substring(0,sbi_cache_string_length/2)}}
|
12 |
+
function getHeaderTransientName(looparrayZero){var headerTransientName='sbi_header_'+looparrayZero;headerTransientName=headerTransientName.substring(0,45);return headerTransientName}
|
13 |
+
transientName+=sbi_cache_string_include+sbi_cache_string_exclude;sbiTransientNames.feed=transientName.substring(0,45);sbiTransientNames.header=getHeaderTransientName(sbiSettings.looparray[0]);if(!sb_instagram_js_options.sbiPageCommentCache&&window.sbiCommentCacheStatus===1&&window.sbiStandalone.noDB!==!0){sbiTransientNames.comments='need'}else{sbiTransientNames.comments='no'}
|
14 |
+
if((window.sbiCacheStatuses[feedOptions.feedIndex].feed===!0||window.sbiCacheStatuses[feedOptions.feedIndex].header===!0||sbiTransientNames.comments==='need')&&!feedOptions.disablecache&&typeof feedOptions.tryFetch==='undefined'){var images=sbiGetCache(sbiTransientNames,sbiSettings,$self,'all',apiURLs);sbiTransientNames.comments='no'}
|
15 |
+
if(getType=='user'&&isNaN(ids_arr[0])){sbiSetUserApiUrl(ids_arr[0],sb_instagram_js_options.sb_instagram_at,'/media/recent','&count=33',function(apiURL,newFeedID){sbiSettings.user_id=newFeedID;sbiFetchData([apiURL],sbiTransientNames.feed,sbiSettings,$self)})}else{if(window.sbiCacheStatuses[feedOptions.feedIndex].feed===!1&&window.sbiCacheStatuses[feedOptions.feedIndex].feed!=='fetched'){window.sbiCacheStatuses[feedOptions.feedIndex].feed='fetched';window.sbiCacheStatuses[feedOptions.feedIndex].tryFetch='done';sbiFetchData(apiURLs,sbiTransientNames.feed,sbiSettings,$self)}
|
16 |
+
if(!window.sbiCacheStatuses[feedOptions.feedIndex].header&&window.sbiCacheStatuses[feedOptions.feedIndex].header!=='fetched'&&sbiSettings.getType==='user'){window.sbiCacheStatuses[feedOptions.feedIndex].header='fetched';var sbi_page_url='https://api.instagram.com/v1/users/'+sbiSettings.user_id+'?access_token='+sb_instagram_js_options.sb_instagram_at;jQuery.ajax({method:"GET",url:sbi_page_url,dataType:"jsonp",success:function(data){sbiBuildHeader(data,sbiSettings);if(!feedOptions.disablecache&&window.sbiCacheStatuses[feedOptions.feedIndex].header!=='cached'&&typeof data.data.username!=='undefined'&&typeof data.data.pagination==='undefined'){window.sbiCacheStatuses[feedOptions.feedIndex].header='cached';sbiCachePhotos(data,sbiTransientNames.header)}}})}}
|
17 |
+
var imagesArr='',sbiNewData=!1,noMoreData=!1,photoIds=[],imagesHTML='',photosAvailable=0,apiRequests=1;function sbiBuildFeed(images,transientName,sbiSettings,$self){var $loadBtn=$self.find("#sbi_load .sbi_load_btn"),num=parseInt(sbiSettings.num),cols=parseInt(sbiSettings.cols),feedOptions=sbiSettings.feedOptions,itemCount=0,imgRes=sbiSettings.imgRes,getType=feedOptions.type,maxRequests=parseInt(feedOptions.maxrequests),imagepadding=feedOptions.imagepadding,imagepaddingunit=feedOptions.imagepaddingunit,looparray=sbiSettings.looparray,headerstyle=feedOptions.headerstyle,headerprimarycolor=feedOptions.headerprimarycolor,headersecondarycolor=feedOptions.headersecondarycolor,media=feedOptions.media;if(imagesArr==''){imagesArr=images}else if(sbiNewData==!0){jQuery.each(images.data,function(index,entry){imagesArr.data.push(entry)});sbiNewData=!1}
|
18 |
+
var imagesNextUrl=images.pagination.next_url;if(typeof imagesNextUrl==='undefined'||imagesNextUrl.length==0){noMoreData=!0}else{$loadBtn.show()}
|
19 |
+
if(typeof images.pagination!=='undefined')imagesArr.pagination=images.pagination;if(feedOptions.sortby!=='')sortby=feedOptions.sortby;var sbiDefaultClass=(feedOptions.hovercolor=='0,0,0')?" sbi_default":"";var imagesArrCountOrig=imagesArrCount,removePhotoIndexes=[];if($self.find('.sbi_header_link').length==0){var sbi_page_url='https://api.instagram.com/v1/users/'+looparray[0]+'?access_token='+sb_instagram_js_options.sb_instagram_at;if(isNaN(looparray[0])){sbiSetUserApiUrl(looparray[0],sb_instagram_js_options.sb_instagram_at,'','',function(apiURL){sbi_page_url=apiURL;if(sbiHeaderCache=='true'&&!feedOptions.disablecache){}else{jQuery.ajax({method:"GET",url:sbi_page_url,dataType:"jsonp",success:function(data){sbiBuildHeader(data,sbiSettings);if(!feedOptions.disablecache&&window.sbiCacheStatuses[feedOptions.feedIndex].header!=='cached'&&typeof data.data.username!=='undefined'&&typeof data.data.pagination==='undefined'){window.sbiCacheStatuses[feedOptions.feedIndex].header='cached';sbiCachePhotos(data,headerTransientName)}}})}})}else{var headerTransientName='sbi_header_'+looparray[0];headerTransientName=headerTransientName.substring(0,45);if(sbiHeaderCache=='true'&&!feedOptions.disablecache){}else if($self.find('.sb_instagram_header').length){jQuery.ajax({method:"GET",url:sbi_page_url,dataType:"jsonp",success:function(data){sbiBuildHeader(data,sbiSettings);if(!feedOptions.disablecache&&window.sbiCacheStatuses[feedOptions.feedIndex].header!=='cached'&&typeof data.data!=='undefined'&&typeof data.data.username!=='undefined'&&typeof data.data.pagination==='undefined'){window.sbiCacheStatuses[feedOptions.feedIndex].header='cached';sbiCachePhotos(data,headerTransientName)}}})}}}
|
20 |
+
jQuery.each(imagesArr.data,function(itemNumber,item){if(media=='videos'&&item.type!=='video')removePhoto=!0;if(media=='photos'&&item.type!=='image'&&item.type!=='carousel')removePhoto=!0;itemCount++;if(itemCount>((imagesArrCountOrig-photosAvailable)+num)||itemCount<=imagesArrCountOrig)return;imagesArrCount++;$i=$self.attr('data-sbi-index');if(jQuery.inArray(item.id,window.sbiFeedMeta[$i].postsInFeed)>-1){return}else{window.sbiFeedMeta[$i].postsInFeed.push(item.id)}
|
21 |
+
var videoIsFirstCarouselItem=!1;if(item.type==='carousel'&&typeof item.carousel_media!=='undefined'){jQuery.each(item.carousel_media,function(index,value){if(typeof value.videos!=='undefined'){if(index===0){videoIsFirstCarouselItem=!0}}})}
|
22 |
+
var data_image=item.images.standard_resolution.url;switch(imgRes.type){case 'thumbnail':data_image=item.images.thumbnail.url;break;case 'low_resolution':data_image=item.images.low_resolution.url;break;case 'custom':data_image=item.images.standard_resolution.url.replace('640x640/',imgRes.width+'x'+imgRes.width+'/');break;case 'autocustom':var thisImageReplace=sbiGetBestResolutionForCustom(imgRes.width,item.images.standard_resolution.width,item.images.standard_resolution.height)
|
23 |
+
data_image=item.images.standard_resolution.url.replace('640x640/',thisImageReplace+'x'+thisImageReplace+'/');break}
|
24 |
+
data_image=data_image.split("?ig_cache_key")[0];var captionText='',created_time_raw=item.created_time;var videoIsFirstCarouselItemClass=videoIsFirstCarouselItem?' sbi_carousel_vid_first':'',carouselTypeIcon=item.type==='carousel'?'<i class="fa fa-clone sbi_carousel_icon" aria-hidden="true"></i>':'';var playBtnHtml=item.type==='video'||videoIsFirstCarouselItemClass?'<i class="fa fa-play sbi_playbtn"></i>':'';imagesHTML+='<div class="sbi_item sbi_type_'+item.type+' sbi_new" id="sbi_'+item.id+'" data-date="'+created_time_raw+'">'+'<div class="sbi_photo_wrap">'+carouselTypeIcon+playBtnHtml+'<a class="sbi_photo" href="'+item.link+'" target="_blank">'+'<img src="'+data_image+'" alt="'+captionText+'" width="200" height="200" />'+'</a>'+'</div>'+'</div>'});removePhotoIndexes.reverse();jQuery.each(removePhotoIndexes,function(index,itemNumber){imagesArr.data.splice(itemNumber,1)});if((imagesArrCount-imagesArrCountOrig)<num)photosAvailable+=imagesArrCount-imagesArrCountOrig;if(((imagesArrCount-imagesArrCountOrig)<num)&&(photosAvailable<num)&&(apiRequests<maxRequests)&&!noMoreData){var sbiFetchURL=imagesArr.pagination.next_url;window.sbiCacheStatuses[feedOptions.feedIndex].feed='fetched';sbiFetchData(sbiFetchURL,sbiTransientNames.feed,sbiSettings,$self);sbiNewData=!0}else{$self.find('#sbi_images').append(imagesHTML);sbiAfterImagesLoaded(imagesArr,sbiTransientNames.feed);imagesHTML='';$self.find('.sbi_loader').remove();$loadBtn.find('.fa-spinner').hide();$loadBtn.find('.sbi_btn_text').css('opacity',1)}
|
25 |
+
function sbiAfterImagesLoaded(imagesArr,transientName){sbiSizeSVG($self);$self.find('.sbi_item').each(function(){var $self=jQuery(this);$self.find('.sbi_photo').hover(function(){jQuery(this).fadeTo(200,0.85)},function(){jQuery(this).stop().fadeTo(500,1)})});$self.find('#sbi_images .sbi_item.sbi_new').sort(function(a,b){var aComp=jQuery(a).attr("data-date"),bComp=jQuery(b).attr("data-date");if(sortby=='none'){return bComp-aComp}else{return(Math.round(Math.random())-0.5)}}).appendTo($self.find("#sbi_images"));setTimeout(function(){jQuery('#sbi_images .sbi_item.sbi_new').removeClass('sbi_new');morePosts=[]},500);var imagesArrLength=imagesArr.data.length;if(((imagesArrCount>=imagesArrLength)&&noMoreData)){$loadBtn.hide()}
|
26 |
+
$self.find('#sbi_load .sbi_load_btn').off().on('click',function(){$loadBtn.find('.fa-spinner').show();$loadBtn.find('.sbi_btn_text').css('opacity',0);photosAvailable=0;imagesArrCount=parseInt(imagesArrCount);imagesArrLength=imagesArr.data.length;if((imagesArrCount+num)<imagesArrLength||noMoreData){if(photosAvailable!=='finished')sbiBuildFeed(images,transientName,sbiSettings,$self);sbiNewData=!1;if((imagesArrCount>=imagesArrLength)&&noMoreData){$loadBtn.hide()}}else{sbiFetchURL=imagesArr.pagination.next_url;window.sbiCacheStatuses[feedOptions.feedIndex].feed='fetched';sbiFetchData(sbiFetchURL,transientName,sbiSettings,$self);sbiNewData=!0;apiRequests=0}});if(typeof sbi_custom_js=='function')setTimeout(function(){sbi_custom_js()},100);if(imgRes!=='thumbnail'){var sbi_imgLiquid=sbi_imgLiquid||{VER:"0.9.944"};sbi_imgLiquid.bgs_Available=!1,sbi_imgLiquid.bgs_CheckRunned=!1,function(i){function t(){if(!sbi_imgLiquid.bgs_CheckRunned){sbi_imgLiquid.bgs_CheckRunned=!0;var t=i('<span style="background-size:cover" />');i("body").append(t),!function(){var i=t[0];if(i&&window.getComputedStyle){var e=window.getComputedStyle(i,null);e&&e.backgroundSize&&(sbi_imgLiquid.bgs_Available="cover"===e.backgroundSize)}}(),t.remove()}}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},t();var a=this;return this.options=e,this.settings=i.extend({},this.defaults,this.options),this.settings.onStart&&this.settings.onStart(),this.each(function(t){function e(){-1===u.css("background-image").indexOf(encodeURI(c.attr("src")))&&u.css({"background-image":'url("'+encodeURI(c.attr("src"))+'")'}),u.css({"background-size":g.fill?"cover":"contain","background-position":(g.horizontalAlign+" "+g.verticalAlign).toLowerCase(),"background-repeat":"no-repeat"}),i("a:first",u).css({display:"block",width:"100%",height:"100%"}),i("img",u).css({display:"none"}),g.onItemFinish&&g.onItemFinish(t,u,c),u.addClass("sbi_imgLiquid_bgSize"),u.addClass("sbi_imgLiquid_ready"),l()}function o(){function e(){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))}if(c.data("oldSrc")&&c.data("oldSrc")!==c.attr("src")){var a=c.clone().removeAttr("style");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)}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({visibility:"visible","max-width":"none","max-height":"none",width:"auto",height:"auto",display:"block"}),c.on("error",n),c[0].onerror=n,e(),void d())}function d(){(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))}function n(){c.data("sbi_imgLiquid_error",!0),u.addClass("sbi_imgLiquid_error"),g.onItemError&&g.onItemError(t,u,c),l()}function s(){var i={};if(a.settings.useDataHtmlAttr){var t=u.attr("data-sbi_imgLiquid-fill"),e=u.attr("data-sbi_imgLiquid-horizontalAlign"),o=u.attr("data-sbi_imgLiquid-verticalAlign");("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)}return sbi_imgLiquid.isIE&&a.settings.ieFadeInDisabled&&(i.fadeInTime=0),i}function r(){var i,e,a,o,d,n,s,r,m=0,h=0,f=u.width(),v=u.height();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({width:i,height:e,"margin-left":Math.floor(h),"margin-top":Math.floor(m)}),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()}function l(){t===a.length-1&&a.settings.onFinish&&a.settings.onFinish()}var g=a.settings,u=i(this),c=i("img:first",u);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()})}})}(jQuery);!function(){var css=sbi_imgLiquid.injectCss,head=document.getElementsByTagName('head')[0],style=document.createElement('style');style.type='text/css';if(style.styleSheet){style.styleSheet.cssText=css}else{style.appendChild(document.createTextNode(css))}
|
27 |
+
head.appendChild(style)}();$self.find(".sbi_photo").sbi_imgLiquid({fill:!0})}
|
28 |
+
var sbi_delay=(function(){var sbi_timer=0;return function(sbi_callback,sbi_ms){clearTimeout(sbi_timer);sbi_timer=setTimeout(sbi_callback,sbi_ms)}})();jQuery(window).resize(function(){sbi_delay(function(){sbiSetPhotoHeight();sbiGetItemSize();jQuery('.sbi').each(function(){var $sbiSelf=jQuery(this),$i=jQuery(this).attr('data-sbi-index');sbiSizeSVG($sbiSelf);if($sbiSelf.attr('data-res')==='autocustom'){var oldRes=window.sbiFeedMeta[$i].minRes;var imageSize=sbiGetResolutionSettings($sbiSelf,'autocustom',cols,colsmobile,$i),width=imageSize.width!==''?imageSize.width:sbiGetWidthForResType(imageSize.type);if(sbiNeedToRaiseRes(width,oldRes)){window.sbiFeedMeta[$i].minRes=640;$sbiSelf.find('.sbi_item').each(function(){var newUrl=jQuery(this).find('.sbi_link_area').length?jQuery(this).find('.sbi_link_area').attr('href'):'';var oldUrl=jQuery(this).find('.sbi_photo img').attr('src'),newRes=640,$photo=jQuery(this);if(newUrl===''){if(oldUrl.indexOf('p'+oldRes+'x'+oldRes)>-1){newUrl=oldUrl.replace('p'+oldRes+'x'+oldRes,'p'+newRes+'x'+newRes)}else if(oldUrl.indexOf('s'+oldRes+'x'+oldRes)>-1){newUrl=oldUrl.replace('s'+oldRes+'x'+oldRes,'s'+newRes+'x'+newRes)}}
|
29 |
+
$photo.find('.sbi_photo img').attr('src',newUrl);$photo.find('.sbi_photo').css('background-image','url("'+newUrl+'")')})}}})},500)});function sbiSetPhotoHeight(){if(imgRes!=='thumbnail'){var sbi_photo_width=$self.find('.sbi_photo').eq(0).innerWidth();var sbi_num_cols=sbiGetColumnCount($self,parseInt(cols),parseInt(cols));var sbi_photo_width_manual=($self.find('#sbi_images').width()/sbi_num_cols)-(imagepadding*2);if(sbi_photo_width<=(sbi_photo_width_manual))sbi_photo_width=sbi_photo_width_manual;$self.find('.sbi_photo').css('height',sbi_photo_width);var sbi_arrows_top=($self.find('.sbi_photo').eq(0).innerWidth()/2);if(imagepaddingunit=='px')sbi_arrows_top+=parseInt(imagepadding)*2;$self.find('.sbi_owl-buttons div').css('top',sbi_arrows_top)}}
|
30 |
+
sbiSetPhotoHeight();!function(i){var n={callback:function(){},runOnLoad:!0,frequency:100,sbiPreviousVisibility:null},c={};c.sbiCheckVisibility=function(i,n){if(jQuery.contains(document,i[0])){var e=n.sbiPreviousVisibility,t=i.is(":visible");n.sbiPreviousVisibility=t,null==e?n.runOnLoad&&n.callback(i,t):e!==t&&n.callback(i,t),setTimeout(function(){c.sbiCheckVisibility(i,n)},n.frequency)}},i.fn.sbiVisibilityChanged=function(e){var t=i.extend({},n,e);return this.each(function(){c.sbiCheckVisibility(i(this),t)})}}(jQuery);jQuery(".sbi").filter(':hidden').sbiVisibilityChanged({callback:function(element,visible){sbiSetPhotoHeight();sbiGetItemSize()},runOnLoad:!1});function sbiGetItemSize(){$self.removeClass('sbi_small sbi_medium');var sbiItemWidth=$self.find('.sbi_item').innerWidth();if(sbiItemWidth>120&&sbiItemWidth<240){$self.addClass('sbi_medium')}else if(sbiItemWidth<=120){$self.addClass('sbi_small')}}
|
31 |
+
sbiGetItemSize();if(!feedOptions.disablecache&&typeof _cache!=='undefined'&&window.sbiCacheStatuses[feedOptions.feedIndex].feed==='fetched'){_cache(imagesArr,transientName);window.sbiCacheStatuses[feedOptions.feedIndex].feed='cached'}
|
32 |
+
photosAvailable='finished';sbSVGify($self)}}
|
33 |
+
function commaSeparateNumber(val){while(/(\d+)(\d{3})/.test(val.toString())){val=val.toString().replace(/(\d+)(\d{3})/,'$1'+','+'$2')}
|
34 |
+
return val}
|
35 |
+
function sbiBuildHeader(data,sbiSettings){if(typeof data.meta.error_message!=='undefined')return;var feedOptions=sbiSettings.feedOptions,headerStyles='';if(feedOptions.headercolor.length)headerStyles='style="color: #'+feedOptions.headercolor+'"';$header='<a href="https://www.instagram.com/'+data.data.username+'" target="_blank" title="@'+data.data.username+'" class="sbi_header_link" '+headerStyles+'>';$header+='<div class="sbi_header_text">';var classheader='';if((typeof data.data.bio!=='undefined'&&data.data.bio.length<1)||feedOptions.showbio!='true')classheader=' class="sbi_no_bio"';$header+='<h3 '+headerStyles+classheader+'>'+data.data.username+'</h3>';var $headerInfo='<p class="sbi_bio_info" ';if(feedOptions.headerstyle=='boxed'){$headerInfo+='style="color: #'+feedOptions.headerprimarycolor+';"'}else{$headerInfo+=headerStyles}
|
36 |
+
if(typeof data.data.bio!=='undefined'&&data.data.bio.length>1&&feedOptions.showbio!=''&&feedOptions.showbio!='false')$header+='<p class="sbi_bio" '+headerStyles+'>'+data.data.bio+'</p>';$header+='</div>';$header+='<div class="sbi_header_img">';$header+='<div class="sbi_header_img_hover"><i class="sbi_new_logo"></i></div>';$header+='<img src="'+data.data.profile_picture+'" alt="'+data.data.full_name+'" width="50" height="50">';$header+='</div>';$header+='</a>';if(feedOptions.headerstyle=='boxed'){$header+='<div class="sbi_header_bar" style="background: #'+feedOptions.headersecondarycolor+'">';if(feedOptions.showbio!='false')$header+=$headerInfo;$header+='<a class="sbi_header_follow_btn" href="https://www.instagram.com/'+data.data.username+'" target="_blank" style="color: #'+feedOptions.headercolor+'; background: #'+feedOptions.headerprimarycolor+';"><i class="sbi_new_logo"></i><span></span></div></div>'}
|
37 |
+
if($self.find('.sbi_header_link').length==0)$self.find('.sb_instagram_header').prepend($header);if($self.find('.sbi_follow_btn').length)$self.find('.sbi_follow_btn a').attr('href','https://www.instagram.com/'+data.data.username);if(feedOptions.headerstyle=='boxed'&&$self.find('.sbi_header_follow_btn').length)$self.find('.sbi_header_follow_btn span').text($self.find('.sb_instagram_header').attr('data-follow-text').replace(/\\/g,""));$self.find('.sb_instagram_header .sbi_header_link').hover(function(){$self.find('.sb_instagram_header .sbi_header_img_hover').fadeIn(200)},function(){$self.find('.sb_instagram_header .sbi_header_img_hover').stop().fadeOut(600)});sbSVGify($self.find('.sb_instagram_header'))}
|
38 |
+
function sbiFetchData(next_url,transientName,sbiSettings,$self){apiURLs=next_url;var urlCount=apiURLs.length,getType=sbiSettings.getType;if(urlCount==0){if(imagesArrCount+parseInt(sbiSettings.num)>=imagesArr.data.length){jQuery('#sbi_load .sbi_load_btn').hide()}}else{var returnedImages=[],numberOfRequests=urlCount;jQuery.each(apiURLs,function(index,entry){jQuery.ajax({method:"GET",url:entry,dataType:"jsonp",success:function(data){var sbiErrorResponse=data.meta.error_message,sbiErrorMsg='',sbiErrorDir='';if(typeof sbiErrorResponse!=='undefined'){if(sbiErrorResponse.indexOf('access_token')>-1){sbiErrorMsg+='<p><b>Error: Access Token is not valid or has expired</b><br /><span>This error message is only visible to WordPress admins</span></p>';sbiErrorDir="<p>There's an issue with the Instagram Access Token that you are using. Please obtain a new Access Token on the plugin's Settings page.<br />If you continue to have an issue with your Access Token then please see <a href='https://smashballoon.com/my-instagram-access-token-keep-expiring/' target='_blank'>this FAQ</a> for more information.</p>";jQuery('#sb_instagram').empty().append('<p style="text-align: center;">Unable to show Instagram photos</p><div id="sbi_mod_error">'+sbiErrorMsg+sbiErrorDir+'</div>');sbiAddTokenToExpiredList(sb_instagram_js_options.sb_instagram_at,transientName);return}else if(typeof data.code!=='undefined'&&data.code=='429'){window.sbiFeedMeta[$i].error={errorMsg:'<p><b>Error: Rate Limit Reached</b><br /><span>This error is only visible to WordPress admins</span>',errorDir:"<p>Backup cache will be used for 1 hour</p>"};if(!$self.find('#sbi_mod_error').length){$self.prepend('<div id="sbi_mod_error">'+window.sbiFeedMeta[$i].error.errorMsg+window.sbiFeedMeta[$i].error.errorDir+'</div>')}else if($self.find('.sbiErrorIds').text().indexOf(window.sbiFeedMeta[$i].idsInFeed[index])==-1){$self.find('.sbiErrorIds').append(','+window.sbiFeedMeta[$i].idsInFeed[index])}
|
39 |
+
var submittedData={action:'sbi_set_use_backup',transientName:transientName,context:'falsecache'};jQuery.ajax({url:sbiajaxurl,type:'post',data:submittedData,success:function(data){}});data='error'}else if(sbiErrorResponse.indexOf('user does not exist')>-1||sbiErrorResponse.indexOf('you cannot view this resource')>-1){window.sbiFeedMeta[$i].error={errorMsg:'<p><b>Error: User ID <span class="sbiErrorIds">'+window.sbiFeedMeta[$i].idsInFeed[index]+'</span> does not exist, is invalid, or is private</b><br /><span>This error is only visible to WordPress admins</span>',errorDir:"<p>Please double check that the Instagram User ID you are using is valid and not from a private account. To find your User ID simply enter your Instagram user name into this <a href='https://smashballoon.com/instagram-feed/find-instagram-user-id/' target='_blank'>tool</a>.</p>"};if(!$self.find('#sbi_mod_error').length){$self.prepend('<div id="sbi_mod_error">'+window.sbiFeedMeta[$i].error.errorMsg+window.sbiFeedMeta[$i].error.errorDir+'</div>')}else if($self.find('.sbiErrorIds').text().indexOf(window.sbiFeedMeta[$i].idsInFeed[index])==-1){$self.find('.sbiErrorIds').append(','+window.sbiFeedMeta[$i].idsInFeed[index])}
|
40 |
+
data='error'}else if(sbiErrorResponse.indexOf('invalid media id')>-1){window.sbiFeedMeta[$i].error={errorMsg:'<p><b>Error: Post Id <span class="sbiErrorIds">'+window.sbiFeedMeta[$i].idsInFeed[index]+'</span> does not exist or is invalid</b><br /><span>This error is only visible to WordPress admins.</span>',errorDir:"<p>Please double check the media (post) id is correct.</p>"};if(!$self.find('#sbi_mod_error').length){$self.prepend('<div id="sbi_mod_error">'+window.sbiFeedMeta[$i].error.errorMsg+window.sbiFeedMeta[$i].error.errorDir+'</div>')}else if($self.find('.sbiErrorIds').text().indexOf(window.sbiFeedMeta[$i].idsInFeed[index])==-1){$self.find('.sbiErrorIds').append(','+window.sbiFeedMeta[$i].idsInFeed[index])}
|
41 |
+
data='error'}}
|
42 |
+
if(getType=='coordinates')data.pagination={'previous_url':entry};if(data!=='error')returnedImages.push(data);numberOfRequests--;if(numberOfRequests==0&&photosAvailable!=='finished')sbiImagesReady(getType)}})});function sbiImagesReady(getType){var paginationArr=[],returnedImagesArr=[];jQuery.each(returnedImages,function(index,object){if(getType=='single'){object.data=[object.data]}
|
43 |
+
if(typeof object.data!=='undefined'){jQuery.each(object.data,function(index,image){if(jQuery.inArray(image.id,photoIds)>-1){}else{photoIds.push(image.id);returnedImagesArr.push(image)}});if(getType=='coordinates'){var lastCreatedTime=object.data[object.data.length-1].created_time,existing_url=object.pagination.previous_url,existing_url_parts=existing_url.split('max_timestamp='),new_url=existing_url_parts[0]+'max_timestamp='+lastCreatedTime;paginationArr.push(new_url)}else{if(typeof object.pagination==='object'&&!!object.pagination&&typeof object.pagination.next_url!=='undefined')paginationArr.push(object.pagination.next_url)}}});if(sortby!=='random'){returnedImagesArr.sort(function(x,y){return y.created_time-x.created_time})}else{returnedImagesArr.sort(function(a,b){return(Math.round(Math.random())-0.5)});transientName+='!'}
|
44 |
+
if(typeof returnedImages!=='undefined')returnedImages[0].data=returnedImagesArr;if(typeof returnedImages[0].pagination!=='undefined'&&!!returnedImages[0].pagination){returnedImages[0].pagination.next_url=paginationArr}else{returnedImages[0].pagination={"next_url":""}}
|
45 |
+
var allImages=returnedImages[0];if(photosAvailable!=='finished')sbiBuildFeed(allImages,transientName,sbiSettings,$self);apiRequests++}}}
|
46 |
+
function sbiGetCache(transientName,sbiSettings,$self,cacheWhat,apiURLs){var transientData=transientName;window.sbiCommentCacheStatus=0;var thisIndex=$self[0].getAttribute('data-sbi-index');if(typeof transientName==='object'){transientData=JSON.stringify(transientName)}
|
47 |
+
var getCacheOpts={url:sbiajaxurl,type:'POST',async:!0,cache:!1,data:{action:'get_cache',transientName:transientData,useBackupHeader:window.sbiUseBackup[thisIndex].header,useBackupFeed:window.sbiUseBackup[thisIndex].feed},success:function(data){data=decodeURI(data);data=data.replace(/\\'/g,"'");data=data.replace(/\\'/g,"'");var jsonobj=JSON.parse(data);if(cacheWhat=='all'){if(typeof jsonobj.header.error==='undefined'){sbiBuildHeader(jsonobj.header,sbiSettings)}
|
48 |
+
if(typeof jsonobj.feed.error==='undefined'){if(photosAvailable!=='finished')sbiBuildFeed(jsonobj.feed,transientName,sbiSettings,$self);if(typeof jsonobj.warning!=='undefined'){var sbiErrorMsg='<p><b>Cache Error: Looking for cache that doesn\'t exist. Now using a backup feed.</b><br /><span>This error is only visible to WordPress admins.</span>';var sbiErrorDir="<p>If you are using a caching plugin, try enabling the option on the Customize tab 'Cache error API recheck' or 'Force cache to clear on interval'</p>";jQuery('#sb_instagram').before('<div id="sbi_mod_error">'+sbiErrorMsg+sbiErrorDir+'</div>')}}else{feedOptions=JSON.parse($self[0].getAttribute('data-options'));var thisIndex=$self[0].getAttribute('data-sbi-index');feedOptions.feedIndex=thisIndex;if(window.sbiCacheStatuses[thisIndex].feed!==!1&&jsonobj.feed.error==='tryfetch'){window.sbiCacheStatuses[thisIndex].feed=!1;if(!$self.find('.sb_instagram_header .sbi_header_text').length){window.sbiCacheStatuses[thisIndex].header=!1}
|
49 |
+
window.sbiCacheStatuses[thisIndex].comments='no';feedOptions.tryFetch=!0;if(typeof window.sbiCacheStatuses[feedOptions.feedIndex].tryFetch==='undefined')sbiCreateFeed($self[0],feedOptions)}else if(window.sbiCacheStatuses[thisIndex].feed===!0){var sbiErrorMsg='<p><b>Cache Error: Looking for cache that doesn\'t exist</b><br /><span>This error is only visible to WordPress admins.</span>';var sbiErrorDir="<p>If you are using a caching plugin, try enabling the option on the Customize tab 'Cache error API recheck' or 'Force cache to clear on interval'</p>";jQuery('#sb_instagram').empty().append('<p style="text-align: center;">Unable to show Instagram photos</p><div id="sbi_mod_error">'+sbiErrorMsg+sbiErrorDir+'</div>');var submittedData={action:'sbi_set_use_backup',transientName:transientName,context:'falsecache'};jQuery.ajax({url:sbiajaxurl,type:'post',data:submittedData,success:function(data){}})}}
|
50 |
+
if(jsonobj.header.error==='tryfetch'){feedOptions=JSON.parse($self[0].getAttribute('data-options'));var thisIndex=$self[0].getAttribute('data-sbi-index');feedOptions.feedIndex=thisIndex;if(window.sbiCacheStatuses[thisIndex].header!==!1){if(!$self.find('.sb_instagram_header .sbi_header_text').length){window.sbiCacheStatuses[thisIndex].header=!1;feedOptions.tryFetch=!0;if(typeof window.sbiCacheStatuses[feedOptions.feedIndex].tryFetch==='undefined')sbiCreateFeed($self[0],feedOptions)}}}
|
51 |
+
if(typeof jsonobj.comments.error==='undefined'){sb_instagram_js_options.sbiPageCommentCache=jsonobj.comments}}else{if(cacheWhat=='header'){sbiBuildHeader(jsonobj,sbiSettings)}else{if(photosAvailable!=='finished')sbiBuildFeed(jsonobj,transientName,sbiSettings,$self)}}},error:function(xhr,textStatus,e){console.log(e);return}};jQuery.ajax(getCacheOpts)}}})}}
|
52 |
+
function sbiAddTokenToExpiredList(access_token,transientName){var accessTokenOpts={url:sbiajaxurl,type:'POST',async:!0,cache:!1,data:{action:'sbi_set_expired_token',access_token:access_token,transientName:transientName},success:function(response){return},error:function(xhr,textStatus,e){console.log(e);return}};jQuery.ajax(accessTokenOpts)}
|
53 |
+
function sbiCachePhotos(images,transientName){var jsonstring=JSON.stringify(images);jsonstring=encodeURI(jsonstring);if(jsonstring.indexOf('%7B%22')===0){var setCacheOpts={url:sbiajaxurl,type:'POST',async:!0,cache:!1,data:{action:'cache_photos',photos:jsonstring,transientName:transientName,},success:function(response){if(response.indexOf('too much filtering')>-1){var useBackupOpts={url:sbiajaxurl,type:'POST',async:!0,cache:!1,data:{action:'set_use_backup',transientName:transientName,},success:function(response){console.log(response)}};jQuery.ajax(useBackupOpts)}
|
54 |
+
return},error:function(xhr,textStatus,e){console.log(e);return}};jQuery.ajax(setCacheOpts)}}
|
55 |
+
function sbiGetColumnCount($self,cols,colsmobile){var sbi_num_cols=cols,sbiWindowWidth=window.innerWidth;if($self.hasClass('sbi_mob_col_auto')){if(sbiWindowWidth<640&&(parseInt(cols)>2&&parseInt(cols)<7))sbi_num_cols=2;if(sbiWindowWidth<640&&(parseInt(cols)>6&&parseInt(cols)<11))sbi_num_cols=4;if(sbiWindowWidth<=480&&parseInt(cols)>2)sbi_num_cols=1}else if(sbiWindowWidth<=480){sbi_num_cols=colsmobile}
|
56 |
+
return sbi_num_cols}
|
57 |
+
function sbiGetWidthForResType(type){switch(type){case 'thumbnail':return 150;case 'low_resolution':return 320;default:return 640}}
|
58 |
+
function sbiGetBestResolutionForCustom(colWidth,imageWidth,imageHeight){var aspectRatio=Math.max(1,imageWidth/imageHeight),bestWidth=colWidth*aspectRatio,bestWidthRounded=Math.ceil(bestWidth/10)*10,customSizes=[30,40,50,60,80,90,100,120,130,150,160,180,190,200,240,270,280,320,350,360,390,480,540,600,640,720,750,800,810,960,1280];if(customSizes.indexOf(parseInt(bestWidthRounded))===-1){var done=!1;jQuery.each(customSizes,function(index,item){if(item>parseInt(bestWidthRounded)&&!done){bestWidthRounded=item;done=!0}})}
|
59 |
+
return bestWidthRounded}
|
60 |
+
function sbiNeedToRaiseRes(width,oldRes){return(width>oldRes)}
|
61 |
+
function sbiGetResolutionSettings($self,imgRes,cols,colsmobile,$i){var feedWidth=$self.innerWidth(),photoPadding=parseInt($self.find('#sbi_images').css('padding'))*2,cols=sbiGetColumnCount($self,parseInt(cols),parseInt(colsmobile)),colWidth=($self.innerWidth()/cols)-photoPadding,imgResReturn={'type':'low_resolution','width':''},customSizes=[30,40,50,60,80,90,100,120,130,150,160,180,190,200,240,270,280,320,350,360,390,480,540,600,640,720,750,800,810,960,1280];if(!isNaN(imgRes)){imgResReturn.type='custom';if(customSizes.indexOf(parseInt(imgRes))>-1){imgResReturn.width=imgRes}else{var done=!1;jQuery.each(customSizes,function(index,item){if(item>parseInt(imgRes)&&!done){imgResReturn.width=item;done=!0}})}}else{switch(imgRes){case 'auto':colWidth=feedWidth/cols;var sbiWindowWidth=jQuery(window).width();if(sbiWindowWidth<640&&$self.is('.sbi_mob_col_auto')){if(feedWidth<640&&$self.is('.sbi_col_1'))colWidth=480;if(feedWidth<640&&$self.is('.sbi_col_3, .sbi_col_4, .sbi_col_5, .sbi_col_6'))colWidth=300;if(feedWidth<640&&$self.is('.sbi_col_7, .sbi_col_8, .sbi_col_9, .sbi_col_10'))colWidth=100;if((feedWidth>320&&feedWidth<480)&&sbiWindowWidth<480)colWidth=480;if(feedWidth<320&&sbiWindowWidth<480)colWidth=300}
|
62 |
+
if(colWidth<150){imgResReturn.type='thumbnail'}else if(colWidth<320){imgResReturn.type='low_resolution'}else{imgResReturn.type='standard_resolution'}
|
63 |
+
break;case 'autocustom':if(colWidth>960){imgResReturn.type='custom';imgResReturn.width=1280}else if((colWidth>130&&colWidth<=150)||(colWidth>280&&colWidth<=320)||(colWidth>600&&colWidth<=640)){if(colWidth<150){imgResReturn.type='thumbnail';imgResReturn.width=150}else if(colWidth<=320){imgResReturn.type='low_resolution';imgResReturn.width=320}else{imgResReturn.type='standard_resolution';imgResReturn.width=640}}else{imgResReturn.type='autocustom';imgResReturn.width=colWidth}
|
64 |
+
break;case 'thumb':imgResReturn.type='thumbnail';break;case 'medium':imgResReturn.type='low_resolution';break;default:imgResReturn.type='standard_resolution'}}
|
65 |
+
if(typeof window.sbiFeedMeta[$i].minRes==='undefined'){window.sbiFeedMeta[$i].minRes=imgResReturn.type==='autocustom'?sbiGetBestResolutionForCustom(colWidth,imgResReturn.width,imgResReturn.width):sbiGetWidthForResType(imgResReturn.type)}
|
66 |
+
return imgResReturn}
|
67 |
+
function sbi_cache_all(imagesArr,transientName){if(transientName.indexOf('header')&&typeof imagesArr.data.pagination==='undefined'){sbiCachePhotos(imagesArr,transientName)}else if(!transientName.indexOf('header')&&typeof imagesArr.data.pagination!=='undefined'){sbiCachePhotos(imagesArr,transientName)}}
|
68 |
+
jQuery(document).ready(function(){window.sbiCommentCacheStatus=0;sbi_init(function(imagesArr,transientName){sbi_cache_all(imagesArr,transientName)})})}
|