Read The Docs More

Close Pesky Side Navigation in Read The Docs

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Read The Docs More
// @namespace    https://qria.net/
// @version      0.1
// @description  Close Pesky Side Navigation in Read The Docs
// @author       Qria
// @match        *://*/*
// @icon         https://www.google.com/s2/favicons?domain=h5py.org
// @grant        none
// ==/UserScript==


window.addEventListener('load', function() {
    'use strict';

    const wyNavSide = document.querySelector(".wy-nav-side");
    const wySideNavSearch = document.querySelector(".wy-side-nav-search");
    const wyNavContent = document.querySelector(".wy-nav-content");
    const wyNavContentWrap = document.querySelector(".wy-nav-content-wrap");

    if (wyNavSide == null || wySideNavSearch == null || wyNavContent == null || wyNavContentWrap == null) {
        // this site is not a Read the Docs site.
        return;
    }

    console.log('Loaded Userscript: Read The Docs More');

    // setup close button
    wySideNavSearch.style.position = 'relative';
    wySideNavSearch.insertAdjacentHTML('afterbegin', `<button style="
        position: absolute;
        right: 10px;
        top: 10px;
        background: none;
        border: none;
        color: white;
        font-size: 20px;
    " id="userscript-close-button">×</button>`);
    const userscriptCloseButton = document.querySelector("#userscript-close-button");

    userscriptCloseButton.addEventListener('click', event => {
        wyNavContentWrap.style.marginLeft = 0;
        wyNavSide.style.display = 'none';
        wyNavContent.style.maxWidth = 'none';
    });
}, false);