Created
October 24, 2025 07:31
-
-
Save garcon/bc92043dab38f6d6f1fee615cff6f4a8 to your computer and use it in GitHub Desktop.
Replace spaces surrounding en-dash on both sides with non-breaking narrow space at left and thin space at right side.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:!function(){function e(e){return e.replace(/\u0020\u2013\u0020/g,"%E2%80%AF%E2%80%93%E2%80%89")}let t=document.activeElement;if(!t){alert("%C5%BD\xe1dn\xfd aktivn\xed prvek!");return}let n=t.tagName.toLowerCase(),l=t.getAttribute("type");if("textarea"!==n&&("input"!==n||l&&"text"!==l)){if(t.isContentEditable){let r=window.getSelection();if(!r.rangeCount){alert("Nejprve ozna%C4%8D text k \xfaprav%C4%9B.");return}let a=r.getRangeAt(0),i=a.toString();if(!i){alert("Nejprve ozna%C4%8D text k \xfaprav%C4%9B.");return}let o=e(i);a.deleteContents(),a.insertNode(document.createTextNode(o)),r.removeAllRanges()}else alert("Aktivn\xed prvek nen\xed textov\xe9 pole ani contenteditable.")}else{let u=t.selectionStart,v=t.selectionEnd;if(u===v){alert("Nejprve ozna%C4%8D text k \xfaprav%C4%9B.");return}let c=t.value.slice(0,u),s=t.value.slice(u,v),$=t.value.slice(v),p=e(s);t.value=c+p+$,t.setSelectionRange(u,u+p.length)}}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment