1
0
Fork 0
forked from 0x2620/oxjs

remove new for all Ox.Elements, dont declare arguments again, add some semicolons

This commit is contained in:
j 2011-06-19 19:48:32 +02:00
commit b27ed00356
69 changed files with 430 additions and 440 deletions

View file

@ -4,7 +4,6 @@
Ox.App <f> Basic application instance that communicates with a JSON API
() -> <f> App object
(options) -> <f> App object
(options, self) -> <f> App object
options <o> Options object
timeout <n> request timeout
type <s> HTTP Request type, i.e. 'GET' or 'POST'
@ -14,9 +13,7 @@ Ox.App <f> Basic application instance that communicates with a JSON API
@*/
Ox.App = (function() {
return function(options) {
Ox.App = function(options) {
options = options || {};
var self = {
@ -27,7 +24,7 @@ Ox.App = (function() {
}, options || {}),
time: new Date()
},
that = new Ox.Element({}, self);
that = Ox.Element({}, self);
that.api = {
api: function(callback) {
@ -128,6 +125,4 @@ Ox.App = (function() {
return that;
};
}());
};

View file

@ -14,10 +14,10 @@ Ox.Container <f> Container (depricated)
@*/
Ox.Container = function(options, self) {
// fixme: to be deprecated
var that = new Ox.Element({}, self)
var that = Ox.Element({}, self)
.options(options || {})
.addClass('OxContainer');
that.$content = new Ox.Element({}, self) // fixme: passing self twice??
that.$content = Ox.Element({}, self) // fixme: passing self twice??
.options(options || {})
.addClass('OxContent')
.appendTo(that);

View file

@ -48,12 +48,10 @@ Ox.Element <function:Ox.JQueryElement> Basic UI element object
* <*> original event properties
@*/
Ox.Element = function() {
return function(options, self) {
Ox.Element = function(options, self) {
/*
// allow for 'Ox.Element()' instead of 'new Ox.Element()'
// allow for 'Ox.Element()' instead of 'Ox.Element()'
if (!(this instanceof arguments.callee)) {
return new arguments.callee(options, self);
}
@ -69,8 +67,8 @@ Ox.Element = function() {
if (Ox.isString(self.options)) {
self.options = {
element: self.options
}
};
};
}
// create event handler
if (!self.$eventHandler) {
self.$eventHandler = $('<div>');
@ -376,6 +374,4 @@ Ox.Element = function() {
return that;
}
}();
};

View file

@ -101,7 +101,7 @@
buffer = '';
}, 1000);
Ox.print(ret)
Ox.print(ret);
return ret;
}

View file

@ -10,8 +10,8 @@ Ox.LoadingIcon <f:Ox.Element> Loading Icon Element
@*/
Ox.LoadingIcon = function(options, self) {
var self = self || {},
that = new Ox.Element('<img>', self)
self = self || {};
var that = Ox.Element('<img>', self)
.defaults({
size: 'medium'
})
@ -42,6 +42,6 @@ Ox.LoadingIcon = function(options, self) {
opacity: 0
}, 250);
return that;
}
};
return that;
}
};

View file

@ -135,10 +135,10 @@ Ox.Request = function(options) {
width: 768,
height: 384
}),
$dialog = new Ox.Dialog({
$dialog = Ox.Dialog({
title: 'Application Error',
buttons: [
new Ox.Button({
Ox.Button({
title: 'Close'
})
.bindEvent({
@ -186,10 +186,10 @@ Ox.Request = function(options) {
if (data.status.code < 500) {
callback(data);
} else {
var $dialog = new Ox.Dialog({
var $dialog = Ox.Dialog({
title: 'Application Error',
buttons: [
new Ox.Button({
Ox.Button({
id: 'details',
title: 'Details'
})
@ -200,7 +200,7 @@ Ox.Request = function(options) {
});
}
}),
new Ox.Button({
Ox.Button({
id: 'close',
title: 'Close'
})

View file

@ -18,7 +18,7 @@ Ox.SyntaxHighlighter <function> Syntax Highlighter
Ox.SyntaxHighlighter = function(options, self) {
self = self || {};
self = self || {};
var that = Ox.Element({}, self)
.defaults({
lineLength: 0,
@ -61,9 +61,9 @@ Ox.SyntaxHighlighter = function(options, self) {
classNames = 'Ox' + Ox.toTitleCase(token.type);
if (self.options.showWhitespace && token.type == 'whitespace') {
if (isAfterLinebreak() && hasIrregularSpaces()) {
classNames += ' OxLeading'
classNames += ' OxLeading';
} else if (isBeforeLinebreak()) {
classNames += ' OxTrailing'
classNames += ' OxTrailing';
}
}
source += '<span class="' + classNames + '">' +
@ -89,7 +89,7 @@ Ox.SyntaxHighlighter = function(options, self) {
lines = source.split('<br/>');
that.empty();
if (self.options.showLineNumbers) {
$lineNumbers = new Ox.Element()
$lineNumbers = Ox.Element()
.addClass('OxLineNumbers')
.html(
Ox.range(lines.length).map(function(line) {
@ -98,19 +98,19 @@ Ox.SyntaxHighlighter = function(options, self) {
)
.appendTo(that);
}
$source = new Ox.Element()
$source = Ox.Element()
.addClass('OxSourceCode')
.html(source)
.appendTo(that);
if (self.options.lineLength) {
$line = new Ox.Element()
$line = Ox.Element()
.css({
position: 'absolute',
top: '-1000px'
})
.html(Ox.repeat('&nbsp;', self.options.lineLength))
.appendTo(that),
width = $line.width() + 4; // add padding
.appendTo(that);
width = $line.width() + 4; // add padding
$line.removeElement();
['moz', 'webkit'].forEach(function(browser) {
$source.css({
@ -129,4 +129,4 @@ Ox.SyntaxHighlighter = function(options, self) {
return that;
};
};