bzr branch
http://gegoxaren.bato24.eu/bzr/lenasys/trunk
20.1.1
by galaxyAbstractor
* Added an simple admin panel to the codeviewer-cmssy stuff |
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 |
}
|