1
0
Fork 0
forked from 0x2620/oxjs

better Ox.isEqual(), more tests, more documentation

This commit is contained in:
rolux 2011-05-08 14:14:07 +02:00
commit 37219bfbe9
5 changed files with 466 additions and 252 deletions

View file

@ -254,6 +254,18 @@ Dialog
cursor: se-resize;
}
/*
================================================================================
Documentation
================================================================================
*/
.OxDocPage code {
//border: 1px solid rgb(232, 232, 232);
//background: rgb(248, 248, 248);
white-space: nowrap;
}
/*
================================================================================
Drag & Drop

View file

@ -6,7 +6,7 @@ Ox.DocPage = function(options, self) {
item: {}
})
.options(options || {})
.addClass('OxText')
.addClass('OxDocPage OxText')
.css({
overflow: 'auto'
});
@ -42,8 +42,13 @@ Ox.DocPage = function(options, self) {
if (item[section]) {
if (section == 'description') {
$elements.push($('<div>')
.css({paddingLeft: (level * 32) + 'px'})
.html(item.description)
.css({
paddingTop: (level ? 0 : 8) + 'px',
borderTop: level ? '': '1px solid rgb(192, 192, 192)',
marginTop: (level ? 0 : 8) + 'px',
marginLeft: (level * 32) + 'px',
})
.html(Ox.parseHTML(item.description))
);
} else {
$elements.push($('<div>')
@ -108,7 +113,7 @@ Ox.DocPage = function(options, self) {
.addClass(className)
.css({marginLeft: (level * 32 + 16) + 'px'})
.html(
'<code>' + Ox.parseHTML(example.result) + '</code>'
'<code>' + Ox.encodeHTML(example.result) + '</code>'
)
)
});

View file

@ -39,7 +39,7 @@ Ox.SyntaxHighlighter = function(options, self) {
!(self.options.stripComments && token.type == 'comment')
) {
classNames = 'Ox' + Ox.toTitleCase(token.type);
if (token.type == 'whitespace') {
if (self.options.showWhitespace && token.type == 'whitespace') {
if (isAfterLinebreak() && hasIrregularSpaces()) {
classNames += ' OxLeading'
} else if (isBeforeLinebreak()) {
@ -65,27 +65,15 @@ Ox.SyntaxHighlighter = function(options, self) {
}
});
self.lines = self.source.split('<br/>');
self.lineNumbersWidth = (self.lines.length + self.options.offset - 1).toString().length * 7;
self.sourceCodeWidth = 80 * 7 + (
self.lines.length > 40 ? Ox.UI.SCROLLBAR_SIZE : 0
);
self.height = 40 * 14 + (
Math.max.apply(null, self.lines.map(function(line) {
return line.length;
})) > 80 ? Ox.UI.SCROLLBAR_SIZE : 0
);
that.css({
//width: self.lineNumbersWidth + self.sourceCodeWidth,
//height: self.height
});
self.lineNumbersWidth = (
self.lines.length + self.options.offset - 1
).toString().length * 7;
self.$lineNumbers = new Ox.Element()
.addClass('OxLineNumbers')
.css({
display: 'table-cell',
width: self.lineNumbersWidth + 'px',
//height: (self.lines.length * 14) + 8 + 'px',
padding: '4px',
})
.html(
@ -98,8 +86,6 @@ Ox.SyntaxHighlighter = function(options, self) {
.addClass('OxSourceCode')
.css({
display: 'table-cell',
//width: self.sourceCodeWidth + 'px',
//height: (self.lines.length * 14) + 'px',
padding: '4px'
})
.html(self.source)