/* * Checks if property is derived from prototype, applies method if it is not exists * * @param string property name * @return bool true if prototyped * @access public */ if('undefined'==typeof Object.hasOwnProperty){Object.prototype.hasOwnProperty=function(i){return!('undefined'==typeof this[i]||this.constructor&&this.constructor.prototype[i]&&this[i]===this.constructor.prototype[i]);}}if(!window.findPath){function findPath(i){var I=document.getElementsByTagName('script'),l=new RegExp('^(.*/|)('+i+')([#?]|$)');for(var o=0,O=I.length;o"+"
{TOOLBAR}{LNG_TIMINGS}{PROCESSING}, {LNG_TOKENS}{TOKENCOUNT}, {LNG_SRCLENGTH}{SRCLENGTH}
"+"
"+"
    {STRINGS}
"+""+"

PSyHi v0.1 (P Syntax Highlighter)

"+"

© 2007 Ilya Lebedev <ilya@lebedev.net>

"+"

{LNG_ACKNOWLEGEMENTS}

"+"

Tokenizer library: Google Code Prettify
"+"Cross-browser clipboard copy: Jeffothy's Clipboard Copy

"+"
"+"
",lang:{en:{'linenum':'Line numbers on/off','togglesrc':'Toggle source','about':'About','clipboard':'Copy to clipboard','langsupport':'Supported languages:','acknowlegements':'Acknowlegements','expandsrc':'Toggle code visibility','timings':'Processing time: ','tokens':'tokens: ','srclength':'source length: '}}};var o=function(e){return e;return e.replace(/&/g,"&").replace(//g,">");};var O=function(e,v){var V="";V+="
  • "+v+"
  • ";return V};var Q=function(e){var v=PR_lexOne(e),V=[],x=0;for(var X=0,z=v.length;X"+o(w[W])+"");Z=[]}}break;default:Z[Z.length]=""+o(v[X].token)+"";break}X++}if(Z.length>0)V[V.length]=O(++x,Z.join(""));}V.tokenCount=v.length;return V};var _=function(e){var v=l.lang[I.lang]||l.lang.en;for(var V in v){if(v.hasOwnProperty(V)){e=e.replace('{LNG_'+V.toUpperCase()+'}',v[V]);}}return e};var c=function(e){var v=[];for(var V in PSyHi.toolbar){if(PSyHi.toolbar.hasOwnProperty(V)){var x=PSyHi.toolbar[V];v[v.length]=""}}return e.replace("{TOOLBAR}",v.join(" "));};var C=function(){l.interface=_(c(l.interface));var e=document.getElementsByTagName('pre'),v=e.length-1,V,x,X,z=document.createElement('div'),Z,w;for(;v>=0;v--){if(V=e[v].className.match(/code/)){w=new Date;try{Z=e[v].value||e[v].innerHTML}catch(err){continue}x=Q(Z);if(!x)continue;while(document.getElementById("PSyHi_Container_"+v))v++;X="PSyHi_Container_"+v;z.innerHTML=l.interface.replace("{STRINGS}",x.join("")).replace("{ID}",X).replace('{TOKENCOUNT}',x.tokenCount).replace('{SRCLENGTH}',Math.round(Z.length/10.24)/100+'Kb');var W=z.firstChild,s=W.childNodes[1];s.childNodes[1].value=Z.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");e[v].style.padding=0;e[v].style.margin=0;e[v].style.border=0;var S=e[v].offsetWidth;var k=e[v].offsetHeight;e[v].style.display='none';W.style.width=S+"px";s.style.width=S+"px";s.childNodes[1].style.height=k+"px";e[v].parentNode.insertBefore(W,e[v]);k=Math.min(k,s.firstChild.firstChild.offsetHeight);s.firstChild.style.height=k+(s.firstChild.offsetHeight-s.firstChild.clientHeight)+"px";s.firstChild.style.height=k+(s.firstChild.offsetHeight-s.firstChild.clientHeight)+"px";W.firstChild.lastChild.innerHTML=W.firstChild.lastChild.innerHTML.replace('{PROCESSING}',((new Date).valueOf()-w.valueOf())+'ms')}}z=null};C();};PSyHi.toolbar={expand:{'class':'expandSource','label':'{LNG_EXPANDSRC}','handler':function(i){var I=i.parentNode.parentNode.childNodes[1];I.style.display=I.style.display=='none'?'':'none';i.className=i.className=='expandSource'?'collapseSource':'expandSource'}},togglelinenumbers:{'class':'toggleLineNumbers','label':'{LNG_LINENUM}','handler':function(i){i=i.parentNode.parentNode.getElementsByTagName('ol')[0];i.className=i.className.match(/(^|\s)noLineNumbers(\s|$)/)?i.className.replace(/(^|\s)noLineNumbers(\s|$)/,""):i.className+" noLineNumbers"}},togglesource:{'class':'toggleSource','label':'{LNG_TOGGLESRC}','handler':function(i){i=i.parentNode.nextSibling;cn=i.className;if(cn.match(/(^|\s)showColorText(\s|$)/)){i.className=cn.replace(/(^|\s)show(ColorText|Copy)(\s|$)/g," showPlainText");}else{i.className=cn.replace(/(^|\s)show(PlainText|Copy)(\s|$)/g," showColorText");}}},clipboardcopy:{'class':'clipboardCopy','label':'{LNG_CLIPBOARD}','handler':function(i){if(window.clipboardData){window.clipboardData.setData('text',I);}else{if(!arguments.callee.fc){arguments.callee.fc=document.createElement('div');document.body.appendChild(arguments.callee.fc);}if(!arguments.callee.tpath)arguments.callee.tpath='/lib/plugins/code/';var I=i.parentNode.parentNode.getElementsByTagName('textarea')[0].value;arguments.callee.fc.innerHTML=''}}},toggleabout:{'class':'toggleAbout','label':'{LNG_ABOUT}','handler':function(i){i=i.parentNode.nextSibling;cn=i.className;if(cn.match(/(^|\s)showCopy(\s|$)/)){i.className=cn.replace(/(^|\s)showCopy(\s|$)/g," showColorText");}else{i.className=cn.replace(/(^|\s)show(Plain|Color)Text(\s|$)/g,"")+" showCopy"}}}};new function(){var i=document.getElementsByTagName("*").length;if(arguments.callee.nodes!=i){arguments.callee.nodes=i;setTimeout(arguments.callee,100);}else{new PSyHi}}; // Copyright (C) 2006 Google Inc. var PR_keywords={};(function(){var i="abstract bool break case catch char class const "+"const_cast continue default delete deprecated dllexport dllimport do "+"double dynamic_cast else enum explicit extern false float for friend "+"goto if inline int long mutable naked namespace new noinline noreturn "+"nothrow novtable operator private property protected public register "+"reinterpret_cast return selectany short signed sizeof static "+"static_cast struct switch template this thread throw true try typedef "+"typeid typename union unsigned using declaration, directive uuid "+"virtual void volatile while typeof";var I="as base by byte checked decimal delegate descending "+"event finally fixed foreach from group implicit in interface internal "+"into is lock null object out override orderby params readonly ref sbyte "+"sealed stackalloc string select uint ulong unchecked unsafe ushort var";var l="package synchronized boolean implements import throws "+"instanceof transient extends final strictfp native super";var o="debugger export function with NaN Infinity";var O="require sub unless until use elsif BEGIN END";var Q="and assert def del elif except exec global lambda "+"not or pass print raise yield False True None";var _="then end begin rescue ensure module when undef next "+"redo retry alias defined";var c="done fi";var C=[i,I,l,o,O,Q,_,c];for(var e=0;e','quot':'"','apos':"'",'amp':'&'};PR_DecodeHelper.prototype.decode=function(i,I){var l=I+1;var o=i.charAt(I);if('&'===o){var O=i.indexOf(';',l);if(O>=0&&O='a'&&i<='z')||(i>='A'&&i<='Z');}function PR_isIdentifierStart(i){return PR_isWordChar(i)||i=='_'||i=='$'||i=='@'}function PR_isIdentifierPart(i){return PR_isIdentifierStart(i)||PR_isDigitChar(i);}function PR_isSpaceChar(i){return"\t \r\n".indexOf(i)>=0}function PR_isDigitChar(i){return i>='0'&&i<='9'}function PR_trim(i){var I=0,l=i.length-1;while(I<=l&&PR_isSpaceChar(i.charAt(I))){++I}while(l>I&&PR_isSpaceChar(i.charAt(l))){--l}return i.substring(I,l+1);}function PR_startsWith(i,I){return i.length>=I.length&&I==i.substring(0,I.length);}function PR_endsWith(i,I){return i.length>=I.length&&I==i.substring(i.length-I.length,i.length);}var REGEXP_PRECEDER_PATTERN=(function(){var i=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=","~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"];var I='(?:'+'(?:(?:^|[^0-9\.])\\.{1,3})|'+'(?:(?:^|[^\\+])\\+)|'+'(?:(?:^|[^\\-])-)';for(var l=0;l:&])/g,'\\$1');}}I+=')\\s*$';return new RegExp(I);})();function PR_prefixMatch(i,I,l){if(I/g,'>').replace(/\"/g,'"').replace(/\xa0/,' ');}function PR_textToHtml(i){return i.replace(/&/g,'&').replace(//g,'>').replace(/\xa0/g,' ');}function PR_isRawContent(i){return'XMP'==i.tagName}var PR_innerHtmlWorks=null;function PR_getInnerHtml(i){if(null==PR_innerHtmlWorks){var I=document.createElement('PRE');I.appendChild(document.createTextNode('\n'));PR_innerHtmlWorks=!/');for(var Q=i.firstChild;Q;Q=Q.nextSibling){PR_normalizedHtml(Q,I);}if(i.firstChild||!/^(?:br|link|img)$/.test(l)){I.push('<\/',l,'>');}break;case 2:I.push(i.name.toLowerCase(),'="',PR_attribToHtml(i.value),'"');break;case 3:case 4:I.push(PR_textToHtml(i.nodeValue));break}}function PR_expandTabs(i,I){var l=' ';var o=0;var O=new PR_DecodeHelper();var Q=[];for(var _=0;_=0;z-=l.length){v.push(l.substring(0,z));}e=O.next;break;case'\n':case'\r':o=0;break;default:++o}}v.push(C.substring(e));Q.push(new PR_Token(v.join(''),c.style));}return Q}function PR_chunkify(i){var I= /(?:[^<]+|<\/?[a-zA-Z][^>]*>|<)/g;var l=i.match(I);var o=[];if(l){var O=null;for(var Q=0,_=l.length;Q<_;++Q){var c=l[Q];var C;if(c.length<2||c.charAt(0)!=='<'){if(O&&O.style===PR_PLAIN){O.token+=c;continue}C=PR_PLAIN}else{C=null}O=new PR_Token(c,C);o.push(O);}}return o}function PR_splitChunks(i,I){var l=[];var o=0;var O=0;var Q=0;var _=new PR_Token('',null);for(var c=0,C=I.length,e=0;c0){l.push(new PR_Token(_.token.substring(Q,_.token.length),null==_.style?null:v.style));}O+=X;Q=0;if(o'==w){l=0;s=PR_DECLARATION}break;case 4:if('-'==w){l=5}break;case 5:if('-'==w){l=6}break;case 6:if('>'==w){l=0;s=PR_COMMENT}else if('-'==w){l=6}else{l=4}break;case 7:if(PR_isWordChar(w)){l=8}else if('<'==w){l=1}else{l=0}break;case 8:if('>'==w){l=0;s=PR_TAG}break;case 9:if('?'==w){l=10}break;case 10:if('>'==w){l=0;s=PR_SOURCE}else if('?'!=w){l=9}break;case 11:if('%'==w){l=12}break;case 12:if('>'==w){l=0;s=PR_SOURCE}else if('%'!=w){l=11}break;case 13:_=0;if(!w.match(/[\r\n]/)){l=0;s=PR_NL;W=z}break}if(_l||l>6){var W=PR_isSpaceChar(w);if(!(_===' '&&W)){if(Q.length>16){Q.shift();}_=W?' ':w;Q.push(_);}}}}O+=v.length}var s;switch(l){case 1:case 2:s=PR_STRING;break;case 4:case 5:case 6:s=PR_COMMENT;break;default:s=PR_PLAIN;break}I.push(new PR_TokenEnd(O,s));return PR_splitChunks(i,I);}function PR_splitNonStringNonCommentToken(i,I){var l=0;var o=0;var O=new PR_DecodeHelper();var Q;for(var _=0;_<=i.length;_=Q){if(_==i.length){C=-2;Q=_+1}else{O.decode(i,_);Q=O.next;var c=O.ch;var C=o;switch(o){case 0:if(PR_isIdentifierStart(c)){C=1}else if(PR_isDigitChar(c)){C=2}else if(c.match(/[\r\n]/)){C=3}else if(!PR_isSpaceChar(c)){C=3}if(C&&l<_){var e=i.substring(l,_);I.push(new PR_Token(e,PR_PLAIN));l=_}break;case 1:if(!PR_isIdentifierPart(c)){C=-1}break;case 2:if(!(PR_isDigitChar(c)||PR_isWordChar(c)||c=='_')){C=-1}break;case 3:if(PR_isIdentifierStart(c)||PR_isDigitChar(c)||PR_isSpaceChar(c)){C=-1}break}}if(C!=o){if(C<0){if(_>l){var e=i.substring(l,_);var v=new PR_DecodeHelper();v.decode(e,0);var V=v.ch;var x=v.next==e.length;var X;if(PR_isIdentifierStart(V)){if(PR_keywords[e]){X=PR_KEYWORD}else if(V==='@'){X=PR_LITERAL}else{var z=false;if(V>='A'&&V<='Z'){for(var Z=v.next;Z='a'&&w<='z'){z=true;break}}if(!z&&!x&&e.substring(e.length-2)=='_t'){z=true}}X=z?PR_TYPE:e==e.toUpperCase()?PR_CONSTANT:PR_PLAIN}}else if(PR_isDigitChar(V)){X=PR_LITERAL}else if(!PR_isSpaceChar(V)){X=PR_PUNCTUATION}else if(V.match(/[\r\n]/)){X=PR_NL}else{X=PR_PLAIN}l=_;I.push(new PR_Token(e,X));}o=0;if(C==-1){Q=_;continue}}o=C}}}function PR_tokenizeMarkup(i){if(!(i&&i.length)){return i}var I=PR_splitMarkup(i);return PR_splitChunks(i,I);}function PR_splitTagAttributes(i){var I=[];var l=0;var o=PR_TAG;var O=null;var Q=new PR_DecodeHelper();for(var _=0;_'){if(PR_TAG!=o){X=v;z=PR_TAG}}else{switch(l){case 0:if('<'==V){l=1}break;case 1:if(PR_isSpaceChar(V)){l=2}break;case 2:if(!PR_isSpaceChar(V)){z=PR_ATTRIB_NAME;X=v;l=3}break;case 3:if('='==V){X=v;z=PR_TAG;l=5}else if(PR_isSpaceChar(V)){X=v;z=PR_TAG;l=4}break;case 4:if('='==V){l=5}else if(!PR_isSpaceChar(V)){X=v;z=PR_ATTRIB_NAME;l=3}break;case 5:if('"'==V||'\''==V){X=v;z=PR_ATTRIB_VALUE;l=6;O=V}else if(!PR_isSpaceChar(V)){X=v;z=PR_ATTRIB_VALUE;l=7}break;case 6:if(V==O){X=x;z=PR_TAG;l=2}break;case 7:if(PR_isSpaceChar(V)){X=v;z=PR_TAG;l=2}break}}if(X){if(X>e){I.push(new PR_Token(C.substring(e,X),o));e=X}o=z}v=x}if(C.length>e){I.push(new PR_Token(C.substring(e,C.length),o));}}else{if(c.style){l=0;o=PR_TAG}I.push(c);}}return I}function PR_splitSourceNodes(i){var I=[];var l=null;var o=new PR_DecodeHelper();var O=null;for(var Q=0,_=i.length;;++Q){var c;if(Q<_){c=i[Q];if(null==c.style){i.push(c);continue}}else if(!l){break}else{c=new PR_Token('',null);}var C=c.token;if(null==l){if(PR_SOURCE==c.style){if('<'==o.decode(C,0)){o.decode(C,o.next);if('%'==o.ch||'?'==o.ch){l=o.ch;I.push(new PR_Token(C.substring(0,o.next),PR_TAG));C=C.substring(o.next,C.length);}}}else if(PR_TAG==c.style){if('<'==o.decode(C,0)&&'/'!=C.charAt(o.next)){var e=C.substring(o.next).toLowerCase();if(PR_startsWith(e,'script')||PR_startsWith(e,'style')||PR_startsWith(e,'xmp')){l='/'}}}}if(null!=l){var v=null;if(PR_SOURCE==c.style){if(l=='%'||l=='?'){var V=C.lastIndexOf(l);if(V>=0&&'>'==o.decode(C,V+1)&&C.length==o.next){v=new PR_Token(C.substring(V,C.length),PR_TAG);C=C.substring(0,V);}}if(null==O){O=[]}O.push(new PR_Token(C,PR_PLAIN));}else if(PR_PLAIN==c.style){if(null==O){O=[]}O.push(c);}else if(PR_TAG==c.style){if('<'==o.decode(c.token,0)&&c.token.length>o.next&&'/'==o.decode(c.token,o.next)){v=c}else{I.push(c);}}else if(Q>=_){v=c}else{if(O){O.push(c);}else{I.push(c);}}if(v){if(O){var x=PR_lexSource(O);I.push(new PR_Token('',null));for(var X=0,z=x.length;X',null));O=null}if(v.token){I.push(v);}l=null}}else{I.push(c);}}return I}function PR_splitAttributeQuotes(i){var I=null,l=null;for(var o=0;o=0;){if(PR_PLAIN==i[o].style){l=o;break}}if(null==I){return i}var O=new PR_DecodeHelper();var Q=i[I].token;var _=O.decode(Q,0);if('"'!=_&&'\''!=_){return i}var c=O.next;var C=i[l].token;var e=C.lastIndexOf('&');if(e<0){e=C.length-1}var v=O.decode(C,e);if(v!=_||O.next!=C.length){v=null;e=C.length}var V=[];for(var o=0;o',null));var e=PR_lexSource(PR_splitAttributeQuotes(l));for(var v=0,V=e.length;v',null));l=null}}else if(O&&c.token.indexOf('=')>=0){var x=O.toLowerCase();if(PR_startsWith(x,'on')||'style'==x){o=true}}else{O=''}}else if(PR_ATTRIB_NAME==c.style){O+=c.token}else if(PR_ATTRIB_VALUE==c.style){if(o){if(null==l){l=[]}C=l;c=new PR_Token(c.token,PR_PLAIN);}}else{if(l){C=l}}C.push(c);}return I}function PR_lexSource(i){var I=PR_splitStringAndCommentTokens(i);var l=[];for(var o=0;o=0;){if(PR_PLAIN==I[O].style){l=PR_endsWith(PR_trim(I[O].token),'>');break}}}break}}return l?PR_lexMarkup(I):PR_lexSource(I);}