mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.6 KiB
63 lines
1.6 KiB
3 years ago
|
<template>
|
||
|
<div class="px-2">
|
||
3 years ago
|
<v-chip x-small> Clicks : {{ clickCount }} </v-chip>
|
||
|
<v-chip x-small> Keystrokes : {{ keystrokeCount }} </v-chip>
|
||
3 years ago
|
<v-chip x-small>
|
||
3 years ago
|
{{ (timer / 1000).toFixed(1) }}
|
||
3 years ago
|
</v-chip>
|
||
3 years ago
|
<v-icon v-if="!pause" small @click="pause = true"> mdi-pause-circle-outline </v-icon>
|
||
|
<v-icon v-else small @click="pause = false"> mdi-play-circle-outline </v-icon>
|
||
|
<v-icon small @click="reset"> mdi-close-circle-outline </v-icon>
|
||
3 years ago
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
name: 'BetterUX',
|
||
|
data() {
|
||
|
return {
|
||
|
pause: false,
|
||
|
clickCount: 0,
|
||
|
keystrokeCount: 0,
|
||
|
timer: 0,
|
||
3 years ago
|
interval: null,
|
||
|
};
|
||
3 years ago
|
},
|
||
|
created() {
|
||
3 years ago
|
this.interval = setInterval(() => {
|
||
|
if (!this.pause) {
|
||
|
this.timer += 100;
|
||
|
}
|
||
|
}, 100);
|
||
|
document.addEventListener('click', this.onClick, true);
|
||
|
document.addEventListener('contextmenu', this.onClick, true);
|
||
|
document.addEventListener('keypress', this.onKeypress, true);
|
||
3 years ago
|
},
|
||
|
beforeDestroy() {
|
||
3 years ago
|
clearInterval(this.interval);
|
||
|
document.removeEventListener('click', this.onClick, true);
|
||
|
document.removeEventListener('contextmenu', this.onClick, true);
|
||
|
document.removeEventListener('keypress', this.onKeypress, true);
|
||
3 years ago
|
},
|
||
|
methods: {
|
||
|
reset() {
|
||
3 years ago
|
this.clickCount = 0;
|
||
|
this.keystrokeCount = 0;
|
||
|
this.timer = 0;
|
||
3 years ago
|
},
|
||
|
onClick() {
|
||
|
if (!this.pause) {
|
||
3 years ago
|
this.clickCount++;
|
||
3 years ago
|
}
|
||
|
},
|
||
|
onKeypress() {
|
||
|
if (!this.pause) {
|
||
3 years ago
|
this.keystrokeCount++;
|
||
3 years ago
|
}
|
||
3 years ago
|
},
|
||
|
},
|
||
|
};
|
||
3 years ago
|
</script>
|
||
|
|
||
3 years ago
|
<style scoped></style>
|