User:EstherLoer/vector.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; }