PHP Documentation Columnify & Other Improvements

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

As of 17.10.2024. See ბოლო ვერსია.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==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' );