WideView

Removes sidebars + stretches post area to full browser width

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name            WideView
// @namespace       http://tampermonkey.net/
// @license         MIT
// @version         0.1.3.4
// @description     Removes sidebars + stretches post area to full browser width
// @description:ru  Удаляет боковые панели + растягивает область поста на всю ширину браузера
// @author          Prog57
// @match           *://*.habr.com/*
// @match           *://*.microsoft.com/*
// @match           *://*.stackoverflow.com/*
// @match           *://rus-linux.net/*
// @match           *://riptutorial.com/*
// @match           *://bitbucket.org/*
// @match           *://*.atlassian.net/*
// @match           *://github.com/*
// @match           *://pikabu.ru/*
// @icon            https://www.google.com/s2/favicons?sz=64&domain=habr.com
// @grant           none
// ==/UserScript==

(function () {
    'use strict';

    const apply = function (toWide, toHide, toMargin, toPadding, percent) {
        // debugger;
        let els = document.querySelectorAll(toHide) || [];
        // els.forEach(el => el.style.cssText += 'display: none;');
        els.forEach(el => el.remove());

        percent ||= 100;
        els = document.querySelectorAll(toWide) || [];
        els.forEach(el => el.style.cssText += `max-width: ${percent}%; width: ${percent}%`);

        els = document.querySelectorAll(toMargin) || [];
        // els.forEach < Element > (el => el.style.cssText += 'margin: 0, auto;'); не всегда работает
        els.forEach(el => {
            el.style.marginLeft = 'auto';
            el.style.marginRight = 'auto';
        });

        document.querySelectorAll(toPadding)
            .forEach(el => el.style.cssText += 'padding: 0;');
    }

    const run = function () {
        const host = window.location.host;
        if (/habr\.com/.test(host)) {
            apply(".tm-page-width, .tm-page__main_has-sidebar, .tm-article-presenter",
                ".column_sidebar, .layout__navbar, .tm-page__sidebar",
                null,
                ".tm-page-width"
            );
        }
        else if (/-linux\.net/.test(host)) {
            apply(null,
                "#left_col");
        }
        else if (/microsoft\.com/.test(host)) {
            apply(".modular-content-container, #main-column",
                "#ms--additional-resources");
        }
        else if (/stackoverflow\.com/.test(host)) {
            apply("body > .container, #content, #mainbar",
                "#sidebar, #left-sidebar, #onetrust-banner-sdk");
        }
        else if (/riptutorial\.com/.test(host)) {
            apply(".section-article",
                "#cookie-consent, div.section-sidebar");
        }
        else if (/bitbucket\.org/.test(host)) {
            apply(null,
                "#_r10_");
        }
        else if (/atlassian\.net/.test(host)) {
            apply(null,
                "div.css-zolx62, link[href*='shared~vendor~atlassian'], script[data-defer-skip], .css-17lamoy, div[id*='page-layout.banner']");
        }
        else if (/github\.com/.test(host)) {
            apply(".container-xl, .markdown-body",
                null,
                ".react-repos-overview-margin"
            );
        }
        else if (/pikabu\.ru/.test(host)) {
            apply(".app__inner, .main",
                ".sidebar"
            );
        }
    }

    setTimeout(run, 1000);
    setTimeout(run, 2000);
})();