Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Extension: JQuery

StashStash
edited February 2007 in Vanilla 1.0 Help
Edit 2007-01-11: jQuery and Smooth Page Jump are completely incompatible. Whichever one is activated last works and prevents the other one from working properly.
Edit 2007-01-20: WORKS with Smooth Page Jump, just enable SPJ AFTER JQuery and its extensions!


OK, so I've written my first ever Vanilla extension. It's very simple and hopefully will work for people other than just me, so please be kind and give me feedback :)

JQuery

The idea with this is that it's simple to update and will allow people to use jQuery in future extensions.

There's already a bug I've found (breaks "#pgbottom" in Smooth Page Jump 1.0 by Jazzman :( ), so no doubt there will be more, but I'll do my best to solve them. Any and all advice from seasoned extension authors and PHP gurus is welcomed as I'm learning as I go here.

Oh, and the version numbering... the numbers reflect the jQuery version number and the letter at the end is my revision letter, or "build number" if you will.

Edit: Incidentally, when I tried to upload as a ZIP file (compressed using 7-Zip) I got the following error...
The file you attempted to upload (jQuery-1.0.4.a.zip) was of type "application/octet-stream", but the file extension "zip" did not match the accepted extensions for this type of file: rar
«1

Comments

  • Options
    Thanks!

    (Personally, I'm of the opinion that forum software as slick as Vanilla ought to be on a JS library as slick as jQuery from the get go ;D)
  • Options
    chuy, I agree that these libraries do belong in Vanilla, I still rather like the idea of them being extensions (even if packaged and required by default) as you can then update them independantly of the main package.

    So, did it work for you?
  • Options
    Stash, my usual requests/remarks:

    #1 - why not name it the jQuery plugin with normal Vanilla versioning, so we can separate your updates from theirs
    #2 - if need be have it check the latest jQuery version on the site and warn the admin if a newer one is needed
    #3 - make sure your extension identifies itself so third party extensions know it's installed? (e.g. set global var?)

    PS while you're at it, can you re-write controls.js so the darn (pretty useless?) whisper auto-completer no longer
    requires 25kB on every page? I never understood the use of the use of auto-complete for whispers, especially
    since it uses the full user database and provides access to the full set of users?!?
  • Options
    #1 - Hmm... I was umming and ahhing over this last night before I posted. I guess you're right. I'll go and change it now.
    #2 - That would be nice, is there a way to do this within the lussumo framework?
    #3 - How? I'm still stumbling around in the dark wrt PHP and the lussumo framewrk, so a little guidance here would be lovely :)

    Regarding the whisper autocomplete, that's currently beyond me, but I'll certainly have a try! Certainly would be nice to have it removed from Vanilla and added as an extension or jQuery plugin though :)

    I was thinking of making jQuery plugins installable into the jQuery extension directory, instead of the extension directory directly. This way it's obvious that you have to have jquery installed first. What does everyone think to this?
  • Options
    #2 - Latest jQuery version is alway here: http://jquery.com/src/jquery-latest.js (or better the compressed one: http://jquery.com/src/jquery-latest.pack.js)
    Solution 1: plugin saves a datestamp to remind the admin to check for updates manually? (cf. vanilla check for update reminder)
    Solution 2: plugin checks for update @ jquery.com if current user is admin and warns him/her is the latest version is newer?
    #3 - I'd assume you could use a global var, cf. http://lussumo.com/community/discussion/4502/ (if (!defined('JQUERY_PRESENT')) exit();

    Don't like the idea of JQuery extensions in the same dir. How about making all JQuery extensions use a common naming scheme
    so they appear grouped in the extensions list and directories, e.g. JQ_ExtensionNames, JQ_AutoComplete, JQ_IgnoreWanderer, etc. etc.
  • Options
    StashStash
    edited December 2006
    #1 - I think I'll wait for the ExtensionAutoUpdate extension tbh ;)

    #3 - I meant how do I set this variable in the first place :D But that bit you posted will certainly be useful!

    jQ_ prefix for jQuery plugins is a damn good idea. As soon as I can do one I will :) I'll then work on some version checking code in the jQ_ plugins that will make sure they have what they need.
  • Options
    I've "updated" it to version 1.0.0, ripped out some fluff that wasn't working properly yet and I think I've defined a variable which sets the extension plugin version...
  • Options
    JQ_IgnoreWanderer, where can I get that? Just kidding, but come on that was funny.
  • Options
    pic

    ROFL

  • Options
    From what I see, there are 2 other extensions that added jquery.js, Attachments and yshout. Would there be any conflicts or is this just redundant?
  • Options
    jimw, the idea behind this is:
    1. other extensions can use jQuery without having to enable other extensions with functions you may not want
    2. extension writers can use jQuery without having to worry about packaging it with their extensions
    3. and so it is easy to update jQuery to the current version.
    Just imagine if you had 4 extensions installed that all used jQuery and all included different versions of it! Now *THAT* would get you some conflicts. I hope that for extensions that already use jQuery the authors could update them to "use" this (all it would really require is ripping some stuff out I'd have thought). Also, if you're referring to Attachments 1.4, isn't that obsoleted by Jazzman now for 2.1?
  • Options
    Updated to 1.0.1 which adds a global variable so other extensions can see if JQuery is installed.
  • Options
    StashStash
    edited January 2007
    I've found a workaround for the #pgbottom link not working with Jazzman's Smooth Page Jump 1.0 extension and JQuery being enabled. Simply ensure that Smooth Page Jump is enabled after JQuery in /conf/extensions.php. The simplest and easiest way to do this is enable JQuery and disable and re-enable Smooth Page Jump. Then it seems to work.

    However, this makes me wonder if certain things in JQuery now won't work as there's obviously a conflict between the two still. Any JS gurus know what's going on?

    1.0.2 uploaded, path typo fixed and code readability improved.

    Edit 2007-01-11: jQuery and Smooth Page Jump are completely incompatible. Whichever one is activated last works and prevents the other one from working properly.
  • Options
    edited January 2007
    jQuery is partially incompatible with DiscussionTags. It breaks the edit inline funtionality wich depends on prototype+scriptaculous. Is there a way to solve this conflict?
  • Options
    jQuery has just been updated to version 1.1. This is incompatible with ThickBox 2.1, so until I can solve that problem I won't be updating this extension (it will happen though).

    Now, I have read a couple of things about getting prototype and jQuery 1.1 to co-exist, so you can see where this is going (ie, soon, but not yet). I hope you're speaking to houseinprogress on how to get prototype compatible with jQuery as well ;)
  • Options
    vanilla should just convert to jquery, drupal already has
  • Options
    edited January 2007
    I've solved my problem changing javascript used by DiscussionTags: the problem is $ obviously so I've converted prototype calls to jQuery calls (ajax functions work the same with no problem) I agree (in part) with SirNot: Vanilla has to choose a javascript library and put it in the core framework forcing all extension developers to use the same library. It's important, we can't go on with these kind of conflicts. I've always used prototype+scriptaculous but if Vanilla choose jQuery... well I'll try it :-)
  • Options
    I think I've solved the incompatibility problem with prototype AND ThickBox with jQuery 1.1. I've got it all running here: http://exhibitq.com/talk/comments.php?DiscussionID=3&page=1 But I would like a couple of people willing to beta test before I release it fully.
  • Options
    Updated to jQuery 1.1 and fixed it working with SmoothPageJump! Just make sure you enable SPJ AFTER JQuery and Any JQ* extensions.
  • Options
    Updated jQuery to 1.1.1.
This discussion has been closed.