Compare commits
8 commits
570fa30d41
...
6e1e2be9c4
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e1e2be9c4 | |||
| 01596fa174 | |||
| 8e760c3959 | |||
| 4cde39b182 | |||
| 6341e64a64 | |||
| 03eb3d4a56 | |||
| 96d4dfe71d | |||
| 168cdd691c |
5 changed files with 139 additions and 37 deletions
|
|
@ -16,6 +16,9 @@ a:hover, .OxLink:hover {
|
||||||
blockquote {
|
blockquote {
|
||||||
margin: 0 1.5em 0 1.5em;
|
margin: 0 1.5em 0 1.5em;
|
||||||
}
|
}
|
||||||
|
html, body {
|
||||||
|
overscroll-behavior: none;
|
||||||
|
}
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ Ox.ArrayEditable = function(options, self) {
|
||||||
var that = Ox.Element({}, self)
|
var that = Ox.Element({}, self)
|
||||||
.defaults({
|
.defaults({
|
||||||
clickLink: null,
|
clickLink: null,
|
||||||
|
confirmDeleteDialog: null,
|
||||||
editable: true,
|
editable: true,
|
||||||
format: null,
|
format: null,
|
||||||
getSortValue: null,
|
getSortValue: null,
|
||||||
|
|
@ -116,23 +117,31 @@ Ox.ArrayEditable = function(options, self) {
|
||||||
|
|
||||||
self.selected = getSelectedPosition();
|
self.selected = getSelectedPosition();
|
||||||
|
|
||||||
function deleteItem(id) {
|
function deleteItem(id, empty) {
|
||||||
// it is possible to delete an (empty-value) item
|
// it is possible to delete an (empty-value) item
|
||||||
// by selecting another one
|
// by selecting another one
|
||||||
id = id || self.options.selected;
|
id = id || self.options.selected;
|
||||||
var position = Ox.getIndexById(self.options.items, id)
|
|
||||||
if (self.options.editable) {
|
(self.options.confirmDeleteDialog && !empty ? self.options.confirmDeleteDialog: Ox.noop)({
|
||||||
self.options.items.splice(position, 1);
|
items: Ox.isArray(id) ? id : [id],
|
||||||
renderItems();
|
}, function(result) {
|
||||||
that.triggerEvent('delete', {id: id});
|
if (self.options.editable) {
|
||||||
self.editing = false;
|
(Ox.isArray(id) ? id : [id]).forEach(id => {
|
||||||
if (self.options.selected == id) {
|
var position = Ox.getIndexById(self.options.items, id)
|
||||||
self.selected = -1;
|
self.options.items.splice(position, 1);
|
||||||
self.options.selected = '';
|
that.triggerEvent('delete', {id: id});
|
||||||
} else if (self.options.selected) {
|
})
|
||||||
self.selected = Ox.getIndexById(self.options.item, self.options.selected)
|
renderItems();
|
||||||
|
self.editing = false;
|
||||||
|
if (self.options.selected == id) {
|
||||||
|
self.selected = -1;
|
||||||
|
self.options.selected = '';
|
||||||
|
} else if (self.options.selected) {
|
||||||
|
self.selected = Ox.getIndexById(self.options.item, self.options.selected)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function doubleclick(e) {
|
function doubleclick(e) {
|
||||||
|
|
@ -146,12 +155,20 @@ Ox.ArrayEditable = function(options, self) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getId(position) {
|
||||||
|
return position > -1 ? self.options.items[position].id : '';
|
||||||
|
}
|
||||||
|
|
||||||
function getSelectedId() {
|
function getSelectedId() {
|
||||||
return self.selected > -1 ? self.options.items[self.selected].id : '';
|
return getId(self.selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPosition(id) {
|
||||||
|
return Ox.getIndexById(self.options.items, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSelectedPosition() {
|
function getSelectedPosition() {
|
||||||
return Ox.getIndexById(self.options.items, self.options.selected);
|
return getPosition(self.options.selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderItems(blur) {
|
function renderItems(blur) {
|
||||||
|
|
@ -267,6 +284,50 @@ Ox.ArrayEditable = function(options, self) {
|
||||||
: that.triggerEvent('selectprevious');
|
: that.triggerEvent('selectprevious');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function toggleItem(idOrPosition) {
|
||||||
|
var id, position;
|
||||||
|
if (Ox.isString(idOrPosition)) {
|
||||||
|
id = idOrPosition
|
||||||
|
position = getPosition(id);
|
||||||
|
} else {
|
||||||
|
position = idOrPosition
|
||||||
|
id = getId(position);
|
||||||
|
}
|
||||||
|
if (!Ox.isArray(self.options.selected)) {
|
||||||
|
self.options.selected = [self.options.selected]
|
||||||
|
}
|
||||||
|
if (!Ox.isArray(self.selected)) {
|
||||||
|
self.selected = [self.selected]
|
||||||
|
}
|
||||||
|
if (!self.options.selected.includes(id)) {
|
||||||
|
var minPos, maxPos;
|
||||||
|
if (Ox.min(self.selected) > position) {
|
||||||
|
minPos = position
|
||||||
|
maxPos = Ox.min(self.selected)
|
||||||
|
} else {
|
||||||
|
minPos = Ox.max(self.selected) + 1
|
||||||
|
maxPos = position + 1
|
||||||
|
}
|
||||||
|
Ox.range(minPos, maxPos).forEach(pos => {
|
||||||
|
self.selected.push(pos)
|
||||||
|
self.options.selected.push(getId(pos))
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
that.find('.OxSelected').removeClass('OxSelected').removeClass('OxMultiple');
|
||||||
|
that.find('.OxGroup').removeClass('OxGroup')
|
||||||
|
if (self.options.selected.length == 1) {
|
||||||
|
self.options.selected = self.options.selected[0]
|
||||||
|
self.selected = self.selected[0]
|
||||||
|
self.$items[self.selected].addClass('OxSelected');
|
||||||
|
self.options.highlightGroup && that.updateItemGroup()
|
||||||
|
} else {
|
||||||
|
Ox.forEach(self.selected, function(selected) {
|
||||||
|
self.$items[selected].addClass('OxSelected').addClass('OxMultiple');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
triggerSelectEvent();
|
||||||
|
}
|
||||||
|
|
||||||
function selectItem(idOrPosition) {
|
function selectItem(idOrPosition) {
|
||||||
if (Ox.isString(idOrPosition)) {
|
if (Ox.isString(idOrPosition)) {
|
||||||
|
|
@ -327,8 +388,14 @@ Ox.ArrayEditable = function(options, self) {
|
||||||
position = $element.data('position');
|
position = $element.data('position');
|
||||||
// if clicked on an element
|
// if clicked on an element
|
||||||
if (position != self.selected) {
|
if (position != self.selected) {
|
||||||
// select another item
|
if (e.shiftKey && self.selected != -1) {
|
||||||
selectItem(position);
|
// add/remove item from multiple selection
|
||||||
|
document.getSelection().removeAllRanges();
|
||||||
|
toggleItem(position);
|
||||||
|
} else {
|
||||||
|
// select another item
|
||||||
|
selectItem(position);
|
||||||
|
}
|
||||||
} else if (e.metaKey) {
|
} else if (e.metaKey) {
|
||||||
// or deselect current item
|
// or deselect current item
|
||||||
selectNone();
|
selectNone();
|
||||||
|
|
@ -370,7 +437,7 @@ Ox.ArrayEditable = function(options, self) {
|
||||||
var item = Ox.getObjectById(self.options.items, id);
|
var item = Ox.getObjectById(self.options.items, id);
|
||||||
Ox.Log('AE', 'submitItem', id, item)
|
Ox.Log('AE', 'submitItem', id, item)
|
||||||
if (value === '') {
|
if (value === '') {
|
||||||
deleteItem(item.id);
|
deleteItem(item.id, true);
|
||||||
} else {
|
} else {
|
||||||
that.triggerEvent(item.value === value ? 'blur' : 'submit', {
|
that.triggerEvent(item.value === value ? 'blur' : 'submit', {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
var that = Ox.Element({}, self)
|
var that = Ox.Element({}, self)
|
||||||
.defaults({
|
.defaults({
|
||||||
clickLink: null,
|
clickLink: null,
|
||||||
|
confirmDeleteDialog: null,
|
||||||
collapsed: false,
|
collapsed: false,
|
||||||
editable: false,
|
editable: false,
|
||||||
highlight: '',
|
highlight: '',
|
||||||
|
|
@ -281,6 +282,7 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
}
|
}
|
||||||
self.$annotations = Ox.ArrayEditable(Ox.extend({
|
self.$annotations = Ox.ArrayEditable(Ox.extend({
|
||||||
clickLink: self.options.clickLink,
|
clickLink: self.options.clickLink,
|
||||||
|
confirmDeleteDialog: self.options.confirmDeleteDialog,
|
||||||
editable: self.options.editable,
|
editable: self.options.editable,
|
||||||
getSortValue: self.options.type == 'text'
|
getSortValue: self.options.type == 'text'
|
||||||
? function(value) {
|
? function(value) {
|
||||||
|
|
@ -579,26 +581,40 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
|
|
||||||
function selectAnnotation(data) {
|
function selectAnnotation(data) {
|
||||||
if (self.loaded) {
|
if (self.loaded) {
|
||||||
var item = Ox.getObjectById(self.options.items, data.id);
|
var extendedData;
|
||||||
self.options.selected = item ? data.id : '';
|
if (Ox.isArray(data.id) && data.id.length) {
|
||||||
if (self.widget) {
|
var items = data.id.map(id => {
|
||||||
if (self.options.type == 'event') {
|
return Ox.getObjectById(self.options.items, id);
|
||||||
self.$calendar.options({
|
})
|
||||||
selected: item && isDefined(item) ? item.event.id : ''
|
self.options.selected = data.id;
|
||||||
})
|
extendedData = Ox.extend(data, {
|
||||||
.panToEvent();
|
'in': Ox.min(items.map(item => { return item["in"]; })),
|
||||||
} else {
|
out: Ox.max(items.map(item => { return item["out"]; })),
|
||||||
self.$map.options({
|
layer: self.options.id
|
||||||
selected: item && isDefined(item) ? item.place.id : ''
|
});
|
||||||
})
|
} else {
|
||||||
.panToPlace();
|
var item = Ox.getObjectById(self.options.items, data.id)
|
||||||
|
self.options.selected = item ? data.id : '';
|
||||||
|
if (self.widget) {
|
||||||
|
if (self.options.type == 'event') {
|
||||||
|
self.$calendar.options({
|
||||||
|
selected: item && isDefined(item) ? item.event.id : ''
|
||||||
|
})
|
||||||
|
.panToEvent();
|
||||||
|
} else {
|
||||||
|
self.$map.options({
|
||||||
|
selected: item && isDefined(item) ? item.place.id : ''
|
||||||
|
})
|
||||||
|
.panToPlace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
extendedData = Ox.extend(data, item ? {
|
||||||
|
'in': item['in'],
|
||||||
|
out: item.out,
|
||||||
|
layer: self.options.id
|
||||||
|
} : {});
|
||||||
}
|
}
|
||||||
that.triggerEvent('select', Ox.extend(data, item ? {
|
that.triggerEvent('select', extendedData)
|
||||||
'in': item['in'],
|
|
||||||
out: item.out,
|
|
||||||
layer: self.options.id
|
|
||||||
} : {}));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,11 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
.defaults({
|
.defaults({
|
||||||
calendarSize: 256,
|
calendarSize: 256,
|
||||||
clickLink: null,
|
clickLink: null,
|
||||||
|
confirmDeleteDialog: null,
|
||||||
editable: false,
|
editable: false,
|
||||||
enableExport: false,
|
enableExport: false,
|
||||||
enableImport: false,
|
enableImport: false,
|
||||||
|
enableTranscribe: false,
|
||||||
highlight: '',
|
highlight: '',
|
||||||
highlightAnnotations: 'none',
|
highlightAnnotations: 'none',
|
||||||
highlightLayer: '*',
|
highlightLayer: '*',
|
||||||
|
|
@ -303,7 +305,11 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
{},
|
{},
|
||||||
{id: 'import', title: Ox._('Import Annotations...'), disabled: !self.options.enableImport},
|
{id: 'import', title: Ox._('Import Annotations...'), disabled: !self.options.enableImport},
|
||||||
{id: 'export', title: Ox._('Export Annotations...'), disabled: !self.options.enableExport},
|
{id: 'export', title: Ox._('Export Annotations...'), disabled: !self.options.enableExport},
|
||||||
]
|
].concat(
|
||||||
|
self.options.enableTranscribe ? [
|
||||||
|
{id: 'transcribeaudio', title: Ox._('Transcribe Audio...')},
|
||||||
|
]: []
|
||||||
|
)
|
||||||
),
|
),
|
||||||
maxWidth: 256,
|
maxWidth: 256,
|
||||||
style: 'square',
|
style: 'square',
|
||||||
|
|
@ -351,6 +357,8 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
// ...
|
// ...
|
||||||
} else if (data.id == 'showentityinfo') {
|
} else if (data.id == 'showentityinfo') {
|
||||||
that.triggerEvent('showentityinfo', annotation.entity);
|
that.triggerEvent('showentityinfo', annotation.entity);
|
||||||
|
} else if (data.id == 'transcribeaudio') {
|
||||||
|
that.triggerEvent('transcribeaudio');
|
||||||
} else if (data.id == 'undo') {
|
} else if (data.id == 'undo') {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
@ -371,6 +379,7 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
self.$folder[index] = Ox.AnnotationFolder(
|
self.$folder[index] = Ox.AnnotationFolder(
|
||||||
Ox.extend({
|
Ox.extend({
|
||||||
clickLink: self.options.clickLink,
|
clickLink: self.options.clickLink,
|
||||||
|
confirmDeleteDialog: self.options.confirmDeleteDialog,
|
||||||
collapsed: !self.options.showLayers[layer.id],
|
collapsed: !self.options.showLayers[layer.id],
|
||||||
editable: self.options.editable,
|
editable: self.options.editable,
|
||||||
highlight: getHighlight(layer.id),
|
highlight: getHighlight(layer.id),
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,13 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
censoredIcon: '',
|
censoredIcon: '',
|
||||||
censoredTooltip: '',
|
censoredTooltip: '',
|
||||||
clickLink: null,
|
clickLink: null,
|
||||||
|
confirmDeleteDialog: null,
|
||||||
cuts: [],
|
cuts: [],
|
||||||
duration: 0,
|
duration: 0,
|
||||||
enableDownload: false,
|
enableDownload: false,
|
||||||
enableImport: false,
|
enableImport: false,
|
||||||
enableExport: false,
|
enableExport: false,
|
||||||
|
enableTranscribe: false,
|
||||||
enableSetPosterFrame: false,
|
enableSetPosterFrame: false,
|
||||||
enableSubtitles: false,
|
enableSubtitles: false,
|
||||||
find: '',
|
find: '',
|
||||||
|
|
@ -844,9 +846,11 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
autocomplete: self.options.autocomplete,
|
autocomplete: self.options.autocomplete,
|
||||||
calendarSize: self.options.annotationsCalendarSize,
|
calendarSize: self.options.annotationsCalendarSize,
|
||||||
clickLink: self.options.clickLink,
|
clickLink: self.options.clickLink,
|
||||||
|
confirmDeleteDialog: self.options.confirmDeleteDialog,
|
||||||
editable: true,
|
editable: true,
|
||||||
enableExport: self.options.enableExport,
|
enableExport: self.options.enableExport,
|
||||||
enableImport: self.options.enableImport,
|
enableImport: self.options.enableImport,
|
||||||
|
enableTranscribe: self.options.enableTranscribe,
|
||||||
highlight: self.options.find,
|
highlight: self.options.find,
|
||||||
highlightAnnotations: self.options.annotationsHighlight,
|
highlightAnnotations: self.options.annotationsHighlight,
|
||||||
highlightLayer: self.options.findLayer,
|
highlightLayer: self.options.findLayer,
|
||||||
|
|
@ -949,6 +953,9 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
that.triggerEvent('showentityinfo', data);
|
that.triggerEvent('showentityinfo', data);
|
||||||
},
|
},
|
||||||
submit: submitAnnotation,
|
submit: submitAnnotation,
|
||||||
|
transcribeaudio: function() {
|
||||||
|
that.triggerEvent('transcribeaudio');
|
||||||
|
},
|
||||||
toggle: toggleAnnotations,
|
toggle: toggleAnnotations,
|
||||||
togglecalendar: function(data) {
|
togglecalendar: function(data) {
|
||||||
self.options.showAnnotationsCalendar = !data.collapsed;
|
self.options.showAnnotationsCalendar = !data.collapsed;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue