Greasy Fork

Greasy Fork is available in English.

WideView

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

当前为 2024-08-30 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name            WideView
// @namespace       http://tampermonkey.net/
// @license         MIT
// @version         0.1.2.1
// @description     Удаляет боковые панели + растягивает область поста на всю ширину браузера
// @author          Prog57
// @match           *://*.habr.com/*
// @match           *://*.microsoft.com/*
// @match           *://*.stackoverflow.com/*
// @match           *://rus-linux.net/*
// @match           *://riptutorial.com/*
// @icon            https://www.google.com/s2/favicons?sz=64&domain=habr.com
// @grant           none
// ==/UserScript==

(function () {
    'use strict';

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

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

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

    const run = function () {
        const host = window.location.host;
        if (/habr\.com/.test(host)) {
            apply(".tm-page__main, .tm-article-presenter, .tm-page-width",
                ".column_sidebar, .layout__navbar, .tm-page__sidebar");
        }
        else if (/-linux\.net/.test(host)) {
            apply("", 
                "#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");
        }
    }


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