-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbookmarklet.html
18 lines (15 loc) · 2.97 KB
/
bookmarklet.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/></head>
<body>
<h1>Dezalgoizer</h1>
<p>Drag and drop this link (<a href='javascript:(()=>{let e=window.getSelection();let l=/[\u0300-\u036F]|[\u0483-\u0489]|[\u1AB0-\u1AFF]|[\u1DC0-\u1DFF]|[\u20D0-\u20FF]|[\u2DE0-\u2DFF]|[\uA66F-\uA67D]|\uA69E|\uA69F|[\uFE20-\uFE2F]/gu,t=[];for(let o of function*(){for(let l=0;l<e.rangeCount;++l)yield e.getRangeAt(l)}()){if(!o||o.collapsed)continue;let e=(e,t,n)=>e.slice(0,t)+e.slice(t,n).replace(l,"")+e.slice(n),u=(l,t,n)=>{l.nodeValue=e(l.nodeValue,t,n)},a=o.startContainer,d=o.endContainer,i=o.startOffset,f=o.endOffset,s=null!=d.nodeValue?d.nodeValue.length-f:0;function*n(e){if(o.intersectsNode(e))if(e.nodeValue)yield[e,e===a?i:0,e===d?f:e.nodeValue.length];else for(let l of e.childNodes)yield*n(l)}for(let e of n(o.commonAncestorContainer))u(...e);let r=null!=d.nodeValue?d.nodeValue.length-s:f,c=new Range;c.setStart(a,i),c.setEnd(d,r),t.push(c)}if(t.length){e.removeAllRanges();for(let l of t)e.addRange(l)}else alert("No text selected to dezalgoize!")})();
'>dezalgoize</a>) into your bookmarks.</p><p>To use, simply select some misdecorated text, then click the bookmarklet.</p>
<h2>Tests</h2>
Sample text to test your new bookmarklet on:
<ul>
<li>Dw̨a̛rf mob̵s ̕qui͠z <tt>lynx.̕j̧pg</tt>, ̴k̛v͡et̴c̀h͢</li>
<li>P̝̈ó̰̫̖̘̦̀ͅj͍̠͎̩̜̫͓̈́̋͋͊̈́d̹̩̠źͥ̎̅̂ͬż̥̭̟̱̹͑̌ė̞̺̤͕̞̮̂̋,͚̹̿ͩͯͫ ͍ͫ̔͌k͚̰ͩ̉ͯͮͩiͥ̋̑ͬ͛̏ͭṉ̗̻͙̜̟́͌͌͊͑̋ͬ̐ ̖̭̜ͨ̿͌̉̌̑t̼̭ͨ̿͊ę͇͕̻̭̈ͦ͌̋ ̠͇͕͑͆̾͑̉c͌͒ͬh͈̺̼̪̟̝̱͂͛͆̅͗m̙̻̗̗͌̍ͦͅu͋̾̓̔ͪ̄̑r͎̞̹̥͉̦͌̐n̤̠͉̥̍̏ͫ͒̌ő̝̠̊ͯͨś̭̫̱̭̻͖͊̉͌ͬ̎̀ć̪͇̙̙̳̝̬̄ ̦̈͑̉̊̌̅w̫̥͇̎ͮͫ͒ͪͧ̾ ̣͙̠͙̫̠̐̈́̿̅͂g͍̹̱̗̗̺͖̈́ͪ͋͋͌ł̮̘̫͙͌ͭą̪͔̞͖̖̠̬̈́b̩̜ͩ͗̃̂ͬ̚ ͓̬̣̜̗̾͐͌͑ͦ͐͗f̮̌̾ͩ͐l̗͇͍̯͎̀̈́ͬ͂ͥ̎̾a͉͔̫̩͖͖̾̔ͮs̗̟͒̀̃͑ͫ̓̆z̬͕̖͍̖͉̾̽ẏ̓!̓̾̌</li>
<li>S͕̼͖̘̥ͅv̭̲͞o͈̙̮̳ ͎̳̼̥̝̭ͅh̡̫̲̰̠̹̫ö̝̦͟l͇̫͙ṱ̝̘̱̳̭͠,̨̻̝͔̲̙͚̺ ̘̖̫͍̗̭y̢̜̙x҉̠n̖̱̣̥a͙̦͙͡ͅ ͈͎͍̥̬͠k̨̻̝͔̮͍ý̲̮r͙͕̳͜ ̲̥þ̥̬͇͢ͅe̱g͘ͅð̬̪̟͢i̗̙̥̼ ̯̱̫̟͎j̝͕ú͙̲̦̻͉̥̗͝ ̫̫̞̙͎͇̀u̯̤m͕̩̭̥͜ͅ ̮̝͚̱̼̪͇d̥͕̣͝ó̰͠p͚͎̣̣͕͠ ͔͇̰͖ͅí͈͖͞ ͍̥̺̕ͅf̰͙͝é̘̭ ̡̠̱̱̝̝ͅá͓ ̗b҉æ̼̰͇.͉̻͕̣̲</li>
<li>T̩̩͖̞̗̼͋̔͋̓̍̚ö̟̮̭̲̝̯͕̀͆̽̈́̚͠r̤̲ͫ̀́͒̊̔k̜̠͈͈̍ͩ͟y͙͚͋̔͞l̠̘̠̼̰̃͐͑̆ͩ͒̂̿͟e̓ͯ̄̓͊̈̊̇҉̤͔̟̬̦̠͢͠m̰͉̈́̾̆͂̔̓̍̕͜p̸̷͉̦͙͔͈͔̤͒̎̽́͞ͅi̧̘̻͍̫̞̯̟͙̇̈́͒͊́̀͗̒̕͟j̨̗̘̫͑̾̅̔̃ͤ̽͘͝ä̴̛̙̭̂̒̇̊̄̂̂̚v̖͓̯̠͔̹͌̌͟o͐ͨ҉̖̝̩̠͎͔͈̺́n̺͙̺͚̫̗͊̈́ͩ̈́̽̉ͭ̌̚ͅg̨͖̯̺̲͙̯ͫ̓̑̑̓̕͟ã̦͍͎̖̞̓̌̿̅̓h̴͉͓͇ͯ͆̌ͅd̴͈̠̹̫͎̥͇̞̎̌ͦ͛ų̸̥̘̮̤̱̼̊͑̐̐͛ͥ͝ͅͅs̠̟͉̤̍ͨ͒͟͠</li>
</ul>
</body></html>