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,46 +415,29 @@ 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
? [data['in'], data.out] ? [data['in'], data.out]
: [] : []
).join(','), ).join(',')
+ (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)
$input.url.options({ .replace(/_/g, '%09').replace(/\s/g, '_')
value: data.protocol + '://' .replace(/"/g, '"');
+ data.site + '/' Ox.print('FU', url);
+ data.item + '/' $input.url.options({value: url});
+ (data.link == 'default' ? '' : data.link + '/')
+ ([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)
});
} }
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]) : '',