refactoring

This commit is contained in:
rolux 2012-05-28 18:21:00 +02:00
parent ab68c4a54f
commit 9ee0742b53
6 changed files with 15 additions and 13 deletions

View file

@ -216,9 +216,9 @@ Ox.Progressbar = function(options, self) {
self.setOption = function(key, value) { self.setOption = function(key, value) {
if (key == 'cancelled') { if (key == 'cancelled') {
toggleCancelled(); toggleCancelled();
} if (key == 'paused') { } else if (key == 'paused') {
togglePaused(); togglePaused();
} if (key == 'progress') { } else if (key == 'progress') {
self.options.progress = Ox.limit(self.options.progress, 0, 1); self.options.progress = Ox.limit(self.options.progress, 0, 1);
!self.options.paused && !self.options.cancelled && setProgress(true); !self.options.paused && !self.options.cancelled && setProgress(true);
} }

View file

@ -36,6 +36,7 @@ Ox.SyntaxHighlighter = function(options, self) {
tabSize: 4 tabSize: 4
}) })
.options(options || {}) .options(options || {})
.update(renderSource)
.addClass('OxSyntaxHighlighter'); .addClass('OxSyntaxHighlighter');
renderSource(); renderSource();
@ -132,10 +133,6 @@ Ox.SyntaxHighlighter = function(options, self) {
} }
} }
self.setOption = function(key, value) {
renderSource();
};
return that; return that;
}; };

View file

@ -102,7 +102,7 @@ Ox.FileButton = function(options, self) {
if (key == 'disabled') { if (key == 'disabled') {
self.$button.options({disabled: value}); self.$button.options({disabled: value});
self.$input[value ? 'hide' : 'show'](); self.$input[value ? 'hide' : 'show']();
} else if (key == title) { } else if (key == 'title') {
self.$button.options({title: value}); self.$button.options({title: value});
} }
} }

View file

@ -848,7 +848,7 @@ Ox.Input = function(options, self) {
} }
self.setOption = function(key, value) { self.setOption = function(key, value) {
var inputWidth, val; var inputWidth;
if (['autocomplete', 'autocompleteReplace', 'autocompleteSelect', 'autovalidate'].indexOf(key) > -1) { if (['autocomplete', 'autocompleteReplace', 'autocompleteSelect', 'autovalidate'].indexOf(key) > -1) {
if (self.options.autocomplete && self.options.autocompleteSelect) { if (self.options.autocomplete && self.options.autocompleteSelect) {
self.$autocompleteMenu = constructAutocompleteMenu(); self.$autocompleteMenu = constructAutocompleteMenu();

View file

@ -13,9 +13,9 @@ Ox.MapRectangle = function(options, self) {
var that = this; var that = this;
options = Ox.extend({ options = Ox.extend({
map: null, map: null,
place: null place: null
}, options); }, options);
Ox.forEach(options, function(val, key) { Ox.forEach(options, function(val, key) {
that[key] = val; that[key] = val;

View file

@ -18,6 +18,12 @@ Ox.Tooltip = function(options, self) {
title: '' title: ''
}) })
.options(options || {}) .options(options || {})
.update({
title: function() {
that.html(value);
value === '' && that.detach();
}
})
.addClass('OxTooltip') .addClass('OxTooltip')
.html(self.options.title); .html(self.options.title);
@ -27,8 +33,7 @@ Ox.Tooltip = function(options, self) {
self.setOption = function(key, value) { self.setOption = function(key, value) {
if (key == 'title') { if (key == 'title') {
that.html(value);
value === '' && that.detach();
} }
}; };