diff --git a/src/routes/oborovky.svelte b/src/routes/oborovky.svelte index 246461c..4a531bf 100644 --- a/src/routes/oborovky.svelte +++ b/src/routes/oborovky.svelte @@ -17,6 +17,35 @@ import LLink from '../components/llink.svelte'; import Carousel from '@beyonk/svelte-carousel'; import ZjistiBtn from '../components/zjisti-vice.svelte'; + import { onMount } from 'svelte'; + + onMount(() => { + const setup = () => { + const pList = document.querySelectorAll('p, li, a, span'); + pList.forEach(p => noMoreLonelyWords(p)); + }; + + const clearWordBreaks = (target) => target.textContent = target.textContent.replace(/\u00a0/g, ' '); + const noMoreLonelyWords = (target) => { + let textArray = target.textContent.split(' '); + let newTextArray = []; + textArray.forEach((word, i, list) => { + let textEntry = ''; + if(word.length === 1) + textEntry = word + '\xa0'; + else + textEntry = word + ' '; + newTextArray.push(textEntry); + }); + target.textContent = newTextArray.join(''); + }; + const updateWordBreaks = (target) => { + clearWordBreaks(target); + noMoreLonelyWords(target); + }; + + setup(); + }); diff --git a/src/routes/prebiram.svelte b/src/routes/prebiram.svelte index 7b429cf..c2a8272 100644 --- a/src/routes/prebiram.svelte +++ b/src/routes/prebiram.svelte @@ -10,6 +10,35 @@ import MenuBtn from '../components/menu-btn.svelte'; import LLink from '../components/llink.svelte'; import ZjistiBtn from '../components/zjisti-vice.svelte'; + import { onMount } from 'svelte'; + + onMount(() => { + const setup = () => { + const pList = document.querySelectorAll('p, li, a, span'); + pList.forEach(p => noMoreLonelyWords(p)); + }; + + const clearWordBreaks = (target) => target.textContent = target.textContent.replace(/\u00a0/g, ' '); + const noMoreLonelyWords = (target) => { + let textArray = target.textContent.split(' '); + let newTextArray = []; + textArray.forEach((word, i, list) => { + let textEntry = ''; + if(word.length === 1) + textEntry = word + '\xa0'; + else + textEntry = word + ' '; + newTextArray.push(textEntry); + }); + target.textContent = newTextArray.join(''); + }; + const updateWordBreaks = (target) => { + clearWordBreaks(target); + noMoreLonelyWords(target); + }; + + setup(); + }); diff --git a/src/routes/predseda.svelte b/src/routes/predseda.svelte index dbf8986..6bb27f5 100644 --- a/src/routes/predseda.svelte +++ b/src/routes/predseda.svelte @@ -14,7 +14,32 @@ onMount(async () => { window.currentSlide(1); - }) + const setup = () => { + const pList = document.querySelectorAll('p, li, a, span'); + pList.forEach(p => noMoreLonelyWords(p)); + }; + + const clearWordBreaks = (target) => target.textContent = target.textContent.replace(/\u00a0/g, ' '); + const noMoreLonelyWords = (target) => { + let textArray = target.textContent.split(' '); + let newTextArray = []; + textArray.forEach((word, i, list) => { + let textEntry = ''; + if(word.length === 1) + textEntry = word + '\xa0'; + else + textEntry = word + ' '; + newTextArray.push(textEntry); + }); + target.textContent = newTextArray.join(''); + }; + const updateWordBreaks = (target) => { + clearWordBreaks(target); + noMoreLonelyWords(target); + }; + + setup(); + }); diff --git a/src/routes/zalozit-spolek.svelte b/src/routes/zalozit-spolek.svelte index 904c128..6259bcc 100644 --- a/src/routes/zalozit-spolek.svelte +++ b/src/routes/zalozit-spolek.svelte @@ -10,6 +10,35 @@ import MenuBtn from '../components/menu-btn.svelte'; import LLink from '../components/llink.svelte'; import ZjistiBtn from '../components/zjisti-vice.svelte'; + import { onMount } from 'svelte'; + + onMount(() => { + const setup = () => { + const pList = document.querySelectorAll('p, li, a, span'); + pList.forEach(p => noMoreLonelyWords(p)); + }; + + const clearWordBreaks = (target) => target.textContent = target.textContent.replace(/\u00a0/g, ' '); + const noMoreLonelyWords = (target) => { + let textArray = target.textContent.split(' '); + let newTextArray = []; + textArray.forEach((word, i, list) => { + let textEntry = ''; + if(word.length === 1) + textEntry = word + '\xa0'; + else + textEntry = word + ' '; + newTextArray.push(textEntry); + }); + target.textContent = newTextArray.join(''); + }; + const updateWordBreaks = (target) => { + clearWordBreaks(target); + noMoreLonelyWords(target); + }; + + setup(); + }); diff --git a/src/routes/zapojit-se.svelte b/src/routes/zapojit-se.svelte index ed697fb..5196d68 100644 --- a/src/routes/zapojit-se.svelte +++ b/src/routes/zapojit-se.svelte @@ -19,6 +19,31 @@ onMount(async () => { window.showSlides(1, "mySlides2", "slideIndex2", 'dot2'); window.showSlides(1, "mySlides3", "slideIndex3", 'dot3'); + const setup = () => { + const pList = document.querySelectorAll('p, li, a, span'); + pList.forEach(p => noMoreLonelyWords(p)); + }; + + const clearWordBreaks = (target) => target.textContent = target.textContent.replace(/\u00a0/g, ' '); + const noMoreLonelyWords = (target) => { + let textArray = target.textContent.split(' '); + let newTextArray = []; + textArray.forEach((word, i, list) => { + let textEntry = ''; + if(word.length === 1) + textEntry = word + '\xa0'; + else + textEntry = word + ' '; + newTextArray.push(textEntry); + }); + target.textContent = newTextArray.join(''); + }; + const updateWordBreaks = (target) => { + clearWordBreaks(target); + noMoreLonelyWords(target); + }; + + setup(); });