您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows a timer on any website to track time spent
当前为
- // ==UserScript==
- // @name Website Usage Timer
- // @namespace http://tampermonkey.net/
- // @version 1.1
- // @description Shows a timer on any website to track time spent
- // @author Drewby123
- // @match *://*/*
- // @grant none
- // @license MIT
- // ==/UserScript==
- (function () {
- 'use strict';
- // Create the timer element
- const timerBox = document.createElement('div');
- timerBox.id = 'site-timer-overlay';
- timerBox.style.position = 'fixed';
- timerBox.style.bottom = '20px';
- timerBox.style.right = '20px';
- timerBox.style.background = 'rgba(0, 0, 0, 0.7)';
- timerBox.style.color = '#fff';
- timerBox.style.padding = '10px 14px';
- timerBox.style.borderRadius = '10px';
- timerBox.style.fontFamily = 'monospace';
- timerBox.style.fontSize = '14px';
- timerBox.style.zIndex = '9999';
- timerBox.style.boxShadow = '0 2px 8px rgba(0,0,0,0.5)';
- timerBox.textContent = 'Time on site: 00:00';
- document.body.appendChild(timerBox);
- // Start timer
- let seconds = 0;
- setInterval(() => {
- seconds++;
- const mins = Math.floor(seconds / 60).toString().padStart(2, '0');
- const secs = (seconds % 60).toString().padStart(2, '0');
- timerBox.textContent = `Time on site: ${mins}:${secs}`;
- }, 1000);
- })();