Estimated reading time badge
Counts the article words and shows a corner badge with the estimated reading time at 220 words per minute.
Code to copy
(function () {
var article = document.querySelector('article, .post, .entry-content, main');
if (!article) return;
var words = (article.innerText || '').trim().split(/\s+/).filter(Boolean).length;
if (words === 0) return;
var minutes = Math.max(1, Math.round(words / 220));
var badge = document.createElement('div');
badge.textContent = '~' + minutes + ' min read';
badge.style.cssText = 'position:fixed;top:12px;right:12px;z-index:999999;' +
'background:#5b4636;color:#fff;font:600 13px/1 sans-serif;' +
'padding:6px 10px;border-radius:6px;box-shadow:0 2px 6px rgba(0,0,0,.25);';
document.body.appendChild(badge);
})();
How to use this example
- Copy the code with the button above.
- Install JustZix (2 minutes) and open the extension on the target page.
- Add a new rule matching that page.
- Paste the code into the rule's JavaScript panel and save — it runs on every page visit.
Rate this example
No ratings yet — be the first.