diff --git a/static/js/embedInfo.js b/static/js/embedInfo.js index cc4bbaac..e3887927 100644 --- a/static/js/embedInfo.js +++ b/static/js/embedInfo.js @@ -2,15 +2,103 @@ pandora.ui.embedInfo = function() { - var ui = pandora.user.ui, + var item = pandora.user.ui.item, - that = Ox.Element(), + data, - $poster = Ox.Element('') - .attr({ - src: '/' + pandora.user.ui.item + '/poster.jpg' - }) - .appendTo(that); + that = Ox.Element(); + + pandora.api.get({ + id: item, + keys: ['director', 'posterRatio', 'title', 'year'] + }, function(result) { + + data = result.data; + + var posterSize = 256, + posterWidth = Math.round( + data.posterRatio > 1 + ? posterSize + : posterSize * data.posterRatio + ), + posterHeight = Math.round( + data.posterRatio > 1 + ? posterSize / data.posterRatio + : posterSize + ), + posterLeft = Math.floor( + (window.innerWidth - posterWidth) / 2 + ), + textCSS = { + marginTop: '8px', + fontWeight: 'bold', + fontSize: '13px', + textAlign: 'center' + }, + + $icon = Ox.$('') + .attr({src: '/' + item + '/poster256.jpg'}) + .css({ + position: 'absolute', + left: posterLeft + 'px', + top: '8px', + width: posterWidth + 'px', + height: posterHeight + 'px', + cursor: 'pointer' + }) + .appendTo(that), + + $reflection = Ox.$('