Thanks for writing this module. I think it is exactly what I was looking for.
I am trying to use your API in my custom module since I need to get the dialog and tabs jQuery widget working with a newer version. Can you tell me if I have to have the jQuery widgets such as dialog, button, and tabs in separate folders in sites/all/libraries/widget-name or can they be integrated in a custom jQuery file and installed in sites/all/libraries/jquery. I had a custom file jquery-ui-1.8.16.custom.min.js which included the widgets mentioned above and I could not by any means load it with the jQuery Multi API. I tried adding (jq1816) in the js file as shown here:
(function($){
$(document).ready(function($) {
//my jQuery code here
});
})(jq1816);
This gives me the following error:
ReferenceError: Can't find variable: jq1816
I also tried to install jquery-1.8.2.min.js instead in sites/all/libraries/jquery and the widget files in sites/all/libraries/ (see attached screen shot).
Then I added the following to my custom module:
function ecomma_jqmulti_libraries() {
return array(
'jquery.dialog',
'jquery.tabs',
);
}
I cannot see any of the widgets being loaded at run time.
drupal_add_js('sites/all/libraries/jquery.dialog/jquery.dialog.min.js');
drupal_add_js('sites/all/libraries/jquery.tabs/jquery.tabs.min.js');Loads the widget files, but probably because they are not loaded with the packages they were downloaded with they are throwing a bunch of errors and $( "id" ).tabs(); as well as $( "id" ).dialog(); still don't get evaluated.
The only way I could get at least the dialog widget to work was add the custom jQuery file manually.
drupal_add_js('sites/all/libraries/jquery/ jquery-ui-1.8.16.custom.min.js');
What can I do to get this working?
| Comment | File | Size | Author |
|---|---|---|---|
| jQuery Multi config.png | 57.13 KB | nsuit |
Comments
Comment #1
devkinetic commentedI'm in the same boat!
...nothing added to $scripts. I also tried loading my script under my module and calling it with hook_jqmulti_files and hook_jqmulti_libraries.
I'm trying to load the plugin for a custom block that utilizes jquery
Comment #2
dunx commentednsuit... if using method A. then you don't need to add the "jq1816" tag. The module does that for you.
devkinetic... Clearing the cache will make the JS files appear in your source.
jqmulti picks up all js files under each library directory, so if you're using a custom or full download of jQuery-UI, then you'll need to figure out which bits you need and copy those into a separate directory, else you'll end up with a huge number of js files included.
In my case, I decided it would just be easier to stick all my "latest jQuery version" scripts in a single /libraries/ directory and check that box under the settings page.
Not that I've actually got it working myself yet!
Comment #2.0
dunx commentedCorrected file name.
Comment #3
goron commentedeveryone, please update to the latest version and see if you still have problems. I've also improved the README there.
nsuit, you don't need to use the alias, unless you're writing code outside of the libraries themselves, in which case you should use the alias for that code.
You can select the libraries using the ui or with the hook as you showed, but notice the new "load always" setting in the new version, which will determine if the files themselves are loaded or not.
Comment #4
goron commented