Wikipedia:User scripts/Guide: Difference between revisions
Content deleted Content added
CosineKitty (talk | contribs) →Finding elements: possessive ''its'' instead of contraction ''it's'' |
→Call from Monobook.js: Adding explanation how to load CSS files from a local web server. |
||
Line 239:
However it's not convinient and creates unnecessary load on WikiMedia servers.
===
The best and most recommended way is to insert into your <tt>monobook.js</tt>
<source lang="javascript">
importScriptURI( 'http://localhost/
</source>
Then run any [[
You can edit your <tt>
For example you could use [http://www.ritlabs.com/en/products/tinyweb/ TinyWeb] which is less than 100kbyte on disk and doesn't require installation. Save and unzip <tt>tinyweb.zip</tt> for example into <tt>c:\Program Files\Tinyweb</tt>, then create a shortcut to <tt>tiny.exe</tt>, in shortcut properties add an argument — path to your folder with <tt>
==== CSS files ====
In the same way you can load a CSS file from your local web server. Put this string at the very top of your <tt>/monobook.css</tt> :
<source lang="css">
@import "http://localhost/wikipediatest.css";
</source>
Note that such <code>@import</code> statements must come before any other declarations in your <tt>/monobook.css</tt>. But there can be <code>/* comments */</code> above them.
Once you have finished the CSS code you need to upload it to for instance [[Special:Mypage/yourscript.css|User:Yourname/yourscript.css]]. If it should be used together with a user script written in JavaScript then from the JavaScript you can load the CSS file with this line of code:
<source lang="javascript">
importStylesheet( 'User:Yourname/yourscript.css' );
</source>
=== Other methods ===
|