// @title Mastodon - n7m
// @description see https://github.com/timrwood/n7m
// @include https://*/web/*
// @license MIT License
// @javascript_url
((target, proc) => (new MutationObserver(m => m.forEach(r => proc(r.addedNodes))).observe(target, {childList: 1, subtree: 1}), proc([target])))(
document.querySelector('.columns-area'),
nodes =>
Array.from(nodes)
.filter(n => n.nodeType === Node.ELEMENT_NODE)
.reduce((p, c) => p.concat(Array.from(c.querySelectorAll('.status__content p:only-child, .status__content p > span'))), [])
.forEach(elem =>
Array.from(elem.childNodes)
.filter(n => n.nodeType === Node.TEXT_NODE)
.forEach(node => node.textContent = node.textContent.replace(/[a-z]{4,}/gi, s => `${s[0]}${s.length-2}${s[s.length-1]}`)))
);