add multiplier url parameter
This commit is contained in:
parent
69ff12bcdb
commit
cd5c210d8a
@ -1,8 +1,15 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { onMount } from 'svelte';
|
||||||
export let data
|
export let data
|
||||||
let multiplier = 1
|
let multiplier = 1
|
||||||
let custom_mul = "…"
|
let custom_mul = "…"
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
// Apply multiplier from URL
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
multiplier = urlParams.get('multiplier') || 1;
|
||||||
|
})
|
||||||
|
|
||||||
function convertFloatsToFractions(inputString) {
|
function convertFloatsToFractions(inputString) {
|
||||||
// Split the input string into individual words
|
// Split the input string into individual words
|
||||||
const words = inputString.split(' ');
|
const words = inputString.split(' ');
|
||||||
@ -214,7 +221,7 @@ span
|
|||||||
{/if}
|
{/if}
|
||||||
<div class=ingredients_grid>
|
<div class=ingredients_grid>
|
||||||
{#each list.list as item}
|
{#each list.list as item}
|
||||||
<div class=amount>{@html adjust_amount(item.amount, multiplier)} {item.unit}</div><div class=name>{@html item.name}</div>
|
<div class=amount>{@html adjust_amount(item.amount, multiplier)} {item.unit}</div><div class=name>{@html item.name.replace("{{multiplier}}", multiplier)}</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
Loading…
Reference in New Issue
Block a user