From 91429437f83fd75e995148fd6317c6147a573e3d Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sun, 26 Dec 2021 14:24:15 +0200 Subject: [PATCH] Users: Make it easier to enter votes vouchers Automatically switch fields and fill all fields on paste --- Web/Presenters/templates/User/Settings.xml | 34 ++++++++++++++++++---- Web/static/js/openvk.cls.js | 18 ++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/Web/Presenters/templates/User/Settings.xml b/Web/Presenters/templates/User/Settings.xml index daa7a0c3..f142a5e3 100644 --- a/Web/Presenters/templates/User/Settings.xml +++ b/Web/Presenters/templates/User/Settings.xml @@ -348,16 +348,40 @@ {elseif $isFinanceTU}

{_voucher_explanation} {_voucher_explanation_ex}

-
- - - - - - - + + - + - + - +

+ {elseif $isInterface} diff --git a/Web/static/js/openvk.cls.js b/Web/static/js/openvk.cls.js index 974a8aca..9d819d6b 100644 --- a/Web/static/js/openvk.cls.js +++ b/Web/static/js/openvk.cls.js @@ -247,3 +247,21 @@ function showCoinsTransferDialog(coinsCount, hash) { Function.noop ]); } + +function chunkSubstr(string, size) { + const numChunks = Math.ceil(string.length / size); + const chunks = new Array(numChunks); + + for (let i = 0, o = 0; i < numChunks; ++i, o += size) { + chunks[i] = string.substr(o, size); + } + + return chunks; +} + +function autoTab(original, next, previous) { + if(original.getAttribute && original.value.length == original.getAttribute("maxlength") && next !== undefined) + next.focus(); + else if(original.value.length == 0 && previous !== undefined) + previous.focus(); +}