Template:Title: Difference between revisions

Jump to navigation Jump to search
RS David (talk | contribs)
m category fix
RS David (talk | contribs)
another attempt at fixing this template
 
Line 1: Line 1:
<includeonly>
<div id="title-meta" style="display: none">{{{1|{{PAGENAME}}}}}</div><div id="title-align" style="display: none">{{#switch:{{{align}}}|right=right|middle|center=center|left}}</div><noinclude>
<div id="title-override" class="topicon" style="float: left; position: absolute; left: 0; top: 0px; width: 100%; padding-top: 5px; display:none">
 
<div style="background: {{#ifeq:{{PAGENAME}}|{{FULLPAGENAME}}|white|#F8FCFF}}; font-size: 200%; padding-top: 0.45em; padding-bottom: 0.1em; position:relative; left:0.45em; color: {{{3|#000000}}}; font-family: {{{2|Arial}}}; font-weight:none;">{{{1|{{FULLPAGENAME}}}}}
Usage examples:
</div></div></includeonly>
*<code><nowiki>{{Title}}</nowiki></code> ''removes namespace''
<noinclude>
*<code><nowiki>{{Title|Foo Bar}}</nowiki></code> ''custom title
This template removes the default title: e.g. Template:Title and replaces it with the text of your choiceYou can also customize the font in which the title is displayed.<br /><br />
*<code><nowiki>{{Title|align=center}}</nowiki></code> ''centered''
==Usage==
*<code><nowiki>{{Title|align=right}}</nowiki></code> ''aligned to the right''
<pre>{{Title|Desired text|(Optional)Desired font}}</pre>
*<code><nowiki>{{Title|Foo Bar|align=center}}</nowiki></code> ''etc''
 
==Using on your wiki==
Paste the following code snippet in your MediaWiki:Common.js
 
<source lang="javascript">
 
// BEGIN JavaScript title rewrite -- jQuery version and new wikia skin fixes by Grunny
function rewriteTitle() {
if( typeof( window.SKIP_TITLE_REWRITE ) != 'undefined' && window.SKIP_TITLE_REWRITE ) {
return;
}
if( $('#title-meta').length == 0 ) {
return;
}
   
var newTitle = $('#title-meta').html();
if( skin == "oasis" ) {
$('header.WikiaPageHeader > h1').html('<div id="title-meta" style="display: inline;">' + newTitle + '</div>');
$('header.WikiaPageHeader > h1').attr('style','text-align:' + $('#title-align').html() + ';');
} else {
$('.firstHeading').html('<div id="title-meta" style="display: inline;">' + newTitle + '</div>');
$('.firstHeading').attr('style','text-align:' + $('#title-align').html() + ';');
}
}
 
// END JavaScript title rewrite
   
addOnloadHook(rewriteTitle);
 
</source>
 


[[Category:Template|{{PAGENAME}}]]
[[Category:Template|{{PAGENAME}}]]
</noinclude>
</noinclude>

Latest revision as of 18:01, 12 June 2013

Usage examples:

  • {{Title}} removes namespace
  • {{Title|Foo Bar}} custom title
  • {{Title|align=center}} centered
  • {{Title|align=right}} aligned to the right
  • {{Title|Foo Bar|align=center}} etc

Using on your wiki

Paste the following code snippet in your MediaWiki:Common.js

<source lang="javascript">

// BEGIN JavaScript title rewrite -- jQuery version and new wikia skin fixes by Grunny

function rewriteTitle() { if( typeof( window.SKIP_TITLE_REWRITE ) != 'undefined' && window.SKIP_TITLE_REWRITE ) { return; }

if( $('#title-meta').length == 0 ) { return; }

var newTitle = $('#title-meta').html(); if( skin == "oasis" ) {

$('header.WikiaPageHeader > h1').html('

' + newTitle + '

');

$('header.WikiaPageHeader > h1').attr('style','text-align:' + $('#title-align').html() + ';'); } else {

$('.firstHeading').html('

' + newTitle + '

');

$('.firstHeading').attr('style','text-align:' + $('#title-align').html() + ';'); } }


// END JavaScript title rewrite

addOnloadHook(rewriteTitle);

</source>