mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
Add missing CW to PostComponent
This commit is contained in:
parent
794cf80c15
commit
d8c7346492
3 changed files with 42 additions and 9 deletions
2
public/js/components.js
vendored
2
public/js/components.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"/js/components.js": "/js/components.js?id=ee54ab3603f4213f2425",
|
||||
"/js/components.js": "/js/components.js?id=b792fd822363d85a4d06",
|
||||
"/js/app.js": "/js/app.js?id=763d01bb175be69c8ad3",
|
||||
"/css/app.css": "/css/app.css?id=986cee6cfca852babf8e",
|
||||
"/js/timeline.js": "/js/timeline.js?id=415bfde862ab8c5b4548",
|
||||
|
|
|
@ -199,7 +199,7 @@ pixelfed.postComponent = {};
|
|||
|
||||
pixelfed.presenter = {
|
||||
show: {
|
||||
image: function(container, media) {
|
||||
image: function(container, media, status) {
|
||||
$('.status-container')
|
||||
.removeClass('orientation-unknown')
|
||||
.addClass('orientation-' + media[0]['orientation']);
|
||||
|
@ -209,10 +209,21 @@ pixelfed.presenter = {
|
|||
el.attr('src', media[0]['url']);
|
||||
el.attr('title', media[0]['description']);
|
||||
wrapper.append(el);
|
||||
container.append(wrapper);
|
||||
if(status.sensitive == true) {
|
||||
let spoilerText = status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media';
|
||||
let cw = $('<details>').addClass('details-animated');
|
||||
let summary = $('<summary>');
|
||||
let text = $('<p>').addClass('mb-0 lead font-weight-bold').text(spoilerText);
|
||||
let direction = $('<p>').addClass('font-weight-light').text('(click to show)');
|
||||
summary.append(text, direction);
|
||||
cw.append(summary, wrapper);
|
||||
container.append(cw);
|
||||
} else {
|
||||
container.append(wrapper);
|
||||
}
|
||||
},
|
||||
|
||||
video: function(container, media) {
|
||||
video: function(container, media, status) {
|
||||
let wrapper = $('<div>');
|
||||
wrapper.addClass('');
|
||||
let el = $('<video>');
|
||||
|
@ -222,7 +233,18 @@ pixelfed.presenter = {
|
|||
el.attr('src', media[0]['url']);
|
||||
el.attr('title', media[0]['description']);
|
||||
wrapper.append(el);
|
||||
container.append(wrapper);
|
||||
if(status.sensitive == true) {
|
||||
let spoilerText = status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media';
|
||||
let cw = $('<details>').addClass('details-animated');
|
||||
let summary = $('<summary>');
|
||||
let text = $('<p>').addClass('mb-0 lead font-weight-bold').text(spoilerText);
|
||||
let direction = $('<p>').addClass('font-weight-light').text('(click to show)');
|
||||
summary.append(text, direction);
|
||||
cw.append(summary, wrapper);
|
||||
container.append(cw);
|
||||
} else {
|
||||
container.append(wrapper);
|
||||
}
|
||||
|
||||
const player = new Plyr(el, {
|
||||
controls: [
|
||||
|
@ -301,7 +323,18 @@ pixelfed.presenter = {
|
|||
inner.append(carouselItem);
|
||||
}
|
||||
wrapper.append(indicators, inner, prev, next);
|
||||
container.append(wrapper);
|
||||
if(status.sensitive == true) {
|
||||
let spoilerText = status.spoiler_text ? status.spoiler_text : 'CW / NSFW / Hidden Media';
|
||||
let cw = $('<details>').addClass('details-animated');
|
||||
let summary = $('<summary>');
|
||||
let text = $('<p>').addClass('mb-0 lead font-weight-bold').text(spoilerText);
|
||||
let direction = $('<p>').addClass('font-weight-light').text('(click to show)');
|
||||
summary.append(text, direction);
|
||||
cw.append(summary, wrapper);
|
||||
container.append(cw);
|
||||
} else {
|
||||
container.append(wrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -495,7 +528,7 @@ export default {
|
|||
switch(template) {
|
||||
case 'image':
|
||||
case 'photo':
|
||||
pixelfed.presenter.show.image(container, media);
|
||||
pixelfed.presenter.show.image(container, media, this.status);
|
||||
break;
|
||||
|
||||
case 'album':
|
||||
|
@ -504,7 +537,7 @@ export default {
|
|||
break;
|
||||
|
||||
case 'video':
|
||||
pixelfed.presenter.show.video(container, media);
|
||||
pixelfed.presenter.show.video(container, media, this.status);
|
||||
break;
|
||||
|
||||
case 'video:album':
|
||||
|
|
Loading…
Add table
Reference in a new issue