Extension:UseResource/cs
![]() Stav rozšíření: stabilníCategory:Stable extensions/cs |
|
---|---|
Implementace | ZnačkaCategory:Tag extensions/cs |
Popis | Načte JS a CSS do jmenného prostoru MediaWiki pro každou stránku. |
Autoři | Brandon Fowler (BrandonXLFdiskuse) |
Nejnovější verze | 1.0.0 |
Zásady kompatibility | Vydání snímků současně s MediaWiki. Hlavní vývojová větev není zpětně kompatibilní. |
MediaWiki | 1.35+Category:Extensions with manual MediaWiki version |
PHP | 7+ |
Licence | GNU General Public License 2.0 nebo novější |
Stáhnout | Category:Extensions in Wikimedia version control/cs |
<usestyle src=...>...</usestyle> |
|
Čtvrtletní stahování | 2 (Ranked 114th) |
Přeložte rozšíření UseResource, používá-li lokalizaci z translatewiki.net | |
Problémy | Otevřené úkoly · Nahlásit chybu |
The UseResource extension adds the <usescript>
and <usestyle>
tags that allow JavaScript and CSS to be loaded from the MediaWiki namespace on a per-page basis.
When used in a template, pages that use the template will load the JS/CSS, this allows for the loading of scripts and stylesheets only used on some pages to be only loaded on the pages they are used on rather than being loaded on all pages using MediaWiki:Common.js and MediaWiki:Common.css or Extension:Gadgets.
Scripts can only be loaded from the MediaWiki namespace to prevent malicious code from being run, if you desire a way for user to edit stylesheets that only affect the content area, see Extension:TemplateStyles.
Instalace
- Stáhněte soubor/y a vložte je do adresáře pojmenovaného
UseResource
ve vaší složceextensions/
.
Vývojáři a přispěvatelé kódu by si místo toho měli nainstalovat rozšíření from Git pomocí:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/UseResource - Na konec vašeho souboru LocalSettings.php přidejte následující kód:
wfLoadExtension( 'UseResource' );
Dokončeno – Přejděte na stránku Special:Version vaší wiki a zkontrolujte, zda bylo rozšíření úspěšně nainstalováno.
Použití
The extension is used by including <usescript src="..." />
or <usestyle src="..." />
tags on wiki pages to load the resource (script or stylesheet), replacing ...
with the name of the resource.
Resources must be located in the MediaWiki namespace and can only be edited by uses with the editinterface
user right as they are the only users allowed to edit pages in the MediaWiki namespace.
The value of the src
attribute is the name of the resource to load.
If no namespace is included, the MediaWiki namespace is assumed.
For example, if you had a script located at MediaWiki:Test.js, you could load it using <usescript src="test.js" />
.
This will fail if the requested script does not exist, is not located in the MediaWiki namespace, or if it does not have the correct content model, JavaScript for scripts and CSS for stylesheets.
If the same resource is included on a single page multiple times, it is only run once.