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.

Files: 

Comments

Status:Active» Needs work

Sounds 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. :-)

Priority:Major» Normal
Status:Needs work» Needs review
StatusFileSize
new581 bytes

Here's a patch to the documentation.

Hi,

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

@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.

Apologies and thank you, I'll leave a request with the accordion menu

StatusFileSize
new565 bytes

This 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.

Agreed, as I later realized that’s what John suggested in #1

Title:Add needed JavaScript documentation to script.jsAdd needed jQuery use info
Status:Fixed» Needs review

Oh, 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.

Title:Add needed jQuery use infoAdd needed JavaScript documentation to script.js
Status:Needs review» Fixed

Matt 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

Title:Add needed jQuery use infoAdd needed JavaScript documentation to script.js
Status:Needs review» Fixed
Issue tags:-jQuery, -Needs Documentation

After working on #1089300: Clean up drupal.js, I've update the documentation to say:

/**
* @file
* A JavaScript file for the theme.
*
* In order for this JavaScript to be loaded on pages, see the instructions in
* the README.txt next to this file.
*/
// JavaScript should be made compatible with libraries other than jQuery by
// wrapping it with an "anonymous closure". See:
// - http://drupal.org/node/1446420
// - http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth
(function ($, Drupal, window, document, undefined) {
// Place your code here.
})(jQuery, Drupal, this, this.document);

@barraponto the core bug on css_alter is resolved and committed

@krisbulman RTBC ...

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status:Closed (fixed)» Active

is 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.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.