pandora_bakma/static/js/infoView.bakma.js

834 lines
30 KiB
JavaScript
Raw Normal View History

2014-06-23 10:15:53 +00:00
'use strict';
2019-11-15 14:10:35 +00:00
pandora.ui.infoView = function(data, isMixed) {
isMixed = isMixed || {};
2014-06-23 10:15:53 +00:00
var ui = pandora.user.ui,
2019-11-15 14:10:35 +00:00
isMultiple = arguments.length == 2,
canEdit = pandora.hasCapability('canEditMetadata') || isMultiple || data.editable,
canRemove = pandora.hasCapability('canRemoveItems'),
2014-06-23 10:15:53 +00:00
css = {
marginTop: '4px',
textAlign: 'justify'
},
descriptions = [],
html,
iconRatio = ui.icons == 'posters' ? data.posterRatio : 1,
2019-11-15 14:10:35 +00:00
iconSize = isMultiple ? 0 : ui.infoIconSize,
iconWidth = isMultiple ? 0 : iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio),
2014-06-23 10:15:53 +00:00
iconHeight = iconRatio < 1 ? iconSize : Math.round(iconSize / iconRatio),
2019-11-15 14:10:35 +00:00
iconLeft = isMultiple ? 0 : iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0,
2014-06-23 10:15:53 +00:00
borderRadius = ui.icons == 'posters' ? 0 : iconSize / 8,
margin = 16,
2018-06-02 16:05:08 +00:00
nameKeys = pandora.site.itemKeys.filter(function(key) {
return key.sortType == 'person';
}).map(function(key) {
return key.id;
}),
listKeys = pandora.site.itemKeys.filter(function(key) {
return Ox.isArray(key.type);
}).map(function(key){
return key.id;
}),
2014-06-23 10:15:53 +00:00
statisticsWidth = 128,
$bar = Ox.Bar({size: 16})
.bindEvent({
doubleclick: function(e) {
if ($(e.target).is('.OxBar')) {
$info.animate({scrollTop: 0}, 250);
}
}
}),
$options = Ox.MenuButton({
items: [
{
id: 'delete',
title: Ox._('Delete {0}...', [pandora.site.itemName.singular]),
disabled: !canRemove
}
],
style: 'square',
title: 'set',
tooltip: Ox._('Options'),
type: 'image',
})
.css({
float: 'left',
borderColor: 'rgba(0, 0, 0, 0)',
background: 'rgba(0, 0, 0, 0)'
})
.bindEvent({
click: function(data_) {
if (data_.id == 'delete') {
2019-08-19 09:33:33 +00:00
pandora.$ui.deleteItemsDialog = pandora.ui.deleteItemsDialog({
items: [data]
}).open();
2014-06-23 10:15:53 +00:00
}
}
})
.appendTo($bar),
$edit = Ox.MenuButton({
items: [
{
id: 'insert',
title: Ox._('Insert HTML...'),
disabled: true
}
],
style: 'square',
title: 'edit',
tooltip: Ox._('Edit'),
type: 'image',
})
.css({
float: 'right',
borderColor: 'rgba(0, 0, 0, 0)',
background: 'rgba(0, 0, 0, 0)'
})
.bindEvent({
click: function(data) {
// ...
}
})
.appendTo($bar),
$info = Ox.Element().css({overflowY: 'auto'}),
that = Ox.SplitPanel({
elements: [
2019-11-15 14:10:35 +00:00
{element: $bar, size: isMultiple ? 0 : 16},
2014-06-23 10:15:53 +00:00
{element: $info}
],
orientation: 'vertical'
}),
$left = Ox.Element()
.css({
position: 'absolute'
})
2019-11-15 14:10:35 +00:00
.appendTo($info);
2014-06-23 10:15:53 +00:00
2019-11-15 14:10:35 +00:00
if (!isMultiple) {
var $icon = Ox.Element({
2014-06-23 10:15:53 +00:00
element: '<img>',
tooltip: 'Switch to ' + Ox.getObjectById(
pandora.site.itemViews,
ui.videoView
).title + ' View'
})
.attr({
src: pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ? 'poster' : 'icon'
) + '512.jpg?' + data.modified)
})
.css({
position: 'absolute',
left: margin + iconLeft + 'px',
top: margin + 'px',
width: iconWidth + 'px',
height: iconHeight + 'px',
borderRadius: borderRadius + 'px',
cursor: 'pointer'
})
.bindEvent({
anyclick: function() {
pandora.UI.set({itemView: ui.videoView});
}
})
.appendTo($left),
$reflection = $('<div>')
.addClass('OxReflection')
.css({
position: 'absolute',
left: margin + 'px',
top: margin + iconHeight + 'px',
width: iconSize + 'px',
height: Math.round(iconSize / 2) + 'px',
overflow: 'hidden'
})
.appendTo($left),
$reflectionIcon = $('<img>')
.attr({
src: pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ? 'poster' : 'icon'
) + '512.jpg?' + data.modified)
})
.css({
position: 'absolute',
left: iconLeft + 'px',
width: iconWidth + 'px',
height: iconHeight + 'px',
borderRadius: borderRadius + 'px'
})
.appendTo($reflection),
$reflectionGradient = $('<div>')
.css({
position: 'absolute',
width: iconSize + 'px',
height: Math.round(iconSize / 2) + 'px'
})
2020-06-06 17:07:49 +00:00
.appendTo($reflection);
2019-11-15 14:10:35 +00:00
}
var $data = $('<div>')
2014-06-23 10:15:53 +00:00
.addClass('OxTextPage')
.css({
position: 'absolute',
left: margin + 'px',
top: margin + iconHeight + margin + 'px',
width: iconSize + 'px',
})
2020-06-06 17:07:49 +00:00
.appendTo($left),
2014-06-23 10:15:53 +00:00
$text = Ox.Element()
.addClass('OxTextPage')
.css({
position: 'absolute',
left: margin + (iconSize == 256 ? 256 : iconWidth) + margin + 'px',
top: margin + 'px',
right: margin + statisticsWidth + margin + 'px',
})
.appendTo($info),
$statistics = $('<div>')
.css({
position: 'absolute',
width: statisticsWidth + 'px',
top: margin + 'px',
right: margin + 'px'
})
.appendTo($info),
$capabilities;
[$options, $edit].forEach(function($element) {
$element.find('input').css({
borderWidth: 0,
borderRadius: 0,
padding: '3px'
});
});
if (!canEdit) {
pandora.createLinks($info);
}
// Source & Project --------------------------------------------------------
/*
['source', 'project'].forEach(function(key) {
if (canEdit || data[key]) {
var $div = $('<div>')
.addClass('OxSelectable')
.css(css)
.css({margin: 0})
.appendTo($data);
$('<span>')
.html(
formatKey({
category: 'categories',
}[key] || key).replace('</span>', '&nbsp;</span>')
)
.appendTo($div);
Ox.EditableContent({
clickLink: pandora.clickLink,
format: function(value) {
return formatValue(key, value);
},
placeholder: formatLight(Ox._('unknown')),
editable: canEdit,
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: listKeys.indexOf(key) >= 0
? (data[key] || []).join(', ')
: data[key] || ''
})
.bindEvent({
submit: function(event) {
editMetadata(key, event.value);
}
})
.appendTo($div);
if (canEdit || data[key + 'description']) {
$('<div>')
.append(
descriptions[key] = Ox.EditableContent({
clickLink: pandora.clickLink,
editable: canEdit,
format: function(value) {
return value.replace(
/<img src=/g,
'<img style="float: left; max-width: 256px; max-height: 256px; margin: 0 16px 16px 0" src='
);
},
placeholder: formatLight(Ox._('No {0} Description', [Ox._(Ox.toTitleCase(key))])),
tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea',
value: data[key + 'description'] || ''
})
.css(css)
.bindEvent({
submit: function(event) {
editMetadata(key + 'description', event.value);
}
})
).css({
margin: '12px 0',
})
.appendTo($div);
}
}
});
*/
// Title -------------------------------------------------------------------
$('<div>')
.css({
marginTop: '-2px',
marginBottom: '12px'
})
.append(
Ox.EditableContent({
editable: canEdit,
2020-06-06 17:07:49 +00:00
placeholder: formatLight(Ox._(isMixed ? 'Mixed title' : 'No title')),
2014-06-23 10:15:53 +00:00
tooltip: canEdit ? pandora.getEditTooltip() : '',
2020-06-06 17:07:49 +00:00
value: data.title || ''
2014-06-23 10:15:53 +00:00
})
.css({
fontWeight: 'bold',
fontSize: '13px'
})
.bindEvent({
submit: function(event) {
editMetadata('title', event.value);
}
})
)
.appendTo($text);
// Groups ------------------------------------------------------------------
2018-06-04 13:04:52 +00:00
renderGroup(['location', 'date', 'language']);
2014-06-23 10:15:53 +00:00
renderGroup(['category', 'name']);
2018-03-08 08:19:27 +00:00
renderGroup(['collectives']);
2014-06-23 10:15:53 +00:00
renderGroup(['tag']);
// Summary -------------------------------------------------------------
if (canEdit || data.summary) {
$('<div>')
.css({
marginTop: '12px',
marginBottom: '12px'
})
.append(
Ox.EditableContent({
clickLink: pandora.clickLink,
collapseToEnd: false,
editable: canEdit,
format: function(value) {
return value.replace(
/<img src=/g,
'<img style="float: left; max-width: 256px; max-height: 256px; margin: 0 16px 16px 0" src='
);
},
maxHeight: Infinity,
2019-11-15 14:10:35 +00:00
placeholder: formatLight(Ox._( isMixed.summary ? 'Mixed Summary' : 'No Summary')),
2014-06-23 10:15:53 +00:00
tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea',
value: data.summary || ''
})
.css(css)
.css({
overflow: 'hidden'
})
.bindEvent({
submit: function(event) {
editMetadata('summary', event.value);
}
})
)
.appendTo($text);
$('<div>').css({width: '1px', height: 0, clear: 'both'}).appendTo($text);
}
// License -----------------------------------------------------------------
//renderGroup(['license']);
$('<div>')
.addClass('OxSelectable')
.css(css)
.css({height: '16px'})
.appendTo($text);
// Duration, Aspect Ratio --------------------------------------------------
2019-11-15 14:10:35 +00:00
if (!isMultiple) {
['duration', 'aspectratio'].forEach(function(key) {
var itemKey = Ox.getObjectById(pandora.site.itemKeys, key),
value = data[key] || 0;
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey(itemKey.title, 'statistics'))
.append(
Ox.Theme.formatColor(null, 'gradient')
.css({textAlign: 'right'})
.html(
Ox['format' + Ox.toTitleCase(itemKey.format.type)]
.apply(null, [value].concat(itemKey.format.args))
)
)
.appendTo($statistics);
});
2014-06-23 10:15:53 +00:00
2019-11-15 14:10:35 +00:00
// Hue, Saturation, Lightness, Volume --------------------------------------
['hue', 'saturation', 'lightness', 'volume'].forEach(function(key) {
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey(key, 'statistics'))
.append(
Ox.Theme.formatColor(
data[key] || 0, key == 'volume' ? 'lightness' : key
).css({textAlign: 'right'})
)
.appendTo($statistics);
});
2014-06-23 10:15:53 +00:00
2019-11-15 14:10:35 +00:00
// Cuts per Minute ---------------------------------------------------------
2014-06-23 10:15:53 +00:00
$('<div>')
.css({marginBottom: '4px'})
2019-11-15 14:10:35 +00:00
.append(formatKey('cuts per minute', 'statistics'))
2014-06-23 10:15:53 +00:00
.append(
2019-11-15 14:10:35 +00:00
Ox.Theme.formatColor(null, 'gradient')
.css({textAlign: 'right'})
.html(Ox.formatNumber(data['cutsperminute'] || 0, 3))
2014-06-23 10:15:53 +00:00
)
.appendTo($statistics);
2019-11-15 14:10:35 +00:00
}
2014-06-23 10:15:53 +00:00
// Rights Level ------------------------------------------------------------
var $rightsLevel = $('<div>');
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey(Ox._('Rights Level'), 'statistics'))
.append($rightsLevel)
.appendTo($statistics);
renderRightsLevel();
// User and Groups ---------------------------------------------------------
2020-06-06 17:07:49 +00:00
if (!isMultiple) {
2014-06-23 10:15:53 +00:00
['user', 'groups'].forEach(function(key) {
(canEdit || data[key] && data[key].length) && $('<div>')
.css({marginBottom: '4px'})
.append(formatKey(key, 'statistics'))
.append(
$('<div>')
.css({margin: '2px 0 0 -1px'}) // fixme: weird
.append(
Ox.Editable({
placeholder: key == 'groups' ? formatLight(Ox._('No Groups')) : '',
editable: canEdit,
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: key == 'user' ? data[key] : data[key].join(', ')
})
.bindEvent({
submit: function(event) {
editMetadata(key, event.value);
}
})
)
)
.appendTo($statistics);
});
2020-06-06 17:07:49 +00:00
}
2014-06-23 10:15:53 +00:00
// Created and Modified ----------------------------------------------------
2020-06-06 17:07:49 +00:00
if (!isMultiple) {
2014-06-23 10:15:53 +00:00
['created', 'modified'].forEach(function(key) {
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey(key, 'statistics'))
.append(
$('<div>').html(Ox.formatDate(data[key], '%B %e, %Y'))
)
.appendTo($statistics);
});
2020-06-06 17:07:49 +00:00
}
2014-06-23 10:15:53 +00:00
// Notes --------------------------------------------------------------------
if (canEdit) {
$('<div>')
.css({marginBottom: '4px'})
.append(
formatKey('Notes', 'statistics').options({
tooltip: Ox._('Only {0} can see and edit these comments', [
Object.keys(pandora.site.capabilities.canEditMetadata).map(function(level, i) {
return (
i == 0 ? ''
: i < Ox.len(pandora.site.capabilities.canEditMetadata) - 1 ? ', '
: ' ' + Ox._('and') + ' '
) + Ox.toTitleCase(level)
}).join('')])
})
)
.append(
Ox.EditableContent({
height: 128,
2019-11-15 14:10:35 +00:00
placeholder: formatLight(Ox._(isMixed ? 'Mixed notes' : 'No notes')),
2014-06-23 10:15:53 +00:00
tooltip: pandora.getEditTooltip(),
type: 'textarea',
value: data.notes || '',
width: 128
})
.bindEvent({
submit: function(event) {
editMetadata('notes', event.value);
}
})
)
.appendTo($statistics);
}
$('<div>').css({height: '16px'}).appendTo($statistics);
function editMetadata(key, value) {
if (value != data[key]) {
2019-11-15 14:10:35 +00:00
var edit = {id: isMultiple ? ui.listSelection : data.id};
2014-06-23 10:15:53 +00:00
if (key == 'title') {
edit[key] = value;
} else if (listKeys.indexOf(key) >= 0) {
edit[key] = value ? value.split(', ') : [];
} else {
edit[key] = value ? value : null;
}
pandora.api.edit(edit, function(result) {
2019-11-15 14:10:35 +00:00
if (!isMultiple) {
data[key] = result.data[key];
descriptions[key] && descriptions[key].options({
value: result.data[key + 'description']
2014-06-23 10:15:53 +00:00
});
2019-11-15 14:10:35 +00:00
Ox.Request.clearCache(); // fixme: too much? can change filter/list etc
if (result.data.id != data.id) {
pandora.UI.set({item: result.data.id});
pandora.$ui.browser.value(data.id, 'id', result.data.id);
}
pandora.updateItemContext();
pandora.$ui.browser.value(result.data.id, key, result.data[key]);
pandora.$ui.itemTitle
.options({
title: '<b>' + result.data.title
+ (Ox.len(result.data.director)
? ' (' + result.data.director.join(', ') + ')'
: '')
+ (result.data.year ? ' ' + result.data.year : '') + '</b>'
});
//pandora.$ui.contentPanel.replaceElement(0, pandora.$ui.browser = pandora.ui.browser());
}
2014-06-23 10:15:53 +00:00
});
}
}
function formatKey(key, mode) {
var item = Ox.getObjectById(pandora.site.itemKeys, key);
key = Ox._(item ? item.title : key);
mode = mode || 'text';
return mode == 'text'
? '<span style="font-weight: bold">' + Ox.toTitleCase(key) + ':</span> '
: mode == 'description'
? Ox.toTitleCase(key)
: Ox.Element()
.css({marginBottom: '4px', fontWeight: 'bold'})
.html(Ox.toTitleCase(key)
.replace(' Per ', ' per '));
}
function formatLight(str) {
return '<span class="OxLight">' + str + '</span>';
}
function formatLink(key, value, linkValue) {
return (Ox.isArray(value) ? value : [value]).map(function(value) {
return key
2018-03-08 08:19:27 +00:00
? '<a href="/' + key + '=' + pandora.escapeQueryValue(linkValue ? linkValue : value) + '">' + value + '</a>'
2014-06-23 10:15:53 +00:00
: value;
}).join(', ');
}
function formatValue(key, value) {
var ret;
if (key == 'date') {
ret = value ? Ox.formatDate(value,
['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length]
) : '';
} else if (listKeys.indexOf(key) > -1) {
ret = value.split(', ');
} else {
ret = value;
}
if (nameKeys.indexOf(key) > -1) {
key = 'name';
}
return formatLink(key, ret, key == 'date' && value);
}
function getRightsLevelElement(rightsLevel) {
return Ox.Theme.formatColorLevel(
rightsLevel,
pandora.site.rightsLevels.map(function(rightsLevel) {
return rightsLevel.name;
})
);
}
function getValue(key, value) {
return !value ? ''
2018-06-02 16:07:45 +00:00
: Ox.contains(listKeys, key) && Ox.isArray(value) ? value.join(', ')
2014-06-23 10:15:53 +00:00
: value;
}
function renderCapabilities(rightsLevel) {
var capabilities = [].concat(
canEdit ? [{name: 'canSeeItem', symbol: 'Find'}] : [],
[
{name: 'canPlayClips', symbol: 'PlayInToOut'},
{name: 'canPlayVideo', symbol: 'Play'},
{name: 'canDownloadVideo', symbol: 'Download'}
]
),
userLevels = canEdit ? pandora.site.userLevels : [pandora.user.level];
$capabilities.empty();
userLevels.forEach(function(userLevel, i) {
var $element,
$line = $('<div>')
.css({
height: '16px',
marginBottom: '4px'
})
.appendTo($capabilities);
if (canEdit) {
$element = Ox.Theme.formatColorLevel(i, userLevels.map(function(userLevel) {
return Ox.toTitleCase(userLevel);
}), [0, 240]);
Ox.Label({
textAlign: 'center',
title: Ox._(Ox.toTitleCase(userLevel)),
width: 60
})
.addClass('OxColor OxColorGradient')
.css({
float: 'left',
height: '12px',
paddingTop: '2px',
background: $element.css('background'),
fontSize: '8px',
color: $element.css('color')
})
.data({OxColor: $element.data('OxColor')})
.appendTo($line);
}
capabilities.forEach(function(capability) {
var hasCapability = pandora.site.capabilities[capability.name][userLevel] >= rightsLevel,
$element = Ox.Theme.formatColorLevel(hasCapability, ['', '']);
Ox.Button({
tooltip: Ox._('{0} '
+ (hasCapability ? 'can' : 'can\'t') + ' '
+ Ox.toSlashes(capability.name)
.split('/').slice(1).join(' ')
.toLowerCase()
.replace('see item', 'see the item')
.replace('play video', 'play the full video')
.replace('download video', 'download the video'),
[canEdit ? Ox._(Ox.toTitleCase(userLevel)) : Ox._('You')]),
title: capability.symbol,
type: 'image'
})
.addClass('OxColor OxColorGradient')
.css({background: $element.css('background')})
.css('margin' + (canEdit ? 'Left' : 'Right'), '4px')
.data({OxColor: $element.data('OxColor')})
.appendTo($line);
});
if (!canEdit) {
Ox.Button({
title: Ox._('Help'),
tooltip: Ox._('About Rights'),
type: 'image'
})
.css({marginLeft: '52px'})
.bindEvent({
click: function() {
pandora.UI.set({page: 'rights'});
}
})
.appendTo($line);
}
});
}
function renderGroup(keys) {
var $element;
if (canEdit || keys.filter(function(key) {
return data[key];
}).length) {
$element = $('<div>')
.addClass('OxSelectable')
.css(css);
keys.forEach(function(key, i) {
if (canEdit || data[key]) {
if ($element.children().length) {
$('<span>').html('; ').appendTo($element);
}
$('<span>').html(formatKey(key)).appendTo($element);
Ox.EditableContent({
clickLink: pandora.clickLink,
format: function(value) {
return formatValue(key, value);
},
2019-11-15 14:10:35 +00:00
placeholder: formatLight(Ox._( isMixed[key] ? 'mixed' : 'unknown')),
2014-06-23 10:15:53 +00:00
tooltip: canEdit ? pandora.getEditTooltip() : '',
value: getValue(key, data[key])
})
.bindEvent({
submit: function(data) {
editMetadata(key, data.value);
}
})
.appendTo($element);
2023-07-27 12:05:22 +00:00
if (isMixed[key] && Ox.contains(listKeys, key)) {
pandora.ui.addRemoveKeyDialog({
ids: ui.listSelection,
key: key,
section: ui.section
}).appendTo($element)
}
2014-06-23 10:15:53 +00:00
}
});
$element.appendTo($text);
}
}
function renderRightsLevel() {
var $rightsLevelElement = getRightsLevelElement(data.rightslevel),
$rightsLevelSelect;
$rightsLevel.empty();
if (canEdit) {
$rightsLevelSelect = Ox.Select({
items: pandora.site.rightsLevels.map(function(rightsLevel, i) {
return {id: i, title: Ox._(rightsLevel.name)};
}),
width: 128,
value: data.rightslevel
})
.addClass('OxColor OxColorGradient')
.css({
marginBottom: '4px',
background: $rightsLevelElement.css('background')
})
.data({OxColor: $rightsLevelElement.data('OxColor')})
.bindEvent({
change: function(event) {
var rightsLevel = event.value;
$rightsLevelElement = getRightsLevelElement(rightsLevel);
$rightsLevelSelect
.css({background: $rightsLevelElement.css('background')})
.data({OxColor: $rightsLevelElement.data('OxColor')})
renderCapabilities(rightsLevel);
2019-11-15 14:10:35 +00:00
var edit = {
id: isMultiple ? ui.listSelection : data.id,
rightslevel: rightsLevel
};
pandora.api.edit(edit, function(result) {
that.triggerEvent('change', Ox.extend({}, 'rightslevel', rightsLevel));
2014-06-23 10:15:53 +00:00
});
}
})
.appendTo($rightsLevel);
} else {
$rightsLevelElement
.css({
marginBottom: '4px'
})
.appendTo($rightsLevel);
}
$capabilities = $('<div>').appendTo($rightsLevel);
renderCapabilities(data.rightslevel);
}
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,
borderRadius = ui.icons == 'posters' ? 0 : iconSize / 8;
$icon.animate({
left: margin + iconLeft + 'px',
width: iconWidth + 'px',
height: iconHeight + 'px',
borderRadius: borderRadius + 'px'
}, 250);
$reflection.animate({
top: margin + iconHeight + 'px',
width: iconSize + 'px',
height: iconSize / 2 + 'px'
}, 250);
$reflectionIcon.animate({
left: iconLeft + 'px',
width: iconWidth + 'px',
height: iconHeight + 'px',
borderRadius: borderRadius + 'px'
}, 250);
$reflectionGradient.animate({
width: iconSize + 'px',
height: iconSize / 2 + 'px'
}, 250);
$data.animate({
top: margin + iconHeight + margin + 'px',
width: iconSize + 'px',
}, 250);
$text.animate({
left: margin + (iconSize == 256 ? 256 : iconWidth) + margin + 'px',
}, 250);
pandora.UI.set({infoIconSize: iconSize});
}
that.reload = function() {
var src = pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ? 'poster' : 'icon'
) + '512.jpg?' + Ox.uid());
$icon.attr({src: src});
$reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256;
iconRatio = ui.icons == 'posters'
? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1;
toggleIconSize();
};
that.bindEvent({
2014-10-20 17:36:02 +00:00
mousedown: function() {
setTimeout(function() {
!Ox.Focus.focusedElementIsInput() && that.gainFocus();
});
},
2014-06-23 10:15:53 +00:00
pandora_icons: that.reload,
pandora_showsiteposters: function() {
ui.icons == 'posters' && that.reload();
}
});
return that;
};