main^2
Midnight 3 years ago
parent 306514fe1c
commit 7e18aa3003

@ -4,6 +4,7 @@
import words from "$lib/en-lang.json"; import words from "$lib/en-lang.json";
let total = 0; let total = 0;
let error = null;
let lang = words["calculator"]; let lang = words["calculator"];
let types = lang["types"]; let types = lang["types"];
@ -25,6 +26,7 @@
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
urlParams.forEach((value, key) => { urlParams.forEach((value, key) => {
if(key == "commissions") { if(key == "commissions") {
try {
commissions = JSON.parse(value); commissions = JSON.parse(value);
commissions.forEach(value => { commissions.forEach(value => {
types.forEach(element => { types.forEach(element => {
@ -39,9 +41,14 @@
update_example(value); update_example(value);
console.log(value.example); console.log(value.example);
}); });
} catch(msg) {
error = "The selected preset link failed to load. It may be from an old version of the commission picker. It has been replaced with the default preset below."
}
} }
}); });
if(commissions.length == 0) base(); if(commissions.length == 0) {
base();
}
} }
function update_example(commission: Commission) { function update_example(commission: Commission) {
@ -200,6 +207,12 @@
</div> </div>
</section> </section>
{#if error}
<section class="bg-slate-800 text-yellow-500 font-bold rounded-lg shadow-lg p-5 flex flex-col gap-5">
⚠️ {error}
</section>
{/if}
{#each [...commissions].reverse() as commission} {#each [...commissions].reverse() as commission}
<section class="flex gap-5"> <section class="flex gap-5">
<div class="w-3/5 bg-slate-800 rounded-lg shadow-lg p-5 flex flex-col gap-5"> <div class="w-3/5 bg-slate-800 rounded-lg shadow-lg p-5 flex flex-col gap-5">

Loading…
Cancel
Save