Use new template system, bump to chart.js 3

This commit is contained in:
Florine W. Dekker 2021-04-18 18:13:23 +02:00
parent 15e0eb26d3
commit 9af57b171c
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
5 changed files with 20 additions and 24 deletions

View File

@ -8,10 +8,10 @@ module.exports = grunt => {
}, },
copy: { copy: {
html: { html: {
files: [{expand: true, cwd: "src/main/", src: "**/*.html", dest: "dist/"}] files: [{expand: true, cwd: "src/main/", src: "**/*.html", dest: "dist/", flatten: true}]
}, },
css: { css: {
files: [{expand: true, cwd: "src/main/", src: "**/*.css", dest: "dist/"}] files: [{expand: true, cwd: "src/main/", src: "**/*.css", dest: "dist/", flatten: true}]
}, },
}, },
focus: { focus: {
@ -43,7 +43,7 @@ module.exports = grunt => {
}, },
webpack: { webpack: {
options: { options: {
entry: "./src/main/js/index.js", entry: "./src/main/js/main.js",
module: { module: {
rules: [ rules: [
{ {

BIN
package-lock.json generated

Binary file not shown.

View File

@ -1,6 +1,6 @@
{ {
"name": "dice", "name": "dice",
"version": "1.0.12", "version": "1.0.13",
"description": "Calculates the probability of rolling a value given a combination of dice.", "description": "Calculates the probability of rolling a value given a combination of dice.",
"author": "Felix W. Dekker", "author": "Felix W. Dekker",
"browser": "dist/bundle.js", "browser": "dist/bundle.js",
@ -16,19 +16,18 @@
"deploy": "grunt deploy" "deploy": "grunt deploy"
}, },
"dependencies": { "dependencies": {
"@fwdekker/template": "^0.0.24", "chart.js": "^3.1.1"
"chart.js": "^2.9.4"
}, },
"devDependencies": { "devDependencies": {
"grunt": "^1.3.0", "grunt": "^1.3.0",
"grunt-cli": "^1.4.1", "grunt-cli": "^1.4.2",
"grunt-contrib-clean": "^2.0.0", "grunt-contrib-clean": "^2.0.0",
"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": "^4.0.2", "grunt-webpack": "^4.0.3",
"webpack": "^5.28.0", "webpack": "^5.33.2",
"webpack-cli": "^4.5.0" "webpack-cli": "^4.6.0"
} }
} }

View File

@ -11,14 +11,15 @@
<title>Dice probabilities | FWDekker</title> <title>Dice probabilities | FWDekker</title>
<link rel="stylesheet" href="https://static.fwdekker.com/fonts/roboto.css" crossorigin="anonymous" /> <link rel="stylesheet" href="https://static.fwdekker.com/fonts/roboto.css" crossorigin="anonymous" />
<link rel="stylesheet" href="https://static.fwdekker.com/lib/template/1.x.x/bundle.css" crossorigin="anonymous" />
</head> </head>
<body> <body>
<noscript> <noscript>
<span style="color: red; font-weight: bold;"> <p style="color: red; font-weight: bold;">
This website does not function if JavaScript is disabled. This website does not function if JavaScript is disabled.
Please check the <a href="https://www.enable-javascript.com/"> Please check the <a href="https://www.enable-javascript.com/">
instructions on how to enable JavaScript in your web browser</a>. instructions on how to enable JavaScript in your web browser</a>.
</span> </p>
</noscript> </noscript>
<main style="display: none;"> <main style="display: none;">
<div id="nav"></div> <div id="nav"></div>
@ -70,8 +71,8 @@
<div id="footer"></div> <div id="footer"></div>
</main> </main>
<script src="https://static.fwdekker.com/lib/template/1.x.x/bundle.js" crossorigin="anonymous"></script>
<!-- Scripts --> <!--suppress HtmlUnknownTarget -->
<script src="bundle.js?v=%%VERSION_NUMBER%%"></script> <script src="bundle.js?v=%%VERSION_NUMBER%%"></script>
</body> </body>
</html> </html>

View File

@ -1,5 +1,8 @@
import {$, doAfterLoad, footer, header, nav, showPage} from "@fwdekker/template"; // noinspection JSUnresolvedVariable
import Chart from "chart.js" const {$, doAfterLoad, footer, header, nav, showPage} = window.fwdekker;
import {Chart, CategoryScale, Filler, LineController, LineElement, LinearScale, PointElement, Tooltip} from "chart.js"
Chart.register(CategoryScale, Filler, LineController, LineElement, LinearScale, PointElement, Tooltip);
////// //////
@ -49,11 +52,6 @@ doAfterLoad(() => {
description: "Calculate the probability of rolling a value given a combination of dice" description: "Calculate the probability of rolling a value given a combination of dice"
})); }));
$("#footer").appendChild(footer({ $("#footer").appendChild(footer({
author: "Felix W. Dekker",
authorURL: "https://fwdekker.com/",
license: "MIT License",
licenseURL: "https://git.fwdekker.com/FWDekker/dice/src/branch/master/LICENSE",
vcs: "git",
vcsURL: "https://git.fwdekker.com/FWDekker/dice/", vcsURL: "https://git.fwdekker.com/FWDekker/dice/",
version: "v%%VERSION_NUMBER%%" version: "v%%VERSION_NUMBER%%"
})); }));
@ -218,9 +216,7 @@ doAfterLoad(() => {
type: "line", type: "line",
data: {}, data: {},
options: { options: {
legend: { fill: true,
display: false
},
scales: { scales: {
yAxes: [{ yAxes: [{
display: true, display: true,