知乎故事会

try to take over the world!

目前为 2019-06-16 提交的版本。查看 最新版本

// ==UserScript==
// @name         知乎故事会
// @namespace    https://github.com/taxayd
// @version      0.2
// @description  try to take over the world!
// @author       taxayd
// @match        *://www.zhihu.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function replace(){
        var main = document.getElementsByClassName('App-main')[0];
        if (main == undefined || main == null) {
            main = document.getElementsByClassName('zg-wrap zu-main clearfix ')[0];
        }
        var html = main.innerHTML;
        // 正文
        html = html.replace(new RegExp('知乎', 'g'), '故事会');
        html = html.replace(new RegExp('回答', 'g'), '故事');
        html = html.replace(new RegExp('谢邀', 'g'), '我要开始装逼了');
        main.innerHTML = html;
        // 滚动条不消失,直接隐藏
        var loading = document.getElementsByClassName('LoadingBar')[0];
        if (loading != undefined && loading != null) {
            loading.style.display = 'none';
        }
        // title
        document.title = document.title.replace(new RegExp('知乎', 'g'), '故事会');
        // favicon
        var link = document.querySelector("link[rel*='shortcut icon']") || document.createElement('link');
        link.type = 'image/x-icon';
        link.rel = 'shortcut icon';
        link.href = 'https://i.loli.net/2019/06/16/5d059b3dbb3dc45665.png';
        document.getElementsByTagName('head')[0].appendChild(link);
        // 头部图标
        var svg = document.getElementsByClassName('Icon ZhihuLogo ZhihuLogo--blue Icon--logo')[0];
        var icon = null;
        var icon_text = null;
        if (svg == undefined || svg == null) {
            svg = document.getElementById('zh-top-link-logo');
            svg.style = 'background-image:url(https://i.loli.net/2019/06/16/5d05ac216b0f116870.png);'
        } else {
            icon_text = document.createElement('b');
            icon_text.style="color: #1889e8;";
            icon_text.id="icon-text";
            icon_text.innerText = '故事会';
            icon = svg.parentElement;
            icon.replaceChild(icon_text, svg);
        }
    }

    addEventListener('load', replace);
})();

QingJ © 2025

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