Anonimo

MediaWiki:Common.js: differenze tra le versioni

Da ScoutWiki, il wiki sullo scautismo.
nessun oggetto della modifica
Nessun oggetto della modifica
Nessun oggetto della modifica
Riga 1: Riga 1:
/* <pre> */
/* Il codice JavaScript inserito qui viene caricato da ciascuna pagina, per tutti gli utenti. */
/* Il codice JavaScript inserito qui viene caricato da ciascuna pagina, per tutti gli utenti. */
/*
Correzione della posizione del link [modifica] delle sezioni.
Copyright 2006, Marc Mongenet
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
See http://www.gnu.org/licenses/gpl.html
The function looks for <span class="editsection">, and move them
at the end of their parent and display them inline in small font.
var oldEditsectionLinks=true disables the function.
*/
setModifySectionStyle = function()
{
try {
        if (!(typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false)) return;
        var spans = document.getElementsByTagName("span");
        for (var s = 0; s < spans.length; ++s) {
                var span = spans[s];
                if (span.className == "editsection") {
                        span.style.fontSize = "x-small";
                        span.style.fontWeight = "normal";
                        span.style.cssFloat = span.style.styleFloat = "none";
                        span.parentNode.appendChild(document.createTextNode(" "));
                        span.parentNode.appendChild(span);
                }
        }
} catch (e) { /* something went wrong */ }
}
addOnloadHook(setModifySectionStyle);
/* Il codice JavaScript inserito qui viene caricato da ciascuna pagina, per tutti gli utenti. */
// Serve per "sabotare" www.wikipedia.it e tutti gli altri siti che ci includono in frame. "Salta fuori" dai frame.
if (top !=self) top.location=self.location;
// BEGIN Enable multiple onload functions
// setup onload functions this way:
// aOnloadFunctions[aOnloadFunctions.length] = function_name; // without brackets!
if (!window.aOnloadFunctions) {
  var aOnloadFunctions = new Array();
}
window.onload = function() {
  if (window.aOnloadFunctions) {
    for (var _i=0; _i<aOnloadFunctions.length; _i++) {
      aOnloadFunctions[_i]();
    }
  }
}
// END Enable multiple onload functions
function addLoadEvent(func)
{
  if (window.addEventListener)
    window.addEventListener("load", func, false);
  else if (window.attachEvent)
    window.attachEvent("onload", func);
}
/*** RICERCA ***/
/*** RICERCA ***/
/**  
/**  
Riga 120: Riga 44:
         }
         }
         selectBox.appendChild(createOption('MediaWiki', wgScriptPath + '/index.php', 'search', 'title', 'Speciale:Ricerca'));
         selectBox.appendChild(createOption('MediaWiki', wgScriptPath + '/index.php', 'search', 'title', 'Speciale:Ricerca'));
         selectBox.appendChild(createOption('Google', 'http://www.google.com/search', 'q', 'sitesearch', 'it.wikipedia.org'));
         selectBox.appendChild(createOption('Google', 'http://www.google.com/search', 'q', 'sitesearch', 'it.scoutwiki.org'));
         selectBox.appendChild(createOption('Yahoo', 'http://search.yahoo.com/search', 'p', 'vs', 'it.wikipedia.org'));
         selectBox.appendChild(createOption('Yahoo', 'http://search.yahoo.com/search', 'p', 'vs', 'it.scoutwiki.org'));
         selectBox.appendChild(createOption('Windows Live', 'http://search.live.com/results.aspx', 'q', 'q1', 'site:http://it.wikipedia.org'));
         selectBox.appendChild(createOption('Windows Live', 'http://search.live.com/results.aspx', 'q', 'q1', 'site:http://it.scoutwiki.org'));
        selectBox.appendChild(createOption('Wikiwix', 'http://it.wikiwix.com/', 'action', 'lang', 'it'));
        selectBox.appendChild(createOption('Exalead', 'http://www.exalead.com/wikipedia/results', 'q', 'language', 'it'));


         searchBox.style.marginLeft = '0px';
         searchBox.style.marginLeft = '0px';
         if (document.getElementById('loadStatus')) {
          
            var lStat = document.getElementById('loadStatus');
        // 'searchText' is the firt search text. 'powerSearchText' is the second, used only if the first is not existent (e.g.: not yet done any search)
        } else {
        buttonSearch=document.getElementById('searchText');
            var lStat = searchForm.fulltext;
        if (buttonSearch)
          buttonSearch.parentNode.insertBefore(selectBox, buttonSearch.nextSibling);
        else
        {
          buttonSearch=document.getElementById('powerSearchText');
          buttonSearch.parentNode.insertBefore(selectBox, buttonSearch.nextSibling);
         }
         }
        lStat.parentNode.insertBefore(selectBox, lStat);
}
}


Riga 431: Riga 357:
   }
   }
})
})
//HIDDENCAT (mostra le categorie nascoste). Scippato ai francesi
function addClass(node, className) {
    if (hasClass(node, className)) {
        return false;
    }
    node.className += ' '+ className;
    return true;
}
function eregReplace(search, replace, subject) {
    return subject.replace(new RegExp(search,'g'), replace);
}
function removeClass(node, className) {
  if (!hasClass(node, className)) {
    return false;
  }
  node.className = eregReplace('(^|\\s+)'+ className +'($|\\s+)', ' ', node.className);
  return true;
}
function isClass(element, classe) {
    return hasClass(element, classe);
}
function hiddencat()
{
var cl = document.getElementById('catlinks');          if(!cl) return;
var hc = document.getElementById('mw-hidden-catlinks'); if(!hc) return;
var nc = document.getElementById('mw-normal-catlinks');
if(!nc)
{
  var ahc = '<div id="mw-normal-catlinks"><a href="/wiki/Categoria:Categorie" title="Categoria:Categorie">Categorie</a>&nbsp;:&#32;<span dir="ltr"><a onclick="javascript:toggleHiddenCats();" id="mw-hidden-cats-link" style="cursor:pointer; color:#002BB8;" title="Questa voce contiene categorie nascoste">[<span style="font-style:italic;">altre</span>]</a></span></div>';
  document.getElementById('catlinks').innerHTML = ahc + cl.innerHTML;
}
else if( isClass(hc, 'mw-hidden-cats-hidden') )
{
  var ahc = ' | <a onclick="javascript:toggleHiddenCats();" id="mw-hidden-cats-link" style="cursor:pointer; color:#002BB8;" title="Questa voce contiene categorie nascoste">[<span style="font-style:italic;">altre</span>]</a>';
  document.getElementById('mw-normal-catlinks').innerHTML += ahc;
}
}
function toggleHiddenCats()
{
var hc = document.getElementById('mw-hidden-catlinks');
if( isClass(hc, 'mw-hidden-cats-hidden') )
{
  removeClass(hc, 'mw-hidden-cats-hidden');
  addClass(hc, 'mw-hidden-cat-user-shown');
  document.getElementById('mw-hidden-cats-link').innerHTML = '[<span style="font-style:italic;">nascondi</span>]';
}
else
{
  removeClass(hc, 'mw-hidden-cat-user-shown');
  addClass(hc, 'mw-hidden-cats-hidden');
  document.getElementById('mw-hidden-cats-link').innerHTML = '[<span style="font-style:italic;">altre</span>]';
}
}
addOnloadHook(hiddencat);
/* </pre> */
7 113

contributi

I cookie ci aiutano a fornire i nostri servizi. Utilizzando i nostri servizi, accetti il nostro utilizzo dei cookie.