/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/js/examplesBody.js

  • Committer: b11johgu
  • Date: 2013-05-14 12:30:38 UTC
  • mto: This revision was merged to the branch mainline in revision 65.
  • Revision ID: b11johgu@student.his.se-20130514123038-rthxj3f34o32gpxy
ExamplesController:
- Added expand/collapse arrows for categories/subcategories.
- Added category positioning (incomplete).

more general changes made.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Functions */
 
2
$(document).ready(function(){
 
3
        drawRows();
 
4
});
 
5
 
 
6
/* Expands/hides category data */
 
7
function categoryExpand(e){
 
8
        e = document.getElementById(e);
 
9
        
 
10
        $(e).children().not('.categoryMoveUp').not('.categoryMoveDown').not(':first-child').toggle();
 
11
        if($(e).children().find('p').first().hasClass('expanded')){
 
12
                $(e).children().find('p').first().removeClass('expanded');
 
13
                $(e).css('height','25px');
 
14
                
 
15
        }
 
16
        else{
 
17
                $(e).children().find('p').first().addClass('expanded');
 
18
                $(e).removeAttr('style');
 
19
        }
 
20
        drawRows();
 
21
}
 
22
 
 
23
function drawRows(){
 
24
        var counter=1;
 
25
        $('.row').not(':hidden').each(function(){
 
26
                counter++;
 
27
                if(counter % 2){
 
28
                        $(this).addClass('odd').removeClass('even');
 
29
                }
 
30
                else{
 
31
                        $(this).addClass('even').removeClass('odd');
 
32
                }
 
33
        });
 
34
}
 
35
 
 
36
function categoryMoveUp(e)
 
37
{
 
38
        var targetMenu = $('li[data-name="'+e+'"]');
 
39
        e = document.getElementById(e);
 
40
        
 
41
        $(e).insertBefore($(e).prev());
 
42
        $(targetMenu).insertBefore((targetMenu).prev().not('li[class="menuHeader"]'));
 
43
        
 
44
        $(e).addClass('categoryPulse');
 
45
        $(targetMenu).addClass('categoryPulseMini');
 
46
        
 
47
        drawRows();
 
48
}
 
49
 
 
50
 
 
51
function categoryMoveDown(e)
 
52
{
 
53
        var targetMenu = $('li[data-name="'+e+'"]');
 
54
        e = document.getElementById(e);
 
55
        
 
56
        $(e).insertAfter($(e).next());
 
57
        $(targetMenu).insertAfter((targetMenu).next());
 
58
        
 
59
        $(e).addClass('categoryPulse');
 
60
        $(targetMenu).addClass('categoryPulseMini');
 
61
        
 
62
        drawRows();
 
63
}
 
64