Wikipedia:User scripts/Guide: Difference between revisions
Content deleted Content added
→Text editors and debugging: this was written in 2007; in 2024, any mainstream editor supports UTF-8 |
m →Your first script: formatting |
||
Line 40:
<syntaxhighlight lang="javascript">
// Qwikify
$( document ).ready( function () {
MODULE_CODE;
} );
</syntaxhighlight>
In <code>MODULE_CODE</code>, we want to add the "Wikify" tab, so we will use the [[mw:RL/DM#addPortletLink|<code>addPortletLink</code> function]] (which requires the <code>mediawiki.util</code> module). Replace <code>MODULE_CODE</code> with a call to this function. Then we'll bind an event handler so that when this link is clicked, we will call another function named <code>doQwikify()</code> that will actually execute the code. The <code>name</code> is what is shown on the tab, so set that to <code>'Wikify'</code>. Most tabs have an
Altogether, your new function should look like this:
|