Difference between revisions of "User:One-Six/fullpagename.js"

From Moegirlpedia
Jump to: navigation, search
m
m (change to function)
Line 1: Line 1:
let mwFullPageName = window.location.href.replace(/http(s|):\/\/en.moegirl.org\//,"");
+
const hrefFullPageNamee = () => {
if(/index\.php/g.test(mwFullPageName)) {
+
let fullPageNamee = window.location.href.replace(/http(s|):\/\/en.moegirl.org\//,"");
let array = [...mwFullPageName.matchAll(/title=(.+?)(?:&|$)/g)];
+
if(/index\.php/g.test(fullPageNamee)) {
    mwFullPageName = array[array.length - 1][1];
+
let array = [...fullPageNamee.matchAll(/title=(.+?)(?:&|$)/g)];
} else {
+
        fullPageNamee = array[array.length - 1][1];
mwFullPageName = mwFullPageName.replace(/http(s|):\/\/en.moegirl.org\//,"");
+
}
}
+
return fullPageNamee.replace(/#.+$/,"");
mwFullPageName = mwFullPageName.replace(/#.+$/,"");
+
//console.log("FULLPAGENAME:"+fullPageNamee);
console.log("FULLPAGENAME:"+mwFullPageName);
+
};

Revision as of 04:21, 28 June 2020

const hrefFullPageNamee = () => {
	let fullPageNamee = window.location.href.replace(/http(s|):\/\/en.moegirl.org\//,"");
	if(/index\.php/g.test(fullPageNamee)) {
		let array = [...fullPageNamee.matchAll(/title=(.+?)(?:&|$)/g)];
        fullPageNamee = array[array.length - 1][1];
	}
	return fullPageNamee.replace(/#.+$/,"");
	//console.log("FULLPAGENAME:"+fullPageNamee);
};