From 522af49a73901252def6c7e4db680d842d6fc65b Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 2 Feb 2014 11:30:25 +0000 Subject: [PATCH] wrap image urls in pandora.getMediaURL to add option to load image from another domain --- pandora/app/config.py | 1 + pandora/settings.py | 2 ++ static/js/browser.js | 4 ++-- static/js/clipList.js | 8 ++++++-- static/js/documentDialog.js | 2 +- static/js/editPanel.js | 4 ++-- static/js/editor.js | 10 +++++----- static/js/embedInfo.js | 6 +++--- static/js/embedPlayer.js | 12 ++++++------ static/js/embedTimeline.js | 10 +++++++--- static/js/infoView.0xdb.js | 18 +++++++++--------- static/js/infoView.indiancinema.js | 14 +++++++------- static/js/infoView.padma.js | 12 ++++++------ static/js/itemClips.js | 8 ++++++-- static/js/list.js | 18 ++++++++++-------- static/js/listDialog.js | 20 ++++++++++++++------ static/js/player.js | 6 ++++-- static/js/previewDialog.js | 8 ++++---- static/js/similarClipsDialog.js | 2 +- static/js/timeline.js | 12 +++++++++--- static/js/utils.js | 12 ++++++++++-- static/js/videoPreview.js | 6 +++--- 22 files changed, 118 insertions(+), 77 deletions(-) diff --git a/pandora/app/config.py b/pandora/app/config.py index 7fdcf386..b7709452 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -57,6 +57,7 @@ def load_config(): settings.DEFAULT_FROM_EMAIL = config['site']['email']['system'] settings.SERVER_EMAIL = config['site']['email']['system'] config['site']['videoprefix'] = settings.VIDEO_PREFIX + config['site']['mediaprefix'] = settings.MEDIA_PREFIX config['site']['version'] = get_version() config['site']['dontValidateUser'] = not settings.AUTH_CHECK_USERNAME if not 'folderdepth' in config['site']: diff --git a/pandora/settings.py b/pandora/settings.py index 7827cc52..b6d798e9 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -195,6 +195,8 @@ USE_IMDB = False #if you set VIDEO_PREFIX make sure cookies work accros subsomains VIDEO_PREFIX='' #VIDEO_PREFIX = '//video{uid}.example.com' +MEDIA_PREFIX='' +#VIDEO_PREFIX = '//media.example.com' #SESSION_COOKIE_DOMAIN = '.example.com' SESSION_COOKIE_AGE=60*24*60*60 diff --git a/static/js/browser.js b/static/js/browser.js index 2f1dd2e8..b7bc552b 100644 --- a/static/js/browser.js +++ b/static/js/browser.js @@ -78,10 +78,10 @@ pandora.ui.browser = function() { var ui = pandora.user.ui, ratio = ui.icons == 'posters' ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1, - url = '/' + data.id + '/' + ( + url = pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' - ) + '128.jpg?' + data.modified, + ) + '128.jpg?' + data.modified), format, info, sortKey = sort[0].key; if (['title', 'director', 'random'].indexOf(sortKey) > -1) { info = data['year']; diff --git a/static/js/clipList.js b/static/js/clipList.js index 108050b6..23be749a 100644 --- a/static/js/clipList.js +++ b/static/js/clipList.js @@ -35,7 +35,9 @@ pandora.ui.clipList = function(videoRatio) { }).map(function(annotation) { return Ox.stripTags(annotation.value.replace(/\n/g, ' ')); }).join('; ') : ''; - url = '/' + data.id.split('/')[0] + '/' + height + 'p' + data['in'] + '.jpg'; + url = pandora.getMediaURL( + '/' + data.id.split('/')[0] + '/' + height + 'p' + data['in'] + '.jpg' + ); sortKey = sort[0].key; if (['text', 'position', 'duration', 'random'].indexOf(sortKey) > -1) { info = Ox.formatDuration(data['in']) + ' - ' @@ -204,7 +206,9 @@ pandora.ui.clipList = function(videoRatio) { censoredTooltip: pandora.site.cantPlay.text, height: height, paused: true, - poster: '/' + item + '/' + height + 'p' + points[0] + '.jpg', + poster: pandora.getMediaURL( + '/' + item + '/' + height + 'p' + points[0] + '.jpg' + ), rewind: true, video: pandora.getClipVideos({ item: item, diff --git a/static/js/documentDialog.js b/static/js/documentDialog.js index 477a3747..021dc7a4 100644 --- a/static/js/documentDialog.js +++ b/static/js/documentDialog.js @@ -162,7 +162,7 @@ pandora.ui.documentDialog = function(options) { center: settings.center, height: dialogHeight, imageHeight: item.dimensions[1], - imagePreviewURL: '/documents/' + item.id + '/256p.jpg', + imagePreviewURL: pandora.getMediaURL('/documents/' + item.id + '/256p.jpg'), imageURL: '/documents/' + item.id + '/' + item.name + '.' + item.extension, imageWidth: item.dimensions[0], diff --git a/static/js/editPanel.js b/static/js/editPanel.js index 9cf7a26c..d671f198 100644 --- a/static/js/editPanel.js +++ b/static/js/editPanel.js @@ -98,7 +98,7 @@ pandora.ui.editPanel = function() { fullscreen: false, getClipImageURL: function(id, width, height) { var clip = Ox.getObjectById(edit.clips, id); - return '/' + clip.item + '/' + height + 'p' + clip['in'] + '.jpg'; + return pandora.getMediaURL('/' + clip.item + '/' + height + 'p' + clip['in'] + '.jpg'); }, getLargeTimelineURL: function(type, i, callback) { pandora.getLargeEditTimelineURL(edit, type, i, callback); @@ -348,7 +348,7 @@ pandora.ui.editPanel = function() { item: function(data, sort, size) { size = size || 128; var ui = pandora.user.ui, - url = '/edit/' + data.id + '/icon' + size + '.jpg?' + data.modified, + url = pandora.getMediaURL('/edit/' + data.id + '/icon' + size + '.jpg?' + data.modified), info = Ox.formatDuration(data.duration); return { height: size, diff --git a/static/js/editor.js b/static/js/editor.js index 53b64cb9..25bb4648 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -29,13 +29,13 @@ pandora.ui.editor = function(data) { enableSubtitles: ui.videoSubtitles, find: ui.itemFind, getFrameURL: function(position) { - return '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg?' + data.modified; + return pandora.getMediaURL('/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg?' + data.modified); }, getLargeTimelineURL: function(type, i) { - return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg?' + data.modified; + return pandora.getMediaURL('/' + ui.item + '/timeline' + type + '64p' + i + '.jpg?' + data.modified); }, getSmallTimelineURL: function(type, i) { - return '/' + ui.item + '/timeline' + type + '16p' + i + '.jpg?' + data.modified; + return pandora.getMediaURL('/' + ui.item + '/timeline' + type + '16p' + i + '.jpg?' + data.modified); }, height: pandora.$ui.contentPanel.size(1), id: 'editor', @@ -298,9 +298,9 @@ pandora.ui.editor = function(data) { function updateBrowser() { pandora.$ui.browser.find('img[src*="/' + ui.item + '/"]').each(function() { $(this).attr({ - src: '/' + ui.item + '/' + ( + src: pandora.getMediaURL('/' + ui.item + '/' + ( ui.icons == 'posters' ? 'poster' : 'icon' - ) + '128.jpg?' + Ox.uid() + ) + '128.jpg?' + Ox.uid()) }); }); } diff --git a/static/js/embedInfo.js b/static/js/embedInfo.js index 2b423b33..b0142812 100644 --- a/static/js/embedInfo.js +++ b/static/js/embedInfo.js @@ -17,7 +17,7 @@ pandora.ui.embedInfo = function() { data = result.data; $icon = Ox.$('') - .attr({src: '/' + item + '/poster512.jpg'}) + .attr({src: pandora.getMediaURL('/' + item + '/poster512.jpg')}) .css({ position: 'absolute', top: margin + 'px', @@ -39,7 +39,7 @@ pandora.ui.embedInfo = function() { .appendTo(that); $reflectionIcon = Ox.$('') - .attr({src: '/' + item + '/poster512.jpg'}) + .attr({src: pandora.getMediaURL('/' + item + '/poster512.jpg')}) .css({ position: 'absolute' }) @@ -136,4 +136,4 @@ pandora.ui.embedInfo = function() { return that; -}; \ No newline at end of file +}; diff --git a/static/js/embedPlayer.js b/static/js/embedPlayer.js index c8adb7ad..05f42e0a 100644 --- a/static/js/embedPlayer.js +++ b/static/js/embedPlayer.js @@ -95,19 +95,19 @@ pandora.ui.embedPlayer = function() { paused: options.paused, playInToOut: options.playInToOut, position: options.position, - poster: '/' + options.item + '/' + '96p' + ( + poster: pandora.getMediaURL('/' + options.item + '/' + '96p' + ( options.position !== void 0 ? options.position : options['in'] !== void 0 ? options['in'] : video.posterFrame - ) +'.jpg', + ) +'.jpg'), resolution: ui.videoResolution, scaleToFill: ui.videoScale == 'fill', subtitles: video.subtitles, timeline: options.playInToOut ? function(size, i) { - return '/' + options.item + return pandora.getMediaURL('/' + options.item + '/timelineantialias' - + size + 'p' + i + '.jpg' - } : '/' + options.item + '/' + 'timeline16p.png', + + size + 'p' + i + '.jpg'); + } : pandora.getMediaURL('/' + options.item + '/' + 'timeline16p.png'), /* timeline: options.playInToOut ? getSmallTimelineURL() : '/' + options.item + '/' + 'timeline16p.png', @@ -173,7 +173,7 @@ pandora.ui.embedPlayer = function() { disabled: isFrame, duration: video.duration, getImageURL: function(type, i) { - return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'; + return pandora.getMediaURL('/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'); }, position: options.position, showInToOut: options.playInToOut && options['in'] < options.out, diff --git a/static/js/embedTimeline.js b/static/js/embedTimeline.js index d7f72a5d..cb6d1583 100644 --- a/static/js/embedTimeline.js +++ b/static/js/embedTimeline.js @@ -51,17 +51,21 @@ pandora.ui.embedTimeline = function() { duration: video.duration, followPlayer: ui.followPlayer, getFrameURL: function(position) { - return '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg'; + return pandora.getMediaURL( + '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg' + ); }, getLargeTimelineURL: function(type, i) { - return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'; + return pandora.getMediaURL( + '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg' + ); }, height: sizes.innerHeight, muted: ui.videoMuted, paused: options.paused, position: options.position, resolution: Ox.min(pandora.site.video.resolutions), - smallTimelineURL: '/' + ui.item + '/timeline16p.jpg', + smallTimelineURL: pandora.getMediaURL('/' + ui.item + '/timeline16p.jpg'), subtitles: video.subtitles, timeline: ui.videoTimeline, timelines: pandora.site.timelines, diff --git a/static/js/infoView.0xdb.js b/static/js/infoView.0xdb.js index 669df34e..393dd7c2 100644 --- a/static/js/infoView.0xdb.js +++ b/static/js/infoView.0xdb.js @@ -135,10 +135,10 @@ pandora.ui.infoView = function(data) { ) : '' }) .attr({ - src: '/' + data.id + '/' + ( + src: pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' - ) + '512.jpg?' + data.modified + ) + '512.jpg?' + data.modified) }) .css({ position: 'absolute', @@ -168,10 +168,10 @@ pandora.ui.infoView = function(data) { $reflectionIcon = $('') .attr({ - src: '/' + data.id + '/' + ( + src: pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' - ) + '512.jpg?' + data.modified + ) + '512.jpg?' + data.modified) }) .css({ position: 'absolute', @@ -1004,7 +1004,7 @@ pandora.ui.infoView = function(data) { var src; Ox.Request.clearCache(); if (ui.icons == 'frames') { - src = '/' + data.id + '/icon512.jpg?' + Ox.uid(); + src = pandora.getMediaURL('/' + data.id + '/icon512.jpg?' + Ox.uid()); $icon.attr({src: src}); $reflectionIcon.attr({src: src}); if (pandora.$ui.videoPreview) { @@ -1015,9 +1015,9 @@ pandora.ui.infoView = function(data) { } if (!ui.showSitePosters) { $browserImages.each(function() { - $(this).attr({src: '/' + data.id + '/' + ( + $(this).attr({src: pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? 'poster' : 'icon' - ) + '128.jpg?' + Ox.uid()}); + ) + '128.jpg?' + Ox.uid())}); }); } if (ui.listSort[0].key == 'modified') { @@ -1135,10 +1135,10 @@ pandora.ui.infoView = function(data) { } that.reload = function() { - var src = src = '/' + data.id + '/' + ( + var src = pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' - ) + '512.jpg?' + Ox.uid() + ) + '512.jpg?' + Ox.uid()) $icon.attr({src: src}); $reflectionIcon.attr({src: src}); iconSize = iconSize == 256 ? 512 : 256; diff --git a/static/js/infoView.indiancinema.js b/static/js/infoView.indiancinema.js index 2ee6b551..555a195b 100644 --- a/static/js/infoView.indiancinema.js +++ b/static/js/infoView.indiancinema.js @@ -131,9 +131,9 @@ pandora.ui.infoView = function(data) { element: '' }) .attr({ - src: '/' + data.id + '/' + ( + src: pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? 'poster' : 'icon' - ) + '512.jpg?' + data.modified + ) + '512.jpg?' + data.modified) }) .css({ position: 'absolute', @@ -163,10 +163,10 @@ pandora.ui.infoView = function(data) { $reflectionIcon = $('') .attr({ - src: '/' + data.id + '/' + ( + src: pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' - ) + '512.jpg?' + data.modified + ) + '512.jpg?' + data.modified) }) .css({ position: 'absolute', @@ -492,7 +492,7 @@ pandora.ui.infoView = function(data) { Ox.contains(['title', 'director', 'year'], key) && ui.icons == 'posters' ) { - src = '/' + data.id + '/poster512.jpg?' + Ox.uid(); + src = pandora.getMediaURL('/' + data.id + '/poster512.jpg?' + Ox.uid()); $icon.attr({src: src}); $reflectionIcon.attr({src: src}); } @@ -1042,9 +1042,9 @@ pandora.ui.infoView = function(data) { } that.reload = function() { - var src = src = '/' + data.id + '/' + ( + var src = pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? 'poster' : 'icon' - ) + '512.jpg?' + Ox.uid(); + ) + '512.jpg?' + Ox.uid()); $icon.attr({src: src}); $reflectionIcon.attr({src: src}); iconSize = iconSize == 256 ? 512 : 256; diff --git a/static/js/infoView.padma.js b/static/js/infoView.padma.js index 71c64e42..5aea6c75 100644 --- a/static/js/infoView.padma.js +++ b/static/js/infoView.padma.js @@ -107,9 +107,9 @@ pandora.ui.infoView = function(data) { ).title + ' View' }) .attr({ - src: '/' + data.id + '/' + ( + src: pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? 'poster' : 'icon' - ) + '512.jpg?' + data.modified + ) + '512.jpg?' + data.modified) }) .css({ position: 'absolute', @@ -141,9 +141,9 @@ pandora.ui.infoView = function(data) { $reflectionIcon = $('') .attr({ - src: '/' + data.id + '/' + ( + src: pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? 'poster' : 'icon' - ) + '512.jpg?' + data.modified + ) + '512.jpg?' + data.modified) }) .css({ position: 'absolute', @@ -767,9 +767,9 @@ pandora.ui.infoView = function(data) { } that.reload = function() { - var src = src = '/' + data.id + '/' + ( + var src = pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? 'poster' : 'icon' - ) + '512.jpg?' + Ox.uid(); + ) + '512.jpg?' + Ox.uid()); $icon.attr({src: src}); $reflectionIcon.attr({src: src}); iconSize = iconSize == 256 ? 512 : 256; diff --git a/static/js/itemClips.js b/static/js/itemClips.js index 2b6601f8..26df7a77 100644 --- a/static/js/itemClips.js +++ b/static/js/itemClips.js @@ -34,7 +34,9 @@ pandora.ui.itemClips = function(options) { : a.value > b.value ? 1 : 0; }), - url = '/' + self.options.id + '/' + self.height + 'p' + clip['in'] + '.jpg', + url = pandora.getMediaURL( + '/' + self.options.id + '/' + self.height + 'p' + clip['in'] + '.jpg' + ), $item = Ox.IconItem({ find: pandora.user.ui.itemFind, imageHeight: self.height, @@ -106,7 +108,9 @@ pandora.ui.itemClips = function(options) { 'in': partsAndPoints.points[0], out: partsAndPoints.points[1], playInToOut: true, - poster: '/' + self.options.id + '/' + self.height + 'p' + points[0] + '.jpg', + poster: pandora.getMediaURL( + '/' + self.options.id + '/' + self.height + 'p' + points[0] + '.jpg' + ), rewind: true, video: partsAndPoints.parts.map(function(i) { return pandora.getVideoURL(self.options.id, Ox.min(pandora.site.video.resolutions), i + 1); diff --git a/static/js/list.js b/static/js/list.js index b915b0af..6cd318aa 100644 --- a/static/js/list.js +++ b/static/js/list.js @@ -44,7 +44,7 @@ pandora.ui.list = function() { //background: 'transparent' }); }).attr({ - src: '/' + data.id + '/' + icon + '14.jpg?' + data.modified + src: pandora.getMediaURL('/' + data.id + '/' + icon + '14.jpg?' + data.modified) }); }, id: 'posterRatio', @@ -128,10 +128,10 @@ pandora.ui.list = function() { item: function(data, sort, size) { var ratio = ui.icons == 'posters' ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1, - url = '/' + data.id + '/' + ( + url = pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' - ) + size + '.jpg?' + data.modified, + ) + size + '.jpg?' + data.modified), format, info, sortKey = sort[0].key; if (['title', 'director', 'random'].indexOf(sortKey) > -1) { info = data['year']; @@ -185,10 +185,10 @@ pandora.ui.list = function() { size = 128; var ratio = ui.icons == 'posters' ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1, - url = '/' + data.id + '/' + ( + url = pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' - ) + size + '.jpg?' + data.modified, + ) + size + '.jpg?' + data.modified), format, info, sortKey = sort[0].key; if (['title', 'director'].indexOf(sortKey) > -1) { info = data['year']; @@ -270,10 +270,10 @@ pandora.ui.list = function() { isClipsQuery = !!clipsQuery.conditions.length, ratio = ui.icons == 'posters' ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1, - url = '/' + data.id + '/' + ( + url = pandora.getMediaURL('/' + data.id + '/' + ( ui.icons == 'posters' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' - ) + size + '.jpg?' + data.modified, + ) + size + '.jpg?' + data.modified), format, info, sortKey = sort[0].key; if (['title', 'director'].indexOf(sortKey) > -1) { info = data['year']; @@ -323,7 +323,9 @@ pandora.ui.list = function() { duration: data.duration, find: isClipsQuery ? clipsQuery.conditions[0].value : '', getImageURL: function(type, i) { - return '/' + data.id + '/timeline' + type + '16p' + i + '.jpg'; + return pandora.getMediaURL( + '/' + data.id + '/timeline' + type + '16p' + i + '.jpg' + ); }, position: ui.videoPoints[data.id] ? ui.videoPoints[data.id].position : 0, diff --git a/static/js/listDialog.js b/static/js/listDialog.js index 673d8e9e..8c88b339 100644 --- a/static/js/listDialog.js +++ b/static/js/listDialog.js @@ -168,7 +168,7 @@ pandora.ui.listGeneralPanel = function(listData) { tooltip: Ox._('Doubleclick to edit icon') }) .attr({ - src: '/' + folderItem.toLowerCase() + '/' + encodeURIComponent(listData.id) + '/icon256.jpg?' + Ox.uid() + src: pandora.getMediaURL('/' + folderItem.toLowerCase() + '/' + encodeURIComponent(listData.id) + '/icon256.jpg?' + Ox.uid()) }) .css({ position: 'absolute', @@ -358,7 +358,7 @@ pandora.ui.listIconPanel = function(listData) { $iconPanel = Ox.Element(), $icon = $('') - .attr({src: '/' + folderItem.toLowerCase() + '/' + encodeURIComponent(listData.id) + '/icon256.jpg?' + Ox.uid()}) + .attr({src: pandora.getMediaURL('/' + folderItem.toLowerCase() + '/' + encodeURIComponent(listData.id) + '/icon256.jpg?' + Ox.uid())}) .css({position: 'absolute', borderRadius: '64px', margin: '16px'}) .appendTo($iconPanel), @@ -435,7 +435,7 @@ pandora.ui.listIconPanel = function(listData) { id: data.id, info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key], title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''), - url: '/' + data.id + '/icon' + size + '.jpg?' + data.modified, + url: pandora.getMediaURL('/' + data.id + '/icon' + size + '.jpg?' + data.modified), width: size }; }, @@ -544,12 +544,20 @@ pandora.ui.listIconPanel = function(listData) { posterFrames: posterFrames }, function() { $icon.attr({ - src: '/' + folderItem.toLowerCase() + '/' + encodeURIComponent(listData.id) + '/icon256.jpg?' + Ox.uid() + src: pandora.getMediaURL('/' + folderItem.toLowerCase() + + '/' + encodeURIComponent(listData.id) + '/icon256.jpg?' + Ox.uid() + ) }); pandora.$ui.folderList[listData.folder].$element - .find('img[src*="/' + encodeURIComponent(listData.id) + '/"]') + .find('img[src*="' + + pandora.getMediaURL('/' + encodeURIComponent(listData.id)) + + '/"]' + ) .attr({ - src: '/' + folderItem.toLowerCase() + '/' + encodeURIComponent(listData.id) + '/icon.jpg?' + Ox.uid() + src: pandora.getMediaURL('/' + folderItem.toLowerCase() + + '/' + encodeURIComponent(listData.id) + + '/icon.jpg?' + Ox.uid() + ) }); pandora.$ui.info.updateListInfo(); }); diff --git a/static/js/player.js b/static/js/player.js index f3ff4789..3120641d 100644 --- a/static/js/player.js +++ b/static/js/player.js @@ -27,7 +27,9 @@ pandora.ui.player = function(data) { enableSubtitles: ui.videoSubtitles, find: ui.itemFind, getLargeTimelineURL: function(type, i) { - return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'; + return pandora.getMediaURL( + '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg' + ); }, height: pandora.$ui.contentPanel.size(1), 'in': ui.videoPoints[ui.item]['in'], @@ -48,7 +50,7 @@ pandora.ui.player = function(data) { showLayers: Ox.clone(ui.showLayers), showUsers: pandora.site.annotations.showUsers, showTimeline: ui.showTimeline, - smallTimelineURL: '/' + ui.item + '/timeline16p.jpg', + smallTimelineURL: pandora.getMediaURL('/' + ui.item + '/timeline16p.jpg'), subtitles: data.subtitles, timeline: ui.videoTimeline, timelineTooltip: 'timeline ' + Ox.SYMBOLS.SHIFT + 'T', diff --git a/static/js/previewDialog.js b/static/js/previewDialog.js index 7dcd8e6d..fce4f46d 100644 --- a/static/js/previewDialog.js +++ b/static/js/previewDialog.js @@ -79,17 +79,17 @@ pandora.ui.previewDialog = function() { item.year ? ' ' + item.year : '' ); $image = $('') - .attr({src: '/' + item.id + '/' + ( + .attr({src: pandora.getMediaURL('/' + item.id + '/' + ( pandora.user.ui.showSitePosters ? 'siteposter' : 'poster' - ) + '128.jpg?' + item.modified}) + ) + '128.jpg?' + item.modified)}) .css({width: size.width + 'px', height: size.height + 'px'}); $('') .load(function() { $image.attr({src: $(this).attr('src')}); }) - .attr({src: '/' + item.id + '/' + ( + .attr({src: pandora.getMediaURL('/' + item.id + '/' + ( pandora.user.ui.showSitePosters ? 'siteposter' : 'poster' - ) + '1024.jpg?' + item.modified}); + ) + '1024.jpg?' + item.modified)}); that.options({ content: $image, title: title, diff --git a/static/js/similarClipsDialog.js b/static/js/similarClipsDialog.js index f29b5d86..40f565bd 100644 --- a/static/js/similarClipsDialog.js +++ b/static/js/similarClipsDialog.js @@ -352,7 +352,7 @@ pandora.ui.similarClipsDialog = function() { id: data.id, info: Ox.formatDuration(data['in'], 2) + '-' + Ox.formatDuration(data.out, 2), title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''), - url: '/' + data.id.split('/')[0] + '/' + height + 'p' + data['in'] + '.jpg', + url: pandora.getMediaURL('/' + data.id.split('/')[0] + '/' + height + 'p' + data['in'] + '.jpg'), width: width }; } diff --git a/static/js/timeline.js b/static/js/timeline.js index 74eb7716..483e10bf 100644 --- a/static/js/timeline.js +++ b/static/js/timeline.js @@ -25,10 +25,14 @@ pandora.ui.timeline = function(data) { duration: data.duration, followPlayer: ui.followPlayer, getFrameURL: function(position) { - return '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg'; + return pandora.getMediaURL( + '/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg?' + data.modified + ); }, getLargeTimelineURL: function(type, i) { - return '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg'; + return pandora.getMediaURL( + '/' + ui.item + '/timeline' + type + '64p' + i + '.jpg?' + data.modified + ); }, height: pandora.$ui.contentPanel.size(1), itemName: pandora.site.itemName, @@ -44,7 +48,9 @@ pandora.ui.timeline = function(data) { showAnnotationsMap: ui.showAnnotationsMap, showLayers: Ox.clone(ui.showLayers), showUsers: pandora.site.annotations.showUsers, - smallTimelineURL: '/' + ui.item + '/timeline16p.jpg', + smallTimelineURL: pandora.getMediaURL( + '/' + ui.item + '/timeline16p.jpg?' + data.modified + ), timeline: ui.videoTimeline, timelines: pandora.site.timelines, video: data.video, diff --git a/static/js/utils.js b/static/js/utils.js index c3f9591a..1d121ac5 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -1241,7 +1241,9 @@ pandora.getLargeClipTimelineURL = function(item, inPoint, outPoint, type, callba } }) .attr({ - src: '/' + item + '/timeline' + type + '64p' + index + '.jpg' + src: pandora.getMediaURL( + '/' + item + '/timeline' + type + '64p' + index + '.jpg' + ) })[0]; }, function() { callback(canvas.toDataURL()); @@ -1455,7 +1457,9 @@ pandora.getSmallClipTimelineURL = function(item, inPoint, outPoint, type, callba } }) .attr({ - src: '/' + item + '/timeline' + type + '16p' + index + '.jpg' + src: pandora.getMediaURL( + '/' + item + '/timeline' + type + '16p' + index + '.jpg' + ) })[0]; }, function() { callback(canvas.toDataURL()); @@ -1646,6 +1650,10 @@ pandora.getStatusText = function(data) { return parts.join(', '); }; +pandora.getMediaURL = function(url) { + return pandora.site.site.mediaprefix + url; +}; + pandora.getVideoURL = function(id, resolution, part) { var prefix = pandora.site.site.videoprefix .replace('{id}', id) diff --git a/static/js/videoPreview.js b/static/js/videoPreview.js index 57f50a24..c036830a 100644 --- a/static/js/videoPreview.js +++ b/static/js/videoPreview.js @@ -12,15 +12,15 @@ pandora.ui.videoPreview = function(data) { resolution = resolutions.length ? Ox.min(resolutions) : Ox.max(pandora.site.video.resolutions); - return '/' + data.id + '/' + resolution + 'p' + ( + return pandora.getMediaURL('/' + data.id + '/' + resolution + 'p' + ( Ox.isUndefined(position) ? '' : position - ) + '.jpg'; + ) + '.jpg'); }, frameRatio: data.frameRatio, height: data.height, position: data.position, scaleToFill: true, - timeline: '/' + data.id + '/timeline16p.jpg', + timeline: pandora.getMediaURL('/' + data.id + '/timeline16p.jpg'), videoTooltip: data.videoTooltip, width: data.width });