forked from 0x2620/oxjs
Ox.tokenize, Ox.SyntaxHighlighter (+demo)
This commit is contained in:
parent
ee9f698b29
commit
74b9a25387
8 changed files with 632 additions and 0 deletions
10
demos/syntax/index.html
Normal file
10
demos/syntax/index.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>OxJS SyntaxHighlighter Demo</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<script type="text/javascript" src="../../build/Ox.js"></script>
|
||||
<script type="text/javascript" src="js/syntax.js"></script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
50
demos/syntax/js/syntax.js
Normal file
50
demos/syntax/js/syntax.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
Ox.load('UI', {
|
||||
debug: true,
|
||||
theme: 'classic'
|
||||
}, function() {
|
||||
|
||||
Ox.Theme('classic');
|
||||
|
||||
var $body = $('body'),
|
||||
$textarea = new Ox.Input({
|
||||
height: 400,
|
||||
type: 'textarea',
|
||||
width: 400
|
||||
})
|
||||
.css({
|
||||
fontFamily: 'Menlo, Monaco, Courier, Courier New'
|
||||
})
|
||||
.appendTo($body),
|
||||
$button = new Ox.Button({
|
||||
title: 'Run',
|
||||
width: 40
|
||||
})
|
||||
.css({
|
||||
position: 'absolute',
|
||||
left: '8px',
|
||||
top: '416px',
|
||||
})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
$div.empty();
|
||||
new Ox.SyntaxHighlighter({
|
||||
showLinebreaks: true,
|
||||
showTabs: true,
|
||||
showWhitespace: true,
|
||||
source: $textarea.value(),
|
||||
//stripComments: true,
|
||||
//stripLinebreaks: true,
|
||||
//stripWhitespace: true,
|
||||
}).appendTo($div);
|
||||
}
|
||||
})
|
||||
.appendTo($body),
|
||||
$div = $('<div>')
|
||||
.css({
|
||||
position: 'absolute',
|
||||
left: '416px',
|
||||
top: '8px'
|
||||
})
|
||||
.appendTo($body);
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue