2 // console.log.apply(console, arguments);
5 function is_constant(s
) {
6 s
= s
.replace(/v\d+(_\d+)?$/, "");
10 return s
.toUpperCase(s
) === s
;
13 function is_variable(s
) {
14 return s
.substring(0,1) === "$";
17 var is_in_string
= false;
19 function type(s
, nn
) {
23 if (!s
.match(/[a-zA-Z]/)) {
41 case "ErrorException":
48 case "IteratorAggregate":
52 case "RecursiveArrayIterator":
55 case "SplObjectStorage":
62 return "<br> <em>";
82 if (-1 !== (i
= s
.indexOf("::"))) {
84 if (!is_constant(t
) && !is_variable(t
)) {
86 return "<a href=\"/" + s
.replace(/::|\\/g, "/") + "\">";
89 if (-1 !== (j = s.indexOf("\\"))) {
90 return "<a href
=\"/" + s.replace(/\\/g, "/").replace(/::|$/, "#") + "\">";
93 switch (s.toLowerCase()) {
96 if (!is_variable(s)) {
103 return "<span
class=\"var\">";
107 if (is_constant(s)) {
108 return "<span
class=\"constant
\">";
112 function node(s, nn) {
117 if ((t = type(s, nn))) {
120 return document.createTextNode(s);
122 function wrap(n, nn) {
126 $n.text().split(/([^a-zA-Z0-9_\\\$:]+)/).forEach(function(v) {
131 function walk(i, e) {
134 $.each($.makeArray(e.childNodes), function(i, n) {
135 switch (n.nodeName) {
153 $c.fadeOut("fast
").queue(function(next) {
154 this.style.color = "red
";
156 }).fadeIn("fast
").fadeOut("slow
").queue(function(next) {
157 this.style.color = "";
162 function hashchange() {
163 if (location.hash.length > 1) {
164 var hash = location.hash.substring(1);
165 var name = is_variable(hash) ? ".var" : ".constant
";
166 var scrolled = false;
168 $(name).each(hash.substring(hash.length-1) === "_
" ? function(i, c) {
169 if (c.textContent.substring(0, hash.length) === hash) {
171 $(window).scrollTop($(c).offset().top - 100);
177 if (c.textContent === hash) {
178 $(window).scrollTop($(c).offset().top - 100);
187 $("h1
,h2
,h3
,h4
,h5
,h6
,p
,li
,code
").each(walk);
188 $(window).on("hashchange
", hashchange);