Upgrade template to v3
This commit is contained in:
parent
458b88159c
commit
66048b94d2
Binary file not shown.
10
package.json
10
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "debreviator",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.5",
|
||||
"description": "Creates meaning by undoing your abbreviation.",
|
||||
"author": "Florine W. Dekker",
|
||||
"browser": "dist/bundle.js",
|
||||
|
@ -16,15 +16,15 @@
|
|||
"deploy": "grunt deploy"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "^1.4.1",
|
||||
"grunt": "^1.5.3",
|
||||
"grunt-cli": "^1.4.3",
|
||||
"grunt-contrib-clean": "^2.0.0",
|
||||
"grunt-contrib-clean": "^2.0.1",
|
||||
"grunt-contrib-copy": "^1.0.0",
|
||||
"grunt-contrib-watch": "^1.1.0",
|
||||
"grunt-focus": "^1.0.0",
|
||||
"grunt-text-replace": "^0.4.0",
|
||||
"grunt-webpack": "^5.0.0",
|
||||
"webpack": "^5.69.1",
|
||||
"webpack-cli": "^4.9.2"
|
||||
"webpack": "^5.75.0",
|
||||
"webpack-cli": "^5.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,17 +8,24 @@
|
|||
<meta name="description" content="Creates meaning by undoing your abbreviation." />
|
||||
<meta name="theme-color" content="#0033cc" />
|
||||
|
||||
<meta name="fwd:nav:target" content="#nav" />
|
||||
<!-- TODO: Remove from [Experimental] once the tool is mature -->
|
||||
<meta name="fwd:nav:highlight-path" content="/Tools/[Experimental]/Debreviator/" />
|
||||
<meta name="fwd:footer:target" content="#footer" />
|
||||
<meta name="fwd:footer:vcs-url" content="https://git.fwdekker.com/tools/debreviator/" />
|
||||
<meta name="fwd:footer:version" content="v%%VERSION_NUMBER%%" />
|
||||
<meta name="fwd:validation:load-forms" />
|
||||
|
||||
<title>Debreviator | FWDekker</title>
|
||||
|
||||
<link rel="stylesheet" href="https://static.fwdekker.com/fonts/roboto/roboto.css" />
|
||||
<link rel="stylesheet" href="https://static.fwdekker.com/lib/template/2.x.x/template.css" />
|
||||
<link rel="stylesheet" href="https://static.fwdekker.com/lib/template/3.x.x/template.css?v=%%VERSION_NUMBER%%" />
|
||||
<!--suppress HtmlUnknownTarget -->
|
||||
<link rel="stylesheet" href="main.css?v=%%VERSION_NUMBER%%" />
|
||||
<script async src="https://stats.fwdekker.com/count.js"
|
||||
data-goatcounter="https://stats.fwdekker.com/count"></script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<noscript class="fwd-js-notice">
|
||||
<img src="https://stats.fwdekker.com/count?p=/tools/debreviator/" alt="Counting pixel" />
|
||||
|
||||
<p>
|
||||
|
@ -27,35 +34,33 @@
|
|||
instructions on how to enable JavaScript in your web browser</a>.
|
||||
</p>
|
||||
</noscript>
|
||||
<main class="hidden">
|
||||
<div id="nav"></div>
|
||||
<div id="contents">
|
||||
<div id="header"></div>
|
||||
<nav id="nav"></nav>
|
||||
<main class="container hidden">
|
||||
<div role="document">
|
||||
<section>
|
||||
<header class="fwd-header">
|
||||
<hgroup>
|
||||
<h1><a href=".">Debreviator</a></h1>
|
||||
<h2>Creates meaning by undoing your abbreviation.</h2>
|
||||
</hgroup>
|
||||
</header>
|
||||
|
||||
<section class="container">
|
||||
<div class="row">
|
||||
<div class="column">
|
||||
<label for="abbreviation">Abbreviation</label>
|
||||
<input id="abbreviation" type="text" autofocus />
|
||||
<form id="debreviate-form">
|
||||
<label for="abbreviation">Abbreviation</label>
|
||||
<input id="abbreviation" type="text" autofocus />
|
||||
<small id="abbreviation-hint" data-hint-for="abbreviation"></small>
|
||||
|
||||
<button id="debreviate" type="button">Debreviate</button>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<button id="debreviate" type="button">Debreviate</button>
|
||||
</form>
|
||||
|
||||
<div class="row">
|
||||
<div class="column">
|
||||
<label for="debreviations">Debreviations</label>
|
||||
<span id="abbreviation-error"></span>
|
||||
<textarea id="debreviations" readonly></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<label for="debreviations">Debreviations</label>
|
||||
<textarea id="debreviations" readonly></textarea>
|
||||
</section>
|
||||
<footer id="footer"></footer>
|
||||
</div>
|
||||
<div id="footer"></div>
|
||||
</main>
|
||||
|
||||
<script src="https://static.fwdekker.com/lib/template/2.x.x/template.js"></script>
|
||||
<script src="https://static.fwdekker.com/lib/template/3.x.x/template.js?v=%%VERSION_NUMBER%%"></script>
|
||||
<!--suppress HtmlUnknownTarget -->
|
||||
<script src="bundle.js?v=%%VERSION_NUMBER%%"></script>
|
||||
</body>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// noinspection JSUnresolvedVariable
|
||||
const {$, doAfterLoad, footer, header, nav} = window.fwdekker;
|
||||
const {$, doAfterLoad} = window.fwdekker;
|
||||
// noinspection JSUnresolvedVariable
|
||||
const {clearFormValidity, showInputInvalid} = window.fwdekker.validation;
|
||||
|
||||
|
||||
function toUppercaseAt(string, index) {
|
||||
|
@ -8,23 +10,9 @@ function toUppercaseAt(string, index) {
|
|||
|
||||
|
||||
doAfterLoad(() => {
|
||||
$("#nav").appendChild(nav("/Tools/Debreviator/"));
|
||||
$("#header").appendChild(header({
|
||||
title: "Debreviator",
|
||||
description: "Creates meaning by undoing your abbreviation"
|
||||
}));
|
||||
$("#footer").appendChild(footer({
|
||||
vcsURL: "https://git.fwdekker.com/tools/debreviator/",
|
||||
version: "v%%VERSION_NUMBER%%"
|
||||
}));
|
||||
$("main").classList.remove("hidden");
|
||||
$("[autofocus]").focus();
|
||||
});
|
||||
|
||||
doAfterLoad(() => {
|
||||
const debreviateForm = $("#debreviate-form");
|
||||
const abbreviationInput = $("#abbreviation");
|
||||
const abbreviationError = $("#abbreviation-error");
|
||||
const debreviateButton = $("#debreviate");
|
||||
const debreviationOutput = $("#debreviations");
|
||||
|
||||
|
||||
|
@ -39,9 +27,10 @@ doAfterLoad(() => {
|
|||
};
|
||||
|
||||
const debreviate = () => {
|
||||
clearFormValidity(debreviateForm);
|
||||
const abbreviation = abbreviationInput.value.trim();
|
||||
if (abbreviation === "") {
|
||||
showError("Abbreviation should be non-empty.");
|
||||
showInputInvalid(abbreviationInput, "Abbreviation should be non-empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -75,11 +64,13 @@ doAfterLoad(() => {
|
|||
});
|
||||
};
|
||||
|
||||
debreviateButton.addEventListener("click", debreviate);
|
||||
abbreviationInput.addEventListener("keypress", event => {
|
||||
if (event.key === "Enter") {
|
||||
debreviate();
|
||||
event.preventDefault();
|
||||
}
|
||||
debreviateForm.addEventListener("submit", event => {
|
||||
event.preventDefault();
|
||||
debreviate();
|
||||
});
|
||||
|
||||
|
||||
// Show page to user
|
||||
$("main").classList.remove("hidden");
|
||||
$("[autofocus]").focus();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue