From acd70661d93e69a4ed9d9fd475dc483bd09adcc2 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 3 Aug 2013 17:38:33 +0000 Subject: [PATCH] use same code path for document.title and item title in toolbar --- static/js/item.js | 8 +------- static/js/utils.js | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/static/js/item.js b/static/js/item.js index adf81984..32c05f6b 100644 --- a/static/js/item.js +++ b/static/js/item.js @@ -34,13 +34,7 @@ pandora.ui.item = function() { } pandora.$ui.itemTitle - .options({ - title: '' + result.data.title - + (Ox.len(result.data.director) - ? ' (' + result.data.director.join(', ') + ')' - : '') - + (result.data.year ? ' ' + result.data.year : '') + '' - }) + .options({title: '' + pandora.getItemTitle(result.data) + ''}) .show(); // fixme: layers have value, subtitles has text? diff --git a/static/js/utils.js b/static/js/utils.js index 7f832cc6..0d61a7ab 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -822,17 +822,7 @@ pandora.getClipVideos = function(clip, resolution) { pandora.getDocumentTitle = function(itemData) { var parts = [pandora.site.site.name]; if (itemData) { - itemTitles[pandora.user.ui.item] = Ox.decodeHTMLEntities( - (itemData.title || Ox._('Untitled')) + ( - Ox.len(itemData.director) || itemData.year - ? ' (' + ( - Ox.len(itemData.director) - ? itemData.director - : [Ox._('Unknown Director')] - ).join(', ') + ')' - : '' - ) + (itemData.year ? ' ' + itemData.year : '') - ); + itemTitles[pandora.user.ui.item] = Ox.decodeHTMLEntities(pandora.getItemTitle(itemData)); } if (pandora.user.ui.section == 'items') { if (!pandora.user.ui.item) { @@ -1120,6 +1110,18 @@ pandora.getItemIdAndPosition = function() { return ret; } +pandora.getItemTitle = function(itemData) { + return (itemData.title || Ox._('Untitled')) + ( + Ox.len(itemData.director) || itemData.year + ? ' (' + ( + Ox.len(itemData.director) + ? itemData.director + : [Ox._('Unknown Director')] + ).join(', ') + ')' + : '' + ) + (itemData.year ? ' ' + itemData.year : '') +}; + pandora.getLargeClipTimelineURL = function(item, inPoint, outPoint, type, callback) { var fps = 25, width = Math.floor((outPoint - inPoint) * fps),