Χρήστης:Lou/monobook.js

Από Βικιλεξικό
Μετάβαση στην πλοήγηση Πήδηση στην αναζήτηση

Σημείωση: μετά την δημοσίευση, ίσως χρειαστεί να παρακάμψετε την προσωρινή μνήμη του προγράμματος περιήγησής σας για να δείτε τις αλλαγές.

  • Firefox / Safari: Κρατήστε πατημένο το Shift κάνοντας ταυτόχρονα κλικ στο κουμπί Ανανέωση ή πιέστε Ctrl-F5 ή Ctrl-R (⌘-R σε Mac)
  • Google Chrome: Πιέστε Ctrl-Shift-R (⌘-Shift-R σε Mac)
  • Internet Explorer / Edge: Κρατήστε πατημένο το Ctrl κάνοντας ταυτόχρονα κλικ στο κουμπί Ανανέωση, ή πιέστε Ctrl-F5
  • Opera: Πιέστε Ctrl-F5.
/* <source lang="javascript"> */
 
/* Ouvre toutes les boîtes déroulantes par défaut */
// var NavigationBarShowDefault = 20;

// addPurge
$(function () {
var hist; var url;
if (!(hist = document.getElementById('ca-history') )) return;
if (!(url = hist.getElementsByTagName('a')[0] )) return;
if (!(url = url.href )) return;
mw.util.addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
'εκκένωση', 'ca-purge', 'Purge server cache for this page', '0');
});

/*
__FORCETOC__
== BARRE EDITION BOUTON ==
<pre>*/

function DeluxeBar() {
  if (document.createTextNode) {
        var toolbar = document.getElementById("toolbar"); 
        if (!toolbar) return;
        

        var messages = new Array()
        var images = new Array()
        var commentaires = new Array()
        var a=-1;

//Le décompte commence à -1 avec une incrémentation sur le premier message, pour éviter tout problème en cas d'inversion ou suppression du premier message

        // le texte a été splitté sinon Mediawiki casse tout...

         messages[++a] = "==={{" + "ετυμολογία" + "}}===" + "\\n" + ": "+ "'''{{" +"PAGENAME" + "}}''' < " + "\\n";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/b/b6/Vjazyce-button.png";
        commentaires[a] = "ετυμολογία"

         messages[++a] = "==={{" + "προφορά" + "}}===" + "\\n" + "{{" +"ΔΦΑ|X" + "}}" + "\\n";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/f/f2/Button_prononciation.png";
        commentaires[a] = "προφορά"

         messages[++a] = "===={{" + "συγγενικά" + "}}====" + "\\n";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/5/5e/Button_API_%C9%91.png";
        commentaires[a] = "συγγενικά"

         messages[++a] = "#:: {{" + "συνων" + "}}";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/5/5e/Button_API_%C9%91.png";
        commentaires[a] = "συνώνυμα"

         messages[++a] = "#:: {{" + "αντων" + "}}";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/5/5e/Button_API_%C9%91.png";
        commentaires[a] = "αντώνυμα"

         messages[++a] = "{{" + "fr-κλίσ-rég" + "}}" + "\\n";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/5/5e/Button_API_%C9%91.png";
        commentaires[a] = "κλίση"

         messages[++a] = "{{" + "fr-κλίσ-mf-rég" + "}}" + "\\n";
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/5/5e/Button_API_%C9%91.png";
        commentaires[a] = "κλίση"

         messages[++a] = "=={{-fr-}}==\\n\\n==={{ουσιαστικό|fr}}===\\n{{fr-κλίσ-rég}}\\n{{τ|fr|{{PAGENAME}}}}"
        images[a] = "http://upload.wikimedia.org/wikipedia/commons/5/5e/Button_API_%C9%91.png";
        commentaires[a] = ""

      ////////////////////////////////

for (var i=0;i<messages.length;i++) {
                var img = document.createElement("img");
                img.setAttribute("src", images[i]);
                
                var ref = document.createElement("a");
                ref.setAttribute("href", "javascript:insertTags('', \"" + messages[i] + "\", '');" + 
                                 "javascript:changeSummary(\"" + commentaires[i] + "\");" ); 
                ref.appendChild(img); 
                
                toolbar.appendChild(ref);
        }
  }
}

