• Resolved TheHungryGeek

    (@thehungrygeek)


    So the latest update breaks Autoptimize.

    Something changed and with the plugin it no longer renders some of the javascript properly.

    Any fixes?

    FYI I have this custom code for my page:

    <!-- Insta Square Box Dynamic Resize AND Fix for browsers that do not support Object-Fit CSS Property -->
    <script type="text/javascript">
    jQuery(document).ready(function() {
    //setTimeout(function(){
    //jQuery(".entry-content:contains('SGD $')").html(function(i,t){ return t.replace(/SGD \$/g, 'SGD$') });	// Singapore currency format hack for Xoogu
    // var cwx = jQuery('#after-slider-widget-left #sb_instagram img').width();
    // jQuery('#after-slider-widget-left #sb_instagram img').css({'height':cwx+'px'});		// this is kind of redundant with CSS height specification
    //}, 5000);
    if (document.createElement("detect").style.objectFit === "") {				// creates objectfit class if there is browser support
    	document.getElementsByTagName("html")[0].className += " objectfit";
    }
    if (jQuery(window).width() > 480 && !jQuery('html').hasClass("objectfit")) {		// only runs if no object-fit class and width greater than 480px
    setTimeout(function(){
      jQuery('#sb_instagram .sbi_photo_wrap').each(function () {
        var jQuerycontainer = jQuery(this),
            imgUrl = jQuerycontainer.find('img').prop('src');
        if (imgUrl) {
          jQuerycontainer
            .css('backgroundImage', 'url(' + imgUrl + ')')
            .addClass('compat-object-fit');
        }
      });
    }, 5000);
    }
    });
    jQuery(window).resize(function() {
    var cw = jQuery('.sbi_photo_wrap.compat-object-fit').width();
    jQuery('.sbi_photo_wrap.compat-object-fit').css({'height':cw+'px'});			// forces image height=width for IE
    if (jQuery(window).width() < 768) {
    var cwx = jQuery('#after-slider-widget-left #sb_instagram img').width();
    jQuery('#after-slider-widget-left #sb_instagram img').css({'height':cwx+'px'});		// forces image height=width for non-IE
    } else {
    jQuery('#after-slider-widget-left #sb_instagram img').css('height', '');
    }
    });
    </script>

    https://www.ads-software.com/plugins/instagram-feed/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter TheHungryGeek

    (@thehungrygeek)

    So I’ve had to exclude the sb-instagram javascript files from Autoptimize together with jQuery.js – not too ideal.

    Hope there is some insight you can shed as to what changes caused this problem? They have been working together for almost half a year without any problems.

    Plugin Author smashballoon

    (@smashballoon)

    Hey TheHungryGeek,

    Do you know which version you updated from where it was working successfully? That way I can check what changed between that version and the latest version. Also, to confirm, you’re using the latest version of the free plugin (1.4.6.1), correct? Have you made any other changes to the site or Autoptimize before the problem occurred?

    Thanks!

    John

    Thread Starter TheHungryGeek

    (@thehungrygeek)

    Hi smashballoon,

    I use an autoplugin update manager that runs a cron everyday, so the issue happened when it updated to 1.4.6.1 from the previous version.

    5 plugins were updated that day, but I troubleshooted by manually deactivating each plugin – narrowed the issue down to Instagram Feed.

    Basically the concatenated .js in Autoptimize breaks something when the sb-instagram .js file is combined within.

    No other changes were made to the site.

    Thread Starter TheHungryGeek

    (@thehungrygeek)

    Update: I tried rolling back the changes from the latest version in Instagram-Feed’s .js files – specifically sb-instagram.js and sb-instagram.min.js – unfortunately the issue still remains. I have also deactivated all the plugins that were updated on that day at the same time to no avail.

    To elaborate, what breaks now really is the Facebook like box and like button on the page – when Instagram-Feed is concatenated by Autoptomize, those things are broken – they don’t load. It wasn’t like that previously.

    I’m really quite stumped by this ??

    Plugin Author smashballoon

    (@smashballoon)

    It’s strange that reverting everything back doesn’t resolve the issue. Was the Autoptimize plugin updated that day, or shortly before?

    The JS in our plugin should actually already be minified and so you could exclude it from Autoptimize without really any performance hit (apart from one additional HTTP request to get that file on the initial page load before it’s cached by the user’s browser). I can try running a test on one of my sites with the latest version of Autoptimize and our plugin to see whether I can replicate the issue. Is it possible to export your Autoptimize settings so that I can replicate your setup, or are you using standard settings?

    John

    Thread Starter TheHungryGeek

    (@thehungrygeek)

    Nope Autoptimize has not been updated for a while, and I am using the latest version.

    The thing is I have 50+ plugins in use and they all work well with Autoptimize, so my pages only have a single .js file to process. Right now with this issue the single .js file has become three (autoptimize’s .js file, jquery.js and sb-instagram.js (minified version).

    As for settings, everything is checked except (1) Force Javascript in <head>, (2) Add try-catch wrapping and (3) Inline all CSS.

    Try it with some Facebook like boxes and buttons.

    Thread Starter TheHungryGeek

    (@thehungrygeek)

    I tried downgrading to the earlier version, and everything works fine lol… this is some mystery, there is something in those 3 new lines of .js code.

    image.images.thumbnail.url = image.images.thumbnail.url.split("?ig_cache_key")[0];
    image.images.standard_resolution.url = image.images.standard_resolution.url.split("?ig_cache_key")[0];
    image.images.low_resolution.url = image.images.low_resolution.url.split("?ig_cache_key")[0];

    It broke something. Anyway to tweak that 3 lines of code to reduce the chances of interference with other scripts?

    I’m assuming those 3 lines of code are the only thing that has changed from the old to new version.

    Thread Starter TheHungryGeek

    (@thehungrygeek)

    Thread Starter TheHungryGeek

    (@thehungrygeek)

    Plugin Author smashballoon

    (@smashballoon)

    Thanks for letting me know what was causing the issue. I assumed that Autoptimize would remove the comment automatically but it seems that it doesn’t. I’ll push out an update to fix this tomorrow.

    Thanks again!

    I assumed that Autoptimize would remove the comment automatically

    it does, the problem is slightly more complex ??

    chances are W3TC js optimization has the exact same problem by the way.

    frank

    Thread Starter TheHungryGeek

    (@thehungrygeek)

    Frank thanks so much with your help on this!

    Plugin Author smashballoon

    (@smashballoon)

    Hey Frank,

    Thanks for helping to troubleshoot this. We’ll remove that comment in the next plugin update which will hopefully resolve this issue.

    Thanks again!

    John

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Latest Update Breaks Autoptimize’ is closed to new replies.