Remove inline styles and scripts
This commit is contained in:
parent
c908afeb42
commit
0e3d3b0adc
13
Gruntfile.js
13
Gruntfile.js
|
@ -7,6 +7,9 @@ module.exports = grunt => {
|
||||||
default: ["dist/"],
|
default: ["dist/"],
|
||||||
},
|
},
|
||||||
copy: {
|
copy: {
|
||||||
|
css: {
|
||||||
|
files: [{expand: true, cwd: "src/main/", src: "**/*.css", dest: "dist/", flatten: true}]
|
||||||
|
},
|
||||||
db: {
|
db: {
|
||||||
files: [{expand: true, cwd: "src/main/", src: "**/.*.db", dest: "dist/", flatten: true}]
|
files: [{expand: true, cwd: "src/main/", src: "**/.*.db", dest: "dist/", flatten: true}]
|
||||||
},
|
},
|
||||||
|
@ -19,12 +22,12 @@ module.exports = grunt => {
|
||||||
},
|
},
|
||||||
focus: {
|
focus: {
|
||||||
dev: {
|
dev: {
|
||||||
include: ["html", "js", "php"],
|
include: ["css", "html", "js", "php"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
replace: {
|
replace: {
|
||||||
dev: {
|
dev: {
|
||||||
src: ["./dist/*.html", "./dist/*.js"],
|
src: ["./dist/**/*.html", "./dist/**/*.js"],
|
||||||
replacements: [
|
replacements: [
|
||||||
{
|
{
|
||||||
from: "%%VERSION_NUMBER%%",
|
from: "%%VERSION_NUMBER%%",
|
||||||
|
@ -45,6 +48,10 @@ module.exports = grunt => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
css: {
|
||||||
|
files: ["src/main/**/*.css"],
|
||||||
|
tasks: ["copy:css"],
|
||||||
|
},
|
||||||
html: {
|
html: {
|
||||||
files: ["src/main/**/*.html"],
|
files: ["src/main/**/*.html"],
|
||||||
tasks: ["copy:html"],
|
tasks: ["copy:html"],
|
||||||
|
@ -98,6 +105,7 @@ module.exports = grunt => {
|
||||||
// Pre
|
// Pre
|
||||||
"clean",
|
"clean",
|
||||||
// Copy files
|
// Copy files
|
||||||
|
"copy:css",
|
||||||
"copy:db",
|
"copy:db",
|
||||||
"copy:html",
|
"copy:html",
|
||||||
"copy:php",
|
"copy:php",
|
||||||
|
@ -110,6 +118,7 @@ module.exports = grunt => {
|
||||||
// Pre
|
// Pre
|
||||||
"clean",
|
"clean",
|
||||||
// Copy files
|
// Copy files
|
||||||
|
"copy:css",
|
||||||
"copy:db",
|
"copy:db",
|
||||||
"copy:html",
|
"copy:html",
|
||||||
"copy:php",
|
"copy:php",
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "random-fo76",
|
"name": "random-fo76",
|
||||||
"version": "1.0.15",
|
"version": "1.0.16",
|
||||||
"description": "Random Fallout 76 record.",
|
"description": "Random Fallout 76 record.",
|
||||||
"author": "Felix W. Dekker",
|
"author": "Felix W. Dekker",
|
||||||
"browser": "dist/bundle.js",
|
"browser": "dist/bundle.js",
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
"deploy": "grunt deploy"
|
"deploy": "grunt deploy"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "^1.3.0",
|
"grunt": "^1.4.0",
|
||||||
"grunt-cli": "^1.4.2",
|
"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",
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
"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.3",
|
"grunt-webpack": "^4.0.3",
|
||||||
"webpack": "^5.33.2",
|
"webpack": "^5.36.0",
|
||||||
"webpack-cli": "^4.6.0"
|
"webpack-cli": "^4.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
table#metadata {
|
||||||
|
max-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
color: red;
|
||||||
|
}
|
|
@ -12,27 +12,29 @@
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://static.fwdekker.com/fonts/roboto/roboto.css" />
|
<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/2.x.x/template.css" />
|
||||||
|
<!--suppress HtmlUnknownTarget -->
|
||||||
|
<link rel="stylesheet" href="main.css?v=%%VERSION_NUMBER%%" />
|
||||||
<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>
|
||||||
<p style="color: red; font-weight: bold;">
|
<img src="https://stats.fwdekker.com/count?p=/tools/random-fo76/" alt="Counting pixel" />
|
||||||
<img src="https://stats.fwdekker.com/count?p=/tools/random-fo76/" alt="Counting pixel" />
|
|
||||||
|
|
||||||
|
<p>
|
||||||
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>.
|
||||||
</p>
|
</p>
|
||||||
</noscript>
|
</noscript>
|
||||||
<main style="display: none;">
|
<main class="hidden">
|
||||||
<div id="nav"></div>
|
<div id="nav"></div>
|
||||||
<div id="contents">
|
<div id="contents">
|
||||||
<div id="header"></div>
|
<div id="header"></div>
|
||||||
|
|
||||||
<!-- Metadata -->
|
<!-- Metadata -->
|
||||||
<section class="container">
|
<section class="container">
|
||||||
<table style="max-width: 300px;">
|
<table class="metadata">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Game version</th>
|
<th>Game version</th>
|
||||||
<td id="gameVersion">loading...</td>
|
<td id="gameVersion">loading...</td>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// noinspection JSUnresolvedVariable
|
// noinspection JSUnresolvedVariable
|
||||||
const {$, doAfterLoad, footer, header, nav, showPage} = window.fwdekker;
|
const {$, doAfterLoad, footer, header, nav} = window.fwdekker;
|
||||||
|
|
||||||
|
|
||||||
const storageKey = "/tools/random-fo76//selected-signatures";
|
const storageKey = "/tools/random-fo76//selected-signatures";
|
||||||
|
@ -98,10 +98,10 @@ const updateSignatureToggle = () => {
|
||||||
|
|
||||||
if (getSelectedSignatures().length === document.querySelectorAll("#signatures input").length) {
|
if (getSelectedSignatures().length === document.querySelectorAll("#signatures input").length) {
|
||||||
signatureToggle.innerHTML = "Deselect all signatures";
|
signatureToggle.innerHTML = "Deselect all signatures";
|
||||||
signatureToggle.onclick = () => setAllSignatures(false);
|
signatureToggle.addEventListener("click", () => setAllSignatures(false));
|
||||||
} else {
|
} else {
|
||||||
signatureToggle.innerHTML = "Select all signatures";
|
signatureToggle.innerHTML = "Select all signatures";
|
||||||
signatureToggle.onclick = () => setAllSignatures(true);
|
signatureToggle.addEventListener("click", () => setAllSignatures(true));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -140,10 +140,10 @@ const createSignatureButtons = signatures => {
|
||||||
checkbox.id = `signature-${signature}`;
|
checkbox.id = `signature-${signature}`;
|
||||||
checkbox.name = `signature-${signature}`;
|
checkbox.name = `signature-${signature}`;
|
||||||
checkbox.value = signature;
|
checkbox.value = signature;
|
||||||
checkbox.onclick = () => {
|
checkbox.addEventListener("click", () => {
|
||||||
updateSignatureToggle();
|
updateSignatureToggle();
|
||||||
saveSelectedSignaturesToStorage();
|
saveSelectedSignaturesToStorage();
|
||||||
};
|
});
|
||||||
col.appendChild(checkbox);
|
col.appendChild(checkbox);
|
||||||
|
|
||||||
row.appendChild(col);
|
row.appendChild(col);
|
||||||
|
@ -176,7 +176,7 @@ doAfterLoad(() => {
|
||||||
vcsURL: "https://git.fwdekker.com/FWDekker/random-fo76/",
|
vcsURL: "https://git.fwdekker.com/FWDekker/random-fo76/",
|
||||||
version: "v%%VERSION_NUMBER%%"
|
version: "v%%VERSION_NUMBER%%"
|
||||||
}));
|
}));
|
||||||
showPage();
|
$("main").classList.remove("hidden");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Load page from API
|
// Load page from API
|
||||||
|
@ -199,7 +199,7 @@ doAfterLoad(() => {
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
const form = $("#signatureForm");
|
const form = $("#signatureForm");
|
||||||
form.style.color = "red";
|
form.classList.add("error");
|
||||||
form.innerHTML = "Error: Failed to download signatures. Try reloading the page.";
|
form.innerHTML = "Error: Failed to download signatures. Try reloading the page.";
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -207,12 +207,12 @@ doAfterLoad(() => {
|
||||||
|
|
||||||
// Install handlers
|
// Install handlers
|
||||||
doAfterLoad(() => {
|
doAfterLoad(() => {
|
||||||
$("#submit").onclick = () => {
|
$("#submit").addEventListener("click", () => {
|
||||||
$("#output").innerHTML = "Fetching record... please wait";
|
$("#output").innerHTML = "Fetching record... please wait";
|
||||||
|
|
||||||
const selectedSignatures = getSelectedSignatures();
|
const selectedSignatures = getSelectedSignatures();
|
||||||
fetchFromApi(`action=get-random&signatures=${selectedSignatures.join(",")}`,
|
fetchFromApi(`action=get-random&signatures=${selectedSignatures.join(",")}`,
|
||||||
record => showRecord(record)
|
record => showRecord(record)
|
||||||
);
|
);
|
||||||
};
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue