READTHEDOCS.IO

try to take over the world!

当前为 2020-05-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name READTHEDOCS.IO
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.5
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://geotrellis.readthedocs.io/*
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12.  
  13. //const $supWindow = window;
  14. window.onload = function() {
  15. var content = jQuery('.wy-nav-content');
  16. var parentDiv = content.parent();
  17. parentDiv[0].style.background = "#fff";
  18. content[0].style.float = 'left';
  19. content[0].style.background = 'darkkhaki';
  20. var copyContent = jQuery(`<div class="wy-nav-content copy" style="float: left;margin-left:20px;background: beige;">` + content[0].innerHTML + `<div>`);
  21. parentDiv.append(jQuery('<iframe id="copy"></iframe>'));
  22. setTimeout(function() {
  23. copy.contentWindow.document.getElementsByTagName('body')[0].innerHTML = `<div class="wy-nav-content" style="float: left;">` + content[0].innerHTML + "</div>";
  24. copy.contentWindow.document.getElementsByTagName('head')[0].innerHTML += `<link rel="stylesheet" href="../_static/css/theme.css" type="text/css">
  25. <link rel="stylesheet" href="../_static/pygments.css" type="text/css">`;
  26. copy.style.height = content[0].clientHeight + "px";
  27. copy.style.width = (content[0].clientWidth + 50) + "px";
  28. });
  29. setTimeout(function() {
  30. jQuery('body').append(jQuery(`
  31. <div id="fixLoc" style="position: fixed;right: 20px;top: 50%;font-size: xx-large;cursor: pointer;user-select: none;">
  32. <div id="justLocUp" style="background: cadetblue;border-radius: 10px;padding: 5px;">上</div>
  33. <div id="closeFixLoc" style="margin-top: 5px;background: cadetblue;border-radius: 10px;padding: 5px;">关</div>
  34. <div id="justLocDown" style="margin-top: 5px;background: cadetblue;border-radius: 10px;padding: 5px;">下</div>
  35. </div>`));
  36. jQuery("#closeFixLoc").on("click",function() {
  37. jQuery("#fixLoc")[0].style.display = "none";
  38. });
  39. let currentLoc = 0;
  40. let justLoc = function(tar) {
  41. let cloc = currentLoc + tar * 50;
  42. if (cloc < 0) {
  43. return;
  44. } else {
  45. content[0].style.marginTop = cloc + "px"
  46. currentLoc = cloc;
  47. }
  48. }
  49. jQuery("#justLocUp").on("click",function() {
  50. justLoc(-1);
  51. });
  52. jQuery("#justLocDown").on("click",function() {
  53. justLoc(1);
  54. });
  55. });
  56. }
  57. // Your code here...
  58. })();

QingJ © 2025

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