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

@ -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)