From 9ee0742b539e59d55b11798f4d05854ea1cbbd6e Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 28 May 2012 18:21:00 +0200 Subject: [PATCH] refactoring --- source/Ox.UI/js/Bar/Ox.Progressbar.js | 4 ++-- source/Ox.UI/js/Code/Ox.SyntaxHighlighter.js | 5 +---- source/Ox.UI/js/Form/Ox.FileButton.js | 2 +- source/Ox.UI/js/Form/Ox.Input.js | 2 +- source/Ox.UI/js/Map/Ox.MapRectangle.js | 6 +++--- source/Ox.UI/js/Window/Ox.Tooltip.js | 9 +++++++-- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/source/Ox.UI/js/Bar/Ox.Progressbar.js b/source/Ox.UI/js/Bar/Ox.Progressbar.js index 8d7bdfa2..09116c94 100644 --- a/source/Ox.UI/js/Bar/Ox.Progressbar.js +++ b/source/Ox.UI/js/Bar/Ox.Progressbar.js @@ -216,9 +216,9 @@ Ox.Progressbar = function(options, self) { self.setOption = function(key, value) { if (key == 'cancelled') { toggleCancelled(); - } if (key == 'paused') { + } else if (key == 'paused') { togglePaused(); - } if (key == 'progress') { + } else if (key == 'progress') { self.options.progress = Ox.limit(self.options.progress, 0, 1); !self.options.paused && !self.options.cancelled && setProgress(true); } diff --git a/source/Ox.UI/js/Code/Ox.SyntaxHighlighter.js b/source/Ox.UI/js/Code/Ox.SyntaxHighlighter.js index 569ce797..81f7f998 100644 --- a/source/Ox.UI/js/Code/Ox.SyntaxHighlighter.js +++ b/source/Ox.UI/js/Code/Ox.SyntaxHighlighter.js @@ -36,6 +36,7 @@ Ox.SyntaxHighlighter = function(options, self) { tabSize: 4 }) .options(options || {}) + .update(renderSource) .addClass('OxSyntaxHighlighter'); renderSource(); @@ -132,10 +133,6 @@ Ox.SyntaxHighlighter = function(options, self) { } } - self.setOption = function(key, value) { - renderSource(); - }; - return that; }; diff --git a/source/Ox.UI/js/Form/Ox.FileButton.js b/source/Ox.UI/js/Form/Ox.FileButton.js index e5868262..f175de60 100644 --- a/source/Ox.UI/js/Form/Ox.FileButton.js +++ b/source/Ox.UI/js/Form/Ox.FileButton.js @@ -102,7 +102,7 @@ Ox.FileButton = function(options, self) { if (key == 'disabled') { self.$button.options({disabled: value}); self.$input[value ? 'hide' : 'show'](); - } else if (key == title) { + } else if (key == 'title') { self.$button.options({title: value}); } } diff --git a/source/Ox.UI/js/Form/Ox.Input.js b/source/Ox.UI/js/Form/Ox.Input.js index c578550e..b39fea36 100644 --- a/source/Ox.UI/js/Form/Ox.Input.js +++ b/source/Ox.UI/js/Form/Ox.Input.js @@ -848,7 +848,7 @@ Ox.Input = function(options, self) { } self.setOption = function(key, value) { - var inputWidth, val; + var inputWidth; if (['autocomplete', 'autocompleteReplace', 'autocompleteSelect', 'autovalidate'].indexOf(key) > -1) { if (self.options.autocomplete && self.options.autocompleteSelect) { self.$autocompleteMenu = constructAutocompleteMenu(); diff --git a/source/Ox.UI/js/Map/Ox.MapRectangle.js b/source/Ox.UI/js/Map/Ox.MapRectangle.js index d3e95bb9..23fb8527 100644 --- a/source/Ox.UI/js/Map/Ox.MapRectangle.js +++ b/source/Ox.UI/js/Map/Ox.MapRectangle.js @@ -13,9 +13,9 @@ Ox.MapRectangle = function(options, self) { var that = this; options = Ox.extend({ - map: null, - place: null - }, options); + map: null, + place: null + }, options); Ox.forEach(options, function(val, key) { that[key] = val; diff --git a/source/Ox.UI/js/Window/Ox.Tooltip.js b/source/Ox.UI/js/Window/Ox.Tooltip.js index b394b395..01384089 100644 --- a/source/Ox.UI/js/Window/Ox.Tooltip.js +++ b/source/Ox.UI/js/Window/Ox.Tooltip.js @@ -18,6 +18,12 @@ Ox.Tooltip = function(options, self) { title: '' }) .options(options || {}) + .update({ + title: function() { + that.html(value); + value === '' && that.detach(); + } + }) .addClass('OxTooltip') .html(self.options.title); @@ -27,8 +33,7 @@ Ox.Tooltip = function(options, self) { self.setOption = function(key, value) { if (key == 'title') { - that.html(value); - value === '' && that.detach(); + } };