-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpretty.js
48 lines (40 loc) · 1.31 KB
/
pretty.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/
var PrettyExceptions = {
/**
* Initialize the pretty print and highlights lines on files
*/
initialize: function()
{
prettyPrint();
var prettyprint = $(".prettyprint");
for (var i = 0; i < prettyprint.length; i++) {
$($(prettyprint[i]).attr("class").split(" ")).each(
function(k, v) {
if (v.match("^highlight")) {
var lis = $("li", prettyprint[i]);
var position = Math.abs(v.split(":")[2] - v.split(":")[1]);
var li = lis[position];
$(li).addClass("highlight");
for (var j = position - 10; j < lis.length; j++) {
if (j >= 0) {
$(prettyprint[i]).scrollTo(lis[j]);
break;
}
}
}
}
);
}
$('#tabs').tabs();
}
};
$(document).ready(function() {
PrettyExceptions.initialize();
});