TianchiNotebook

天池Notebook界面优化。

  1. // ==UserScript==
  2. // @name TianchiNotebook
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 天池Notebook界面优化。
  6. // @author You
  7. // @match https://tianchi.aliyun.com/ailab/notebook-ai/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=aliyun.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. window.onload = function () {
  16. var iframe = document.getElementsByClassName('detail-html')[0];
  17. if (iframe) {
  18. var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
  19. if (iframeWin.document.body) {
  20. var arr = iframeWin.document.getElementsByClassName('p-Widget');
  21. setTimeout(function () {
  22. iframe.style.height = (arr[arr.length - 1].getBoundingClientRect().top) + 200 + 'px';
  23. }, 1000);
  24. }
  25. }
  26.  
  27. document.body.insertAdjacentHTML('beforeBegin','<style>\n' +
  28. ' .GTGoToTop{\n' +
  29. ' cursor: pointer;\n' +
  30. ' position: fixed;\n' +
  31. ' right: 50px;\n' +
  32. ' bottom: 50px;\n' +
  33. ' width: 50px;\n' +
  34. ' height: 50px;\n' +
  35. ' color: #fff;\n' +
  36. ' background: #ff8929;\n' +
  37. ' box-shadow: 5px 2px 5px #ffe4d1;\n' +
  38. ' line-height: 15px;\n' +
  39. ' padding: 10px;\n' +
  40. ' }\n' +
  41. ' .ailab-common-breadcrumb{\n' +
  42. ' display: none !important;\n' +
  43. ' }\n' +
  44. ' .ant-layout-header{\n' +
  45. ' display: none !important;\n' +
  46. ' }\n' +
  47. ' .ailab-notebook{\n' +
  48. ' height: unset;\n' +
  49. ' }\n' +
  50. ' .mynotebook-btn-container{\n' +
  51. ' padding: 16px 13px 22px;\n' +
  52. ' border-top: none;\n' +
  53. ' position: fixed;\n' +
  54. ' bottom: 0;\n' +
  55. ' left: 0;\n' +
  56. ' width: 295px !important;\n' +
  57. ' background: #fff;\n' +
  58. ' }\n' +
  59. ' .right-content-wrap{\n' +
  60. ' height: unset;\n' +
  61. ' }\n' +
  62. '</style>');
  63.  
  64. document.body.insertAdjacentHTML('beforeEnd','<span class="GTGoToTop" onclick="window.scrollTo(0,0)">回到顶部</span>');
  65.  
  66. var list_height = document.getElementsByClassName('left-menu')[0].offsetHeight;
  67. var btn_line_body = document.getElementsByClassName('mynotebook-btn-container')[0];
  68. var list_body = document.getElementsByClassName('list-container')[0];
  69. btn_line_body.style.position = "fixed";
  70. window.onscroll = function () {
  71. //为了保证兼容性,这里取两个值,哪个有值取哪一个
  72. //scrollTop就是触发滚轮事件时滚轮的高度
  73. var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  74. if(scrollTop + document.body.offsetHeight >= list_height){
  75. btn_line_body.style.position = "relative";
  76. list_body.style.marginBottom = "0";
  77. }else{
  78. btn_line_body.style.position = "fixed";
  79. list_body.style.marginBottom = "70px";
  80. }
  81. };
  82. };
  83. // Your code here...
  84. })();

QingJ © 2025

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