ProfessionalWiki / FontAwesome

Allows to insert Font Awesome Free icons in page
https://www.mediawiki.org/wiki/Extension:FontAwesome
GNU General Public License v3.0
4 stars 2 forks source link

Compatibility with MobileFrontend and MinervaNeue #5

Open Ciferlingvulo opened 4 years ago

Ciferlingvulo commented 4 years ago

Hello,

I'm quite new to MediaWiki, and I'm currently trying to set up a wiki. I installed the FontAwesome extension, using Composer, and it works fine on my main Wiki style (Vector). But I also have the MobileFrontend extension installed with MinervaNeue skin. And on the mobile version of the wiki, the icons are not showing up... Am I doing something wrong, or is there an issue somewhere ? I've tried both renderers without any change.

You can check an exemple of an icon use on this page on my wiki : https://wiki.penspinning-france.fr/Modèle:Information (click "Version mobile" on the bottom of the page to switch to mobile display and see the icon vanish).

The additionnal configuration I have in my LocalSettings.php is as follows :

wfLoadSkin( 'MinervaNeue' );
wfLoadExtension( 'MobileFrontend' );
$wgMinervaAlwaysShowLanguageButton = false;

wfLoadExtension( 'Scribunto' );
$wgScribuntoDefaultEngine = 'luastandalone';

$wgGroupPermissions['sysop']['deletelogentry'] = true;
$wgGroupPermissions['sysop']['deleterevision'] = true;

$wgFileExtensions[] = 'svg';
$wgSVGConverter = 'ImageMagick';

wfLoadExtension( 'ParserFunctions' );

$wgFavicon = "$wgResourceBasePath/resources/assets/logo_120x120.png";

$wgCategoryCollation = "uca-fr";

wfLoadExtension( 'Cite' );

wfLoadExtension( 'FontAwesome' );

Thanks for your help!

kghbln commented 4 years ago

It does not surprise me that it is not working with Minerva Neue. Since you are in an early stage of creating your wiki it is probably better to use a mobile and responsive skin by default. I believe FontAwesome should work with Chameleon without issues, other skins would need to be tested.

Ciferlingvulo commented 4 years ago

I will consider that. Chameleon definitely seems to have some interesting features.

But still, it's unfortunate if this kind of extension doesn't work with a skin as common as Minerva Neue (I'm not blaming you, I know it's not always easy, and it might even be Minerva Neue's fault for what I know...).

s7eph4n commented 4 years ago

When I force the skin to MinervaNeue via URL parameter it seems to work: https://wiki.penspinning-france.fr/Mod%C3%A8le:Information?useskin=minerva&debug=true

No idea if it makes a difference if the skin is selected via prefs or URL.

kghbln commented 4 years ago

There is a difference between just Minerva Neue and Minerva Neue + MobileFrontend. Since just Minerva Neue appears to work the issue originates from MobileFrontend.

Ciferlingvulo commented 4 years ago

Thanks for your help.

From what you said I decided to check back the MobileFrontend extension to see if I had missed anything, and indeed, at the bottom of the extension page, there is a title called "For Extension Developers" that I had overlooked because I wasn't the target audience. But it states "By default resource modules in extensions will not be loaded in mobile view", which I believe is the cause of my issue ? With that this extension's authors provided a link to a guide for "Writing a MobileFrontend friendly ResourceLoader module". I read it a little but I'm not sure if there is actually anything that I can do on my end to make the FontAwesome extension work with MobileFrontend extension... It seems to me that they expect the extension to be built a certain way...

Regards.

s7eph4n commented 4 years ago

Rarely have I read such a bullshit as in that "For Extension Developers" article. "We broke your toy to make you think"? WTAF!?

Anyway, as per [1] it should work to add the required target declaration to the FontAwesome modules by adding a line in the foreach loop in ResourceLoaderRegisterModules.php:

$modules[ $name ][ 'targets' ] = ['mobile', 'desktop']

[1] https://www.mediawiki.org/wiki/ResourceLoader/Writing_a_MobileFrontend_friendly_ResourceLoader_module#Enabling_your_existing_modules

Ciferlingvulo commented 4 years ago

Can I / Should I update the file directly in my wiki extensions/ folder ? Or will it mess with the update system ?

s7eph4n commented 4 years ago

This would be a temporary fix that would be overwritten by any update. However, if it works this should become a regular patch, so should be contained in any future version anyway.

Ciferlingvulo commented 4 years ago

I added the line where you said, and it seems to be working :) Thanks again!