Uzanto:ArnoLagrange/monobook.js

El Vikipedio, la libera enciklopedio

Notu:Post publikigo forviŝu la kaŝmemoron de via foliumilo por vidi la ŝanĝojn.

  • Firefox / Safari: Premu majuskligan klavon klakante Reŝarĝi, aŭ premu aŭ Stir-F5Stir-R (⌘-R kun Makintoŝo)
  • Google Chrome: Premu Stir-majuskligklavon-R (⌘-Majuskligklavo-R kun Makintoŝo)
  • Interreta Esplorilo / Edge: Premu Stir klakante Refreŝu, aŭ premu Stir-F5
  • Opera: Premu Stir-F5.
//<source lang="javascript">

/* La JavaSkriptaĵoj ĉi tie estos ŝarĝitaj nur por ĉi tiu uzanto sur ĉiu paĝo. 
*/
/* <pre> <nowiki> 
*/   
/**
* Diverses fonctions manipulant les classes
* Utilise des expressions régulières et un cache pour de meilleures perfs
* isClass et whichClass depuis http://fr.wikibooks.org/w/index.php?title=MediaWiki:Common.js&oldid=140211
* hasClass, addClass, removeClass et eregReplace depuis http://drupal.org.in/doc/misc/drupal.js.source.html
* surveiller l'implémentation de .classList http://www.w3.org/TR/2008/WD-html5-diff-20080122/#htmlelement-extensions
*/
function isClass(element, classe) {
return hasClass(element, classe);
}
 
function whichClass(element, classes) {
var s=" "+element.className+" ";
for(var i=0;i<classes.length;i++)
if (s.indexOf(" "+classes[i]+" ")>=0) return i;
return -1;
}
 
function hasClass(node, className) {
if (node.className == className) {
return true;
}
var reg = new RegExp('(^| )'+ className +'($| )')
if (reg.test(node.className)) {
return true;
}
return false;
}
 
function addClass(node, className) {
if (hasClass(node, className)) {
return false;
}
node.className += ' '+ className;
return true;
}
 
function removeClass(node, className) {
if (!hasClass(node, className)) {
return false;
}
node.className = eregReplace('(^|\\s+)'+ className +'($|\\s+)', ' ', node.className);
return true;
}
 
function eregReplace(search, replace, subject) {
return subject.replace(new RegExp(search,'g'), replace);
}
 

addCustomButton('http://upload.wikimedia.org/wikipedia/commons/f/fa/Button_bold_ukr.png','AL-subskribo','{{alss}} ~~~~~','','','mw-editbutton-signature');


/** WikiMiniAtlas *******************************************************
   *
   *  Priskribo: WikiMiniAtlas estas ŝprucanta alklakebla kaj tirebla mondmapo. 
   *             La skripto estigas ke ĉiuj viaj koordinataj ligiloj montras la WikiMiniAtlas-ŝprucbutonon. 
   *             La skripto mem estas lokita sur meta ĉar ĝi estas uzata de multaj projektoj. 
   *             Vidu [[Meta:WikiMiniAtlas]] por plia informo. 
   *  Kreita de : [[:en:User:Dschwen]]
   */
 
/*document.write('<script type="text/javascript" src="' 
*     + 'http://meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js' 
*    + '&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400"></script>');
*/

/*  </nowiki> </pre>*/


