Extension:PersonalizarApariencias

This page is a translated version of the page Extension:SkinCustomiser and the translation is 33% complete.
Manual de extensiones de MediaWiki
SkinCustomiser
Estado de lanzamiento: estable
Implementación Piel , MyWiki , Gancho
Descripción Personaliza las apariencias existentes. Añadir Scripts y Metadatos justo antes de la etiqueta ‎</head> del wiki.
Autor(es) WikiMANNia (WikiForMendiscusión)
Última versión 2.1.0 (2024-04-20)
MediaWiki 1.25+
PHP 5.4+
Cambios de la base de datos No
Licencia GNU Licencia Pública general 2.0 o posterior
Descarga

  • $wgSkinCustomiserHeadItems
  • $wgSkinCustomiserMetaItems
  • $wgSkinCustomiserDisplayBottom
  • $wgSkinCustomiserScripts

La SkinCustomiser personaliza apariencias existentes para una familia wiki completa. Añade scripts y metadatos justo antes de la etiqueta ‎</head> del wiki; y traduce entradas individuales en la barra lateral .

Contexto

Personalizando apariencias

MediaWiki skins can be customised in the files MediaWiki:Cologneblue.css, MediaWiki:Modern.css, MediaWiki:Monaco.css, MediaWiki:Monobook.css, MediaWiki:Timeless.css, MediaWiki:Vector.css, MediaWiki:Mobile.css, MediaWiki:Common.css respectively. However, if a wiki farm is operated, it is impractical to set up and maintain these files in every wiki on that farm.

Instead, all these CSS instructions can be collected centrally in this extension and included globally in all wikis of the wiki farm.

Personalizando barras laterales

Customisation also includes further entries via the sidebar , which on the one hand are to be managed centrally in a wiki farm and on the other hand are also to be translated into other languages .

This can be done by entering these labels and their translations in the i18n files of this extension.

Instalación

  • Descarga y extrae los archivos en un directorio denominado «SkinCustomiser» dentro de la carpeta extensions/.
  • Añade el siguiente código en la parte final de tu archivo LocalSettings.php :
    wfLoadExtension( 'SkinCustomiser' );
    
  • Configurar como sea necesario.
  •   Hecho – Navega a Special:Version en el wiki para verificar que la extensión se haya instalado correctamente.

Configuración

Unlike the vast majority of extensions, this one cannot be used in its original state, but must first be adapted for a specific wiki farm .

Apariencias

MediaWiki skins can be customised in files MediaWiki:Cologneblue.css, MediaWiki:Modern.css, MediaWiki:Monaco.css, MediaWiki:Monobook.css, MediaWiki:Vector.css, MediaWiki:Mobile.css, MediaWiki:Common.css respectively. However, if a wiki farm is operated, it is impractical to set up and maintain these files in each wiki of this farm.

