diff --git a/app/src/App.vue b/app/src/App.vue index 4325545a..e5e2673a 100644 --- a/app/src/App.vue +++ b/app/src/App.vue @@ -125,17 +125,31 @@ export default { }, mounted () { - // Konamicode ;P - const konamiCode = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a'] - let step = 0 + // Unlock copypasta on log view + const copypastaCode = ['ArrowDown', 'ArrowDown', 'ArrowUp', 'ArrowUp'] + let copypastastep = 0 document.addEventListener('keydown', ({ key }) => { - if (key === konamiCode[step++]) { - if (step === konamiCode.length) { - this.$store.commit('SET_SPINNER', 'nyancat') - step = 0 + if (key === copypastaCode[copypastastep++]) { + if (copypastastep === copypastaCode.length) { + document.getElementsByClassName("unselectable").forEach((element) => element.classList.remove("unselectable")) + copypastastep = 0 } } 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 } }) diff --git a/app/src/i18n/locales/en.json b/app/src/i18n/locales/en.json index e34ebfd8..a312bbd5 100644 --- a/app/src/i18n/locales/en.json +++ b/app/src/i18n/locales/en.json @@ -466,6 +466,7 @@ "system_upgrade_all_applications_btn": "Upgrade all applications", "system_upgrade_all_packages_btn": "Upgrade all packages", "tcp": "TCP", + "text_selection_is_disabled": "Text selection is disabled. If you want to share this log, please share the *full* log with the 'Share with Yunopaste' button.
Or if you really really want to select text, press these keys: ↓↓↑↑.", "tip_about_user_email": "Users are created with an associated email address (and XMPP account) with the format username@domain.tld. Additional email aliases and email forwards can later be added by the admin and the user.", "tools": "Tools", "tools_adminpw": "Change administration password", diff --git a/app/src/scss/main.scss b/app/src/scss/main.scss index 566d0b6a..b87594cb 100644 --- a/app/src/scss/main.scss +++ b/app/src/scss/main.scss @@ -175,3 +175,11 @@ code { background-color: $light; overflow: auto; } + +.unselectable { + -webkit-user-select: none; + -webkit-touch-callout: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} diff --git a/app/src/views/tool/ToolLog.vue b/app/src/views/tool/ToolLog.vue index 7ca3ba4f..743f1e15 100644 --- a/app/src/views/tool/ToolLog.vue +++ b/app/src/views/tool/ToolLog.vue @@ -50,12 +50,15 @@ {{ $t('logs_more') }} -
- +
{{ $t('logs_share_with_yunopaste') }} + + +

+