Hello, I need help about javascript, and I would like to document better a few things at the same time (like I did a short while ago about the cache API: I recycled the help I received to make a handbook page where one was lacking). I have never coded any javascript nor used jQuery before, so I deserve my handle more than ever on this topic. Unfortunately, there is no introductionnary and Drupal specific documentation about javascript, and about the proper use of js within Drupal. There are a few js snippets or js related handbook pages here and there (especially within the php snippets section: http://drupal.org/handbook/customization/php-snippets ). I suggest we create a separate handbook section for javascript (see request: http://drupal.org/node/145660). What is missing, is a Javascript API page, that would serve as a general introduction to using js within Drupal. Please help me answer the following questions, and I'll put it all together into a handbook page: Is the Drupal js API limited to those? http://api.drupal.org/apis/5/js What js is included with core, that one can use without messing with any js code? (what is needed here, is at least a short introduction to the core .js files: [augustin@203 misc]$ ls *.js autocomplete.js collapse.js drupal.js jquery.js progress.js tableselect.js textarea.js update.js upload.js when they are used (i.e. included in the page request), what can be done with them without needing adding any additional js code, etc. If jquery is included in core, does that mean that I can start adding the relevant tags in html without bothering with js code?? What else would a beginner need to know, to get started efficiently working with Drupal and js? Beside http://www.learningjquery.com/ , http://jquery.com (hmmm, the latter times out), what other web sites or (Drupal-specific) articles hosted elsewhere would it be useful to link to? Thanks, Augustin. -- http://www.wechange.org/ Because we and the world need to change. http://www.reuniting.info/ Intimate Relationships, peace and harmony in the couple.
For the JQuery stuff, I'd actually recommend looking at the Pro Drupal Development book. There is an excellent introduction to JQuery there. Along with a sample module. Dave On May 21, 2007, at 7:41 AM, Augustin (Beginner) wrote:
Hello,
I need help about javascript, and I would like to document better a few things at the same time (like I did a short while ago about the cache API: I recycled the help I received to make a handbook page where one was lacking).
I have never coded any javascript nor used jQuery before, so I deserve my handle more than ever on this topic.
Unfortunately, there is no introductionnary and Drupal specific documentation about javascript, and about the proper use of js within Drupal.
There are a few js snippets or js related handbook pages here and there (especially within the php snippets section: http://drupal.org/handbook/customization/php-snippets ).
I suggest we create a separate handbook section for javascript (see request: http://drupal.org/node/145660).
What is missing, is a Javascript API page, that would serve as a general introduction to using js within Drupal.
Please help me answer the following questions, and I'll put it all together into a handbook page:
Is the Drupal js API limited to those? http://api.drupal.org/apis/5/js
What js is included with core, that one can use without messing with any js code? (what is needed here, is at least a short introduction to the core .js files:
[augustin@203 misc]$ ls *.js autocomplete.js collapse.js drupal.js jquery.js progress.js tableselect.js textarea.js update.js upload.js
when they are used (i.e. included in the page request), what can be done with them without needing adding any additional js code, etc.
If jquery is included in core, does that mean that I can start adding the relevant tags in html without bothering with js code??
What else would a beginner need to know, to get started efficiently working with Drupal and js?
Beside http://www.learningjquery.com/ , http://jquery.com (hmmm, the latter times out), what other web sites or (Drupal-specific) articles hosted elsewhere would it be useful to link to?
Thanks,
Augustin.
-- http://www.wechange.org/ Because we and the world need to change.
http://www.reuniting.info/ Intimate Relationships, peace and harmony in the couple.
You also might want to take a look at jQuery Interface Sortable -- http://drupal.org/project/interface_sortable -- and the jQuery interface -- http://drupal.org/project/jquery_interface -- and jQuery update -- http://drupal.org/project/jquery_update -- modules. Cheers, Bill David Metzler wrote:
For the JQuery stuff, I'd actually recommend looking at the Pro Drupal Development book. There is an excellent introduction to JQuery there. Along with a sample module.
Dave
On May 21, 2007, at 7:41 AM, Augustin (Beginner) wrote:
Hello,
I need help about javascript, and I would like to document better a few things at the same time (like I did a short while ago about the cache API: I recycled the help I received to make a handbook page where one was lacking).
I have never coded any javascript nor used jQuery before, so I deserve my handle more than ever on this topic.
Unfortunately, there is no introductionnary and Drupal specific documentation about javascript, and about the proper use of js within Drupal.
There are a few js snippets or js related handbook pages here and there (especially within the php snippets section: http://drupal.org/handbook/customization/php-snippets ).
I suggest we create a separate handbook section for javascript (see request: http://drupal.org/node/145660).
What is missing, is a Javascript API page, that would serve as a general introduction to using js within Drupal.
Please help me answer the following questions, and I'll put it all together into a handbook page:
Is the Drupal js API limited to those? http://api.drupal.org/apis/5/js
What js is included with core, that one can use without messing with any js code? (what is needed here, is at least a short introduction to the core .js files:
[augustin@203 misc]$ ls *.js autocomplete.js collapse.js drupal.js jquery.js progress.js tableselect.js textarea.js update.js upload.js
when they are used (i.e. included in the page request), what can be done with them without needing adding any additional js code, etc.
If jquery is included in core, does that mean that I can start adding the relevant tags in html without bothering with js code??
What else would a beginner need to know, to get started efficiently working with Drupal and js?
Beside http://www.learningjquery.com/ , http://jquery.com (hmmm, the latter times out), what other web sites or (Drupal-specific) articles hosted elsewhere would it be useful to link to?
Thanks,
Augustin.
--http://www.wechange.org/ Because we and the world need to change.
http://www.reuniting.info/ Intimate Relationships, peace and harmony in the couple.
-- Bill Fitzgerald http://www.funnymonkey.com Tools for Teachers 503.897.7160
On Monday 21 May 2007 23:25, Bill Fitzgerald wrote:
You also might want to take a look at jQuery Interface Sortable -- http://drupal.org/project/interface_sortable -- and the jQuery interface -- http://drupal.org/project/jquery_interface -- and jQuery update -- http://drupal.org/project/jquery_update -- modules.
Hi Bill, Thanks. I have created the following page: http://drupal.org/node/145950 and I also suggested that there is a javascript-related category for modules: http://drupal.org/node/146175. Blessings, Augustin. -- http://www.wechange.org/ Because we and the world need to change. http://www.reuniting.info/ Intimate Relationships, peace and harmony in the couple.
On 21 May 2007, at 16:49, David Metzler wrote:
For the JQuery stuff, I'd actually recommend looking at the Pro Drupal Development book. There is an excellent introduction to JQuery there. Along with a sample module.
Actually, it's the one chapter I'm not super-excited about. If you know no jQuery at all, the chapter will be helpful. But if you know a little bit about jQuery, the jQuery chapter doesn't learn you much. Most of the code in the jQuery chapter is PHP/Drupal code, and not Javascript/jQuery code. So the chapter is good at educating you how to bind Drupal and jQuery, but doesn't get you far with jQuery itself. Many of the most basic jQuery stuff is missing (i.e. it's extremely brief about selectors) and much of the chapter repeats what was already discussed in earlier chapters (i.e. how to build a module). So, if there is going to be a Drupal 6 version of the book (*please*), I'd suggest that the jQuery chapter gets another 10 pages with more jQuery tips and tricks. That said, the book rocks! :) -- Dries Buytaert :: http://www.buytaert.net/
I'm sure some people know about this (was news to me though).
From the http://learningjquery.com site:
http://www.learningjquery.com/2007/03/learning-jquery-the-book "About the Authors Jonathan Chaffer is a long-time Drupal contributor and creator of Drupal’s CCK...." andre Dries Buytaert wrote:
On 21 May 2007, at 16:49, David Metzler wrote:
For the JQuery stuff, I'd actually recommend looking at the Pro Drupal Development book. There is an excellent introduction to JQuery there. Along with a sample module.
Actually, it's the one chapter I'm not super-excited about. If you know no jQuery at all, the chapter will be helpful. But if you know a little bit about jQuery, the jQuery chapter doesn't learn you much. Most of the code in the jQuery chapter is PHP/Drupal code, and not Javascript/jQuery code. So the chapter is good at educating you how to bind Drupal and jQuery, but doesn't get you far with jQuery itself. Many of the most basic jQuery stuff is missing (i.e. it's extremely brief about selectors) and much of the chapter repeats what was already discussed in earlier chapters (i.e. how to build a module).
So, if there is going to be a Drupal 6 version of the book (*please*), I'd suggest that the jQuery chapter gets another 10 pages with more jQuery tips and tricks.
That said, the book rocks! :)
-- Dries Buytaert :: http://www.buytaert.net/
There was an excellent Drupal Dojo lesson (twice, because the screencast got lost the first time) on jQuery, with running examples for ajax callbacks, etc. Here are the links: General (including bittorrent to download screencast): http://drupaldojo.com/lesson/jquery-resurrected Brief class notes explaining pastebin working code: http://groups.drupal.org/node/2843 Victor Kane http://awebfactory.com.ar On 5/22/07, Dries Buytaert <dries.buytaert@gmail.com> wrote:
On 21 May 2007, at 16:49, David Metzler wrote:
For the JQuery stuff, I'd actually recommend looking at the Pro Drupal Development book. There is an excellent introduction to JQuery there. Along with a sample module.
Actually, it's the one chapter I'm not super-excited about. If you know no jQuery at all, the chapter will be helpful. But if you know a little bit about jQuery, the jQuery chapter doesn't learn you much. Most of the code in the jQuery chapter is PHP/Drupal code, and not Javascript/jQuery code. So the chapter is good at educating you how to bind Drupal and jQuery, but doesn't get you far with jQuery itself. Many of the most basic jQuery stuff is missing (i.e. it's extremely brief about selectors) and much of the chapter repeats what was already discussed in earlier chapters (i.e. how to build a module).
So, if there is going to be a Drupal 6 version of the book (*please*), I'd suggest that the jQuery chapter gets another 10 pages with more jQuery tips and tricks.
That said, the book rocks! :)
-- Dries Buytaert :: http://www.buytaert.net/
Beside http://www.learningjquery.com/ , http://jquery.com (hmmm, the latter times out), what other web sites or (Drupal-specific) articles hosted elsewhere would it be useful to link to?
A graphically organized jquery reference: www.visualjquery.com Farsheed ____________________________________________________________________________________ Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html
Hello, Thanks to those who replied and helped me. I found out that javascript-related pages were spread over many sections of the handbook. I have reorganized everything, so that everything can be found under one section: http://drupal.org/node/121997 I have added pointers in some places, so that people can find it more easily. I have added all the information you gave me, too. I still have one lingering question, though: What about Drupal's own javascript API?? This page is the only documentation of Drupal's API: http://drupal.org/node/83181 None of Drupal's own misc/*.js files are documented on a.d.o (e.g. :http://api.drupal.org/apis/HEAD/drupal.js ) and the code source itself is not very helpful. Unlike for all the php functions, the js functions are not documented at all at the source, nor at api.drupal.org. I would have expected the function's headers to document how to make use of the function by applying the proper html markup. E.g., instead of having: /** * Toggle the visibility of a fieldset using smooth animations */ Drupal.toggleFieldset = function(fieldset) { We would have something like: /** * Toggle the visibility of a fieldset using smooth animations * * Applicable to all <fieldset> elements. * The class "collapsed" indicates the state of the fieldset where everything in the fieldset but the <legend> element is hidden. * e.g.: * <fieldset class=" collapsible collapsed"><legend>Input format</legend></fieldset> */ Drupal.toggleFieldset = function(fieldset) { Unfortunately, I am not competent to document this (that's why I asked for your help in the first place. I have already documented what I could, though). If someone knows how to document this, would the core committers (Gerhard, Neil, Gabor, Steve and Dries) actually commit relevant patches? Thanks, Augustin. -- http://www.wechange.org/ Because we and the world need to change. http://www.reuniting.info/ Intimate Relationships, peace and harmony in the couple.
We would have something like:
/** * Toggle the visibility of a fieldset using smooth animations * * Applicable to all <fieldset> elements. * The class "collapsed" indicates the state of the fieldset where everything in the fieldset but the <legend> element is hidden. * e.g.: * <fieldset class=" collapsible collapsed"><legend>Input format</legend></fieldset> */ Drupal.toggleFieldset = function(fieldset) {
You're never supposed to use the collapsible feature with anything other than a Form API-generated collapsible fieldset. Just because there is a JS/PHP split doesn't mean that that split maps to the API as well. The only JS API functions we have are in drupal.js. Everything else is specific to one feature and should not be called from outside that .js file itself. The only exception I know of is the various issues with behaviour attaching, for which there is in fact a patch in the queue to provide a more robust mechanism. You would never hack together Form API-like arrays and pass them directly to functions buried deep inside form.inc would you? Steven Wittens
On Friday 25 May 2007 02:47:42 pm Steven Wittens wrote:
You're never supposed to use the collapsible feature with anything other than a Form API-generated collapsible fieldset. Just because there is a JS/PHP split doesn't mean that that split maps to the API as well. The only JS API functions we have are in drupal.js. Everything else is specific to one feature and should not be called from outside that .js file itself.
Apologies if this is off-topic, as I have not been following this thread all along. However if people are looking for a way to make text appear and disappear in the manner of a collapsible fieldset, check out what this module calls "clicktips": http://drupal.org/project/hovertip -Dave
participants (9)
-
Andre Molnar -
Augustin (Beginner) -
Bill Fitzgerald -
Dave Cohen -
David Metzler -
Dries Buytaert -
Farsheed -
Steven Wittens -
Victor Kane