improve urls created by insertEmbedDialog

This commit is contained in:
j 2014-02-14 08:42:24 +00:00
parent 42febc6c04
commit 8158e2594c

View file

@ -415,31 +415,11 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
var data = Ox.map($input, function($element) { var data = Ox.map($input, function($element) {
return $element.options('value'); return $element.options('value');
}); });
Ox.print('FU', data.protocol + '://' url = data.protocol + '://'
+ data.site + '/' + data.site + '/'
+ data.item + '/' + data.item + '/'
+ (data.link == 'default' ? '' : data.link + '/') + (data.link == 'default' ? '' : data.link + '/')
+ ([data.position] || []).concat( + (data.position ? [data.position] : []).concat(
data['in'] || data.out
? [data['in'], data.out]
: []
).join(','),
+ (data.annotation || '')
+ '#embed?'
+ Ox.serialize({
title: data.title,
showTimeline: data.showTimeline || null,
timeline: data.timeline,
showAnnotations: data.showAnnotations || null,
showLayers: data.showAnnotations && data.showLayers ? data.showLayers : null,
matchRatio: true
}, true));
$input.url.options({
value: data.protocol + '://'
+ data.site + '/'
+ data.item + '/'
+ (data.link == 'default' ? '' : data.link + '/')
+ ([data.position] || []).concat(
data['in'] || data.out data['in'] || data.out
? [data['in'], data.out] ? [data['in'], data.out]
: [] : []
@ -447,14 +427,17 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
+ (data.annotation || '') + (data.annotation || '')
+ '#embed?' + '#embed?'
+ Ox.serialize({ + Ox.serialize({
title: data.title, title: data.title || void 0,
showTimeline: data.showTimeline || null, showTimeline: data.showTimeline || void 0,
timeline: data.timeline, timeline: data.timeline && data.timeline != 'default' ? data.timeline : void 0,
showAnnotations: data.showAnnotations || null, showAnnotations: data.showAnnotations || void 0,
showLayers: data.showAnnotations && data.showLayers ? data.showLayers : null, showLayers: data.showAnnotations && data.showLayers ? data.showLayers : void 0,
matchRatio: true //matchRatio: true
}, true) }, true)
}); .replace(/_/g, '%09').replace(/\s/g, '_')
.replace(/"/g, '"');
Ox.print('FU', url);
$input.url.options({value: url});
} }
function limitPoint(value, min, max) { function limitPoint(value, min, max) {
@ -493,12 +476,13 @@ pandora.ui.insertEmbedDialog = function(/*[url, ]callback*/) {
duration = result.data.duration; duration = result.data.duration;
item = id; item = id;
} }
console.log('parse url', state);
Ox.forEach({ Ox.forEach({
protocol: protocol, protocol: protocol,
site: site, site: site,
item: item, item: item,
link: state.view || 'default', // FIXME: wrong, user-dependent link: state.view || 'default', // FIXME: wrong, user-dependent
position: Ox.isArray(state.span) position: Ox.isArray(state.span) && state.span.lenght == 3
? Ox.formatDuration(state.span[0]) : '', ? Ox.formatDuration(state.span[0]) : '',
'in': Ox.isArray(state.span) 'in': Ox.isArray(state.span)
? Ox.formatDuration(state.span[state.span.length - 2]) : '', ? Ox.formatDuration(state.span[state.span.length - 2]) : '',