Difference between revisions of "MediaWiki:Common.js"
From PCGamingWiki, the wiki about fixing PC games
Line 3: | Line 3: | ||
var $this = $(this); | var $this = $(this); | ||
if ($this.attr('id') !== undefined) { | if ($this.attr('id') !== undefined) { | ||
− | $('<span> | + | $('<span>- </span><a></a>').text('Link here').attr({title: 'Link here', href: '#'+$this.attr('id')}).wrap('<span class="mw-linkhere"></span>').appendTo(this); |
} | } | ||
}); | }); |
Revision as of 14:28, 11 September 2012
function addAnchorInHeaders() { $('span.mw-headline', '#mw-content-text').each(function() { var $this = $(this); if ($this.attr('id') !== undefined) { $('<span>- </span><a></a>').text('Link here').attr({title: 'Link here', href: '#'+$this.attr('id')}).wrap('<span class="mw-linkhere"></span>').appendTo(this); } }); } $(addAnchorInHeaders);