WideView

Удобное чтение хабров +

当前为 2024-06-19 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WideView
  3. // @namespace http://tampermonkey.net/
  4. // @license MIT
  5. // @version 0.1
  6. // @description Удобное чтение хабров +
  7. // @author Prog57
  8. // @match *://*.habr.com/*
  9. // @match *://*.microsoft.com/*
  10. // @match *://*.stackoverflow.com/*
  11. // @icon https://www.google.com/s2/favicons?sz=64&domain=habr.com
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17. const toHide_habr = ".column_sidebar, .layout__navbar, .tm-page__sidebar";
  18. const toHide_stackoverflow = "#sidebar, #left-sidebar";
  19. const toHide = [toHide_habr, toHide_stackoverflow].join(', ');
  20.  
  21. const toWide_habr = ".tm-page__main_has-sidebar";
  22. const toWide_microsoft = ".modular-content-container";
  23. const toWide_stackoverflow = "body > .container, #content, #mainbar";
  24. const toWide = [toWide_habr, toWide_microsoft, toWide_stackoverflow].join(', ');
  25.  
  26. const run = function(){
  27. // debugger;
  28. let els = document.querySelectorAll(toHide) || [];
  29. for (let i = 0; i < els.length; i++) {
  30. //console.log(els[i]);
  31. els[i].style.cssText += 'display: none;';
  32. }
  33.  
  34. els = document.querySelectorAll(toWide) || [];
  35. for (let i = 0; i < els.length; i++) {
  36. els[i].style.cssText += 'max-width: 100%; width: 100%';
  37. }
  38.  
  39. document.querySelectorAll('.page, .layout__body')
  40. .forEach(el => el.style.cssText += 'margin: 0;');
  41. }
  42.  
  43. setTimeout(run, 1000);
  44. })();