misc fixes

This commit is contained in:
rolux 2012-01-02 19:35:14 +05:30
parent 7ca9a4a9e7
commit b77852296b
7 changed files with 28 additions and 44 deletions

View file

@ -90,14 +90,14 @@ Ox.Progressbar = function(options, self) {
if (self.options.showCancelButton) { if (self.options.showCancelButton) {
self.$cancelButton = Ox.Button(Ox.extend({ self.$cancelButton = Ox.Button(Ox.extend({
style: 'symbol', style: 'symbol',
tooltip: self.options.showRestartButton
? ['Cancel', 'Restart'] : 'Cancel',
type: 'image' type: 'image'
}, self.options.showRestartButton ? { }, self.options.showRestartButton ? {
tooltip: ['Cancel', 'Restart'],
value: 'close', value: 'close',
values: ['close', 'redo'] values: ['close', 'redo']
} : { } : {
title: 'close' title: 'close',
tooltip: 'Cancel'
})) }))
.bindEvent({ .bindEvent({
click: toggleCancelled click: toggleCancelled

View file

@ -367,13 +367,7 @@ Ox.URL = function(options) {
} }
function parseDuration(str) { function parseDuration(str) {
var parts = str.split(':').reverse(); return Ox.parseDuration(str);
while (parts.length > 3) {
parts.pop();
}
return parts.reduce(function(prev, curr, i) {
return prev + (parseFloat(curr) || 0) * Math.pow(60, i);
}, 0);
} }
function parseFind(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) { function parseURL(str, callback) {
// fixme: removing trailing slash makes it impossible to search for '/' // fixme: removing trailing slash makes it impossible to search for '/'
str = str.replace(/(^\/|\/$)/g, ''); str = str.replace(/(^\/|\/$)/g, '');
@ -633,7 +617,7 @@ Ox.URL = function(options) {
} else if (type == 'integer') { } else if (type == 'integer') {
value = Math.round(str) || 0; value = Math.round(str) || 0;
} else if (type == 'time') { } else if (type == 'time') {
value = parseTime(value); value = Ox.formatDurarion(Ox.parseDuration(value));
} else if (type == 'year') { } else if (type == 'year') {
value = Math.round(str) || 1970; value = Math.round(str) || 1970;
} }

View file

@ -83,12 +83,19 @@ Ox.CollapsePanel = function(options, self) {
} }
function toggleCollapsed() { function toggleCollapsed() {
// show/hide is needed in case the collapsed content
// grows vertically when shrinking the panel horizontally
var marginTop; var marginTop;
self.options.collapsed = !self.options.collapsed; self.options.collapsed = !self.options.collapsed;
marginTop = self.options.collapsed ? -that.$content.height() : 0; marginTop = self.options.collapsed ? -that.$content.height() : 0;
!self.options.collapsed && that.css({
marginTop: -that.$content.height() + 'px'
}).show();
that.$content.animate({ that.$content.animate({
marginTop: marginTop + 'px' marginTop: marginTop + 'px'
}, 200); }, 250, function() {
self.options.collapsed && that.hide();
});
that.triggerEvent('toggle', { that.triggerEvent('toggle', {
collapsed: self.options.collapsed collapsed: self.options.collapsed
}); });

View file

@ -58,6 +58,8 @@ Ox.AnnotationPanel = function(options, self) {
self.$annotations = Ox.List({ self.$annotations = Ox.List({
construct: function(data) { construct: function(data) {
var $item = Ox.Element() var $item = Ox.Element()
.addClass('OxAnnotation OxTarget')
.css({padding: '4px 4px 0 4px'})
.append( .append(
Ox.Editable({ Ox.Editable({
type: 'textarea', type: 'textarea',
@ -73,9 +75,7 @@ Ox.AnnotationPanel = function(options, self) {
} }
}) })
) )
.append($('<div>').css({height: '4px'})) .append($('<div>').css({height: '4px'}));
.css({padding: '4px 4px 0 4px'})
.addClass('OxAnnotation OxTarget');
return $item; return $item;
}, },
items: self.options.items, items: self.options.items,
@ -155,8 +155,7 @@ Ox.AnnotationPanel = function(options, self) {
deselectItems <f> deselectItems deselectItems <f> deselectItems
@*/ @*/
that.deselectItems = function() { that.deselectItems = function() {
if(self.$annotations.options('selected')) self.$annotations.options('selected', []);
self.$annotations.options('selected',[]);
}; };
return that; return that;

View file

@ -175,8 +175,8 @@ Ox.LargeVideoTimeline = function(options, self) {
function setSubtitles() { function setSubtitles() {
self.$subtitles = []; self.$subtitles = [];
self.options.subtitles.forEach(function(subtitle, i) { self.options.subtitles.forEach(function(subtitle, i) {
var found = self.options.find && var found = self.options.find
subtitle.text.toLowerCase().indexOf(self.options.find.toLowerCase()) > -1; && subtitle.text.toLowerCase().indexOf(self.options.find.toLowerCase()) > -1;
self.$subtitles[i] = $('<div>') self.$subtitles[i] = $('<div>')
.addClass('OxSubtitle' + (found ? ' OxHighlight' : '')) .addClass('OxSubtitle' + (found ? ' OxHighlight' : ''))
.css({ .css({
@ -227,7 +227,7 @@ Ox.LargeVideoTimeline = function(options, self) {
} else if (key == 'position') { } else if (key == 'position') {
setPosition(); setPosition();
} else if (key == 'subtitles') { } else if (key == 'subtitles') {
// ...
} else if (key == 'width') { } else if (key == 'width') {
setWidth(); setWidth();
} }

View file

@ -99,7 +99,6 @@ Bars
rgba(0, 0, 0, 0.1) 75%, rgba(0, 0, 0, 0.1) 100% 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)); -webkit-linear-gradient(top, rgb(224, 224, 224), rgb(192, 192, 192));
background-size: 32px 32px, 16px 16px;
} }
.OxThemeClassic .OxResizebar > .OxLine { .OxThemeClassic .OxResizebar > .OxLine {

View file

@ -71,7 +71,6 @@ Ox.parseHTML = (function() {
} }
}, },
tab = '\t'; tab = '\t';
return function(html, tags, wikilinks) { return function(html, tags, wikilinks) {
var matches = [], var matches = [],
tags = tags || defaultTags; tags = tags || defaultTags;
@ -94,17 +93,14 @@ Ox.parseHTML = (function() {
html = Ox.encodeHTML(html); html = Ox.encodeHTML(html);
html = Ox.parseURLs(html); html = Ox.parseURLs(html);
html = Ox.parseEmailAddresses(html); html = Ox.parseEmailAddresses(html);
//Ox.print('Ox.parseHTML', html, 'matches', matches);
matches.forEach(function(match, i) { matches.forEach(function(match, i) {
html = html.replace(new RegExp(tab + i + tab, 'gi'), match); html = html.replace(new RegExp(tab + i + tab, 'gi'), match);
}); });
//html = html.replace(/\n/g, '<br/>\n');
html = html.replace(/\n\n/g, '<br/><br/>'); html = html.replace(/\n\n/g, '<br/><br/>');
// close extra opening (and remove extra closing) tags // close extra opening (and remove extra closing) tags
// note: this converts '&quot;' to '"' // note: this converts '&quot;' to '"'
return Ox.element('<div>').html(html).html(); return Ox.element('<div>').html(html).html();
} }
}()); }());
/*@ /*@
@ -132,7 +128,6 @@ Ox.parseURL <f> Takes a URL, returns its components
'?a=0&b=1' '?a=0&b=1'
@*/ @*/
Ox.parseURL = (function() { Ox.parseURL = (function() {
// fixme: leak memory, like now, or create every time? ... benchmark??
var a = document.createElement('a'), var a = document.createElement('a'),
keys = ['hash', 'host', 'hostname', 'origin', keys = ['hash', 'host', 'hostname', 'origin',
'pathname', 'port', 'protocol', 'search']; 'pathname', 'port', 'protocol', 'search'];