User:Kku/Scripts/BacklinkTitle.js

/*replace Data visualization in https://en.wikipedia.org/wiki/Data_visualization by Data visualization /* BUGS: 1. does not work with firstChild.nodeValue italic titles, these will vanish (nesting!!) workaround found. will eradicate italics... 2. ... $(document).ready(function { console.log('backlinks.js'); //console.log(mw.config.get("wgCanonicalNamespace")); //console.log(mw.config.get("wgAction")); //console.log(mw.config.get("wgArticleId"));

if (mw.config.get("wgCanonicalNamespace") == "") // (true) {

if (mw.config.get("wgAction") == "view") { var pageName = mw.config.get("wgPageName"); var hd = document.getElementById("firstHeading"); var hdchild=hd.firstchild; var pagtit=hd.getElementsByClassName('mw-page-title-main'); var hdtxt= pagtit[0] ? pagtit[0].innerHTML : ''; //console.log('mw.config.get("wgPageName") '+pageName); //console.log('mw-page-title-main '+hdtxt); var searchNode = document.createElement("a"); searchNode.innerHTML = hdtxt; searchNode.setAttribute('href', '/wiki/Special:WhatLinksHere/' + encodeURIComponent(hdtxt)); if ( pagtit[0] ) { pagtit[0].textContent=''; pagtit[0].appendChild(searchNode); }    }    } });