bugfixing: make it safari 15.6 compatible
This commit is contained in:
parent
d5c6d10a1a
commit
341d6c0120
@ -1,24 +1,43 @@
|
||||
<script lang='ts'>
|
||||
import { stockTicker, displayCompanyName } from "$lib/store";
|
||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||
import { stockTicker, displayCompanyName } from "$lib/store";
|
||||
import InfoModal from '$lib/components/InfoModal.svelte';
|
||||
|
||||
export let data;
|
||||
export let marketMoods = {};
|
||||
export let data;
|
||||
export let marketMoods = {};
|
||||
|
||||
let rawData = marketMoods;
|
||||
let mode = 'bullish';
|
||||
let showFullText = false;
|
||||
// Function to split text into paragraphs
|
||||
let rawData = marketMoods;
|
||||
let mode = 'bullish';
|
||||
let showFullText = false;
|
||||
// Function to split text into paragraphs
|
||||
|
||||
function splitIntoParagraphs(text) {
|
||||
// Split the text into paragraphs based on periods followed by spaces, excluding numbers with decimals
|
||||
return text?.replace('U.S.', 'US')?.split(/(?<!\d\.\d)(?<!vs)\.\s/);
|
||||
function splitIntoParagraphs(text) {
|
||||
if (!text) return [];
|
||||
|
||||
// Replace "U.S." and "vs." with placeholders
|
||||
const placeholderUS = '__US__';
|
||||
const placeholderVs = '__VS__';
|
||||
|
||||
let tempText = text.replace(/U\.S\./g, placeholderUS)
|
||||
.replace(/vs\./g, placeholderVs);
|
||||
|
||||
// Split the text based on periods followed by spaces
|
||||
let paragraphs = tempText.split(/\. \s*/);
|
||||
|
||||
// Restore the placeholders back to "U.S." and "vs."
|
||||
paragraphs = paragraphs.map(paragraph =>
|
||||
paragraph.replace(new RegExp(placeholderUS, 'g'), 'U.S.')
|
||||
.replace(new RegExp(placeholderVs, 'g'), 'vs.')
|
||||
);
|
||||
|
||||
return paragraphs;
|
||||
}
|
||||
|
||||
let paragraphs = splitIntoParagraphs(rawData?.bullSays);
|
||||
|
||||
|
||||
function handleMode(i) {
|
||||
let paragraphs = splitIntoParagraphs(rawData?.bullSays);
|
||||
|
||||
|
||||
function handleMode(i) {
|
||||
activeIdx = i;
|
||||
if(activeIdx === 0) {
|
||||
paragraphs = splitIntoParagraphs(rawData?.bullSays);
|
||||
@ -26,9 +45,9 @@ function handleMode(i) {
|
||||
else if (activeIdx === 1) {
|
||||
paragraphs = splitIntoParagraphs(rawData?.bearSays);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const tabs = [
|
||||
const tabs = [
|
||||
{
|
||||
title: "Bull Case",
|
||||
},
|
||||
@ -39,21 +58,21 @@ const tabs = [
|
||||
|
||||
let activeIdx = 0;
|
||||
|
||||
$: {
|
||||
$: {
|
||||
if($stockTicker && typeof window !== 'undefined') {
|
||||
rawData = marketMoods;
|
||||
mode = 'bullish';
|
||||
showFullText = false;
|
||||
paragraphs = splitIntoParagraphs(rawData?.bullSays);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
|
||||
{#if Object?.keys(marketMoods)?.length !== 0}
|
||||
{#if Object?.keys(marketMoods)?.length !== 0}
|
||||
|
||||
<div class="space-y-3 overflow-hidden">
|
||||
<div class="space-y-3 overflow-hidden">
|
||||
<!--Start Content-->
|
||||
<div class="w-auto lg:w-full p-1 flex flex-col m-auto">
|
||||
|
||||
@ -130,4 +149,4 @@ $: {
|
||||
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
@ -180,6 +180,7 @@ let Cookie;
|
||||
$showCookieConsent = typeof data?.cookieConsent !== 'undefined' ? false : true;
|
||||
|
||||
onMount(async () => {
|
||||
//await fallbackWorker();
|
||||
await loadWorker();
|
||||
//await pushNotification()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user