您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
当前为
- // ==UserScript==
- // @name READTHEDOCS.IO
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match https://geotrellis.readthedocs.io/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- const requestUrl = location.protocol === "https:" ? "https://www.sunibas.cn/api" : "http://www.sunibas.cn/api";
- window.$jq = jQuery;
- window.$tran = function (list) {
- return fetch(requestUrl, {
- headers: {
- "Content-Type": "application/json",
- },
- method: "post",
- body: JSON.stringify({
- api: "GoogleTranslate",
- method: "fetchTran",
- data: {
- list: list
- }
- })
- }).then(_ => _.text()).then(JSON.parse).then(_ => _.data.data);
- }
- let tasks = [];
- window.$tranPElement = function (tar) {
- let ps = $jq(tar || 'p');
- for (let i = 0; i < ps.length; i++) {
- tasks.push((function (node) {
- $tran(node.innerText)
- .then(_ => {
- $jq(node).replaceWith($jq(`<${node.nodeName} class="ibas_tran">${_}</${node.nodeName}>`));
- if (tasks.length) {
- tasks.shift()();
- } else {
- //alert("完成");
- }
- })
- .catch(_ => {
- console.log(_);
- if (tasks.length) {
- tasks.shift()();
- } else {
- //alert("完成");
- }
- })
- }).bind(null, ps[i]));
- }
- if (tasks.length) {
- tasks.shift()();
- } else {
- alert("完成");
- }
- }
- window.onload = function() {
- var content = jQuery('.wy-nav-content');
- var parentDiv = content.parent();
- parentDiv[0].style.background = "#fff";
- content[0].style.float = 'left';
- content[0].style.background = 'darkkhaki';
- var copyContent = jQuery(`<div class="wy-nav-content copy" style="float: left;margin-left:20px;background: beige;">` + content[0].innerHTML + `<div>`);
- parentDiv.append(copyContent);
- setTimeout(function(){
- $tranPElement('.copy .document p,.copy .document li');
- },1000);
- }
- // Your code here...
- })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址