Extension:HeadScript/id
HeadScript Status rilis stabil |
|
---|---|
Implementasi | Hook |
Deskripsi | Menambahkan skrip tepat sebelum </head> dari wiki |
Perancang awal | |
Versi terbaru | 1.1.1 (2021-12-03) |
MediaWiki | |
Perubahan basis data | Tidak |
Lisensi | Lisensi MIT |
Unduh | |
|
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Terjemahkan ekstensi HeadScript jika tersedia di translatewiki.net |
The HeadScript extension allows scripts to easily be added just before </head>
of the wiki.
The code for the head script is defined in "LocalSettings.php " and is controlled by variables.
This implementation makes it easy for inexperienced users to implement head scripts just before </head>
of the wiki.
It also makes it possible to add head scripts that cannot be changed or removed, such as would be possible by wiki Administrator if the head script were added to the Sitenotice .
This makes the extension particularly useful for placing Cookie Consent plugin or CSS style links, as such content cannot be removed by abusive or rogue administrators.
Pemasangan
- <translate> [[<tvar name=2>Special:ExtensionDistributor/HeadScript/id</tvar>|Download]] and move the extracted <tvar name=name>
HeadScript/id
</tvar> folder to your <tvar name=ext>extensions/
</tvar> directory.</translate>
<translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/HeadScript%2Fid - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'HeadScript/id' );
- Configure as required.
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Konfigurasi
Satu atau lebih HeadScript dapat ditambahkan ke suatu wiki. HeadScript dapat terdiri dari HTML dan/atau JavaScript.
To configure the head script, add the following to "LocalSettings.php" after the installation line:
$wgHeadScriptCode = <<<'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.
Untuk menambahkan skrip tambahan, cukup sertakan skrip di antara markah:
$wgHeadScriptCode = <<<'START_END_MARKER'
<script></script>
<script></script>
<script></script>
START_END_MARKER;
Anda juga dapat memberi nama untuk skrip jika diperlukan, tambahkan yang berikut ini setelah baris instalasi:
$wgHeadScriptName = 'my-wonderful-script';
META and LINK elements can also be added, such as:
$wgHeadScriptCode = <<<'START_END_MARKER'
<meta name="author" content="Wikimedia Foundation" />
<link rel="author" type="text/plain" href="/humans.txt" />
<script></script>
START_END_MARKER;
See also
- Extension:HeaderExtension - Improved code
- Extension:Postscript - append a text or script in last of all artices.