mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-30 17:14:50 +00:00
Merge pull request #163 from StarCitizenTools/dev
Various improvement and bug fixes
This commit is contained in:
commit
596423753f
|
@ -9,7 +9,7 @@ Live demo can be seen at the [Star Citizen Wiki](https://starcitizen.tools), mor
|
||||||
* **Fully responsive skin**: Responsive and able to adapt to different screen sizes. 📱💻🖥️
|
* **Fully responsive skin**: Responsive and able to adapt to different screen sizes. 📱💻🖥️
|
||||||
* **Persistent ToC**: Access ToC anywhere in the article. ***Tracking require JS.*** 🔍📖
|
* **Persistent ToC**: Access ToC anywhere in the article. ***Tracking require JS.*** 🔍📖
|
||||||
* **Rich search suggestions**: More helpful search suggestions with images and descriptions. ***Require JS.*** 🔍👀
|
* **Rich search suggestions**: More helpful search suggestions with images and descriptions. ***Require JS.*** 🔍👀
|
||||||
* **Lazyload images**: Improve load time of your wiki and avoid unnessecary image downloads. ***Require JS.*** 🚀
|
* **Lazyload images**: Improve load time of your wiki and avoid unnecessary image downloads. ***Require JS.*** 🚀
|
||||||
* **Native light/dark mode support**: Respect OS and app configuration for light and dark mode. ☀️🌙
|
* **Native light/dark mode support**: Respect OS and app configuration for light and dark mode. ☀️🌙
|
||||||
* **Webapp manifest**: Give a more app-like experience when user add your wiki to their home screen. 📱
|
* **Webapp manifest**: Give a more app-like experience when user add your wiki to their home screen. 📱
|
||||||
* **HTTP security response headers**: Enhance the security of your wiki from HTTP response headers. 🔒🔑
|
* **HTTP security response headers**: Enhance the security of your wiki from HTTP response headers. 🔒🔑
|
||||||
|
@ -27,8 +27,8 @@ wfLoadSkin( 'Citizen' );
|
||||||
The config flags allow more customization on the specific features in the skin.
|
The config flags allow more customization on the specific features in the skin.
|
||||||
|
|
||||||
Note that:
|
Note that:
|
||||||
* By default all security-related features are turned off to ensure maximum compatiability.
|
* By default, all security-related features are turned off to ensure maximum compatibility.
|
||||||
* If you have a lot of users that does not use javascript, it is recommended to turn off image lazyload as it requires javascript to display images properly.
|
* If you have a lot of users that do not use javascript, it is recommended to turn off lazyloading of images as it requires javascript to display images properly.
|
||||||
|
|
||||||
### Search suggestions
|
### Search suggestions
|
||||||
Name | Description | Values | Default
|
Name | Description | Values | Default
|
||||||
|
|
|
@ -84,6 +84,7 @@ class CitizenHooks {
|
||||||
} catch ( ConfigException $e ) {
|
} catch ( ConfigException $e ) {
|
||||||
wfLogWarning( sprintf( 'Could not get config for "$wgThumbnailSize". Defaulting to "10". %s',
|
wfLogWarning( sprintf( 'Could not get config for "$wgThumbnailSize". Defaulting to "10". %s',
|
||||||
$e->getMessage() ) );
|
$e->getMessage() ) );
|
||||||
|
$lazyloadEnabled = true;
|
||||||
$thumbSize = 10;
|
$thumbSize = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs the entire contents of the page
|
* Outputs the entire contents of the page
|
||||||
|
* @throws MWException
|
||||||
*/
|
*/
|
||||||
public function execute() {
|
public function execute() {
|
||||||
// Naming conventions for Mustache parameters:
|
// Naming conventions for Mustache parameters:
|
||||||
|
@ -128,6 +129,8 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
* Render the navigation drawer
|
* Render the navigation drawer
|
||||||
* Based on Vector (be3843e)
|
* Based on Vector (be3843e)
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws MWException
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function buildDrawer() : array {
|
private function buildDrawer() : array {
|
||||||
$skin = $this->getSkin();
|
$skin = $this->getSkin();
|
||||||
|
@ -156,7 +159,7 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
// The language portal will be added provided either
|
// The language portal will be added provided either
|
||||||
// languages exist or there is a value in html-after-portal
|
// languages exist or there is a value in html-after-portal
|
||||||
// for example to show the add language wikidata link (T252800)
|
// for example to show the add language wikidata link (T252800)
|
||||||
if ( count( $languages ) || $portal['html-after-portal'] ) {
|
if ( $portal['html-after-portal'] || count( $languages ) ) {
|
||||||
$props[] = $portal;
|
$props[] = $portal;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -220,9 +223,10 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
* TODO: Use standardize classes and IDs
|
* TODO: Use standardize classes and IDs
|
||||||
* TODO: Rebuild icon function based on Desktop Improvement Project
|
* TODO: Rebuild icon function based on Desktop Improvement Project
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws MWException
|
||||||
*/
|
*/
|
||||||
private function buildLogo() : array {
|
private function buildLogo() : array {
|
||||||
$props = [
|
return [
|
||||||
'msg-sitetitle' => $this->getMsg( 'sitetitle' )->text(),
|
'msg-sitetitle' => $this->getMsg( 'sitetitle' )->text(),
|
||||||
'html-mainpage-attributes' => Xml::expandAttributes(
|
'html-mainpage-attributes' => Xml::expandAttributes(
|
||||||
Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) + [
|
Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) + [
|
||||||
|
@ -230,14 +234,13 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
return $props;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Echo notification badges and ULS button
|
* Echo notification badges and ULS button
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getExtratools() {
|
private function getExtratools(): array {
|
||||||
$personalTools = $this->getPersonalTools();
|
$personalTools = $this->getPersonalTools();
|
||||||
|
|
||||||
// Create the Echo badges and ULS
|
// Create the Echo badges and ULS
|
||||||
|
@ -264,6 +267,7 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
* Render the search box
|
* Render the search box
|
||||||
* TODO: Use standardized classes and IDs
|
* TODO: Use standardized classes and IDs
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws MWException
|
||||||
*/
|
*/
|
||||||
private function buildSearchbox() : array {
|
private function buildSearchbox() : array {
|
||||||
$config = $this->config;
|
$config = $this->config;
|
||||||
|
@ -271,7 +275,7 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
$toggleMsg = $this->getMsg( 'citizen-search-toggle' )->text();
|
$toggleMsg = $this->getMsg( 'citizen-search-toggle' )->text();
|
||||||
$accessKey = Linker::accesskey( 'search' );
|
$accessKey = Linker::accesskey( 'search' );
|
||||||
|
|
||||||
$props = [
|
return [
|
||||||
'msg-citizen-search-toggle' => $toggleMsg,
|
'msg-citizen-search-toggle' => $toggleMsg,
|
||||||
'msg-citizen-search-toggle-shortcut' => $toggleMsg . ' [alt-shift-' . $accessKey . ']',
|
'msg-citizen-search-toggle-shortcut' => $toggleMsg . ' [alt-shift-' . $accessKey . ']',
|
||||||
'form-action' => $config->get( 'Script' ),
|
'form-action' => $config->get( 'Script' ),
|
||||||
|
@ -281,7 +285,6 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
'html-random-href' => Skin::makeSpecialUrl( 'Randompage' ),
|
'html-random-href' => Skin::makeSpecialUrl( 'Randompage' ),
|
||||||
'msg-random' => $this->getMsg( 'Randompage' )->text(),
|
'msg-random' => $this->getMsg( 'Randompage' )->text(),
|
||||||
];
|
];
|
||||||
return $props;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -292,9 +295,9 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
* * 'login': only visible if logged in (string)
|
* * 'login': only visible if logged in (string)
|
||||||
* * 'permission-*': only visible if user has permission
|
* * 'permission-*': only visible if user has permission
|
||||||
* e.g. permission-edit = only visible if user can edit pages
|
* e.g. permission-edit = only visible if user can edit pages
|
||||||
* @return string html
|
* @return array html
|
||||||
*/
|
*/
|
||||||
protected function buildPageTools() {
|
protected function buildPageTools(): array {
|
||||||
$config = $this->config;
|
$config = $this->config;
|
||||||
$skin = $this->getSkin();
|
$skin = $this->getSkin();
|
||||||
$condition = $config->get( 'CitizenShowPageTools' );
|
$condition = $config->get( 'CitizenShowPageTools' );
|
||||||
|
@ -341,7 +344,7 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render page-related links at the bottom
|
* Render page-related links at the bottom
|
||||||
* @return string html
|
* @return array html
|
||||||
*/
|
*/
|
||||||
private function buildPageLinks() : array {
|
private function buildPageLinks() : array {
|
||||||
$contentNavigation = $this->data['content_navigation'];
|
$contentNavigation = $this->data['content_navigation'];
|
||||||
|
@ -357,12 +360,10 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
$variantshtml[ 'label-class' ] .= 'screen-reader-text';
|
$variantshtml[ 'label-class' ] .= 'screen-reader-text';
|
||||||
}
|
}
|
||||||
|
|
||||||
$props = [
|
return [
|
||||||
'data-namespaces' => $namespaceshtml,
|
'data-namespaces' => $namespaceshtml,
|
||||||
'data-variants' => $variantshtml,
|
'data-variants' => $variantshtml,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $props;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -373,11 +374,9 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
$lastMod = null;
|
$lastMod = null;
|
||||||
$footerLinks = $this->getFooterLinks();
|
$footerLinks = $this->getFooterLinks();
|
||||||
|
|
||||||
if ( isset( $footerLinks['info'] ) ) {
|
if ( isset( $footerLinks['info'] ) && in_array( 'lastmod', $footerLinks['info'], true ) ) {
|
||||||
if ( in_array( 'lastmod', $footerLinks['info'] ) ) {
|
$key = array_search( 'lastmod', $footerLinks['info'], true );
|
||||||
$key = array_search( 'lastmod', $footerLinks['info'] );
|
$lastMod = $this->get( $footerLinks['info'][$key], '' );
|
||||||
$lastMod = $this->get( $footerLinks['info'][$key], '' );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $lastMod;
|
return $lastMod;
|
||||||
|
@ -502,7 +501,7 @@ class CitizenTemplate extends BaseTemplate {
|
||||||
$props['html-after-portal'] = $this->getAfterPortlet( $label );
|
$props['html-after-portal'] = $this->getAfterPortlet( $label );
|
||||||
|
|
||||||
// Mark the portal as empty if it has no content
|
// Mark the portal as empty if it has no content
|
||||||
$class = ( count( $urls ) == 0 && !$props['html-after-portal'] )
|
$class = ( count( $urls ) === 0 && !$props['html-after-portal'] )
|
||||||
? ' mw-portal-empty' : '';
|
? ' mw-portal-empty' : '';
|
||||||
$props['class'] = $class;
|
$props['class'] = $class;
|
||||||
return $props;
|
return $props;
|
||||||
|
|
|
@ -27,7 +27,7 @@ use ApiFormatJson;
|
||||||
use ApiResult;
|
use ApiResult;
|
||||||
use ConfigException;
|
use ConfigException;
|
||||||
use Exception;
|
use Exception;
|
||||||
use MWHttpRequest;
|
use MediaWiki\MediaWikiServices;
|
||||||
use Title;
|
use Title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,7 +83,9 @@ class ApiWebappManifest extends ApiBase {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = MWHttpRequest::factory( $appleTouchIconUrl );
|
$request = MediaWikiServices::getInstance()
|
||||||
|
->getHttpRequestFactory()
|
||||||
|
->create( $appleTouchIconUrl );
|
||||||
$request->execute();
|
$request->execute();
|
||||||
$appleTouchIconContent = $request->getContent();
|
$appleTouchIconContent = $request->getContent();
|
||||||
|
|
||||||
|
|
|
@ -155,3 +155,31 @@
|
||||||
box-shadow: 0 19px 38px rgba( 0, 0, 0, 0.075 ), 0 15px 12px rgba( 0, 0, 0, 0.055 ); // Dialogs
|
box-shadow: 0 19px 38px rgba( 0, 0, 0, 0.075 ), 0 15px 12px rgba( 0, 0, 0, 0.055 ); // Dialogs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Borrowed from Mediawiki core 1.35
|
||||||
|
// “Clearfix Reloaded” Mixin
|
||||||
|
// The mixin is used on a container with floating children.
|
||||||
|
// Margin collapsing is a feature, not a bug, hence relying on `display: block` as default.
|
||||||
|
// With `.mixin-clearfix( @collapse: false; );` you call it to let `margin`s not collapse.
|
||||||
|
// See https://www.cssmojo.com/the-very-latest-clearfix-reloaded/
|
||||||
|
// In future we might replace the `&:after` pseudo-element with
|
||||||
|
// `display: flow-root;` altogether.
|
||||||
|
// Support: Firefox 3.5+, Safari 4+, Chrome, Opera 15+, IE 8+
|
||||||
|
.mixin-clearfix( @collapse: true ) {
|
||||||
|
&:after {
|
||||||
|
clear: both;
|
||||||
|
// Margin collapsing as feature. Apply it.
|
||||||
|
& when ( @collapse ) {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Margin collapsing as bug. Prevent it.
|
||||||
|
& when not ( @collapse ) {
|
||||||
|
&:before,
|
||||||
|
&:after {
|
||||||
|
content: '';
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -144,6 +144,7 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
.content-center;
|
.content-center;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
|
.mixin-clearfix();
|
||||||
|
|
||||||
p {
|
p {
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "Citizen",
|
"name": "Citizen",
|
||||||
"namemsg": "skinname-citizen",
|
"namemsg": "skinname-citizen",
|
||||||
"version": "0.9.3",
|
"version": "0.9.4",
|
||||||
"author": [
|
"author": [
|
||||||
"[https://www.mediawiki.org/wiki/User:Alistair3149 Alistair3149]",
|
"[https://www.mediawiki.org/wiki/User:Alistair3149 Alistair3149]",
|
||||||
"[https://www.mediawiki.org/wiki/User:Octfx Octfx]"
|
"[https://www.mediawiki.org/wiki/User:Octfx Octfx]"
|
||||||
|
|
Loading…
Reference in a new issue