forked from cory/tildefriends
		
	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:
		| @@ -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} | ||||
| 		`; | ||||
| 	} | ||||
|   | ||||
| @@ -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:')) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user