variable scope, add ;

This commit is contained in:
j 2012-02-11 17:57:58 +05:30
parent 4857b65268
commit 793429c66c

View file

@ -11,6 +11,7 @@ pandora.ui.infoView = function(data) {
MozUserSelect: 'text', MozUserSelect: 'text',
WebkitUserSelect: 'text' WebkitUserSelect: 'text'
}, },
html,
iconRatio = ui.icons == 'posters' ? data.posterRatio : 1, iconRatio = ui.icons == 'posters' ? data.posterRatio : 1,
iconSize = ui.infoIconSize, iconSize = ui.infoIconSize,
iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio), iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio),
@ -23,6 +24,7 @@ pandora.ui.infoView = function(data) {
that = Ox.Element(), that = Ox.Element(),
$div,
$list, $list,
$info = Ox.Element() $info = Ox.Element()
@ -138,7 +140,7 @@ pandora.ui.infoView = function(data) {
var count = 0; var count = 0;
['source', 'project'].forEach(function(key) { ['source', 'project'].forEach(function(key) {
var $div = $('<div>').appendTo($data) $div = $('<div>').appendTo($data);
if (canEdit || data[key]) { if (canEdit || data[key]) {
count && $('<br>').appendTo($div); count && $('<br>').appendTo($div);
$('<div>') $('<div>')
@ -232,7 +234,7 @@ pandora.ui.infoView = function(data) {
// Location, Date, Language and Duration ----------------------------------- // Location, Date, Language and Duration -----------------------------------
if (canEdit) { if (canEdit) {
var $div = $('<div>').css(css).css({marginTop: '12px'}).appendTo($center); $div = $('<div>').css(css).css({marginTop: '12px'}).appendTo($center);
['location', 'date', 'language', 'duration'].forEach(function(key, i) { ['location', 'date', 'language', 'duration'].forEach(function(key, i) {
i && $('<div>').css({float: 'left'}).html(';&nbsp;').appendTo($div); i && $('<div>').css({float: 'left'}).html(';&nbsp;').appendTo($div);
$('<div>') $('<div>')
@ -262,7 +264,7 @@ pandora.ui.infoView = function(data) {
}); });
$('<br>').appendTo($center); $('<br>').appendTo($center);
} else if (data.location || data.date || data.language) { } else if (data.location || data.date || data.language) {
var html = []; html = [];
['location', 'date', 'language'].forEach(function(key) { ['location', 'date', 'language'].forEach(function(key) {
if (data[key]) { if (data[key]) {
html.push( html.push(
@ -277,7 +279,7 @@ pandora.ui.infoView = function(data) {
// Director, Cinematographer and Featuring --------------------------------- // Director, Cinematographer and Featuring ---------------------------------
if (canEdit) { if (canEdit) {
var $div = $('<div>').css(css).css('clear', 'both').appendTo($center); $div = $('<div>').css(css).css('clear', 'both').appendTo($center);
['director', 'cinematographer', 'featuring'].forEach(function(key, i) { ['director', 'cinematographer', 'featuring'].forEach(function(key, i) {
i && $('<div>').css({float: 'left'}).html(';&nbsp;').appendTo($div); i && $('<div>').css({float: 'left'}).html(';&nbsp;').appendTo($div);
$('<div>') $('<div>')
@ -287,7 +289,7 @@ pandora.ui.infoView = function(data) {
Ox.Editable({ Ox.Editable({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
format: function(value) { format: function(value) {
return formatValue(value.split(', '), 'name') return formatValue(value.split(', '), 'name');
}, },
placeholder: formatLight('unknown'), placeholder: formatLight('unknown'),
tooltip: 'Doubleclick to edit', tooltip: 'Doubleclick to edit',
@ -305,7 +307,7 @@ pandora.ui.infoView = function(data) {
}); });
$('<br>').appendTo($center); $('<br>').appendTo($center);
} else if (data.director || data.cinematographer || data.featuring) { } else if (data.director || data.cinematographer || data.featuring) {
var html = []; html = [];
['director', 'cinematographer', 'featuring'].forEach(function(key) { ['director', 'cinematographer', 'featuring'].forEach(function(key) {
if (data[key] && data[key].length) { if (data[key] && data[key].length) {
html.push( html.push(
@ -320,8 +322,8 @@ pandora.ui.infoView = function(data) {
// Topic ------------------------------------------------------------------- // Topic -------------------------------------------------------------------
if (canEdit) { if (canEdit) {
var $div = $('<div>').css(css).css('clear', 'both').appendTo($center), var key = 'topic';
key = 'topic'; $div = $('<div>').css(css).css('clear', 'both').appendTo($center);
$('<div>') $('<div>')
.css({float: 'left'}) .css({float: 'left'})
.html(formatKey('Topics').replace('</span>', '&nbsp;</span>')) .html(formatKey('Topics').replace('</span>', '&nbsp;</span>'))
@ -329,7 +331,7 @@ pandora.ui.infoView = function(data) {
Ox.Editable({ Ox.Editable({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
format: function(value) { format: function(value) {
return formatValue(value.split(', '), key) return formatValue(value.split(', '), key);
}, },
placeholder: formatLight('unknown'), placeholder: formatLight('unknown'),
tooltip: 'Doubleclick to edit', tooltip: 'Doubleclick to edit',
@ -347,7 +349,7 @@ pandora.ui.infoView = function(data) {
$('<br>').appendTo($center); $('<br>').appendTo($center);
} else if (data.topic) { } else if (data.topic) {
var html = formatKey('topics') + formatValue(data.topic, 'topic'); html = formatKey('topics') + formatValue(data.topic, 'topic');
$('<div>').css(css).html(html).appendTo($center); $('<div>').css(css).html(html).appendTo($center);
} }
@ -424,6 +426,7 @@ pandora.ui.infoView = function(data) {
} }
}) })
.appendTo($div); .appendTo($div);
$div.append('; ');
['created', 'modified'].forEach(function(key) { ['created', 'modified'].forEach(function(key) {
data[key] && html.push( data[key] && html.push(
formatKey(key == 'modified' ? 'Last Modified' : key) formatKey(key == 'modified' ? 'Last Modified' : key)