final ver

This commit is contained in:
skidoodle 2023-10-30 00:26:28 +01:00
parent 2180538627
commit efd76b27a2
4 changed files with 13 additions and 28 deletions

View file

@ -1,6 +0,0 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}

View file

@ -1,20 +1,18 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="hu"> <html lang="hu">
<head> <head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TAJ Validator</title> <title>TAJ Validator</title>
<script src="script.js" async></script> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="stylesheet" href="style.css" /> <link rel="stylesheet" href="style.css" />
<script async src="script.js"></script>
</head> </head>
<body> <body>
<h1>TAJ Validator</h1> <h1>TAJ Validator</h1>
<form> <form>
<input type="text" id="taj" oninput="restrictInput(this, 'number')" /> <input type="text" id="taj" oninput="restrictInput(this, 'number')" />
<button type="submit" onclick="checkTAJ()">Ellenőrzés</button> <button type="submit" onclick="checkTAJ()">Ellenőrzés</button>
</form> </form>
<p id="result"></p> <p id="result"></p>
</body> </body>
</html> </html>

View file

@ -1,4 +1,3 @@
// Input 0
function restrictInput(a) { function restrictInput(a) {
a.value = a.value.replace(/[^0-9]/g, "").slice(0, 9); a.value = a.value.replace(/[^0-9]/g, "").slice(0, 9);
} }
@ -7,7 +6,7 @@ function validateTAJ(a) {
if (9 != a.length) { if (9 != a.length) {
return !1; return !1;
} }
for (var c = 0, d = "", b = 0; b < a.length; b++) { for (var c = 0, d = '', b = 0; b < a.length; b++) {
7 >= b && (c += 0 == (b + 1) % 2 ? 7 * parseInt(a[b]) : 3 * parseInt(a[b]), d += a[b]); 7 >= b && (c += 0 == (b + 1) % 2 ? 7 * parseInt(a[b]) : 3 * parseInt(a[b]), d += a[b]);
} }
return a == d + c % 10; return a == d + c % 10;
@ -19,5 +18,4 @@ function checkTAJ() {
c.textContent = a ? "A TAJ sz\u00e1m \u00e9rv\u00e9nyes." : "A TAJ sz\u00e1m \u00e9rv\u00e9nytelen."; c.textContent = a ? "A TAJ sz\u00e1m \u00e9rv\u00e9nyes." : "A TAJ sz\u00e1m \u00e9rv\u00e9nytelen.";
c.style.color = a ? "#4CAF50" : "#FF5733"; c.style.color = a ? "#4CAF50" : "#FF5733";
return a; return a;
} };
;

View file

@ -1,35 +1,32 @@
body,
input {
width: 100%;
text-align: center;
}
body { body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
background-color: #121212; background-color: #121212;
color: #338ef7; color: #338ef7;
text-align: center;
font-size: 1.5rem; font-size: 1.5rem;
margin: 10% auto; margin: 10% auto;
width: 100%;
} }
form { form {
max-width: 300px; max-width: 300px;
margin: 0 auto; margin: 0 auto;
} }
input,
label, label {
input {
margin: 10px 0; margin: 10px 0;
color: #338ef7; color: #338ef7;
font-size: 2rem; font-size: 2rem;
} }
input { input {
width: 100%;
padding: 10px; padding: 10px;
border: 1px solid #338ef7; border: 1px solid #338ef7;
border-radius: 5px; border-radius: 5px;
background-color: #333; background-color: #333;
box-sizing: border-box; box-sizing: border-box;
text-align: center;
} }
button { button {
background-color: #338ef7; background-color: #338ef7;
color: #efefef; color: #efefef;
@ -39,14 +36,12 @@ button {
border-radius: 5px; border-radius: 5px;
cursor: pointer; cursor: pointer;
font-size: 1rem; font-size: 1rem;
font-weight: bold; font-weight: 700;
} }
input::-webkit-inner-spin-button { input::-webkit-inner-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
margin: 0; margin: 0;
} }
input[type='number'] { input[type='number'] {
-moz-appearance: textfield; -moz-appearance: textfield;
} }