User:Bility/statusupdate

From Wikipedia, the free encyclopedia
Code for this script resides at User:Bility/statusupdate.js

This script adds links to any <span> element inside an element with the ID "user-status". When one of the <span>s is clicked, the page at "User:User name/Status" is updated with the text inside the <span>. The purpose is to put links on your user page you can click to update the status page, which is transcluded into the user page. This way you don't have to go to the status page, edit it then save it. Note that this script only works for pages in your user space and user talk pages.

Using this script[edit]

Add the following code to your skin javascript or common.js:

var hideStatus = false;
importScript('User:Bility/statusupdate.js');

The first line is optional, and if set to true, will allow you to hide the update links from other users.

In your user page or status template[edit]

Wherever the links are going to reside, either transcluded from another page or directly in your user page, just make sure they are in <span> tags, within another tag containing the id="user-status" attribute. If you have set var hideStatus = true; above, you need to add a hidden visibility style to the element as well. Here are a couple possible examples:

Using a <div> with hidden visibility
<div id="user-status" style="visibility:hidden"><span>online</span> | <span>offline</span></div>
online | offline

Using a list
<ul id="user-status">
<li><span>online</span></li>
<li><span>offline</span></li>
</ul>
  • online
  • offline