diff --git a/source/Ox/js/HTML.js b/source/Ox/js/HTML.js
index b5cf839b..35518f4b 100644
--- a/source/Ox/js/HTML.js
+++ b/source/Ox/js/HTML.js
@@ -55,10 +55,8 @@
{
'name': 'a',
'required': ['href'],
- 'optional': ['target'],
'validate': {
- 'href': /^((https?:\/\/|\/|mailto:).*?)/,
- 'target': /^_blank$/
+ 'href': /^((https?:\/\/|\/|mailto:).*?)/
}
},
{'name': 'br'},
@@ -509,8 +507,6 @@
'http://www.foo.com/'
> Ox.sanitizeHTML('foo')
'foo'
- > Ox.sanitizeHTML('foo')
- 'foo'
> Ox.sanitizeHTML('foo')
'<a href="javascript:alert()">foo</a>'
> Ox.sanitizeHTML('foo')
diff --git a/source/Ox/js/Locale.js b/source/Ox/js/Locale.js
index 324f8646..9a6fe862 100644
--- a/source/Ox/js/Locale.js
+++ b/source/Ox/js/Locale.js
@@ -31,6 +31,7 @@
Ox.LOCALE = locale;
if (locale == 'en') {
translations = {};
+ callback(true);
} else {
translations = {};
Ox.forEach(Ox.LOCALES, function(locales, module) {
@@ -44,19 +45,15 @@
]);
}
});
- }
- url && Ox.makeArray(url).forEach(function(value) {
- urls.push(Ox.makeArray(value));
- });
- if (urls.length) {
+ url && Ox.makeArray(url).forEach(function(value) {
+ urls.push(Ox.makeArray(value));
+ });
Ox.getJSON(urls, function(data) {
Ox.forEach(data, function(values, url) {
Ox.extend(translations, values);
});
callback(true);
- })
- } else {
- callback(true);
+ });
}
} else {
callback(false);
diff --git a/source/UI/js/Core/URL.js b/source/UI/js/Core/URL.js
index f411d692..784e27ec 100644
--- a/source/UI/js/Core/URL.js
+++ b/source/UI/js/Core/URL.js
@@ -810,8 +810,7 @@ Ox.URL = function(options) {
function parseURL(str, callback) {
// remove facebook spam
- //str = str.replace(/\?fbclid=[A-Za-z0-9_]+/, '')
- str = str.replace(/\?fbclid=.*/, '')
+ str = str.replace(/\?fbclid=[A-Za-z0-9_]+/, '')
// fixme: removing trailing slash makes it impossible to search for '/'
var split = str.split('#'),
diff --git a/source/UI/js/Form/ArrayEditable.js b/source/UI/js/Form/ArrayEditable.js
index f361569d..ea890b1e 100644
--- a/source/UI/js/Form/ArrayEditable.js
+++ b/source/UI/js/Form/ArrayEditable.js
@@ -220,11 +220,10 @@ Ox.ArrayEditable = function(options, self) {
}, 250);
},
cancel: function(data) {
- var id = $(this).data('id');
self.editing = false;
that.gainFocus();
data.value === ''
- ? submitItem(id, '')
+ ? submitItem(i, '')
: that.triggerEvent('blur', data);
},
change: function(data) {
@@ -248,10 +247,9 @@ Ox.ArrayEditable = function(options, self) {
that.triggerEvent('open');
},
submit: function(data) {
- var id = $(this).data('id');
self.editing = false;
that.gainFocus();
- submitItem(id, data.value);
+ submitItem(i, data.value);
}
})
.appendTo(that);
@@ -366,9 +364,8 @@ Ox.ArrayEditable = function(options, self) {
}
}
- function submitItem(id, value) {
- var item = Ox.getObjectById(self.options.items, id);
- Ox.Log('AE', 'submitItem', id, item)
+ function submitItem(position, value) {
+ var item = self.options.items[position];
if (value === '') {
deleteItem(item.id);
} else {
diff --git a/source/UI/js/Video/AnnotationFolder.js b/source/UI/js/Video/AnnotationFolder.js
index f6fb3127..977575fe 100644
--- a/source/UI/js/Video/AnnotationFolder.js
+++ b/source/UI/js/Video/AnnotationFolder.js
@@ -71,10 +71,8 @@ Ox.AnnotationFolder = function(options, self) {
}
if (['in', 'out'].indexOf(key) > -1 && self.editing) {
var item = Ox.getObjectById(self.options.items, self.options.selected);
- if (item) {
- item[key] = value;
- item.duration = self.options.out - self.options['in'];
- }
+ item[key] = value;
+ item.duration = self.options.out - self.options['in'];
self.points = getPoints();
}
if (key == 'in') {
@@ -327,7 +325,7 @@ Ox.AnnotationFolder = function(options, self) {
that.triggerEvent('add', {value: data.value || ''});
},
blur: function(data) {
- if (data && data.id && data.id[0] == '_') {
+ if (data && data.id[0] == '_') {
changeAnnotation(data);
that.triggerEvent('blur');
} else {
@@ -622,12 +620,10 @@ Ox.AnnotationFolder = function(options, self) {
function submitAnnotation(data) {
var item = Ox.getObjectById(self.options.items, data.id);
- if (item) {
- item.value = data.value;
- self.editing = false;
- self.options.sort == 'text' && self.$annotations.reloadItems();
- that.triggerEvent('submit', item);
- }
+ item.value = data.value;
+ self.editing = false;
+ self.options.sort == 'text' && self.$annotations.reloadItems();
+ that.triggerEvent('submit', item);
}
function toggleLayer() {
@@ -753,7 +749,6 @@ Ox.AnnotationFolder = function(options, self) {
(id, data) -> update item
@*/
that.updateItem = function(id, data) {
- Ox.Log('AF', 'updateItem', id, data)
var item = Ox.getObjectById(self.options.items, id);
Ox.forEach(data, function(value, key) {
item[key] = value;
@@ -765,7 +760,7 @@ Ox.AnnotationFolder = function(options, self) {
if (id != item.id) {
self.$annotations.find('.OxEditableElement').each(function() {
var $element = $(this);
- if ($element.data('id') == id) {
+ if ($element.data('id') == self.options.selected) {
$element.data({id: item.id});
}
});
diff --git a/source/UI/js/Video/AnnotationPanel.js b/source/UI/js/Video/AnnotationPanel.js
index 83036b77..4e896767 100644
--- a/source/UI/js/Video/AnnotationPanel.js
+++ b/source/UI/js/Video/AnnotationPanel.js
@@ -737,10 +737,7 @@ Ox.AnnotationPanel = function(options, self) {
@*/
that.blurItem = function() {
self.editing = false;
- var $folder = getFolder(self.options.selected)
- if ($folder) {
- $folder.blurItem();
- }
+ getFolder(self.options.selected).blurItem();
renderEditMenu();
return that;
};
@@ -808,10 +805,7 @@ Ox.AnnotationPanel = function(options, self) {
// called from editannotation callback
// on the first update of a new annotation, the id will change
self.options.selected = item.id;
- var $folder = getFolder(id);
- if ($folder) {
- $folder.updateItem(id, item);
- }
+ getFolder(id).updateItem(id, item);
updateLanguages();
renderOptionsMenu();
renderEditMenu();
diff --git a/source/UI/js/Video/VideoAnnotationPanel.js b/source/UI/js/Video/VideoAnnotationPanel.js
index 639fa1fa..a3935b1e 100644
--- a/source/UI/js/Video/VideoAnnotationPanel.js
+++ b/source/UI/js/Video/VideoAnnotationPanel.js
@@ -938,7 +938,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
that.triggerEvent('resizemap', data);
},
select: function(data) {
- selectAnnotation(data, !self.updating);
+ selectAnnotation(data, true);
},
showentityinfo: function(data) {
that.triggerEvent('showentityinfo', data);
@@ -1340,7 +1340,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
that.triggerEvent('annotationssize', {size: data.size});
}
- function selectAnnotation(data, moveToPosition) {
+ function selectAnnotation(data, stayAtPosition) {
if (Ox.isUndefined(data)) {
// doubleclick on small timeline
data = getAnnotation();
@@ -1351,11 +1351,13 @@ Ox.VideoAnnotationPanel = function(options, self) {
// FIXME
// self.editing = false;
if (data.id) {
- var outOfRange = self.options.annotationsRange != 'position' && (
- self.options.position < data['in']
- || self.options.position > data.out
- )
- if (moveToPosition && outOfRange) {
+ if (!stayAtPosition || (
+ self.options.annotationsRange != 'position' && (
+ self.options.position < data['in']
+ || self.options.position > data.out
+ )
+ )
+ ) {
setPosition(data['in']);
// if annotationsRange is 'position',
// this may cause a deselect
@@ -1715,7 +1717,6 @@ Ox.VideoAnnotationPanel = function(options, self) {
(id, annotation) -> update annotation with id
@*/
that.updateAnnotation = function(id, annotation) {
- self.updating = true
// called from editannotation callback
// id might have changed if new annotation was created
if (annotation.id) {
@@ -1729,7 +1730,6 @@ Ox.VideoAnnotationPanel = function(options, self) {
self.annotations = getAnnotations();
setTimelineState();
}
- self.updating = false
};
/*@