MediaWiki talk:SearchIcons.js

The iconMap cannot be easily overriden with the current code. Ideally, for allow local sites to override certain parts of the code, it should be coded like this:

// private variables with the default values var _iconMap = [ // URL to image, then one space, then the name of the article 'http://upload.wikimedia.org/wikipedia/commons/9/94/Empty_search_icon.png Emptiness' ];

// Check for local customizations. Checks for global variable window.SearchIcons_iconMap first, then fallback to the default SearchIcons._iconMap var lines = (window.SearchIcons_iconMap || SearchIcons._iconMap);

Then, for overriding on a local wiki, first declare the var window.SearchIcons_iconMap and then import the script:

window.SearchIcons_iconMap = [ /* whatever */ ]; importScriptURI('http://www.mediawiki.org/w/index.php?title=MediaWiki:SearchIcons.js&action=raw&ctype=text/javascript');

Note: variable names are just an example. The defaults don't need to be private, but prevent people from trying to override them the wrong way. --Ciencia Al Poder 20:49, 27 October 2011 (UTC)