Backpack

Adjusts the layout of backpack docs to make it more laptop-friendly

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name        Backpack
// @namespace   urn://https://www.georgegillams.co.uk/greasemonkey/backpack_docs
// @include     *backpack.github.io*
// @exclude     none
// @version     5
// @description:en	Adjusts the layout of backpack docs to make it more laptop-friendly
// @grant    		none
// @description Adjusts the layout of backpack docs to make it more laptop-friendly
// ==/UserScript==

let lastModifiedUrl = null;

function fixNavs() {
  const allElements = document.getElementsByTagName('NAV');
  for (let i = 0; i < allElements.length; i += 1) {
    const element = allElements[i];
    const elementClassName = `${element.className}`;
    if (elementClassName.includes('bpkdocs-sidebar-')) {
      element.style.minWidth = '10rem';
      element.style.padding = '3.75rem 2rem';
    }
  }
}

function fixImgs() {
  const allElements = document.getElementsByTagName('IMG');
  for (let i = 0; i < allElements.length; i += 1) {
    const element = allElements[i];
    const elementClassName = `${element.className}`;
    if (elementClassName.includes('bpkdocs-sections-list__heading-icon-')) {
      element.style.marginRight = '1rem';
    }
  }
}

function fixHeroImgs() {
  const allElements = document.getElementsByTagName('DIV');
  for (let i = 0; i < allElements.length; i += 1) {
    const element = allElements[i];
    const elementClassName = `${element.className}`;
    if (elementClassName.includes('bpkdocs-main-hero-image')) {
      element.style.maxHeight = '10rem';
    }
  }
}

function fixAll() {
  const currentUrl = `${window.location}`;
  if (currentUrl === lastModifiedUrl) {
    return;
  }
  fixNavs();
  fixImgs();
  fixHeroImgs();
  lastModifiedUrl = currentUrl;
}

fixAll();
setInterval(fixAll, 500);