User:Ignatzmice/duckduckTitle.js

addOnloadHook(duckduckTitle); function duckduckTitle {		if(wgCanonicalNamespace == "") {			var subjectName; if(wgPageName.charAt(wgPageName.length - 1) == ")")			{				subjectName = wgPageName.substring(0, wgPageName.lastIndexOf("(") - 1); }			else {				subjectName = wgPageName; }			var searchNode = document.createElement("a"); searchNode.href = "https://www.duckduckgo.com/?q=" + encodeURIComponent(subjectName.replace(/_/g, " ")) + "+-site:wikipedia.org"; searchNode.target = "_blank"; searchNode.innerHTML = " Search DuckDuckGo "; document.getElementById("firstHeading").appendChild(searchNode); } }