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

From Moegirlpedia
Jump to: navigation, search
m (// Edit via Wikiplus)
m
Line 1: Line 1:
 
let mwFullPageName = window.location.href.replace(/http(s|):\/\/en.moegirl.org\//,"");
 
let mwFullPageName = window.location.href.replace(/http(s|):\/\/en.moegirl.org\//,"");
 
if(/index\.php/g.test(mwFullPageName)) {
 
if(/index\.php/g.test(mwFullPageName)) {
    let match = /title=(.+?)(?:&|$)/g.exec(mwFullPageName);
+
let array = [...mwFullPageName.matchAll(/title=(.+?)(?:&|$)/g)];
     mwFullPageName = match[match.length - 1];
+
     mwFullPageName = array[array.length - 1][1];
 
} else {
 
} else {
 
mwFullPageName = mwFullPageName.replace(/http(s|):\/\/en.moegirl.org\//,"");
 
mwFullPageName = mwFullPageName.replace(/http(s|):\/\/en.moegirl.org\//,"");

Revision as of 03:55, 28 June 2020

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