READTHEDOCS.IO

try to take over the world!

目前為 2020-07-02 提交的版本,檢視 最新版本

// ==UserScript==
// @name         READTHEDOCS.IO
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  try to take over the world!
// @author       You
// @match        https://geotrellis.readthedocs.io/*
// ==/UserScript==

(function() {
    'use strict';

    //const $supWindow = window;
    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(jQuery('<iframe id="copy"></iframe>'));
        setTimeout(function() {
            setTimeout(function(){
                var ls = document.getElementsByTagName('head')[0].getElementsByTagName('link');
                for (var i = 0;i < ls.length;i++) {
                    if (ls[i].getAttribute('rel') == "stylesheet") {
                        copy.contentWindow.document.getElementsByTagName('body')[0].innerHTML += `<link rel="stylesheet" href="${ls[i].href}" type="text/css">`;
                    }
                }
            },500);
            copy.contentWindow.document.getElementsByTagName('body')[0].innerHTML = `<div class="wy-nav-content" style="float: left;">` + content[0].innerHTML + "</div>";
            //copy.contentWindow.document.getElementsByTagName('head')[0].innerHTML += `<link rel="stylesheet" href="http://www.sunibas.cn/public/geotrellis-docs/_static/css/theme.css" type="text/css">
//<link rel="stylesheet" href="http://www.sunibas.cn/public/geotrellis-docs/_static/css/theme.css/_static/pygments.css" type="text/css">`;
            copy.style.height = content[0].clientHeight + "px";
            copy.style.width = (content[0].clientWidth + 50) + "px";
        });
        setTimeout(function() {
            jQuery('body').append(jQuery(`
<div id="fixLoc" style="position: fixed;right: 20px;top: 50%;font-size: xx-large;cursor: pointer;user-select: none;">
<div id="justLocUp" style="background: cadetblue;border-radius: 10px;padding: 5px;">上</div>
<div id="closeFixLoc" style="margin-top: 5px;background: cadetblue;border-radius: 10px;padding: 5px;">关</div>
<div id="justLocDown" style="margin-top: 5px;background: cadetblue;border-radius: 10px;padding: 5px;">下</div>
</div>`));
            jQuery("#closeFixLoc").on("click",function() {
                jQuery("#fixLoc")[0].style.display = "none";
            });
            let currentLoc = 0;
            let justLoc = function(tar) {
                let cloc = currentLoc + tar * 50;
                if (cloc < 0) {
                    return;
                } else {
                    content[0].style.marginTop = cloc + "px"
                    currentLoc = cloc;
                }
            }
            jQuery("#justLocUp").on("click",function() {
                justLoc(-1);
            });
            jQuery("#justLocDown").on("click",function() {
                justLoc(1);
            });
        });
    }
    // Your code here...
})();

QingJ © 2025

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