function changeSummary(sampleText) {
        document.editform.wpSummary.value = sampleText;
}

addLoadEvent(DeluxeBar);


/*</pre>
=== εισαγωγή νέων κουμπιών στην εργαλειοθήκη ===
<pre>*/
 
//Remplit la variable mwCustomEditButtons (voir /skins-1.5/commons/wikibits.js) pour ajouter des boutons à la barre d'outils
function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText)
{
 mwCustomEditButtons[mwCustomEditButtons.length] =
 {"imageFile": imageFile,
  "speedTip": speedTip,
  "tagOpen": tagOpen,
  "tagClose": tagClose,
  "sampleText": sampleText};
}

addCustomButton('http://upload.wikimedia.org/wikipedia/commons/5/5e/Button_API_%C9%91.png','Prononciation',"ɑ","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/a/a7/Button_API_%C9%94.png','Prononciation',"ɔ","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/7/74/Button_API_%C9%9B.png','Prononciation',"ɛ","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/1/1e/Button_API_%C5%93.png','Prononciation',"œ","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/6/66/Button_API_tilde.png','Prononciation',"̃","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/8/81/Button_API_%C9%99.png','Prononciation',"ə","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/2/22/Button_API_%C3%B8.png','Prononciation',"ø","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/c/c0/Button_API_%C9%A5.png','Prononciation',"ɥ","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/8/83/Button_API_%CB%90.png','Prononciation',"ː","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/5/55/Button_API_%E2%80%BF.png','Prononciation',"‿","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/1/13/Button_API_%CA%83.png','Prononciation',"ʃ","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/b/b2/Button_API_%CA%94.png','Prononciation',"ʔ","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/2/27/Button_API_%CA%92.png','Prononciation',"ʒ","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/c/c3/Button_API_%C9%B2.png','Prononciation',"ɲ","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/c/ca/Button_API_%C5%8B.png','Prononciation',"ŋ","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/f/ff/Button_API_%CA%81.png','Prononciation',"ʁ","",'');

addCustomButton('http://upload.wikimedia.org/wikipedia/commons/b/bf/Button_pagename.png','pagename',"\'\'\'\{\{PAGENAME\}\}\'\'\'","",'');
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/e/e1/Button_flag_of_France.png','ξεν fr',"\{\{τ|fr|","\{\{PAGENAME\}\}\}\}",'');

// Ressemble à la fonction de /skins-1.5/commons/wikibits.js pour insérer un autre lien que insertTags
function marque_tab()
{
 var toolbar = document.getElementById('toolbar');
 if (!toolbar) return false;
 
 var textbox = document.getElementById('wpTextbox1');
 if (!textbox) return false;
 
 if (!document.selection && textbox.selectionStart == null)
 return false;
 
 var image = document.createElement("img");
 image.width = 23;
 image.height = 22;
 toolbar.appendChild(image);
}
 
$(marque_tab);

/* </pre> */

