commit
f152a3dc6f
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "sengi",
|
"name": "sengi",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"main": "main-electron.js",
|
"main": "main-electron.js",
|
||||||
"description": "A multi-account desktop client for Mastodon and Pleroma",
|
"description": "A multi-account desktop client for Mastodon and Pleroma",
|
||||||
|
|
|
@ -150,7 +150,8 @@
|
||||||
min-height: 80px;
|
min-height: 80px;
|
||||||
display: block;
|
display: block;
|
||||||
margin: 0 10px 0 $avatar-column-space;
|
margin: 0 10px 0 $avatar-column-space;
|
||||||
padding: 3px 5px 12px 5px;
|
padding: 3px 5px 14px 5px;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
@ -100,54 +100,20 @@ export class StatusComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// private checkContentWarning(status: Status) {
|
|
||||||
// let cwPolicy = this.toolsService.getSettings().contentWarningPolicy;
|
|
||||||
|
|
||||||
// let splittedContent = [];
|
|
||||||
// if ((cwPolicy.policy === ContentWarningPolicyEnum.HideAll && cwPolicy.addCwOnContent.length > 0)
|
|
||||||
// || (cwPolicy.policy === ContentWarningPolicyEnum.AddOnAllContent && cwPolicy.removeCwOnContent.length > 0)
|
|
||||||
// || (cwPolicy.hideCompletlyContent && cwPolicy.hideCompletlyContent.length > 0)) {
|
|
||||||
// let parser = new DOMParser();
|
|
||||||
// let dom = parser.parseFromString((status.content + ' ' + status.spoiler_text).replace("<br/>", " ").replace("<br>", " ").replace(/\n/g, ' '), 'text/html')
|
|
||||||
// let contentToParse = dom.body.textContent;
|
|
||||||
// splittedContent = contentToParse.toLowerCase().split(' ');
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (cwPolicy.policy === ContentWarningPolicyEnum.None && (status.sensitive || status.spoiler_text)) {
|
|
||||||
// this.setContentWarning(status);
|
|
||||||
// } else if (cwPolicy.policy === ContentWarningPolicyEnum.HideAll) {
|
|
||||||
// let detected = cwPolicy.addCwOnContent.filter(x => splittedContent.find(y => y == x || y == `#${x}`));
|
|
||||||
// if (!detected || detected.length === 0) {
|
|
||||||
// this.status.sensitive = false;
|
|
||||||
// } else {
|
|
||||||
// if (!status.spoiler_text) {
|
|
||||||
// status.spoiler_text = detected.join(' ');
|
|
||||||
// }
|
|
||||||
// this.setContentWarning(status);
|
|
||||||
// }
|
|
||||||
// } else if (cwPolicy.policy === ContentWarningPolicyEnum.AddOnAllContent) {
|
|
||||||
// let detected = cwPolicy.removeCwOnContent.filter(x => splittedContent.find(y => y == x || y == `#${x}`));
|
|
||||||
|
|
||||||
// if (detected && detected.length > 0) {
|
|
||||||
// this.status.sensitive = false;
|
|
||||||
// } else {
|
|
||||||
// this.setContentWarning(status);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (cwPolicy.hideCompletlyContent && cwPolicy.hideCompletlyContent.length > 0) {
|
|
||||||
// let detected = cwPolicy.hideCompletlyContent.filter(x => splittedContent.find(y => y == x || y == `#${x}`));
|
|
||||||
// if (detected && detected.length > 0) {
|
|
||||||
// this.hideStatus = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
private setContentWarning(status: StatusWrapper) {
|
private setContentWarning(status: StatusWrapper) {
|
||||||
this.hideStatus = status.hide;
|
this.hideStatus = status.hide;
|
||||||
this.isContentWarned = status.applyCw;
|
this.isContentWarned = status.applyCw;
|
||||||
this.contentWarningText = this.emojiConverter.applyEmojis(this.displayedStatus.emojis, status.status.spoiler_text, EmojiTypeEnum.medium);
|
|
||||||
|
let spoiler = this.htmlEncode(status.status.spoiler_text);
|
||||||
|
this.contentWarningText = this.emojiConverter.applyEmojis(this.displayedStatus.emojis, spoiler, EmojiTypeEnum.medium);
|
||||||
|
}
|
||||||
|
|
||||||
|
private htmlEncode(str: string): string {
|
||||||
|
var encodedStr = str.replace(/[\u00A0-\u9999<>\&]/gim, function (i) {
|
||||||
|
return '&#' + i.charCodeAt(0) + ';';
|
||||||
|
});
|
||||||
|
return encodedStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeContentWarning(): boolean {
|
removeContentWarning(): boolean {
|
||||||
|
|
Loading…
Reference in New Issue