2011-08-05 18:26:27 +00:00
|
|
|
pandora.ui.infoView = function(data) {
|
|
|
|
|
2011-08-06 03:19:14 +00:00
|
|
|
var css = {
|
|
|
|
marginTop: '4px',
|
|
|
|
textAlign: 'justify',
|
|
|
|
MozUserSelect: 'text',
|
|
|
|
WebkitUserSelect: 'text'
|
|
|
|
},
|
|
|
|
listWidth = 144 + Ox.UI.SCROLLBAR_SIZE,
|
|
|
|
margin = 16,
|
2011-08-07 22:15:08 +00:00
|
|
|
iconSize = pandora.user.ui.infoIconSize,
|
|
|
|
iconRatio = pandora.user.ui.icons == 'posters'
|
2011-08-19 12:33:02 +00:00
|
|
|
? data.posterRatio : 1,
|
2011-08-07 22:15:08 +00:00
|
|
|
iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio),
|
|
|
|
iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio),
|
|
|
|
iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0,
|
2011-08-17 09:29:42 +00:00
|
|
|
borderRadius = pandora.user.ui.icons == 'posters' ? 0 : iconSize / 8,
|
2011-08-07 22:15:08 +00:00
|
|
|
edit = false,
|
2011-08-05 18:26:27 +00:00
|
|
|
that = Ox.Element(),
|
2011-08-06 13:34:56 +00:00
|
|
|
uid = Ox.uid(),
|
2011-08-05 18:26:27 +00:00
|
|
|
$list,
|
|
|
|
$info = $('<div>')
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: pandora.user.level == 'admin' ? -listWidth + 'px' : 0,
|
|
|
|
top: 0,
|
|
|
|
right: 0,
|
|
|
|
})
|
|
|
|
.appendTo(that.$element),
|
|
|
|
$data = Ox.Container()
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: (pandora.user.level == 'admin' ? listWidth : 0) + 'px',
|
|
|
|
top: 0,
|
|
|
|
right: 0,
|
|
|
|
height: pandora.$ui.contentPanel.size(1) + 'px'
|
|
|
|
})
|
|
|
|
.appendTo($info),
|
2011-08-07 22:15:08 +00:00
|
|
|
$icon = Ox.Element('<img>')
|
2011-08-05 18:26:27 +00:00
|
|
|
.attr({
|
2011-08-07 22:15:08 +00:00
|
|
|
src: '/' + data.id + '/' + (
|
|
|
|
pandora.user.ui.icons == 'posters' ? 'poster' : 'icon'
|
|
|
|
) + '512.jpg?' + uid
|
2011-08-05 18:26:27 +00:00
|
|
|
})
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
2011-08-07 22:15:08 +00:00
|
|
|
left: margin + iconLeft + 'px',
|
2011-08-05 18:26:27 +00:00
|
|
|
top: margin + 'px',
|
2011-08-07 22:15:08 +00:00
|
|
|
width: iconWidth + 'px',
|
|
|
|
height: iconHeight + 'px',
|
2011-08-17 09:29:42 +00:00
|
|
|
borderRadius: borderRadius + 'px',
|
2011-08-06 01:34:07 +00:00
|
|
|
cursor: 'pointer'
|
|
|
|
})
|
|
|
|
.bindEvent({
|
2011-08-07 22:15:08 +00:00
|
|
|
singleclick: toggleIconSize
|
2011-08-05 18:26:27 +00:00
|
|
|
})
|
|
|
|
.appendTo($data.$element),
|
|
|
|
$reflection = $('<div>')
|
2011-08-07 16:30:26 +00:00
|
|
|
.addClass('OxReflection')
|
2011-08-05 18:26:27 +00:00
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
|
|
|
left: margin + 'px',
|
2011-08-07 22:15:08 +00:00
|
|
|
top: margin + iconHeight + 'px',
|
|
|
|
width: iconSize + 'px',
|
|
|
|
height: iconSize / 2 + 'px',
|
2011-08-05 18:26:27 +00:00
|
|
|
overflow: 'hidden'
|
|
|
|
})
|
|
|
|
.appendTo($data.$element),
|
2011-08-07 22:15:08 +00:00
|
|
|
$reflectionIcon = $('<img>')
|
2011-08-05 18:26:27 +00:00
|
|
|
.attr({
|
2011-08-07 22:15:08 +00:00
|
|
|
src: '/' + data.id + '/' + (
|
|
|
|
pandora.user.ui.icons == 'posters' ? 'poster' : 'icon'
|
|
|
|
) + '512.jpg?' + uid
|
2011-08-05 18:26:27 +00:00
|
|
|
})
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
2011-08-07 22:15:08 +00:00
|
|
|
left: iconLeft + 'px',
|
|
|
|
width: iconWidth + 'px',
|
2011-08-17 09:29:42 +00:00
|
|
|
height: iconHeight + 'px',
|
|
|
|
borderRadius: borderRadius + 'px'
|
2011-08-05 18:26:27 +00:00
|
|
|
})
|
|
|
|
.appendTo($reflection),
|
|
|
|
$reflectionGradient = $('<div>')
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
2011-08-07 22:15:08 +00:00
|
|
|
width: iconSize + 'px',
|
|
|
|
height: iconSize / 2 + 'px'
|
2011-08-05 18:26:27 +00:00
|
|
|
})
|
|
|
|
.appendTo($reflection),
|
|
|
|
$text = $('<div>')
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
2011-08-07 22:15:08 +00:00
|
|
|
left: margin + (iconSize == 256 ? 256 : iconWidth) + margin + 'px',
|
2011-08-05 18:26:27 +00:00
|
|
|
top: margin + 'px',
|
|
|
|
right: margin + 'px'
|
|
|
|
})
|
2011-08-07 16:30:26 +00:00
|
|
|
.bind({
|
|
|
|
click: function(e) {
|
|
|
|
var $target = $(e.target);
|
2011-08-07 17:05:49 +00:00
|
|
|
if ($target.is('a')) {
|
|
|
|
pandora.URL.set($target.attr('href'));
|
|
|
|
return false;
|
2011-08-07 16:30:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2011-08-06 13:34:56 +00:00
|
|
|
.appendTo($data.$element),
|
|
|
|
$browserImages = [];
|
2011-08-06 03:19:14 +00:00
|
|
|
|
|
|
|
var match = /(\(S\d{2}(E\d{2})?\))/.exec(data.title);
|
|
|
|
if (match) {
|
|
|
|
data.title = data.title.replace(match[0], formatLight(match[0]));
|
|
|
|
}
|
|
|
|
|
|
|
|
$('<div>')
|
|
|
|
.css({
|
|
|
|
marginTop: '-2px',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: '13px',
|
|
|
|
MozUserSelect: 'text',
|
|
|
|
WebkitUserSelect: 'text'
|
|
|
|
})
|
|
|
|
.html(
|
2011-08-06 13:34:56 +00:00
|
|
|
data.title + (
|
|
|
|
data.original_title && data.original_title != data.title
|
|
|
|
? ' ' + formatLight('(' + data.original_title + ')') : ''
|
|
|
|
)
|
2011-08-06 03:19:14 +00:00
|
|
|
)
|
|
|
|
.appendTo($text);
|
|
|
|
|
|
|
|
$('<div>')
|
|
|
|
.css({
|
|
|
|
marginTop: '2px',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
fontSize: '13px',
|
|
|
|
MozUserSelect: 'text',
|
|
|
|
WebkitUserSelect: 'text'
|
|
|
|
})
|
|
|
|
.html(formatValue(data.director, 'name'))
|
|
|
|
.appendTo($text);
|
2011-08-06 01:04:09 +00:00
|
|
|
|
|
|
|
if (data.country || data.year || data.language || data.runtime || pandora.user.level == 'admin') {
|
|
|
|
var $div = $('<div>')
|
2011-08-06 03:19:14 +00:00
|
|
|
.css(css)
|
2011-08-06 01:04:09 +00:00
|
|
|
.appendTo($text);
|
|
|
|
var html = [];
|
|
|
|
['country', 'year', 'language', 'runtime'].forEach(function(key) {
|
|
|
|
if (data[key] || (['country', 'year'].indexOf(key) > -1 && pandora.user.level == 'admin')) {
|
2011-08-06 03:19:14 +00:00
|
|
|
var value = data[key] || formatLight('unknown');
|
2011-08-06 01:04:09 +00:00
|
|
|
html.push(
|
|
|
|
formatKey(key)
|
|
|
|
+ (key == 'runtime'
|
|
|
|
? Math.round(value / 60) + ' min'
|
2011-08-06 03:19:14 +00:00
|
|
|
: formatValue(value, key == 'runtime' || !data[key] ? null : key))
|
2011-08-06 01:04:09 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$div.html(html.join('; '));
|
|
|
|
}
|
|
|
|
|
2011-08-05 18:26:27 +00:00
|
|
|
// fixme: should be camelCase!
|
|
|
|
data.alternative_titles && $('<div>')
|
2011-08-06 03:19:14 +00:00
|
|
|
.css(css)
|
2011-08-05 18:26:27 +00:00
|
|
|
.html(
|
|
|
|
formatKey('Alternative Titles') + data.alternative_titles.map(function(value) {
|
2011-08-06 03:19:14 +00:00
|
|
|
return value[0] + (value[1] ? ' '
|
|
|
|
+ formatLight('(' + value[1] + ')') : '');
|
2011-08-05 18:26:27 +00:00
|
|
|
}).join(', ')
|
|
|
|
)
|
|
|
|
.appendTo($text);
|
2011-08-06 01:04:09 +00:00
|
|
|
|
2011-08-06 03:19:14 +00:00
|
|
|
if (data.creator || data.writer || data.producer || data.cinematographer || data.editor) {
|
2011-08-06 01:04:09 +00:00
|
|
|
$div = $('<div>')
|
2011-08-06 03:19:14 +00:00
|
|
|
.css(css)
|
2011-08-06 01:04:09 +00:00
|
|
|
.appendTo($text);
|
|
|
|
html = [];
|
2011-08-06 03:19:14 +00:00
|
|
|
['creator', 'writer', 'producer', 'cinematographer', 'editor'].forEach(function(key) {
|
2011-08-06 01:04:09 +00:00
|
|
|
data[key] && html.push(
|
|
|
|
formatKey(key) + formatValue(data[key], 'name')
|
|
|
|
);
|
|
|
|
});
|
|
|
|
$div.html(html.join('; '));
|
|
|
|
}
|
|
|
|
|
|
|
|
data.cast && $('<div>')
|
2011-08-06 03:19:14 +00:00
|
|
|
.css(css)
|
2011-08-06 01:04:09 +00:00
|
|
|
.html(
|
|
|
|
formatKey('cast') + data.cast.map(function(value) {
|
|
|
|
value.character = value.character.replace('(uncredited)', '').trim();
|
2011-08-06 03:19:14 +00:00
|
|
|
return formatValue(value.actor, 'name')
|
|
|
|
+ (value.character ? ' '
|
|
|
|
+ formatLight('(' + formatValue(value.character) + ')')
|
|
|
|
: '');
|
2011-08-06 01:04:09 +00:00
|
|
|
}).join(', ')
|
|
|
|
)
|
2011-08-05 18:26:27 +00:00
|
|
|
.appendTo($text);
|
|
|
|
|
2011-08-06 01:04:09 +00:00
|
|
|
if (data.genre || data.keyword) {
|
|
|
|
$div = $('<div>')
|
2011-08-06 03:19:14 +00:00
|
|
|
.css(css)
|
2011-08-05 18:26:27 +00:00
|
|
|
.appendTo($text);
|
2011-08-06 01:04:09 +00:00
|
|
|
html = [];
|
|
|
|
['genre', 'keyword'].forEach(function(key) {
|
|
|
|
data[key] && html.push(
|
|
|
|
formatKey(key == 'keyword' ? 'keywords' : key)
|
|
|
|
+ formatValue(data[key], key)
|
|
|
|
);
|
|
|
|
});
|
|
|
|
$div.html(html.join('; '));
|
|
|
|
}
|
2011-08-05 18:26:27 +00:00
|
|
|
|
|
|
|
data.summary && $('<div>')
|
2011-08-06 03:19:14 +00:00
|
|
|
.css(css)
|
2011-08-05 18:26:27 +00:00
|
|
|
.html(
|
|
|
|
formatKey('summary') + data.summary
|
|
|
|
)
|
|
|
|
.appendTo($text);
|
|
|
|
|
|
|
|
data.trivia && data.trivia.forEach(function(value) {
|
|
|
|
$('<div>')
|
|
|
|
.css({
|
|
|
|
display: 'table-row'
|
|
|
|
})
|
|
|
|
.append(
|
|
|
|
$('<div>')
|
|
|
|
.css({
|
|
|
|
display: 'table-cell',
|
|
|
|
width: '12px',
|
2011-08-06 01:04:09 +00:00
|
|
|
paddingTop: '4px'
|
2011-08-05 18:26:27 +00:00
|
|
|
})
|
|
|
|
.html('<span style="font-weight: bold">•</span>')
|
|
|
|
)
|
|
|
|
.append(
|
|
|
|
$('<div>')
|
|
|
|
.css({
|
|
|
|
display: 'table-cell',
|
|
|
|
paddingTop: '4px',
|
|
|
|
textAlign: 'justify',
|
|
|
|
MozUserSelect: 'text',
|
|
|
|
WebkitUserSelect: 'text'
|
|
|
|
})
|
|
|
|
.html(value)
|
|
|
|
)
|
|
|
|
.append(
|
|
|
|
$('<div>').css({clear: 'both'})
|
|
|
|
)
|
|
|
|
.appendTo($text);
|
|
|
|
});
|
|
|
|
|
|
|
|
data.filming_locations && $('<div>')
|
2011-08-06 03:19:14 +00:00
|
|
|
.css(css)
|
2011-08-05 18:26:27 +00:00
|
|
|
.html(
|
|
|
|
formatKey('Filming Locations') + data.filming_locations.join('; ')
|
|
|
|
)
|
|
|
|
.appendTo($text);
|
|
|
|
|
|
|
|
data.releasedate && $('<div>')
|
2011-08-06 03:19:14 +00:00
|
|
|
.css(css)
|
2011-08-05 18:26:27 +00:00
|
|
|
.html(
|
|
|
|
formatKey('Release Date') + Ox.formatDate(data.releasedate, '%A, %B %e, %Y')
|
|
|
|
)
|
|
|
|
.appendTo($text);
|
|
|
|
|
|
|
|
if (data.budget || data.gross || data.profit) {
|
|
|
|
$div = $('<div>')
|
2011-08-06 03:19:14 +00:00
|
|
|
.css(css)
|
2011-08-05 18:26:27 +00:00
|
|
|
.appendTo($text);
|
2011-08-06 01:04:09 +00:00
|
|
|
html = [];
|
2011-08-05 18:26:27 +00:00
|
|
|
['budget', 'gross', 'profit'].forEach(function(key) {
|
2011-08-06 01:04:09 +00:00
|
|
|
data[key] && html.push(
|
|
|
|
formatKey(key) + Ox.formatCurrency(data[key], '$')
|
|
|
|
);
|
2011-08-05 18:26:27 +00:00
|
|
|
});
|
2011-08-06 01:04:09 +00:00
|
|
|
$div.html(html.join('; '));
|
2011-08-05 18:26:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (data.rating || data.votes) {
|
|
|
|
$div = $('<div>')
|
2011-08-06 03:19:14 +00:00
|
|
|
.css(css)
|
2011-08-05 18:26:27 +00:00
|
|
|
.appendTo($text);
|
2011-08-06 01:04:09 +00:00
|
|
|
html = [];
|
2011-08-05 18:26:27 +00:00
|
|
|
['rating', 'votes'].forEach(function(key) {
|
2011-08-06 01:04:09 +00:00
|
|
|
data[key] && html.push(
|
|
|
|
formatKey(key) + Ox.formatNumber(data[key])
|
|
|
|
);
|
2011-08-05 18:26:27 +00:00
|
|
|
});
|
2011-08-06 01:04:09 +00:00
|
|
|
$div.html(html.join('; '));
|
2011-08-05 18:26:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (data.connections) {
|
|
|
|
$div = $('<div>')
|
2011-08-06 03:19:14 +00:00
|
|
|
.css(css)
|
2011-08-05 18:26:27 +00:00
|
|
|
.appendTo($text);
|
2011-08-06 01:04:09 +00:00
|
|
|
html = [];
|
|
|
|
[
|
|
|
|
'Edited from', 'Edited into',
|
|
|
|
'Features', 'Featured in',
|
|
|
|
'Follows', 'Followed by',
|
|
|
|
'References', 'Referenced in',
|
|
|
|
'Remake of', 'Remade as',
|
|
|
|
'Spin off from', 'Spin off',
|
|
|
|
'Spoofs', 'Spoofed in'
|
|
|
|
].forEach(function(key) {
|
|
|
|
data.connections[key] && html.push(
|
|
|
|
formatKey(key) + formatValue(data.connections[key])
|
|
|
|
);
|
2011-08-05 18:26:27 +00:00
|
|
|
});
|
2011-08-06 01:04:09 +00:00
|
|
|
$div.html(html.join('; '));
|
2011-08-05 18:26:27 +00:00
|
|
|
}
|
|
|
|
|
2011-08-06 01:04:09 +00:00
|
|
|
['reviews', 'links'].forEach(function(key) {
|
|
|
|
data[key] && $('<div>')
|
2011-08-06 03:19:14 +00:00
|
|
|
.css(css)
|
2011-08-06 01:04:09 +00:00
|
|
|
.html(
|
|
|
|
formatKey(key) + data[key].map(function(value) {
|
2011-08-07 17:05:49 +00:00
|
|
|
return '<a href="/?url=' + encodeURIComponent(value.url) + '">' + value.source + '</a>'
|
2011-08-06 01:04:09 +00:00
|
|
|
}).join(', ')
|
|
|
|
)
|
|
|
|
.appendTo($text);
|
|
|
|
});
|
2011-08-05 18:26:27 +00:00
|
|
|
|
|
|
|
$('<div>').css({height: '8px'}).appendTo($text);
|
|
|
|
|
|
|
|
if (pandora.user.level == 'admin') {
|
2011-08-06 01:34:07 +00:00
|
|
|
|
2011-08-07 22:15:08 +00:00
|
|
|
$icon.bindEvent({
|
2011-08-06 01:34:07 +00:00
|
|
|
doubleclick: function() {
|
2011-08-07 22:15:08 +00:00
|
|
|
if (!edit) {
|
2011-08-05 18:26:27 +00:00
|
|
|
$info.animate({
|
|
|
|
left: 0
|
|
|
|
}, 250);
|
2011-08-07 22:15:08 +00:00
|
|
|
edit = true;
|
2011-08-05 18:26:27 +00:00
|
|
|
} else {
|
|
|
|
$info.animate({
|
|
|
|
left: -listWidth + 'px'
|
|
|
|
}, 250);
|
2011-08-07 22:15:08 +00:00
|
|
|
edit = false;
|
2011-08-05 18:26:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2011-08-07 22:15:08 +00:00
|
|
|
|
|
|
|
renderList();
|
|
|
|
|
2011-08-05 18:26:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function formatKey(key) {
|
|
|
|
return '<span style="font-weight: bold">' + Ox.toTitleCase(key) + ':</span> ';
|
|
|
|
}
|
|
|
|
|
2011-08-06 03:19:14 +00:00
|
|
|
function formatLight(str) {
|
|
|
|
return '<span style="color: rgb(128, 128, 128)">' + str + '</span>';
|
|
|
|
}
|
|
|
|
|
2011-08-05 18:26:27 +00:00
|
|
|
function formatValue(value, key) {
|
|
|
|
return (Ox.isArray(value) ? value : [value]).map(function(value) {
|
2011-08-07 16:30:26 +00:00
|
|
|
return key ?
|
2011-08-07 17:05:49 +00:00
|
|
|
'<a href="/?find=' + key + ':' + value + '">' + value + '</a>'
|
2011-08-07 16:30:26 +00:00
|
|
|
: value;
|
|
|
|
//return key ? '<a href="/?find=' + key + ':' + value + '">' + value + '</a>' : value;
|
2011-08-05 18:26:27 +00:00
|
|
|
}).join(', ');
|
|
|
|
}
|
|
|
|
|
2011-08-07 22:15:08 +00:00
|
|
|
function renderList() {
|
|
|
|
pandora.api.get({
|
|
|
|
id: data.id,
|
|
|
|
keys: [pandora.user.ui.icons == 'posters' ? 'posters' : 'frames']
|
|
|
|
}, 0, function(result) {
|
|
|
|
Ox.print('RESULT', result.data)
|
|
|
|
var images = result.data[pandora.user.ui.icons == 'posters' ? 'posters' : 'frames'],
|
|
|
|
selectedImage = images.filter(function(image) {
|
|
|
|
return image.selected;
|
|
|
|
})[0];
|
|
|
|
$list = Ox.IconList({
|
|
|
|
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : data.stream.aspectRatio,
|
|
|
|
fixedRatio: pandora.user.ui.icons == 'posters' ? false : data.stream.aspectRatio,
|
|
|
|
item: function(data, sort, size) {
|
|
|
|
var ratio = data.width / data.height;
|
|
|
|
size = size || 128;
|
|
|
|
return {
|
|
|
|
height: ratio <= 1 ? size : size / ratio,
|
|
|
|
id: data['id'],
|
|
|
|
info: data.width + ' x ' + data.height + ' px',
|
|
|
|
title: pandora.user.ui.icons == 'posters' ? data.source : Ox.formatDuration(data.position),
|
|
|
|
url: data.url,
|
|
|
|
width: ratio >= 1 ? size : size * ratio
|
|
|
|
}
|
|
|
|
},
|
|
|
|
items: images,
|
|
|
|
keys: pandora.user.ui.icons == 'posters'
|
|
|
|
? ['index', 'source', 'width', 'height', 'url']
|
|
|
|
: ['index', 'position', 'width', 'height', 'url'],
|
|
|
|
max: 1,
|
|
|
|
min: 1,
|
|
|
|
orientation: 'vertical',
|
|
|
|
selected: [selectedImage['index']],
|
|
|
|
size: 128,
|
|
|
|
sort: [{key: 'index', operator: '+'}],
|
|
|
|
unique: 'index'
|
|
|
|
})
|
|
|
|
.css({
|
|
|
|
display: 'block',
|
|
|
|
position: 'absolute',
|
|
|
|
left: 0,
|
|
|
|
top: 0,
|
|
|
|
width: listWidth + 'px',
|
|
|
|
height: pandora.$ui.contentPanel.size(1) + 'px'
|
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
select: function(event) {
|
|
|
|
var index = event.ids[0];
|
|
|
|
selectedImage = images.filter(function(image) {
|
|
|
|
return image.index == index;
|
|
|
|
})[0];
|
|
|
|
var imageRatio = selectedImage.width / selectedImage.height,
|
|
|
|
src = selectedImage.url;
|
|
|
|
if ($browserImages.length == 0) {
|
|
|
|
$browserImages = pandora.$ui.browser.find('img[src*="/' + data.id + '/"]');
|
|
|
|
}
|
|
|
|
if (pandora.user.ui.icons == 'posters') {
|
|
|
|
$browserImages.each(function() {
|
|
|
|
var $this = $(this),
|
|
|
|
size = Math.max($this.width(), $this.height());
|
|
|
|
$this.attr({src: src});
|
|
|
|
pandora.user.ui.icons == 'posters' && $this.css(imageRatio < 1 ? {
|
|
|
|
width: Math.round(size * imageRatio) + 'px',
|
|
|
|
height: size + 'px'
|
|
|
|
} : {
|
|
|
|
width: size + 'px',
|
|
|
|
height: Math.round(size / imageRatio) + 'px'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$icon.attr({src: src});
|
|
|
|
$reflectionIcon.attr({src: src});
|
|
|
|
iconRatio = imageRatio;
|
|
|
|
iconSize = iconSize == 256 ? 512 : 256;
|
|
|
|
toggleIconSize();
|
|
|
|
}
|
|
|
|
pandora.api[pandora.user.ui.icons == 'posters' ? 'setPoster' : 'setPosterFrame'](Ox.extend({
|
|
|
|
id: data.id
|
|
|
|
}, pandora.user.ui.icons == 'posters' ? {
|
|
|
|
source: selectedImage.source
|
|
|
|
} : {
|
|
|
|
position: selectedImage.index // fixme: api slightly inconsistent
|
|
|
|
}), function() {
|
|
|
|
var src;
|
|
|
|
if (pandora.user.ui.icons == 'frames') {
|
|
|
|
src = '/' + data.id + '/icon512.jpg?' + Ox.uid()
|
|
|
|
$icon.attr({src: src});
|
|
|
|
$reflectionIcon.attr({src: src});
|
|
|
|
}
|
|
|
|
$browserImages.each(function() {
|
|
|
|
$(this).attr({src: '/' + data.id + '/' + (
|
|
|
|
pandora.user.ui.icons == 'posters' ? 'poster' : 'icon'
|
|
|
|
) + '64.jpg?' + Ox.uid()});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.appendTo($info);
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleIconSize() {
|
|
|
|
iconSize = iconSize == 256 ? 512 : 256;
|
|
|
|
iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio);
|
|
|
|
iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio);
|
|
|
|
iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0,
|
2011-08-17 09:29:42 +00:00
|
|
|
borderRadius = pandora.user.ui.icons == 'posters' ? 0 : iconSize / 8;
|
2011-08-07 22:15:08 +00:00
|
|
|
$icon.animate({
|
|
|
|
left: margin + iconLeft + 'px',
|
|
|
|
width: iconWidth + 'px',
|
2011-08-17 09:29:42 +00:00
|
|
|
height: iconHeight + 'px',
|
|
|
|
borderRadius: borderRadius + 'px'
|
2011-08-06 01:34:07 +00:00
|
|
|
}, 250);
|
|
|
|
$reflection.animate({
|
2011-08-07 22:15:08 +00:00
|
|
|
top: margin + iconHeight + 'px',
|
|
|
|
width: iconSize + 'px',
|
|
|
|
height: iconSize / 2 + 'px'
|
2011-08-06 01:34:07 +00:00
|
|
|
}, 250);
|
2011-08-07 22:15:08 +00:00
|
|
|
$reflectionIcon.animate({
|
|
|
|
left: iconLeft + 'px',
|
|
|
|
width: iconWidth + 'px',
|
|
|
|
height: iconHeight + 'px',
|
2011-08-17 09:29:42 +00:00
|
|
|
borderRadius: borderRadius + 'px'
|
2011-08-06 01:34:07 +00:00
|
|
|
}, 250);
|
|
|
|
$reflectionGradient.animate({
|
2011-08-07 22:15:08 +00:00
|
|
|
width: iconSize + 'px',
|
|
|
|
height: iconSize / 2 + 'px'
|
2011-08-06 01:34:07 +00:00
|
|
|
}, 250);
|
|
|
|
$text.animate({
|
2011-08-07 22:15:08 +00:00
|
|
|
left: margin + (iconSize == 256 ? 256 : iconWidth) + margin + 'px',
|
2011-08-06 01:34:07 +00:00
|
|
|
}, 250);
|
2011-08-07 22:15:08 +00:00
|
|
|
pandora.UI.set({infoIconSize: iconSize});
|
2011-08-06 01:34:07 +00:00
|
|
|
}
|
|
|
|
|
2011-08-07 22:15:08 +00:00
|
|
|
that.reload = function() {
|
|
|
|
var src = src = '/' + data.id + '/' + (
|
|
|
|
pandora.user.ui.icons == 'posters' ? 'poster' : 'icon'
|
|
|
|
) + '512.jpg?' + Ox.uid()
|
|
|
|
$icon.attr({src: src});
|
|
|
|
$reflectionIcon.attr({src: src});
|
|
|
|
iconSize = iconSize == 256 ? 512 : 256;
|
|
|
|
iconRatio = pandora.user.ui.icons == 'posters'
|
2011-08-20 09:07:45 +00:00
|
|
|
? data.posterRatio : 1;
|
2011-08-07 22:15:08 +00:00
|
|
|
toggleIconSize();
|
2011-08-07 22:21:38 +00:00
|
|
|
pandora.user.level == 'admin' && $list.replaceWith($list = renderList());
|
2011-08-07 22:15:08 +00:00
|
|
|
};
|
|
|
|
|
2011-08-05 18:26:27 +00:00
|
|
|
that.resize = function() {
|
|
|
|
var height = pandora.$ui.contentPanel.size(1);
|
|
|
|
$list && $list.css({height: height + 'px'});
|
|
|
|
$data.css({height: height + 'px'});
|
|
|
|
};
|
|
|
|
|
|
|
|
return that;
|
|
|
|
|
2011-08-20 09:07:45 +00:00
|
|
|
}
|