User:EstherLoer/hide path.js

// This script hides the path to a sub page, and only shows the sub page's title. The path can still be seen below the title. // Not compatible with other title-modifying scripts like distinguish_title.js.

var firstHeading = document.getElementById("firstHeading");

if (	RLCONF.wgAction == "view" // checks whether the user is in viewing mode, as opposed to editing, history, or others.	&& firstHeading.innerHTML.search("/") > -1 // checks whether the title contains a slash	) {	// gets the name of the sub page using a negative lookahead regular expression var subpage_title = firstHeading.innerHTML.substring(firstHeading.innerHTML.search(/(\/)(?:.(?!(\/)))+$/)+1 ); firstHeading.innerHTML = subpage_title; }