try to take over the world!
当前为
// ==UserScript==
// @name READTHEDOCS.IO
// @namespace http://tampermonkey.net/
// @version 0.5
// @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() {
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="../_static/css/theme.css" type="text/css">
<link rel="stylesheet" href="../_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...
})();