FANDOM


CategoryIcon adds icons to links on category page, where image name = link target. Added images has class "cicon-image" by default.

Settings

Available through window.fng.cicon:

option - defaults - acceptable values
description
debug - false - true/false
some info spammed to console
restrict - true - true/false
run the script only in category: namespace
ext - .png - string
image format (extension)
cls - cicon-image - string
image class, for styling purposes
scale - /scale-to-width-down/50 - string
add scaling request to image path (reduces bandwith usage); last part (50) - size in pixels; use scale="" to disable
iprepend - "" - string
prepend text to image name; result: string+name+ext
iappend - "" - string
append text to image name; result: name+string+ext
tprepend - "" - string
prepend text (span with class "cicon-prepend") to image tag; result: string<img ...>
tappend - "" - string
append text (span with class "cicon-append") to image tag; result: <img ...>string

Example

//create settings object
window.fng = $.extend(window.fng, {cicon:{}});
//set file extension to .svg
window.fng.cicon.ext = '.svg';
//append 'Map ' to all filenames ('Map Earth' etc)
window.fng.cicon.iprepend = 'Map ';
//request downscaling to 50px
window.fng.cicon.scale = '/scale-to-width-down/50';

With settings above the script searches files named "Map link.svg", where "link" is link text, then adds them to links.

Notes

  • Double redirects will not resolved.
  • Image and text are not styled by default. Use classes above to add styling.
  • Settings supposed to be somewhere in common/wikia.js. Script itself - in ImportJS.

Installation

See also: Help:Including additional CSS and JS, Help:Advanced CSS and JS
  • For site-wide use, an administrator can add the line below to the wiki's MediaWiki:ImportJS page.
dev:CategoryIcon/code.js