/* 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)
  }
}

$(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)
  }
}

$(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>');

// por la verdaj butonetoj laŭ hsbwp, plwp kaj ruwp resp. propra vikio

document.write('<script type="text/javascript" src="' 
     + 'http://eo.wikipedia.org/w/index.php?title=Vikipediisto:Tlustulimu/butonetoj.js' 
     + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');



// Installe wikEd pour l'édition des pages (pour tous)
 
var wikEdDiffPreset = false;
var wikEdRegExTypoFix = true;
var wikEdRegExTypoFixURL = 'http://fr.wikipedia.org/wiki/Wikipédia:AutoWikiBrowser/Typos?action=raw';
 


// install the Esperanto translation for [[:en:User:Cacycle/wikEd]]
// instalas esperanto version por [[:en:User:Cacycle/wikEd]]
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:ArnoLagrange/wikEd-eo.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
// install [[User:Cacycle/diff]] text diff code
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/diff.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
// install [[User:Pilaf/Live_Preview]] page preview tool
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.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>');



// [[:en:User:Lupin/popups.js]]
// Traduction de [[:fr:Utilisateur:Leag|Leag]] : [[:fr:Utilisateur:Leag/Navigation popups|Navigation popups]]
 
document.write('<script type="text/javascript" src="' 
+ 'http://eo.wikipedia.org/w/index.php?title=Vikipediisto:ArnoLagrange/popups-strings-eo.js' 
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
document.write('<script type="text/javascript" src="' 
+ 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

function moveEditsection() {
     if (typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false) {
         var spans = document.getElementsByTagName("span");
         for(var i = 0; i < spans.length; i++) {
             if(spans[i].className == "editsection") {
                 spans[i].style.fontSize = "x-small";
                 spans[i].style.fontWeight = "normal";
                 spans[i].style.cssFloat = "none";
                 spans[i].style.marginLeft = "0px";
                 spans[i].parentNode.appendChild(document.createTextNode(" "));
                 spans[i].parentNode.appendChild(spans[i]);
             }
         }
     }
}
// onload
$(moveEditsection);

/** Dynamic Navigation Bars (experimental) *************************************
*
*  Description: See [[Wikipedia:NavFrame]].
*  Maintainers: UNMAINTAINED
*/
 
// set up the words in your language
var autoCollapse = 1
var collapseCaption = 'Kaŝi'
var expandCaption = 'Montri'

var Nav1igationBarHide = '[' + collapseCaption + ']';
var Nav1igationBarShow = '[' + expandCaption + ']';
 
// shows and hides content and picture (if available) of navigation bars
// Parameters:
//     indexNav1igationBar: the index of navigation bar to be toggled
function toggleNav1igationBar(indexNav1igationBar)
{
    var Nav1Toggle = document.getElementById("Nav1Toggle" + indexNav1igationBar);
    var Nav1Frame = document.getElementById("Nav1Frame" + indexNav1igationBar);
 
    if (!Nav1Frame || !Nav1Toggle) {
        return false;
    }
 
    // if shown now
    if (Nav1Toggle.firstChild.data == Nav1igationBarHide) {
        for (var Nav1Child = Nav1Frame.firstChild; Nav1Child != null; Nav1Child = Nav1Child.nextSibling) {
            if ( hasClass( Nav1Child, 'NavPic' ) ) {
                Nav1Child.style.display = 'none';
            }
            if ( hasClass( Nav1Child, 'Nav1Content') ) {
                Nav1Child.style.display = 'none';
            }
        }
    Nav1Toggle.firstChild.data = Nav1igationBarShow;
 
    // if hidden now
    } else if (Nav1Toggle.firstChild.data == Nav1igationBarShow) {
        for (var Nav1Child = Nav1Frame.firstChild; Nav1Child != null; Nav1Child = Nav1Child.nextSibling) {
            if (hasClass(Nav1Child, 'NavPic')) {
                Nav1Child.style.display = 'block';
            }
            if (hasClass(Nav1Child, 'Nav1Content')) {
                Nav1Child.style.display = 'block';
            }
        }
        Nav1Toggle.firstChild.data = Nav1igationBarHide;
    }
}
 
// adds show/hide-button to navigation bars
function createNav1igationBarToggleButton()
{
    var indexNav1igationBar = 0;
    // iterate over all < div >-elements 
    var divs = document.getElementsByTagName("div");
    for (var i = 0; Nav1Frame = divs[i]; i++) {
        // if found a navigation bar
        if (hasClass(Nav1Frame, "Nav1Frame")) {
 
            indexNav1igationBar++;
            var Nav1Toggle = document.createElement("a");
            Nav1Toggle.className = 'Nav1Toggle';
            Nav1Toggle.setAttribute('id', 'Nav1Toggle' + indexNav1igationBar);
            Nav1Toggle.setAttribute('href', 'javascript:toggleNav1igationBar(' + indexNav1igationBar + ');');
 
            var isCollapsed = hasClass( Nav1Frame, "collapsed" );
            /*
             * Check if any children are already hidden.  This loop is here for backwards compatibility:
             * the old way of making Nav1Frames start out collapsed was to manually add style="display:none"
             * to all the NavPic/Nav1Content elements.  Since this was bad for accessibility (no way to make
             * the content visible without JavaScript support), the new recommended way is to add the class
             * "collapsed" to the Nav1Frame itself, just like with collapsible tables.
             */
            for (var Nav1Child = Nav1Frame.firstChild; Nav1Child != null && !isCollapsed; Nav1Child = Nav1Child.nextSibling) {
                if ( hasClass( Nav1Child, 'NavPic' ) || hasClass( Nav1Child, 'Nav1Content' ) ) {
                    if ( Nav1Child.style.display == 'none' ) {
                        isCollapsed = true;
                    }
                }
            }
            if (isCollapsed) {
                for (var Nav1Child = Nav1Frame.firstChild; Nav1Child != null; Nav1Child = Nav1Child.nextSibling) {
                    if ( hasClass( Nav1Child, 'NavPic' ) || hasClass( Nav1Child, 'Nav1Content' ) ) {
                        Nav1Child.style.display = 'none';
                    }
                }
            }
            var Nav1ToggleText = document.createTextNode(isCollapsed ? Nav1igationBarShow : Nav1igationBarHide);
            Nav1Toggle.appendChild(Nav1ToggleText);
 
            // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
            for(var j=0; j < Nav1Frame.childNodes.length; j++) {
                if (hasClass(Nav1Frame.childNodes[j], "NavHead")) {
                    Nav1Frame.childNodes[j].appendChild(Nav1Toggle);
                }
            }
            Nav1Frame.setAttribute('id', 'Nav1Frame' + indexNav1igationBar);
        }
    }
}
 
$( createNav1igationBarToggleButton );

document.write('<script type="text/javascript" src="' 
+ 'http://eo.wikipedia.org/w/index.php?title=Vikipediisto:ArnoLagrange/cache.js' 
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

/*
function toggleRevRatings(){
  var FlaggedRevTag = document.getElementById('mw-revisiontag');
  var SubDiv = document.getElementById('mw-revisionratings');
  if (SubDiv.style.display == 'block'){
    FlaggedRevTag.style.background = 'none';
    SubDiv.style.display = 'none';
    FlaggedRevTag.getElementsByTagName('b')[0].style.display = 'none';
  }
  else {
    FlaggedRevTag.style.background = '#F9F9F9';
    SubDiv.style.display = 'block';   
    FlaggedRevTag.getElementsByTagName('b')[0].style.display = 'inline';
  }
}
$(toggleRevRatings);
*/
 
function removeFlaggedRevInfotext(){
  var FlaggedRevTag = document.getElementById('mw-revisiontag');
  if (FlaggedRevTag != null){
    var TextNode = FlaggedRevTag.getElementsByTagName('b')[0];
    if (TextNode != null) TextNode.style.display = 'none';
  }
}

// addOnloadHook(removeFlaggedRevInfotext);


document.write('<script type="text/javascript" src="' 
+ 'http://eo.wikipedia.org/w/index.php?title=Vikipediisto:ArnoLagrange/aliaj_projektoj.js' 
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');


/**
* Forŝovo de la geografiaj koordinatoj supre de la paĝo 
*/
function moveCoord() {
var h1 = document.getElementsByTagName("h1")[0];
var coord = document.getElementById('coordinates');
if ( !coord || !h1 ) return;
coord.id = "coordinates-title";
h1.insertBefore(coord, h1.firstChild);
}
$(moveCoord);
//</source>