MHN
Add a comment on Hacker News →
1 of 271 comments
  1. Cool, here's a quick hack to try a similar technique with the comments in this thread (copy and paste into dev tools:

        $$('span.commtext').forEach(span => {
            const frag = document.createDocumentFragment();
            span.textContent.split(/\s+/).forEach(word => {
              const len = Math.ceil(word.length * 0.3);
              const leading = document.createElement('strong');
              leading.textContent = word.slice(0, len);
              const trailing = document.createTextNode(word.slice(len) + ' ');
              frag.appendChild(leading);
              frag.appendChild(trailing);
            });
            span.parentNode.replaceChild(frag, span);
        })