Jump to content

User:Rusty Lugnuts/common.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Floathead
importStylesheet('User:Rezonansowy/FloatHead.css');

// Serendipity
// [[User:Mxn/serendipity.js]]
//importScript("User:Mxn/serendipity.js");

// Google Title
$(document).ready(function()
{
		if(mw.config.get('wgCanonicalNamespace') == "")
		{
			var subjectName;
			if(mw.config.get('wgPageName').charAt(mw.config.get('wgPageName').length - 1) == ")")
			{
				subjectName = mw.config.get('wgPageName').substring(0, mw.config.get('wgPageName').lastIndexOf("(") - 1);
			}
			else
			{
				subjectName = mw.config.get('wgPageName');
			}
			var searchNode = document.createElement("a");
			searchNode.href = "http://www.google.com/search?q=" + encodeURIComponent(subjectName.replace(/_/g, " ")) + "+-wikipedia.org";
			searchNode.target = "_blank";
			searchNode.innerHTML = "<span style='font-size:x-small;'>Search Google</span>";
			document.getElementById("firstHeading").appendChild(searchNode);
		}
});