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]/)) {
42 case "ErrorException":
49 case "IteratorAggregate":
53 case "RecursiveArrayIterator":
56 case "SplObjectStorage":
63 return "<br> <em>";
83 if (-1 !== (i
= s
.indexOf("::"))) {
85 if (!is_constant(t
) && !is_variable(t
)) {
87 return "<a href=\"" + s
.replace(/::|\\/g, "/") + "\">";
90 if (-1 !== (j = s.indexOf("\\")) && s.substr(j+1,1) !== "n
") {
91 return "<a href
=\"" + s.replace(/\\/g, "/").replace(/::|$/, "#") + "\">";
94 switch (s.toLowerCase()) {
97 if (!is_variable(s)) {
104 return "<span
class=\"var\">";
108 if (is_constant(s)) {
109 return "<span
class=\"constant
\">";
113 function node(s, nn) {
118 if ((t = type(s, nn))) {
121 return document.createTextNode(s);
123 function wrap(n, nn) {
127 $n.text().split(/([^a-zA-Z0-9_\\\$:]+)/).forEach(function(v) {
132 function walk(i, e) {
135 $.each($.makeArray(e.childNodes), function(i, n) {
136 switch (n.nodeName) {
154 $c.fadeOut("fast
").queue(function(next) {
155 this.style.color = "red
";
157 }).fadeIn("fast
").fadeOut("slow
").queue(function(next) {
158 this.style.color = "";
163 function hashchange() {
164 if (location.hash.length > 1) {
165 var hash = location.hash.substring(1);
166 var name = is_variable(hash) ? ".var" : ".constant
";
167 var scrolled = false;
169 $(name).each(hash.substring(hash.length-1) === "_
" ? function(i, c) {
170 if (c.textContent.substring(0, hash.length) === hash) {
172 $(window).scrollTop($(c).offset().top - 100);
178 if (c.textContent === hash) {
179 $(window).scrollTop($(c).offset().top - 100);
188 $("h1
,h2
,h3
,h4
,h5
,h6
,p
,li
,code
").each(walk);
189 $(window).on("hashchange
", hashchange);