Archived
2
0

fix client linter

This commit is contained in:
m1k1o 2021-02-13 12:05:59 +01:00
parent b8b43d69b0
commit c2e57cf51a
2 changed files with 35 additions and 27 deletions

View File

@ -2,13 +2,16 @@
<!-- <!--
<img :src="`https://ui-avatars.com/api/?name=${seed}&size=${size}`" /> <img :src="`https://ui-avatars.com/api/?name=${seed}&size=${size}`" />
--> -->
<div class="avatar" :style="{ <div
width: size + 'px', class="avatar"
height: size + 'px', :style="{
lineHeight: size + 'px', width: size + 'px',
fontSize: (size/2) + 'px', height: size + 'px',
backgroundColor: Background(seed), lineHeight: size + 'px',
}"> fontSize: size / 2 + 'px',
backgroundColor: Background(seed),
}"
>
{{ seed.substring(0, 2).toUpperCase() }} {{ seed.substring(0, 2).toUpperCase() }}
</div> </div>
</template> </template>
@ -32,21 +35,24 @@
name: 'neko-avatar', name: 'neko-avatar',
}) })
export default class extends Vue { export default class extends Vue {
@Prop(String) readonly seed: string | undefined; @Prop(String) readonly seed: string | undefined
@Prop(Number) readonly size: number | undefined; @Prop(Number) readonly size: number | undefined
Background(seed: string) { Background(seed: string) {
let a = 0, b = 0, c = 0; let a = 0,
for(let i = 0; i < seed.length; i++) { b = 0,
a += seed.charCodeAt(i) * 3; c = 0
b += seed.charCodeAt(i) * 5;
c += seed.charCodeAt(i) * 7; for (let i = 0; i < seed.length; i++) {
a += seed.charCodeAt(i) * 3
b += seed.charCodeAt(i) * 5
c += seed.charCodeAt(i) * 7
} }
let x = Math.floor(128 + (a % 128)); let x = Math.floor(128 + (a % 128))
let y = Math.floor(128 + (b % 128)); let y = Math.floor(128 + (b % 128))
let z = Math.floor(128 + (c % 128)); let z = Math.floor(128 + (c % 128))
return "rgb(" + x + "," + y + "," + z + ")"; return 'rgb(' + x + ',' + y + ',' + z + ')'
} }
} }
</script> </script>

View File

@ -37,7 +37,9 @@
</li> </li>
</ul> </ul>
<ul v-if="!fullscreen" class="video-menu bottom"> <ul v-if="!fullscreen" class="video-menu bottom">
<li v-if="hosting && (!clipboard_read_available || !clipboard_write_available)"><i @click.stop.prevent="onClipboard" class="fas fa-clipboard"></i></li> <li v-if="hosting && (!clipboard_read_available || !clipboard_write_available)">
<i @click.stop.prevent="onClipboard" class="fas fa-clipboard"></i>
</li>
<li> <li>
<i <i
@click.stop.prevent="requestPictureInPicture" @click.stop.prevent="requestPictureInPicture"
@ -550,11 +552,11 @@
} }
onMouseEnter(e: MouseEvent) { onMouseEnter(e: MouseEvent) {
if(this.hosting) { if (this.hosting) {
this.$accessor.remote.syncKeyboardModifierState({ this.$accessor.remote.syncKeyboardModifierState({
capsLock: e.getModifierState("CapsLock"), capsLock: e.getModifierState('CapsLock'),
numLock: e.getModifierState("NumLock"), numLock: e.getModifierState('NumLock'),
scrollLock: e.getModifierState("ScrollLock"), scrollLock: e.getModifierState('ScrollLock'),
}) })
} }
@ -564,11 +566,11 @@
} }
onMouseLeave(e: MouseEvent) { onMouseLeave(e: MouseEvent) {
if(this.hosting) { if (this.hosting) {
this.$accessor.remote.setKeyboardModifierState({ this.$accessor.remote.setKeyboardModifierState({
capsLock: e.getModifierState("CapsLock"), capsLock: e.getModifierState('CapsLock'),
numLock: e.getModifierState("NumLock"), numLock: e.getModifierState('NumLock'),
scrollLock: e.getModifierState("ScrollLock"), scrollLock: e.getModifierState('ScrollLock'),
}) })
} }