~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

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

  • Committer: Danilo Segan
  • Date: 2011-09-02 10:22:52 UTC
  • mfrom: (455.1.2 bug-839395)
  • Revision ID: danilo@canonical.com-20110902102252-phc11upmjw8tz1mg
[r=jam][bug=839395] Do not crash when someone asks to look at per-revision changes for a file when file is not changed in a certain revision.

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
 
}