GithubHelp home page GithubHelp logo

rheingoldriver / highlightlinksincategory Goto Github PK

View Code? Open in Web Editor NEW

This project forked from labster/highlightlinksincategory

1.0 1.0 0.0 16 KB

Mediawiki Extension: If a link is a member of a category, it gets a custom CSS class

License: MIT License

PHP 100.00%

highlightlinksincategory's Introduction

Highlight Links in Category

A Mediawiki Extension: If a link is a member of a category, it gets a custom CSS class.

You can add as many of these as you want, but from a UX perspective it's probably not awesome to add 500 different style links.

Requirements

Mediawiki 1.25 probably, but only tested on 1.26 and above. Theoretically can work on 1.12 but might require some changes.

Installation

Make sure that this directory is installed in mediawiki/extensions (or wherever your custom extension directory is.

Then, add this to LocalSettings.php:

	wfLoadExtension( 'HighlightLinksInCategory' );
	$wgHighlightLinksInCategory = array(
	    "Disambiguation_pages" => 'disambig',
	    "Templates" => 'templates',
	);

Configuration

The global variable $wgHighlightLinksInCategory is an array that configures which categories get an added CSS class. The keys are the Category names, which must include underscores instead of spaces. Do not include the Category: namespace. The value for each key is the CSS class you would like to add to that category. If you want add more than one class, separate the class names with spaces, like:

$wgHighlightLinksInCategory = array( "My_Cat" => "class1 class2 class3" );

If $wgHighlightLinksInCategory is not set or empty, this extension will do nothing.

Styling

Simply add the styles you need for these links to Mediawiki:Common.css on your wiki. For example:

	a.disambig {
		color: rebeccapurple
	}
	a.templates {
		font-weight: bold;
		background-color: #efe;
	}

If you want one category to override another, you'll have to specify it with CSS.

	a.templates.disambig {
		font-weight: normal;
		background-color: transparent;
		color: rebeccapurple;
	}

Or alternatively, you could have defined the original a.templates rule as a.templates:not(.disambig) instead.

There's also the link icon approach:

	a.superlink {
		background-image: url(super.png);
		padding-left: 16px;
	}

License

MIT. See LICENSE for details.

Have the appropriate amount of fun!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.