diff --git a/source/Ox.UI/js/Core/Ox.URL.js b/source/Ox.UI/js/Core/Ox.URL.js index 0d47bd44..432f0ec3 100644 --- a/source/Ox.UI/js/Core/Ox.URL.js +++ b/source/Ox.UI/js/Core/Ox.URL.js @@ -125,9 +125,12 @@ example.com/2001/2001 -> example.com/0062622/video/00:33:21 example.com/2002/2002 -> example.com/calendar/2002/2002 2002 is a valid duration, but no list view supports durations. Then it is read as a year, and we get calendar view with find *=2002 +example.com/@paris/london -> example.com/map/@paris/london + paris matches place ABC (case-insensitive), but (assuming) find *=london + does not match place ABC, "paris" becomes the map query example.com/@paris/paris -> example.com/map/ABC/paris - paris matches a place name (case-insensitive), so we get map view, zoomed to - Paris, with find *=paris + paris matches place ABC (case-insensitive), so we get map view, zoomed to + ABC/Paris, which is selected, with find *=paris example.com/@renaissance/renaissance -> example.com/calendar/ABC/renaissance renaissaince matches an event name (case-insensitive), so we get calendar view, zoomed to the Renaissance, with find *=renaissance @@ -200,13 +203,9 @@ Ox.URL = function(options) { function constructFind(find) { return find.conditions.map(function(condition) { - var ret; - if (condition.conditions) { - ret = '(' + constructFind(condition) + ')'; - } else { - ret = constructCondition(condition); - } - return ret; + return condition.conditions + ? '(' + constructFind(condition) + ')' + : constructCondition(condition); }).join(find.operator); } @@ -275,10 +274,7 @@ Ox.URL = function(options) { type = Ox.isArray(findKey.type) ? findKey.type[0] : findKey.type, value = str, values = findKey.values; - if (type == 'enum') { - return values[value]; - } - return value; + return type == 'enum' ? values[value] : value; } function decodeValue(str) { @@ -531,6 +527,7 @@ Ox.URL = function(options) { if (!state.span && /^[A-Z@]/.test(parts[0])) { // test for span id or name self.options.getSpan(state.item, state.view, parts[0].replace(/%20/g, ' '), function(span, view) { + Ox.Log('Core', 'span/view', span, view) if (span) { if (!state.view) { // set list or item view diff --git a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js index 81d899bd..215c3e70 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js @@ -82,6 +82,7 @@ Ox.AnnotationPanel = function(options, self) { self.$annotations = Ox.ArrayEditable({ editable: self.options.editable, items: getAnnotations(), + selected: self.options.selected, sort: self.sort, width: self.options.width, type: self.options.type == 'text' ? 'textarea' : 'input' @@ -104,20 +105,16 @@ Ox.AnnotationPanel = function(options, self) { } self.$annotations.appendTo(that.$content); - /* - self.$annotations = Ox.Element() - .appendTo(that.$content); - self.$annotation = []; - self.options.items.forEach(function(item, i) { - self.$annotation[i] = Ox.Element() - .addClass('OxAnnotation') - .html(item.value.replace(/\n/g, '
')) - .click(function() { - clickAnnotation(i); - }) - .appendTo(self.$annotations); - }); - */ + Ox.print('SOS', self.options.selected); + self.options.selected && setTimeout(function() { + selectAnnotation({id: self.options.selected}); + }, 0); + + function editAnnotation(data) { + var item = Ox.getObjectById(self.options.items, data.id); + item.value = data.value; + that.triggerEvent('submit', item); + } function getAnnotations() { return self.options.items.filter(function(item) { @@ -128,7 +125,7 @@ Ox.AnnotationPanel = function(options, self) { ) || ( self.options.range == 'position' && item['in'] <= self.options.position - && item.out > self.options.position + && item.out >= self.options.position ) }); } @@ -144,12 +141,6 @@ Ox.AnnotationPanel = function(options, self) { } : {})); } - function editAnnotation(data) { - var item = Ox.getObjectById(self.options.items, data.id); - item.value = data.value; - that.triggerEvent('submit', item); - } - function togglePanel() { } diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index 42f1c5e3..86e259a8 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -157,6 +157,8 @@ Ox.VideoEditor = function(options, self) { margin: 8, }); + Ox.print('VIDEO EDITOR OPTIONS', self.options) + self.words = []; Ox.forEach(Ox.count(Ox.words(self.options.subtitles.map(function(subtitle) { return subtitle.text; @@ -309,6 +311,8 @@ Ox.VideoEditor = function(options, self) { self.$annotationPanel = []; self.options.layers.forEach(function(layer, i) { + var item = Ox.getObjectById(layer.items, self.options.selected), + selected = item ? item.id : ''; self.$annotationPanel[i] = Ox.AnnotationPanel( Ox.extend({ font: self.options.annotationsFont, @@ -316,7 +320,7 @@ Ox.VideoEditor = function(options, self) { out: self.options.out, position: self.options.position, range: self.options.annotationsRange, - // selected: self.options.selected, + selected: selected, sort: self.options.annotationsSort, width: self.options.annotationsSize - Ox.UI.SCROLLBAR_SIZE }, layer) @@ -338,13 +342,15 @@ Ox.VideoEditor = function(options, self) { }); }, select: function(data) { - if(data.id) { + if (data.id) { self.options.layers.forEach(function(layer_, i_) { if (i_ != i) { self.$annotationPanel[i_].deselectItems(); } }); selectAnnotation(data); + } else { + // ... } }, submit: editAnnotation @@ -873,9 +879,9 @@ Ox.VideoEditor = function(options, self) { //Ox.Log('Video', 'getSizes', scrollbarIsVisible, height, self.options.height, size) return (!scrollbarIsVisible && height > self.options.height - 16) ? getSizes(true) : size; function getHeight() { - return size.player[0].height + self.controlsHeight + - size.timeline[0].height + lines * 16 + - (lines + 3) * self.margin; + return size.player[0].height + self.controlsHeight + + size.timeline[0].height + lines * 16 + + (lines + 3) * self.margin; } } @@ -930,11 +936,14 @@ Ox.VideoEditor = function(options, self) { function selectAnnotation(data) { self.options.annotationsRange != 'position' && setPosition(data['in']); + setState(data.id ? 'selected' : 'default'); + that.triggerEvent('select', { + id: data.id || '' + }); if (data.id) { setPoint('in', data['in']); setPoint('out', data.out); } - setState(data.id ? 'selected' : 'default'); } function select(type) { @@ -942,7 +951,7 @@ Ox.VideoEditor = function(options, self) { setPoints(); } - function setPoint(point, position) { + function setPoint(point, position, annotation) { var otherPoint = point == 'in' ? 'out' : 'in'; self.options[point] = position; if (self.options.state == 'selected') {