refactoring

This commit is contained in:
Devaev Maxim 2018-10-06 03:23:03 +03:00
parent 576ed9e18e
commit f3478dc241
4 changed files with 21 additions and 21 deletions

View File

@ -1,4 +1,4 @@
textarea#pak-text { textarea#hid-pak-text {
display: block; display: block;
resize: none; resize: none;
width: 100%; width: 100%;
@ -10,12 +10,12 @@ textarea#pak-text {
-webkit-appearance:none; -webkit-appearance:none;
} }
textarea#pak-text::-moz-placeholder { textarea#hid-pak-text::-moz-placeholder {
line-height: 40px; line-height: 40px;
text-align: center; text-align: center;
} }
textarea#pak-text::-webkit-input-placeholder { textarea#hid-pak-text::-webkit-input-placeholder {
line-height: 40px; line-height: 40px;
text-align: center; text-align: center;
} }

View File

@ -37,7 +37,7 @@ img.led-hdd-busy {
} }
img.led-msd-writing, img.led-msd-writing,
img.led-pak-typing { img.led-hid-pak-typing {
-webkit-filter: var(--led-filter-yellow); -webkit-filter: var(--led-filter-yellow);
filter: var(--led-filter-yellow); filter: var(--led-filter-yellow);
-webkit-animation: var(--led-spin-fast); -webkit-animation: var(--led-spin-fast);

View File

@ -15,7 +15,7 @@
<link rel="stylesheet" href="css/modals.css"> <link rel="stylesheet" href="css/modals.css">
<link rel="stylesheet" href="css/leds.css"> <link rel="stylesheet" href="css/leds.css">
<link rel="stylesheet" href="css/stream.css"> <link rel="stylesheet" href="css/stream.css">
<link rel="stylesheet" href="css/shortcuts.css"> <link rel="stylesheet" href="css/hid.css">
<link rel="stylesheet" href="css/msd.css"> <link rel="stylesheet" href="css/msd.css">
<link rel="stylesheet" href="css/keyboard.css"> <link rel="stylesheet" href="css/keyboard.css">
<link rel="stylesheet" href="css/about.css"> <link rel="stylesheet" href="css/about.css">
@ -218,14 +218,14 @@
<li class="ctl-right-actions"> <li class="ctl-right-actions">
<div class="ctl-dropdown"> <div class="ctl-dropdown">
<a class="ctl-item" href="#"> <a class="ctl-item" href="#">
<img data-dont-hide-menu id="pak-led" class="led-off" src="svg/gear-led.svg" /> <img data-dont-hide-menu id="hid-pak-led" class="led-off" src="svg/gear-led.svg" />
Shortcuts &#8628; Shortcuts &#8628;
</a> </a>
<div class="ctl-dropdown-content"> <div class="ctl-dropdown-content">
<div class="ctl-dropdown-content-buttons"> <div class="ctl-dropdown-content-buttons">
<textarea data-dont-hide-menu id="pak-text" placeholder="Paste your text here"></textarea> <textarea data-dont-hide-menu id="hid-pak-text" placeholder="Paste your text here"></textarea>
<hr> <hr>
<button disabled id="pak-button">&bull; &uarr; Paste-as-Keys <sup><i>ascii-only</i></sup></button> <button disabled id="hid-pak-button">&bull; &uarr; Paste-as-Keys <sup><i>ascii-only</i></sup></button>
<hr> <hr>
<div class="buttons-row"> <div class="buttons-row">
<button data-shortcut="CapsLock" class="row50">&bull; CapsLock</button> <button data-shortcut="CapsLock" class="row50">&bull; CapsLock</button>

View File

@ -42,7 +42,7 @@ function Hid() {
window.onblur = __releaseAll; window.onblur = __releaseAll;
__chars_to_codes = __buildCharsToCodes(); __chars_to_codes = __buildCharsToCodes();
tools.setOnClick($("pak-button"), __clickPasteAsKeysButton); tools.setOnClick($("hid-pak-button"), __clickPasteAsKeysButton);
tools.setOnClick($("hid-reset-button"), __clickResetButton); tools.setOnClick($("hid-reset-button"), __clickResetButton);
@ -57,7 +57,7 @@ function Hid() {
__ws = ws; __ws = ws;
__keyboard.setSocket(ws); __keyboard.setSocket(ws);
__mouse.setSocket(ws); __mouse.setSocket(ws);
$("pak-text").disabled = $("pak-button").disabled = $("hid-reset-button").disabled = !ws; $("hid-pak-text").disabled = $("hid-pak-button").disabled = $("hid-reset-button").disabled = !ws;
}; };
var __releaseAll = function() { var __releaseAll = function() {
@ -130,7 +130,7 @@ function Hid() {
}; };
var __clickPasteAsKeysButton = function() { var __clickPasteAsKeysButton = function() {
var text = $("pak-text").value.replace(/[^\x00-\x7F]/g, ""); // eslint-disable-line no-control-regex var text = $("hid-pak-text").value.replace(/[^\x00-\x7F]/g, ""); // eslint-disable-line no-control-regex
if (text) { if (text) {
var clipboard_codes = []; var clipboard_codes = [];
var codes_count = 0; var codes_count = 0;
@ -151,10 +151,10 @@ function Hid() {
ui.confirm(confirm_msg).then(function(ok) { ui.confirm(confirm_msg).then(function(ok) {
if (ok) { if (ok) {
$("pak-text").disabled = true; $("hid-pak-text").disabled = true;
$("pak-button").disabled = true; $("hid-pak-button").disabled = true;
$("pak-led").className = "led-pak-typing"; $("hid-pak-led").className = "led-hid-pak-typing";
$("pak-led").title = "Autotyping..."; $("hid-pak-led").title = "Autotyping...";
tools.debug("Paste-as-keys:", text); tools.debug("Paste-as-keys:", text);
@ -165,17 +165,17 @@ function Hid() {
if (index < clipboard_codes.length && __ws) { if (index < clipboard_codes.length && __ws) {
iterate(); iterate();
} else { } else {
$("pak-text").value = ""; $("hid-pak-text").value = "";
$("pak-text").disabled = false; $("hid-pak-text").disabled = false;
$("pak-button").disabled = false; $("hid-pak-button").disabled = false;
$("pak-led").className = "led-off"; $("hid-pak-led").className = "led-off";
$("pak-led").title = ""; $("hid-pak-led").title = "";
} }
}); });
}; };
iterate(); iterate();
} else { } else {
$("pak-text").value = ""; $("hid-pak-text").value = "";
} }
}); });
} }