Open main menu

Changes

1,607 bytes added ,  10:47, 17 November 2016
no edit summary
Is how to show a '''Font Awesome''' icon. Which looks like this: <i class="fa fa-pull-left fa-rocket" aria-hidden="true"></i>
 
 
== How To ==
Adding Font Awesome used to be an extension that you could install<ref>Extension:FontAwesome has been stagnant since 2014 and the developer has been changing around URLs with the current pay link saying it's "out of stock"!? Really, you ran out of source code?</ref>. However, the source is no longer available, except as a GPL-violating purchase with no source; and the link doesn't even work.
 
Some would say that you can shim into [https://doc.wikimedia.org/mediawiki-core/master/php/classOutputPage.html OutputPage] by calling a hook in your LocalSettings.php
 
<source lang=php>
$wgHooks['BeforePageDisplay'][] ='onBeforePageDisplay';
 
function onBeforePageDisplay( OutputPage &$out, Skin &$skin )
{
$script = '<script type="text/javascript" src="https://use.fontawesome.com/14c71d3de0.js"></script>';
$out->addHeadItem("wowhead script", $script);
return true;
};
</source>
 
But that did not seem effective.
 
Then there is another extension called [[mw:Extension:PhpTags_Widgets]]. But installing that caused a fatal error in my wiki that I didn't have time to debug.
 
Another way to add a script is to modify [[MediaWiki:Common.js]], but I ran into [[#Problems]] with that too.
<source lang=javascript>
/*To add <script src="https://use.fontawesome.com/14c71d3de0.js"></script>
we use load instead of the deprecated importScriptURI */
mw.loader.load('//use.fontawesome.com/14c71d3de0.js');
</source>
 
I'll check into all the recent details of the '[https://www.mediawiki.org/wiki/ResourceLoader ResourceLoader]' mechanism, and write a new extension or update comments here.
=== Problems ===
4,558

edits