From e497e7a7ace5e274030dadcc6c32a8a1a8673894 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 31 Aug 2020 23:12:46 +0200 Subject: [PATCH 1/8] remove anything after fbclid=, closes #3240 --- source/UI/js/Core/URL.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/UI/js/Core/URL.js b/source/UI/js/Core/URL.js index 784e27ec..f411d692 100644 --- a/source/UI/js/Core/URL.js +++ b/source/UI/js/Core/URL.js @@ -810,7 +810,8 @@ Ox.URL = function(options) { function parseURL(str, callback) { // 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 '/' var split = str.split('#'), From 290afaf332be1e84e2bf66551546af164edffda6 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 18 Sep 2020 10:41:13 +0200 Subject: [PATCH 2/8] folder might have gone --- source/UI/js/Video/AnnotationPanel.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/UI/js/Video/AnnotationPanel.js b/source/UI/js/Video/AnnotationPanel.js index 4e896767..cfe75a03 100644 --- a/source/UI/js/Video/AnnotationPanel.js +++ b/source/UI/js/Video/AnnotationPanel.js @@ -805,7 +805,10 @@ 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; - getFolder(id).updateItem(id, item); + var $folder = getFolder(id); + if ($folder) { + $folder.updateItem(id, item); + } updateLanguages(); renderOptionsMenu(); renderEditMenu(); From 396fac63c0c7afd67b07177f3d9e022cb21b8ca6 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 21 Sep 2020 14:02:57 +0200 Subject: [PATCH 3/8] avoid error on blur --- source/UI/js/Video/AnnotationFolder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/UI/js/Video/AnnotationFolder.js b/source/UI/js/Video/AnnotationFolder.js index 977575fe..c392ce8d 100644 --- a/source/UI/js/Video/AnnotationFolder.js +++ b/source/UI/js/Video/AnnotationFolder.js @@ -325,7 +325,7 @@ Ox.AnnotationFolder = function(options, self) { that.triggerEvent('add', {value: data.value || ''}); }, blur: function(data) { - if (data && data.id[0] == '_') { + if (data && data.id && data.id[0] == '_') { changeAnnotation(data); that.triggerEvent('blur'); } else { From c2d35e615defb9b7d814d637bb330af77380f956 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 21 Sep 2020 14:05:57 +0200 Subject: [PATCH 4/8] don't move to annotation in point after adding annotation creating an anntoation is async and might return after user has seeked to another location or started playback again. also: fix variable name: stayAtPosition->moveToPosition --- source/UI/js/Video/VideoAnnotationPanel.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/UI/js/Video/VideoAnnotationPanel.js b/source/UI/js/Video/VideoAnnotationPanel.js index a3935b1e..639fa1fa 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, true); + selectAnnotation(data, !self.updating); }, 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, stayAtPosition) { + function selectAnnotation(data, moveToPosition) { if (Ox.isUndefined(data)) { // doubleclick on small timeline data = getAnnotation(); @@ -1351,13 +1351,11 @@ Ox.VideoAnnotationPanel = function(options, self) { // FIXME // self.editing = false; if (data.id) { - if (!stayAtPosition || ( - self.options.annotationsRange != 'position' && ( - self.options.position < data['in'] - || self.options.position > data.out - ) - ) - ) { + var outOfRange = self.options.annotationsRange != 'position' && ( + self.options.position < data['in'] + || self.options.position > data.out + ) + if (moveToPosition && outOfRange) { setPosition(data['in']); // if annotationsRange is 'position', // this may cause a deselect @@ -1717,6 +1715,7 @@ 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) { @@ -1730,6 +1729,7 @@ Ox.VideoAnnotationPanel = function(options, self) { self.annotations = getAnnotations(); setTimelineState(); } + self.updating = false }; /*@ From 009cdd68c3f15c676a00b9bb823270af91d95e68 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 22 Sep 2020 12:48:08 +0200 Subject: [PATCH 5/8] update item by id not position --- source/UI/js/Form/ArrayEditable.js | 11 +++++++---- source/UI/js/Video/AnnotationFolder.js | 19 ++++++++++++------- source/UI/js/Video/AnnotationPanel.js | 5 ++++- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/source/UI/js/Form/ArrayEditable.js b/source/UI/js/Form/ArrayEditable.js index ea890b1e..f361569d 100644 --- a/source/UI/js/Form/ArrayEditable.js +++ b/source/UI/js/Form/ArrayEditable.js @@ -220,10 +220,11 @@ Ox.ArrayEditable = function(options, self) { }, 250); }, cancel: function(data) { + var id = $(this).data('id'); self.editing = false; that.gainFocus(); data.value === '' - ? submitItem(i, '') + ? submitItem(id, '') : that.triggerEvent('blur', data); }, change: function(data) { @@ -247,9 +248,10 @@ Ox.ArrayEditable = function(options, self) { that.triggerEvent('open'); }, submit: function(data) { + var id = $(this).data('id'); self.editing = false; that.gainFocus(); - submitItem(i, data.value); + submitItem(id, data.value); } }) .appendTo(that); @@ -364,8 +366,9 @@ Ox.ArrayEditable = function(options, self) { } } - function submitItem(position, value) { - var item = self.options.items[position]; + function submitItem(id, value) { + var item = Ox.getObjectById(self.options.items, id); + Ox.Log('AE', 'submitItem', id, item) if (value === '') { deleteItem(item.id); } else { diff --git a/source/UI/js/Video/AnnotationFolder.js b/source/UI/js/Video/AnnotationFolder.js index c392ce8d..f6fb3127 100644 --- a/source/UI/js/Video/AnnotationFolder.js +++ b/source/UI/js/Video/AnnotationFolder.js @@ -71,8 +71,10 @@ Ox.AnnotationFolder = function(options, self) { } if (['in', 'out'].indexOf(key) > -1 && self.editing) { var item = Ox.getObjectById(self.options.items, self.options.selected); - item[key] = value; - item.duration = self.options.out - self.options['in']; + if (item) { + item[key] = value; + item.duration = self.options.out - self.options['in']; + } self.points = getPoints(); } if (key == 'in') { @@ -620,10 +622,12 @@ Ox.AnnotationFolder = function(options, self) { function submitAnnotation(data) { var item = Ox.getObjectById(self.options.items, data.id); - item.value = data.value; - self.editing = false; - self.options.sort == 'text' && self.$annotations.reloadItems(); - that.triggerEvent('submit', item); + if (item) { + item.value = data.value; + self.editing = false; + self.options.sort == 'text' && self.$annotations.reloadItems(); + that.triggerEvent('submit', item); + } } function toggleLayer() { @@ -749,6 +753,7 @@ 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; @@ -760,7 +765,7 @@ Ox.AnnotationFolder = function(options, self) { if (id != item.id) { self.$annotations.find('.OxEditableElement').each(function() { var $element = $(this); - if ($element.data('id') == self.options.selected) { + if ($element.data('id') == id) { $element.data({id: item.id}); } }); diff --git a/source/UI/js/Video/AnnotationPanel.js b/source/UI/js/Video/AnnotationPanel.js index cfe75a03..83036b77 100644 --- a/source/UI/js/Video/AnnotationPanel.js +++ b/source/UI/js/Video/AnnotationPanel.js @@ -737,7 +737,10 @@ Ox.AnnotationPanel = function(options, self) { @*/ that.blurItem = function() { self.editing = false; - getFolder(self.options.selected).blurItem(); + var $folder = getFolder(self.options.selected) + if ($folder) { + $folder.blurItem(); + } renderEditMenu(); return that; }; From 47fc01742f6fb55773eb4d4640c471189b1cc33b Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Oct 2020 11:40:14 +0200 Subject: [PATCH 6/8] allow target="_blank" for href --- source/Ox/js/HTML.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/Ox/js/HTML.js b/source/Ox/js/HTML.js index 35518f4b..b5cf839b 100644 --- a/source/Ox/js/HTML.js +++ b/source/Ox/js/HTML.js @@ -55,8 +55,10 @@ { 'name': 'a', 'required': ['href'], + 'optional': ['target'], 'validate': { - 'href': /^((https?:\/\/|\/|mailto:).*?)/ + 'href': /^((https?:\/\/|\/|mailto:).*?)/, + 'target': /^_blank$/ } }, {'name': 'br'}, @@ -507,6 +509,8 @@ 'http://www.foo.com/' > Ox.sanitizeHTML('foo') 'foo' + > Ox.sanitizeHTML('foo') + 'foo' > Ox.sanitizeHTML('foo') '<a href="javascript:alert()">foo</a>' > Ox.sanitizeHTML('foo') From c61d17392222463b7d1efd9f0daf4f11b5713a4a Mon Sep 17 00:00:00 2001 From: j Date: Thu, 1 Apr 2021 11:56:38 +0200 Subject: [PATCH 7/8] allow setting locale urls for locale=en --- source/Ox/js/Locale.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/Ox/js/Locale.js b/source/Ox/js/Locale.js index 9a6fe862..4d6c674f 100644 --- a/source/Ox/js/Locale.js +++ b/source/Ox/js/Locale.js @@ -45,15 +45,19 @@ ]); } }); - url && Ox.makeArray(url).forEach(function(value) { - urls.push(Ox.makeArray(value)); - }); + } + url && Ox.makeArray(url).forEach(function(value) { + urls.push(Ox.makeArray(value)); + }); + if (urls.length) { Ox.getJSON(urls, function(data) { Ox.forEach(data, function(values, url) { Ox.extend(translations, values); }); callback(true); - }); + }) + } else { + callback(true); } } else { callback(false); From cb42e1d7fa0625b89131950cc7c88bcd4e73c568 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 6 Apr 2021 10:26:27 +0200 Subject: [PATCH 8/8] don't call callback twice, fixup for c61d173922 --- source/Ox/js/Locale.js | 1 - 1 file changed, 1 deletion(-) diff --git a/source/Ox/js/Locale.js b/source/Ox/js/Locale.js index 4d6c674f..324f8646 100644 --- a/source/Ox/js/Locale.js +++ b/source/Ox/js/Locale.js @@ -31,7 +31,6 @@ Ox.LOCALE = locale; if (locale == 'en') { translations = {}; - callback(true); } else { translations = {}; Ox.forEach(Ox.LOCALES, function(locales, module) {