Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Where to put additional jQuery plugins?

edited March 2012 in Vanilla 2.0 - 2.8

Hi again,
I need to install an extra jQuery plugin to use it in my Vanilla plugin, and I was wondering what's the recommended place where to put it (it requires some extra CSS, too).

Initially, I thought of putting it in subdirectory of my plugin's directory, but, on the other hand, I might need it again and I'd like not to install it multiple times.

Also, all the examples I found call the "AddJs" somewhere in the initialization, but, this way, the JS file gets loaded in every page, and not only when needed. Is there some sort of "conditional load", or can I freely implement it myself? For example, checking the path and deciding if I should load it or not.

Thanks for the help.

Answers

  • In the past i have used conditions and added it to default.master.php file in my theme, but perhaps there is a cleaner way. Watching this thread

    There was an error rendering this rich post.

  • Pocket plugin can have you but not lot of choices.

  • PamelaPamela ✭✭
    edited June 2012

    422 said:
    In the past i have used conditions and added it to default.master.php file in my theme, but perhaps there is a cleaner way. Watching this thread

    Which discussion ?

    please, could you give us an example of your code :) thanks in advance

  • There was an error rendering this rich post.

  • peregrineperegrine MVP
    edited June 2012

    in addtion to 422's suggestion on the plugin, you can also

    take a look at the embedfriendly theme for an example of how js is added in a theme.

    e.g. this is where to hook
    class.embedfriendlythemehooks.php

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • PamelaPamela ✭✭

    @442 & @peregrine, it was on my "to do" list :) I will check it out... thank you for your reply

  • I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.