Meidogger:Snakesteuben/monobook.js: ferskil tusken ferzjes

Content deleted Content added
Nije Side: →‎Function to make shortcut toolbar. Adapted from en.wikipedia/Jsimlo/shortcuts.js: /*********************************************************** * INTERFACE **********************...
(Gjin ferskil)

De ferzje fan 17 apr 2008 om 16.11

 /*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: fyNPL */
 buttons += '<a class="mybutton" title="fyNPL" href="javascript:fyNPL()" style="background:deepskyblue"><code style="background:deepskyblue">fp</code></a>';

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

 /* Botón fy: Ingelsk site, noun inflection template */
 buttons += '<a class="mybutton" title="infl-n" href="javascript:fyInoun()" style="background:green"><code style="background:green">fn</code></a>';

 /* Botón fy-head: Ingelsk site, West Frisian new entry generic */
 buttons += '<a class="mybutton" title="West Frisian entry generic-Ingelsk site" href="javascript:fyHead()" style="background:mistyrose"><code style="background:mistyrose">fg</code></a>';

 /* Botón prueba-es */
 buttons += '<a class="mybutton" title="prueba" href="javascript:prueba()" style="background:lavenderblush"><code style="background:lavenderblush">P</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 fyNPL ()
 {insertTags('{{subst:fy-NPL|{{PAGENAME}}|','}}','');}

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

 function fyInoun ()
 {insertTags('{{infl|fy|','|g=c}}','');}


 function fyHead ()
 {insertTags('==West Frisian==\n===','===\n{{PAGENAME}}\n#[[]]\n\n[[Category:West Frisian ]]','');}

 function prueba ()
 {insertTags('{{subst:Prueba','}}','');}

 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('*{{is}}: [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 ('current', 'Category:Frisian language');
  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 ('Shortpages', 'Special:Shortpages');
  shortcutsAddLink ('Greasepit', 'Wiktionary:Grease pit');
 
 }