From b77852296bf2234c42121f81a23f09fae0f7d1e5 Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 2 Jan 2012 19:35:14 +0530 Subject: [PATCH] misc fixes --- source/Ox.UI/js/Bar/Ox.Progressbar.js | 6 ++--- source/Ox.UI/js/Core/Ox.URL.js | 20 ++------------- source/Ox.UI/js/Panel/Ox.CollapsePanel.js | 9 ++++++- source/Ox.UI/js/Video/Ox.AnnotationPanel.js | 25 +++++++++---------- .../Ox.UI/js/Video/Ox.LargeVideoTimeline.js | 6 ++--- source/Ox.UI/themes/classic/css/classic.css | 1 - source/Ox/js/HTML.js | 5 ---- 7 files changed, 28 insertions(+), 44 deletions(-) diff --git a/source/Ox.UI/js/Bar/Ox.Progressbar.js b/source/Ox.UI/js/Bar/Ox.Progressbar.js index 276442cf..5d43a9cb 100644 --- a/source/Ox.UI/js/Bar/Ox.Progressbar.js +++ b/source/Ox.UI/js/Bar/Ox.Progressbar.js @@ -90,14 +90,14 @@ Ox.Progressbar = function(options, self) { if (self.options.showCancelButton) { self.$cancelButton = Ox.Button(Ox.extend({ style: 'symbol', - tooltip: self.options.showRestartButton - ? ['Cancel', 'Restart'] : 'Cancel', type: 'image' }, self.options.showRestartButton ? { + tooltip: ['Cancel', 'Restart'], value: 'close', values: ['close', 'redo'] } : { - title: 'close' + title: 'close', + tooltip: 'Cancel' })) .bindEvent({ click: toggleCancelled diff --git a/source/Ox.UI/js/Core/Ox.URL.js b/source/Ox.UI/js/Core/Ox.URL.js index cc1fe6e9..2136fc73 100644 --- a/source/Ox.UI/js/Core/Ox.URL.js +++ b/source/Ox.UI/js/Core/Ox.URL.js @@ -367,13 +367,7 @@ Ox.URL = function(options) { } function parseDuration(str) { - var parts = str.split(':').reverse(); - while (parts.length > 3) { - parts.pop(); - } - return parts.reduce(function(prev, curr, i) { - return prev + (parseFloat(curr) || 0) * Math.pow(60, i); - }, 0); + return Ox.parseDuration(str); } function parseFind(str) { @@ -445,16 +439,6 @@ Ox.URL = function(options) { ); } - function parseTime(str) { - var split = str.split(':').reverse(); - while (split.length > 3) { - split.pop(); - } - return Ox.formatDuration(split.reduce(function(prev, curr, i) { - return prev + (parseFloat(curr) || 0) * Math.pow(60, i); - }, 0)); - } - function parseURL(str, callback) { // fixme: removing trailing slash makes it impossible to search for '/' str = str.replace(/(^\/|\/$)/g, ''); @@ -633,7 +617,7 @@ Ox.URL = function(options) { } else if (type == 'integer') { value = Math.round(str) || 0; } else if (type == 'time') { - value = parseTime(value); + value = Ox.formatDurarion(Ox.parseDuration(value)); } else if (type == 'year') { value = Math.round(str) || 1970; } diff --git a/source/Ox.UI/js/Panel/Ox.CollapsePanel.js b/source/Ox.UI/js/Panel/Ox.CollapsePanel.js index b00bfecf..df349add 100644 --- a/source/Ox.UI/js/Panel/Ox.CollapsePanel.js +++ b/source/Ox.UI/js/Panel/Ox.CollapsePanel.js @@ -83,12 +83,19 @@ Ox.CollapsePanel = function(options, self) { } function toggleCollapsed() { + // show/hide is needed in case the collapsed content + // grows vertically when shrinking the panel horizontally var marginTop; self.options.collapsed = !self.options.collapsed; marginTop = self.options.collapsed ? -that.$content.height() : 0; + !self.options.collapsed && that.css({ + marginTop: -that.$content.height() + 'px' + }).show(); that.$content.animate({ marginTop: marginTop + 'px' - }, 200); + }, 250, function() { + self.options.collapsed && that.hide(); + }); that.triggerEvent('toggle', { collapsed: self.options.collapsed }); diff --git a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js index 199a1fb9..944f8c7e 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js @@ -20,14 +20,14 @@ Ox.AnnotationPanel = function(options, self) { self = self || {}; var that = Ox.Element({}, self) - .defaults({ - id: '', - items: [], - title: '', - type: 'text', - width: 0 - }) - .options(options || {}); + .defaults({ + id: '', + items: [], + title: '', + type: 'text', + width: 0 + }) + .options(options || {}); self.selected = -1; @@ -58,6 +58,8 @@ Ox.AnnotationPanel = function(options, self) { self.$annotations = Ox.List({ construct: function(data) { var $item = Ox.Element() + .addClass('OxAnnotation OxTarget') + .css({padding: '4px 4px 0 4px'}) .append( Ox.Editable({ type: 'textarea', @@ -73,9 +75,7 @@ Ox.AnnotationPanel = function(options, self) { } }) ) - .append($('
').css({height: '4px'})) - .css({padding: '4px 4px 0 4px'}) - .addClass('OxAnnotation OxTarget'); + .append($('
').css({height: '4px'})); return $item; }, items: self.options.items, @@ -155,8 +155,7 @@ Ox.AnnotationPanel = function(options, self) { deselectItems deselectItems @*/ that.deselectItems = function() { - if(self.$annotations.options('selected')) - self.$annotations.options('selected',[]); + self.$annotations.options('selected', []); }; return that; diff --git a/source/Ox.UI/js/Video/Ox.LargeVideoTimeline.js b/source/Ox.UI/js/Video/Ox.LargeVideoTimeline.js index c0849f58..c88b9e93 100644 --- a/source/Ox.UI/js/Video/Ox.LargeVideoTimeline.js +++ b/source/Ox.UI/js/Video/Ox.LargeVideoTimeline.js @@ -175,8 +175,8 @@ Ox.LargeVideoTimeline = function(options, self) { function setSubtitles() { self.$subtitles = []; self.options.subtitles.forEach(function(subtitle, i) { - var found = self.options.find && - subtitle.text.toLowerCase().indexOf(self.options.find.toLowerCase()) > -1; + var found = self.options.find + && subtitle.text.toLowerCase().indexOf(self.options.find.toLowerCase()) > -1; self.$subtitles[i] = $('
') .addClass('OxSubtitle' + (found ? ' OxHighlight' : '')) .css({ @@ -227,7 +227,7 @@ Ox.LargeVideoTimeline = function(options, self) { } else if (key == 'position') { setPosition(); } else if (key == 'subtitles') { - + // ... } else if (key == 'width') { setWidth(); } diff --git a/source/Ox.UI/themes/classic/css/classic.css b/source/Ox.UI/themes/classic/css/classic.css index 6ed42abd..f41181f1 100644 --- a/source/Ox.UI/themes/classic/css/classic.css +++ b/source/Ox.UI/themes/classic/css/classic.css @@ -99,7 +99,6 @@ Bars rgba(0, 0, 0, 0.1) 75%, rgba(0, 0, 0, 0.1) 100% ), -webkit-linear-gradient(top, rgb(224, 224, 224), rgb(192, 192, 192)); - background-size: 32px 32px, 16px 16px; } .OxThemeClassic .OxResizebar > .OxLine { diff --git a/source/Ox/js/HTML.js b/source/Ox/js/HTML.js index b5f4a755..ad047c68 100644 --- a/source/Ox/js/HTML.js +++ b/source/Ox/js/HTML.js @@ -71,7 +71,6 @@ Ox.parseHTML = (function() { } }, tab = '\t'; - return function(html, tags, wikilinks) { var matches = [], tags = tags || defaultTags; @@ -94,17 +93,14 @@ Ox.parseHTML = (function() { html = Ox.encodeHTML(html); html = Ox.parseURLs(html); html = Ox.parseEmailAddresses(html); - //Ox.print('Ox.parseHTML', html, 'matches', matches); matches.forEach(function(match, i) { html = html.replace(new RegExp(tab + i + tab, 'gi'), match); }); - //html = html.replace(/\n/g, '
\n'); html = html.replace(/\n\n/g, '

'); // close extra opening (and remove extra closing) tags // note: this converts '"' to '"' return Ox.element('
').html(html).html(); } - }()); /*@ @@ -132,7 +128,6 @@ Ox.parseURL Takes a URL, returns its components '?a=0&b=1' @*/ Ox.parseURL = (function() { - // fixme: leak memory, like now, or create every time? ... benchmark?? var a = document.createElement('a'), keys = ['hash', 'host', 'hostname', 'origin', 'pathname', 'port', 'protocol', 'search'];