您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自用1.0
当前为
- // ==UserScript==
- // @name 自用
- // @namespace 自用
- // @version 1.0
- // @description 自用1.0
- // @author 自用
- // @match *://*/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- var title, time;
- config(ready);
- // 配置
- function config(callback) {
- if (!sessionStorage.oixmRefreshTime) {
- time = 10;
- if (isNaN(time)) return;
- sessionStorage.oixmRefreshTime = time;
- } else {
- time = parseInt(sessionStorage.oixmRefreshTime);
- }
- callback();
- }
- // Ready
- function ready() {
- title = document.title;
- loop();
- }
- // 循环时间
- function loop() {
- document.title = "[" + formatTime(time) + "] " + title;
- if (time === 0) {
- location.reload();
- return;
- }
- time--;
- setTimeout(loop, 1000);
- }
- // 格式化时间
- function formatTime(t) {
- if (isNaN(t)) return "";
- var s = "";
- var h = parseInt(t / 3600);
- s += (pad(h) + ":");
- t -= (3600 * h);
- var m = parseInt(t / 60);
- s += (pad(m) + ":");
- t -= (60 * m);
- s += pad(t);
- return s;
- }
- // 补零
- function pad(n) {
- return ("00" + n).slice(-2);
- }
- })();