📄 highlighter.js
字号:
Highlighter.Brushes.ActionScript = function(){
var keywords = 'break call continue delete do duplicateMovieClip else for function if in include loadVariablesNum printNum removeMovieClip return setProperty startDrag stopDrag trace var while with';
var objects = 'fscommand\\b|#include getURL gotoAndPlay gotoAndStop ifFrameLoaded loadMovieNum on onClipEvent play stop stopAllSounds tellTarget toggleHighQuality unloadMovieNum';
var properties = 'align\\b|_(parent|root|alpha|currentframe|droptarget|focusrect|framesloaded|height|highquality|name|quality|rotation|soundbuftime|target|totalframes|url|width|visible|x|xmouse|xscale|y|ymouse|yscale) autoSize background backgroundColor border borderColor bold bottomScroll blockIndent bullet color embedFonts font hscroll html htmlText indent italic leading leftMargin maxChars maxhsscroll multiline password rightMargin selectable size tabEnabled tabIndex tabStops target text textColor textHeight textWidth type underline url variable wordWrap';
var events = 'data dragOut dragOver enterFrame keyPress load onClose onConnect onLoad onXML press release releaseOutside rollOut rollOver';
var functions = 'abs acos add addListener and appendChild asin atan atan2 attachMovie attachSound attributes ceil charAt charCodeAt childNodes chr cloneNode close concat connect constructor cos createElement createEmptyMovieClip createTextNode createTextField docTypeDecl eq escape eval evaluate exp false firstChild floor fromCharCode ge getAscii getBeginIndex getBounds getBytesLoaded getBytesTotal getCaretIndex getCode getDate getDay getDepth getEndIndex getFocus getFontList getFullYear getHours getMilliseconds getMinutes getMonth getNewTextFormat getPan getProperty getRGB getSeconds getTextExtent getTime getTimer getTimezoneOffset getTransform getUTCDate getUTCDay getUTCFullYear getUTCHours getUTCMilliseconds getUTCMinutes getUTCMonth getUTCSeconds getVersion getVolume getYear globalToLocal gt hasChildNodes hide hitTest indexOf insertBefore int isDown isFinite isNaN isToggled join lastChild lastIndexOf le length loaded loadMovie loadVariables localToGlobal log lt max maxscroll mbchr mblength mbord mbsubstring min mouseDown mouseUp ne new newline nextFrame nextScene nextSibling nodeName nodeType nodeValue not null number onReleaseOutside onDragOut onDragOver onRollOut onRollOver onRelease onPress or ord parentNode parseFloat parseInt parseXML pop pow prevFrame previousSibling prevScene print printAsBitmap push random removeNode reverse round removeListener removeTextField replaceSel restrict scroll scrollString send sendAndLoad set setDate setFocus setFullYear setHours setMilliseconds setMinutes setMonth setPan setRGB setSeconds setSelection setTextFormat setTime setTransform setUTCDate setUTCFullYear setUTCHours setUTCMilliseconds setUTCMinutes setUTCMonth setUTCSeconds setVolume setYear shift show sin slice sort splice split sqrt start status substr substring swapDepths tan targetPath this toLowerCase toString toUpperCase true typeof unescape unloadMovie unshift updateAfterEvent valueOf void xmlDecl';
var objects = 'Array Boolean Color Date Key Math Mouse MovieClip Number Object Selection Sound String TextFormat XML XMLSocket';
var constants = 'BACKSPACE CAPSLOCK CONTROL DELETEKEY DOWN END ENTER ESCAPE HOME INSERT LEFT LN10 LN2 LOG10E LOG2E MAX_VALUE MIN_VALUE NaN NEGATIVE_INFINITY PGDN PGUP PI POSITIVE_INFINITY RIGHT SHIFT SPACE SQRT1_2 SQRT2 TAB UP UTC';
this.regexList = [
{ regex: Highlighter.RegexLib.MultiLineCComments, css: 'color:#008080' },
{ regex: Highlighter.RegexLib.SingleLineCComments, css: 'color:#008080' },
{ regex: Highlighter.RegexLib.DoubleQuotedString, css: 'color:#990000' },
{ regex: Highlighter.RegexLib.SingleQuotedString, css: 'color:#990000' },
{ regex: new RegExp(this.GetKeywords(objects), 'gm'), css: 'color:red' },
{ regex: new RegExp(this.GetKeywords(properties), 'gm'), css: 'color:#FF8000' },
{ regex: new RegExp(this.GetKeywords(events), 'gm'), css: 'color:#008000' },
{ regex: new RegExp(this.GetKeywords(functions), 'gm'), css: 'color:#ff1493' },
{ regex: new RegExp(this.GetKeywords(constants), 'gm'), css: 'color:#008284' },
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'color:blue' }
];
}
Highlighter.Brushes.ActionScript.prototype = new Highlighter.Brushe();
Highlighter.Brushes.ActionScript.Aliases = ['as', 'ascript', 'actionscript'];
Highlighter.Brushes.Php = function(){
var funcs = 'abs acos acosh addcslashes addslashes array_change_key_case array_chunk array_combine array_count_values array_diff array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill array_filter array_flip array_intersect array_intersect_assoc array_intersect_key array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map array_merge array_merge_recursive array_multisort array_pad array_pop array_product array_push array_rand array_reduce array_reverse array_search array_shift array_slice array_splice array_sum array_udiff array_udiff_assoc array_udiff_uassoc array_uintersect array_uintersect_assoc array_uintersect_uassoc array_unique array_unshift array_values array_walk array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists closedir closelog copy cos cosh count count_chars date decbin dechex decoct deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br parse_ini_file parse_str parse_url passthru pathinfo readlink realpath rewind rewinddir rmdir round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime strtoupper strtr strval substr substr_compare';
var keywords = 'and or xor __FILE__ __LINE__ array as break case cfunction class const continue declare default die do else elseif empty enddeclare endfor endforeach endif endswitch endwhile extends for foreach function include include_once global if new old_function return static switch use require require_once var while __FUNCTION__ __CLASS__ __METHOD__ abstract interface public implements extends private protected throw';
var operators = 'AND new not OR XOR';
this.regexList = [
{ regex: Highlighter.RegexLib.MultiLineCComments, css: 'color:#008080' },
{ regex: Highlighter.RegexLib.SingleLineCComments, css: 'color:#008080' },
{ regex: Highlighter.RegexLib.DoubleQuotedString, css: 'color:#990000' },
{ regex: Highlighter.RegexLib.SingleQuotedString, css: 'color:#990000' },
{ regex: new RegExp('\\$\\w+', 'g'), css: 'color:red' },
{ regex: new RegExp(this.GetKeywords(funcs), 'gmi'), css: 'color:#FF8000' },
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'color:blue' },
{ regex: new RegExp(this.GetKeywords(operators), 'gm'), css: 'color:#008000' }
];
}
Highlighter.Brushes.Php.prototype = new Highlighter.Brushe();
Highlighter.Brushes.Php.Aliases = ['php','php4'];
Highlighter.Brushes.Python = function(){
var keywords = 'and assert break class continue def del elif else except exec finally for from global if import in is lambda not or pass print raise return try yield while';
var special = 'None True False self cls class_'
this.regexList = [
{ regex: Highlighter.RegexLib.SingleLinePerlComments, css: 'color:#008080' },
{ regex: new RegExp("^\\s*@\\w+", 'gm'), css: 'color:#ff1493' },
{ regex: new RegExp("(['\"]{3})([^\\1])*?\\1", 'gm'), css: 'color:#FF8000' },
{ regex: new RegExp('"(?!")(?:\\.|\\\\\\"|[^\\""\\n\\r])*"', 'gm'), css: 'color:#990000' },
{ regex: new RegExp("'(?!')*(?:\\.|(\\\\\\')|[^\\''\\n\\r])*'", 'gm'), css: 'color:#990000' },
{ regex: new RegExp("\\b\\d+\\.?\\w*", 'g'), css: 'color:red' },
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'color:blue' },
{ regex: new RegExp(this.GetKeywords(special), 'gm'), css: 'color:#8A2BE2' }
];
}
Highlighter.Brushes.Python.prototype = new Highlighter.Brushe();
Highlighter.Brushes.Python.Aliases = ['py', 'python'];
Highlighter.Brushes.Ruby = function(){
var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif END end ensure false for if in module new next nil not or raise redo rescue retry return self super then throw true undef unless until when while yield';
var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ThreadGroup Thread Time TrueClass'
this.regexList = [
{ regex: Highlighter.RegexLib.SingleLinePerlComments, css: 'color:#008080' },
{ regex: Highlighter.RegexLib.DoubleQuotedString, css: 'color:#990000' },
{ regex: Highlighter.RegexLib.SingleQuotedString, css: 'color:#990000' },
{ regex: new RegExp(':[a-z][A-Za-z0-9_]*', 'g'), css: 'color:#aa7700' },
{ regex: new RegExp('(\\$|@@|@)\\w+', 'g'), css: 'color:#aa7700' },
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'color:blue' },
{ regex: new RegExp(this.GetKeywords(builtins), 'gm'), css: 'color:red' }
];
}
Highlighter.Brushes.Ruby.prototype = new Highlighter.Brushe();
Highlighter.Brushes.Ruby.Aliases = ['rb', 'ruby', 'rails', 'ror'];
Highlighter.Brushes.Perl = function(){
var keywords = 'while\\b|\\s+\\-A\\b|\\s+\\-B\\b|\\s+\\-C\\b|\\s+\\-M\\b|\\s+\\-O\\b|\\s+\\-R\\b|\\s+\\-S\\b|\\s+\\-T\\b|\\s+\\-W\\b|\\s+\\-X\\b|\\s+\\-b\\b|\\s+\\-c\\b|\\s+\\-d\\b|\\s+\\-e\\b|\\s+\\-f\\b|\\s+\\-g\\b|\\s+\\-k\\b|\\s+\\-l\\b|\\s+\\-o\\b|\\s+\\-p\\b|\\s+\\-r\\b|\\s+\\-s\\b|\\s+\\-t\\b|\\s+\\-u\\b|\\s+\\-w\\b|\\s+\\-x\\b|\\s+\\-z\\b|\\s+__DATA__\\S+|\\s+__END__\\S+|\\s+__FILE__\\S+|\\s+__LINE__\\s+|\\bcontinue do else elsif for foreach goto if last local my next no our package redo return require sub until unless use';
var methods = 'accept alarm atan2 bind binmode bless caller chdir chmod chomp chop chown chr chroot close closedir connect cos crypt dbmclose dbmopen defined delete die dump each endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exit exp exists fcntl fileno flock fork formline format getc getgrent getgrgid getgrname gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt glob gmtime grep hex index int ioctl join keys kill lc lcfirst length link listen localtime log lstat map mkdir msgctl msgget msgrcv msgsnd new oct open opendir ord pack pipe pop pos print printf push quotemeta rand read readdir readline readlink recv ref rename reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl semgett semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat study substr symlink syscall sysopen sysread system syswrite tell telldir tie tied time times truncate uc ucfirst umask undef unlink unpack unshift utime values vec wait waitpid wantarray warn write';
var operators = 'AUTOLOAD and BEGIN CORE DESTROY eq END ge gt le lt ne not m or q qq qw qx SUPER s tr UNIVERSAL x xor y';
this.regexList = [
{ regex: Highlighter.RegexLib.SingleLinePerlComments, css: 'color:#008080' },
{ regex: Highlighter.RegexLib.DoubleQuotedString, css: 'color:#990000' },
{ regex: Highlighter.RegexLib.SingleQuotedString, css: 'color:#990000' },
{ regex: new RegExp('\\$\\w+', 'g'), css: 'color:red' },
{ regex: new RegExp(this.GetKeywords(methods), 'gm'), css: 'color:#FF8000' },
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'color:blue' },
{ regex: new RegExp(this.GetKeywords(operators), 'gm'), css: 'color:008000' }
];
}
Highlighter.Brushes.Perl.prototype = new Highlighter.Brushe();
Highlighter.Brushes.Perl.Aliases = ['pl', 'cgi', 'pm', 'plx', 'perl'];
Highlighter.Brushes.Assembly = function(){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -