Wužiwar:Tlustulimu/monobook.js

z Kitakija

(rozdźěl mjez wersijomaj)
Dźi do: Nawigacija, Pytać
(dodawk)
S (dodawk)
Rjadka 102: Rjadka 102:
}
}
 +
/* z / from enwikt */
 +
function addLoadEvent(func)
 +
{
 +
  if (window.addEventListener)
 +
    window.addEventListener("load", func, false);
 +
  else if (window.attachEvent)
 +
    window.attachEvent("onload", func);
 +
}
 +
/* z / from enwikit */
//Cookie helpers
//Cookie helpers
function setCookie(cookieName, cookieValue) {
function setCookie(cookieName, cookieValue) {

Wersija z 13:51, 6. jul 2007

/* zdźěla wot mojeje němskeje strony */
 
/* Füge Projektportal-Link hinzu */
function addPortal()
{
  quickbar = document.getElementById('quickbar');
  if (quickbar)
  {
    neues = document.createElement('a')
    neues.href = '/wiki/Wikipedia:Portal'
    neues.appendChild(document.createTextNode('Projektportal'))
    quickbar.appendChild(neues)
  }
}
 
addOnloadHook(addPortal);
 
/* Einige link-Tags hinzufügen */
head = document.getElementsByTagName('head')[0]
 
function verlinke(rel, href, title)
{
  link = document.createElement('link')
  link.rel = rel
  link.href = '/wiki/' + href
  link.title = title
  head.appendChild(link)
}
 
if (head) /* sollte immer true ergeben, aber sicher ist sicher */
{
  verlinke('start', 'Hauptseite', 'Hauptseite')
  verlinke('help', 'Wikipedia:Handbuch', 'Handbuch')
  verlinke('index', 'Spezial:Allpages', 'Index')
}
 
/* decodiere UTF8 (aus Selfhtml) */
function decode_utf8(utftext) {
     var plaintext = ""; var i=0; var c=c1=c2=0;
     // while-Schleife, weil einige Zeichen uebersprungen werden
     while(i<utftext.length)
         {
         c = utftext.charCodeAt(i);
         if (c<128) {
             plaintext += String.fromCharCode(c);
             i++;}
         else if((c>191) && (c<224)) {
             c2 = utftext.charCodeAt(i+1);
             plaintext += String.fromCharCode(((c&31)<<6) | (c2&63));
             i+=2;}
         else {
             c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2);
             plaintext += String.fromCharCode(((c&15)<<12) | ((c2&63)<<6) | (c3&63));
             i+=3;}
         }
     return plaintext;
}
 
/* decodiere die codierten UTF8-Zeichen in Kapitel-Ankern */
function decodeanchor(anchorname)
{
  var escaped = anchorname.replace(/\.([0-9A-F][0-9A-F])/g,"%$1");
  return decode_utf8(unescape(escaped)).replace(/_/g,' ');
}
 
/* Füge Link-Tags fürs Inhaltsverzeichnis hinzu */
function addcontents()
{
  var head = document.getElementsByTagName('head')[0];
  var len = document.anchors.length
  for (i = 0; i <  len; ++i)
  {
    anchor = document.anchors[i];
    link = document.createElement('link')
    link.rel = 'chapter'
    link.href = '#' + anchor.name;
    link.title = decodeanchor(anchor.name);
    head.appendChild(link)
  }
}
 
addOnloadHook(addcontents);
 
//Bei Dschwen gefunden
// [[Benutzer:Dschwen/wikiminiatlas2.js]] - diese Zeile bitte mitkopieren
document.write('<script type="text/javascript" src="' 
     + 'http://de.wikipedia.org/w/index.php?title=User:Dschwen/wikiminiatlas2.js' 
     + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
//Aus der englischen Wikipedia von User:Cacycle
// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
 
//Po ideju w němskej Wikipediji [[:de:Wikipedia Diskussion:Skin#Freigeben rot]]
 
if (document.getElementById("ca-unprotect")) 
{  document.getElementById("ca-unprotect").style.borderColor = "#FF0000";
document.getElementById("ca-unprotect").style.borderWidth = "4px";
}
 
/* z / from enwikt */
function addLoadEvent(func) 
{
  if (window.addEventListener) 
    window.addEventListener("load", func, false);
  else if (window.attachEvent) 
    window.attachEvent("onload", func);
}
 
/* z / from enwikit */
//Cookie helpers
function setCookie(cookieName, cookieValue) {
 var today = new Date();
 var expire = new Date();
 var nDays = 30;
 expire.setTime( today.getTime() + (3600000 * 24 * nDays) );
 document.cookie = cookieName + "=" + escape(cookieValue)
                 + ";path=/w"
                 + ";expires="+expire.toGMTString();
 document.cookie = cookieName + "=" + escape(cookieValue)
                 + ";path=/wiki"
                 + ";expires="+expire.toGMTString();
}
 
function getCookie(cookieName) {
  var start = document.cookie.indexOf( cookieName + "=" );
  if ( start == -1 ) return "";
  var len = start + cookieName.length + 1;
  if ( ( !start ) &&
    ( cookieName != document.cookie.substring( 0, cookieName.length ) ) )
      {
        return "";
      }
  var end = document.cookie.indexOf( ";", len );
  if ( end == -1 ) end = document.cookie.length;
  return unescape( document.cookie.substring( len, end ) );
}
 
function deleteCookie(cookieName) {
  if ( getCookie(cookieName) ) {
    document.cookie = cookieName + "=" + ";path=/w" +
    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
    document.cookie = cookieName + "=" + ";path=/wiki" +
    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
  }
}
 
 
/* add menu for selecting subsets of secial characters */
/***** must match MediaWiki:Edittools *****/
function addCharSubsetMenu() {
  var edittools = document.getElementById('specialchars');
 
  if (edittools) {
    var menu = "<select id=\"charSubsetControl\" style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
    menu += "<option>standard</option>";
    menu += "<option>WikiSyntax</option>";
    menu += "<option>templates</option>";
    menu += "<option>IPA</option>";
    menu += "<option>lat</option>";
    menu += "<option>arab</option>";
    menu += "<option>czech</option>";
    menu += "<option>esperanto</option>";
    menu += "<option>eston</option>";
    menu += "<option>franc</option>";
    menu += "<option>galic</option>";
    menu += "<option>grjek</option>";
    menu += "<option>hawai</option>";
    menu += "<option>island</option>";
    menu += "<option>ital</option>";
    menu += "<option>jid</option>";
    menu += "<option>jug</option>";
    menu += "<option>katal</option>";
    menu += "<option>kyril</option>";
    menu += "<option>let</option>";
    menu += "<option>lit</option>";
    menu += "<option>mad</option>";
    menu += "<option>malt</option>";
    menu += "<option>de</option>";
    menu += "<option>pinyin</option>";
    menu += "<option>pol</option>";
    menu += "<option>port</option>";
    menu += "<option>roman</option>";
    menu += "<option>rumun</option>";
    menu += "<option>serb</option>";
    menu += "<option>skand</option>";
    menu += "<option>slowak</option>";
    menu += "<option>str_gjek</option>";
    menu += "<option>span</option>";
    menu += "<option>turk</option>";
    menu += "<option>viet</option>";
    menu += "</select>";
    edittools.innerHTML = menu + edittools.innerHTML;
 
    /* default subset from cookie */
    var s = parseInt( getCookie('edittoolscharsubset') );
    if ( isNaN(s) ) s = 0;
 
    /* update dropdown control to value of cookie */
    document.getElementById('charSubsetControl').selectedIndex = s; 
 
    /* display the subset indicated by the cookie */
    chooseCharSubset( s );
  }
}
 
/* select subsection of special characters */
function chooseCharSubset(s) {
  var l = document.getElementById('specialchars').getElementsByTagName('p');
  for (var i = 0; i < l.length ; i++) {
    l[i].style.display = i == s ? 'inline' : 'none';
   // l[i].style.visibility = i == s ? 'visible' : 'hidden';
  }
  setCookie('edittoolscharsubset', s);
}
 
/* do any Wikipedia-specific customizations */
/* from enwikt */
function customizeWikipedia() {
  // doRedirect();
  addCharSubsetMenu();
  // fixEditSectionWikifiedLinks();
  // wiktHeadingToolTips();
}
 
addLoadEvent(customizeWikipedia);
Wosobinske nastroje