Help:Quickbar

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
(Preparation: more words)
(actually, make this more friendly)
Line 16: Line 16:
<pre>
<pre>
-
gs*****InsertBefore = 'pt-@@@@@';
+
function addQuickbarLink(href, title, before)
-
function *****Link()
+
{
-
{
+
  var li = document.createElement('li');
-
  var user = document.getElementById( 'pt-userpage').firstChild.firstChild.data;
+
  var a = document.createElement('a');
-
  var li = document.createElement( 'li' );
+
  a.appendChild(document.createTextNode(title));
-
  li.id = 'pt-*****';
+
  a.href = href;
-
  var a = document.createElement( 'a' );
+
  li.appendChild(a);
-
  a.appendChild( document.createTextNode( '******' ) );
+
  if (!before)
-
  a.href = '#####'
+
  {
-
  li.appendChild( a );
+
    document.getElementById('pt-logout').parentNode.appendChild(li);
-
  if ( ! gs*****InsertBefore )
+
  }
-
  {
+
  else
-
      document.getElementById( 'pt-logout' ).parentNode.appendChild( li );
+
  {
-
  }
+
    before = document.getElementById('pt-'+before);
-
  else
+
    before.parentNode.insertBefore(li, before);
-
  {
+
  }
-
      var before = document.getElementById( gs******InsertBefore );
+
}
-
      before.parentNode.insertBefore( li, before );
+
function addLinks()
-
  }
+
{
-
}
+
  addQuickbarLink("http://www.hrwiki.org/etc", "link title", "watchlist"); ******
-
if ( window.addEventListener ) window.addEventListener( 'load', *****Link, false );
+
}
-
else if ( window.attachEvent ) window.attachEvent( 'onload', *****Link );
+
if (window.addEventListener) window.addEventListener('load', addLinks, false);
 +
else if (window.attachEvent) window.attachEvent('onload', addLinks);
</pre>
</pre>
==Fine Tuning==
==Fine Tuning==
-
Now, look at all of the symbols in the code. You'll see stars, @ signs, and number signs. You need to replace them:
+
Now, look at the line marked with ******:
-
*Where ever you see '''*****''' in the code, replace it with your (very short) new link name. You will do this eight times.
+
*Remove the ******, it's only there so you can find the line.
-
*Where you see '''@@@@@''' in the code, replace it with one of the following names:
+
*There are three things you need to replace, in "quotes", separated by commas.
-
**Replace it with '''userpage''' if you want the link to appear before your '''userpage''' link.
+
**The first is the entire link path to the page you want to link to.
-
**Replace it with '''mytalk''' if you want the link to appear before your '''my talk''' link.
+
**The second is what you want the link to say.
-
**Replace it with '''preferences''' if you want the link to appear before your '''preferences''' link.
+
**The third says where you want the link to be in the quickbar:
-
**Replace it with '''watchlist''' if you want the link to appear before your '''my watchlist''' link.
+
***Replace it with '''userpage''' if you want the link to appear before your '''userpage''' link.
-
**Replace it with '''mycontris''' if you want the link to appear before your '''my contributions''' link.
+
***Replace it with '''mytalk''' if you want the link to appear before your '''my talk''' link.
-
**Replace it with '''logout''' if you want the link to appear before your '''log out''' link.
+
***Replace it with '''preferences''' if you want the link to appear before your '''preferences''' link.
-
**Delete that entire line of text if you want the link to appear after your '''log out''' link.
+
***Replace it with '''watchlist''' if you want the link to appear before your '''my watchlist''' link.
-
*Where you see '''#####''' in the code, replace it with the entire link path to the page you want to link to.
+
***Replace it with '''mycontris''' if you want the link to appear before your '''my contributions''' link.
 +
***Replace it with '''logout''' if you want the link to appear before your '''log out''' link.
 +
***Make it blank (ie just two quote marks <code>""</code>) if you want the link to appear after your '''log out''' link.
 +
*If you want to add several links, make multiple copies of this one line (don't copy the whole script).
Now, save your edit, and reload the page.
Now, save your edit, and reload the page.
-
[[Category:Help|Q]]
+
[[Category:Help|Quickbar]]

Revision as of 03:00, 21 March 2006

Here's how to add a link to your quickbar:

Preparation

1. First, decide what kind of link you would like to add:

  • A page that you frequently visit, that isn't easily accessible.
  • One of your user space pages.
  • A friend's user page or talk page.

2. Find the complete address of that page, and copy it down.

3. Go to your monobook.js page by clicking here.

The Code

Edit the page, and insert the following lines of code:

function addQuickbarLink(href, title, before)
{
  var li = document.createElement('li');
  var a = document.createElement('a');
  a.appendChild(document.createTextNode(title));
  a.href = href;
  li.appendChild(a);
  if (!before)
  {
    document.getElementById('pt-logout').parentNode.appendChild(li);
  }
  else
  {
    before = document.getElementById('pt-'+before);
    before.parentNode.insertBefore(li, before);
  }
}
function addLinks()
{
  addQuickbarLink("http://www.hrwiki.org/etc", "link title", "watchlist"); ******
}
if (window.addEventListener) window.addEventListener('load', addLinks, false);
else if (window.attachEvent) window.attachEvent('onload', addLinks);

Fine Tuning

Now, look at the line marked with ******:

  • Remove the ******, it's only there so you can find the line.
  • There are three things you need to replace, in "quotes", separated by commas.
    • The first is the entire link path to the page you want to link to.
    • The second is what you want the link to say.
    • The third says where you want the link to be in the quickbar:
      • Replace it with userpage if you want the link to appear before your userpage link.
      • Replace it with mytalk if you want the link to appear before your my talk link.
      • Replace it with preferences if you want the link to appear before your preferences link.
      • Replace it with watchlist if you want the link to appear before your my watchlist link.
      • Replace it with mycontris if you want the link to appear before your my contributions link.
      • Replace it with logout if you want the link to appear before your log out link.
      • Make it blank (ie just two quote marks "") if you want the link to appear after your log out link.
  • If you want to add several links, make multiple copies of this one line (don't copy the whole script).

Now, save your edit, and reload the page.

Personal tools