MediaWiki:Thumbwarn.js

Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
/* <pre>  */

//This triggers an alert on contextmenu click (right click) to remind new users that there is a larger version available.
//It sets and tests a cookie so the same user will not see the notice over and over again.
//It is not intended to suppress the context menu.
//It might make sense to disable this for SVG since the thumbs are more useful... but a notice doesn't hurt anyone.


function alertonclick(e) {
    if (checkThumbWarn()!=1) {
    alert('You may Click to access the full-size version. This notice will only be shown once.');
    document.cookie = "SawThumbWarn=True; expires=Thu, 2 Aug 2009 10:10:10 UTC; path=/";
    }
    return 1;
}

function checkThumbWarn() {
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		if (c.replace(/^\s+|\s+$/g,"") == "SawThumbWarn=True") {
                  return 1;
                } 
	}
	return null;
}

function hookimages() {
  if (checkThumbWarn()!=1) {
    for (var i=0; i<document.images.length; i++) document.images[i].onmousedown=alertonclick;
  }
}

$(hookimages);

/* </pre>  */