| CODENOTIFIER | HelpYou are not signed inSign in |
Project: gwt-ext
Revision: 1813
Author: mlim1972
Date: 30 Aug 2008 16:15:44
Changes:Issue 400. Added the SyntaxHighligterPanel
Files:| ... | ...@@ -0,0 +1,10 @@ | |
| 1 | /* | |
| 2 | * JsMin | |
| 3 | * Javascript Compressor | |
| 4 | * http://www.crockford.com/ | |
| 5 | * http://www.smallsharptools.com/ | |
| 6 | */ | |
| 7 | ||
| 8 | dp.sh.Brushes.Delphi=function() | |
| 9 | {var keywords='abs addr and ansichar ansistring array as asm begin boolean byte cardinal '+'case char class comp const constructor currency destructor div do double '+'downto else end except exports extended false file finalization finally '+'for function goto if implementation in inherited int64 initialization '+'integer interface is label library longint longword mod nil not object '+'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended '+'pint64 pointer private procedure program property pshortstring pstring '+'pvariant pwidechar pwidestring protected public published raise real real48 '+'record repeat set shl shortint shortstring shr single smallint string then '+'threadvar to true try type unit until uses val var varirnt while widechar '+'widestring with word write writeln xor';this.regexList=[{regex:new RegExp('\\(\\*[\\s\\S]*?\\*\\)','gm'),css:'comment'},{regex:new RegExp('{(?!\\$)[\\s\\S]*?}','gm'),css:'comment'},{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('\\{\\$[a-zA-Z]+ .+\\}','g'),css:'directive'},{regex:new RegExp('\\b[\\d\\.]+\\b','g'),css:'number'},{regex:new RegExp('\\$[a-zA-Z0-9]+\\b','g'),css:'number'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-delphi';this.Style='.dp-delphi .number { color: blue; }'+'.dp-delphi .directive { color: #008284; }'+'.dp-delphi .vars { color: #000; }';} | |
| 10 | dp.sh.Brushes.Delphi.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Delphi.Aliases=['delphi','pascal']; |
| ... | ...@@ -0,0 +1,10 @@ | |
| 1 | /* | |
| 2 | * JsMin | |
| 3 | * Javascript Compressor | |
| 4 | * http://www.crockford.com/ | |
| 5 | * http://www.smallsharptools.com/ | |
| 6 | */ | |
| 7 | ||
| 8 | dp.sh.Brushes.Vb=function() | |
| 9 | {var keywords='AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto '+'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate '+'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType '+'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each '+'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend '+'Function Get GetType GoSub GoTo Handles If Implements Imports In '+'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module '+'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing '+'NotInheritable NotOverridable Object On Option Optional Or OrElse '+'Overloads Overridable Overrides ParamArray Preserve Private Property '+'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume '+'Return Select Set Shadows Shared Short Single Static Step Stop String '+'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until '+'Variant When While With WithEvents WriteOnly Xor';this.regexList=[{regex:new RegExp('\'.*$','gm'),css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:new RegExp('^\\s*#.*','gm'),css:'preprocessor'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-vb';} | |
| 10 | dp.sh.Brushes.Vb.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Vb.Aliases=['vb','vb.net']; |
| ... | ...@@ -7,6 +7,7 @@ | |
| 7 | 7 | <inherits name="com.google.gwt.user.History"/> |
| 8 | 8 | <inherits name="com.google.gwt.i18n.I18N"/> |
| 9 | 9 | <inherits name="com.gwtext.Pagebus"/> |
| 10 | <inherits name="com.gwtext.SyntaxHighlighter"/> | |
| 10 | 11 | |
| 11 | 12 | <entry-point class='com.gwtext.sample.showcase2.client.Showcase2'/> |
| 12 | 13 |
| ... | ...@@ -0,0 +1,10 @@ | |
| 1 | /* | |
| 2 | * JsMin | |
| 3 | * Javascript Compressor | |
| 4 | * http://www.crockford.com/ | |
| 5 | * http://www.smallsharptools.com/ | |
| 6 | */ | |
| 7 | ||
| 8 | dp.sh.Brushes.JScript=function() | |
| 9 | {var keywords='abstract boolean break byte case catch char class const continue debugger '+'default delete do double else enum export extends false final finally float '+'for function goto if implements import in instanceof int interface long native '+'new null package private protected public return short static super switch '+'synchronized this throw throws transient true try typeof var void volatile while with';this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('^\\s*#.*','gm'),css:'preprocessor'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-c';} | |
| 10 | dp.sh.Brushes.JScript.prototype=new dp.sh.Highlighter();dp.sh.Brushes.JScript.Aliases=['js','jscript','javascript']; |
| ... | ...@@ -0,0 +1,10 @@ | |
| 1 | /* | |
| 2 | * JsMin | |
| 3 | * Javascript Compressor | |
| 4 | * http://www.crockford.com/ | |
| 5 | * http://www.smallsharptools.com/ | |
| 6 | */ | |
| 7 | ||
| 8 | dp.sh.Brushes.CSharp=function() | |
| 9 | {var keywords='abstract as base bool break byte case catch char checked class const '+'continue decimal default delegate do double else enum event explicit '+'extern false finally fixed float for foreach get goto if implicit in int '+'interface internal is lock long namespace new null object operator out '+'override params private protected public readonly ref return sbyte sealed set '+'short sizeof stackalloc static string struct switch this throw true try '+'typeof uint ulong unchecked unsafe ushort using virtual void while';this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('^\\s*#.*','gm'),css:'preprocessor'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-c';this.Style='.dp-c .vars { color: #d00; }';} | |
| 10 | dp.sh.Brushes.CSharp.prototype=new dp.sh.Highlighter();dp.sh.Brushes.CSharp.Aliases=['c#','c-sharp','csharp']; |
| ... | ...@@ -0,0 +1,10 @@ | |
| 1 | /* | |
| 2 | * JsMin | |
| 3 | * Javascript Compressor | |
| 4 | * http://www.crockford.com/ | |
| 5 | * http://www.smallsharptools.com/ | |
| 6 | */ | |
| 7 | ||
| 8 | dp.sh.Brushes.Java=function() | |
| 9 | {var keywords='abstract assert boolean break byte case catch char class const '+'continue default do double else enum extends '+'false final finally float for goto if implements import '+'instanceof int interface long native new null '+'package private protected public return '+'short static strictfp super switch synchronized this throw throws true '+'transient try void volatile while';this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b','gi'),css:'number'},{regex:new RegExp('(?!\\@interface\\b)\\@[\\$\\w]+\\b','g'),css:'annotation'},{regex:new RegExp('\\@interface\\b','g'),css:'keyword'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-j';this.Style='.dp-j .annotation { color: #646464; }'+'.dp-j .number { color: #C00000; }';} | |
| 10 | dp.sh.Brushes.Java.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Java.Aliases=['java']; |
| ... | ...@@ -0,0 +1,11 @@ | |
| 1 | /* | |
| 2 | * JsMin | |
| 3 | * Javascript Compressor | |
| 4 | * http://www.crockford.com/ | |
| 5 | * http://www.smallsharptools.com/ | |
| 6 | */ | |
| 7 | ||
| 8 | dp.sh.Brushes.Python=function() | |
| 9 | {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_' | |
| 10 | this.regexList=[{regex:dp.sh.RegexLib.SingleLinePerlComments,css:'comment'},{regex:new RegExp("^\\s*@\\w+",'gm'),css:'decorator'},{regex:new RegExp("(['\"]{3})([^\\1])*?\\1",'gm'),css:'comment'},{regex:new RegExp('"(?!")(?:\\.|\\\\\\"|[^\\""\\n\\r])*"','gm'),css:'string'},{regex:new RegExp("'(?!')*(?:\\.|(\\\\\\')|[^\\''\\n\\r])*'",'gm'),css:'string'},{regex:new RegExp("\\b\\d+\\.?\\w*",'g'),css:'number'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'},{regex:new RegExp(this.GetKeywords(special),'gm'),css:'special'}];this.CssClass='dp-py';this.Style='.dp-py .builtins { color: #ff1493; }'+'.dp-py .magicmethods { color: #808080; }'+'.dp-py .exceptions { color: brown; }'+'.dp-py .types { color: brown; font-style: italic; }'+'.dp-py .commonlibs { color: #8A2BE2; font-style: italic; }';} | |
| 11 | dp.sh.Brushes.Python.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Python.Aliases=['py','python']; |
| ... | ...@@ -0,0 +1,11 @@ | |
| 1 | /* | |
| 2 | * JsMin | |
| 3 | * Javascript Compressor | |
| 4 | * http://www.crockford.com/ | |
| 5 | * http://www.smallsharptools.com/ | |
| 6 | */ | |
| 7 | ||
| 8 | dp.sh.Brushes.Ruby=function() | |
| 9 | {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' | |
| 10 | this.regexList=[{regex:dp.sh.RegexLib.SingleLinePerlComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp(':[a-z][A-Za-z0-9_]*','g'),css:'symbol'},{regex:new RegExp('(\\$|@@|@)\\w+','g'),css:'variable'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'},{regex:new RegExp(this.GetKeywords(builtins),'gm'),css:'builtin'}];this.CssClass='dp-rb';this.Style='.dp-rb .symbol { color: #a70; }'+'.dp-rb .variable { color: #a70; font-weight: bold; }';} | |
| 11 | dp.sh.Brushes.Ruby.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Ruby.Aliases=['ruby','rails','ror']; |
| ... | ...@@ -0,0 +1,10 @@ | |
| 1 | /* | |
| 2 | * JsMin | |
| 3 | * Javascript Compressor | |
| 4 | * http://www.crockford.com/ | |
| 5 | * http://www.smallsharptools.com/ | |
| 6 | */ | |
| 7 | ||
| 8 | dp.sh.Brushes.Cpp=function() | |
| 9 | {var datatypes='ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR '+'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH '+'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP '+'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY '+'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT '+'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE '+'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF '+'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR '+'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR '+'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT '+'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 '+'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR '+'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 '+'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT '+'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG '+'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM '+'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t '+'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS '+'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t '+'__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t '+'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler '+'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function '+'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf '+'va_list wchar_t wctrans_t wctype_t wint_t signed';var keywords='break case catch class const __finally __exception __try '+'const_cast continue private public protected __declspec '+'default delete deprecated dllexport dllimport do dynamic_cast '+'else enum explicit extern if for friend goto inline '+'mutable naked namespace new noinline noreturn nothrow '+'register reinterpret_cast return selectany '+'sizeof static static_cast struct switch template this '+'thread throw true false try typedef typeid typename union '+'using uuid virtual void volatile whcar_t while';this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('^ *#.*','gm'),css:'preprocessor'},{regex:new RegExp(this.GetKeywords(datatypes),'gm'),css:'datatypes'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-cpp';this.Style='.dp-cpp .datatypes { color: #2E8B57; font-weight: bold; }';} | |
| 10 | dp.sh.Brushes.Cpp.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Cpp.Aliases=['cpp','c','c++']; |
| ... | ...@@ -0,0 +1,185 @@ | |
| 1 | .dp-highlighter | |
| 2 | { | |
| 3 | font-family: "Consolas", "Courier New", Courier, mono, serif; | |
| 4 | font-size: 12px; | |
| 5 | background-color: #E7E5DC; | |
| 6 | width: 99%; | |
| 7 | overflow: auto; | |
| 8 | margin: 18px 0 18px 0 !important; | |
| 9 | padding-top: 1px; /* adds a little border on top when controls are hidden */ | |
| 10 | } | |
| 11 | ||
| 12 | /* clear styles */ | |
| 13 | .dp-highlighter ol, | |
| 14 | .dp-highlighter ol li, | |
| 15 | .dp-highlighter ol li span | |
| 16 | { | |
| 17 | margin: 0; | |
| 18 | padding: 0; | |
| 19 | border: none; | |
| 20 | } | |
| 21 | ||
| 22 | .dp-highlighter a, | |
| 23 | .dp-highlighter a:hover | |
| 24 | { | |
| 25 | background: none; | |
| 26 | border: none; | |
| 27 | padding: 0; | |
| 28 | margin: 0; | |
| 29 | } | |
| 30 | ||
| 31 | .dp-highlighter .bar | |
| 32 | { | |
| 33 | padding-left: 45px; | |
| 34 | } | |
| 35 | ||
| 36 | .dp-highlighter.collapsed .bar, | |
| 37 | .dp-highlighter.nogutter .bar | |
| 38 | { | |
| 39 | padding-left: 0px; | |
| 40 | } | |
| 41 | ||
| 42 | .dp-highlighter ol | |
| 43 | { | |
| 44 | list-style: decimal; /* for ie */ | |
| 45 | background-color: #fff; | |
| 46 | margin: 0px 0px 1px 45px !important; /* 1px bottom margin seems to fix occasional Firefox scrolling */ | |
| 47 | padding: 0px; | |
| 48 | color: #5C5C5C; | |
| 49 | } | |
| 50 | ||
| 51 | .dp-highlighter.nogutter ol, | |
| 52 | .dp-highlighter.nogutter ol li | |
| 53 | { | |
| 54 | list-style: none !important; | |
| 55 | margin-left: 0px !important; | |
| 56 | } | |
| 57 | ||
| 58 | .dp-highlighter ol li, | |
| 59 | .dp-highlighter .columns div | |
| 60 | { | |
| 61 | list-style: decimal-leading-zero; /* better look for others, override cascade from OL */ | |
| 62 | list-style-position: outside !important; | |
| 63 | border-left: 3px solid #6CE26C; | |
| 64 | background-color: #F8F8F8; | |
| 65 | color: #5C5C5C; | |
| 66 | padding: 0 3px 0 10px !important; | |
| 67 | margin: 0 !important; | |
| 68 | line-height: 14px; | |
| 69 | } | |
| 70 | ||
| 71 | .dp-highlighter.nogutter ol li, | |
| 72 | .dp-highlighter.nogutter .columns div | |
| 73 | { | |
| 74 | border: 0; | |
| 75 | } | |
| 76 | ||
| 77 | .dp-highlighter .columns | |
| 78 | { | |
| 79 | background-color: #F8F8F8; | |
| 80 | color: gray; | |
| 81 | overflow: hidden; | |
| 82 | width: 100%; | |
| 83 | } | |
| 84 | ||
| 85 | .dp-highlighter .columns div | |
| 86 | { | |
| 87 | padding-bottom: 5px; | |
| 88 | } | |
| 89 | ||
| 90 | .dp-highlighter ol li.alt | |
| 91 | { | |
| 92 | background-color: #FFF; | |
| 93 | color: inherit; | |
| 94 | } | |
| 95 | ||
| 96 | .dp-highlighter ol li span | |
| 97 | { | |
| 98 | color: black; | |
| 99 | background-color: inherit; | |
| 100 | } | |
| 101 | ||
| 102 | /* Adjust some properties when collapsed */ | |
| 103 | ||
| 104 | .dp-highlighter.collapsed ol | |
| 105 | { | |
| 106 | margin: 0px; | |
| 107 | } | |
| 108 | ||
| 109 | .dp-highlighter.collapsed ol li | |
| 110 | { | |
| 111 | display: none; | |
| 112 | } | |
| 113 | ||
| 114 | /* Additional modifications when in print-view */ | |
| 115 | ||
| 116 | .dp-highlighter.printing | |
| 117 | { | |
| 118 | border: none; | |
| 119 | } | |
| 120 | ||
| 121 | .dp-highlighter.printing .tools | |
| 122 | { | |
| 123 | display: none !important; | |
| 124 | } | |
| 125 | ||
| 126 | .dp-highlighter.printing li | |
| 127 | { | |
| 128 | display: list-item !important; | |
| 129 | } | |
| 130 | ||
| 131 | /* Styles for the tools */ | |
| 132 | ||
| 133 | .dp-highlighter .tools | |
| 134 | { | |
| 135 | padding: 3px 8px 3px 10px; | |
| 136 | font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif; | |
| 137 | color: silver; | |
| 138 | background-color: #f8f8f8; | |
| 139 | padding-bottom: 10px; | |
| 140 | border-left: 3px solid #6CE26C; | |
| 141 | } | |
| 142 | ||
| 143 | .dp-highlighter.nogutter .tools | |
| 144 | { | |
| 145 | border-left: 0; | |
| 146 | } | |
| 147 | ||
| 148 | .dp-highlighter.collapsed .tools | |
| 149 | { | |
| 150 | border-bottom: 0; | |
| 151 | } | |
| 152 | ||
| 153 | .dp-highlighter .tools a | |
| 154 | { | |
| 155 | font-size: 9px; | |
| 156 | color: #a0a0a0; | |
| 157 | background-color: inherit; | |
| 158 | text-decoration: none; | |
| 159 | margin-right: 10px; | |
| 160 | } | |
| 161 | ||
| 162 | .dp-highlighter .tools a:hover | |
| 163 | { | |
| 164 | color: red; | |
| 165 | background-color: inherit; | |
| 166 | text-decoration: underline; | |
| 167 | } | |
| 168 | ||
| 169 | /* About dialog styles */ | |
| 170 | ||
| 171 | .dp-about { background-color: #fff; color: #333; margin: 0px; padding: 0px; } | |
| 172 | .dp-about table { width: 100%; height: 100%; font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; } | |
| 173 | .dp-about td { padding: 10px; vertical-align: top; } | |
| 174 | .dp-about .copy { border-bottom: 1px solid #ACA899; height: 95%; } | |
| 175 | .dp-about .title { color: red; background-color: inherit; font-weight: bold; } | |
| 176 | .dp-about .para { margin: 0 0 4px 0; } | |
| 177 | .dp-about .footer { background-color: #ECEADB; color: #333; border-top: 1px solid #fff; text-align: right; } | |
| 178 | .dp-about .close { font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; background-color: #ECEADB; color: #333; width: 60px; height: 22px; } | |
| 179 | ||
| 180 | /* Language specific styles */ | |
| 181 | ||
| 182 | .dp-highlighter .comment, .dp-highlighter .comments { color: #008200; background-color: inherit; } | |
| 183 | .dp-highlighter .string { color: blue; background-color: inherit; } | |
| 184 | .dp-highlighter .keyword { color: #069; font-weight: bold; background-color: inherit; } | |
| 185 | .dp-highlighter .preprocessor { color: gray; background-color: inherit; } |
| ... | ...@@ -0,0 +1,213 @@ | |
| 1 | /* | |
| 2 | * GWT-Ext Widget Library | |
| 3 | * Copyright 2007 - 2008, GWT-Ext LLC., and individual contributors as indicated | |
| 4 | * by the @authors tag. See the copyright.txt in the distribution for a | |
| 5 | * full listing of individual contributors. | |
| 6 | * | |
| 7 | * This is free software; you can redistribute it and/or modify it | |
| 8 | * under the terms of the GNU Lesser General Public License as | |
| 9 | * published by the Free Software Foundation; either version 3 of | |
| 10 | * the License, or (at your option) any later version. | |
| 11 | * | |
| 12 | * This software is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 15 | * Lesser General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU Lesser General Public | |
| 18 | * License along with this software; if not, write to the Free | |
| 19 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
| 20 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
| 21 | */ | |
| 22 | package com.gwtext.client.widgets; | |
| 23 | ||
| 24 | import com.google.gwt.core.client.JavaScriptObject; | |
| 25 | import com.google.gwt.user.client.Command; | |
| 26 | import com.google.gwt.user.client.DeferredCommand; | |
| 27 | import com.gwtext.client.core.Ext; | |
| 28 | import com.gwtext.client.core.Function; | |
| 29 | import com.gwtext.client.widgets.HTMLPanel; | |
| 30 | ||
| 31 | /** | |
| 32 | * This class creates a Syntax Highlight panel for different | |
| 33 | * languages, XML, and HTML for displaying. This class | |
| 34 | * uses the syntaxhighlighter library found at: | |
| 35 | * http://code.google.com/p/syntaxhighlighter/ | |
| 36 | * | |
| 37 | * @author Mario Lim | |
| 38 | * | |
| 39 | */ | |
| 40 | public class SyntaxHighlightPanel extends HTMLPanel { | |
| 41 | public static final String SYNTAX_CPP = "cpp"; | |
| 42 | public static final String SYNTAX_CSHARP = "csharp"; | |
| 43 | public static final String SYNTAX_CSS = "css"; | |
| 44 | public static final String SYNTAX_PASCAL = "pascal"; | |
| 45 | public static final String SYNTAX_DELPHI = "pascal"; | |
| 46 | public static final String SYNTAX_JAVA = "java"; | |
| 47 | public static final String SYNTAX_JAVASCRIPT = "javascript"; | |
| 48 | public static final String SYNTAX_PHP = "php"; | |
| 49 | public static final String SYNTAX_PYTHON = "python"; | |
| 50 | public static final String SYNTAX_RUBY = "ruby"; | |
| 51 | public static final String SYNTAX_SQL = "sql"; | |
| 52 | public static final String SYNTAX_VB = "vb"; | |
| 53 | public static final String SYNTAX_XML = "xml"; | |
| 54 | public static final String SYNTAX_HTML = "html"; | |
| 55 | ||
| 56 | private String name = "sh_" + Ext.generateId(); | |
| 57 | private String html = null; | |
| 58 | private String syntaxType = SYNTAX_XML; | |
| 59 | ||
| 60 | private boolean showGutter = true; | |
| 61 | private boolean showControls = true; | |
| 62 | private boolean collapseAll = false; | |
| 63 | private int firstLine = 1; | |
| 64 | private boolean showColumns = true; | |
| 65 | ||
| 66 | ||
| 67 | /** | |
| 68 | * Create a new SyntaxHighlightPanel. | |
| 69 | */ | |
| 70 | public SyntaxHighlightPanel() { | |
| 71 | setBorder(true); | |
| 72 | } | |
| 73 | ||
| 74 | /** | |
| 75 | * Create a new SyntaxHighlightPanel. | |
| 76 | * | |
| 77 | * @param code the code to show in the panel | |
| 78 | * @param syntaxType is one of the available types: | |
| 79 | * <ul> | |
| 80 | * <li>SyntaxHighlightPanel.SYNTAX_CPP</li> | |
| 81 | * <li>SyntaxHighlightPanel.SYNTAX_CSHARP</li> | |
| 82 | * <li>SyntaxHighlightPanel.SYNTAX_CSS</li> | |
| 83 | * <li>SyntaxHighlightPanel.SYNTAX_PASCAL</li> | |
| 84 | * <li>SyntaxHighlightPanel.SYNTAX_DELPHI</li> | |
| 85 | * <li>SyntaxHighlightPanel.SYNTAX_JAVA</li> | |
| 86 | * <li>SyntaxHighlightPanel.SYNTAX_JAVASCRIPT</li> | |
| 87 | * <li>SyntaxHighlightPanel.SYNTAX_PHP</li> | |
| 88 | * <li>SyntaxHighlightPanel.SYNTAX_PYTHON</li> | |
| 89 | * <li>SyntaxHighlightPanel.SYNTAX_RUBY</li> | |
| 90 | * <li>SyntaxHighlightPanel.SYNTAX_SQL</li> | |
| 91 | * <li>SyntaxHighlightPanel.SYNTAX_VB</li> | |
| 92 | * <li>SyntaxHighlightPanel.SYNTAX_XML</li> | |
| 93 | * <li>SyntaxHighlightPanel.SYNTAX_HTML</li> | |
| 94 | * </ul> | |
| 95 | */ | |
| 96 | public SyntaxHighlightPanel(String code, String syntaxType) { | |
| 97 | setBorder(true); | |
| 98 | setHtml(code); | |
| 99 | this.syntaxType = syntaxType; | |
| 100 | } | |
| 101 | ||
| 102 | /** | |
| 103 | * sets the code to the SyntaxHighlightPanel. This is the code | |
| 104 | * that will be displayed in the panel | |
| 105 | * @param code is the code to display in the panel | |
| 106 | */ | |
| 107 | public void setHtml(String code){ | |
| 108 | this.html = code; | |
| 109 | ||
| 110 | addListener("render", new Function(){ | |
| 111 | public void execute() { | |
| 112 | setSuperHtml(setSyntaxHighlight()); | |
| 113 | DeferredCommand.addCommand(new Command(){ | |
| 114 | public void execute() { | |
| 115 | executeSh(name, showGutter, showControls, collapseAll, firstLine, showColumns); | |
| 116 | } | |
| 117 | }); | |
| 118 | } | |
| 119 | }); | |
| 120 | } | |
| 121 | ||
| 122 | /** | |
| 123 | * used internally to call the super method for setHtml... | |
| 124 | * @param html the html to set for the panel | |
| 125 | */ | |
| 126 | private void setSuperHtml(String html){ | |
| 127 | super.setHtml(html); | |
| 128 | } | |
| 129 | ||
| 130 | /** | |
| 131 | * This method is called internally to set the html to use | |
| 132 | * the textarea with a specific name and classname for | |
| 133 | * the library to use its specific css | |
| 134 | * @return the String that will be used for the setHtml. | |
| 135 | */ | |
| 136 | protected String setSyntaxHighlight(){ | |
| 137 | StringBuffer buffer = new StringBuffer(); | |
| 138 | buffer.append("<textarea name=\""); | |
| 139 | buffer.append(name); | |
| 140 | buffer.append("\" class=\""); | |
| 141 | buffer.append(syntaxType); | |
| 142 | buffer.append("\">"); | |
| 143 | buffer.append(html); | |
| 144 | buffer.append("</textarea>"); | |
| 145 | ||
| 146 | return buffer.toString(); | |
| 147 | } | |
| 148 | ||
| 149 | /** | |
| 150 | * Private method that is called to apply the highlight for the textarea | |
| 151 | * @param name the name generated for this highlight | |
| 152 | * @param showGutter if it should show gutter | |
| 153 | * @param showControls if it should show the controls at the top | |
| 154 | * @param collapseAll if it should collapse the code | |
| 155 | * @param firstLine the first line to show | |
| 156 | * @param showColumns if it should show the column numbers | |
| 157 | */ | |
| 158 | private native void executeSh(String name, boolean showGutter, boolean showControls, | |
| 159 | boolean collapseAll, int firstLine, boolean showColumns) /*-{ | |
| 160 | $wnd.dp.SyntaxHighlighter.ClipboardSwf = 'js/sh/clipboard.swf'; | |
| 161 | $wnd.dp.SyntaxHighlighter.HighlightAll(name, showGutter, | |
| 162 | showControls, collapseAll, firstLine, showColumns); | |
| 163 | }-*/; | |
| 164 | ||
| 165 | protected JavaScriptObject create(JavaScriptObject config){ | |
| 166 | super.setHtml(setSyntaxHighlight()); | |
| 167 | return createJ(config); | |
| 168 | } | |
| 169 | ||
| 170 | protected JavaScriptObject createJ(JavaScriptObject config){ | |
| 171 | return super.create(config); | |
| 172 | } | |
| 173 | ||
| 174 | /** | |
| 175 | * Method to show gutter | |
| 176 | * @param showGutter true or false to show gutter | |
| 177 | */ | |
| 178 | public void setShowGutter(boolean showGutter){ | |
| 179 | this.showGutter = showGutter; | |
| 180 | } | |
| 181 | ||
| 182 | /** | |
| 183 | * Method to show controls | |
| 184 | * @param showControls true or false to show controls | |
| 185 | */ | |
| 186 | public void setShowControls(boolean showControls){ | |
| 187 | this.showControls = showControls; | |
| 188 | } | |
| 189 | ||
| 190 | /** | |
| 191 | * Method to collapse the code | |
| 192 | * @param collapseAll true or false to collapse or not the code | |
| 193 | */ | |
| 194 | public void setCollapseAll(boolean collapseAll){ | |
| 195 | this.collapseAll = collapseAll; | |
| 196 | } | |
| 197 | ||
| 198 | /** | |
| 199 | * Method to set what line to start showing | |
| 200 | * @param firstLine integer of the line to show first | |
| 201 | */ | |
| 202 | public void setFirstLine(int firstLine){ | |
| 203 | this.firstLine = firstLine; | |
| 204 | } | |
| 205 | ||
| 206 | /** | |
| 207 | * Method to show columns | |
| 208 | * @param showColumns true or false to show columns or not | |
| 209 | */ | |
| 210 | public void setShowColumns(boolean showColumns){ | |
| 211 | this.showColumns = showColumns; | |
| 212 | } | |
| 213 | } |
| ... | ...@@ -0,0 +1,161 @@ | |
| 1 | /* | |
| 2 | * JsMin | |
| 3 | * Javascript Compressor | |
| 4 | * http://www.crockford.com/ | |
| 5 | * http://www.smallsharptools.com/ | |
| 6 | */ | |
| 7 | ||
| 8 | var dp={sh:{Toolbar:{},Utils:{},RegexLib:{},Brushes:{},Strings:{AboutDialog:'<html><head><title>About...</title></head><body class="dp-about"><table cellspacing="0"><tr><td class="copy"><p class="title">dp.SyntaxHighlighter</div><div class="para">Version: {V}</p><p><a href="http://www.dreamprojections.com/syntaxhighlighter/?ref=about" target="_blank">http://www.dreamprojections.com/syntaxhighlighter</a></p>©2004-2007 Alex Gorbatchev.</td></tr><tr><td class="footer"><input type="button" class="close" value="OK" onClick="window.close()"/></td></tr></table></body></html>'},ClipboardSwf:null,Version:'1.5.1'}};dp.SyntaxHighlighter=dp.sh;dp.sh.Toolbar.Commands={ExpandSource:{label:'+ expand source',check:function(highlighter){return highlighter.collapse;},func:function(sender,highlighter) | |
| 9 | {sender.parentNode.removeChild(sender);highlighter.div.className=highlighter.div.className.replace('collapsed','');}},ViewSource:{label:'view plain',func:function(sender,highlighter) | |
| 10 | {var code=dp.sh.Utils.FixForBlogger(highlighter.originalCode).replace(/</g,'<');var wnd=window.open('','_blank','width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=0');wnd.document.write('<textarea style="width:99%;height:99%">'+code+'</textarea>');wnd.document.close();}},CopyToClipboard:{label:'copy to clipboard',check:function(){return window.clipboardData!=null||dp.sh.ClipboardSwf!=null;},func:function(sender,highlighter) | |
| 11 | {var code=dp.sh.Utils.FixForBlogger(highlighter.originalCode).replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&');if(window.clipboardData) | |
| 12 | {window.clipboardData.setData('text',code);} | |
| 13 | else if(dp.sh.ClipboardSwf!=null) | |
| 14 | {var flashcopier=highlighter.flashCopier;if(flashcopier==null) | |
| 15 | {flashcopier=document.createElement('div');highlighter.flashCopier=flashcopier;highlighter.div.appendChild(flashcopier);} | |
| 16 | flashcopier.innerHTML='<embed src="'+dp.sh.ClipboardSwf+'" FlashVars="clipboard='+encodeURIComponent(code)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';} | |
| 17 | alert('The code is in your clipboard now');}},PrintSource:{label:'print',func:function(sender,highlighter) | |
| 18 | {var iframe=document.createElement('IFRAME');var doc=null;iframe.style.cssText='position:absolute;width:0px;height:0px;left:-500px;top:-500px;';document.body.appendChild(iframe);doc=iframe.contentWindow.document;dp.sh.Utils.CopyStyles(doc,window.document);doc.write('<div class="'+highlighter.div.className.replace('collapsed','')+' printing">'+highlighter.div.innerHTML+'</div>');doc.close();iframe.contentWindow.focus();iframe.contentWindow.print();alert('Printing...');document.body.removeChild(iframe);}},About:{label:'?',func:function(highlighter) | |
| 19 | {var wnd=window.open('','_blank','dialog,width=300,height=150,scrollbars=0');var doc=wnd.document;dp.sh.Utils.CopyStyles(doc,window.document);doc.write(dp.sh.Strings.AboutDialog.replace('{V}',dp.sh.Version));doc.close();wnd.focus();}}};dp.sh.Toolbar.Create=function(highlighter) | |
| 20 | {var div=document.createElement('DIV');div.className='tools';for(var name in dp.sh.Toolbar.Commands) | |
| 21 | {var cmd=dp.sh.Toolbar.Commands[name];if(cmd.check!=null&&!cmd.check(highlighter)) | |
| 22 | continue;div.innerHTML+='<a href="#" onclick="dp.sh.Toolbar.Command(\''+name+'\',this);return false;">'+cmd.label+'</a>';} | |
| 23 | return div;} | |
| 24 | dp.sh.Toolbar.Command=function(name,sender) | |
| 25 | {var n=sender;while(n!=null&&n.className.indexOf('dp-highlighter')==-1) | |
| 26 | n=n.parentNode;if(n!=null) | |
| 27 | dp.sh.Toolbar.Commands[name].func(sender,n.highlighter);} | |
| 28 | dp.sh.Utils.CopyStyles=function(destDoc,sourceDoc) | |
| 29 | {var links=sourceDoc.getElementsByTagName('link');for(var i=0;i<links.length;i++) | |
| 30 | if(links[i].rel.toLowerCase()=='stylesheet') | |
| 31 | destDoc.write('<link type="text/css" rel="stylesheet" href="'+links[i].href+'"></link>');} | |
| 32 | dp.sh.Utils.FixForBlogger=function(str) | |
| 33 | {return(dp.sh.isBloggerMode==true)?str.replace(/<br\s*\/?>|<br\s*\/?>/gi,'\n'):str;} | |
| 34 | dp.sh.RegexLib={MultiLineCComments:new RegExp('/\\*[\\s\\S]*?\\*/','gm'),SingleLineCComments:new RegExp('//.*$','gm'),SingleLinePerlComments:new RegExp('#.*$','gm'),DoubleQuotedString:new RegExp('"(?:\\.|(\\\\\\")|[^\\""\\n])*"','g'),SingleQuotedString:new RegExp("'(?:\\.|(\\\\\\')|[^\\''\\n])*'",'g')};dp.sh.Match=function(value,index,css) | |
| 35 | {this.value=value;this.index=index;this.length=value.length;this.css=css;} | |
| 36 | dp.sh.Highlighter=function() | |
| 37 | {this.noGutter=false;this.addControls=true;this.collapse=false;this.tabsToSpaces=true;this.wrapColumn=80;this.showColumns=true;} | |
| 38 | dp.sh.Highlighter.SortCallback=function(m1,m2) | |
| 39 | {if(m1.index<m2.index) | |
| 40 | return-1;else if(m1.index>m2.index) | |
| 41 | return 1;else | |
| 42 | {if(m1.length<m2.length) | |
| 43 | return-1;else if(m1.length>m2.length) | |
| 44 | return 1;} | |
| 45 | return 0;} | |
| 46 | dp.sh.Highlighter.prototype.CreateElement=function(name) | |
| 47 | {var result=document.createElement(name);result.highlighter=this;return result;} | |
| 48 | dp.sh.Highlighter.prototype.GetMatches=function(regex,css) | |
| 49 | {var index=0;var match=null;while((match=regex.exec(this.code))!=null) | |
| 50 | this.matches[this.matches.length]=new dp.sh.Match(match[0],match.index,css);} | |
| 51 | dp.sh.Highlighter.prototype.AddBit=function(str,css) | |
| 52 | {if(str==null||str.length==0) | |
| 53 | return;var span=this.CreateElement('SPAN');str=str.replace(/ /g,' ');str=str.replace(/</g,'<');str=str.replace(/\n/gm,' <br>');if(css!=null) | |
| 54 | {if((/br/gi).test(str)) | |
| 55 | {var lines=str.split(' <br>');for(var i=0;i<lines.length;i++) | |
| 56 | {span=this.CreateElement('SPAN');span.className=css;span.innerHTML=lines[i];this.div.appendChild(span);if(i+1<lines.length) | |
| 57 | this.div.appendChild(this.CreateElement('BR'));}} | |
| 58 | else | |
| 59 | {span.className=css;span.innerHTML=str;this.div.appendChild(span);}} | |
| 60 | else | |
| 61 | {span.innerHTML=str;this.div.appendChild(span);}} | |
| 62 | dp.sh.Highlighter.prototype.IsInside=function(match) | |
| 63 | {if(match==null||match.length==0) | |
| 64 | return false;for(var i=0;i<this.matches.length;i++) | |
| 65 | {var c=this.matches[i];if(c==null) | |
| 66 | continue;if((match.index>c.index)&&(match.index<c.index+c.length)) | |
| 67 | return true;} | |
| 68 | return false;} | |
| 69 | dp.sh.Highlighter.prototype.ProcessRegexList=function() | |
| 70 | {for(var i=0;i<this.regexList.length;i++) | |
| 71 | this.GetMatches(this.regexList[i].regex,this.regexList[i].css);} | |
| 72 | dp.sh.Highlighter.prototype.ProcessSmartTabs=function(code) | |
| 73 | {var lines=code.split('\n');var result='';var tabSize=4;var tab='\t';function InsertSpaces(line,pos,count) | |
| 74 | {var left=line.substr(0,pos);var right=line.substr(pos+1,line.length);var spaces='';for(var i=0;i<count;i++) | |
| 75 | spaces+=' ';return left+spaces+right;} | |
| 76 | function ProcessLine(line,tabSize) | |
| 77 | {if(line.indexOf(tab)==-1) | |
| 78 | return line;var pos=0;while((pos=line.indexOf(tab))!=-1) | |
| 79 | {var spaces=tabSize-pos%tabSize;line=InsertSpaces(line,pos,spaces);} | |
| 80 | return line;} | |
| 81 | for(var i=0;i<lines.length;i++) | |
| 82 | result+=ProcessLine(lines[i],tabSize)+'\n';return result;} | |
| 83 | dp.sh.Highlighter.prototype.SwitchToList=function() | |
| 84 | {var html=this.div.innerHTML.replace(/<(br)\/?>/gi,'\n');var lines=html.split('\n');if(this.addControls==true) | |
| 85 | this.bar.appendChild(dp.sh.Toolbar.Create(this));if(this.showColumns) | |
| 86 | {var div=this.CreateElement('div');var columns=this.CreateElement('div');var showEvery=10;var i=1;while(i<=150) | |
| 87 | {if(i%showEvery==0) | |
| 88 | {div.innerHTML+=i;i+=(i+'').length;} | |
| 89 | else | |
| 90 | {div.innerHTML+='·';i++;}} | |
| 91 | columns.className='columns';columns.appendChild(div);this.bar.appendChild(columns);} | |
| 92 | for(var i=0,lineIndex=this.firstLine;i<lines.length-1;i++,lineIndex++) | |
| 93 | {var li=this.CreateElement('LI');var span=this.CreateElement('SPAN');li.className=(i%2==0)?'alt':'';span.innerHTML=lines[i]+' ';li.appendChild(span);this.ol.appendChild(li);} | |
| 94 | this.div.innerHTML='';} | |
| 95 | dp.sh.Highlighter.prototype.Highlight=function(code) | |
| 96 | {function Trim(str) | |
| 97 | {return str.replace(/^\s*(.*?)[\s\n]*$/g,'$1');} | |
| 98 | function Chop(str) | |
| 99 | {return str.replace(/\n*$/,'').replace(/^\n*/,'');} | |
| 100 | function Unindent(str) | |
| 101 | {var lines=dp.sh.Utils.FixForBlogger(str).split('\n');var indents=new Array();var regex=new RegExp('^\\s*','g');var min=1000;for(var i=0;i<lines.length&&min>0;i++) | |
| 102 | {if(Trim(lines[i]).length==0) | |
| 103 | continue;var matches=regex.exec(lines[i]);if(matches!=null&&matches.length>0) | |
| 104 | min=Math.min(matches[0].length,min);} | |
| 105 | if(min>0) | |
| 106 | for(var i=0;i<lines.length;i++) | |
| 107 | lines[i]=lines[i].substr(min);return lines.join('\n');} | |
| 108 | function Copy(string,pos1,pos2) | |
| 109 | {return string.substr(pos1,pos2-pos1);} | |
| 110 | var pos=0;if(code==null) | |
| 111 | code='';this.originalCode=code;this.code=Chop(Unindent(code));this.div=this.CreateElement('DIV');this.bar=this.CreateElement('DIV');this.ol=this.CreateElement('OL');this.matches=new Array();this.div.className='dp-highlighter';this.div.highlighter=this;this.bar.className='bar';this.ol.start=this.firstLine;if(this.CssClass!=null) | |
| 112 | this.ol.className=this.CssClass;if(this.collapse) | |
| 113 | this.div.className+=' collapsed';if(this.noGutter) | |
| 114 | this.div.className+=' nogutter';if(this.tabsToSpaces==true) | |
| 115 | this.code=this.ProcessSmartTabs(this.code);this.ProcessRegexList();if(this.matches.length==0) | |
| 116 | {this.AddBit(this.code,null);this.SwitchToList();this.div.appendChild(this.bar);this.div.appendChild(this.ol);return;} | |
| 117 | this.matches=this.matches.sort(dp.sh.Highlighter.SortCallback);for(var i=0;i<this.matches.length;i++) | |
| 118 | if(this.IsInside(this.matches[i])) | |
| 119 | this.matches[i]=null;for(var i=0;i<this.matches.length;i++) | |
| 120 | {var match=this.matches[i];if(match==null||match.length==0) | |
| 121 | continue;this.AddBit(Copy(this.code,pos,match.index),null);this.AddBit(match.value,match.css);pos=match.index+match.length;} | |
| 122 | this.AddBit(this.code.substr(pos),null);this.SwitchToList();this.div.appendChild(this.bar);this.div.appendChild(this.ol);} | |
| 123 | dp.sh.Highlighter.prototype.GetKeywords=function(str) | |
| 124 | {return'\\b'+str.replace(/ /g,'\\b|\\b')+'\\b';} | |
| 125 | dp.sh.BloggerMode=function() | |
| 126 | {dp.sh.isBloggerMode=true;} | |
| 127 | dp.sh.HighlightAll=function(name,showGutter,showControls,collapseAll,firstLine,showColumns) | |
| 128 | {function FindValue() | |
| 129 | {var a=arguments;for(var i=0;i<a.length;i++) | |
| 130 | {if(a[i]==null) | |
| 131 | continue;if(typeof(a[i])=='string'&&a[i]!='') | |
| 132 | return a[i]+'';if(typeof(a[i])=='object'&&a[i].value!='') | |
| 133 | return a[i].value+'';} | |
| 134 | return null;} | |
| 135 | function IsOptionSet(value,list) | |
| 136 | {for(var i=0;i<list.length;i++) | |
| 137 | if(list[i]==value) | |
| 138 | return true;return false;} | |
| 139 | function GetOptionValue(name,list,defaultValue) | |
| 140 | {var regex=new RegExp('^'+name+'\\[(\\w+)\\]$','gi');var matches=null;for(var i=0;i<list.length;i++) | |
| 141 | if((matches=regex.exec(list[i]))!=null) | |
| 142 | return matches[1];return defaultValue;} | |
| 143 | function FindTagsByName(list,name,tagName) | |
| 144 | {var tags=document.getElementsByTagName(tagName);for(var i=0;i<tags.length;i++) | |
| 145 | if(tags[i].getAttribute('name')==name) | |
| 146 | list.push(tags[i]);} | |
| 147 | var elements=[];var highlighter=null;var registered={};var propertyName='innerHTML';FindTagsByName(elements,name,'pre');FindTagsByName(elements,name,'textarea');if(elements.length==0) | |
| 148 | return;for(var brush in dp.sh.Brushes) | |
| 149 | {var aliases=dp.sh.Brushes[brush].Aliases;if(aliases==null) | |
| 150 | continue;for(var i=0;i<aliases.length;i++) | |
| 151 | registered[aliases[i]]=brush;} | |
| 152 | for(var i=0;i<elements.length;i++) | |
| 153 | {var element=elements[i];var options=FindValue(element.attributes['class'],element.className,element.attributes['language'],element.language);var language='';if(options==null) | |
| 154 | continue;options=options.split(':');language=options[0].toLowerCase();if(registered[language]==null) | |
| 155 | continue;highlighter=new dp.sh.Brushes[registered[language]]();element.style.display='none';highlighter.noGutter=(showGutter==null)?IsOptionSet('nogutter',options):!showGutter;highlighter.addControls=(showControls==null)?!IsOptionSet('nocontrols',options):showControls;highlighter.collapse=(collapseAll==null)?IsOptionSet('collapse',options):collapseAll;highlighter.showColumns=(showColumns==null)?IsOptionSet('showcolumns',options):showColumns;var headNode=document.getElementsByTagName('head')[0];if(highlighter.Style&&headNode) | |
| 156 | {var styleNode=document.createElement('style');styleNode.setAttribute('type','text/css');if(styleNode.styleSheet) | |
| 157 | {styleNode.styleSheet.cssText=highlighter.Style;} | |
| 158 | else | |
| 159 | {var textNode=document.createTextNode(highlighter.Style);styleNode.appendChild(textNode);} | |
| 160 | headNode.appendChild(styleNode);} | |
| 161 | highlighter.firstLine=(firstLine==null)?parseInt(GetOptionValue('firstline',options,1)):firstLine;highlighter.Highlight(element[propertyName]);highlighter.source=element;element.parentNode.insertBefore(highlighter.div,element);}} |
| ... | ...@@ -0,0 +1,21 @@ | |
| 1 | ||
| 2 | <module> | |
| 3 | <inherits name='com.gwtext.GwtExt'/> | |
| 4 | <script src="js/sh/shCore.js"/> | |
| 5 | ||
| 6 | <script src="js/sh/shBrushCpp.js"/> | |
| 7 | <script src="js/sh/shBrushCSharp.js"/> | |
| 8 | <script src="js/sh/shBrushCss.js"/> | |
| 9 | <script src="js/sh/shBrushDelphi.js"/> | |
| 10 | <script src="js/sh/shBrushJava.js"/> | |
| 11 | <script src="js/sh/shBrushJScript.js"/> | |
| 12 | <script src="js/sh/shBrushPhp.js"/> | |
| 13 | <script src="js/sh/shBrushPython.js"/> | |
| 14 | <script src="js/sh/shBrushRuby.js"/> | |
| 15 | <script src="js/sh/shBrushSql.js"/> | |
| 16 | <script src="js/sh/shBrushVb.js"/> | |
| 17 | <script src="js/sh/shBrushXml.js"/> | |
| 18 | ||
| 19 | <stylesheet src="js/sh/SyntaxHighlighter.css"/> | |
| 20 | ||
| 21 | </module> | |
| 0 | 22 | \ No newline at end of file |
| ... | ...@@ -0,0 +1,10 @@ | |
| 1 | /* | |
| 2 | * JsMin | |
| 3 | * Javascript Compressor | |
| 4 | * http://www.crockford.com/ | |
| 5 | * http://www.smallsharptools.com/ | |
| 6 | */ | |
| 7 | ||
| 8 | dp.sh.Brushes.Php=function() | |
| 9 | {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';this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('\\$\\w+','g'),css:'vars'},{regex:new RegExp(this.GetKeywords(funcs),'gmi'),css:'func'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-c';} | |
| 10 | dp.sh.Brushes.Php.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Php.Aliases=['php']; |
| ... | ...@@ -0,0 +1,14 @@ | |
| 1 | /* | |
| 2 | * JsMin | |
| 3 | * Javascript Compressor | |
| 4 | * http://www.crockford.com/ | |
| 5 | * http://www.smallsharptools.com/ | |
| 6 | */ | |
| 7 | ||
| 8 | dp.sh.Brushes.CSS=function() | |
| 9 | {var keywords='ascent azimuth background-attachment background-color background-image background-position '+'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top '+'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color '+'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width '+'border-bottom-width border-left-width border-width border cap-height caption-side centerline clear clip color '+'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display '+'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font '+'height letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top '+'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans '+'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page '+'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position '+'quotes richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress '+'table-layout text-align text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em '+'vertical-align visibility voice-family volume white-sp |