/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/codeviewer.js

  • Committer: Gustav Hatvigsson
  • Date: 2013-05-31 06:15:46 UTC
  • mfrom: (90.1.20 lenasys2)
  • Revision ID: gustav.hartvigsson@gmail.com-20130531061546-vj8z28sq375kvghq
Merged Jonsson:s changes:
Fixed the layout on cms index so the arrows and dots marks expanded objects.
Fixed so the course content is sorted by course occasion and not by name

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
aceeditors = [];
 
2
 
 
3
function highlight(id, word){
 
4
        clearHighlights();
 
5
        for(var x = 0; x < id.length; x++) {
 
6
                var Search = require("ace/search").Search;
 
7
 
 
8
                var editor = ace.edit(id[x]);
 
9
 
 
10
                srch = new Search();
 
11
                srch.set({needle:word});
 
12
                numbers = [];
 
13
                numbers = srch.findAll(editor.getSession());
 
14
 
 
15
 
 
16
                for(var i = 0; i < numbers.length;i++){
 
17
                        editor.getSession().addMarker(numbers[i], "highlighted", "text",false);
 
18
                }
 
19
        }
 
20
 
 
21
}
 
22
 
 
23
function highlightrows(id, from, to){
 
24
        clearHighlights();
 
25
        for(var x = 0; x < id.length; x++) {
 
26
                var Range = require("ace/range").Range;
 
27
 
 
28
                var editor = ace.edit(id[x]);
 
29
 
 
30
                editor.getSession().addMarker(new Range(from, 0, to, Number.POSITIVE_INFINITY), "highlighted", "text",false);
 
31
        }
 
32
}
 
33
 
 
34
function clearHighlights(){
 
35
        for(var i = 0; i < aceeditors.length; i++){
 
36
                var editor = ace.edit(aceeditors[i]);
 
37
                markers = editor.getSession().getMarkers(false);
 
38
 
 
39
                $.each(markers, function(index, value){
 
40
                        if(value.clazz == "highlighted") {
 
41
                                editor.getSession().removeMarker(index);
 
42
                        }
 
43
                });
 
44
        }
 
45
}
 
46
 
 
47
open = false;
 
48
function dropdown(){
 
49
    if(!open){
 
50
        $('#dropdown').show();
 
51
        open = true;
 
52
    } else {
 
53
        $('#dropdown').hide();
 
54
        open = false;
 
55
    }
 
56
}
 
57
 
 
58
$(function () {
 
59
        $('section.group div.heading').bind('click', function (e) {
 
60
                var heading1 = $(this);
 
61
                if (heading1.hasClass('open')) {
 
62
                        heading1.removeClass('open').next().animate({
 
63
                                height: 0
 
64
                        }, 200, function () {
 
65
                                heading1.css({
 
66
                                        height: "auto",
 
67
                                        overflow: "hidden"
 
68
                                });
 
69
                        });
 
70
                        if (heading1.parent().parent().hasClass('content')) {
 
71
                                heading1.parent().parent().css({
 
72
                                        height: "auto",
 
73
                                        overflow: "show"
 
74
                                });
 
75
                        }
 
76
                } else {
 
77
                        var innerHeight = 0;
 
78
                        heading1.next().children().each(function () {
 
79
                                innerHeight += this.offsetHeight;
 
80
                        });
 
81
                        heading1.addClass('open').next().animate({
 
82
                                height: innerHeight
 
83
                        }, 200);
 
84
                        if (heading1.parent().parent().hasClass('content')) {
 
85
                                heading1.parent().parent().css({
 
86
                                        height: "auto",
 
87
                                        overflow: "show"
 
88
                                });
 
89
                        }
 
90
//heading1.parent().siblings().each(function(){
 
91
// $(this).find('div.heading1.open').removeClass('open').next().animate({height:0},200)
 
92
//});
 
93
}
 
94
});
 
95
});
 
 
b'\\ No newline at end of file'