add poster script

This commit is contained in:
j 2024-06-02 11:22:15 +01:00
parent 2d5bd3fb23
commit a6b5d8d40e
2 changed files with 96 additions and 8 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
*.pyc
*.swp

View File

@ -122,6 +122,12 @@ pandora.ui.infoView = function(data, isMixed) {
orientation: 'vertical'
});
var $left = Ox.Element()
.css({
position: 'absolute'
})
.appendTo($info);
if (!isMultiple) {
var $icon = Ox.Element({
element: '<img>',
@ -143,7 +149,7 @@ pandora.ui.infoView = function(data, isMixed) {
.bindEvent({
singleclick: toggleIconSize
})
.appendTo($info),
.appendTo($left),
$reflection = $('<div>')
.addClass('OxReflection')
@ -155,7 +161,7 @@ pandora.ui.infoView = function(data, isMixed) {
height: iconSize / 2 + 'px',
overflow: 'hidden'
})
.appendTo($info),
.appendTo($left),
$reflectionIcon = $('<img>')
.attr({
@ -181,6 +187,16 @@ pandora.ui.infoView = function(data, isMixed) {
.appendTo($reflection);
}
var $data = $('<div>')
.addClass('OxTextPage')
.css({
position: 'absolute',
left: margin + 'px',
top: margin + iconHeight + margin + 'px',
width: iconSize + 'px',
})
.appendTo($left)
var $text = Ox.Element()
.addClass('OxTextPage')
.css({
@ -218,6 +234,82 @@ pandora.ui.infoView = function(data, isMixed) {
pandora.createLinks($info);
}
// Show description -----------------------------------------------------
if (!isMultiple) {
;['show'].forEach(key => {
var $box = $('<div>').appendTo($data);
(data[key] ? pandora.api.findEntities : Ox.noop)({
query: {
conditions: [{
key: 'type', operator: '==', value: Ox.decodeHTMLEntities(key)
}, {
key: 'name', operator: '==', value: Ox.decodeHTMLEntities(data[key][0] || '')
}],
operator: '&'
},
keys: ['id', 'name', 'description', 'image']
}, function(result) {
if (data[key] && ((result && result.data.items.length == 1) || canEdit)) {
var entity = {}
if (result && result.data.items.length) {
entity = result.data.items[0]
}
$('<div>')
.html(Ox._('About {0}:', [data[key]]))
.css({
'padding-top': '4px',
'font-weight': 'bold'
})
.appendTo($box);
$('<div>')
.addClass("InlineImages")
.append(
Ox.EditableContent({
clickLink: pandora.clickLink,
editable: false,
placeholder: formatLight(Ox._('No {0} Description', [Ox._(Ox.toTitleCase(key))])),
tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea',
value: entity.description || ''
})
.css(css)
.css({
'text-align': ''
})
.bindEvent({
doubleclick: function(event) {
if (!canEdit) {
return
}
if (entity.id) {
var set = {}
set['entitiesType'] = key
set['entitiesSelection.' + key] = [entity.id];
pandora.UI.set(set);
pandora.$ui.entitiesDialog = pandora.ui.entitiesDialog().open();
} else {
pandora.api.addEntity({
type: key,
name: data[key]
}, function(result) {
var set = {}
set['entitiesType'] = key
set['entitiesSelection.' + key] = [result.data.id];
pandora.UI.set(set);
pandora.$ui.entitiesDialog = pandora.ui.entitiesDialog().open();
})
}
}
})
).css({
margin: '12px 0',
})
.appendTo($box);
}
})
});
}
// Title -------------------------------------------------------------------
$('<div>')
@ -260,16 +352,11 @@ pandora.ui.infoView = function(data, isMixed) {
if (canEdit || data.summary) {
$('<div>')
.addClass("InlineImages")
.append(
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='
);
},
maxHeight: Infinity,
placeholder: formatLight(Ox._( isMixed.summary ? 'Mixed Summary' : 'No Summary')),
tooltip: canEdit ? pandora.getEditTooltip() : '',