Greasy Fork镜像 还支持 简体中文。

Page Title Editor

Permanently edit document.title on any site! Press Ctrl+Alt+= to set, Ctrl+Alt+Backspace to revert to original title.

目前為 2021-05-13 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Page Title Editor
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Permanently edit document.title on any site! Press Ctrl+Alt+= to set, Ctrl+Alt+Backspace to revert to original title.
// @author       Balint Sotanyi
// @include      *
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var title_original = document.title, titles = localStorage.getItem('pte_titles') === null ? {} : JSON.parse(localStorage.getItem('pte_titles'));
    if (titles[window.location.href] !== undefined) {
        document.title = titles[window.location.href];
    }
    window.addEventListener('keydown', function(e) {
        if (e.code == 'Equal' && e.ctrlKey && e.altKey) {
            var t = prompt('document.title = ');
            document.title = t;
            titles[encodeURIComponent(window.location.href)] = t;
            console.log(titles);
            localStorage.setItem('pte_titles', JSON.stringify(titles));
            e.preventDefault();
        }
        if (e.code == 'Backspace' && e.ctrlKey && e.altKey) {
            document.title = title_original;
            titles = titles.filter(e => e != window.location.href);
            localStorage.setItem('pte_titles', JSON.stringify(titles));
            e.preventDefault();
        }
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址