WideView

Удаляет боковые панели + растягивает область поста на всю ширину браузера

  1. // ==UserScript==
  2. // @name WideView
  3. // @namespace http://tampermonkey.net/
  4. // @license MIT
  5. // @version 0.1.3.1
  6. // @description Удаляет боковые панели + растягивает область поста на всю ширину браузера
  7. // @author Prog57
  8. // @match *://*.habr.com/*
  9. // @match *://*.microsoft.com/*
  10. // @match *://*.stackoverflow.com/*
  11. // @match *://rus-linux.net/*
  12. // @match *://riptutorial.com/*
  13. // @match *://bitbucket.org/*
  14. // @match *://*.atlassian.net/*
  15. // @icon https://www.google.com/s2/favicons?sz=64&domain=habr.com
  16. // @grant none
  17. // ==/UserScript==
  18.  
  19. (function () {
  20. 'use strict';
  21.  
  22. const apply = function (toWide, toHide, toMatrgin, percent) {
  23. // debugger;
  24. let els = document.querySelectorAll(toHide) || [];
  25. // els.forEach(el => el.style.cssText += 'display: none;');
  26. els.forEach(el => el.remove());
  27.  
  28. percent ||= 100;
  29. els = document.querySelectorAll(toWide) || [];
  30. els.forEach(el => el.style.cssText += `max-width: ${percent}%; width: ${percent}%`);
  31.  
  32. document.querySelectorAll(toMatrgin)
  33. .forEach(el => el.style.cssText += 'margin: 0;');
  34. }
  35.  
  36. const run = function () {
  37. const host = window.location.host;
  38. if (/habr\.com/.test(host)) {
  39. apply(".tm-page__main, .tm-article-presenter, .tm-page-width",
  40. ".column_sidebar, .layout__navbar, .tm-page__sidebar");
  41. }
  42. else if (/-linux\.net/.test(host)) {
  43. apply(null,
  44. "#left_col");
  45. }
  46. else if (/\.microsoft\.com/.test(host)) {
  47. apply(".modular-content-container, #main-column",
  48. "#ms--additional-resources");
  49. }
  50. else if (/stackoverflow\.com/.test(host)) {
  51. apply("body > .container, #content, #mainbar",
  52. "#sidebar, #left-sidebar, #onetrust-banner-sdk");
  53. }
  54. else if (/riptutorial\.com/.test(host)) {
  55. apply(".section-article",
  56. "#cookie-consent, div.section-sidebar");
  57. }
  58. else if (/bitbucket\.org/.test(host)) {
  59. apply(null,
  60. "div.css-19vvwff.ehpgwqe0");
  61. }
  62. else if (/atlassian\.net/.test(host)) {
  63. apply(null,
  64. "div.css-zolx62, link[href*='shared~vendor~atlassian'], script[data-defer-skip]");
  65. }
  66. }
  67.  
  68. setTimeout(run, 1000);
  69. setTimeout(run, 2000);
  70. setTimeout(run, 5000);
  71. })();