jQuery 1.9+ support in vBulletin.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ibeauty
    Member
    • Sep 2010
    • 52
    • 3.8.x

    jQuery 1.9+ support in vBulletin.

    Does any of standard themes supports jQery 1.9+ ? Because I'm having big issue with it, as I try to use Twitter bootstrap elements in themes. I need jQuery 1.9 at least for it.
  • glennrocksvb
    Former vBulletin Developer
    • Mar 2011
    • 4021
    • 5.7.X

    #2
    vB5 uses jQuery 1.7.2 which is too far behind the latest version 1.11.3.

    If you replace the old one with 1.11.3, it might break some scripts that use deprecated or modified jQuery methods.
    Starting jQuery 1.9.0, there were major changes that may break sites. That's why jQuery provided jQuery migrate plugin to simplify transition from older versions.

    There is no straightforward to upgrade jQuery in vB5 but to do this without modifying templates and be safe from future upgrades, do the following:

    1. Remove the jQuery src at the bottom of the page by replacing this:

    src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"

    with an empty string

    You do this in AdminCP > Styles & Themes (or Style & Templates depending on your vB5 version) > Replacement Variable Manager.
    Click Add New Replacement Variable for the target style/theme.
    Fill out the form with the following info.

    Search for Text:

    src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"

    Replace with Text:

    (leave it empty)

    Repeat steps for all the themes/styles you are using.


    2. Then create a template hook in header_head hook location with this template:

    Code:
    <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
    You may use a different CDN url if you want.
    For steps on how to create a template hook, see one of the mods in my signature for similar instructions.


    Note: This is untested. Let me know if this works or not.
    Last edited by glennrocksvb; Mon 19 Oct '15, 9:50am.

    Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

    Comment

    • Wayne Luke
      vBulletin Technical Support Lead
      • Aug 2000
      • 74123

      #3
      Vote here to get it updated and tested - http://tracker.vbulletin.com/browse/VBV-12035
      Translations provided by Google.

      Wayne Luke
      The Rabid Badger - a vBulletin Cloud demonstration site.
      vBulletin 5 API

      Comment

      • ibeauty
        Member
        • Sep 2010
        • 52
        • 3.8.x

        #4
        Glenn Vergara Doesn't work. And I think you had over-engineered the solution. To replace jQuery version it is enough, to replace setting: "Use Remote jQuery" and "Custom Remote jQuery Path" without replacement variables. I've tested both ways. And now about the errors:

        jQuery migrate isn't enough, because scripts are not strict written.

        Code:
        a.curCSS is not a function
        - this can be quickly fixed by
        Code:
        jQuery.curCSS = jQuery.css;
        another one is caused by selectors like
        Code:
        input[name=xxx]
        where it should be with quotes
        Code:
        input[name='xxx']
        third is "selectBox" which crashes silently and refuses to work. And I gave up here. I didn't want to search all selectors for "selectBox"

        So... vBulletin is tightly bound to jQuery 1.7.2 and there is no easy way to change it. I've been looking for any template on the internet that allows newer jQuery to be used, but didn't found any. Well I think that is another nail to the coffin for vBulletin.

        Wayne Luke Thank for guiding me, but I think this will take too long for me, to be used.

        Comment

        • glennrocksvb
          Former vBulletin Developer
          • Mar 2011
          • 4021
          • 5.7.X

          #5
          You can fix the selectBox plugin by overriding the .selectBox() method. This will skip the plugin and all your dropdowns will use the native select and should work as is.

          Code:
          <script>
          $.fn.selectBox = function () {
              return this;
          };
          </script>
          You would add the above code via template hook in footer_before_body_end location.

          For the attribute selectors without quotes, that should work. I don't know why you're having an issue on this.

          But after all these, you will still have issues with jQuery UI. You also need to upgrade jQuery UI 1.8.14 to 1.11.4. The only way to do that unfortunately is to edit the footer-rollup js file and replace the jQuery UI block with the latest version. You would have to do this on every upgrade.

          Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

          Comment

          • Craig
            Senior Member
            • Jan 2008
            • 998
            • 6.X

            #6
            any update on the jquery version upgrade?
            adktramping ~ my happy place.

            "Whoever said practice makes perfect was an idiot. Humans can't be perfect because we're not machines." ~ Sam Gardner.

            Vote for your favorite feature requests and the bugs you want to see fixed.

            Comment

            • Wayne Luke
              vBulletin Technical Support Lead
              • Aug 2000
              • 74123

              #7
              Originally posted by NumNum
              any update on the jquery version upgrade?
              It is currently being worked on. It is proving more difficult than just dropping in a new library due to some of the changes made to the Tab UI in jQuery UI. That is all I can say at this time.
              Translations provided by Google.

              Wayne Luke
              The Rabid Badger - a vBulletin Cloud demonstration site.
              vBulletin 5 API

              Comment

              Related Topics

              Collapse

              Working...