/**
 * Create a new DOM node for the current document.
 *    Basic usage:  var mySpan = newNode('span', "Hello World!")
 *    Supports attributes and event handlers*: var mySpan = newNode('span', {style:"color: red", focus: function(){alert(this)}, id:"hello"}, "World, Hello!")
 *    Also allows nesting to create trees: var myPar = newNode('p', newNode('b',{style:"color: blue"},"Hello"), mySpan)
 *
 * *event handlers, there are some issues with IE6 not registering event handlers on some nodes that are not yet attached to the DOM,
 * it may be safer to add event handlers later manually.
**/
function newNode(tagname){
 
  var node = document.createElement(tagname);
 
  for( var i=1;i<arguments.length;i++ ){
 
    if(typeof arguments[i] == 'string'){ //Text
      node.appendChild( document.createTextNode(arguments[i]) );
 
    }else if(typeof arguments[i] == 'object'){ 
 
      if(arguments[i].nodeName){ //If it is a DOM Node
        node.appendChild(arguments[i]);
 
      }else{ //Attributes (hopefully)
        for(var j in arguments[i]){
          if(j == 'class'){ //Classname different because...
            node.className = arguments[i][j];
 
          }else if(j == 'style'){ //Style is special
            node.style.cssText = arguments[i][j];
 
          }else if(typeof arguments[i][j] == 'function'){ //Basic event handlers
            try{ node.addEventListener(j,arguments[i][j],false); //W3C
            }catch(e){try{ node.attachEvent('on'+j,arguments[i][j],"Language"); //MSIE
            }catch(e){ node['on'+j]=arguments[i][j]; }}; //Legacy
 
          }else{
            node.setAttribute(j,arguments[i][j]); //Normal attributes
 
          }
        }
      }
    }
  }
 
  return node;
}
 
/* Cross browser CSS - yurk */
var p_styleSheet=false;
 
window.addCSSRule = function (selector,cssText){
  if(!p_styleSheet) return setupCSS(selector,cssText);
  if(p_styleSheet.insertRule){
    p_styleSheet.insertRule( selector+' { '+cssText+' }', p_styleSheet.cssRules.length );
  }else if(p_styleSheet.addRule){ //Guess who...
    p_styleSheet.addRule(selector,cssText);
  }
 
  function setupCSS(selector,cssText){
    if(document.styleSheets){
      var i = document.styleSheets.length-1;
      while(i>=0){
        try{ //This loop tries to get around the irritation that some extensions
             //include external, and thus read-only, stylesheets. Bah.
          p_styleSheet = document.styleSheets[i];
          var media = p_styleSheet.media.mediaType?p_styleSheet.media.mediaType:p_styleSheet.media;
          if( media.indexOf('screen') > -1 || media == '' ){
            addCSSRule(selector,cssText);
            return true;
          }
        }catch(e){ i--; }
      }
    }
    //Ok document.stylesheets isn't an option :(... take this for hacky
    //It might be better to create one <style> element and write into it
    // but it doesn't work :(
    window.addCSSRule = function(sel,css){
      var head = document.getElementsByTagName('head')[0];
      var text = sel + '{' + css + '}';
      try { head.innerHTML += '<style type="text/css">' + text + '</style>'; }
      catch(e) {
        var style = document.createElement('style');
        style.setAttribute('type', 'text/css');
        style.appendChild(document.createTextNode(text));
        head.appendChild(style);
      }
    }
    addCSSRule(selector,cssText);
  }
}
 
