User:IagoQnsi/addptlinks
Appearance
Don't use this script! There is built-in code in MediaWiki that can do the same thing (and then some). You should use the MediaWiki function instead of my code because I will not be maintaining this script if it breaks. The function is called addPortletLink() , and it's documented here: mw:ResourceLoader/Core modules#addPortletLink. You can set portletId (the first parameter) to 'p-personal' to select the personal toolbar (as opposed to the sidebar or what have you). |
This is a simple script that allows you to insert custom links into your personal toolbar (i.e. the list at the top right with links to your user page, talk page, preferences, etc.).
Usage
[edit]To use the script, you will need to add something like this to your common.js file:
var ptLinksToAdd = [ { label: "New pages", title: "Feed of recently created pages", url: "/wiki/Special:NewPagesFeed", index: 5 }, { label: "AfD", url: "/wiki/Wikipedia:Articles_for_Deletion", index: 6 } ]; importScript('User:IagoQnsi/addptlinks.js');
The variable ptLinksToAdd
is an array of all the links you would like to add. Each object in this array can have these attributes:
Attribute | Required? | Purpose |
---|---|---|
label
|
yes | The text to be shown for the link |
title
|
no | A title attribute for the link, if desired. Most browsers display these titles when you hover your mouse over the link. |
url
|
yes | The URL where the link goes. If you would like to link to a page on the Wikipedia, use the format "/wiki/Page_name". |
index
|
no | The index where this link will be placed in the list (i.e. "0" would put the link at the far left, "1" would put it to the right of the username, etc.). If the index is not set, the link will be added to the end of the list. |