Greasy Fork is available in English.

Geeksforgeeks browse improve all in one

Geeksforgeeks browse improve ultra

  1. // ==UserScript==
  2. // @name Geeksforgeeks browse improve all in one
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Geeksforgeeks browse improve ultra
  6. // @author fvydjt
  7. // @match https://www.geeksforgeeks.org/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=geeksforgeeks.org
  9. // @grant GM_addStyle
  10. // ==/UserScript==
  11.  
  12. let content = document.querySelector('.leftBar');
  13. let sidebar = document.querySelector('.sidebar_wrapper');
  14. sidebar.style.cssText = 'display:auto';
  15. let btn;
  16.  
  17. let toggle = () => {
  18. let mark = document.querySelector('#btn');
  19. if (mark.innerText == '<') {
  20. sidebar.style.cssText = 'display:none';
  21. content.setAttribute('style', 'min-width: calc(100%) !important;');
  22. mark.innerText = '>';
  23. btn.style.left = '0px';
  24. } else if (mark.innerText == '>') {
  25. sidebar.style.cssText = 'display:auto';
  26. content.setAttribute('style', 'min-width: calc(80%) !important;');
  27. mark.innerText = '<';
  28. btn.style.left = '238px';
  29. }
  30. };
  31.  
  32. (function () {
  33. 'use strict';
  34. let cancelSticky = `
  35. .make_sticky {
  36. position: initial !important;
  37. }
  38. `;
  39. let sidebarChangeStyle = `
  40. .sidebar_wrapper {
  41. border:solid;
  42. border-color:white black white white;
  43. }
  44. `;
  45. // unfold the list
  46. let sidebarChangeHeight = `
  47. .sideBar {
  48. height:100% !important;
  49. }
  50. `;
  51. let cancelHeaderSticky = `
  52. .header-main__slider {
  53. position:initial !important;
  54. }
  55. `;
  56. GM_addStyle(cancelSticky);
  57. GM_addStyle(sidebarChangeStyle);
  58. GM_addStyle(sidebarChangeHeight);
  59. GM_addStyle(cancelHeaderSticky);
  60.  
  61. // init text area width
  62. content.setAttribute('style', 'min-width: calc(80%) !important;');
  63.  
  64. // remove ads in article
  65. let ads = document.querySelectorAll('.inArticleAds');
  66. for (let i = 0; i < ads.length; i++) {
  67. ads.outerHTML = '';
  68. }
  69.  
  70. // create button for menu control
  71. let body = document.querySelector('body');
  72. btn = document.createElement('div');
  73. btn.setAttribute('id', 'btn');
  74. btn.style.cssText = 'position: fixed;z-index: 1;left: 238px;top: 300px;width: 20px;height: 30px;background: #308d46;font-size: 18px;border-radius: 0% 100% 100% 0%;padding-left: 2px;padding-top: 4px;font-weight: bold;color: #cddc39;user-select:none;';
  75. // btn.setAttribute('style', 'position: fixed;z-index: 1;left: 238px;top: 300px;width: 20px;height: 30px;background: #308d46;font-size: 18px;border-radius: 0% 100% 100% 0%;padding-left: 2px;padding-top: 4px;font-weight: bold;color: #cddc39;user-select:none;');
  76. let text_in = document.createTextNode('<');
  77. btn.appendChild(text_in);
  78. body.appendChild(btn);
  79.  
  80. btn.addEventListener('click', toggle);
  81.  
  82. // right bar remove
  83. document.getElementById('.rightBar').style.display = "none";
  84.  
  85. // Stop GeeksForGeeks from opening its stupid login modal
  86. // author: https://github.com/khang06
  87. localStorage.setItem("gfgViewCount", 0);
  88. localStorage.setItem("guestPageCount", 0);
  89.  
  90. })();