update info embed

This commit is contained in:
rolux 2014-01-22 17:10:13 +00:00
parent c832690bd1
commit 138f5913ad

View file

@ -4,12 +4,7 @@ pandora.ui.embedInfo = function() {
var data, var data,
item = pandora.user.ui.item, item = pandora.user.ui.item,
textCSS = { margin = 16,
marginTop: '8px',
fontWeight: 'bold',
fontSize: '13px',
textAlign: 'center'
},
that = Ox.Element(), that = Ox.Element(),
$icon, $reflection, $reflectionIcon, $reflectionGradient, $icon, $reflection, $reflectionIcon, $reflectionGradient,
$text; $text;
@ -25,7 +20,7 @@ pandora.ui.embedInfo = function() {
.attr({src: '/' + item + '/poster512.jpg'}) .attr({src: '/' + item + '/poster512.jpg'})
.css({ .css({
position: 'absolute', position: 'absolute',
top: '8px', top: margin + 'px',
cursor: 'pointer' cursor: 'pointer'
}) })
.appendTo(that); .appendTo(that);
@ -54,19 +49,28 @@ pandora.ui.embedInfo = function() {
$text = Ox.$('<div>') $text = Ox.$('<div>')
.css({ .css({
position: 'absolute', position: 'absolute',
left: '8px', left: margin + 'px',
right: '8px' right: margin + 'px'
}) })
.appendTo(that); .appendTo(that);
Ox.$('<div>') Ox.$('<div>')
.css(textCSS) .css({
fontWeight: 'bold',
fontSize: '13px',
textAlign: 'center'
})
.html(data.title + (data.year ? ' (' + data.year + ')' : '')) .html(data.title + (data.year ? ' (' + data.year + ')' : ''))
.appendTo($text); .appendTo($text);
if (data.director) { if (data.director) {
Ox.$('<div>') Ox.$('<div>')
.css(textCSS) .css({
marginTop: '8px',
fontWeight: 'bold',
fontSize: '13px',
textAlign: 'center'
})
.html(data.director.map(function(director) { .html(data.director.map(function(director) {
// fixme: there should be a utils method for this // fixme: there should be a utils method for this
return '<a href="/name=' return '<a href="/name='
@ -81,9 +85,9 @@ pandora.ui.embedInfo = function() {
}); });
that.resizePanel = function() { that.resizePanel = function() {
var posterSize = Math.floor( var posterSize = Math.floor((Math.min(
(Math.min(window.innerWidth, window.innerHeight) - 16) * 2/3 window.innerWidth, window.innerHeight
), ) - 2 * margin) * 2/3),
posterWidth = Math.round( posterWidth = Math.round(
data.posterRatio > 1 data.posterRatio > 1
? posterSize ? posterSize
@ -102,7 +106,7 @@ pandora.ui.embedInfo = function() {
}); });
$reflection.css({ $reflection.css({
left: posterLeft + 'px', left: posterLeft + 'px',
top: posterHeight + 8 + 'px', top: posterHeight + margin + 'px',
width: posterWidth + 'px', width: posterWidth + 'px',
height: Math.round(posterHeight / 2) + 'px' height: Math.round(posterHeight / 2) + 'px'
}); });
@ -115,7 +119,7 @@ pandora.ui.embedInfo = function() {
height: Math.round(posterHeight / 2) + 'px' height: Math.round(posterHeight / 2) + 'px'
}); });
$text.css({ $text.css({
top: 8 + 8 + posterHeight + 'px' top: 2 * margin + posterHeight + 'px'
}); });
return that; return that;
}; };