MediaWiki:Email link.js

From Wikinews, the free news source you can write!
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: hold Ctrl while clicking Refresh, or press Ctrl-F5; Konqueror: simply click the Reload button, or press F5; Opera users may need to completely clear their cache in Tools→Preferences. — More skins

// created by [[pl:user:Beau]]. Copied from odder's js as it got deleted there. I think somebody still uses this
//add mw.loader.load( '/w/index.php?title=' + "MediaWiki:Email_link.js" + '&action=raw&ctype=text/javascript' ); to your [[special:mypage/monobook.js]]

$(function() {
	if (mw.config.get('wgNamespaceNumber') !== 0)
		return;
	if (mw.config.get('wgAction') != "view")
		return;

	var subject = 'Read a great article "' + mw.config.get('wgTitle') + '" on the English Wikinews!';
	var body = "Hi!\n\nThere's a great article on the English Wikinews I think you will consider interesting.  See " + document.location + " for more.";
	var link = document.createElement('a');
	link.appendChild(document.createTextNode('E-mail this page'));
	link.href = "mailto:?subject=" + encodeURIComponent(subject) + "&body=" + encodeURIComponent(body);

	var li = document.createElement('li');
	li.appendChild(link);

	var tools = document.getElementById("t-permalink").parentNode;
	tools.appendChild(li);
});