WideView

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

目前為 2024-06-20 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

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

(function() {
    'use strict';
    const toHide_habr = ".column_sidebar, .layout__navbar, .tm-page__sidebar";
    const toHide_microsoft = "#ms--additional-resources";
    const toHide_stackoverflow = "#sidebar, #left-sidebar";
    const toHide = [toHide_habr, toHide_microsoft, toHide_stackoverflow].join(', ');

    const toWide_habr = ".tm-page__main_has-sidebar, .tm-article-presenter";
    const toWide_microsoft = ".modular-content-container, #main-column";
    const toWide_stackoverflow = "body > .container, #content, #mainbar";
    const toWide = [toWide_habr, toWide_microsoft, toWide_stackoverflow].join(', ');

    const run = function(){
        // debugger;
        let els = document.querySelectorAll(toHide) || [];
        for (let i = 0; i < els.length; i++) {
            //console.log(els[i]);
            els[i].style.cssText += 'display: none;';
        }

        els = document.querySelectorAll(toWide) || [];
        for (let i = 0; i < els.length; i++) {
            els[i].style.cssText += 'max-width: 100%; width: 100%';
        }

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

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