mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Make logs unselectable to force people clicking the damn share button >_>
This commit is contained in:
parent
127ceefa02
commit
81b00d3ac7
3 changed files with 39 additions and 10 deletions
|
@ -125,17 +125,31 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted () {
|
mounted () {
|
||||||
// Konamicode ;P
|
// Unlock copypasta on log view
|
||||||
const konamiCode = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a']
|
const copypastaCode = ['ArrowDown', 'ArrowDown', 'ArrowUp', 'ArrowUp']
|
||||||
let step = 0
|
let copypastastep = 0
|
||||||
document.addEventListener('keydown', ({ key }) => {
|
document.addEventListener('keydown', ({ key }) => {
|
||||||
if (key === konamiCode[step++]) {
|
if (key === copypastaCode[copypastastep++]) {
|
||||||
if (step === konamiCode.length) {
|
if (copypastastep === copypastaCode.length) {
|
||||||
this.$store.commit('SET_SPINNER', 'nyancat')
|
document.getElementsByClassName("unselectable").forEach((element) => element.classList.remove("unselectable"))
|
||||||
step = 0
|
copypastastep = 0
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
step = 0
|
copypastastep = 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Konamicode ;P
|
||||||
|
const konamiCode = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a']
|
||||||
|
let konamistep = 0
|
||||||
|
document.addEventListener('keydown', ({ key }) => {
|
||||||
|
if (key === konamiCode[konamistep++]) {
|
||||||
|
if (konamistep === konamiCode.length) {
|
||||||
|
this.$store.commit('SET_SPINNER', 'nyancat')
|
||||||
|
konamistep = 0
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
konamistep = 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -175,3 +175,11 @@ code {
|
||||||
background-color: $light;
|
background-color: $light;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unselectable {
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
|
@ -50,12 +50,19 @@
|
||||||
<icon iname="plus" /> {{ $t('logs_more') }}
|
<icon iname="plus" /> {{ $t('logs_more') }}
|
||||||
</b-button>
|
</b-button>
|
||||||
|
|
||||||
<pre class="log"><code v-html="logs" /></pre>
|
<pre class="log unselectable"><code v-html="logs" /></pre>
|
||||||
|
|
||||||
<b-button @click="shareLogs" variant="success" class="w-100 rounded-0">
|
<b-button @click="shareLogs" variant="success" class="w-100 rounded-0">
|
||||||
<icon iname="cloud-upload" /> {{ $t('logs_share_with_yunopaste') }}
|
<icon iname="cloud-upload" /> {{ $t('logs_share_with_yunopaste') }}
|
||||||
</b-button>
|
</b-button>
|
||||||
</card>
|
</card>
|
||||||
|
|
||||||
|
|
||||||
|
<p class="w-100 px-5 py-2 mb-0">
|
||||||
|
Text selection is disabled. If you want to share this log, please share the *full* log with the 'Share with Yunopaste' button.
|
||||||
|
<br/>
|
||||||
|
<small>Or if you really really want to select text, press these keys: ↓↓↑↑.</small>
|
||||||
|
</p>
|
||||||
|
|
||||||
</view-base>
|
</view-base>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue