PHP Documentation Columnify & Other Improvements

View the PHP document front page in a multi-column layout and some other small improvements.

Stan na 17-10-2024. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         PHP Documentation Columnify & Other Improvements
// @version      2.0
// @description  View the PHP document front page in a multi-column layout and some other small improvements.
// @author       Shakil Shahadat
// @match        https://www.php.net/manual/*/
// @match        https://www.php.net/manual/*/index.php
// @namespace    https://greasyfork.org/en/users/6404-shakil
// ==/UserScript==

'use strict';

// Multi-column layout
document.querySelector( '.chunklist' ).style.WebkitColumnCount = 5;
document.querySelector( '.chunklist' ).style.MozColumnCount = 5;
document.querySelector( '.chunklist' ).style.ColumnCount = 5;

document.querySelector( '.chunklist' ).style.WebkitColumnRuleStyle = 'dotted';
document.querySelector( '.chunklist' ).style.MozColumnRuleStyle = 'dotted';
document.querySelector( '.chunklist' ).style.ColumnRuleStyle = 'dotted';

document.querySelector( '.chunklist' ).style.WebkitColumnRuleWidth = '1px';
document.querySelector( '.chunklist' ).style.MozColumnRuleWidth = '1px';
document.querySelector( '.chunklist' ).style.ColumnRuleWidth = '1px';

// Hide unnecessary segments
for ( let e of [ '.headsup', '.page-tools', '.info', '.contribute', '#usernotes', 'footer' ] )
{
	document.querySelector( e ).style.display = 'none';
}

// Keep the header where it should be
document.querySelector( 'nav' ).style.position = 'absolute';

// Widen the layout
document.querySelector( '#layout' ).style.width = '100%';

// Add target="_blank" to all anchor tags, v 2.1
for ( let x of document.links ) x.setAttribute( 'target', '_blank' );