pedf
/
spolky
Archived
1
0
Fork 0

fix line breaks on single-letter words

master
Lukáš Hozda 4 years ago
parent c9adb664f8
commit ae0899cfc5

@ -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();
});
</script>
<MenuBtn>

@ -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();
});
</script>
<svelte:head>

@ -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();
});
</script>
<svelte:head>

@ -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();
});
</script>
<svelte:head>

@ -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();
});
</script>