source: trunk/www.guidonia.net/wp/wp-includes/js/codepress/languages/javascript.js@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 1.5 KB
Line 
1/*
2 * CodePress regular expressions for JavaScript syntax highlighting
3 */
4
5// JavaScript
6Language.syntax = [
7 { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
8 { input : /\'(.*?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
9 { input : /\b(break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g, output : '<b>$1</b>' }, // reserved words
10 { input : /\b(alert|isNaN|parent|Array|parseFloat|parseInt|blur|clearTimeout|prompt|prototype|close|confirm|length|Date|location|Math|document|element|name|self|elements|setTimeout|navigator|status|String|escape|Number|submit|eval|Object|event|onblur|focus|onerror|onfocus|onclick|top|onload|toString|onunload|unescape|open|valueOf|window|onmouseover)\b/g, output : '<u>$1</u>' }, // special words
11 { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments //
12 { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */
13]
14
15Language.snippets = [
16 { input : 'dw', output : 'document.write(\'$0\');' },
17 { input : 'getid', output : 'document.getElementById(\'$0\')' },
18 { input : 'fun', output : 'function $0(){\n\t\n}' },
19 { input : 'func', output : 'function $0(){\n\t\n}' }
20]
21
22Language.complete = [
23 { input : '\'',output : '\'$0\'' },
24 { input : '"', output : '"$0"' },
25 { input : '(', output : '\($0\)' },
26 { input : '[', output : '\[$0\]' },
27 { input : '{', output : '{\n\t$0\n}' }
28]
29
30Language.shortcuts = []
Note: See TracBrowser for help on using the repository browser.