// πηγή: atg
$(function() {
  if (wgNamespaceNumber != 0) {
    return;
  }
  addCSSRule('.ns-0 #toc','float: right; clear: right; margin-left: 7px; margin-bottom: 6px; display: inline;');
  var BodyContent = document.getElementById('bodyContent');
  var ContentStart = document.getElementById('contentSub');
 
  var Toc = document.getElementById('toc');
  if (!Toc) {
    return;
  }
  var TocListItems = Toc.getElementsByTagName('li');
  if (!TocListItems) {
    return;
  }
  var TabHolder = newNode('table', { 'style': 'background:#F8FCFF; text-align:center; border-collapse:collapse; border-width:0px;', 'id':'atgtabholder' } );
  var TabHolderRow = newNode('tr', '');
  var Count = 0;
 
  for (var i=0; i< TocListItems.length; i++) {
    var TocListEntry = TocListItems[i];
    if (TocListEntry.className.search(/^toclevel-1( |$)/) == 0) {
       // <a ...><span>nn</span><span>text</span>...</a>
       var TocListEntryHrefSpanText = TocListEntry.childNodes[0].innerHTML;
       TocListEntryHrefSpanText.match(/(\(.+\))/);  // get the lang code in the parens?
       TocListEntryHrefSpanText = RegExp.$1;
       // now get all the links and look for the ones with pos
       var TocListEntryLinks = TocListEntry.getElementsByTagName('a');
       for (j=0; j<TocListEntryLinks.length; j++) {
          var TocListEntryLinkSpanStuff = TocListEntryLinks[j].innerHTML;
          TocListEntryLinkSpanStuff.match(/<span[^>]*>([^0-9.<]+)( [0-9]+)?<\/span>/);
          var TocListEntryLinkSpanText = RegExp.$1;
          if ( TocListEntryLinkSpanText == 'Ουσιαστικό' ||
            TocListEntryLinkSpanText == 'Πρόθεση' ||
            TocListEntryLinkSpanText == 'Μετοχή' ||
            TocListEntryLinkSpanText == 'Μόριο' ||
            TocListEntryLinkSpanText == 'Ρήμα' ||
            TocListEntryLinkSpanText == 'Επίθετο' ||
            TocListEntryLinkSpanText == 'Επίρρημα' ||
            TocListEntryLinkSpanText == 'Αριθμητικό' ||
            TocListEntryLinkSpanText == 'Χαρακτήρας' ||
            TocListEntryLinkSpanText == 'Έκφραση' ||
            TocListEntryLinkSpanText == 'Επιθετική έκφραση' ||
            TocListEntryLinkSpanText == 'Επίθημα' ||
            TocListEntryLinkSpanText == 'Επιρρηματική έκφραση' ||
            TocListEntryLinkSpanText == 'Επιφώνημα' ||
            TocListEntryLinkSpanText == 'Κύριο όνομα' ||
            TocListEntryLinkSpanText == 'Κατάληξη επιρρημάτων' ||
            TocListEntryLinkSpanText == 'Κατάληξη θηλυκών ουσιαστικών' ||
            TocListEntryLinkSpanText == 'Κατάληξη ουδέτερων ουσιαστικών' ||
            TocListEntryLinkSpanText == 'Κατάληξη ρημάτων' ||
            TocListEntryLinkSpanText == 'Κατάληξη αρσενικών επιθέτων' ||
            TocListEntryLinkSpanText == 'Συντομομορφή' ||
            TocListEntryLinkSpanText == 'Σύνδεσμος' ||
            TocListEntryLinkSpanText == 'Πρόθημα' ||
            TocListEntryLinkSpanText == 'Πολυλεκτικός όρος' ||
            TocListEntryLinkSpanText == 'Κατάληξη αρσενικών ουσιαστικών' ||
            TocListEntryLinkSpanText == 'Σύμβολο' ||
            TocListEntryLinkSpanText == 'Κατάληξη αρσενικών και θηλυκών ουσιαστικών' ) {
 
            if (Count == 0) {
               BodyContent.insertBefore(TabHolder,ContentStart);
               TabHolder.appendChild(TabHolderRow);
            }
            else {
              var TabNode = newNode('td', { 'style': 'padding:0px; border-bottom:2px solid #A3B1BF; width:3px;'} );
              TabHolderRow.appendChild(TabNode);
            }
            TabCellStyle='padding:0.5em; background-color:#CEE0F2; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF;';
            // <a ...><span>nn</span><span>text</span>...</a>
            var TabNode = newNode('td', { 'style': TabCellStyle } );
            if (Count%10 == 0 && Count > 0) {
               // καινούργια γραμμή μετά από 10 καρτέλες
               TabHolderRow = newNode('tr', '');
               TabHolder.appendChild(TabHolderRow);
            }
            Count++;
            TabHolderRow.appendChild(TabNode);
            var TabNodeLink = newNode('a', { 'href': TocListEntryLinks[j].href } );
            TabNode.appendChild(TabNodeLink);
            TabNodeLinkText = newNode('span', Count + ". " + TocListEntryLinkSpanText + " " +  TocListEntryHrefSpanText );
            TabNodeLink.appendChild(TabNodeLinkText);
          }       
       }
    }
  }
  if ( Count == 1 ) {
     // σβήνουμε την μοναδική καρτέλα :-P
     var TabHolder = document.getElementById('atgtabholder');
     BodyContent.removeChild(TabHolder);
  }
});