forked from 0x2620/oxjs
remove new for all Ox.Elements, dont declare arguments again, add some semicolons
This commit is contained in:
parent
3eab11e967
commit
b27ed00356
69 changed files with 430 additions and 440 deletions
|
|
@ -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;
|
||||
|
||||
};
|
||||
|
||||
}());
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
}();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@
|
|||
buffer = '';
|
||||
}, 1000);
|
||||
|
||||
Ox.print(ret)
|
||||
Ox.print(ret);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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(' ', 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;
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue