Version Description
- Tweak: Automatic image resolution detection setting now works better with wide images. Resizing the browser will now automatically raise the image resolution if needed.
- Fix: Fixed an issue where the Load More button would disappear if all posts for a feed were cached.
Download this release
Release Info
Developer | smashballoon |
Plugin | Instagram Feed |
Version | 1.10.1 |
Comparing to | |
See all releases |
Code changes from version 1.10 to 1.10.1
- README.txt +5 -1
- instagram-feed-admin.php +2 -2
- instagram-feed.php +2 -2
- js/sb-instagram.js +45 -91
- js/sb-instagram.min.js +10 -12
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.10
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -310,6 +310,10 @@ 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.10 =
|
314 |
* New: We've made improvements to the way photos are loaded into the feed, adding a smooth transition to display photos subtly rather than suddenly.
|
315 |
* New: More header sizes; you can now choose from three sizes: small, medium, and large. Change this on the "Customize" tab.
|
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.10.1
|
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.10.1 =
|
314 |
+
* Tweak: Automatic image resolution detection setting now works better with wide images. Resizing the browser will now automatically raise the image resolution if needed.
|
315 |
+
* Fix: Fixed an issue where the Load More button would disappear if all posts for a feed were cached.
|
316 |
+
|
317 |
= 1.10 =
|
318 |
* New: We've made improvements to the way photos are loaded into the feed, adding a smooth transition to display photos subtly rather than suddenly.
|
319 |
* New: More header sizes; you can now choose from three sizes: small, medium, and large. Change this on the "Customize" tab.
|
instagram-feed-admin.php
CHANGED
@@ -1838,12 +1838,12 @@ function sb_instagram_settings_page() {
|
|
1838 |
|
1839 |
<p>
|
1840 |
<span class="sbi-support-title"><i class="fa fa-youtube-play" aria-hidden="true"></i> <a
|
1841 |
-
href="https://www.youtube.com/embed/
|
1842 |
id="sbi-play-support-video"><?php _e( 'Watch a Video' ); ?></a></span>
|
1843 |
<?php _e( "Watch a short video demonstrating how to set up, customize and use the plugin.<br /><b>Please note</b> that the video shows the set up and use of the <b><a href='https://smashballoon.com/instagram-feed/' target='_blank'>PRO version</a></b> of the plugin, but the process is the same for this free version. The only difference is some of the features available." ); ?>
|
1844 |
|
1845 |
<iframe id="sbi-support-video"
|
1846 |
-
src="//www.youtube.com/embed/
|
1847 |
height="540" frameborder="0" allowfullscreen="allowfullscreen"></iframe>
|
1848 |
</p>
|
1849 |
|
1838 |
|
1839 |
<p>
|
1840 |
<span class="sbi-support-title"><i class="fa fa-youtube-play" aria-hidden="true"></i> <a
|
1841 |
+
href="https://www.youtube.com/embed/q6ZXVU4g970" target="_blank"
|
1842 |
id="sbi-play-support-video"><?php _e( 'Watch a Video' ); ?></a></span>
|
1843 |
<?php _e( "Watch a short video demonstrating how to set up, customize and use the plugin.<br /><b>Please note</b> that the video shows the set up and use of the <b><a href='https://smashballoon.com/instagram-feed/' target='_blank'>PRO version</a></b> of the plugin, but the process is the same for this free version. The only difference is some of the features available." ); ?>
|
1844 |
|
1845 |
<iframe id="sbi-support-video"
|
1846 |
+
src="//www.youtube.com/embed/q6ZXVU4g970?theme=light&showinfo=0&controls=2" width="960"
|
1847 |
height="540" frameborder="0" allowfullscreen="allowfullscreen"></iframe>
|
1848 |
</p>
|
1849 |
|
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.10
|
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.10' );
|
27 |
|
28 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
|
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.10.1
|
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.10.1' );
|
27 |
|
28 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
29 |
|
js/sb-instagram.js
CHANGED
@@ -374,6 +374,7 @@ if(!sbi_js_exists){
|
|
374 |
var $loadBtn = $self.find("#sbi_load .sbi_load_btn"),
|
375 |
num = parseInt(sbiSettings.num),
|
376 |
cols = parseInt(sbiSettings.cols),
|
|
|
377 |
feedOptions = sbiSettings.feedOptions,
|
378 |
itemCount = 0,
|
379 |
imgRes = sbiSettings.imgRes,
|
@@ -496,12 +497,17 @@ if(!sbi_js_exists){
|
|
496 |
case 'low_resolution':
|
497 |
data_image = item.images.low_resolution.url;
|
498 |
break;
|
499 |
-
case '
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
|
|
|
|
|
|
|
|
|
|
505 |
break;
|
506 |
}
|
507 |
data_image = data_image.split("?ig_cache_key")[0];
|
@@ -524,7 +530,7 @@ if(!sbi_js_exists){
|
|
524 |
//TEMPLATE:
|
525 |
imagesHTML += '<div class="sbi_item sbi_type_'+item.type+' sbi_new sbi_transition" id="sbi_'+item.id+'" data-date="'+created_time_raw+'">' +
|
526 |
'<div class="sbi_photo_wrap">'+
|
527 |
-
'<a class="sbi_photo" href="'+item.link+'" target="_blank">' + carouselTypeIcon + playBtnHtml +
|
528 |
'<img src="'+data_image+'" alt="'+captionText.replace(/<>/g, " ")+'" width="200" height="200" />' +
|
529 |
'</a>' +
|
530 |
'</div>' +
|
@@ -574,6 +580,8 @@ if(!sbi_js_exists){
|
|
574 |
|
575 |
//Show the Load More button
|
576 |
$self.find('#sbi_load').removeClass('sbi_hidden');
|
|
|
|
|
577 |
|
578 |
setTimeout(function(){
|
579 |
//Hide the loader in the load more button
|
@@ -718,15 +726,16 @@ if(!sbi_js_exists){
|
|
718 |
var $sbiSelf = jQuery(this),
|
719 |
$i = jQuery(this).attr('data-sbi-index');
|
720 |
sbiSizeSVG($sbiSelf);
|
721 |
-
|
|
|
722 |
var oldRes = window.sbiFeedMeta[$i].minRes;
|
723 |
-
var imageSize = sbiGetResolutionSettings($sbiSelf, '
|
724 |
width = imageSize.width !== '' ? imageSize.width : sbiGetWidthForResType(imageSize.type);
|
725 |
|
726 |
if (sbiNeedToRaiseRes(width,oldRes)) {
|
727 |
window.sbiFeedMeta[$i].minRes = 640;
|
728 |
$sbiSelf.find('.sbi_item').each(function() {
|
729 |
-
var newUrl = jQuery(this).find('.
|
730 |
var oldUrl = jQuery(this).find('.sbi_photo img').attr('src'),
|
731 |
newRes = 640,
|
732 |
$photo = jQuery(this);
|
@@ -1316,11 +1325,16 @@ if(!sbi_js_exists){
|
|
1316 |
}
|
1317 |
}
|
1318 |
|
1319 |
-
function
|
|
|
1320 |
var aspectRatio = Math.max(1,imageWidth/imageHeight),
|
1321 |
bestWidth = colWidth*aspectRatio,
|
1322 |
bestWidthRounded = Math.ceil(bestWidth / 10) * 10,
|
1323 |
-
customSizes = [
|
|
|
|
|
|
|
|
|
1324 |
|
1325 |
if (customSizes.indexOf(parseInt(bestWidthRounded)) === -1) {
|
1326 |
var done = false;
|
@@ -1341,98 +1355,38 @@ if(!sbi_js_exists){
|
|
1341 |
}
|
1342 |
|
1343 |
function sbiGetResolutionSettings($self, imgRes, cols, colsmobile, $i) {
|
1344 |
-
var
|
1345 |
-
//colWidth = $self.innerWidth() / cols,
|
1346 |
-
photoPadding = parseInt($self.find('#sbi_images').css('padding')) * 2,
|
1347 |
cols = sbiGetColumnCount($self, parseInt(cols), parseInt(colsmobile)),
|
1348 |
colWidth = ($self.innerWidth() / cols) - photoPadding,
|
1349 |
imgResReturn = {
|
1350 |
'type' : 'low_resolution',
|
1351 |
'width' : ''
|
1352 |
-
}
|
1353 |
-
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];
|
1354 |
-
if (!isNaN(imgRes)) {
|
1355 |
-
imgResReturn.type = 'custom';
|
1356 |
-
if (customSizes.indexOf(parseInt(imgRes)) > -1) {
|
1357 |
-
imgResReturn.width = imgRes;
|
1358 |
-
} else {
|
1359 |
-
var done = false;
|
1360 |
-
jQuery.each(customSizes,function(index,item) {
|
1361 |
-
if (item > parseInt(imgRes) && !done) {
|
1362 |
-
imgResReturn.width = item;
|
1363 |
-
done = true;
|
1364 |
-
}
|
1365 |
-
});
|
1366 |
-
}
|
1367 |
-
} else {
|
1368 |
-
switch(imgRes) {
|
1369 |
-
case 'auto':
|
1370 |
-
colWidth = feedWidth/cols;
|
1371 |
-
//Check if page width is less than 640. If it is then use the script above
|
1372 |
-
var sbiWindowWidth = jQuery(window).width();
|
1373 |
-
if( sbiWindowWidth < 640 && $self.is('.sbi_mob_col_auto') ){
|
1374 |
-
//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
|
1375 |
-
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
|
1376 |
-
if( feedWidth < 640 && $self.is('.sbi_col_3, .sbi_col_4, .sbi_col_5, .sbi_col_6') ) colWidth = 300; //Use medium images
|
1377 |
-
if( feedWidth < 640 && $self.is('.sbi_col_7, .sbi_col_8, .sbi_col_9, .sbi_col_10') ) colWidth = 100; //Use thumbnail images
|
1378 |
-
if( (feedWidth > 320 && feedWidth < 480) && sbiWindowWidth < 480 ) colWidth = 480; //Use full size images
|
1379 |
-
if( feedWidth < 320 && sbiWindowWidth < 480 ) colWidth = 300; //Use medium size images
|
1380 |
-
}
|
1381 |
-
|
1382 |
-
if( colWidth < 150 ){
|
1383 |
-
imgResReturn.type = 'thumbnail';
|
1384 |
-
} else if( colWidth < 320 ){
|
1385 |
-
imgResReturn.type = 'low_resolution';
|
1386 |
-
} else {
|
1387 |
-
imgResReturn.type = 'standard_resolution';
|
1388 |
-
}
|
1389 |
-
|
1390 |
-
break;
|
1391 |
-
case 'autocustom':
|
1392 |
-
//var imageSize = Math.ceil(colWidth / 10) * 10;
|
1393 |
-
|
1394 |
-
if (colWidth > 960) {
|
1395 |
-
imgResReturn.type = 'custom';
|
1396 |
-
imgResReturn.width = 1280;
|
1397 |
-
} else if((colWidth > 130 && colWidth <= 150)
|
1398 |
-
|| (colWidth > 280 && colWidth <= 320)
|
1399 |
-
|| (colWidth > 600 && colWidth <= 640) ) {
|
1400 |
-
|
1401 |
-
if( colWidth < 150 ){
|
1402 |
-
imgResReturn.type = 'thumbnail';
|
1403 |
-
imgResReturn.width = 150;
|
1404 |
-
} else if( colWidth <= 320 ){
|
1405 |
-
imgResReturn.type = 'low_resolution';
|
1406 |
-
imgResReturn.width = 320;
|
1407 |
-
} else {
|
1408 |
-
imgResReturn.type = 'standard_resolution';
|
1409 |
-
imgResReturn.width = 640;
|
1410 |
-
}
|
1411 |
-
|
1412 |
-
} else {
|
1413 |
-
imgResReturn.type = 'autocustom';
|
1414 |
-
imgResReturn.width = colWidth;
|
1415 |
-
}
|
1416 |
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
|
|
|
|
|
|
|
|
1428 |
}
|
1429 |
|
1430 |
if ( typeof window.sbiFeedMeta[$i].minRes === 'undefined' ) {
|
1431 |
-
window.sbiFeedMeta[$i].minRes = imgResReturn.type === '
|
1432 |
}
|
1433 |
|
1434 |
return imgResReturn;
|
1435 |
}
|
|
|
1436 |
// Called at the very end of the feed creation process
|
1437 |
// Takes all of the data retrieved from the API during the feed creation process and caches it
|
1438 |
function sbi_cache_all(imagesArr,transientName) {
|
374 |
var $loadBtn = $self.find("#sbi_load .sbi_load_btn"),
|
375 |
num = parseInt(sbiSettings.num),
|
376 |
cols = parseInt(sbiSettings.cols),
|
377 |
+
colsmobile = 'auto',
|
378 |
feedOptions = sbiSettings.feedOptions,
|
379 |
itemCount = 0,
|
380 |
imgRes = sbiSettings.imgRes,
|
497 |
case 'low_resolution':
|
498 |
data_image = item.images.low_resolution.url;
|
499 |
break;
|
500 |
+
case 'auto':
|
501 |
+
imgRes = sbiGetResolutionSettings($self, var_this.getAttribute('data-res'), cols, colsmobile, $i);
|
502 |
+
var thisImageReplace = sbiGetBestResolutionForAuto(imgRes.width,item.images.standard_resolution.width,item.images.standard_resolution.height,($self.hasClass('sbi_highlight')));
|
503 |
+
switch (thisImageReplace) {
|
504 |
+
case 320:
|
505 |
+
data_image = item.images.low_resolution.url;
|
506 |
+
break;
|
507 |
+
case 150:
|
508 |
+
data_image = item.images.thumbnail.url;
|
509 |
+
break;
|
510 |
+
}
|
511 |
break;
|
512 |
}
|
513 |
data_image = data_image.split("?ig_cache_key")[0];
|
530 |
//TEMPLATE:
|
531 |
imagesHTML += '<div class="sbi_item sbi_type_'+item.type+' sbi_new sbi_transition" id="sbi_'+item.id+'" data-date="'+created_time_raw+'">' +
|
532 |
'<div class="sbi_photo_wrap">'+
|
533 |
+
'<a class="sbi_photo" href="'+item.link+'" target="_blank" data-full-res="'+item.images.standard_resolution.url+'">' + carouselTypeIcon + playBtnHtml +
|
534 |
'<img src="'+data_image+'" alt="'+captionText.replace(/<>/g, " ")+'" width="200" height="200" />' +
|
535 |
'</a>' +
|
536 |
'</div>' +
|
580 |
|
581 |
//Show the Load More button
|
582 |
$self.find('#sbi_load').removeClass('sbi_hidden');
|
583 |
+
//Don't show the button if there aren't enough photos to fill the feed
|
584 |
+
if( imagesArrCount >= num ) $self.find('.sbi_load_btn').show();
|
585 |
|
586 |
setTimeout(function(){
|
587 |
//Hide the loader in the load more button
|
726 |
var $sbiSelf = jQuery(this),
|
727 |
$i = jQuery(this).attr('data-sbi-index');
|
728 |
sbiSizeSVG($sbiSelf);
|
729 |
+
|
730 |
+
if ($sbiSelf.attr('data-res') ==='auto') {
|
731 |
var oldRes = window.sbiFeedMeta[$i].minRes;
|
732 |
+
var imageSize = sbiGetResolutionSettings($sbiSelf, 'auto', cols, colsmobile, $i),
|
733 |
width = imageSize.width !== '' ? imageSize.width : sbiGetWidthForResType(imageSize.type);
|
734 |
|
735 |
if (sbiNeedToRaiseRes(width,oldRes)) {
|
736 |
window.sbiFeedMeta[$i].minRes = 640;
|
737 |
$sbiSelf.find('.sbi_item').each(function() {
|
738 |
+
var newUrl = jQuery(this).find('.sbi_photo').attr('data-full-res');
|
739 |
var oldUrl = jQuery(this).find('.sbi_photo img').attr('src'),
|
740 |
newRes = 640,
|
741 |
$photo = jQuery(this);
|
1325 |
}
|
1326 |
}
|
1327 |
|
1328 |
+
function sbiGetBestResolutionForAuto(colWidth,imageWidth,imageHeight,isHighlight) {
|
1329 |
+
|
1330 |
var aspectRatio = Math.max(1,imageWidth/imageHeight),
|
1331 |
bestWidth = colWidth*aspectRatio,
|
1332 |
bestWidthRounded = Math.ceil(bestWidth / 10) * 10,
|
1333 |
+
customSizes = [150,320,640];
|
1334 |
+
|
1335 |
+
if (isHighlight) {
|
1336 |
+
bestWidthRounded = bestWidthRounded*2;
|
1337 |
+
}
|
1338 |
|
1339 |
if (customSizes.indexOf(parseInt(bestWidthRounded)) === -1) {
|
1340 |
var done = false;
|
1355 |
}
|
1356 |
|
1357 |
function sbiGetResolutionSettings($self, imgRes, cols, colsmobile, $i) {
|
1358 |
+
var photoPadding = parseInt(($self.find('#sbi_images').outerWidth() - $self.find('#sbi_images').width())) / 2,
|
|
|
|
|
1359 |
cols = sbiGetColumnCount($self, parseInt(cols), parseInt(colsmobile)),
|
1360 |
colWidth = ($self.innerWidth() / cols) - photoPadding,
|
1361 |
imgResReturn = {
|
1362 |
'type' : 'low_resolution',
|
1363 |
'width' : ''
|
1364 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1365 |
|
1366 |
+
switch(imgRes) {
|
1367 |
+
case 'auto':
|
1368 |
+
imgResReturn.type = 'auto';
|
1369 |
+
imgResReturn.width = colWidth;
|
1370 |
+
|
1371 |
+
break;
|
1372 |
+
case 'thumb':
|
1373 |
+
imgResReturn.type = 'thumbnail';
|
1374 |
+
break;
|
1375 |
+
case 'medium':
|
1376 |
+
imgResReturn.type = 'low_resolution';
|
1377 |
+
break;
|
1378 |
+
default:
|
1379 |
+
// do custom sizes if set
|
1380 |
+
imgResReturn.type = 'standard_resolution';
|
1381 |
}
|
1382 |
|
1383 |
if ( typeof window.sbiFeedMeta[$i].minRes === 'undefined' ) {
|
1384 |
+
window.sbiFeedMeta[$i].minRes = imgResReturn.type === 'auto' ? sbiGetBestResolutionForAuto(colWidth,imgResReturn.width,imgResReturn.width,$self.hasClass('sbi_highlight')): sbiGetWidthForResType(imgResReturn.type);
|
1385 |
}
|
1386 |
|
1387 |
return imgResReturn;
|
1388 |
}
|
1389 |
+
|
1390 |
// Called at the very end of the feed creation process
|
1391 |
// Takes all of the data retrieved from the API during the feed creation process and caches it
|
1392 |
function sbi_cache_all(imagesArr,transientName) {
|
js/sb-instagram.min.js
CHANGED
@@ -17,20 +17,20 @@ transientName+=sbi_cache_string_include+sbi_cache_string_exclude;sbiTransientNam
|
|
17 |
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'}
|
18 |
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)}
|
19 |
if(!window.sbiCacheStatuses[feedOptions.feedIndex].header&&window.sbiCacheStatuses[feedOptions.feedIndex].header!=='fetched'&&sbiSettings.getType==='user'){window.sbiCacheStatuses[feedOptions.feedIndex].header='fetched';var atParts=accessTokens[0].split('.');sbiSettings.user_id=atParts[0];var sbi_page_url='https://api.instagram.com/v1/users/'+sbiSettings.user_id+'?access_token='+addLinksToPage(accessTokens[0]);jQuery.ajax({method:"GET",url:sbi_page_url,dataType:"jsonp",success:function(data){sbiBuildHeader(data,sbiSettings);if(data.data!==undefined){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)}}}})}
|
20 |
-
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;$loadBtn.find('.sbi_loader').css('background-color',$loadBtn.css('color'));if(imagesArr==''){imagesArr=images}else if(sbiNewData==!0){jQuery.each(images.data,function(index,entry){imagesArr.data.push(entry)});sbiNewData=!1}
|
21 |
var imagesNextUrl=images.pagination.next_url;if(typeof imagesNextUrl==='undefined'||imagesNextUrl.length==0){noMoreData=!0}else{$loadBtn.show()}
|
22 |
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;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)}}})}}
|
23 |
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)}
|
24 |
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}}})}
|
25 |
-
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 '
|
26 |
-
|
27 |
data_image=data_image.split("?ig_cache_key")[0];var captionText='',created_time_raw=item.created_time;if(item.caption!=null&&item.caption!=''){captionText=typeof item.caption!=='undefined'?item.caption.text.replace(/"/g,"""):'';captionText=captionText.replace(/\n/g," ")}
|
28 |
-
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 sbi_transition" id="sbi_'+item.id+'" data-date="'+created_time_raw+'">'+'<div class="sbi_photo_wrap">'+'<a class="sbi_photo" href="'+item.link+'" target="_blank">'+carouselTypeIcon+playBtnHtml+'<img src="'+data_image+'" alt="'+captionText.replace(/<>/g," ")+'" 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);var time=10;$self.find('.sbi_transition').each(function(){var $sbi_item_transition_el=jQuery(this);setTimeout(function(){$sbi_item_transition_el.removeClass('sbi_transition')},time)
|
29 |
-
time+=10});imagesHTML='';$self.find('#sbi_images > .sbi_loader').remove();$self.find('#sbi_load').removeClass('sbi_hidden');setTimeout(function(){$loadBtn.find('.sbi_loader').addClass('sbi_hidden');$loadBtn.find('.sbi_btn_text').removeClass('sbi_hidden')},500)}
|
30 |
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()}
|
31 |
$self.find('#sbi_load .sbi_load_btn').off().on('click',function(){jQuery(this).find('.sbi_loader').removeClass('sbi_hidden');jQuery(this).find('.sbi_btn_text').addClass('sbi_hidden');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))}
|
32 |
head.appendChild(style)}();$self.find(".sbi_photo").sbi_imgLiquid({fill:!0})}
|
33 |
-
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')==='
|
34 |
$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 imagesPadding=jQuery('#sbi_images').innerWidth()-jQuery('#sbi_images').width(),sbi_photo_width_manual=($self.find('#sbi_images').width()/sbi_num_cols)-imagesPadding;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)}}
|
35 |
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')}}
|
36 |
sbiGetItemSize();if(!feedOptions.disablecache&&typeof _cache!=='undefined'&&window.sbiCacheStatuses[feedOptions.feedIndex].feed==='fetched'){_cache(imagesArr,transientName);window.sbiCacheStatuses[feedOptions.feedIndex].feed='cached'}
|
@@ -60,14 +60,12 @@ return},error:function(xhr,textStatus,e){console.log(e);return}};jQuery.ajax(set
|
|
60 |
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}
|
61 |
return sbi_num_cols}
|
62 |
function sbiGetWidthForResType(type){switch(type){case 'thumbnail':return 150;case 'low_resolution':return 320;default:return 640}}
|
63 |
-
function
|
|
|
64 |
return bestWidthRounded}
|
65 |
function sbiNeedToRaiseRes(width,oldRes){return(width>oldRes)}
|
66 |
-
function sbiGetResolutionSettings($self,imgRes,cols,colsmobile,$i){var
|
67 |
-
if(
|
68 |
-
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}
|
69 |
-
break;case 'thumb':imgResReturn.type='thumbnail';break;case 'medium':imgResReturn.type='low_resolution';break;default:imgResReturn.type='standard_resolution'}}
|
70 |
-
if(typeof window.sbiFeedMeta[$i].minRes==='undefined'){window.sbiFeedMeta[$i].minRes=imgResReturn.type==='autocustom'?sbiGetBestResolutionForCustom(colWidth,imgResReturn.width,imgResReturn.width):sbiGetWidthForResType(imgResReturn.type)}
|
71 |
return imgResReturn}
|
72 |
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)}}
|
73 |
jQuery(document).ready(function(){window.sbiCommentCacheStatus=0;sbi_init(function(imagesArr,transientName){sbi_cache_all(imagesArr,transientName)})})}
|
17 |
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'}
|
18 |
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)}
|
19 |
if(!window.sbiCacheStatuses[feedOptions.feedIndex].header&&window.sbiCacheStatuses[feedOptions.feedIndex].header!=='fetched'&&sbiSettings.getType==='user'){window.sbiCacheStatuses[feedOptions.feedIndex].header='fetched';var atParts=accessTokens[0].split('.');sbiSettings.user_id=atParts[0];var sbi_page_url='https://api.instagram.com/v1/users/'+sbiSettings.user_id+'?access_token='+addLinksToPage(accessTokens[0]);jQuery.ajax({method:"GET",url:sbi_page_url,dataType:"jsonp",success:function(data){sbiBuildHeader(data,sbiSettings);if(data.data!==undefined){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)}}}})}
|
20 |
+
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),colsmobile='auto',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;$loadBtn.find('.sbi_loader').css('background-color',$loadBtn.css('color'));if(imagesArr==''){imagesArr=images}else if(sbiNewData==!0){jQuery.each(images.data,function(index,entry){imagesArr.data.push(entry)});sbiNewData=!1}
|
21 |
var imagesNextUrl=images.pagination.next_url;if(typeof imagesNextUrl==='undefined'||imagesNextUrl.length==0){noMoreData=!0}else{$loadBtn.show()}
|
22 |
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;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)}}})}}
|
23 |
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)}
|
24 |
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}}})}
|
25 |
+
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 'auto':imgRes=sbiGetResolutionSettings($self,var_this.getAttribute('data-res'),cols,colsmobile,$i);var thisImageReplace=sbiGetBestResolutionForAuto(imgRes.width,item.images.standard_resolution.width,item.images.standard_resolution.height,($self.hasClass('sbi_highlight')));switch(thisImageReplace){case 320:data_image=item.images.low_resolution.url;break;case 150:data_image=item.images.thumbnail.url;break}
|
26 |
+
break}
|
27 |
data_image=data_image.split("?ig_cache_key")[0];var captionText='',created_time_raw=item.created_time;if(item.caption!=null&&item.caption!=''){captionText=typeof item.caption!=='undefined'?item.caption.text.replace(/"/g,"""):'';captionText=captionText.replace(/\n/g," ")}
|
28 |
+
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 sbi_transition" id="sbi_'+item.id+'" data-date="'+created_time_raw+'">'+'<div class="sbi_photo_wrap">'+'<a class="sbi_photo" href="'+item.link+'" target="_blank" data-full-res="'+item.images.standard_resolution.url+'">'+carouselTypeIcon+playBtnHtml+'<img src="'+data_image+'" alt="'+captionText.replace(/<>/g," ")+'" 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);var time=10;$self.find('.sbi_transition').each(function(){var $sbi_item_transition_el=jQuery(this);setTimeout(function(){$sbi_item_transition_el.removeClass('sbi_transition')},time)
|
29 |
+
time+=10});imagesHTML='';$self.find('#sbi_images > .sbi_loader').remove();$self.find('#sbi_load').removeClass('sbi_hidden');if(imagesArrCount>=num)$self.find('.sbi_load_btn').show();setTimeout(function(){$loadBtn.find('.sbi_loader').addClass('sbi_hidden');$loadBtn.find('.sbi_btn_text').removeClass('sbi_hidden')},500)}
|
30 |
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()}
|
31 |
$self.find('#sbi_load .sbi_load_btn').off().on('click',function(){jQuery(this).find('.sbi_loader').removeClass('sbi_hidden');jQuery(this).find('.sbi_btn_text').addClass('sbi_hidden');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))}
|
32 |
head.appendChild(style)}();$self.find(".sbi_photo").sbi_imgLiquid({fill:!0})}
|
33 |
+
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')==='auto'){var oldRes=window.sbiFeedMeta[$i].minRes;var imageSize=sbiGetResolutionSettings($sbiSelf,'auto',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_photo').attr('data-full-res');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)}}
|
34 |
$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 imagesPadding=jQuery('#sbi_images').innerWidth()-jQuery('#sbi_images').width(),sbi_photo_width_manual=($self.find('#sbi_images').width()/sbi_num_cols)-imagesPadding;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)}}
|
35 |
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')}}
|
36 |
sbiGetItemSize();if(!feedOptions.disablecache&&typeof _cache!=='undefined'&&window.sbiCacheStatuses[feedOptions.feedIndex].feed==='fetched'){_cache(imagesArr,transientName);window.sbiCacheStatuses[feedOptions.feedIndex].feed='cached'}
|
60 |
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}
|
61 |
return sbi_num_cols}
|
62 |
function sbiGetWidthForResType(type){switch(type){case 'thumbnail':return 150;case 'low_resolution':return 320;default:return 640}}
|
63 |
+
function sbiGetBestResolutionForAuto(colWidth,imageWidth,imageHeight,isHighlight){var aspectRatio=Math.max(1,imageWidth/imageHeight),bestWidth=colWidth*aspectRatio,bestWidthRounded=Math.ceil(bestWidth/10)*10,customSizes=[150,320,640];if(isHighlight){bestWidthRounded=bestWidthRounded*2}
|
64 |
+
if(customSizes.indexOf(parseInt(bestWidthRounded))===-1){var done=!1;jQuery.each(customSizes,function(index,item){if(item>parseInt(bestWidthRounded)&&!done){bestWidthRounded=item;done=!0}})}
|
65 |
return bestWidthRounded}
|
66 |
function sbiNeedToRaiseRes(width,oldRes){return(width>oldRes)}
|
67 |
+
function sbiGetResolutionSettings($self,imgRes,cols,colsmobile,$i){var photoPadding=parseInt(($self.find('#sbi_images').outerWidth()-$self.find('#sbi_images').width()))/2,cols=sbiGetColumnCount($self,parseInt(cols),parseInt(colsmobile)),colWidth=($self.innerWidth()/cols)-photoPadding,imgResReturn={'type':'low_resolution','width':''};switch(imgRes){case 'auto':imgResReturn.type='auto';imgResReturn.width=colWidth;break;case 'thumb':imgResReturn.type='thumbnail';break;case 'medium':imgResReturn.type='low_resolution';break;default:imgResReturn.type='standard_resolution'}
|
68 |
+
if(typeof window.sbiFeedMeta[$i].minRes==='undefined'){window.sbiFeedMeta[$i].minRes=imgResReturn.type==='auto'?sbiGetBestResolutionForAuto(colWidth,imgResReturn.width,imgResReturn.width,$self.hasClass('sbi_highlight')):sbiGetWidthForResType(imgResReturn.type)}
|
|
|
|
|
|
|
69 |
return imgResReturn}
|
70 |
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)}}
|
71 |
jQuery(document).ready(function(){window.sbiCommentCacheStatus=0;sbi_init(function(imagesArr,transientName){sbi_cache_all(imagesArr,transientName)})})}
|