您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
为英文文档添加中文文档的跳转链接
// ==UserScript== // @name 中文文档导航 // @namespace http://tampermonkey.net/ // @version 0.4 // @description 为英文文档添加中文文档的跳转链接 // @author You // @match *://gobyexample.com/* // @match *://www.typescriptlang.org/* // @match *://eslint.org/docs/rules/* // @require https://cdn.bootcss.com/jquery/1.12.2/jquery.min.js // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; var href = window.location.href; if (href.indexOf('gobyexample.com') > -1) { var cnHref = href.replace('https://gobyexample.com/', 'https://books.studygolang.com/gobyexample/'); var html = ` <a href="${cnHref}" target="_blank">→中文版</a>`; $('.example h2').append(html); } if (href.indexOf('typescriptlang.org') > -1) { var link = window.location.href.replace('www.typescriptlang.org', 'www.tslang.cn'); var html = '<li class="nav-item"><a href="'+ link +'" target="_blank">中文版</a></li>'; setTimeout(() => { $($('nav[role="navigation"] ul')[0]).append(html); }, 1000); } if (href.indexOf('eslint.org') > -1) { var link = window.location.href.replace('eslint.org/', 'cn.eslint.org/'); var html = `<li><a href="${link}">中文版</a></li>`; setTimeout(() => { $($('.navbar-right')[0]).append(html); }, 1000); } })();