------------------------------------------------------------
revno: 4159
committer: Morten Olav Hansen <[email protected]>
branch nick: dhis2
timestamp: Mon 2011-07-18 15:21:37 +0200
message:
more jquerification in ouwt
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2011-07-18 12:07:17 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2011-07-18 13:21:37 +0000
@@ -173,17 +173,15 @@
function processCollapse( rootElement )
{
- var unitElements = rootElement.getElementsByTagName( 'unit' );
-
- for ( var i = 0, unitElement; ( unitElement = unitElements[i] ); ++i )
+ $( rootElement ).find( "unit" ).each( function( i, item )
{
- var parentId = unitElement.firstChild.nodeValue;
- var parentTag = document.getElementById( getTagId( parentId ) );
- var children = parentTag.getElementsByTagName( 'ul' );
+ var parentId = $( item ).eq( 0 ).text();
+ var $parentTag = $( "#" + getTagId( parentId ) );
+ var child = $parentTag.find( "ul" ).eq( 0 );
- setVisible( children[0], false );
- setToggle( parentTag, false );
- }
+ setVisible( child, false );
+ setToggle( $parentTag, false );
+ } );
}
function processExpand( rootElement )
@@ -292,8 +290,7 @@
function setToggle( unitTag, expanded )
{
- var spans = unitTag.getElementsByTagName( 'span' );
- var toggleTag = spans[0];
+ var toggleTag = $( unitTag ).find( "span" ).get( 0 );
var toggleImg = expanded ? getToggleCollapse() : getToggleExpand();
if ( toggleTag.firstChild )
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp