Facilitating learncpp.com

Move the control button from bottom to top. This is not a responsive script.

  1. // ==UserScript==
  2. // @name Facilitating learncpp.com
  3. // @namespace http://github.com/basilguo
  4. // @description Move the control button from bottom to top. This is not a responsive script.
  5. // @author Basil Guo
  6. // @match https://www.learncpp.com/cpp-tutorial/*
  7. // @icon https://www.learncpp.com/blog/wp-content/uploads/learncpp.png
  8. // @homepageURL https://gist.github.com/BasilGuo/84350a125bcb864abe2a779a2768c381
  9. // @license MIT
  10. // @version 2024-07-04-02
  11. // @note 2024-07-04-02 Modify the description.
  12. // @note 2024-07-04-01 Modify the description.
  13. // @note 2024-07-04-00 Conceal the text as default and will appear after hovering the control buttons.
  14. // @note 2024-05-23-00 Create the script.
  15. // @grant none
  16. // ==/UserScript==
  17.  
  18. (function() {
  19. 'use strict';
  20. // Your code here...
  21. document.body.style.cssText += 'font-size: 1em';
  22. let pndiv = document.querySelector('.prevnext');
  23. pndiv.style.cssText = `position:fixed;top:0;width:100%;z-index:101;background-color:#fff`;
  24. let header = document.querySelector('header')
  25. header.appendChild(pndiv);
  26.  
  27. let prevnext_inline = document.querySelector('.prevnext-inline');
  28. prevnext_inline.style.cssText = `width:100%;display:flex;flex-direction:row-reverse;max-width:100%;justify-content:space-around;align-items:center;background-color:#fff;margin-top:0`;
  29.  
  30.  
  31. let prevBtn = document.querySelector('.nav-button-prev');
  32. let prevBtnText = document.querySelector('.nav-button-prev .nav-button-text');
  33. prevBtn.onmouseover = function(){prevBtnText.style.display = '';};
  34. prevBtn.onmouseout = function(){prevBtnText.style.display = 'none';};
  35. prevBtnText.style.display = 'none';
  36.  
  37. let nextBtn = document.querySelector('.nav-button-next');
  38. let nextBtnText = document.querySelector('.nav-button-next .nav-button-text');
  39. nextBtn.onmouseover = function(){nextBtnText.style.display = '';};
  40. nextBtn.onmouseout = function(){nextBtnText.style.display = 'none';};
  41. nextBtnText.style.display = 'none';
  42.  
  43. let homeBtn = document.querySelector('.nav-button-index');
  44. let homeBtnText = document.querySelector('.nav-button-index .nav-button-text');
  45. let homeBtnIcon = document.querySelector('.nav-button-index .nav-button-icon');
  46. homeBtn.onmouseover = function(){homeBtnText.style.display = '';};
  47. homeBtn.onmouseout = function(){homeBtnText.style.display = 'none';};
  48. homeBtnText.style.cssText = `display:none;line-height:42px;font-size:42px;margin:auto;padding:0 0 0 10px`;
  49. homeBtnIcon.style.cssText = `width:42px;height:42px;line-height:42px;font-size:42px;margin:auto`;
  50. })();

QingJ © 2025

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