Compare commits
8 commits
ffeee38d7d
...
cb42e1d7fa
| Author | SHA1 | Date | |
|---|---|---|---|
| cb42e1d7fa | |||
| c61d173922 | |||
| 47fc01742f | |||
| 009cdd68c3 | |||
| c2d35e615d | |||
| 396fac63c0 | |||
| 290afaf332 | |||
| e497e7a7ac |
7 changed files with 52 additions and 30 deletions
|
|
@ -55,8 +55,10 @@
|
||||||
{
|
{
|
||||||
'name': 'a',
|
'name': 'a',
|
||||||
'required': ['href'],
|
'required': ['href'],
|
||||||
|
'optional': ['target'],
|
||||||
'validate': {
|
'validate': {
|
||||||
'href': /^((https?:\/\/|\/|mailto:).*?)/
|
'href': /^((https?:\/\/|\/|mailto:).*?)/,
|
||||||
|
'target': /^_blank$/
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{'name': 'br'},
|
{'name': 'br'},
|
||||||
|
|
@ -507,6 +509,8 @@
|
||||||
'<a href="http://www.foo.com/">http://www.foo.com/</a>'
|
'<a href="http://www.foo.com/">http://www.foo.com/</a>'
|
||||||
> Ox.sanitizeHTML('<a href="http://foo.com" onclick="alert()">foo</a>')
|
> Ox.sanitizeHTML('<a href="http://foo.com" onclick="alert()">foo</a>')
|
||||||
'<a href="http://foo.com">foo</a>'
|
'<a href="http://foo.com">foo</a>'
|
||||||
|
> Ox.sanitizeHTML('<a href="http://foo.com" target="_blank">foo</a>')
|
||||||
|
'<a href="http://foo.com" target="_blank">foo</a>'
|
||||||
> Ox.sanitizeHTML('<a href="javascript:alert()">foo</a>')
|
> Ox.sanitizeHTML('<a href="javascript:alert()">foo</a>')
|
||||||
'<a href="javascript:alert()">foo</a>'
|
'<a href="javascript:alert()">foo</a>'
|
||||||
> Ox.sanitizeHTML('<a href="foo">foo</a>')
|
> Ox.sanitizeHTML('<a href="foo">foo</a>')
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@
|
||||||
Ox.LOCALE = locale;
|
Ox.LOCALE = locale;
|
||||||
if (locale == 'en') {
|
if (locale == 'en') {
|
||||||
translations = {};
|
translations = {};
|
||||||
callback(true);
|
|
||||||
} else {
|
} else {
|
||||||
translations = {};
|
translations = {};
|
||||||
Ox.forEach(Ox.LOCALES, function(locales, module) {
|
Ox.forEach(Ox.LOCALES, function(locales, module) {
|
||||||
|
|
@ -45,15 +44,19 @@
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
url && Ox.makeArray(url).forEach(function(value) {
|
url && Ox.makeArray(url).forEach(function(value) {
|
||||||
urls.push(Ox.makeArray(value));
|
urls.push(Ox.makeArray(value));
|
||||||
});
|
});
|
||||||
|
if (urls.length) {
|
||||||
Ox.getJSON(urls, function(data) {
|
Ox.getJSON(urls, function(data) {
|
||||||
Ox.forEach(data, function(values, url) {
|
Ox.forEach(data, function(values, url) {
|
||||||
Ox.extend(translations, values);
|
Ox.extend(translations, values);
|
||||||
});
|
});
|
||||||
callback(true);
|
callback(true);
|
||||||
});
|
})
|
||||||
|
} else {
|
||||||
|
callback(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
callback(false);
|
callback(false);
|
||||||
|
|
|
||||||
|
|
@ -810,7 +810,8 @@ Ox.URL = function(options) {
|
||||||
|
|
||||||
function parseURL(str, callback) {
|
function parseURL(str, callback) {
|
||||||
// remove facebook spam
|
// remove facebook spam
|
||||||
str = str.replace(/\?fbclid=[A-Za-z0-9_]+/, '')
|
//str = str.replace(/\?fbclid=[A-Za-z0-9_]+/, '')
|
||||||
|
str = str.replace(/\?fbclid=.*/, '')
|
||||||
// fixme: removing trailing slash makes it impossible to search for '/'
|
// fixme: removing trailing slash makes it impossible to search for '/'
|
||||||
|
|
||||||
var split = str.split('#'),
|
var split = str.split('#'),
|
||||||
|
|
|
||||||
|
|
@ -220,10 +220,11 @@ Ox.ArrayEditable = function(options, self) {
|
||||||
}, 250);
|
}, 250);
|
||||||
},
|
},
|
||||||
cancel: function(data) {
|
cancel: function(data) {
|
||||||
|
var id = $(this).data('id');
|
||||||
self.editing = false;
|
self.editing = false;
|
||||||
that.gainFocus();
|
that.gainFocus();
|
||||||
data.value === ''
|
data.value === ''
|
||||||
? submitItem(i, '')
|
? submitItem(id, '')
|
||||||
: that.triggerEvent('blur', data);
|
: that.triggerEvent('blur', data);
|
||||||
},
|
},
|
||||||
change: function(data) {
|
change: function(data) {
|
||||||
|
|
@ -247,9 +248,10 @@ Ox.ArrayEditable = function(options, self) {
|
||||||
that.triggerEvent('open');
|
that.triggerEvent('open');
|
||||||
},
|
},
|
||||||
submit: function(data) {
|
submit: function(data) {
|
||||||
|
var id = $(this).data('id');
|
||||||
self.editing = false;
|
self.editing = false;
|
||||||
that.gainFocus();
|
that.gainFocus();
|
||||||
submitItem(i, data.value);
|
submitItem(id, data.value);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.appendTo(that);
|
.appendTo(that);
|
||||||
|
|
@ -364,8 +366,9 @@ Ox.ArrayEditable = function(options, self) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitItem(position, value) {
|
function submitItem(id, value) {
|
||||||
var item = self.options.items[position];
|
var item = Ox.getObjectById(self.options.items, id);
|
||||||
|
Ox.Log('AE', 'submitItem', id, item)
|
||||||
if (value === '') {
|
if (value === '') {
|
||||||
deleteItem(item.id);
|
deleteItem(item.id);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,10 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
}
|
}
|
||||||
if (['in', 'out'].indexOf(key) > -1 && self.editing) {
|
if (['in', 'out'].indexOf(key) > -1 && self.editing) {
|
||||||
var item = Ox.getObjectById(self.options.items, self.options.selected);
|
var item = Ox.getObjectById(self.options.items, self.options.selected);
|
||||||
|
if (item) {
|
||||||
item[key] = value;
|
item[key] = value;
|
||||||
item.duration = self.options.out - self.options['in'];
|
item.duration = self.options.out - self.options['in'];
|
||||||
|
}
|
||||||
self.points = getPoints();
|
self.points = getPoints();
|
||||||
}
|
}
|
||||||
if (key == 'in') {
|
if (key == 'in') {
|
||||||
|
|
@ -325,7 +327,7 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
that.triggerEvent('add', {value: data.value || ''});
|
that.triggerEvent('add', {value: data.value || ''});
|
||||||
},
|
},
|
||||||
blur: function(data) {
|
blur: function(data) {
|
||||||
if (data && data.id[0] == '_') {
|
if (data && data.id && data.id[0] == '_') {
|
||||||
changeAnnotation(data);
|
changeAnnotation(data);
|
||||||
that.triggerEvent('blur');
|
that.triggerEvent('blur');
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -620,11 +622,13 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
|
|
||||||
function submitAnnotation(data) {
|
function submitAnnotation(data) {
|
||||||
var item = Ox.getObjectById(self.options.items, data.id);
|
var item = Ox.getObjectById(self.options.items, data.id);
|
||||||
|
if (item) {
|
||||||
item.value = data.value;
|
item.value = data.value;
|
||||||
self.editing = false;
|
self.editing = false;
|
||||||
self.options.sort == 'text' && self.$annotations.reloadItems();
|
self.options.sort == 'text' && self.$annotations.reloadItems();
|
||||||
that.triggerEvent('submit', item);
|
that.triggerEvent('submit', item);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function toggleLayer() {
|
function toggleLayer() {
|
||||||
self.options.collapsed = !self.options.collapsed;
|
self.options.collapsed = !self.options.collapsed;
|
||||||
|
|
@ -749,6 +753,7 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
(id, data) -> <o> update item
|
(id, data) -> <o> update item
|
||||||
@*/
|
@*/
|
||||||
that.updateItem = function(id, data) {
|
that.updateItem = function(id, data) {
|
||||||
|
Ox.Log('AF', 'updateItem', id, data)
|
||||||
var item = Ox.getObjectById(self.options.items, id);
|
var item = Ox.getObjectById(self.options.items, id);
|
||||||
Ox.forEach(data, function(value, key) {
|
Ox.forEach(data, function(value, key) {
|
||||||
item[key] = value;
|
item[key] = value;
|
||||||
|
|
@ -760,7 +765,7 @@ Ox.AnnotationFolder = function(options, self) {
|
||||||
if (id != item.id) {
|
if (id != item.id) {
|
||||||
self.$annotations.find('.OxEditableElement').each(function() {
|
self.$annotations.find('.OxEditableElement').each(function() {
|
||||||
var $element = $(this);
|
var $element = $(this);
|
||||||
if ($element.data('id') == self.options.selected) {
|
if ($element.data('id') == id) {
|
||||||
$element.data({id: item.id});
|
$element.data({id: item.id});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -737,7 +737,10 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
@*/
|
@*/
|
||||||
that.blurItem = function() {
|
that.blurItem = function() {
|
||||||
self.editing = false;
|
self.editing = false;
|
||||||
getFolder(self.options.selected).blurItem();
|
var $folder = getFolder(self.options.selected)
|
||||||
|
if ($folder) {
|
||||||
|
$folder.blurItem();
|
||||||
|
}
|
||||||
renderEditMenu();
|
renderEditMenu();
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
@ -805,7 +808,10 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
// called from editannotation callback
|
// called from editannotation callback
|
||||||
// on the first update of a new annotation, the id will change
|
// on the first update of a new annotation, the id will change
|
||||||
self.options.selected = item.id;
|
self.options.selected = item.id;
|
||||||
getFolder(id).updateItem(id, item);
|
var $folder = getFolder(id);
|
||||||
|
if ($folder) {
|
||||||
|
$folder.updateItem(id, item);
|
||||||
|
}
|
||||||
updateLanguages();
|
updateLanguages();
|
||||||
renderOptionsMenu();
|
renderOptionsMenu();
|
||||||
renderEditMenu();
|
renderEditMenu();
|
||||||
|
|
|
||||||
|
|
@ -938,7 +938,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
that.triggerEvent('resizemap', data);
|
that.triggerEvent('resizemap', data);
|
||||||
},
|
},
|
||||||
select: function(data) {
|
select: function(data) {
|
||||||
selectAnnotation(data, true);
|
selectAnnotation(data, !self.updating);
|
||||||
},
|
},
|
||||||
showentityinfo: function(data) {
|
showentityinfo: function(data) {
|
||||||
that.triggerEvent('showentityinfo', data);
|
that.triggerEvent('showentityinfo', data);
|
||||||
|
|
@ -1340,7 +1340,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
that.triggerEvent('annotationssize', {size: data.size});
|
that.triggerEvent('annotationssize', {size: data.size});
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectAnnotation(data, stayAtPosition) {
|
function selectAnnotation(data, moveToPosition) {
|
||||||
if (Ox.isUndefined(data)) {
|
if (Ox.isUndefined(data)) {
|
||||||
// doubleclick on small timeline
|
// doubleclick on small timeline
|
||||||
data = getAnnotation();
|
data = getAnnotation();
|
||||||
|
|
@ -1351,13 +1351,11 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
// FIXME
|
// FIXME
|
||||||
// self.editing = false;
|
// self.editing = false;
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
if (!stayAtPosition || (
|
var outOfRange = self.options.annotationsRange != 'position' && (
|
||||||
self.options.annotationsRange != 'position' && (
|
|
||||||
self.options.position < data['in']
|
self.options.position < data['in']
|
||||||
|| self.options.position > data.out
|
|| self.options.position > data.out
|
||||||
)
|
)
|
||||||
)
|
if (moveToPosition && outOfRange) {
|
||||||
) {
|
|
||||||
setPosition(data['in']);
|
setPosition(data['in']);
|
||||||
// if annotationsRange is 'position',
|
// if annotationsRange is 'position',
|
||||||
// this may cause a deselect
|
// this may cause a deselect
|
||||||
|
|
@ -1717,6 +1715,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
(id, annotation) -> <o> update annotation with id
|
(id, annotation) -> <o> update annotation with id
|
||||||
@*/
|
@*/
|
||||||
that.updateAnnotation = function(id, annotation) {
|
that.updateAnnotation = function(id, annotation) {
|
||||||
|
self.updating = true
|
||||||
// called from editannotation callback
|
// called from editannotation callback
|
||||||
// id might have changed if new annotation was created
|
// id might have changed if new annotation was created
|
||||||
if (annotation.id) {
|
if (annotation.id) {
|
||||||
|
|
@ -1730,6 +1729,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
|
||||||
self.annotations = getAnnotations();
|
self.annotations = getAnnotations();
|
||||||
setTimelineState();
|
setTimelineState();
|
||||||
}
|
}
|
||||||
|
self.updating = false
|
||||||
};
|
};
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue