Expandable image mentions. Do a faster fts validation at startup. Hide the news test button.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3983 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-09-14 23:49:25 +00:00
parent 88592886ca
commit d216d96144
4 changed files with 32 additions and 4 deletions

View File

@ -291,7 +291,7 @@ class TfElement extends LitElement {
return html`
${id_picker}
${tabs}
<input type="button" value="Fake News" @click=${this.add_fake_news}></input>
<!-- <input type="button" value="Fake News" @click=${this.add_fake_news}></input> -->
${contents}
`;
}

View File

@ -73,11 +73,39 @@ class TfMessageElement extends LitElement {
emojis.picker(x => this.vote(x));
}
show_image(link) {
let div = document.createElement('div');
div.style.left = 0;
div.style.top = 0;
div.style.width = '100%';
div.style.height = '100%';
div.style.position = 'fixed';
div.style.background = '#000';
div.style.zIndex = 100;
div.style.display = 'grid';
let img = document.createElement('img');
img.src = link;
img.style.maxWidth = '100%';
img.style.maxHeight = '100%';
img.style.display = 'block';
img.style.margin = 'auto';
img.style.objectFit = 'contain';
img.style.width = '100%';
div.appendChild(img);
function image_close(event) {
document.body.removeChild(div);
window.removeEventListener('keydown', image_close);
}
div.onclick = image_close;
window.addEventListener('keydown', image_close);
document.body.appendChild(div);
}
render_mention(mention) {
if (mention.link?.startsWith('&') &&
mention.type?.startsWith('image/')) {
return html`
<img src=${'/' + mention.link + '/view'} style="max-width: 128px; max-height: 128px" title=${mention.name}>
<img src=${'/' + mention.link + '/view'} style="max-width: 128px; max-height: 128px" title=${mention.name} @click=${() => this.show_image('/' + mention.link + '/view')}>
`;
} else if (mention.link?.startsWith('&') &&
mention.name?.startsWith('audio:')) {