If a different skin is used, the AnotherSkin.css file must be renamed accordingly and this change must also be made in the extension.json file.

  1. In the file tree:
    * resources
    **css
    ***Common.css       // <=== put the stuff from the file "MediaWiki:Common.css" inside here (or let it be empty)
    ***Mobile.css       // <=== put the stuff from the file "MediaWiki:Mobile.css" inside here (or let it be empty)
    ***Cologneblue.css  // <=== put the stuff from the file "MediaWiki:Cologneblue.css" inside here (or let it be empty)
    ***Modern.css       // <=== put the stuff from the file "MediaWiki:Modern.css" inside here (or let it be empty)
    ***Monaco.css       // <=== put the stuff from the file "MediaWiki:Monaco.css" inside here (or let it be empty)
    ***Monobook.css     // <=== put the stuff from the file "MediaWiki:Monobook.css" inside here (or let it be empty)
    ***Vector.css       // <=== put the stuff from the file "MediaWiki:Vector.css" inside here (or let it be empty)
    ***AnotherSkin.css  // <=== 1. rename this to "'YourSkin'.css" for supporting other skins
    **images            // <=== You may add some (background) images here
    
  2. In the extension.json file:
    	"ResourceModules": {
    		"ext.skincustomiser.common": {
    			"styles": "css/Common.css"
    		},
    		"ext.skincustomiser.mobile": {
    			"styles": "css/mobile.css"
    		},
    		"ext.skincustomiser.cologneblue": {
    			"styles": "css/Cologneblue.css"
    		},
    		"ext.skincustomiser.modern": {
    			"styles": "css/Modern.css"
    		},
    		"ext.skincustomiser.monaco": {
    			"styles": "css/Monaco.css"
    		},
    		"ext.skincustomiser.monobook": {
    			"styles": "css/Monobook.css"
    		},
    		"ext.skincustomiser.vector": {
    			"styles": "css/Vector.css"
    		},
    		"ext.skincustomiser.anotherskin": {  // <=== 2. rename this to "ext.skincustomiser.'yourskin'"
    			"styles": "css/AnotherSkin.css"  // <=== rename this to "css/'YourSkin'.css"
    		}
    	},
    
  3. In the includes/specials/HooksSkinCustomiser.php file:
    	private static function isSupported( $skinname ) {
    
    		// Add another supported skin here:
    		$mySkin = 'anotherskin';  // <=== 3. remember to rename this
    		return in_array( $skinname, [ 'cologneblue', 'modern', 'monaco, 'monobook', 'vector', $mySkin ] );
    	}
    


$wgLogos   = [ '1x' => "$wgResourceBasePath/extensions/SkinCustomiser/resources/images/logo.png" ];
$wgFavicon = "$wgResourceBasePath/extensions/SkinCustomiser/resources/images/favicon.ico";

Skin vector-2022

$wgLogos = [
	'1x' => "$wgResourceBasePath/extensions/SkinCustomiser/resources/images/logo.png",
	'icon' => "$wgResourceBasePath/extensions/SkinCustomiser/resources/images/logo-icon.svg",
	'wordmark' => [
		"src" => "$wgResourceBasePath/extensions/SkinCustomiser/resources/images/logo-wordmark.svg",
		"width" => 160,
		"height" => 24
	],
	'tagline' => [
		"src" => "$wgResourceBasePath/extensions/SkinCustomiser/resources/images/logo-tagline.svg",
		"width" => 160,
		"height" => 14
	]
];
$wgFavicon = "$wgResourceBasePath/extensions/SkinCustomiser/resources/images/favicon.ico";

Barra lateral

A wiki farm can be customised in the sidebar . The customised labels and their translations can be managed in this way:

* i18n
**en.json  // <=== add the labels from the "MediaWiki:Sidebar" here
**de.json  // <=== add the German translations of the custom labels from the "MediaWiki:Sidebar" here
**es.json  // <=== add the Spanish translations of the custom labels from the "MediaWiki:Sidebar" here
**fr.json  // <=== add more translation files if needed

In addition, some standard messages from mediawiki can also be customised there.

Customising the i18n/en.json file:

{
	"@metadata": {
		"authors": [ "YOU" ]
	},
	"about": "About your wiki",           // <==== You may have an individual "about" link in the Sidebar
	"projectpage": "Project page",        // <==== You may link to an individual project page
	"registrate": "Ask for account",      // <==== You may have a link to an individual registration form
	"contact": "Contact",                 // <==== You may have a link to an individual contact form
	"interaction": "Interaction",         // <==== Custom translation for an "Interaction" portlet
	"portals": "Portals",                 // <==== Custom portlet for some custom portal pages
	"portal-1": "Your personal portal 1", // <==== Custom portal page 1
	"portal-2": "Your personal portal 2", // <==== Custom portal page 2
	"portal-3": "Your personal portal 3", // <==== Custom portal page 3
	"createacct-benefit-heading": "{{SITENAME}} is made by individuals like you." // <==== Customise a mediawiki message
}

For more details see: Localisation file format

Head data

Disable with: $wgSkinCustomiserHeadItems = [];

Esquema

To configure the head data, add the following to LocalSettings.php after the installation line:

$wgSkinCustomiserHeadItems = [
		[ "key1", "content1" ],
		[ "key2", "content2" ]
	];

Meta data

Disable with: $wgSkinCustomiserMetaItems = [];

Esquema

To configure the head meta data, add the following to LocalSettings.php after the installation line:

$wgSkinCustomiserMetaItems = [
		[ "name1", "content1" ]
		[ "name2", "content2" ],
	];

Ejemplos

$wgSkinCustomiserMetaItems = [
		[ "age-de-meta-label", "age=0 hash: yourdigitalcode v=1.0 kind=sl protocol=all" ],
	];

Scripts

One or more head scripts can be added to the wiki. The head scripts can consist of any HTML and/or JavaScript .

Disable with: $wgSkinCustomiserScripts = "";

Esquema

To configure the head script, add the following to LocalSettings.php after the installation line:

$wgSkinCustomiserScripts = <<<'START_END_MARKER'
<script></script>
START_END_MARKER;

Leave untouched the first and last line with START_END_MARKER stuff, this is a special syntax of PHP (without it, it would be tricky to deal with apostrophes inside the script). Do not add whitespaces around the last line’s marker, it would break it (more details about this syntax). Do add new line after.

To add additional scripts, simply include them between the markers:

$wgSkinCustomiserScripts = <<<'START_END_MARKER'
<script></script>
<script></script>
<script></script>
START_END_MARKER;

You may specify a name for the script too if needed, add the following after the installation line:

$wgSkinCustomiserScripts = 'add_your_script_name_here';

Ejemplos

$wgSkinCustomiserScripts = <<<'START_END_MARKER'
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-xxxxxxxx-xx', 'auto');
  ga('set', 'anonymizeIp', true);
  ga('send', 'pageview');
</script>
START_END_MARKER;
$wgHeadScriptName = 'googleanalytics';

Bottom Display

$wgSkinCustomiserDisplayBottom adds items at the end of a page, at the bottom but still within the content frame.

Disable with: $wgSkinCustomiserDisplayBottom = "";

Ejemplos

$wgSkinCustomiserDisplayBottom =
    '<p>Something at the bottom of every page.</p>';

Véase también

The extension SkinCustomiser combines functionality from