Upgrade template to v3
This commit is contained in:
parent
1f65d60675
commit
5470eb3c7a
Binary file not shown.
10
package.json
10
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "converter",
|
"name": "converter",
|
||||||
"version": "1.4.12",
|
"version": "1.4.13",
|
||||||
"description": "Convert numbers to and from various bases.",
|
"description": "Convert numbers to and from various bases.",
|
||||||
"author": "Florine W. Dekker",
|
"author": "Florine W. Dekker",
|
||||||
"browser": "dist/bundle.js",
|
"browser": "dist/bundle.js",
|
||||||
|
@ -19,15 +19,15 @@
|
||||||
"big-integer": "^1.6.51"
|
"big-integer": "^1.6.51"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "^1.4.1",
|
"grunt": "^1.5.3",
|
||||||
"grunt-cli": "^1.4.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-copy": "^1.0.0",
|
||||||
"grunt-contrib-watch": "^1.1.0",
|
"grunt-contrib-watch": "^1.1.0",
|
||||||
"grunt-focus": "^1.0.0",
|
"grunt-focus": "^1.0.0",
|
||||||
"grunt-text-replace": "^0.4.0",
|
"grunt-text-replace": "^0.4.0",
|
||||||
"grunt-webpack": "^5.0.0",
|
"grunt-webpack": "^5.0.0",
|
||||||
"webpack": "^5.69.1",
|
"webpack": "^5.75.0",
|
||||||
"webpack-cli": "^4.9.2"
|
"webpack-cli": "^5.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,20 @@
|
||||||
<meta name="description" content="Convert numbers to and from various bases." />
|
<meta name="description" content="Convert numbers to and from various bases." />
|
||||||
<meta name="theme-color" content="#0033cc" />
|
<meta name="theme-color" content="#0033cc" />
|
||||||
|
|
||||||
|
<meta name="fwd:nav:target" content="#nav" />
|
||||||
|
<meta name="fwd:nav:highlight-path" content="/Tools/Converter/" />
|
||||||
|
<meta name="fwd:footer:target" content="#footer" />
|
||||||
|
<meta name="fwd:footer:vcs-url" content="https://git.fwdekker.com/tools/converter/" />
|
||||||
|
<meta name="fwd:footer:version" content="v%%VERSION_NUMBER%%" />
|
||||||
|
|
||||||
<title>Converter | FWDekker</title>
|
<title>Converter | FWDekker</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://static.fwdekker.com/fonts/roboto/roboto.css" />
|
<link rel="stylesheet" href="https://static.fwdekker.com/lib/template/3.x.x/template.css?v=%%VERSION_NUMBER%%" />
|
||||||
<link rel="stylesheet" href="https://static.fwdekker.com/lib/template/2.x.x/template.css" />
|
|
||||||
<script async src="https://stats.fwdekker.com/count.js"
|
<script async src="https://stats.fwdekker.com/count.js"
|
||||||
data-goatcounter="https://stats.fwdekker.com/count"></script>
|
data-goatcounter="https://stats.fwdekker.com/count"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript class="fwd-js-notice">
|
||||||
<img src="https://stats.fwdekker.com/count?p=/tools/converter/" alt="Counting pixel" />
|
<img src="https://stats.fwdekker.com/count?p=/tools/converter/" alt="Counting pixel" />
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -25,27 +30,26 @@
|
||||||
instructions on how to enable JavaScript in your web browser</a>.
|
instructions on how to enable JavaScript in your web browser</a>.
|
||||||
</p>
|
</p>
|
||||||
</noscript>
|
</noscript>
|
||||||
<main class="hidden">
|
<nav id="nav"></nav>
|
||||||
<div id="nav"></div>
|
<main class="container hidden">
|
||||||
<div id="contents">
|
<div role="document">
|
||||||
<div id="header"></div>
|
<section>
|
||||||
|
<header class="fwd-header">
|
||||||
|
<hgroup>
|
||||||
|
<h1><a href=".">Converter</a></h1>
|
||||||
|
<h2>Convert numbers to and from various bases.</h2>
|
||||||
|
</hgroup>
|
||||||
|
</header>
|
||||||
|
|
||||||
<!-- Input -->
|
<form>
|
||||||
<section class="container">
|
<fieldset id="inputs"></fieldset>
|
||||||
<div class="row">
|
</form>
|
||||||
<div class="column">
|
|
||||||
<form>
|
|
||||||
<fieldset id="inputs">
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
|
<footer id="footer"></footer>
|
||||||
</div>
|
</div>
|
||||||
<div id="footer"></div>
|
|
||||||
</main>
|
</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 -->
|
<!--suppress HtmlUnknownTarget -->
|
||||||
<script src="bundle.js?v=%%VERSION_NUMBER%%"></script>
|
<script src="bundle.js?v=%%VERSION_NUMBER%%"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// noinspection JSUnresolvedVariable
|
// noinspection JSUnresolvedVariable
|
||||||
const {$, doAfterLoad, footer, header, nav} = window.fwdekker;
|
const {$, doAfterLoad} = window.fwdekker;
|
||||||
import bigInt from "big-integer"
|
import bigInt from "big-integer"
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import bigInt from "big-integer"
|
||||||
* @returns {string} the input string with one character replaced
|
* @returns {string} the input string with one character replaced
|
||||||
*/
|
*/
|
||||||
const stringReplaceAt = (str, index, replacement) =>
|
const stringReplaceAt = (str, index, replacement) =>
|
||||||
str.substr(0, index) + replacement + str.substr(index + replacement.length);
|
str.substring(0, index) + replacement + str.substring(index + replacement.length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replaces all instances of the target with the replacement.
|
* Replaces all instances of the target with the replacement.
|
||||||
|
@ -149,15 +149,12 @@ class Base64NumeralSystemInput extends NumeralSystemInput {
|
||||||
super(name, new Base64NumeralSystem(Base64NumeralSystem.defaultAlphabet()));
|
super(name, new Base64NumeralSystem(Base64NumeralSystem.defaultAlphabet()));
|
||||||
|
|
||||||
this.dropdown = document.createElement("select");
|
this.dropdown = document.createElement("select");
|
||||||
this.dropdown.id = `${this.name}Dropdown`;
|
this.dropdown.id = `${this.name}-dropdown`;
|
||||||
this.dropdown.onchange = () => {
|
this.dropdown.onchange = () => {
|
||||||
const selectedOption = Base64NumeralSystemInput.dropdownOptions()[this.dropdown.value];
|
const selectedOption = Base64NumeralSystemInput.dropdownOptions()[this.dropdown.value];
|
||||||
this.setLastDigits(selectedOption[0], selectedOption[1]);
|
this.setLastDigits(selectedOption[0], selectedOption[1]);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.dropdownDiv = document.createElement("div");
|
|
||||||
this.dropdownDiv.classList.add("float-right");
|
|
||||||
|
|
||||||
this.options =
|
this.options =
|
||||||
Object.keys(Base64NumeralSystemInput.dropdownOptions()).map(key => {
|
Object.keys(Base64NumeralSystemInput.dropdownOptions()).map(key => {
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
|
@ -180,10 +177,9 @@ class Base64NumeralSystemInput extends NumeralSystemInput {
|
||||||
|
|
||||||
addToParent(parent) {
|
addToParent(parent) {
|
||||||
this.options.forEach(option => this.dropdown.appendChild(option));
|
this.options.forEach(option => this.dropdown.appendChild(option));
|
||||||
this.dropdownDiv.appendChild(this.dropdown);
|
|
||||||
parent.appendChild(this.dropdownDiv);
|
|
||||||
|
|
||||||
parent.appendChild(this.label);
|
parent.appendChild(this.label);
|
||||||
|
parent.appendChild(this.dropdown);
|
||||||
parent.appendChild(this.textarea);
|
parent.appendChild(this.textarea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,19 +209,6 @@ const updateAllInputs = (source, newValue) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
doAfterLoad(() => {
|
|
||||||
$("#nav").appendChild(nav("/Tools/Converter/"));
|
|
||||||
$("#header").appendChild(header({
|
|
||||||
title: "Converter",
|
|
||||||
description: "Convert numbers to and from various bases"
|
|
||||||
}));
|
|
||||||
$("#footer").appendChild(footer({
|
|
||||||
vcsURL: "https://git.fwdekker.com/tools/converter/",
|
|
||||||
version: "v%%VERSION_NUMBER%%"
|
|
||||||
}));
|
|
||||||
$("main").classList.remove("hidden");
|
|
||||||
});
|
|
||||||
|
|
||||||
doAfterLoad(() => {
|
doAfterLoad(() => {
|
||||||
const inputParent = $("#inputs");
|
const inputParent = $("#inputs");
|
||||||
|
|
||||||
|
@ -234,4 +217,6 @@ doAfterLoad(() => {
|
||||||
|
|
||||||
updateAllInputs(undefined, bigInt(42));
|
updateAllInputs(undefined, bigInt(42));
|
||||||
inputs[0].textarea.focus();
|
inputs[0].textarea.focus();
|
||||||
|
|
||||||
|
$("main").classList.remove("hidden");
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue