/[drupal]/contributions/modules/import_html/toggle_treeview.js
ViewVC logotype

Contents of /contributions/modules/import_html/toggle_treeview.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Wed Dec 3 11:33:18 2008 UTC (11 months, 3 weeks ago) by dman
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--1, DRUPAL-5--2
Changes since 1.1: +36 -36 lines
File MIME type: text/javascript
Huge file-ending problem fix up.
I think my Mac touched them and saved them :(
Back to Unix newlines please
1 //
2 // Add multi-select toggling for nested treeviews
3 //
4 /*
5 DIV.tree-branch
6 LABEL.tree-branch-label
7 checkbox.tree-branch-toggle
8 DIV.tree-content
9 LABEL
10 checkbox.tree-leaf
11 LABEL
12 checkbox.tree-item
13
14 */
15
16 /**
17 * Attach an event to each tree-branch-toggle - the representative toggle for a branch.
18 * Onset, toggle all child elements of that branch
19 */
20
21 if (Drupal.jsEnabled) {
22 $(document).ready(function() {
23 $('.tree-branch-toggle').change(
24 function(e){
25 var checked = $(this).attr("checked");
26 // find current container
27 parentElem = $(this).parent();
28 while(! $(parentElem).is(".tree-branch") && (parentElem = $(parentElem).parent())) { /* loop */ }
29 if($(parentElem).is(".tree-branch")){
30 // now set every child
31 $('input:checkbox', parentElem).attr("checked", checked ? true : false);
32 }
33 }
34 ) // each label
35 }) // ready func
36 } // JS OK

  ViewVC Help
Powered by ViewVC 1.1.2