~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/static/javascript/custom.js

  • Committer: Michael Hudson
  • Date: 2008-03-06 02:35:59 UTC
  • mto: This revision was merged to the branch mainline in revision 149.
  • Revision ID: michael.hudson@canonical.com-20080306023559-xl46e4ipgxw44zcf
use a list comprehension instead

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
window.addEvent('domready', function()
2
 
{
3
 
    $$('.revision_log').each(function(item, i)
4
 
    {
5
 
        // FIXME: Make less redundant
6
 
        var thisSlider = new Fx.Slide( item.getElement( '.revisioninfo' ), { duration: 200 } );
7
 
        var shortDescription = item.getElement( '.short_description' );
8
 
        var longDescription = item.getElement( '.long_description' );
9
 
        thisSlider.hide();
10
 
        item.getElement( '.expand_revisioninfo' ).addEvent( 'click', function()
11
 
            {
12
 
                thisSlider.toggle();
13
 
                if(longDescription.style.display == 'none')
14
 
                {
15
 
                    longDescription.style.display = 'block';
16
 
                    shortDescription.style.display = 'none';
17
 
                }
18
 
                else
19
 
                {
20
 
                    longDescription.style.display = 'none';
21
 
                    shortDescription.style.display = 'block';
22
 
                }
23
 
            } );
24
 
    });
25
 
 
26
 
});
27
 
 
28
 
function toggle_expand_all(action)
29
 
{
30
 
    $$('.revision_log').each(function(item, i)
31
 
    {
32
 
        // FIXME: Make less redundant
33
 
        var thisSlider = new Fx.Slide( item.getElement( '.revisioninfo' ), { duration: 200 } );
34
 
        var shortDescription = item.getElement( '.short_description' );
35
 
        var longDescription = item.getElement( '.long_description' );
36
 
        if(action == 'close')
37
 
        {
38
 
            thisSlider.slideOut();
39
 
            $('expand_all').style.display = 'block';
40
 
            $('collapse_all').style.display = 'none';
41
 
 
42
 
        }
43
 
        else if(action == 'open')
44
 
        {
45
 
            thisSlider.slideIn();
46
 
            $('expand_all').style.display = 'none';
47
 
            $('collapse_all').style.display = 'block';
48
 
        }
49
 
                if(longDescription.style.display == 'none')
50
 
                {
51
 
                    longDescription.style.display = 'block';
52
 
                    shortDescription.style.display = 'none';
53
 
                }
54
 
                else
55
 
                {
56
 
                    longDescription.style.display = 'none';
57
 
                    shortDescription.style.display = 'block';
58
 
                }
59
 
    });
60
 
}