Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
So everytime i use jQuery with Zen i get on a hour long marathon to find how to get jQuery to work (yes i forget between jobs). It would be VERY helpfull if a few lines were added to the readme file in the /zensubtheme/js folder that would just tell you that you need to wrap your jquery code in:
(function ($) { /* jQuery stuff */ })(jQuery);
This would save a lot of hassle for a lot of people first extending zen with jQuery.
Comment | File | Size | Author |
---|---|---|---|
#6 | js-doc-1105868-6.patch | 565 bytes | maartenverbaarschot |
#2 | js-doc-1105868-2.patch | 581 bytes | echoz |
Comments
Comment #1
JohnAlbinSounds good to me. How about a comment before that anonymous function explaining why you need it? Either in patch form or just the script.js. :-)
Comment #2
echoz CreditAttribution: echoz commentedHere's a patch to the documentation.
Comment #3
efc84 CreditAttribution: efc84 commentedHi,
I have a java scrpt query to do Zen?
I have just switched themes from Bartik to Zen and my Accordion menu (http://drupal.org/project/accordion_menu) does not function anymore since the switch?
How do i enable Java script in Zen?
The accordion menu files are stored in drupal-7.8/misc/ui and this contains 43 files?
Thanks
Comment #4
JohnAlbin@efc84 This issue is about a feature request for additional documentation for jQuery. It's not a forum for posting support requests.
Zen doesn't enable or disable JavaScript at all. There's no reason that I know of why that module would stop working with Zen. Perhaps its something else you did? You should submit a support request with the accordian_menu module.
Comment #5
efc84 CreditAttribution: efc84 commentedApologies and thank you, I'll leave a request with the accordion menu
Comment #6
maartenverbaarschot CreditAttribution: maartenverbaarschot commentedThis patch adds a blank JavaScript file with just the jQuery compatiblity documentation. It's probably good to have it in the file itself as a lot of people might skip the readme. And you won't have to copy-paste the wrapper code everytime.
Comment #7
echoz CreditAttribution: echoz commentedAgreed, as I later realized that’s what John suggested in #1
Comment #8
barraponto CreditAttribution: barraponto commentedOh, I'm all for it. Tao strips all the core css like that, since it is way too opinionated to allow for proper vertical rhythm. Although it duplicates maintenance efforts. But I digress.What we've got to be careful is with core bug #967166: Content rendered via AJAX does not respect stylesheets removed in .info files which reintroduces CSS regardless of .info or css_alter. And let's get that fixed, shall we?
Man, what was I talking about? I'll sleep more from now on, promise.
Comment #9
JohnAlbinMatt Farina pointed out this article about the module pattern and anonymous closures, etc. http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth
It's so awesome, I added it to the script.js comments.
Thanks, everyone! The patches made it really easy to tweak it and add this into Zen. :-)
Fixed. http://drupalcode.org/project/zen.git/commitdiff/6e5fd91
Comment #10
JohnAlbinAfter working on #1089300: Clean up drupal.js, I've update the documentation to say:
Comment #11
KrisBulman CreditAttribution: KrisBulman commented@barraponto the core bug on css_alter is resolved and committed
Comment #12
barraponto CreditAttribution: barraponto commented@krisbulman RTBC ...
Comment #14
cjoy CreditAttribution: cjoy commentedis there a reason for the script.js template to not extend Drupal.behaviors ?
In the current form it does not appear to support the use of jQuery even though the the template suggest it does.
Comment #15
JohnAlbinSure! http://drupalcode.org/project/zen.git/commitdiff/fef436c