Created
January 24, 2014 02:46
-
-
Save 6174/8591231 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!window.__p) { | |
window.originalSetTimeout = setTimeout; | |
window.originalSetInterval = setInterval; | |
eval("var setTimeout, setInterval;"); | |
setTimeout = function() { | |
return Function.prototype.apply.call(window.newSetTimeout, null, arguments); | |
}; | |
setInterval = function() { | |
return Function.prototype.apply.call(window.newSetInterval, null, arguments); | |
}; | |
} | |
(function() { | |
if (window.__p) return; | |
var request = new window.XMLHttpRequest(); | |
request.open('GET', '/instrument.js', false); | |
request.send(); | |
window.eval(request.responseText); | |
window.__p.sessionId = 'a0h8x'; | |
window.__p.limits = { | |
lvl: 1, | |
prop: 3, | |
arr: 3, | |
str: 50 | |
}; | |
})(); | |
try { | |
__p.p('1,405,0,1,PS,[p]:,http://nodejs.org/sh_main.js'); | |
if (__p.i('1,1,4,22,TST,[p]:,http://nodejs.org/sh_main.js'), !this.sh_languages) { | |
{ | |
__p.i('2,2,2,25,S,[p]:,http://nodejs.org/sh_main.js'); | |
this.sh_languages = {}; | |
} | |
} { | |
__p.i('4,4,0,21,S,[p]:,http://nodejs.org/sh_main.js'); | |
var sh_requests = {}; | |
} | |
function sh_isEmailAddress(url) { | |
try { | |
__p.f('5,10,0,1,FS,sh_isEmailAddress,http://nodejs.org/sh_main.js;5,5,27,30,url', arguments); | |
if (__p.i('6,6,6,26,TST,sh_isEmailAddress,http://nodejs.org/sh_main.js'), /^mailto:/.test(url)) { | |
return __p.r('7,7,4,17,R,sh_isEmailAddress,http://nodejs.org/sh_main.js', false); | |
} | |
return __p.r('9,9,2,33,R,sh_isEmailAddress,http://nodejs.org/sh_main.js', url.indexOf('@') !== -1); | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('5,10,0,1,FE,sh_isEmailAddress,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_setHref(tags, numTags, inputString) { | |
try { | |
__p.f('11,20,0,1,FS,sh_setHref,http://nodejs.org/sh_main.js;11,11,20,24,tags;11,11,26,33,numTags;11,11,35,46,inputString', arguments); { | |
__p.i('12,12,2,80,S,sh_setHref,http://nodejs.org/sh_main.js'); | |
var url = inputString.substring(tags[numTags - 2].pos, tags[numTags - 1].pos); | |
} | |
if (__p.i('13,13,6,84,TST,sh_setHref,http://nodejs.org/sh_main.js'), (__p.i('13,13,6,46,LGL,sh_setHref,http://nodejs.org/sh_main.js'), (__p.i('13,13,6,21,LGL,sh_setHref,http://nodejs.org/sh_main.js'), url.length >= 2) && (__p.i('13,13,25,46,LGR,sh_setHref,http://nodejs.org/sh_main.js'), url.charAt(0) === '<')) && (__p.i('13,13,50,84,LGR,sh_setHref,http://nodejs.org/sh_main.js'), url.charAt(url.length - 1) === '>')) { | |
{ | |
__p.i('14,14,4,40,S,sh_setHref,http://nodejs.org/sh_main.js'); | |
url = url.substr(1, url.length - 2); | |
} | |
} | |
if (__p.i('16,16,6,28,TST,sh_setHref,http://nodejs.org/sh_main.js'), sh_isEmailAddress(url)) { | |
{ | |
__p.i('17,17,4,26,S,sh_setHref,http://nodejs.org/sh_main.js'); | |
url = 'mailto:' + url; | |
} | |
} { | |
__p.i('19,19,2,36,S,sh_setHref,http://nodejs.org/sh_main.js'); | |
tags[numTags - 2].node.href = url; | |
} | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('11,20,0,1,FE,sh_setHref,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_konquerorExec(s) { | |
try { | |
__p.f('21,26,0,1,FS,sh_konquerorExec,http://nodejs.org/sh_main.js;21,21,26,27,s', arguments); { | |
__p.i('22,22,2,20,S,sh_konquerorExec,http://nodejs.org/sh_main.js'); | |
var result = ['']; | |
} { | |
__p.i('23,23,2,26,S,sh_konquerorExec,http://nodejs.org/sh_main.js'); | |
result.index = s.length; | |
} { | |
__p.i('24,24,2,19,S,sh_konquerorExec,http://nodejs.org/sh_main.js'); | |
result.input = s; | |
} | |
return __p.r('25,25,2,16,R,sh_konquerorExec,http://nodejs.org/sh_main.js', result); | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('21,26,0,1,FE,sh_konquerorExec,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_highlightString(inputString, language) { | |
try { | |
__p.f('27,182,0,1,FS,sh_highlightString,http://nodejs.org/sh_main.js;27,27,28,39,inputString;27,27,41,49,language', arguments); | |
if (__p.i('28,28,6,43,TST,sh_highlightString,http://nodejs.org/sh_main.js'), /Konqueror/.test(navigator.userAgent)) { | |
if (__p.i('29,29,8,27,TST,sh_highlightString,http://nodejs.org/sh_main.js'), !language.konquered) { | |
for (var s = 0; __p.i('30,30,22,41,TST,sh_highlightString,http://nodejs.org/sh_main.js'), s < language.length; s++) { | |
for (var p = 0; __p.i('31,31,24,46,TST,sh_highlightString,http://nodejs.org/sh_main.js'), p < language[s].length; p++) { | |
{ | |
__p.i('32,32,10,36,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var r = language[s][p][0]; | |
} | |
if (__p.i('33,33,14,30,TST,sh_highlightString,http://nodejs.org/sh_main.js'), r.source === '$') { | |
{ | |
__p.i('34,34,12,38,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
r.exec = sh_konquerorExec; | |
} | |
} | |
} | |
} { | |
__p.i('38,38,6,32,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
language.konquered = true; | |
} | |
} | |
} { | |
__p.i('41,41,2,38,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var a = document.createElement('a'); | |
} { | |
__p.i('42,42,2,44,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var span = document.createElement('span'); | |
} { | |
__p.i('43,43,2,16,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var tags = []; | |
} { | |
__p.i('44,44,2,18,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var numTags = 0; | |
} { | |
__p.i('45,45,2,24,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var patternStack = []; | |
} { | |
__p.i('46,46,2,14,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var pos = 0; | |
} { | |
__p.i('47,47,2,26,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var currentStyle = null; | |
} { | |
__p.i('48,85,2,4,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var output = function(s, style) { | |
try { | |
__p.f('48,85,15,3,FS,output,http://nodejs.org/sh_main.js;48,48,25,26,s;48,48,28,33,style', arguments); { | |
__p.i('49,49,4,26,S,output,http://nodejs.org/sh_main.js'); | |
var length = s.length; | |
} | |
if (__p.i('50,50,8,20,TST,output,http://nodejs.org/sh_main.js'), length === 0) { | |
return __p.r('51,51,6,13,R,output,http://nodejs.org/sh_main.js'); | |
} | |
if (__p.i('53,53,8,14,TST,output,http://nodejs.org/sh_main.js'), !style) { | |
{ | |
__p.i('54,54,6,44,S,output,http://nodejs.org/sh_main.js'); | |
var stackLength = patternStack.length; | |
} | |
if (__p.i('55,55,10,27,TST,output,http://nodejs.org/sh_main.js'), stackLength !== 0) { | |
{ | |
__p.i('56,56,8,52,S,output,http://nodejs.org/sh_main.js'); | |
var pattern = patternStack[stackLength - 1]; | |
} | |
if (__p.i('57,57,12,23,TST,output,http://nodejs.org/sh_main.js'), !pattern[3]) { | |
{ | |
__p.i('58,58,10,29,S,output,http://nodejs.org/sh_main.js'); | |
style = pattern[1]; | |
} | |
} | |
} | |
} | |
if (__p.i('62,62,8,30,TST,output,http://nodejs.org/sh_main.js'), currentStyle !== style) { | |
if (__p.i('63,63,10,22,TST,output,http://nodejs.org/sh_main.js'), currentStyle) { | |
{ | |
__p.i('64,64,8,39,S,output,http://nodejs.org/sh_main.js'); | |
tags[numTags++] = { | |
pos: pos | |
}; | |
} | |
if (__p.i('65,65,12,37,TST,output,http://nodejs.org/sh_main.js'), currentStyle === 'sh_url') { | |
{ | |
__p.i('66,66,10,49,S,output,http://nodejs.org/sh_main.js'); | |
sh_setHref(tags, numTags, inputString); | |
} | |
} | |
} | |
if (__p.i('69,69,10,15,TST,output,http://nodejs.org/sh_main.js'), style) { | |
{ | |
__p.i('70,70,8,18,S,output,http://nodejs.org/sh_main.js'); | |
var clone; | |
} | |
if (__p.i('71,71,12,30,TST,output,http://nodejs.org/sh_main.js'), style === 'sh_url') { | |
{ | |
__p.i('72,72,10,37,S,output,http://nodejs.org/sh_main.js'); | |
clone = a.cloneNode(false); | |
} | |
} else { | |
{ | |
__p.i('74,74,10,40,S,output,http://nodejs.org/sh_main.js'); | |
clone = span.cloneNode(false); | |
} | |
} { | |
__p.i('76,76,8,32,S,output,http://nodejs.org/sh_main.js'); | |
clone.className = style; | |
} { | |
__p.i('77,80,8,10,S,output,http://nodejs.org/sh_main.js'); | |
tags[numTags++] = { | |
node: clone, | |
pos: pos | |
}; | |
} | |
} | |
} { | |
__p.i('83,83,4,18,S,output,http://nodejs.org/sh_main.js'); | |
pos += length; | |
} { | |
__p.i('84,84,4,25,S,output,http://nodejs.org/sh_main.js'); | |
currentStyle = style; | |
} | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('48,85,15,3,FE,output,http://nodejs.org/sh_main.js'); | |
} | |
}; | |
} { | |
__p.i('86,86,2,39,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var endOfLinePattern = /\r\n|\r|\n/g; | |
} { | |
__p.i('87,87,2,33,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
endOfLinePattern.lastIndex = 0; | |
} { | |
__p.i('88,88,2,45,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var inputStringLength = inputString.length; | |
} | |
while (__p.i('89,89,9,32,TST,sh_highlightString,http://nodejs.org/sh_main.js'), pos < inputStringLength) { | |
{ | |
__p.i('90,90,4,20,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var start = pos; | |
} { | |
__p.i('91,91,4,12,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var end; | |
} { | |
__p.i('92,92,4,24,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var startOfNextLine; | |
} { | |
__p.i('93,93,4,60,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var endOfLineMatch = endOfLinePattern.exec(inputString); | |
} | |
if (__p.i('94,94,8,31,TST,sh_highlightString,http://nodejs.org/sh_main.js'), endOfLineMatch === null) { | |
{ | |
__p.i('95,95,6,30,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
end = inputStringLength; | |
} { | |
__p.i('96,96,6,42,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
startOfNextLine = inputStringLength; | |
} | |
} else { | |
{ | |
__p.i('98,98,6,33,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
end = endOfLineMatch.index; | |
} { | |
__p.i('99,99,6,51,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
startOfNextLine = endOfLinePattern.lastIndex; | |
} | |
} { | |
__p.i('101,101,4,49,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var line = inputString.substring(start, end); | |
} { | |
__p.i('102,102,4,24,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var matchCache = []; | |
} | |
for (;;) { | |
{ | |
__p.i('104,104,6,38,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var posWithinLine = pos - start; | |
} { | |
__p.i('105,105,6,21,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var stateIndex; | |
} { | |
__p.i('106,106,6,44,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var stackLength = patternStack.length; | |
} | |
if (__p.i('107,107,10,27,TST,sh_highlightString,http://nodejs.org/sh_main.js'), stackLength === 0) { | |
{ | |
__p.i('108,108,8,23,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
stateIndex = 0; | |
} | |
} else { | |
{ | |
__p.i('110,110,8,54,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
stateIndex = patternStack[stackLength - 1][2]; | |
} | |
} { | |
__p.i('112,112,6,39,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var state = language[stateIndex]; | |
} { | |
__p.i('113,113,6,37,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var numPatterns = state.length; | |
} { | |
__p.i('114,114,6,38,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var mc = matchCache[stateIndex]; | |
} | |
if (__p.i('115,115,10,13,TST,sh_highlightString,http://nodejs.org/sh_main.js'), !mc) { | |
{ | |
__p.i('116,116,8,41,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
mc = matchCache[stateIndex] = []; | |
} | |
} { | |
__p.i('118,118,6,27,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var bestMatch = null; | |
} { | |
__p.i('119,119,6,32,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var bestPatternIndex = -1; | |
} | |
for (var i = 0; __p.i('120,120,22,37,TST,sh_highlightString,http://nodejs.org/sh_main.js'), i < numPatterns; i++) { | |
{ | |
__p.i('121,121,8,18,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var match; | |
} | |
if (__p.i('122,122,12,77,TST,sh_highlightString,http://nodejs.org/sh_main.js'), (__p.i('122,122,12,25,LGL,sh_highlightString,http://nodejs.org/sh_main.js'), i < mc.length) && (__p.i('122,122,30,76,LGR,sh_highlightString,http://nodejs.org/sh_main.js'), (__p.i('122,122,30,44,LGL,sh_highlightString,http://nodejs.org/sh_main.js'), mc[i] === null) || (__p.i('122,122,48,76,LGR,sh_highlightString,http://nodejs.org/sh_main.js'), posWithinLine <= mc[i].index))) { | |
{ | |
__p.i('123,123,10,24,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
match = mc[i]; | |
} | |
} else { | |
{ | |
__p.i('125,125,10,34,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var regex = state[i][0]; | |
} { | |
__p.i('126,126,10,42,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
regex.lastIndex = posWithinLine; | |
} { | |
__p.i('127,127,10,35,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
match = regex.exec(line); | |
} { | |
__p.i('128,128,10,24,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
mc[i] = match; | |
} | |
} | |
if (__p.i('130,130,12,83,TST,sh_highlightString,http://nodejs.org/sh_main.js'), (__p.i('130,130,12,26,LGL,sh_highlightString,http://nodejs.org/sh_main.js'), match !== null) && (__p.i('130,130,31,82,LGR,sh_highlightString,http://nodejs.org/sh_main.js'), (__p.i('130,130,31,49,LGL,sh_highlightString,http://nodejs.org/sh_main.js'), bestMatch === null) || (__p.i('130,130,53,82,LGR,sh_highlightString,http://nodejs.org/sh_main.js'), match.index < bestMatch.index))) { | |
{ | |
__p.i('131,131,10,28,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
bestMatch = match; | |
} { | |
__p.i('132,132,10,31,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
bestPatternIndex = i; | |
} | |
if (__p.i('133,133,14,43,TST,sh_highlightString,http://nodejs.org/sh_main.js'), match.index === posWithinLine) { | |
{ | |
__p.i('134,134,12,18,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
break; | |
} | |
} | |
} | |
} | |
if (__p.i('138,138,10,28,TST,sh_highlightString,http://nodejs.org/sh_main.js'), bestMatch === null) { | |
{ | |
__p.i('139,139,8,52,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
output(line.substring(posWithinLine), null); | |
} { | |
__p.i('140,140,8,14,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
break; | |
} | |
} else { | |
if (__p.i('142,142,12,43,TST,sh_highlightString,http://nodejs.org/sh_main.js'), bestMatch.index > posWithinLine) { | |
{ | |
__p.i('143,143,10,71,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
output(line.substring(posWithinLine, bestMatch.index), null); | |
} | |
} { | |
__p.i('145,145,8,46,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var pattern = state[bestPatternIndex]; | |
} { | |
__p.i('146,146,8,34,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var newStyle = pattern[1]; | |
} { | |
__p.i('147,147,8,26,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
var matchedString; | |
} | |
if (__p.i('148,148,12,37,TST,sh_highlightString,http://nodejs.org/sh_main.js'), newStyle instanceof Array) { | |
for (var subexpression = 0; __p.i('149,149,38,69,TST,sh_highlightString,http://nodejs.org/sh_main.js'), subexpression < newStyle.length; subexpression++) { | |
{ | |
__p.i('150,150,12,57,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
matchedString = bestMatch[subexpression + 1]; | |
} { | |
__p.i('151,151,12,59,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
output(matchedString, newStyle[subexpression]); | |
} | |
} | |
} else { | |
{ | |
__p.i('154,154,10,39,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
matchedString = bestMatch[0]; | |
} { | |
__p.i('155,155,10,42,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
output(matchedString, newStyle); | |
} | |
} | |
switch (__p.i('157,157,16,26,SWT,sh_highlightString,http://nodejs.org/sh_main.js'), pattern[2]) { | |
case -1: | |
{ | |
{ | |
__p.i('159,159,10,16,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
break; | |
} | |
} | |
case -2: | |
{ | |
{ | |
__p.i('161,161,10,29,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
patternStack.pop(); | |
} { | |
__p.i('162,162,10,16,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
break; | |
} | |
} | |
case -3: | |
{ | |
{ | |
__p.i('164,164,10,34,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
patternStack.length = 0; | |
} { | |
__p.i('165,165,10,16,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
break; | |
} | |
} | |
default: | |
{ | |
{ | |
__p.i('167,167,10,37,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
patternStack.push(pattern); | |
} { | |
__p.i('168,168,10,16,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
break; | |
} | |
} | |
} | |
} | |
} | |
if (__p.i('172,172,8,20,TST,sh_highlightString,http://nodejs.org/sh_main.js'), currentStyle) { | |
{ | |
__p.i('173,173,6,37,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
tags[numTags++] = { | |
pos: pos | |
}; | |
} | |
if (__p.i('174,174,10,35,TST,sh_highlightString,http://nodejs.org/sh_main.js'), currentStyle === 'sh_url') { | |
{ | |
__p.i('175,175,8,47,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
sh_setHref(tags, numTags, inputString); | |
} | |
} { | |
__p.i('177,177,6,26,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
currentStyle = null; | |
} | |
} { | |
__p.i('179,179,4,26,S,sh_highlightString,http://nodejs.org/sh_main.js'); | |
pos = startOfNextLine; | |
} | |
} | |
return __p.r('181,181,2,14,R,sh_highlightString,http://nodejs.org/sh_main.js', tags); | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('27,182,0,1,FE,sh_highlightString,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_getClasses(element) { | |
try { | |
__p.f('183,195,0,1,FS,sh_getClasses,http://nodejs.org/sh_main.js;183,183,23,30,element', arguments); { | |
__p.i('184,184,2,18,S,sh_getClasses,http://nodejs.org/sh_main.js'); | |
var result = []; | |
} { | |
__p.i('185,185,2,36,S,sh_getClasses,http://nodejs.org/sh_main.js'); | |
var htmlClass = element.className; | |
} | |
if (__p.i('186,186,6,39,TST,sh_getClasses,http://nodejs.org/sh_main.js'), (__p.i('186,186,6,15,LGL,sh_getClasses,http://nodejs.org/sh_main.js'), htmlClass) && (__p.i('186,186,19,39,LGR,sh_getClasses,http://nodejs.org/sh_main.js'), htmlClass.length > 0)) { | |
{ | |
__p.i('187,187,4,43,S,sh_getClasses,http://nodejs.org/sh_main.js'); | |
var htmlClasses = htmlClass.split(' '); | |
} | |
for (var i = 0; __p.i('188,188,20,42,TST,sh_getClasses,http://nodejs.org/sh_main.js'), i < htmlClasses.length; i++) { | |
if (__p.i('189,189,10,35,TST,sh_getClasses,http://nodejs.org/sh_main.js'), htmlClasses[i].length > 0) { | |
{ | |
__p.i('190,190,8,36,S,sh_getClasses,http://nodejs.org/sh_main.js'); | |
result.push(htmlClasses[i]); | |
} | |
} | |
} | |
} | |
return __p.r('194,194,2,16,R,sh_getClasses,http://nodejs.org/sh_main.js', result); | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('183,195,0,1,FE,sh_getClasses,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_addClass(element, name) { | |
try { | |
__p.f('196,205,0,1,FS,sh_addClass,http://nodejs.org/sh_main.js;196,196,21,28,element;196,196,30,34,name', arguments); { | |
__p.i('197,197,2,43,S,sh_addClass,http://nodejs.org/sh_main.js'); | |
var htmlClasses = sh_getClasses(element); | |
} | |
for (var i = 0; __p.i('198,198,18,40,TST,sh_addClass,http://nodejs.org/sh_main.js'), i < htmlClasses.length; i++) { | |
if (__p.i('199,199,8,59,TST,sh_addClass,http://nodejs.org/sh_main.js'), name.toLowerCase() === htmlClasses[i].toLowerCase()) { | |
return __p.r('200,200,6,13,R,sh_addClass,http://nodejs.org/sh_main.js'); | |
} | |
} { | |
__p.i('203,203,2,25,S,sh_addClass,http://nodejs.org/sh_main.js'); | |
htmlClasses.push(name); | |
} { | |
__p.i('204,204,2,44,S,sh_addClass,http://nodejs.org/sh_main.js'); | |
element.className = htmlClasses.join(' '); | |
} | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('196,205,0,1,FE,sh_addClass,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_extractTagsFromNodeList(nodeList, result) { | |
try { | |
__p.f('206,237,0,1,FS,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js;206,206,36,44,nodeList;206,206,46,52,result', arguments); { | |
__p.i('207,207,2,31,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
var length = nodeList.length; | |
} | |
for (var i = 0; __p.i('208,208,18,28,TST,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'), i < length; i++) { | |
{ | |
__p.i('209,209,4,32,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
var node = nodeList.item(i); | |
} | |
switch (__p.i('210,210,12,25,SWT,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'), node.nodeType) { | |
case 1: | |
{ | |
if (__p.i('212,212,10,46,TST,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'), node.nodeName.toLowerCase() === 'br') { | |
{ | |
__p.i('213,213,8,23,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
var terminator; | |
} | |
if (__p.i('214,214,12,44,TST,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'), /MSIE/.test(navigator.userAgent)) { | |
{ | |
__p.i('215,215,10,28,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
terminator = '\r'; | |
} | |
} else { | |
{ | |
__p.i('217,217,10,28,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
terminator = '\n'; | |
} | |
} { | |
__p.i('219,219,8,37,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
result.text.push(terminator); | |
} { | |
__p.i('220,220,8,21,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
result.pos++; | |
} | |
} else { | |
{ | |
__p.i('222,225,8,11,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
result.tags.push({ | |
node: node.cloneNode(false), | |
pos: result.pos | |
}); | |
} { | |
__p.i('226,226,8,60,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
sh_extractTagsFromNodeList(node.childNodes, result); | |
} { | |
__p.i('227,227,8,46,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
result.tags.push({ | |
pos: result.pos | |
}); | |
} | |
} { | |
__p.i('229,229,6,12,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
break; | |
} | |
} | |
case 3: | |
case 4: | |
{ | |
{ | |
__p.i('232,232,6,34,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
result.text.push(node.data); | |
} { | |
__p.i('233,233,6,32,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
result.pos += node.length; | |
} { | |
__p.i('234,234,6,12,S,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
break; | |
} | |
} | |
} | |
} | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('206,237,0,1,FE,sh_extractTagsFromNodeList,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_extractTags(element, tags) { | |
try { | |
__p.f('238,245,0,1,FS,sh_extractTags,http://nodejs.org/sh_main.js;238,238,24,31,element;238,238,33,37,tags', arguments); { | |
__p.i('239,239,2,18,S,sh_extractTags,http://nodejs.org/sh_main.js'); | |
var result = {}; | |
} { | |
__p.i('240,240,2,19,S,sh_extractTags,http://nodejs.org/sh_main.js'); | |
result.text = []; | |
} { | |
__p.i('241,241,2,21,S,sh_extractTags,http://nodejs.org/sh_main.js'); | |
result.tags = tags; | |
} { | |
__p.i('242,242,2,17,S,sh_extractTags,http://nodejs.org/sh_main.js'); | |
result.pos = 0; | |
} { | |
__p.i('243,243,2,57,S,sh_extractTags,http://nodejs.org/sh_main.js'); | |
sh_extractTagsFromNodeList(element.childNodes, result); | |
} | |
return __p.r('244,244,2,30,R,sh_extractTags,http://nodejs.org/sh_main.js', result.text.join('')); | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('238,245,0,1,FE,sh_extractTags,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_mergeTags(originalTags, highlightTags) { | |
try { | |
__p.f('246,288,0,1,FS,sh_mergeTags,http://nodejs.org/sh_main.js;246,246,22,34,originalTags;246,246,36,49,highlightTags', arguments); { | |
__p.i('247,247,2,44,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
var numOriginalTags = originalTags.length; | |
} | |
if (__p.i('248,248,6,27,TST,sh_mergeTags,http://nodejs.org/sh_main.js'), numOriginalTags === 0) { | |
return __p.r('249,249,4,25,R,sh_mergeTags,http://nodejs.org/sh_main.js', highlightTags); | |
} { | |
__p.i('251,251,2,46,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
var numHighlightTags = highlightTags.length; | |
} | |
if (__p.i('252,252,6,28,TST,sh_mergeTags,http://nodejs.org/sh_main.js'), numHighlightTags === 0) { | |
return __p.r('253,253,4,24,R,sh_mergeTags,http://nodejs.org/sh_main.js', originalTags); | |
} { | |
__p.i('255,255,2,18,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
var result = []; | |
} { | |
__p.i('256,256,2,24,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
var originalIndex = 0; | |
} { | |
__p.i('257,257,2,25,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
var highlightIndex = 0; | |
} | |
while (__p.i('258,258,9,77,TST,sh_mergeTags,http://nodejs.org/sh_main.js'), (__p.i('258,258,9,40,LGL,sh_mergeTags,http://nodejs.org/sh_main.js'), originalIndex < numOriginalTags) && (__p.i('258,258,44,77,LGR,sh_mergeTags,http://nodejs.org/sh_main.js'), highlightIndex < numHighlightTags)) { | |
{ | |
__p.i('259,259,4,50,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
var originalTag = originalTags[originalIndex]; | |
} { | |
__p.i('260,260,4,53,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
var highlightTag = highlightTags[highlightIndex]; | |
} | |
if (__p.i('261,261,8,43,TST,sh_mergeTags,http://nodejs.org/sh_main.js'), originalTag.pos <= highlightTag.pos) { | |
{ | |
__p.i('262,262,6,31,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
result.push(originalTag); | |
} { | |
__p.i('263,263,6,22,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
originalIndex++; | |
} | |
} else { | |
{ | |
__p.i('265,265,6,32,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
result.push(highlightTag); | |
} | |
if (__p.i('266,266,10,66,TST,sh_mergeTags,http://nodejs.org/sh_main.js'), highlightTags[highlightIndex + 1].pos <= originalTag.pos) { | |
{ | |
__p.i('267,267,8,25,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
highlightIndex++; | |
} { | |
__p.i('268,268,8,51,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
result.push(highlightTags[highlightIndex]); | |
} { | |
__p.i('269,269,8,25,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
highlightIndex++; | |
} | |
} else { | |
{ | |
__p.i('271,271,8,46,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
result.push({ | |
pos: originalTag.pos | |
}); | |
} { | |
__p.i('272,275,8,10,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
highlightTags[highlightIndex] = { | |
node: highlightTag.node.cloneNode(false), | |
pos: originalTag.pos | |
}; | |
} | |
} | |
} | |
} | |
while (__p.i('279,279,9,40,TST,sh_mergeTags,http://nodejs.org/sh_main.js'), originalIndex < numOriginalTags) { | |
{ | |
__p.i('280,280,4,45,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
result.push(originalTags[originalIndex]); | |
} { | |
__p.i('281,281,4,20,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
originalIndex++; | |
} | |
} | |
while (__p.i('283,283,9,42,TST,sh_mergeTags,http://nodejs.org/sh_main.js'), highlightIndex < numHighlightTags) { | |
{ | |
__p.i('284,284,4,47,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
result.push(highlightTags[highlightIndex]); | |
} { | |
__p.i('285,285,4,21,S,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
highlightIndex++; | |
} | |
} | |
return __p.r('287,287,2,16,R,sh_mergeTags,http://nodejs.org/sh_main.js', result); | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('246,288,0,1,FE,sh_mergeTags,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_insertTags(tags, text) { | |
try { | |
__p.f('289,321,0,1,FS,sh_insertTags,http://nodejs.org/sh_main.js;289,289,23,27,tags;289,289,29,33,text', arguments); { | |
__p.i('290,290,2,21,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
var doc = document; | |
} { | |
__p.i('291,291,2,49,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
var result = document.createDocumentFragment(); | |
} { | |
__p.i('292,292,2,19,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
var tagIndex = 0; | |
} { | |
__p.i('293,293,2,28,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
var numTags = tags.length; | |
} { | |
__p.i('294,294,2,18,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
var textPos = 0; | |
} { | |
__p.i('295,295,2,31,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
var textLength = text.length; | |
} { | |
__p.i('296,296,2,27,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
var currentNode = result; | |
} | |
while (__p.i('297,297,9,51,TST,sh_insertTags,http://nodejs.org/sh_main.js'), (__p.i('297,297,9,29,LGL,sh_insertTags,http://nodejs.org/sh_main.js'), textPos < textLength) || (__p.i('297,297,33,51,LGR,sh_insertTags,http://nodejs.org/sh_main.js'), tagIndex < numTags)) { | |
{ | |
__p.i('298,298,4,12,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
var tag; | |
} { | |
__p.i('299,299,4,15,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
var tagPos; | |
} | |
if (__p.i('300,300,8,26,TST,sh_insertTags,http://nodejs.org/sh_main.js'), tagIndex < numTags) { | |
{ | |
__p.i('301,301,6,27,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
tag = tags[tagIndex]; | |
} { | |
__p.i('302,302,6,23,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
tagPos = tag.pos; | |
} | |
} else { | |
{ | |
__p.i('304,304,6,26,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
tagPos = textLength; | |
} | |
} | |
if (__p.i('306,306,8,25,TST,sh_insertTags,http://nodejs.org/sh_main.js'), tagPos <= textPos) { | |
if (__p.i('307,307,10,18,TST,sh_insertTags,http://nodejs.org/sh_main.js'), tag.node) { | |
{ | |
__p.i('308,308,8,31,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
var newNode = tag.node; | |
} { | |
__p.i('309,309,8,41,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
currentNode.appendChild(newNode); | |
} { | |
__p.i('310,310,8,30,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
currentNode = newNode; | |
} | |
} else { | |
{ | |
__p.i('312,312,8,45,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
currentNode = currentNode.parentNode; | |
} | |
} { | |
__p.i('314,314,6,17,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
tagIndex++; | |
} | |
} else { | |
{ | |
__p.i('316,316,6,83,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
currentNode.appendChild(doc.createTextNode(text.substring(textPos, tagPos))); | |
} { | |
__p.i('317,317,6,23,S,sh_insertTags,http://nodejs.org/sh_main.js'); | |
textPos = tagPos; | |
} | |
} | |
} | |
return __p.r('320,320,2,16,R,sh_insertTags,http://nodejs.org/sh_main.js', result); | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('289,321,0,1,FE,sh_insertTags,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_highlightElement(element, language) { | |
try { | |
__p.f('322,333,0,1,FS,sh_highlightElement,http://nodejs.org/sh_main.js;322,322,29,36,element;322,322,38,46,language', arguments); { | |
__p.i('323,323,2,40,S,sh_highlightElement,http://nodejs.org/sh_main.js'); | |
sh_addClass(element, 'sh_sourceCode'); | |
} { | |
__p.i('324,324,2,24,S,sh_highlightElement,http://nodejs.org/sh_main.js'); | |
var originalTags = []; | |
} { | |
__p.i('325,325,2,58,S,sh_highlightElement,http://nodejs.org/sh_main.js'); | |
var inputString = sh_extractTags(element, originalTags); | |
} { | |
__p.i('326,326,2,64,S,sh_highlightElement,http://nodejs.org/sh_main.js'); | |
var highlightTags = sh_highlightString(inputString, language); | |
} { | |
__p.i('327,327,2,55,S,sh_highlightElement,http://nodejs.org/sh_main.js'); | |
var tags = sh_mergeTags(originalTags, highlightTags); | |
} { | |
__p.i('328,328,2,58,S,sh_highlightElement,http://nodejs.org/sh_main.js'); | |
var documentFragment = sh_insertTags(tags, inputString); | |
} | |
while (__p.i('329,329,9,32,TST,sh_highlightElement,http://nodejs.org/sh_main.js'), element.hasChildNodes()) { | |
{ | |
__p.i('330,330,4,44,S,sh_highlightElement,http://nodejs.org/sh_main.js'); | |
element.removeChild(element.firstChild); | |
} | |
} { | |
__p.i('332,332,2,40,S,sh_highlightElement,http://nodejs.org/sh_main.js'); | |
element.appendChild(documentFragment); | |
} | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('322,333,0,1,FE,sh_highlightElement,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_getXMLHttpRequest() { | |
try { | |
__p.f('334,341,0,1,FS,sh_getXMLHttpRequest,http://nodejs.org/sh_main.js', arguments); | |
if (__p.i('335,335,6,26,TST,sh_getXMLHttpRequest,http://nodejs.org/sh_main.js'), window.ActiveXObject) { | |
return __p.r('336,336,4,47,R,sh_getXMLHttpRequest,http://nodejs.org/sh_main.js', new ActiveXObject('Msxml2.XMLHTTP')); | |
} else if (__p.i('337,337,13,34,TST,sh_getXMLHttpRequest,http://nodejs.org/sh_main.js'), window.XMLHttpRequest) { | |
return __p.r('338,338,4,32,R,sh_getXMLHttpRequest,http://nodejs.org/sh_main.js', new XMLHttpRequest()); | |
} { | |
__p.i('340,340,2,53,S,sh_getXMLHttpRequest,http://nodejs.org/sh_main.js'); | |
throw 'No XMLHttpRequest implementation available'; | |
} | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('334,341,0,1,FE,sh_getXMLHttpRequest,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_load(language, element, prefix, suffix) { | |
try { | |
__p.f('342,369,0,1,FS,sh_load,http://nodejs.org/sh_main.js;342,342,17,25,language;342,342,27,34,element;342,342,36,42,prefix;342,342,44,50,suffix', arguments); | |
if (__p.i('343,343,6,29,TST,sh_load,http://nodejs.org/sh_main.js'), language in sh_requests) { | |
{ | |
__p.i('344,344,4,40,S,sh_load,http://nodejs.org/sh_main.js'); | |
sh_requests[language].push(element); | |
} | |
return __p.r('345,345,4,11,R,sh_load,http://nodejs.org/sh_main.js'); | |
} { | |
__p.i('347,347,2,36,S,sh_load,http://nodejs.org/sh_main.js'); | |
sh_requests[language] = [element]; | |
} { | |
__p.i('348,348,2,39,S,sh_load,http://nodejs.org/sh_main.js'); | |
var request = sh_getXMLHttpRequest(); | |
} { | |
__p.i('349,349,2,47,S,sh_load,http://nodejs.org/sh_main.js'); | |
var url = prefix + 'sh_' + language + suffix; | |
} { | |
__p.i('350,350,2,33,S,sh_load,http://nodejs.org/sh_main.js'); | |
request.open('GET', url, true); | |
} { | |
__p.i('351,367,2,4,S,sh_load,http://nodejs.org/sh_main.js'); | |
request.onreadystatechange = function() { | |
try { | |
__p.f('351,367,31,3,FS,request.onreadystatechange,http://nodejs.org/sh_main.js', arguments); | |
if (__p.i('352,352,8,32,TST,request.onreadystatechange,http://nodejs.org/sh_main.js'), request.readyState === 4) { | |
try { | |
if (__p.i('354,354,12,53,TST,request.onreadystatechange,http://nodejs.org/sh_main.js'), (__p.i('354,354,12,27,LGL,request.onreadystatechange,http://nodejs.org/sh_main.js'), !request.status) || (__p.i('354,354,31,53,LGR,request.onreadystatechange,http://nodejs.org/sh_main.js'), request.status === 200)) { | |
{ | |
__p.i('355,355,10,37,S,request.onreadystatechange,http://nodejs.org/sh_main.js'); | |
eval(request.responseText); | |
} { | |
__p.i('356,356,10,47,S,request.onreadystatechange,http://nodejs.org/sh_main.js'); | |
var elements = sh_requests[language]; | |
} | |
for (var i = 0; __p.i('357,357,26,45,TST,request.onreadystatechange,http://nodejs.org/sh_main.js'), i < elements.length; i++) { | |
{ | |
__p.i('358,358,12,69,S,request.onreadystatechange,http://nodejs.org/sh_main.js'); | |
sh_highlightElement(elements[i], sh_languages[language]); | |
} | |
} | |
} else { | |
{ | |
__p.i('361,361,10,55,S,request.onreadystatechange,http://nodejs.org/sh_main.js'); | |
throw 'HTTP error: status ' + request.status; | |
} | |
} | |
} finally { | |
{ | |
__p.i('364,364,8,23,S,request.onreadystatechange,http://nodejs.org/sh_main.js'); | |
request = null; | |
} | |
} | |
} | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('351,367,31,3,FE,request.onreadystatechange,http://nodejs.org/sh_main.js'); | |
} | |
}; | |
} { | |
__p.i('368,368,2,21,S,sh_load,http://nodejs.org/sh_main.js'); | |
request.send(null); | |
} | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('342,369,0,1,FE,sh_load,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function highlight(prefix, suffix, tag) { | |
try { | |
__p.f('370,400,0,1,FS,highlight,http://nodejs.org/sh_main.js;370,370,19,25,prefix;370,370,27,33,suffix;370,370,35,38,tag', arguments); { | |
__p.i('371,371,2,52,S,highlight,http://nodejs.org/sh_main.js'); | |
var nodeList = document.getElementsByTagName(tag); | |
} | |
for (var i = 0; __p.i('372,372,18,37,TST,highlight,http://nodejs.org/sh_main.js'), i < nodeList.length; i++) { | |
{ | |
__p.i('373,373,4,35,S,highlight,http://nodejs.org/sh_main.js'); | |
var element = nodeList.item(i); | |
} { | |
__p.i('374,374,4,45,S,highlight,http://nodejs.org/sh_main.js'); | |
var htmlClasses = sh_getClasses(element); | |
} { | |
__p.i('375,375,4,28,S,highlight,http://nodejs.org/sh_main.js'); | |
var highlighted = false; | |
} { | |
__p.i('376,376,4,30,S,highlight,http://nodejs.org/sh_main.js'); | |
var donthighlight = false; | |
} | |
for (var j = 0; __p.i('377,377,20,42,TST,highlight,http://nodejs.org/sh_main.js'), j < htmlClasses.length; j++) { | |
{ | |
__p.i('378,378,6,51,S,highlight,http://nodejs.org/sh_main.js'); | |
var htmlClass = htmlClasses[j].toLowerCase(); | |
} | |
if (__p.i('379,379,10,33,TST,highlight,http://nodejs.org/sh_main.js'), htmlClass === 'sh_none') { | |
{ | |
__p.i('380,380,8,29,S,highlight,http://nodejs.org/sh_main.js'); | |
donthighlight = true; | |
} { | |
__p.i('381,381,8,17,S,highlight,http://nodejs.org/sh_main.js'); | |
continue; | |
} | |
} | |
if (__p.i('383,383,10,42,TST,highlight,http://nodejs.org/sh_main.js'), htmlClass.substr(0, 3) === 'sh_') { | |
{ | |
__p.i('384,384,8,46,S,highlight,http://nodejs.org/sh_main.js'); | |
var language = htmlClass.substring(3); | |
} | |
if (__p.i('385,385,12,36,TST,highlight,http://nodejs.org/sh_main.js'), language in sh_languages) { | |
{ | |
__p.i('386,386,10,63,S,highlight,http://nodejs.org/sh_main.js'); | |
sh_highlightElement(element, sh_languages[language]); | |
} { | |
__p.i('387,387,10,29,S,highlight,http://nodejs.org/sh_main.js'); | |
highlighted = true; | |
} | |
} else if (__p.i('388,388,19,75,TST,highlight,http://nodejs.org/sh_main.js'), (__p.i('388,388,19,45,LGL,highlight,http://nodejs.org/sh_main.js'), typeof prefix === 'string') && (__p.i('388,388,49,75,LGR,highlight,http://nodejs.org/sh_main.js'), typeof suffix === 'string')) { | |
{ | |
__p.i('389,389,10,53,S,highlight,http://nodejs.org/sh_main.js'); | |
sh_load(language, element, prefix, suffix); | |
} | |
} else { | |
{ | |
__p.i('391,391,10,106,S,highlight,http://nodejs.org/sh_main.js'); | |
throw 'Found <' + tag + '> element with class="' + htmlClass + '", but no such language exists'; | |
} | |
} { | |
__p.i('393,393,8,14,S,highlight,http://nodejs.org/sh_main.js'); | |
break; | |
} | |
} | |
} | |
if (__p.i('396,396,8,55,TST,highlight,http://nodejs.org/sh_main.js'), (__p.i('396,396,8,29,LGL,highlight,http://nodejs.org/sh_main.js'), highlighted === false) && (__p.i('396,396,33,55,LGR,highlight,http://nodejs.org/sh_main.js'), donthighlight == false)) { | |
{ | |
__p.i('397,397,6,63,S,highlight,http://nodejs.org/sh_main.js'); | |
sh_highlightElement(element, sh_languages['javascript']); | |
} | |
} | |
} | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('370,400,0,1,FE,highlight,http://nodejs.org/sh_main.js'); | |
} | |
} | |
function sh_highlightDocument(prefix, suffix) { | |
try { | |
__p.f('401,405,0,1,FS,sh_highlightDocument,http://nodejs.org/sh_main.js;401,401,30,36,prefix;401,401,38,44,suffix', arguments); { | |
__p.i('402,402,2,34,S,sh_highlightDocument,http://nodejs.org/sh_main.js'); | |
highlight(prefix, suffix, 'tt'); | |
} { | |
__p.i('403,403,2,36,S,sh_highlightDocument,http://nodejs.org/sh_main.js'); | |
highlight(prefix, suffix, 'code'); | |
} { | |
__p.i('404,404,2,35,S,sh_highlightDocument,http://nodejs.org/sh_main.js'); | |
highlight(prefix, suffix, 'pre'); | |
} | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.fe('401,405,0,1,FE,sh_highlightDocument,http://nodejs.org/sh_main.js'); | |
} | |
} | |
} catch (__ex) { | |
__p.e(__ex); | |
throw __ex; | |
} finally { | |
__p.pe('1,405,0,1,PE,[p]:,http://nodejs.org/sh_main.js'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
SHJS - Syntax Highlighting in JavaScript | |
Copyright (C) 2007, 2008 [email protected] | |
License: http://shjs.sourceforge.net/doc/gplv3.html | |
*/ | |
if (! this.sh_languages) { | |
this.sh_languages = {}; | |
} | |
var sh_requests = {}; | |
function sh_isEmailAddress(url) { | |
if (/^mailto:/.test(url)) { | |
return false; | |
} | |
return url.indexOf('@') !== -1; | |
} | |
function sh_setHref(tags, numTags, inputString) { | |
var url = inputString.substring(tags[numTags - 2].pos, tags[numTags - 1].pos); | |
if (url.length >= 2 && url.charAt(0) === '<' && url.charAt(url.length - 1) === '>') { | |
url = url.substr(1, url.length - 2); | |
} | |
if (sh_isEmailAddress(url)) { | |
url = 'mailto:' + url; | |
} | |
tags[numTags - 2].node.href = url; | |
} | |
/* | |
Konqueror has a bug where the regular expression /$/g will not match at the end | |
of a line more than once: | |
var regex = /$/g; | |
var match; | |
var line = '1234567890'; | |
regex.lastIndex = 10; | |
match = regex.exec(line); | |
var line2 = 'abcde'; | |
regex.lastIndex = 5; | |
match = regex.exec(line2); // fails | |
*/ | |
function sh_konquerorExec(s) { | |
var result = ['']; | |
result.index = s.length; | |
result.input = s; | |
return result; | |
} | |
/** | |
Highlights all elements containing source code in a text string. The return | |
value is an array of objects, each representing an HTML start or end tag. Each | |
object has a property named pos, which is an integer representing the text | |
offset of the tag. Every start tag also has a property named node, which is the | |
DOM element started by the tag. End tags do not have this property. | |
@param inputString a text string | |
@param language a language definition object | |
@return an array of tag objects | |
*/ | |
function sh_highlightString(inputString, language) { | |
if (/Konqueror/.test(navigator.userAgent)) { | |
if (! language.konquered) { | |
for (var s = 0; s < language.length; s++) { | |
for (var p = 0; p < language[s].length; p++) { | |
var r = language[s][p][0]; | |
if (r.source === '$') { | |
r.exec = sh_konquerorExec; | |
} | |
} | |
} | |
language.konquered = true; | |
} | |
} | |
var a = document.createElement('a'); | |
var span = document.createElement('span'); | |
// the result | |
var tags = []; | |
var numTags = 0; | |
// each element is a pattern object from language | |
var patternStack = []; | |
// the current position within inputString | |
var pos = 0; | |
// the name of the current style, or null if there is no current style | |
var currentStyle = null; | |
var output = function(s, style) { | |
var length = s.length; | |
// this is more than just an optimization - we don't want to output empty <span></span> elements | |
if (length === 0) { | |
return; | |
} | |
if (! style) { | |
var stackLength = patternStack.length; | |
if (stackLength !== 0) { | |
var pattern = patternStack[stackLength - 1]; | |
// check whether this is a state or an environment | |
if (! pattern[3]) { | |
// it's not a state - it's an environment; use the style for this environment | |
style = pattern[1]; | |
} | |
} | |
} | |
if (currentStyle !== style) { | |
if (currentStyle) { | |
tags[numTags++] = {pos: pos}; | |
if (currentStyle === 'sh_url') { | |
sh_setHref(tags, numTags, inputString); | |
} | |
} | |
if (style) { | |
var clone; | |
if (style === 'sh_url') { | |
clone = a.cloneNode(false); | |
} | |
else { | |
clone = span.cloneNode(false); | |
} | |
clone.className = style; | |
tags[numTags++] = {node: clone, pos: pos}; | |
} | |
} | |
pos += length; | |
currentStyle = style; | |
}; | |
var endOfLinePattern = /\r\n|\r|\n/g; | |
endOfLinePattern.lastIndex = 0; | |
var inputStringLength = inputString.length; | |
while (pos < inputStringLength) { | |
var start = pos; | |
var end; | |
var startOfNextLine; | |
var endOfLineMatch = endOfLinePattern.exec(inputString); | |
if (endOfLineMatch === null) { | |
end = inputStringLength; | |
startOfNextLine = inputStringLength; | |
} | |
else { | |
end = endOfLineMatch.index; | |
startOfNextLine = endOfLinePattern.lastIndex; | |
} | |
var line = inputString.substring(start, end); | |
var matchCache = []; | |
for (;;) { | |
var posWithinLine = pos - start; | |
var stateIndex; | |
var stackLength = patternStack.length; | |
if (stackLength === 0) { | |
stateIndex = 0; | |
} | |
else { | |
// get the next state | |
stateIndex = patternStack[stackLength - 1][2]; | |
} | |
var state = language[stateIndex]; | |
var numPatterns = state.length; | |
var mc = matchCache[stateIndex]; | |
if (! mc) { | |
mc = matchCache[stateIndex] = []; | |
} | |
var bestMatch = null; | |
var bestPatternIndex = -1; | |
for (var i = 0; i < numPatterns; i++) { | |
var match; | |
if (i < mc.length && (mc[i] === null || posWithinLine <= mc[i].index)) { | |
match = mc[i]; | |
} | |
else { | |
var regex = state[i][0]; | |
regex.lastIndex = posWithinLine; | |
match = regex.exec(line); | |
mc[i] = match; | |
} | |
if (match !== null && (bestMatch === null || match.index < bestMatch.index)) { | |
bestMatch = match; | |
bestPatternIndex = i; | |
if (match.index === posWithinLine) { | |
break; | |
} | |
} | |
} | |
if (bestMatch === null) { | |
output(line.substring(posWithinLine), null); | |
break; | |
} | |
else { | |
// got a match | |
if (bestMatch.index > posWithinLine) { | |
output(line.substring(posWithinLine, bestMatch.index), null); | |
} | |
var pattern = state[bestPatternIndex]; | |
var newStyle = pattern[1]; | |
var matchedString; | |
if (newStyle instanceof Array) { | |
for (var subexpression = 0; subexpression < newStyle.length; subexpression++) { | |
matchedString = bestMatch[subexpression + 1]; | |
output(matchedString, newStyle[subexpression]); | |
} | |
} | |
else { | |
matchedString = bestMatch[0]; | |
output(matchedString, newStyle); | |
} | |
switch (pattern[2]) { | |
case -1: | |
// do nothing | |
break; | |
case -2: | |
// exit | |
patternStack.pop(); | |
break; | |
case -3: | |
// exitall | |
patternStack.length = 0; | |
break; | |
default: | |
// this was the start of a delimited pattern or a state/environment | |
patternStack.push(pattern); | |
break; | |
} | |
} | |
} | |
// end of the line | |
if (currentStyle) { | |
tags[numTags++] = {pos: pos}; | |
if (currentStyle === 'sh_url') { | |
sh_setHref(tags, numTags, inputString); | |
} | |
currentStyle = null; | |
} | |
pos = startOfNextLine; | |
} | |
return tags; | |
} | |
//////////////////////////////////////////////////////////////////////////////// | |
// DOM-dependent functions | |
function sh_getClasses(element) { | |
var result = []; | |
var htmlClass = element.className; | |
if (htmlClass && htmlClass.length > 0) { | |
var htmlClasses = htmlClass.split(' '); | |
for (var i = 0; i < htmlClasses.length; i++) { | |
if (htmlClasses[i].length > 0) { | |
result.push(htmlClasses[i]); | |
} | |
} | |
} | |
return result; | |
} | |
function sh_addClass(element, name) { | |
var htmlClasses = sh_getClasses(element); | |
for (var i = 0; i < htmlClasses.length; i++) { | |
if (name.toLowerCase() === htmlClasses[i].toLowerCase()) { | |
return; | |
} | |
} | |
htmlClasses.push(name); | |
element.className = htmlClasses.join(' '); | |
} | |
/** | |
Extracts the tags from an HTML DOM NodeList. | |
@param nodeList a DOM NodeList | |
@param result an object with text, tags and pos properties | |
*/ | |
function sh_extractTagsFromNodeList(nodeList, result) { | |
var length = nodeList.length; | |
for (var i = 0; i < length; i++) { | |
var node = nodeList.item(i); | |
switch (node.nodeType) { | |
case 1: | |
if (node.nodeName.toLowerCase() === 'br') { | |
var terminator; | |
if (/MSIE/.test(navigator.userAgent)) { | |
terminator = '\r'; | |
} | |
else { | |
terminator = '\n'; | |
} | |
result.text.push(terminator); | |
result.pos++; | |
} | |
else { | |
result.tags.push({node: node.cloneNode(false), pos: result.pos}); | |
sh_extractTagsFromNodeList(node.childNodes, result); | |
result.tags.push({pos: result.pos}); | |
} | |
break; | |
case 3: | |
case 4: | |
result.text.push(node.data); | |
result.pos += node.length; | |
break; | |
} | |
} | |
} | |
/** | |
Extracts the tags from the text of an HTML element. The extracted tags will be | |
returned as an array of tag objects. See sh_highlightString for the format of | |
the tag objects. | |
@param element a DOM element | |
@param tags an empty array; the extracted tag objects will be returned in it | |
@return the text of the element | |
@see sh_highlightString | |
*/ | |
function sh_extractTags(element, tags) { | |
var result = {}; | |
result.text = []; | |
result.tags = tags; | |
result.pos = 0; | |
sh_extractTagsFromNodeList(element.childNodes, result); | |
return result.text.join(''); | |
} | |
/** | |
Merges the original tags from an element with the tags produced by highlighting. | |
@param originalTags an array containing the original tags | |
@param highlightTags an array containing the highlighting tags - these must not overlap | |
@result an array containing the merged tags | |
*/ | |
function sh_mergeTags(originalTags, highlightTags) { | |
var numOriginalTags = originalTags.length; | |
if (numOriginalTags === 0) { | |
return highlightTags; | |
} | |
var numHighlightTags = highlightTags.length; | |
if (numHighlightTags === 0) { | |
return originalTags; | |
} | |
var result = []; | |
var originalIndex = 0; | |
var highlightIndex = 0; | |
while (originalIndex < numOriginalTags && highlightIndex < numHighlightTags) { | |
var originalTag = originalTags[originalIndex]; | |
var highlightTag = highlightTags[highlightIndex]; | |
if (originalTag.pos <= highlightTag.pos) { | |
result.push(originalTag); | |
originalIndex++; | |
} | |
else { | |
result.push(highlightTag); | |
if (highlightTags[highlightIndex + 1].pos <= originalTag.pos) { | |
highlightIndex++; | |
result.push(highlightTags[highlightIndex]); | |
highlightIndex++; | |
} | |
else { | |
// new end tag | |
result.push({pos: originalTag.pos}); | |
// new start tag | |
highlightTags[highlightIndex] = {node: highlightTag.node.cloneNode(false), pos: originalTag.pos}; | |
} | |
} | |
} | |
while (originalIndex < numOriginalTags) { | |
result.push(originalTags[originalIndex]); | |
originalIndex++; | |
} | |
while (highlightIndex < numHighlightTags) { | |
result.push(highlightTags[highlightIndex]); | |
highlightIndex++; | |
} | |
return result; | |
} | |
/** | |
Inserts tags into text. | |
@param tags an array of tag objects | |
@param text a string representing the text | |
@return a DOM DocumentFragment representing the resulting HTML | |
*/ | |
function sh_insertTags(tags, text) { | |
var doc = document; | |
var result = document.createDocumentFragment(); | |
var tagIndex = 0; | |
var numTags = tags.length; | |
var textPos = 0; | |
var textLength = text.length; | |
var currentNode = result; | |
// output one tag or text node every iteration | |
while (textPos < textLength || tagIndex < numTags) { | |
var tag; | |
var tagPos; | |
if (tagIndex < numTags) { | |
tag = tags[tagIndex]; | |
tagPos = tag.pos; | |
} | |
else { | |
tagPos = textLength; | |
} | |
if (tagPos <= textPos) { | |
// output the tag | |
if (tag.node) { | |
// start tag | |
var newNode = tag.node; | |
currentNode.appendChild(newNode); | |
currentNode = newNode; | |
} | |
else { | |
// end tag | |
currentNode = currentNode.parentNode; | |
} | |
tagIndex++; | |
} | |
else { | |
// output text | |
currentNode.appendChild(doc.createTextNode(text.substring(textPos, tagPos))); | |
textPos = tagPos; | |
} | |
} | |
return result; | |
} | |
/** | |
Highlights an element containing source code. Upon completion of this function, | |
the element will have been placed in the "sh_sourceCode" class. | |
@param element a DOM <pre> element containing the source code to be highlighted | |
@param language a language definition object | |
*/ | |
function sh_highlightElement(element, language) { | |
sh_addClass(element, 'sh_sourceCode'); | |
var originalTags = []; | |
var inputString = sh_extractTags(element, originalTags); | |
var highlightTags = sh_highlightString(inputString, language); | |
var tags = sh_mergeTags(originalTags, highlightTags); | |
var documentFragment = sh_insertTags(tags, inputString); | |
while (element.hasChildNodes()) { | |
element.removeChild(element.firstChild); | |
} | |
element.appendChild(documentFragment); | |
} | |
function sh_getXMLHttpRequest() { | |
if (window.ActiveXObject) { | |
return new ActiveXObject('Msxml2.XMLHTTP'); | |
} | |
else if (window.XMLHttpRequest) { | |
return new XMLHttpRequest(); | |
} | |
throw 'No XMLHttpRequest implementation available'; | |
} | |
function sh_load(language, element, prefix, suffix) { | |
if (language in sh_requests) { | |
sh_requests[language].push(element); | |
return; | |
} | |
sh_requests[language] = [element]; | |
var request = sh_getXMLHttpRequest(); | |
var url = prefix + 'sh_' + language + suffix; | |
request.open('GET', url, true); | |
request.onreadystatechange = function () { | |
if (request.readyState === 4) { | |
try { | |
if (! request.status || request.status === 200) { | |
eval(request.responseText); | |
var elements = sh_requests[language]; | |
for (var i = 0; i < elements.length; i++) { | |
sh_highlightElement(elements[i], sh_languages[language]); | |
} | |
} | |
else { | |
throw 'HTTP error: status ' + request.status; | |
} | |
} | |
finally { | |
request = null; | |
} | |
} | |
}; | |
request.send(null); | |
} | |
/** | |
Highlights all elements containing source code on the current page. Elements | |
containing source code must be "pre" elements with a "class" attribute of | |
"sh_LANGUAGE", where LANGUAGE is a valid language identifier; e.g., "sh_java" | |
identifies the element as containing "java" language source code. | |
*/ | |
function highlight(prefix, suffix, tag) { | |
var nodeList = document.getElementsByTagName(tag); | |
for (var i = 0; i < nodeList.length; i++) { | |
var element = nodeList.item(i); | |
var htmlClasses = sh_getClasses(element); | |
var highlighted = false; | |
var donthighlight = false; | |
for (var j = 0; j < htmlClasses.length; j++) { | |
var htmlClass = htmlClasses[j].toLowerCase(); | |
if (htmlClass === 'sh_none') { | |
donthighlight = true | |
continue; | |
} | |
if (htmlClass.substr(0, 3) === 'sh_') { | |
var language = htmlClass.substring(3); | |
if (language in sh_languages) { | |
sh_highlightElement(element, sh_languages[language]); | |
highlighted = true; | |
} | |
else if (typeof(prefix) === 'string' && typeof(suffix) === 'string') { | |
sh_load(language, element, prefix, suffix); | |
} | |
else { | |
throw 'Found <' + tag + '> element with class="' + htmlClass + '", but no such language exists'; | |
} | |
break; | |
} | |
} | |
if (highlighted === false && donthighlight == false) { | |
sh_highlightElement(element, sh_languages["javascript"]); | |
} | |
} | |
} | |
function sh_highlightDocument(prefix, suffix) { | |
highlight(prefix, suffix, 'tt'); | |
highlight(prefix, suffix, 'code'); | |
highlight(prefix, suffix, 'pre'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* spy-js - v0.2.2 - 2013-10-04 | |
* http://spy-js.com | |
* Copyright (c) 2013-2013 spy-js - All Rights Reserved. | |
* | |
* This source code file is a part of spy-js product. | |
* | |
* Using/copying/sharing/distributing the code in any way | |
* (different from licensed product usage described in EULA) | |
* is not allowed without owner's written permission. | |
*/ | |
! function() { | |
var a = !0, | |
b = null; | |
! function(c) { | |
function d(c) { | |
if ("bug-string-char-index" == c) return "a" != "a" [0]; | |
var d, e = "json" == c; | |
if (e || "json-stringify" == c || "json-parse" == c) { | |
if ("json-stringify" == c || e) { | |
var f = j.stringify, | |
i = "function" == typeof f && k; | |
if (i) { | |
(d = function() { | |
return 1 | |
}).toJSON = d; | |
try { | |
i = "0" === f(0) && "0" === f(new Number) && '""' == f(new String) && f(h) === g && f(g) === g && f() === g && "1" === f(d) && "[1]" == f([d]) && "[null]" == f([g]) && "null" == f(b) && "[null,null,null]" == f([g, h, b]) && '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}' == f({ | |
a: [d, a, !1, b, "\0\b\n\f\r "] | |
}) && "1" === f(b, d) && "[\n 1,\n 2\n]" == f([1, 2], b, 1) && '"-271821-04-20T00:00:00.000Z"' == f(new Date(-864e13)) && '"+275760-09-13T00:00:00.000Z"' == f(new Date(864e13)) && '"-000001-01-01T00:00:00.000Z"' == f(new Date(-621987552e5)) && '"1969-12-31T23:59:59.999Z"' == f(new Date(-1)) | |
} catch (l) { | |
i = !1 | |
} | |
} | |
if (!e) return i | |
} | |
if ("json-parse" == c || e) { | |
if (c = j.parse, "function" == typeof c) try { | |
if (0 === c("0") && !c(!1)) { | |
d = c('{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'); | |
var m = 5 == d.a.length && 1 === d.a[0]; | |
if (m) { | |
try { | |
m = !c('" "') | |
} catch (n) {} | |
if (m) try { | |
m = 1 !== c("01") | |
} catch (o) {} | |
} | |
} | |
} catch (p) { | |
m = !1 | |
} | |
if (!e) return m | |
} | |
return i && m | |
} | |
} | |
var e, f, g, h = {}.toString, | |
i = "function" == typeof define && define.amd, | |
j = "object" == typeof exports && exports; | |
j || i ? "object" == typeof JSON && JSON ? j ? (j.stringify = JSON.stringify, j.parse = JSON.parse) : j = JSON : i && (j = c.JSON = {}) : j = c.JSON || (c.JSON = {}); | |
var k = new Date(-0xc782b5b800cec); | |
try { | |
k = -109252 == k.getUTCFullYear() && 0 === k.getUTCMonth() && 1 === k.getUTCDate() && 10 == k.getUTCHours() && 37 == k.getUTCMinutes() && 6 == k.getUTCSeconds() && 708 == k.getUTCMilliseconds() | |
} catch (l) {} | |
if (!d("json")) { | |
var m = d("bug-string-char-index"); | |
if (!k) var n = Math.floor, | |
o = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], p = function(a, b) { | |
return o[b] + 365 * (a - 1970) + n((a - 1969 + (b = +(b > 1))) / 4) - n((a - 1901 + b) / 100) + n((a - 1601 + b) / 400) | |
}; | |
(e = {}.hasOwnProperty) || (e = function(a) { | |
var c, d = {}; | |
return (d.__proto__ = b, d.__proto__ = { | |
toString: 1 | |
}, d).toString != h ? e = function(a) { | |
var c = this.__proto__, | |
a = (this.__proto__ = b, a in this); | |
return this.__proto__ = c, a | |
} : (c = d.constructor, e = function(a) { | |
var b = (this.constructor || c).prototype; | |
return a in this && !(a in b && this[a] === b[a]) | |
}), d = b, e.call(this, a) | |
}); | |
var q = { | |
"boolean": 1, | |
number: 1, | |
string: 1, | |
undefined: 1 | |
}; | |
if (f = function(a, c) { | |
var d, f, g, i = 0; | |
(d = function() { | |
this.valueOf = 0 | |
}).prototype.valueOf = 0, f = new d; | |
for (g in f) e.call(f, g) && i++; | |
d = f = b, i ? i = 2 == i ? function(a, b) { | |
var c, d = {}, f = "[object Function]" == h.call(a); | |
for (c in a)!(f && "prototype" == c) && !e.call(d, c) && (d[c] = 1) && e.call(a, c) && b(c) | |
} : function(a, b) { | |
var c, d, f = "[object Function]" == h.call(a); | |
for (c in a)!(f && "prototype" == c) && e.call(a, c) && !(d = "constructor" === c) && b(c); | |
(d || e.call(a, c = "constructor")) && b(c) | |
} : (f = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"], i = function(a, b) { | |
var c, d, g = "[object Function]" == h.call(a); | |
(d = !g) && (d = "function" != typeof a.constructor) && (d = typeof a.hasOwnProperty, d = "object" == d ? !! a.hasOwnProperty : !q[d]), d = d ? a.hasOwnProperty : e; | |
for (c in a)!(g && "prototype" == c) && d.call(a, c) && b(c); | |
for (g = f.length; c = f[--g]; d.call(a, c) && b(c)); | |
}), i(a, c) | |
}, !d("json-stringify")) { | |
var r = { | |
92: "\\\\", | |
34: '\\"', | |
8: "\\b", | |
12: "\\f", | |
10: "\\n", | |
13: "\\r", | |
9: "\\t" | |
}, s = function(a, b) { | |
return ("000000" + (b || 0)).slice(-a) | |
}, t = function(a) { | |
var b, c = '"', | |
d = 0, | |
e = a.length, | |
f = e > 10 && m; | |
for (f && (b = a.split("")); e > d; d++) { | |
var g = a.charCodeAt(d); | |
switch (g) { | |
case 8: | |
case 9: | |
case 10: | |
case 12: | |
case 13: | |
case 34: | |
case 92: | |
c += r[g]; | |
break; | |
default: | |
if (32 > g) { | |
c += "\\u00" + s(2, g.toString(16)); | |
break | |
} | |
c += f ? b[d] : m ? a.charAt(d) : a[d] | |
} | |
} | |
return c + '"' | |
}, u = function(c, d, i, j, k, l, m) { | |
var o, q, r, v, w, x, y, z, A, B = d[c]; | |
try { | |
B = d[c] | |
} catch (C) {} | |
if ("object" == typeof B && B) | |
if (o = h.call(B), "[object Date]" != o || e.call(B, "toJSON")) "function" == typeof B.toJSON && ("[object Number]" != o && "[object String]" != o && "[object Array]" != o || e.call(B, "toJSON")) && (B = B.toJSON(c)); | |
else | |
if (B > -1 / 0 && 1 / 0 > B) { | |
if (p) { | |
for (r = n(B / 864e5), o = n(r / 365.2425) + 1970 - 1; p(o + 1, 0) <= r; o++); | |
for (q = n((r - p(o, 0)) / 30.42); p(o, q + 1) <= r; q++); | |
r = 1 + r - p(o, q), v = (B % 864e5 + 864e5) % 864e5, w = n(v / 36e5) % 24, x = n(v / 6e4) % 60, y = n(v / 1e3) % 60, v %= 1e3 | |
} else o = B.getUTCFullYear(), q = B.getUTCMonth(), r = B.getUTCDate(), w = B.getUTCHours(), x = B.getUTCMinutes(), y = B.getUTCSeconds(), v = B.getUTCMilliseconds(); | |
B = (0 >= o || o >= 1e4 ? (0 > o ? "-" : "+") + s(6, 0 > o ? -o : o) : s(4, o)) + "-" + s(2, q + 1) + "-" + s(2, r) + "T" + s(2, w) + ":" + s(2, x) + ":" + s(2, y) + "." + s(3, v) + "Z" | |
} else B = b; if (i && (B = i.call(d, c, B)), B === b) return "null"; | |
if (o = h.call(B), "[object Boolean]" == o) return "" + B; | |
if ("[object Number]" == o) return B > -1 / 0 && 1 / 0 > B ? "" + B : "null"; | |
if ("[object String]" == o) return t("" + B); | |
if ("object" == typeof B) { | |
for (c = m.length; c--;) | |
if (m[c] === B) throw TypeError(); | |
if (m.push(B), z = [], d = l, l += k, "[object Array]" == o) { | |
for (q = 0, c = B.length; c > q; A || (A = a), q++) o = u(q, B, i, j, k, l, m), z.push(o === g ? "null" : o); | |
c = A ? k ? "[\n" + l + z.join(",\n" + l) + "\n" + d + "]" : "[" + z.join(",") + "]" : "[]" | |
} else f(j || B, function(b) { | |
var c = u(b, B, i, j, k, l, m); | |
c !== g && z.push(t(b) + ":" + (k ? " " : "") + c), A || (A = a) | |
}), c = A ? k ? "{\n" + l + z.join(",\n" + l) + "\n" + d + "}" : "{" + z.join(",") + "}" : "{}"; | |
return m.pop(), c | |
} | |
}; | |
j.stringify = function(a, b, c) { | |
var d, e, f; | |
if ("function" == typeof b || "object" == typeof b && b) | |
if ("[object Function]" == h.call(b)) e = b; | |
else | |
if ("[object Array]" == h.call(b)) { | |
f = {}; | |
for (var g, i = 0, j = b.length; j > i; g = b[i++], ("[object String]" == h.call(g) || "[object Number]" == h.call(g)) && (f[g] = 1)); | |
} | |
if (c) | |
if ("[object Number]" == h.call(c)) { | |
if ((c -= c % 1) > 0) | |
for (d = "", c > 10 && (c = 10); d.length < c; d += " "); | |
} else "[object String]" == h.call(c) && (d = c.length <= 10 ? c : c.slice(0, 10)); | |
return u("", (g = {}, g[""] = a, g), e, f, d, "", []) | |
} | |
} | |
if (!d("json-parse")) { | |
var v, w, x = String.fromCharCode, | |
y = { | |
92: "\\", | |
34: '"', | |
47: "/", | |
98: "\b", | |
116: " ", | |
110: "\n", | |
102: "\f", | |
114: "\r" | |
}, z = function() { | |
throw v = w = b, SyntaxError() | |
}, A = function() { | |
for (var c, d, e, f, g, h = w, i = h.length; i > v;) switch (g = h.charCodeAt(v)) { | |
case 9: | |
case 10: | |
case 13: | |
case 32: | |
v++; | |
break; | |
case 123: | |
case 125: | |
case 91: | |
case 93: | |
case 58: | |
case 44: | |
return c = m ? h.charAt(v) : h[v], v++, c; | |
case 34: | |
for (c = "@", v++; i > v;) | |
if (g = h.charCodeAt(v), 32 > g) z(); | |
else | |
if (92 == g) switch (g = h.charCodeAt(++v)) { | |
case 92: | |
case 34: | |
case 47: | |
case 98: | |
case 116: | |
case 110: | |
case 102: | |
case 114: | |
c += y[g], v++; | |
break; | |
case 117: | |
for (d = ++v, e = v + 4; e > v; v++) g = h.charCodeAt(v), g >= 48 && 57 >= g || g >= 97 && 102 >= g || g >= 65 && 70 >= g || z(); | |
c += x("0x" + h.slice(d, v)); | |
break; | |
default: | |
z() | |
} else { | |
if (34 == g) break; | |
for (g = h.charCodeAt(v), d = v; g >= 32 && 92 != g && 34 != g;) g = h.charCodeAt(++v); | |
c += h.slice(d, v) | |
} if (34 == h.charCodeAt(v)) return v++, c; | |
z(); | |
default: | |
if (d = v, 45 == g && (f = a, g = h.charCodeAt(++v)), g >= 48 && 57 >= g) { | |
for (48 == g && (g = h.charCodeAt(v + 1), g >= 48 && 57 >= g) && z(); i > v && (g = h.charCodeAt(v), g >= 48 && 57 >= g); v++); | |
if (46 == h.charCodeAt(v)) { | |
for (e = ++v; i > e && (g = h.charCodeAt(e), g >= 48 && 57 >= g); e++); | |
e == v && z(), v = e | |
} | |
if (g = h.charCodeAt(v), 101 == g || 69 == g) { | |
for (g = h.charCodeAt(++v), (43 == g || 45 == g) && v++, e = v; i > e && (g = h.charCodeAt(e), g >= 48 && 57 >= g); e++); | |
e == v && z(), v = e | |
} | |
return +h.slice(d, v) | |
} | |
if (f && z(), "true" == h.slice(v, v + 4)) return v += 4, a; | |
if ("false" == h.slice(v, v + 5)) return v += 5, !1; | |
if ("null" == h.slice(v, v + 4)) return v += 4, b; | |
z() | |
} | |
return "$" | |
}, B = function(b) { | |
var c, d; | |
if ("$" == b && z(), "string" == typeof b) { | |
if ("@" == (m ? b.charAt(0) : b[0])) return b.slice(1); | |
if ("[" == b) { | |
for (c = []; b = A(), "]" != b; d || (d = a)) d && ("," == b ? (b = A(), "]" == b && z()) : z()), "," == b && z(), c.push(B(b)); | |
return c | |
} | |
if ("{" == b) { | |
for (c = {}; b = A(), "}" != b; d || (d = a)) d && ("," == b ? (b = A(), "}" == b && z()) : z()), ("," == b || "string" != typeof b || "@" != (m ? b.charAt(0) : b[0]) || ":" != A()) && z(), c[b.slice(1)] = B(A()); | |
return c | |
} | |
z() | |
} | |
return b | |
}, C = function(a, b, c) { | |
c = D(a, b, c), c === g ? delete a[b] : a[b] = c | |
}, D = function(a, b, c) { | |
var d, e = a[b]; | |
if ("object" == typeof e && e) | |
if ("[object Array]" == h.call(e)) | |
for (d = e.length; d--;) C(e, d, c); | |
else f(e, function(a) { | |
C(e, a, c) | |
}); | |
return c.call(a, b, e) | |
}; | |
j.parse = function(a, c) { | |
var d, e; | |
return v = 0, w = "" + a, d = B(A()), "$" != A() && z(), v = w = b, c && "[object Function]" == h.call(c) ? D((e = {}, e[""] = d, e), "", c) : d | |
} | |
} | |
} | |
}(this) | |
}(), | |
function(global) { | |
var streamContext = Math.random().toString(36).substr(2, 5), | |
eventContext = 0, | |
isFromSetTimeout = !1, | |
isFromSetInterval = !1, | |
originalSetTimeout = global.originalSetTimeout, | |
originalSetInterval = global.originalSetInterval, | |
originalClearTimeout = global.clearTimeout, | |
originalXMLHttpRequest = global.XMLHttpRequest, | |
originalJSON = global.JSON, | |
originalEvent = global.Event; | |
try { | |
var spyIndicator = global.document.documentElement.appendChild(global.document.createElement("div")), | |
st = spyIndicator.style; | |
st.position = "fixed", st.display = "block", st.right = "10px", st.top = "10px", st.width = "48px", st.height = "48px", st.background = 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAAAAAByaaZbAAACzklEQVRIx62Wi0/aQBjA+ef79fqAWV/zgTCI4rSR4YjTERdfwERZnHMTmROX6MSB6CKWyaO9XVuqbYNXTPYlHA18v/ve1/Mh1iHItvYUH0IOZWRb2V6rj32m/CeAQwDPAAIfDvdWoyKwwEA/AJfuYKwpRVkMxsf7ACCmYEPuizW1Ou8NCN+wZghhNFyZAA8AokoXMKkc8rKQtetr+HoMqABIF9gkuqu6RAeY100TsCh8wNFdyuix6gF3V3w5SAX8p44QCKSEgQLA+B8XoLUXGArALLTdgLZKtTB91jT9f4w6Rw96YC57etNU8aN85dyA0ZTAMIze0wzD+sdmlzbzB0c/Tk6+F/Z3EsgFiDOpTG47vZqcCw+Ht2IDhCEsy/GCIPAcYt2F47L3ZsLVllKtqH/Pd94EJd6wyJioC+D3sZUYoz8x7tQvirvrywlZlheSqcxmAGzzR1waTlc72NEPhmidNhFVw7XJAelFQCRGwQSAHX37udzotoOub63mL63LcvnXWamQT0X4bloBkBRdzpeuGp3u7tjdUcajsgIPdQBgWHEkktjYL1XqTYtzNBXGShKchQPEA/IPBWPJtXzxvHbXVB+219p35U8znKvSEMqKujEYS8iR0ZHQ7OL7ta2Pu7u5zNqyHJIQuFsDpq7fGQ/81HSYJJNUgZdjnOGwVQ8nMHxVj+uVhfB2ekT/FjZaBZ7SfMIxvtt4KXATZxh/GeTE0F4Lp2kzDetk6mvHRxWSlc55oXSr4dY8QwOiDSsrVn5+D1FPDf+xe6QzrnlxT1y8iTXbuYRvgh5HpXho70OsbbJ0CyShNXsXlQbBA2DZxcZDGLj6CrwskPfkimI1+NVsX28gFK8YLqmnEUsfUQFy/KUv6rc/U5KpjxCiW9BnUJqcCDwOMh0w/9W1ja3Jx8sC5aLxhEu22wdC/QCmKsuiXrZ8dh1k7Wg99bgM/QPE+cpqUFqlxgAAAABJRU5ErkJggg==")', st.borderRadius = "3px", st.padding = "0px", st.zIndex = 1e3, st.opacity = "0.7", originalSetTimeout(function() { | |
global.document.documentElement.removeChild(spyIndicator) | |
}, 5e3) | |
} catch (e) {} | |
global.newSetTimeout = function() { | |
var callback = arguments[0]; | |
return arguments[0] = function() { | |
isFromSetTimeout = !0, eventContext++, callback instanceof Function ? callback() : eval(callback), isFromSetTimeout = !1 | |
}, Function.prototype.apply.call(originalSetTimeout, null, arguments) | |
}, global.newSetInterval = function() { | |
var callback = arguments[0]; | |
return arguments[0] = function() { | |
isFromSetInterval = !0, eventContext++, callback instanceof Function ? callback() : eval(callback), isFromSetInterval = !1 | |
}, Function.prototype.apply.call(originalSetInterval, null, arguments) | |
}; | |
var lastEvent = null, | |
lastEventData = "", | |
prepareLastEvent = function(a) { | |
return { | |
type: a.type || "unknown", | |
timeStamp: a.timeStamp | |
} | |
}, hasOwnProperty = Object.prototype.hasOwnProperty || function(a) { | |
var b = this.__proto__ || obj.constructor.prototype; | |
return a in this && (!(a in b) || b[a] !== this[a]) | |
}, prepareObj = function(a, b) { | |
var c; | |
switch (typeof a) { | |
case "object": | |
if (null === a) c = a; | |
else if ("[object Array]" === Object.prototype.toString.call(a)) { | |
c = "__[]EA"; | |
var d = a.length; | |
if (d) | |
if (b >= global.__p.limits.lvl) c = "__[]LA"; | |
else { | |
c = []; | |
for (var e = 0; d > e; e++) { | |
if (e >= global.__p.limits.arr) { | |
c[e] = "__[]A"; | |
break | |
} | |
c[e] = prepareObj(a[e], b + 1) | |
} | |
} | |
} else if ("[object Date]" === Object.prototype.toString.call(a)) c = a.toString(); | |
else if (b >= global.__p.limits.lvl) c = "__[]LO"; | |
else { | |
c = {}; | |
try { | |
var f = 0; | |
for (var g in a) | |
if (hasOwnProperty.call(a, g)) { | |
if (f >= global.__p.limits.prop) { | |
c["__[]P"] = ""; | |
break | |
} | |
c[g] = prepareObj(a[g], b + 1), f++ | |
} | |
} catch (h) { | |
c = "__[]E" + h.message | |
} | |
} | |
break; | |
case "string": | |
c = a.length > global.__p.limits.str ? a.slice(0, global.__p.limits.str) + "__[]S" : a; | |
break; | |
case "function": | |
c = "__[]F"; | |
break; | |
case "undefined": | |
c = "__[]U"; | |
break; | |
case "number": | |
c = isNaN(a) ? "__[]NN" : a === Number.NEGATIVE_INFINITY ? "__[]IN" : a === Number.POSITIVE_INFINITY ? "__[]IP" : a; | |
break; | |
default: | |
c = a | |
} | |
return c | |
}, messages = [], | |
chunkSize = 1e4, | |
sendInterval = 20, | |
isSending = !1, | |
sender = null, | |
startSending = function() { | |
isSending || (isSending = !0, sender = originalSetTimeout(send, sendInterval)) | |
}, stopSending = function() { | |
isSending && (isSending = !1, sender && originalClearTimeout(sender), messages.length = 0) | |
}, send = function() { | |
if (isSending) { | |
var a = Math.min(messages.length, chunkSize), | |
b = { | |
data: messages.splice(0, a), | |
streamContext: streamContext, | |
sessionId: global.__p.sessionId | |
}, c = new originalXMLHttpRequest, | |
d = function() { | |
messages.length ? sender = originalSetTimeout(send, sendInterval) : stopSending() | |
}; | |
c.open("POST", "/ui-event-handler"), c.setRequestHeader("Content-Type", "application/json;charset=UTF-8"), c.addEventListener ? (c.addEventListener("load", d, !1), c.addEventListener("error", d, !1), c.addEventListener("abort", d, !1)) : c.onreadystatechange = function() { | |
4 === c.readyState && d() | |
}, c.send(originalJSON.stringify(b)) | |
} | |
}, stackDepth = 0; | |
global.__p = { | |
i: function(a, b) { | |
var c = window.event; | |
if (!c && 0 == stackDepth) try { | |
var d = arguments.callee.caller.caller; | |
if (d && !d.caller && d.arguments.length) { | |
var e = d.arguments[0]; | |
c = e instanceof originalEvent ? e : null | |
} | |
} catch (f) {} | |
c ? 0 != stackDepth || lastEvent && lastEvent == c || (lastEvent = c, lastEventData = prepareLastEvent(c), eventContext++) : (0 == stackDepth && eventContext++, lastEvent = null, lastEventData = ""); | |
var g = { | |
callData: a, | |
pageEvent: lastEventData, | |
isFromSetTimeout: isFromSetTimeout, | |
isFromSetInterval: isFromSetInterval, | |
time: (new Date).getTime(), | |
eventContext: eventContext, | |
objDump: b | |
}; | |
lastEventData && (lastEventData = { | |
type: lastEvent.type | |
}), startSending(), messages.push(g) | |
}, | |
r: function(a, b) { | |
var c = global.__p.limits ? prepareObj(b, 0) : void 0; | |
return global.__p.i(a, c), b | |
}, | |
f: function(a, b) { | |
if (global.__p.limits) { | |
var c = []; | |
b = b || []; | |
for (var d in b) c.push(prepareObj(b[d], 0)); | |
global.__p.i(a, c) | |
} else global.__p.i(a); | |
stackDepth++ | |
}, | |
fe: function(a) { | |
global.__p.i(a), stackDepth-- | |
}, | |
p: function(a) { | |
global.__p.i(a), stackDepth++ | |
}, | |
pe: function(a) { | |
global.__p.i(a), stackDepth-- | |
}, | |
e: function(a) { | |
if (global.__p.limits) { | |
var b = prepareObj(a, 0); | |
a && b && (b.name = a.name, b.message = a.message), global.__p.i("", b) | |
} else global.__p.i("") | |
} | |
} | |
}(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment