diff --git a/public/css/style.scss b/public/css/style.scss index a39efc58a..27ae4472c 100644 --- a/public/css/style.scss +++ b/public/css/style.scss @@ -418,6 +418,37 @@ a:hover { } } } + .typographyCheck { + span { + display: block; + font-size: 0.76rem; + color: var(--sub-color); + margin-left: 1.5rem; + } + + input { + margin: 0 !important; + cursor: pointer; + width: 0; + height: 0; + display: none; + + & ~ .customTextTypographyCheckbox { + width: 12px; + height: 12px; + background: rgba(0, 0, 0, 0.1); + border-radius: 2px; + box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.1); + display: inline-block; + margin: 0 0.5rem 0 0.25rem; + transition: 0.25s; + } + + &:checked ~ .customTextTypographyCheckbox { + background: var(--main-color); + } + } + } } } diff --git a/public/index.html b/public/index.html index 9534c8b98..eb2528962 100644 --- a/public/index.html +++ b/public/index.html @@ -80,6 +80,14 @@ Word count +
ok
diff --git a/public/js/script.js b/public/js/script.js index a3991ea36..3167c6b8a 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -2741,6 +2741,19 @@ function changeCustomText() { // initWords(); } +function cleanTypographySymbols(textToClean) { + var specials = { + '“': '"', // “ “ + '”': '"', // ” ” + '’': "'", // ‘ ‘ + '‘': "'", // ’ ’ + ',': ",", // ‚ ‚ + '—': "-", // — — + '…': "..."// … … + } + return textToClean.replace(/[“”’‘—,…]/g, (char) => specials[char] || ''); +} + function changePage(page) { if (pageTransition) { return; @@ -3516,6 +3529,9 @@ $("#customTextPopup .button").click((e) => { text = text.trim(); text = text.replace(/[\n\r\t ]/gm, " "); text = text.replace(/ +/gm, " "); + if($("#customTextPopup .typographyCheck input").prop("checked")) { + text = cleanTypographySymbols(text) + } text = text.split(" "); // if (text.length >= 10000) { // showNotification("Custom text cannot be longer than 10000 words.", 4000);