This commit is contained in:
Araxeus
2021-04-17 20:43:48 +03:00
parent 341a06aae7
commit 3f50ab7cfc
3 changed files with 7 additions and 22 deletions

View File

@ -48,5 +48,5 @@ body {
.minus, .minus,
.plus { .plus {
background:rgb(0, 0, 0); background: rgb(0, 0, 0);
} }

View File

@ -80,13 +80,9 @@ select#data {
} }
/* Counter mode css */ /* Counter mode css */
span { span {
cursor: pointer; cursor: pointer;
} }
.number {
margin: 100px;
}
.minus, .minus,
.plus { .plus {
user-select: none; user-select: none;
@ -100,13 +96,3 @@ span {
vertical-align: middle; vertical-align: middle;
text-align: center; text-align: center;
} }
.inputt {
height: 34px;
width: 100px;
text-align: center;
font-size: 26px;
border: 1px solid #ddd;
border-radius: 4px;
display: inline-block;
vertical-align: middle;
}

View File

@ -1,12 +1,12 @@
const fs = require("fs"); const fs = require("fs");
const {ipcRenderer} = require("electron"); const { ipcRenderer } = require("electron");
let promptId = null; let promptId = null;
let promptOptions = null; let promptOptions = null;
function $(selector) {return document.querySelector(selector)} function $(selector) { return document.querySelector(selector) }
document.addEventListener( 'DOMContentLoaded', promptRegister); document.addEventListener('DOMContentLoaded', promptRegister);
function promptRegister() { function promptRegister() {
//get custom session id //get custom session id
@ -71,7 +71,6 @@ function promptRegister() {
return promptError(`Unhandled input type '${promptOptions.type}'`); return promptError(`Unhandled input type '${promptOptions.type}'`);
} }
if (promptOptions.type === "counter") { if (promptOptions.type === "counter") {
dataElement.classList.add("input");
dataElement.style.width = "unset"; dataElement.style.width = "unset";
dataElement.style["text-align"] = "center"; dataElement.style["text-align"] = "center";
//dataElement.style["min-height"] = "1.5em"; //dataElement.style["min-height"] = "1.5em";
@ -215,7 +214,7 @@ function createMinus(dataElement) {
minus.textContent = "-"; minus.textContent = "-";
minus.classList.add("minus"); minus.classList.add("minus");
minus.onmousedown = () => { minus.onmousedown = () => {
dataElement.value = validateCounterInput(parseInt(dataElement.value) - 1); dataElement.value = validateCounterInput(parseInt(dataElement.value) - 1);
}; };
return minus; return minus;
} }
@ -233,7 +232,7 @@ function createPlus(dataElement) {
//validate counter //validate counter
function validateCounterInput(input) { function validateCounterInput(input) {
const min = promptOptions.counterOptions?.minimum, const min = promptOptions.counterOptions?.minimum,
max = promptOptions.counterOptions?.maximum; max = promptOptions.counterOptions?.maximum;
if (min !== undefined && input < min) { if (min !== undefined && input < min) {
return min; return min;
} }