| 
									
										
										
										
											2020-10-31 17:21:40 -05:00
										 |  |  | <template> | 
					
						
							|  |  |  | <a | 
					
						
							|  |  |  |   :href="`${Utils.siteDomain}c/${character}`" | 
					
						
							|  |  |  |   target="_blank" | 
					
						
							|  |  |  |   @mouseover.prevent="show()" | 
					
						
							|  |  |  |   @mouseenter.prevent="show()" | 
					
						
							|  |  |  |   @mouseleave.prevent="dismiss()" | 
					
						
							| 
									
										
										
										
											2021-03-25 16:54:10 -05:00
										 |  |  |   @click.middle.prevent.stop="toggleStickyness()" | 
					
						
							| 
									
										
										
										
											2020-10-31 17:21:40 -05:00
										 |  |  |   @click.right.passive="dismiss(true)" | 
					
						
							|  |  |  |   @click.left.passive="dismiss(true)" | 
					
						
							| 
									
										
										
										
											2024-01-26 19:45:59 -08:00
										 |  |  |   ><img :src="getAvatarUrl()" class="character-avatar icon" :title="character" :alt="character" v-once></a> | 
					
						
							| 
									
										
										
										
											2020-10-31 17:21:40 -05:00
										 |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script lang="ts"> | 
					
						
							|  |  |  | import {Component, Hook, Prop} from '@f-list/vue-ts'; | 
					
						
							|  |  |  | import Vue from 'vue'; | 
					
						
							|  |  |  | import { EventBus } from '../chat/preview/event-bus'; | 
					
						
							|  |  |  | import * as Utils from '../site/utils'; | 
					
						
							| 
									
										
										
										
											2024-01-26 19:45:59 -08:00
										 |  |  | import { characterImage } from '../chat/common'; | 
					
						
							| 
									
										
										
										
											2020-10-31 17:21:40 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | @Component | 
					
						
							|  |  |  | export default class IconView extends Vue { | 
					
						
							|  |  |  |     Utils = Utils; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @Prop({required: true}) | 
					
						
							|  |  |  |     readonly character!: string; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @Hook('mounted') | 
					
						
							|  |  |  |     mounted(): void { | 
					
						
							|  |  |  |       // do nothing
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @Hook('beforeDestroy') | 
					
						
							|  |  |  |     beforeDestroy(): void { | 
					
						
							|  |  |  |         this.dismiss(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @Hook('deactivated') | 
					
						
							|  |  |  |     deactivate(): void { | 
					
						
							|  |  |  |         this.dismiss(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     getCharacterUrl(): string { | 
					
						
							|  |  |  |       return `flist-character://${this.character}`; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-26 19:45:59 -08:00
										 |  |  |     getAvatarUrl(): string { | 
					
						
							|  |  |  |       return characterImage(this.character); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-31 17:21:40 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     dismiss(force: boolean = false): void { | 
					
						
							|  |  |  |         // if (!this.preview) {
 | 
					
						
							|  |  |  |         //   return;
 | 
					
						
							|  |  |  |         // }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         EventBus.$emit('imagepreview-dismiss', {url: this.getCharacterUrl(), force}); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     show(): void { | 
					
						
							|  |  |  |         // if (!this.preview) {
 | 
					
						
							|  |  |  |         //   return;
 | 
					
						
							|  |  |  |         // }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         EventBus.$emit('imagepreview-show', {url: this.getCharacterUrl()}); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     toggleStickyness(): void { | 
					
						
							|  |  |  |         // if (!this.preview) {
 | 
					
						
							|  |  |  |         //   return;
 | 
					
						
							|  |  |  |         // }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         EventBus.$emit('imagepreview-toggle-stickyness', {url: this.getCharacterUrl()}); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | </script> |