WordPress.org

Ready to get started?Download WordPress

Forums

Gallery Carousel Without JetPack
Gallery plugin patch for jQuery 1.9 : ) (8 posts)

  1. Ryan Urban
    Member
    Posted 1 year ago #

    Hello guys, first off, great work on this. Love it and so happy to not have to use the full Jetpack : )

    So just wanted to give you a heads up and others a quick patch. The site I'm using this plugin on uses jQuery 1.9, which resulted in the plugin not working as the plugin currently uses the now deprecated $.browser object for jQuery < 1.9 (lines 137-140):

    if ( $.browser.mozilla )
         leftWidth -= 55;
    else if ( $.browser.msie )
         leftWidth -= 20;

    Not quite sure where WordPress core is in terms of adopting the use of jQuery 1.9, but wanted to throw out how I patched this up. I basically tested for whether $.browser is a valid function (aka if jQuery is < 1.9) and then setup the relevant code to handle both situations so we are gracefully handling both situations:

    if( ! $.isFunction( $.browser ) ) {
         var isMozilla = navigator.userAgent.match(/Firefox/i) != null;
         var isMSIE = navigator.userAgent.match(/MSIE/i) != null;
    
         if ( isMozilla )
              leftWidth -= 55;
         else if ( isMSIE )
              leftWidth -= 20;
         leftWidth += 'px';
    } else {
         if ( $.browser.mozilla )
              leftWidth -= 55;
         else if ( $.browser.msie )
              leftWidth -= 20;
         leftWidth += 'px';
    }

    It's obviously not ideal to alter plugin code, which I realize, I just really wanted to use this and couldn't find a Github repo for this : ) So by all means, use this as you see fit or when / if it makes sense. Thanks!

    http://wordpress.org/extend/plugins/carousel-without-jetpack/

  2. Syed Balkhi
    Member
    Plugin Author

    Posted 1 year ago #

    Hey Ryan,

    Thanks a lot for writing this patch. I try to keep this plugin up to date with the official Jetpack plugin. Any bug that is in the Jetpack Carousel plugin will be found in this plugin as well.

    As much as I would like to fix all the bugs before they do, I don't want to. Because then it would make the updating process much harder. Currently all I do is copy/paste the Jetpack carousel module (change class name) and here is the new update.

    Fixing bugs, adding functionality, etc to this plugin would then essentially start a separate plugin dev. process.

    WordPress 3.6 should have jQuery 1.9, so I'm certain that an update of Jetpack and this plugin will follow right along with it :)

  3. Ryan Urban
    Member
    Posted 1 year ago #

    Hey Syed!

    You're very welcome and that makes total sense. Figured as much : ) Just wanted to throw the patch out there for anyone already using jQuery 1.9.

    Cool, thanks for the response and again for doing the hard work for us of making this a separate plugin ; )

  4. zaGerald
    Member
    Posted 1 year ago #

    Hi Ryan - Thanks for the fix, it is much appreciated... I almost abandoned the plugin and luckily found your post just in time!

  5. Ryan Urban
    Member
    Posted 1 year ago #

    My pleasure : )

  6. Samuel
    Member
    Posted 1 year ago #

    Thanks Ryan! Perfect fix.

  7. lornix
    Member
    Posted 11 months ago #

    Thanks for this fix! Very helpful!

  8. bjornst
    Member
    Posted 10 months ago #

    Tried using this plugin with WordPress 3.6 and it doesnt seem to work. Would it work if i apply the patch suggested by the op of this thread?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags