add and use pandora.site.posters.ratio (fixes #1572)

This commit is contained in:
rolux 2013-07-08 14:40:23 +02:00
parent e6117dfc61
commit 9e6fa2714e
10 changed files with 30 additions and 18 deletions

View file

@ -664,6 +664,9 @@
//{"title": "Movies with Video", "query": {"conditions": [{"key": "canplayvideo", "value": "true", "operator": "="}], "operator": "&"}}, //{"title": "Movies with Video", "query": {"conditions": [{"key": "canplayvideo", "value": "true", "operator": "="}], "operator": "&"}},
//{"title": "Movies with Clips", "query": {"conditions": [{"key": "canplayclips", "value": "true", "operator": "="}], "operator": "&"}} //{"title": "Movies with Clips", "query": {"conditions": [{"key": "canplayclips", "value": "true", "operator": "="}], "operator": "&"}}
], ],
"posters": {
"ratio": 0.625
},
"rightsLevel": {"member": 4, "staff": 3, "admin": 2}, "rightsLevel": {"member": 4, "staff": 3, "admin": 2},
"rightsLevels": [ "rightsLevels": [
{"name": "Public", "color": [128, 255, 128]}, {"name": "Public", "color": [128, 255, 128]},

View file

@ -703,6 +703,9 @@
{"title": "Black & White Films", "query": {"conditions": [{"key": "color", "value": "Black and White", "operator": "=="}], "operator": "&"}}, {"title": "Black & White Films", "query": {"conditions": [{"key": "color", "value": "Black and White", "operator": "=="}], "operator": "&"}},
{"title": "Silent Films", "query": {"conditions": [{"key": "language", "value": "None", "operator": "=="}, {"key": "sound", "value": "Silent", "operator": "=="}], "operator": "|"}} {"title": "Silent Films", "query": {"conditions": [{"key": "language", "value": "None", "operator": "=="}, {"key": "sound", "value": "Silent", "operator": "=="}], "operator": "|"}}
], ],
"posters": {
"ratio": 0.6875
},
"rightsLevel": {"member": 3, "student": 3, "staff": 3, "admin": 3}, "rightsLevel": {"member": 3, "student": 3, "staff": 3, "admin": 3},
"rightsLevels": [ "rightsLevels": [
{"name": "Public", "color": [128, 255, 128]}, {"name": "Public", "color": [128, 255, 128]},

View file

@ -585,6 +585,9 @@
"personalLists": [ "personalLists": [
{"title": "Favorites"} {"title": "Favorites"}
], ],
"posters": {
"ratio": 0.625
},
"rightsLevel": {"member": 2, "staff": 2, "admin": 2}, "rightsLevel": {"member": 2, "staff": 2, "admin": 2},
"rightsLevels": [ "rightsLevels": [
{"name": "Public", "color": [128, 255, 128]}, {"name": "Public", "color": [128, 255, 128]},

View file

@ -504,6 +504,9 @@
"personalLists": [ "personalLists": [
{"title": "Favorites"} {"title": "Favorites"}
], ],
"posters": {
"ratio": 0.625
},
"rightsLevel": {"member": 2, "staff": 2, "admin": 2}, "rightsLevel": {"member": 2, "staff": 2, "admin": 2},
"rightsLevels": [ "rightsLevels": [
{"name": "Public", "color": [128, 255, 128]}, {"name": "Public", "color": [128, 255, 128]},

View file

@ -66,14 +66,14 @@ pandora.ui.browser = function() {
var that = Ox.IconList({ var that = Ox.IconList({
borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 8, borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 8,
centered: true, centered: true,
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1, defaultRatio: pandora.user.ui.icons == 'posters' ? pandora.site.posters.ratio : 1,
draggable: true, draggable: true,
id: 'list', id: 'list',
item: function(data, sort, size) { item: function(data, sort, size) {
size = size || 64; size = size || 64;
var ui = pandora.user.ui, var ui = pandora.user.ui,
ratio = ui.icons == 'posters' ratio = ui.icons == 'posters'
? (ui.showSitePosters ? 5/8 : data.posterRatio) : 1, ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1,
url = '/' + data.id + '/' + ( url = '/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
@ -158,7 +158,7 @@ pandora.ui.browser = function() {
pandora_icons: function(data) { pandora_icons: function(data) {
that.options({ that.options({
borderRadius: data.value == 'posters' ? 0 : 8, borderRadius: data.value == 'posters' ? 0 : 8,
defaultRatio: data.value == 'posters' ? 5/8 : 1 defaultRatio: data.value == 'posters' ? pandora.site.posters.ratio : 1
}).reloadList(); }).reloadList();
}, },
pandora_item: function(data) { pandora_item: function(data) {

View file

@ -16,7 +16,7 @@ pandora.ui.infoView = function(data) {
WebkitUserSelect: 'text' WebkitUserSelect: 'text'
}, },
iconRatio = ui.icons == 'posters' ? ( iconRatio = ui.icons == 'posters' ? (
ui.showSitePosters ? 5/8 : data.posterRatio ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio
) : 1, ) : 1,
iconSize = ui.infoIconSize, iconSize = ui.infoIconSize,
iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio), iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio),
@ -852,7 +852,7 @@ pandora.ui.infoView = function(data) {
return image.selected; return image.selected;
})[0]; })[0];
$list = Ox.IconList({ $list = Ox.IconList({
defaultRatio: ui.icons == 'posters' || !data.stream ? 5/8 : data.stream.aspectratio, defaultRatio: ui.icons == 'posters' || !data.stream ? pandora.site.posters.ratio : data.stream.aspectratio,
fixedRatio: ui.icons == 'posters' || !data.stream ? false : data.stream.aspectratio, fixedRatio: ui.icons == 'posters' || !data.stream ? false : data.stream.aspectratio,
item: function(data, sort, size) { item: function(data, sort, size) {
var ratio = data.width / data.height; var ratio = data.width / data.height;
@ -1059,7 +1059,7 @@ pandora.ui.infoView = function(data) {
$reflectionIcon.attr({src: src}); $reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256; iconSize = iconSize == 256 ? 512 : 256;
iconRatio = ui.icons == 'posters' iconRatio = ui.icons == 'posters'
? (ui.showSitePosters ? 5/8 : data.posterRatio) : 1; ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1;
toggleIconSize(); toggleIconSize();
pandora.user.level == 'admin' && $list.replaceWith($list = renderList()); pandora.user.level == 'admin' && $list.replaceWith($list = renderList());
}; };

View file

@ -13,7 +13,7 @@ pandora.ui.infoView = function(data) {
WebkitUserSelect: 'text' WebkitUserSelect: 'text'
}, },
iconRatio = ui.icons == 'posters' ? ( iconRatio = ui.icons == 'posters' ? (
ui.showSitePosters ? 5/8 : data.posterRatio ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio
) : 1, ) : 1,
iconSize = ui.infoIconSize, iconSize = ui.infoIconSize,
iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio), iconWidth = iconRatio > 1 ? iconSize : Math.round(iconSize * iconRatio),
@ -1030,7 +1030,7 @@ pandora.ui.infoView = function(data) {
$reflectionIcon.attr({src: src}); $reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256; iconSize = iconSize == 256 ? 512 : 256;
iconRatio = ui.icons == 'posters' iconRatio = ui.icons == 'posters'
? (ui.showSitePosters ? 5/8 : data.posterRatio) : 1; ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1;
toggleIconSize(); toggleIconSize();
}; };

View file

@ -641,7 +641,7 @@ pandora.ui.infoView = function(data) {
$reflectionIcon.attr({src: src}); $reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256; iconSize = iconSize == 256 ? 512 : 256;
iconRatio = ui.icons == 'posters' iconRatio = ui.icons == 'posters'
? (ui.showSitePosters ? 5/8 : data.posterRatio) : 1; ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1;
toggleIconSize(); toggleIconSize();
}; };

View file

@ -690,7 +690,7 @@ pandora.ui.infoView = function(data) {
$reflectionIcon.attr({src: src}); $reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256; iconSize = iconSize == 256 ? 512 : 256;
iconRatio = ui.icons == 'posters' iconRatio = ui.icons == 'posters'
? (ui.showSitePosters ? 5/8 : data.posterRatio) : 1; ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1;
toggleIconSize(); toggleIconSize();
}; };

View file

@ -121,13 +121,13 @@ pandora.ui.list = function() {
} else if (view == 'grid') { } else if (view == 'grid') {
that = Ox.IconList({ that = Ox.IconList({
borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16, borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16,
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1, defaultRatio: pandora.user.ui.icons == 'posters' ? pandora.site.posters.ratio : 1,
draggable: true, draggable: true,
id: 'list', id: 'list',
item: function(data, sort, size) { item: function(data, sort, size) {
var ui = pandora.user.ui, var ui = pandora.user.ui,
ratio = ui.icons == 'posters' ratio = ui.icons == 'posters'
? (ui.showSitePosters ? 5/8 : data.posterRatio) : 1, ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1,
url = '/' + data.id + '/' + ( url = '/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
@ -178,14 +178,14 @@ pandora.ui.list = function() {
} else if (view == 'clips') { } else if (view == 'clips') {
that = Ox.InfoList({ that = Ox.InfoList({
borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16, borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16,
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1, defaultRatio: pandora.user.ui.icons == 'posters' ? pandora.site.posters.ratio : 1,
draggable: true, draggable: true,
id: 'list', id: 'list',
item: function(data, sort, size) { item: function(data, sort, size) {
size = 128; size = 128;
var ui = pandora.user.ui, var ui = pandora.user.ui,
ratio = ui.icons == 'posters' ratio = ui.icons == 'posters'
? (ui.showSitePosters ? 5/8 : data.posterRatio) : 1, ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1,
url = '/' + data.id + '/' + ( url = '/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
@ -261,7 +261,7 @@ pandora.ui.list = function() {
} else if (view == 'timelines') { } else if (view == 'timelines') {
that = Ox.InfoList({ that = Ox.InfoList({
borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16, borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16,
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1, defaultRatio: pandora.user.ui.icons == 'posters' ? pandora.site.posters.ratio : 1,
draggable: true, draggable: true,
id: 'list', id: 'list',
item: function(data, sort, size) { item: function(data, sort, size) {
@ -270,7 +270,7 @@ pandora.ui.list = function() {
isClipsQuery = !!clipsQuery.conditions.length, isClipsQuery = !!clipsQuery.conditions.length,
ui = pandora.user.ui, ui = pandora.user.ui,
ratio = ui.icons == 'posters' ratio = ui.icons == 'posters'
? (ui.showSitePosters ? 5/8 : data.posterRatio) : 1, ? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1,
url = '/' + data.id + '/' + ( url = '/' + data.id + '/' + (
ui.icons == 'posters' ui.icons == 'posters'
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon' ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
@ -467,7 +467,7 @@ pandora.ui.list = function() {
) + ( ) + (
item.year ? ' ' + item.year : '' item.year ? ' ' + item.year : ''
), ),
ratio = ui.showSitePosters ? 5/8 : item.posterRatio, ratio = ui.showSitePosters ? pandora.site.posters.ratio : item.posterRatio,
windowWidth = window.innerWidth * 0.8, windowWidth = window.innerWidth * 0.8,
windowHeight = window.innerHeight * 0.8, windowHeight = window.innerHeight * 0.8,
windowRatio = windowWidth / windowHeight, windowRatio = windowWidth / windowHeight,
@ -606,7 +606,7 @@ pandora.ui.list = function() {
} else { } else {
that.options({ that.options({
borderRadius: data.value == 'posters' ? 0 : 16, borderRadius: data.value == 'posters' ? 0 : 16,
defaultRatio: data.value == 'posters' ? 5/8 : 1 defaultRatio: data.value == 'posters' ? pandora.site.posters.ratio : 1
}); });
} }
that.reloadList(true); that.reloadList(true);