← All examples

JavaScript Productivity tiktok.com

TikTok: usage-time reminder

Every 15 minutes shows a gentle bar reminding you how long you have been browsing TikTok.

Code to copy

// Show a gentle usage reminder every 15 minutes
const MIN = 15;
let elapsed = 0;
setInterval(function () {
  elapsed += 1;
  if (elapsed % MIN !== 0) { return; }
  const bar = document.createElement('div');
  bar.textContent = 'You have been on TikTok for ' + elapsed + ' minutes.';
  bar.style.cssText = 'position:fixed;top:0;left:0;right:0;z-index:99999;'
    + 'background:#fe2c55;color:#fff;text-align:center;padding:10px;'
    + 'font:600 14px sans-serif;cursor:pointer';
  bar.addEventListener('click', function () { bar.remove(); });
  document.body.appendChild(bar);
  setTimeout(function () { bar.remove(); }, 8000);
}, 60000);

How to use this example

  1. Copy the code with the button above.
  2. Install JustZix (2 minutes) and open the extension on the target page.
  3. Add a new rule matching that page.
  4. 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.

Does this example work?

Snippets are useless without somewhere to paste them.

JustZix takes 2 minutes to install and runs your code on every matching page. No account, no payment.

Download free See use cases