Gebruiker:Snakesteuben/monobook.js

Uit WikiWoordenboek

Let op! Nadat u de veranderingen heeft opgeslagen, moet u de cache van uw browser nog legen om ze daadwerkelijk te zien.

Mozilla (incl. Firefox) Ctrl+Shift+R
Internet Explorer Ctrl+F5
Opera F5
Safari Cmd+R
Konqueror F5
 /* Warning: 1. I am not a programmer. Anything I made myself probably doesn't work. */
 /* 2. This document may contain profanity and content others find objectionable. */
 
 /* Everything here was adapted from either: en.wikipedia/Jsimlo/shortcuts.js, or */
 /* http://meta.wikimedia.org/wiki/User:Spacebirdy/alt%C3%A6kt.js. */
 /* For best results, I suggest snagging it from the source. :-) -Winter */

 /*Function to make shortcut toolbar. Adapted from en.wikipedia/Jsimlo/shortcuts.js*/

 /***********************************************************
  * INTERFACE
  ***********************************************************/

 /**
  * Starts a new section of links. Function for external use.
  */

 function shortcutsStartSection (name)
 {
   shortcutsLinks[shortcutsLinks.length] = { 'name': name, 'links': new Array () };
 }

 /* Adds new link into the current section of links. Function for external use. */

 function shortcutsAddLink (name, article)
 {
   var links = shortcutsLinks[shortcutsLinks.length - 1]['links'];
   links[links.length] = { 'name': name, 'article': article };
 }

 /***********************************************************
  * IMPLEMENTATION
  ***********************************************************/

 /* Link maker: Creates and returns an li element with the desired link. */

 function shortcutsMakeLink (name, url)
 {
   var ntxt = document.createTextNode (name);
   var na   = document.createElement ('a');
   var nli  = document.createElement ('li');

   na.setAttribute ('href', '/wiki/' + url); 
   nli.setAttribute ('class', 'n-shortcut');

   na.appendChild (ntxt);
   nli.appendChild (na);

   return nli;
 }

 /* Portlet maker: Creates and returns a portlet populated by list of links. */

 function shortcutsMakePortlet (name, links)
 {
   var nportlet = document.createElement ('div');
   var nh5 = document.createElement ('h5');
   var ntit = document.createTextNode (name);
   var nbody = document.createElement ('div');
   var nul = document.createElement ('ul');

   nportlet.setAttribute ('id', 'p-'+name);
   nportlet.setAttribute ('class', 'portlet');
   nbody.setAttribute ('class', 'pBody');
   nul.setAttribute ('id', 'p-'+name);

   for (var i = 0; i < links.length; i++)
     nul.appendChild (
       shortcutsMakeLink (links[i]['name'], links[i]['article'])
     );

   nh5.appendChild (ntit);
   nportlet.appendChild (nh5);
   nbody.appendChild (nul);
   nportlet.appendChild (nbody);

   return nportlet;
 }

 /* Main function: Enumerates all non-empty sections, 
  * and adds new portlets beneath the old ones. */

 function shortcutsMain ()
 {
   var sidecol = document.getElementById ('column-one');

   for (var i = 0; i < shortcutsLinks.length; i++)
     if (shortcutsLinks[i]['links'].length > 0)
       sidecol.appendChild (
         shortcutsMakePortlet (shortcutsLinks[i]['name'], shortcutsLinks[i]['links'])
       );
 }

 /* Initializes the onload events. */

 function shortcutsInitialize ()
 {
   shortcutsInit ();
   shortcutsMain ();
 }

 /***********************************************************
  * INITIALIZATION
  ***********************************************************/

 var shortcutsLinks = new Array ();
 shortcutsStartSection (wgUserName ? wgUserName : 'shortcuts');

 addOnloadHook (shortcutsInitialize);

 /*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/

 /*********** Botonera ***********/


 function loadButtons()
 {
 var buttons = '<div>';

 /* Botón WEI */
 buttons += '<a class="mybutton" title="wei: selecciona antes el texto a resaltar" href="javascript:ponWEI()" style="background:gold" ><code style="background:gold">:\)</code></a>';

 /* Botón small */
 buttons += '<a class="mybutton" title="Código para escribir texto en letra pequeña" href="javascript:small()" style="background:skyblue"><code style="background:skyblue"><small>p</small></code></a>';

 /* Botón big */
buttons += '<a class="mybutton" title="Código para escribir texto en letra grande" href="javascript:big()" style="background:lightskyblue"><code style="background:lightskyblue"><big>G</big></code></a>';

 /* Botón iswikt: sagnbeyging */
 buttons += '<a class="mybutton" title="sagnbeyging" href="javascript:sagnBeyging()" style="background:deepskyblue"><code style="background:deepskyblue">S</code></a>';

 /* Botón t+fy: Ingelsk site, oersettings section */
 buttons += '<a class="mybutton" title="fy translation insert" href="javascript:advBeyging()" style="background:dodgerblue"><code style="background:dodgerblue">f0</code></a>';

 /* Botón t+fy: Ingelsk site, oersettings section */
 buttons += '<a class="mybutton" title="fy translation insert" href="javascript:advBeyging()" style="background:green"><code style="background:green">fc</code></a>';

 /* Botón en-N */
 buttons += '<a class="mybutton" title="Ingelsk noun template" href="javascript:enN()" style="background:mistyrose"><code style="background:mistyrose">eN</code></a>';

 /* Botón en-translation line */
 buttons += '<a class="mybutton" title="Ingelsk oersetting lyn" href="javascript:eng()" style="background:lavenderblush"><code style="background:lavenderblush">eO</code></a>';

 /* Botón hola */
 buttons += '<a class="mybutton" title="Hallo" href="javascript:hallo()" style="background:mistyrose"><code style="background:mistyrose">H</code></a>';

 /* Botón prueba */
 buttons += '<a class="mybutton" title="Test" href="javascript:test()" style="background:lavenderblush"><code style="background:lavenderblush">T</code></a>';

 /* Botón kat */
 buttons += '<a class="mybutton" title="Fallbeyging" href="javascript:ponKat()" style="background:lightcoral"><code style="background:lightcoral">F</code></a>';

 /* Botón subst */
 buttons += '<a class="mybutton" title="Baustein mit subst" href="javascript:ponSubst()" style="background:lightgrey"><code style="background:lightgrey">{}</code></a>';

 /* Botón Contribs. */
 buttons += '<a class="mybutton" title="Special:Contributions" href="javascript:spContrib()" style="background:silver"><code style="background:silver">C</code></a>';

 /* Botón clearall. */
 buttons += '<a class="mybutton" title="clearall" href="javascript:clearAll()" style="background:WhiteSmoke"><code style="background:WhiteSmoke">/</code></a>';

 /* Botón sigh */
 buttons += '<a class="mybutton" title="<pre>" href="javascript:ponPre()" style="background:thistle"><code style="background:thistle;font-size:80%">pre</code></a>';

 /* Botón Uetrad */
 buttons += '<a class="mybutton" title="Ü" href="javascript:Uetrad()" style="background:lightsteelblue"><code style="background:lightsteelblue">*</code></a>';

 /* Botón iswikt: Önnur orð með sömu fallbeygingu */
 buttons += '<a class="mybutton" title="Önnur orð" href="javascript:oennurOrd()" style="background:azure"><code style="background:azure">Ö</code></a>';

 /* Botón iswikt: ref-icelandiconlinedictionary */
 buttons += '<a class="mybutton" title="Icelandic Online Dictionary" href="javascript:iceOnline()" style="background:paleturquoise"><code style="background:paleturquoise">1</code></a>';

 /* Botón iswikt: ref-orðabanki */
 buttons += '<a class="mybutton" title="Orðabanki" href="javascript:ordabanki()" style="background:paleturquoise"><code style="background:paleturquoise">2</code></a>';

 /* Botón iswikt: ref-orðabók háskólans*/
 buttons += '<a class="mybutton" title="Orðabók Háskólans" href="javascript:ordabokhaskolans()" style="background:lightcyan"><code style="background:lightcyan">3</code></a>';

 /* Botón iswikt: Hugtakasafn Þýðingamiðstöðvar utanríkisráðuneytis*/
 buttons += '<a class="mybutton" title="Hugtakasafn Þýðingamiðstöðvar utanríkisráðuneytis" href="javascript:hugtakasafn()" style="background:lightcyan"><code style="background:lightcyan">4</code></a>';

 buttons += '</div>';

 var toolbox = document.getElementById("p-navigation");
 toolbox.innerHTML += '<h5>Mi botonera</h5>'+buttons;

 }

 function ponWEI()
 {insertTags('<code style="background:steelblue;color:white">','</code>','');}

 function small ()
 {insertTags('<small>','</small>','');}

 function big ()
 {insertTags('<big>','</big>','');}

 function sagnBeyging ()
 {insertTags('{\{Sagnbeyging|\nég-nútíð=\n|þú-nútíð=\n|hann-nútíð=\n|við-nútíð=\n|þið-nútíð=\n|þeir-nútíð=\n|ég-nútíð-miðmynd=\n|Þátíð=\n|Lýsingarháttur þátíðar=\n|Viðtengingarháttur=\n|Boðháttur=\n|allar sagnbeygingar=\n','}}','');}

 function advBeyging ()
 {insertTags('* West Frisian: {\{t+|fy|','}}','');}

 function enN ()
 {insertTags('{\{subst:en-N|','}}','');}

 function eng ()
 {insertTags(':*{\{eng}}: {\{trad|en|','}}','');}

 function hallo ()
 {insertTags('{\{subst:Hallo','}}','');}

 function test ()
 {insertTags('{\{subst:Test','}}','');}

 function ponKat ()
 {insertTags('{\{Fallbeyging ','}}','');}

 function ponSubst ()
 {insertTags('{\{subst:','}}','');}

 function spContrib ()
 {insertTags('[[Special:Contributions/',']]','');}

 function clearAll ()
 {insertTags('<br clear="all"','>','');}

 function ponPre ()
 {insertTags('<pre>','</pre>','');}

 function Uetrad ()
 {insertTags('*{\{isl}}: [1] {\{Ü|is|','}}','');}

 function oennurOrd ()
 {insertTags('[[Kerfissíða:Whatlinkshere/Snið:Fallbeyging ','|Önnur orð með sömu fallbeygingu]]','');}

 function iceOnline ()
 {insertTags('{\{Ref-IcelandicOnlineDictionary|','}}\n<!-- á= %E1, ð= %F0, é= %E9, í=%ED, ó= %F3, ú= %FA, ý= %FD, þ=%FE, æ= %E6, ö= %F6 -->','');}

 function ordabanki ()
 {insertTags('{\{Ref-Orðabanki|','}}','');}

 function ordabokhaskolans ()
 {insertTags('{\{Ref-Orðabók Háskólans|','}}\n<!-- á= %E1, ð= %F0, é= %E9, í=%ED, ó= %F3, ú= %FA, ý= %FD, þ=%FE, æ= %E6, ö= %F6 -->','');}

 function hugtakasafn ()
 {insertTags('{\{Ref-Hugtakasafn|','}}\n<!-- á= %E1, ð= %F0, é= %E9, í=%ED, ó= %F3, ú= %FA, ý= %FD, þ=%FE, æ= %E6, ö= %F6 -->','');}

 /******* from Spacebirdy, who got it from Connel ****/

function addLoadEvent(func) {
 if (window.addEventListener) 
   window.addEventListener("load", func, false);
 else if (window.attachEvent) 
   window.attachEvent("onload", func);
}

addLoadEvent( loadButtons );

 /*********** Fin botonera ************/

 /*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/

 /*********** arkkiste *************/
 /* Selsadvys: fy/stq where the admin-oriented links are actually useful */
 /* to me use a different naming convention; wiki rather than special. */
 /* those alias correctly ONLY if you use an html external link. */
  
 function shortcutsInit ()
 {
  shortcutsAddLink ('System messages', 'Special:Allmessages');
  shortcutsAddLink ('New pages', 'Special:Newpages');
  shortcutsAddLink ('IP Blocklist', 'Special:Ipblocklist');
  shortcutsAddLink ('List sysop users', 'Special:Listusers/sysop');
  shortcutsAddLink ('Linksearch', 'Special:Linksearch');
  shortcutsAddLink ('PrefixIndex', 'Special:Prefixindex');
  shortcutsAddLink ('Where are MY fucking pages?', 'Special:Prefixindex/User:Snakesteuben');
  shortcutsAddLink ('Shortpages', 'Special:Shortpages');
  shortcutsAddLink ('current', 'Category:Frisian language');
 }