bugfixing: make it safari 15.6 compatible

This commit is contained in:
MuslemRahimi 2024-08-13 22:33:03 +02:00
parent d5c6d10a1a
commit 341d6c0120
2 changed files with 147 additions and 127 deletions

View File

@ -11,10 +11,29 @@ 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/);
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);

View File

@ -180,6 +180,7 @@ let Cookie;
$showCookieConsent = typeof data?.cookieConsent !== 'undefined' ? false : true;
onMount(async () => {
//await fallbackWorker();
await loadWorker();
//await pushNotification()