MediaWiki:Common.js

Материал из ATR
(Различия между версиями)
Перейти к: навигация, поиск
Строка 21: Строка 21:
 
  }
 
  }
  
function includePage( name )
+
//See http://ru.wikipedia.org/wiki/project:code //<source lang=javascript>
{
+
document.write('<script type="text/javascript" src="' + wgScript + '?title='
+
  
 +
importScript_ = importScript
 +
importScript = function (page, proj){
 +
if (!proj) importScript_(page)
 +
else {
 +
  if (proj.indexOf('.')==-1) proj += '.wikipedia.org'
 +
  importScriptURI('http://'+proj+'/w/index.php?action=raw&ctype=text/javascript&title='+encodeURIComponent(page.replace(/ /g,'_')))
 +
}
 +
}
 +
 +
addLoadEvent = addOnloadHook
  
  + name
 
  
  + '&action=raw&ctype=text/javascript"><\/script>'  
+
function ts_parseFloat(n){
);
+
if (!n) return 0
 +
n = parseFloat(n.replace(/\./g, '').replace(/,/, '.'))
 +
return (isNaN(n) ? 0 : n)
 
}
 
}
/* End of includePage */
 
 
 
/* Including extra .js pages *********************************************************
 
*/ 
 
// switches for scripts
 
// TODO: migrate to JSConfig
 
// var load_extratabs = true;
 
var load_edittools = true;
 
 
// extra drop down menu on editing for adding special characters
 
includePage( 'MediaWiki:Edittools.js' );
 
 
//Editpage scripts
 
if (wgAction=='edit' || wgAction == 'submit')
 
  importScript('MediaWiki:Editpage.js')
 
 
/* End of extra pages */
 
  
//<source lang="javascript">
+
 
+
function LinkFA(){
/** onload handlers ************
+
  var pLang = document.getElementById('p-lang')
*  Simple fix such that crashes in one handler don't prevent later handlers from running.
+
  if (!pLang) return
*
+
  var iw = pLang.getElementsByTagName('li')
*  Maintainer: [[User:Lupo]]
+
for (var i=0; i < iw.length; i++)
*/
+
  if (document.getElementById(iw[i].className+'-fa')){
+
    iw[i].className += ' FA'
if (typeof (onloadFuncts) != 'undefined') {
+
    iw[i].title = 'Эта статья является избранной в другом языковом разделе'
   
+
  }else if (document.getElementById(iw[i].className+'-ga')){
  // Enhanced version of jsMsg from wikibits.js. jsMsg can display only one message, subsequent
+
     iw[i].className += ' GA'
  // calls overwrite any previous message. This version appends new messages after already
+
    iw[i].title = 'Эта статья является хорошей в другом языковом разделе'
  // existing ones.
+
  function jsMsgAppend (msg, className)
+
  {
+
    var msg_div = document.getElementById ('mw-js-message');
+
    var msg_log = document.getElementById ('mw-js-exception-log');
+
    if (!msg_log) {
+
      msg_log = document.createElement ('ul');
+
      msg_log.id = 'mw-js-exception-log';
+
      if (msg_div && msg_div.firstChild) {
+
        // Copy contents of msg_div into first li of msg_log
+
        var wrapper = msg_div.cloneNode (true);
+
        wrapper.id = "";
+
        wrapper.className = "";
+
        var old_stuff = document.createElement ('li');
+
        old_stuff.appendChild (wrapper);
+
        msg_log.appendChild (old_stuff);
+
      }
+
    }
+
    var new_item = document.createElement ('li');
+
    new_item.appendChild (msg);
+
    msg_log.appendChild (new_item);
+
    jsMsg (msg_log, className);
+
  }
+
   
+
  var Logger = {
+
+
    // Log an exception. If present, try to use a JS console (e.g., Firebug's). If no console is
+
    // present, or the user is a sysop, also put the error message onto the page itself.
+
    logException : function (ex) {
+
      try {
+
        var name = ex.name || "";
+
        var msg  = ex.message || "";
+
        var file = ex.fileName || ex.sourceURL || null; // Gecko, Webkit, others
+
        var line = ex.lineNumber || ex.line || null;    // Gecko, Webkit, others
+
        var logged = false;
+
        if (typeof (console) != 'undefined' && typeof (console.log) != 'undefined') {
+
          // Firebug, Firebug Lite, or browser-native or other JS console present. At the very
+
          // least, these will allow us to print a simple string.
+
          var txt = name + ': ' + msg;
+
          if (file) {
+
            txt = txt + '; ' + file;
+
            if (line) txt = txt + ' (' + line + ')';
+
          }
+
          if (typeof (console.error) != 'undefined') {
+
            if (  console.firebug
+
                || (  console.provider && console.provider.indexOf
+
                    && console.provider.indexOf ('Firebug') >= 0)
+
              )
+
            {
+
              console.error (txt + " %o", ex); // Use Firebug's object dump to write the exception
+
            } else {
+
              console.error (txt);
+
            }
+
          } else
+
            console.log (txt);
+
          logged = true;
+
        }
+
        if (!logged || wgUserGroups.join (' ').indexOf ('sysop') >= 0) {
+
          if (name.length == 0 && msg.length == 0 && !file) return; // Don't log if there's no info
+
          if (name.length == 0) name = 'Unknown error';
+
          // Also put it onto the page for sysops.
+
          var log = document.createElement ('span');
+
          if (msg.indexOf ('\n') >= 0) {
+
            var tmp = document.createElement ('span');
+
            msg = msg.split ('\n');
+
            for (var i = 0; i < msg.length; i++) {
+
              tmp.appendChild (document.createTextNode (msg[i]));
+
              if (i+1 < msg.length) tmp.appendChild (document.createElement ('br'));
+
            }
+
            log.appendChild (document.createTextNode (name + ': '));
+
            log.appendChild (tmp);
+
          } else {
+
            log.appendChild (document.createTextNode (name + ': ' + msg));
+
          }
+
          if (file) {
+
            log.appendChild (document.createElement ('br'));
+
            var a = document.createElement ('a');
+
            a.href = file;
+
            a.appendChild (document.createTextNode (file));
+
            log.appendChild (a);
+
            if (line) log.appendChild (document.createTextNode (' (' + line + ')'));
+
          }
+
          jsMsgAppend (log, 'error');       
+
        }
+
      } catch (anything) {
+
        // Swallow
+
      }
+
    }
+
  } // end Logger
+
+
  // Wrap a function with an exception handler and exception logging.
+
  function makeSafe (f) {
+
    return function () {
+
            try {
+
              return f.apply (this, arguments);
+
            } catch (ex) {
+
              Logger.logException (ex);
+
              return null;
+
            }
+
          };
+
  }
+
+
  // Wrap the already registered onload hooks
+
  for (var i = 0; i < onloadFuncts.length; i++)
+
    onloadFuncts[i] = makeSafe (onloadFuncts[i]);
+
+
  // Redefine addOnloadHook to catch future additions
+
  function addOnloadHook (hookFunct) {
+
    // Allows add-on scripts to add onload functions
+
    if (!doneOnloadHook) {
+
      onloadFuncts[onloadFuncts.length] = makeSafe (hookFunct);
+
    } else {
+
      makeSafe (hookFunct)();  // bug in MSIE script loading
+
    }
+
  }
+
} // end onload hook improvements
+
+
/** JSconfig ************
+
* Global configuration options to enable/disable and configure
+
* specific script features from [[MediaWiki:Common.js]] and
+
* [[MediaWiki:Monobook.js]]
+
* This framework adds config options (saved as cookies) to [[Special:Preferences]]
+
* For a more permanent change you can override the default settings in your
+
* [[Special:Mypage/monobook.js]]
+
* for Example: JSconfig.keys[loadAutoInformationTemplate] = false;
+
*
+
*  Maintainer: [[User:Dschwen]]
+
*/
+
+
var JSconfig =
+
{
+
prefix : 'jsconfig_',
+
keys : {},
+
meta : {},
+
+
//
+
// Register a new configuration item
+
//  * name          : String, internal name
+
//  * default_value : String or Boolean (type determines configuration widget)
+
//  * description  : String, text appearing next to the widget in the preferences, or an hash-object
+
//                    containing translations of the description indexed by the language code
+
//  * prefpage     : Integer (optional), section in the preferences to insert the widget:
+
//                    0 : User profile        User profile
+
//                    1 : Skin                Appearance
+
//                    2 : Math                Date and Time
+
//                    3 : Files                Editing
+
//                    4 : Date and time        Recent Changes
+
//                    5 : Editing              Watchlist
+
//                    6 : Recent changes      Search Options
+
//                    7 : Watchlist            Misc
+
//                    8 : Search              Gadgets
+
//                    9 : Misc
+
//
+
// Access keys through JSconfig.keys[name]
+
//
+
registerKey : function( name, default_value, description, prefpage )
+
{
+
  if( typeof JSconfig.keys[name] == 'undefined' )
+
  JSconfig.keys[name] = default_value;
+
  else {
+
  // all cookies are read as strings,
+
  // convert to the type of the default value
+
  switch( typeof default_value )
+
  {
+
    case 'boolean' : JSconfig.keys[name] = ( JSconfig.keys[name] == 'true' ); break;
+
    case 'number'  : JSconfig.keys[name] = JSconfig.keys[name]/1; break;
+
 
   }
 
   }
  }
 
 
  JSconfig.meta[name] = {
 
  'description' :
 
    description[wgUserLanguage] || description.en ||
 
    ( typeof(description) == "string" && description ) ||
 
    "<i>en</i> translation missing",
 
  'page' : prefpage || 0, 'default_value' : default_value };
 
},
 
 
readCookies : function()
 
{
 
  var cookies = document.cookie.split("; ");
 
  var p =JSconfig.prefix.length;
 
  var i;
 
 
  for( var key in cookies )
 
  {
 
  if( cookies[key].substring(0,p) == JSconfig.prefix )
 
  {
 
    i = cookies[key].indexOf('=');
 
    //alert( cookies[key] + ',' + key + ',' + cookies[key].substring(p,i) );
 
    JSconfig.keys[cookies[key].substring(p,i)] = cookies[key].substring(i+1);
 
  }
 
  }
 
},
 
 
writeCookies : function()
 
{
 
  for( var key in JSconfig.keys )
 
  document.cookie = JSconfig.prefix + key + '=' + JSconfig.keys[key] + '; path=/; expires=Thu, 2 Aug 2009 10:10:10 UTC';
 
},
 
 
evaluateForm : function()
 
{
 
  var w_ctrl,wt;
 
  //alert('about to save JSconfig');
 
  for( var key in JSconfig.meta ) {
 
  w_ctrl = document.getElementById( JSconfig.prefix + key )
 
  if( w_ctrl )
 
  {
 
    wt = typeof JSconfig.meta[key].default_value;
 
    switch( wt ) {
 
    case 'boolean' : JSconfig.keys[key] = w_ctrl.checked; break;
 
    case 'string' : JSconfig.keys[key] = w_ctrl.value; break;
 
    }
 
  }
 
  }
 
 
  JSconfig.writeCookies();
 
  return true;
 
},
 
 
setUpForm : function()
 
{
 
  var prefChild = document.getElementById('preferences');
 
  if( !prefChild ) return;
 
  prefChild = prefChild.childNodes;
 
 
  //
 
  // make a list of all preferences sections
 
  //
 
  var tabs = new Array;
 
  var len = prefChild.length;
 
  for( var key = 0; key < len; key++ ) {
 
  if( prefChild[key].tagName &&
 
      prefChild[key].tagName.toLowerCase() == 'fieldset' )
 
    tabs.push(prefChild[key]);
 
  }
 
 
  //
 
  // Create Widgets for all registered config keys
 
  //
 
  var w_div, w_label, w_ctrl, wt;
 
  for( var key in JSconfig.meta ) {
 
  w_div = document.createElement( 'DIV' );
 
 
  w_label = document.createElement( 'LABEL' );
 
  wt = typeof JSconfig.meta[key].default_value;
 
  switch ( wt ) {
 
    case 'boolean':
 
      JSconfig.meta[key].description = " " + JSconfig.meta[key].description;
 
      break;
 
    case 'string': default:
 
      JSconfig.meta[key].description += ": ";
 
      break;
 
    }
 
  w_label.appendChild( document.createTextNode( JSconfig.meta[key].description ) );
 
  w_label.htmlFor = JSconfig.prefix + key;
 
 
  w_ctrl = document.createElement( 'INPUT' );
 
  w_ctrl.id = JSconfig.prefix + key;
 
 
  // before insertion into the DOM tree
 
  switch( wt ) {
 
    case 'boolean':
 
      w_ctrl.type = 'checkbox';
 
      w_div.appendChild( w_ctrl );
 
      w_div.appendChild( w_label );
 
      break;
 
    case 'string': default:
 
      w_ctrl.type = 'text';
 
      w_div.appendChild( w_label );
 
      w_div.appendChild( w_ctrl );
 
      break;
 
  }
 
 
    tabs[JSconfig.meta[key].page].appendChild( w_div );
 
 
  // after insertion into the DOM tree
 
  switch( wt ) {
 
    case 'boolean' : w_ctrl.defaultChecked = w_ctrl.checked = JSconfig.keys[key]; break;
 
    case 'string' : w_ctrl.defaultValue = w_ctrl.value = JSconfig.keys[key]; break;
 
  }
 
 
  }
 
  addEvent(document.getElementById('preferences').parentNode, 'submit', JSconfig.evaluateForm );
 
}
 
 
}
 
}
+
 
JSconfig.readCookies();
+
 
addOnloadHook(JSconfig.setUpForm);
+
function icqIcons(){
   
+
var a, spans = document.getElementById('content').getElementsByTagName('span')
+
  for (var i=0; a=spans[i]; i++)
+
  if (a.className == 'ICQ')  
/** extract a URL parameter from the current URL **********
+
    a.style.backgroundImage = "url('http://status.icq.com/online.gif?icq="+a.id+"&img=5&randseed="+Math.floor(Math.random()*10000000)+"')"
* From [[en:User:Lupin/autoedit.js]]
+
*
+
* paramName  : the name of the parameter to extract
+
*
+
* Local Maintainer: [[User:Dschwen]]
+
*/
+
+
function getParamValue( paramName, url)  
+
{
+
if (typeof (url) == 'undefined' ) url = document.location.href;
+
var cmdRe=RegExp( '[&?]' + paramName + '=([^&]*)' );
+
var m=cmdRe.exec(url);
+
if (m) {
+
  try {
+
  return decodeURIComponent(m[1]);
+
  } catch (someError) {}
+
}
+
return null;
+
 
}
 
}
+
 
+
 
/** &withJS= URL parameter *******
+
function newSectionLink(){
  * Allow to try custom scripts on the MediaWiki namespace without
+
  var plus = document.getElementById('ca-addsection')
* editing [[Special:Mypage/monobook.js]]
+
  if (!plus) return
  *
+
  var custom = document.getElementById('add-custom-section')
* Maintainer: [[User:Platonides]]
+
  if (!custom) return
*/
+
plus.firstChild.setAttribute('href', custom.getElementsByTagName('a')[0].href)
{
+
  var extraJS = getParamValue("withJS");
+
  if (extraJS)
+
  if (extraJS.match("^MediaWiki:[^&<>=%]*\.js$"))
+
  importScript(extraJS);
+
  else
+
  alert(extraJS + " javascript not allowed to be loaded.");
+
 
}
 
}
+
 
+
 
/** Attach (or remove) an Event to a specific object **********
+
function editZeroSection(){
  * Cross-browser event attachment (John Resig)
+
  var body = document.getElementById('bodyContent')
  * http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
+
  if (!body) return
  *
+
  var h2s = body.getElementsByTagName('H2')
  * obj  : DOM tree object to attach the event to
+
  var h2 = h2s[0]
  * type : String, event type ("click", "mouseover", "submit", etc.)
+
  if (!h2) return
  * fn  : Function to be called when the event is triggered (the ''this''
+
  if (h2.parentNode.id == 'toctitle') h2 = h2s[1]
*        keyword points to ''obj'' inside ''fn'' when the event is triggered)
+
  if (!h2) return
*
+
var span = h2.firstChild
* Local Maintainer: [[User:Dschwen]]
+
  if (!span || span.className != 'editsection') return
  */
+
var zero = span.cloneNode(true)
function addEvent( obj, type, fn )
+
  body.insertBefore(zero, body.firstChild)
{
+
  var a = zero.getElementsByTagName('a')[0]
  if (obj.addEventListener)
+
if (a.href.indexOf('&section=T') == -1 )  a.title = a.title.replace(/:.*$/,': 0')
  obj.addEventListener( type, fn, false );
+
else a.title = 'Править секцию: 0'
  else if (obj.attachEvent)
+
a.setAttribute('href', wgScript + '?title='+encodeURIComponent(wgPageName) + '&action=edit&section=0')
  {
+
  obj["e"+type+fn] = fn;
+
  obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
+
  obj.attachEvent( "on"+type, obj[type+fn] );
+
}
+
 
}
 
}
function removeEvent( obj, type, fn )
+
 
{
+
 
  if (obj.removeEventListener)
+
function mainPage(){
   obj.removeEventListener( type, fn, false );
+
  if (wgArticleId == 23 || wgArticleId == 4401){
else if (obj.detachEvent)
+
   var li = addPortletLink('p-lang', wgArticlePath.replace(/\$1/, 'Википедия:Список_Википедий'), 'Полный список', 'interwiki-completelist')
{
+
  if (li) li.style.fontWeight = 'bold'
   obj.detachEvent( "on"+type, obj[type+fn] );
+
   var nstab = document.getElementById('ca-nstab-main') || document.getElementById('ca-current')
   obj[type+fn] = null;
+
   if (nstab && wgUserLanguage == 'ru')  nstab.firstChild.firstChild.nodeValue = 'Заглавная'
  obj["e"+type+fn] = null;
+
 
  }
 
  }
 
}
 
}
+
 
+
 
/** Extra toolbar options ***********
+
//Collapsiblе: [[ВП:СБ]]
* Append custom buttons to the edit mode toolbar.
+
 
* This is a modified copy of a script by User:MarkS for extra features added by User:Voice of All.
+
var NavigationBarShowDefault = 2
* This is based on the original code on Wikipedia:Tools/Editing tools
+
var NavigationBarHide = '[скрыть]'
* To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/monobook.js]]
+
var NavigationBarShow = '[показать]'
+
 
*  Maintainers: [[User:MarkS]]?, [[User:Voice of All]], [[User:R. Koot]]
+
var hasClass = (function (){
*/
+
  var reCache = {}
if (mwCustomEditButtons) {
+
  return function (element, className){
  mwCustomEditButtons.push({
+
  return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className)
    "imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
+
    "speedTip": "Redirect",
+
    "tagOpen": "#REDIRECT [[",
+
    "tagClose": "]]",
+
    "sampleText": "Insert text"
+
  });
+
}
+
+
+
/***** SpecialSearchEnhanced ********
+
* Improvement of the search page v4
+
* Written by Marc Mongenet & Suisui (GFDL & GPL)
+
*
+
* Maintainers: none, ([[User:Dschwen]]?)
+
  ****/
+
var sse_i18n = {
+
'af' : 'Vind media met Mayflower',
+
'ar' : 'بحث عن الوسائط بواسطة مايفلاور',
+
'bg' : 'Търсете мултимедийно съдържание с Mayflower',
+
'ca' : 'Cerca continguts multimèdia amb Mayflower',
+
'cs' : 'Najdi média s Mayflower',
+
'de' : 'Suche Multimedia-Dateien mit Mayflower',
+
'da' : 'Find media med Mayflower',
+
'el' : 'Αναζήτηση πολυμέσων με το Mayflower',
+
'en' : 'Find media with Mayflower',
+
'es' : 'Busca contenidos multimedia con Mayflower',
+
'fi' : 'Etsi mediaa Mayflowerin avulla',
+
'fr' : 'Cherchez des fichiers média avec Mayflower',
+
'gl' : 'Procura contidos multimedia coa Mayflower',
+
'he' : 'חפשו קבצי מדיה עם מייפלאור',
+
'hu' : 'Keress médiafájlokat a Mayflowerrel',
+
'ht' : 'Chache fichye medya yo epi Mayflower',
+
'id' : 'Cari media dengan Mayflower',
+
'is' : 'Finndu miðla með Mayflower',
+
'it' : 'Cerca file multimediali con Mayflower',
+
'ja' : 'Mayflower を使ってマルチメディアを探す',
+
'lt' : 'Ieškoti media su Mayflower',
+
'nl' : 'Media zoeken met Mayflower',
+
'nn' : 'Finn media med Mayflower',
+
'no' : 'Finn media med Mayflower',
+
'sv' : 'Sök media med Mayflower',
+
'sl' : 'Poišči večpredstavnostne datoteke z Mayflower',
+
'sk' : 'Nájdi médiá s Mayflower',
+
'sr' : 'Pronađi medij koristeći Mayflower',
+
'pl' : 'Wyszukaj media poprzez Mayflower',
+
'pt' : 'Procure conteúdos multimídia com Mayflower',
+
'ru' : 'Найти информацию с помощью системы Mayflower',
+
'vi' : 'Tìm tập tin phương tiện bằng Mayflower',
+
'zh' : '使用Mayflower搜索媒体文件',
+
'zh-hans' : '使用Mayflower搜索媒体文件',
+
'zh-hant' : '使用Mayflower搜尋媒體檔案',
+
'zh-cn' : '使用Mayflower搜索媒体文件',
+
'zh-sg' : '使用Mayflower搜索媒体文件',
+
'zh-tw' : '使用Mayflower搜尋媒體檔案',
+
'zh-hk' : '使用Mayflower搜尋媒體檔案'
+
};
+
function SpecialSearchEnhanced()
+
{
+
  function SearchForm(engine_name, engine_url, logo_url, search_action_url,
+
                    search_field_name, add_search_field, field_array)
+
{
+
  var span= document.createElement("span");
+
  span.style.marginRight = "1em";
+
+
  var form = document.createElement("form");
+
  form.method = "get";
+
  form.action = search_action_url;
+
  form.style.display = "inline";
+
  span.appendChild(form);
+
+
  var input = document.createElement("input");
+
  input.type = "hidden";
+
  input.name = search_field_name;
+
  form.appendChild(input);
+
+
  for( var i in field_array){
+
  var fld = document.createElement("input");
+
  fld.type = "hidden";
+
  fld.name = i;
+
  fld.value = field_array[i];
+
  form.appendChild(fld);
+
 
   }
 
   }
   
+
})()
  var submit = document.createElement("input");
+
 
  submit.type = "submit";
+
function collapsibleTables(){
  submit.value = sse_i18n[wgUserLanguage] || sse_i18n['en'];
+
  var Table, HRow,  HCell, btn, a, tblIdx = 0, colTables = []
  form.appendChild(submit);
+
var allTables = document.getElementsByTagName('table')
+
for (var i=0; Table = allTables[i]; i++){
  form.onsubmit = function() {
+
   if (!hasClass(Table, 'collapsible')) continue
   if(add_search_field == ""){
+
   if (!(HRow=Table.rows[0])) continue
    input.value = document.getElementById("lsearchbox").value;
+
   if (!(HCell=HRow.getElementsByTagName('th')[0])) continue
   }else{
+
  Table.id = 'collapsibleTable' + tblIdx
    input.value = document.getElementById("lsearchbox").value+add_search_field;
+
   btn = document.createElement('span')
   }
+
   btn.style.cssText = 'float:right; font-weight:normal; font-size:smaller'
  }
+
   a = document.createElement('a')
+
  a.id = 'collapseButton' + tblIdx
  if( !sse_i18n[wgUserLanguage] )
+
  a.href = 'javascript:collapseTable(' + tblIdx + ');'
  {
+
  a.style.color = HCell.style.color
   var h = document.createElement("a");
+
  a.appendChild(document.createTextNode(NavigationBarHide))
   h.href =
+
  btn.appendChild(a)
    "http://meta.wikimedia.org/w/index.php?title=User:Tangotango/Mayflower/Translation&action=edit&section=3";
+
  HCell.insertBefore(btn, HCell.childNodes[0])
  span.appendChild(h);
+
  colTables[tblIdx++] = Table
   h.appendChild( document.createTextNode( " [help translate this button]" ) );
+
  }
+
+
  var a = document.createElement("a");
+
  a.href = engine_url;
+
  span.appendChild(a);
+
+
  var img = document.createElement("img");
+
  img.src = logo_url;
+
  img.alt = engine_name;
+
  img.style.borderWidth = "0";
+
  img.style.padding = "5px";
+
  img.style.width = "220px";
+
  img.style.height = "53px";
+
  a.appendChild(img);
+
+
  return span;
+
 
  }
 
  }
   
+
  for (var i=0; i < tblIdx; i++)
//honor user configuration
+
  if ((tblIdx > NavigationBarShowDefault && hasClass(colTables[i], 'autocollapse')) || hasClass(colTables[i], 'collapsed'))
if( !JSconfig.keys['specialSearchEnhanced'] ) return;
+
    collapseTable(i)
+
if (wgCanonicalNamespace != "Special" || wgCanonicalSpecialPageName != "Search") return;
+
+
if(skin == "monobook" || skin == "cologneblue" || skin == "simple")
+
  var mainNode = document.getElementsByTagName("form");
+
if (!mainNode) return;
+
mainNode = mainNode[0];
+
mainNode.appendChild(document.createElement("center"));
+
mainNode = mainNode.lastChild;
+
+
var searchValue = document.getElementById("lsearchbox").value;
+
+
var div = document.createElement("div");
+
div.style.width = "100%";
+
//  ul.style.list-style-type = "none";
+
mainNode.appendChild(div);
+
+
var engine;
+
var mayflowero = new Object();
+
mayflowero["t"] = "n";
+
engine = SearchForm("MayFlower", "http://toolserver.org/~tangotango/mayflower/index.php", "http://toolserver.org/~tangotango/mayflower/images/mayflower-logo.png", 
+
                    "http://toolserver.org/~tangotango/mayflower/search.php",
+
                    "q", "", mayflowero);
+
div.appendChild(engine);
+
 
}
 
}
//JSconfig.registerKey('specialSearchEnhanced', true, ( sse_i18n[wgUserLanguage] || sse_i18n['en'] ) + ':', 6);
+
 
// addOnloadHook(SpecialSearchEnhanced);
+
function collapseTable (idx){
   
+
var Table = document.getElementById('collapsibleTable' + idx)
//
+
var btn = document.getElementById('collapseButton' + idx)
// Collapsible tables
+
if (!Table || !btn) return false
//
+
  var Rows = Table.rows
importScript('MediaWiki:CollapsibleTables.js');
+
var isShown = (btn.firstChild.data == NavigationBarHide)
   
+
  btn.firstChild.data = isShown ? NavigationBarShow : NavigationBarHide
/**** Special:Upload enhancements ******
+
  var disp = isShown ? 'none' : Rows[0].style.display
* moved to [[MediaWiki:Upload.js]]
+
  for (var i=1; i < Rows.length; i++)  
*
+
     Rows[i].style.display = disp
* Maintainer: [[User:Lupo]]
+
  ****/
+
JSconfig.registerKey('UploadForm_loadform', true,
+
{
+
  'bg': 'Използване на логиката на новия формуляр за качвания',
+
  'en': 'Use new upload form logic' // default
+
}, 3);
+
JSconfig.registerKey('UploadForm_newlayout', true,
+
  {
+
  'bg': 'Използване на облика на новия формуляр за качвания',
+
  'en': 'Use new form layout' // default
+
}, 3);
+
+
function enableNewUploadForm ()
+
{
+
  var match = navigator.userAgent.match(/AppleWebKit\/(\d+)/);
+
  if (match) {
+
     var webKitVersion = parseInt(match[1]);
+
    if (webKitVersion < 420) return; // Safari 2 crashes hard with the new upload form...
+
  }
+
+
  // honor JSConfig user settings
+
  if( !JSconfig.keys['UploadForm_loadform'] ) return;
+
+
  importScript( 'MediaWiki:UploadForm.js' );
+
 
}
 
}
+
 
if (wgPageName == 'Special:Upload')  
+
function collapsibleDivs(){
{
+
  var navIdx = 0, colNavs = [], i, NavFrame
  importScript( 'MediaWiki:Upload.js' );
+
  var divs = document.getElementById('content').getElementsByTagName('div')
  // Uncomment the following line (the call to enableNewUploadForm) to globally enable the
+
  for (i=0; NavFrame = divs[i]; i++) {
// new upload form. Leave the line *above* (the include of MediaWiki:Upload.js) untouched;
+
  if (!hasClass(NavFrame, 'NavFrame')) continue
// that script provides useful default behavior if the new upload form is disabled or
+
  NavFrame.id = 'NavFrame' + navIdx
// redirects to the old form in case an error occurs.
+
  var a = document.createElement('a')
enableNewUploadForm ();
+
  a.className = 'NavToggle'
}
+
  a.id = 'NavToggle' + navIdx
+
   a.href = 'javascript:collapseDiv(' + navIdx + ');'
// We may be running MediaWiki:UploadForm.js on this site. The following script changes the
+
  a.appendChild(document.createTextNode(NavigationBarHide))
// "reupload" links on image pages to go to the basic form.
+
   for (var j=0; j < NavFrame.childNodes.length; j++)
if (wgNamespaceNumber == 6) importScript ('MediaWiki:UploadFormLinkFixer.js');
+
    if (hasClass(NavFrame.childNodes[j], 'NavHead'))
   
+
      NavFrame.childNodes[j].appendChild(a)
+
  colNavs[navIdx++] = NavFrame
/**** QICSigs ******
+
* Fix for the broken signatures in gallery tags
+
* needed for [[COM:QIC]]
+
*
+
*  Maintainers: [[User:Dschwen]]
+
****/
+
if( wgPageName == "Commons:Quality_images_candidates/candidate_list" && wgAction == "edit" )
+
{
+
importScript( 'MediaWiki:QICSigs.js' );
+
}
+
+
/**** VICValidate ******
+
* Some basic form validation for creating new Valued image nominations
+
* needed for [[COM:VIC]]
+
*
+
*  Maintainers: [[User:Dschwen]]
+
****/
+
if( wgPageName == "Commons:Valued_image_candidates" && wgAction == "view" )
+
{
+
importScript( 'MediaWiki:VICValidate.js' );
+
}
+
+
+
/***** subPagesLink ********
+
* Adds a link to subpages of current page
+
*
+
*  Maintainers: [[:he:משתמש:ערן]], [[User:Dschwen]]
+
*
+
*  JSconfig items: bool JSconfig.subPagesLink
+
*                      (true=enabled (default), false=disabled)
+
****/
+
var subPagesLink =
+
{
+
//
+
// Translations of the menu item
+
//
+
i18n :
+
{
+
  'bg': 'Подстраници',
+
  'ca': 'Subpàgines',
+
  'cs': 'Podstránky',
+
  'de': 'Unterseiten',
+
  'en': 'Subpages',   // default
+
  'eo': 'Subpaĝoj',
+
  'es': 'Subpáginas',
+
  'fi': 'Alasivut',
+
  'fr': 'Sous-pages',
+
  'gl': 'Subpáxinas',
+
  'he': 'דפי משנה',
+
  'hr': 'Podstranice',
+
  'it': 'Sottopagine',
+
  'is': 'Undirsíður',
+
  'nl': "Subpagina's",
+
  'no': 'Undersider',
+
  'pl': 'Podstrony',
+
  'ru': 'Подстраницы'
+
},
+
+
install: function()
+
{
+
  // honor user configuration
+
  if( !JSconfig.keys['subPagesLink'] ) return;
+
+
  if ( document.getElementById("t-whatlinkshere")  
+
      &&  wgNamespaceNumber != -2  // Media: (upcoming)
+
      &&  wgNamespaceNumber != -1  // Special:
+
      && wgNamespaceNumber != 6    // Image:
+
      &&  wgNamespaceNumber != 14  // Category:
+
    )
+
  {
+
   var subpagesText = subPagesLink.i18n[wgUserLanguage] || subPagesLink.i18n['en'];
+
  var subpagesLink ='/wiki/Special:Prefixindex/' + wgPageName +'/';
+
+
  addPortletLink( 'p-tb', subpagesLink, subpagesText, 't-subpages' );
+
  }
+
 
  }
 
  }
 +
for (i=0; i < navIdx; i++)
 +
  if ((navIdx > NavigationBarShowDefault && !hasClass(colNavs[i], 'expanded')) || hasClass(colNavs[i], 'collapsed'))
 +
    collapseDiv(i)
 
}
 
}
JSconfig.registerKey('subPagesLink', true,
+
 
  {
+
function collapseDiv(idx) {
  'bg': 'Показване на връзката Подстраници в менюто с инструменти',
+
var div = document.getElementById('NavFrame' + idx)
  'cs': 'Zobrazovat v panelu nástrojů odkaz Podstránky',
+
  var btn = document.getElementById('NavToggle' + idx)
  'en': 'Show a Subpages link in the toolbox', // default
+
  if (!div || !btn) return false
  'pl': 'Pokaż w panelu bocznym link do podstron'
+
var isShown = (btn.firstChild.data == NavigationBarHide)
  }, 7);
+
  btn.firstChild.data = isShown ? NavigationBarShow : NavigationBarHide
addOnloadHook(subPagesLink.install);
+
  var disp = isShown ? 'none' : 'block'
   
+
for (var child = div.firstChild; child != null;  child = child.nextSibling)
+
   if (hasClass(child, 'NavPic') || hasClass(child, 'NavContent'))
/***** new os_createContainer ********
+
      child.style.display = disp
* make the width of the search suggest window customizable
+
*
+
*  Maintainers: [[User:Dschwen]]
+
  ****/
+
+
// Translations of the message in the user preferences
+
if( typeof os_createContainer != 'undefined' ) {
+
  JSconfig.registerKey('os_suggest_width', "",
+
  {
+
    'bg': 'Ширина на падащото меню с AJAX предположения',
+
    'cs': 'Šířka AJAXového napovídače',
+
    'en': 'Custom AJAX suggestion box width' // default
+
  }, 6);
+
  var old_os_createContainer = os_createContainer;
+
  os_createContainer = function( r)  
+
  {
+
   var c = old_os_createContainer( r );
+
  var w = JSconfig.keys['os_suggest_width'];
+
  if( w != "" ) c.style.width = w + "px";
+
  return c;
+
  }
+
 
}
 
}
+
 
+
function voting8(){
/***** gallery_dshuf_prepare ********
+
  if (votingTrigger = document.getElementById('voting-trigger'))
* prepare galleries which are surrounded by <div class="dshuf"></div>
+
   importScriptURI(wgServer+wgScript
* for shuffling with dshuf (see below).
+
   +'?title=MediaWiki:Voting8.js&action=raw&ctype=text/javascript&cversion='
*
+
  +encodeURIComponent(votingTrigger.innerHTML.replace(/\D+/g, '.')))
*  Maintainers: [[User:Dschwen]]
+
****/
+
function gallery_dshuf_prepare()
+
{
+
  var tables = document.getElementsByTagName("table");
+
var divsorig, divs, newdiv, parent, j, i;
+
+
for ( i = 0; i < tables.length; i++)
+
  if ( tables[i].className == 'gallery' &&
+
      tables[i].parentNode.className == 'dshuf' )
+
   {
+
  divsorig = tables[i].getElementsByTagName( 'div' );
+
   divs = [];
+
  for ( j = 0; j < divsorig.length; j++) divs.push(divsorig[j]);
+
  for ( j = 0; j < divs.length; j++)
+
    if ( divs[j].className == 'gallerybox' )
+
    {
+
    newdiv = document.createElement( 'DIV' );
+
    newdiv.className = 'dshuf dshufset' + i;
+
    while( divs[j].childNodes.length > 0 )
+
      newdiv.appendChild( divs[j].removeChild(divs[j].firstChild) );
+
    divs[j].appendChild( newdiv );
+
    }
+
  }
+
 
}
 
}
addOnloadHook(gallery_dshuf_prepare);
+
 
+
//Execution
+
if (wgCanonicalNamespace == 'Special'){
/***** dshuf ********
+
   switch (wgCanonicalSpecialPageName){
* shuffles div elements with the class dshuf and
+
   case 'Upload': importScript_('MediaWiki:Upload.js'); break
* common class dshufsetX (X being an integer)
+
   case 'Search': importScript_('MediaWiki:Search.js'); break
* taken from http://commons.wikimedia.org/w/index.php?title=MediaWiki:Common.js&oldid=7380543
+
*
+
*  Maintainers: [[User:Gmaxwell]], [[User:Dschwen]]
+
****/
+
function dshuf(){
+
var shufsets = {};
+
var rx = new RegExp('dshuf'+'\\s+(dshufset\\d+)', 'i');
+
var divs = document.getElementsByTagName("div");
+
var i = divs.length;
+
while( i-- )
+
{
+
   if( rx.test(divs[i].className) )
+
  {
+
   if ( typeof shufsets[RegExp.$1] == "undefined" )
+
  {
+
    shufsets[RegExp.$1] = {};
+
    shufsets[RegExp.$1].inner = [];
+
    shufsets[RegExp.$1].member = [];
+
   }
+
  shufsets[RegExp.$1].inner.push( { key:Math.random(), html:divs[i].innerHTML } );
+
  shufsets[RegExp.$1].member.push(divs[i]);
+
 
   }
 
   }
}
+
}else if (wgAction != 'history'){
+
  addOnloadHook(editZeroSection)
for( shufset in shufsets )
+
  addOnloadHook(collapsibleDivs)
{
+
  addOnloadHook(collapsibleTables)
   shufsets[shufset].inner.sort( function(a,b) { return a.key - b.key; } );
+
   addOnloadHook(mainPage)
   i = shufsets[shufset].member.length;
+
  importScript('MediaWiki:Wikiminiatlas.js', 'meta.wikimedia.org')
   while( i-- )
+
   if (navigator.appName=='Microsoft Internet Explorer' && document.createStyleSheet)
   {
+
    document.createStyleSheet().addRule('.IPA', 'font-family: "Doulos SIL", "Charis SIL", Gentium, "DejaVu Sans", Code2000, "TITUS Cyberbit Basic", "Arial Unicode MS", "Lucida Sans Unicode", "Chrysanthi Unicode";')
  shufsets[shufset].member[i].innerHTML = shufsets[shufset].inner[i].html;
+
   if (wgNamespaceNumber==0 || wgNamespaceNumber==100)
  shufsets[shufset].member[i].style.display = "block";
+
    addOnloadHook(LinkFA)
 +
   else {
 +
    addOnloadHook(icqIcons)
 +
    addOnloadHook(newSectionLink)
 
   }
 
   }
}
+
  if (wgAction=='edit' || wgAction=='submit') importScript_('MediaWiki:Editpage.js')
 +
  addOnloadHook(voting8)
 
}
 
}
addOnloadHook(dshuf);
+
 
+
 
+
if (wgUserGroups)
//Adds a dismissable notice to Special:Watchlist
+
for (var i=0; i<wgUserGroups.length; i++) switch (wgUserGroups[i]){
//Useful to use instead of the sitenotice for messages only
+
case 'editor': importStylesheet('MediaWiki:Gadget-FlaggedRevs.css'); break
//relevant to registered users.
+
case 'sysop': importScript_('MediaWiki:Sysop.js'); break
if( wgCanonicalSpecialPageName == "Watchlist" ) importScript( 'MediaWiki:Common.js/WatchlistNotice.js' );
+
+
/***** localizeSignature ********
+
* localizes the signature on Commons with the string in the user's preferred language
+
*
+
* Maintainer: [[User:Slomox]]
+
****/
+
function localizeSignature() {
+
var talkTextLocalization = { ca: 'Discussió', cs: 'diskuse', de: 'Diskussion', nds: 'Diskuschoon' };
+
var talkText = talkTextLocalization[wgUserLanguage];
+
if (!talkText) return;
+
var spans=document.getElementsByTagName("span");
+
for (var i = 0; i < spans.length; i++) {
+
  if ( spans[i].className == 'signature-talk' ) {
+
  spans[i].innerHTML = talkText;
+
  }
+
}
+
 
}
 
}
addOnloadHook(localizeSignature);
+
 
+
//Сообщить об ошибке
// Load POTY gallery enhancements
+
importScript_('MediaWiki:Wikibugs.js')
function POTYenhancements() {
+
 
    var g = document.getElementById('poty2008')
+
    if (g && wgUserName) {
+
        uri = wgScript + '?title=User:Kalan/poty.js&action=raw&ctype=text/javascript&go=' + g.className.match(/version-\d+/)[0]
+
        importScriptURI(uri)
+
    }
+
}
+
+
addOnloadHook(POTYenhancements)
+
+
//
+
// Add "Nominate for Deletion" to toolbar ([[MediaWiki talk:Quick-delete-code.js]])
+
//
+
importScript('MediaWiki:Quick-delete-code.js');
+
+
//
+
// Import usergroup-specific stylesheet, only for admins atm
+
//
+
for( var key in wgUserGroups )
+
{
+
  if (wgUserGroups[key] =="sysop")
+
  {
+
      importStylesheet("MediaWiki:Admin.css");
+
  }
+
}
+
+
// SVG images: adds links to rendered PNG images in different resolutions
+
addOnloadHook(function() {
+
      if (wgAction == "view" && wgNamespaceNumber == 6 && wgTitle.substring(wgTitle.lastIndexOf(".")).toLowerCase() == ".svg") {
+
      var file = document.getElementById("file");
+
      if (!file) return;  // might happen if MediaWiki can't render the SVG
+
      var div = document.createElement("div");
+
      div.appendChild(document.createTextNode("SVG rendered as PNG images in different resolutions:"));
+
      div.appendChild(document.createElement("br"));
+
      var a200 = document.createElement("a");
+
      a200.setAttribute("href", "http://commons.wikimedia.org/w/thumb.php?f=" + wgTitle + "&width=200px");
+
      a200.appendChild(document.createTextNode("200px"));
+
      var a500 = document.createElement("a");
+
      a500.setAttribute("href", "http://commons.wikimedia.org/w/thumb.php?f=" + wgTitle + "&width=500px");
+
      a500.appendChild(document.createTextNode("500px"));
+
      var a1000 = document.createElement("a");
+
      a1000.setAttribute("href", "http://commons.wikimedia.org/w/thumb.php?f=" + wgTitle + "&width=1000px");
+
      a1000.appendChild(document.createTextNode("1000px"));
+
      var a2000 = document.createElement("a");
+
      a2000.setAttribute("href", "http://commons.wikimedia.org/w/thumb.php?f=" + wgTitle + "&width=2000px");
+
      a2000.appendChild(document.createTextNode("2000px"));
+
      div.appendChild(a200);
+
      div.appendChild(document.createTextNode(", "));
+
      div.appendChild(a500);
+
      div.appendChild(document.createTextNode(", "));
+
      div.appendChild(a1000);
+
      div.appendChild(document.createTextNode(", "));
+
      div.appendChild(a2000);
+
      div.appendChild(document.createTextNode("."));
+
      file.parentNode.insertBefore(div, document.getElementById("file").nextSibling.nextSibling);
+
  }
+
});
+
+
//Language-specific JavaScript.
+
//may be useful for renaming tab in main page in every language.
+
importScript('MediaWiki:Common.js/' + wgUserLanguage);
+
+
/* Quick-adding a command CommonsDelinker's command line */
+
/* Local maintainer: [[User:Kwj2772]] */
+
importScript('MediaWiki:CommonsDelinker.js');
+
+
/*Automatic language selection using javascript*/
+
importScript('MediaWiki:Common.js/LangSelect.js');
+
+
 
//</source>
 
//</source>

Версия 15:12, 10 июля 2009

/* Размещённый здесь код JavaScript будет загружен всем пользователям при обращении к какой-либо странице */
 /** Extra toolbar options ******************************************************
  *
  *  Description: UNDOCUMENTED
  *  Maintainers: [[User:MarkS]]?, [[User:Voice of All]], [[User:R. Koot]]
  */
 
 //This is a modified copy of a script by User:MarkS for extra features added by User:Voice of All.
 // This is based on the original code on Wikipedia:Tools/Editing tools
 // To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/monobook.js]]
 
 if (mwCustomEditButtons) {
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.koreanwikiproject.com/wiki/skins/common/images/Button_mp3.png",
     "speedTip": "Mp3",
     "tagOpen": "<flashmp3>filename.mp3|leftbg=003478|rightbg=c60c30|lefticon=ffffff|righticon=ffffff</flashmp3>",
     "tagClose": "",
     "sampleText": ""};


 }

//See http://ru.wikipedia.org/wiki/project:code //<source lang=javascript>

importScript_ = importScript
importScript = function (page, proj){
 if (!proj) importScript_(page)
 else {
   if (proj.indexOf('.')==-1) proj += '.wikipedia.org'
   importScriptURI('http://'+proj+'/w/index.php?action=raw&ctype=text/javascript&title='+encodeURIComponent(page.replace(/ /g,'_')))
 }
}

addLoadEvent = addOnloadHook 


function ts_parseFloat(n){
 if (!n) return 0
 n = parseFloat(n.replace(/\./g, '').replace(/,/, '.'))
 return (isNaN(n) ? 0 : n)
}


function LinkFA(){
 var pLang = document.getElementById('p-lang')
 if (!pLang) return
 var iw = pLang.getElementsByTagName('li')
 for (var i=0; i < iw.length; i++)
   if (document.getElementById(iw[i].className+'-fa')){
     iw[i].className += ' FA'
     iw[i].title = 'Эта статья является избранной в другом языковом разделе'
   }else if (document.getElementById(iw[i].className+'-ga')){
     iw[i].className += ' GA'
     iw[i].title = 'Эта статья является хорошей в другом языковом разделе'
   }
}


function icqIcons(){
 var a, spans = document.getElementById('content').getElementsByTagName('span')
 for (var i=0; a=spans[i]; i++)
   if (a.className == 'ICQ') 
     a.style.backgroundImage = "url('http://status.icq.com/online.gif?icq="+a.id+"&img=5&randseed="+Math.floor(Math.random()*10000000)+"')"
}


function newSectionLink(){
 var plus = document.getElementById('ca-addsection')
 if (!plus) return
 var custom = document.getElementById('add-custom-section')
 if (!custom) return
 plus.firstChild.setAttribute('href', custom.getElementsByTagName('a')[0].href)
}


function editZeroSection(){
 var body = document.getElementById('bodyContent')
 if (!body) return
 var h2s = body.getElementsByTagName('H2')
 var h2 = h2s[0]
 if (!h2) return
 if (h2.parentNode.id == 'toctitle') h2 = h2s[1]
 if (!h2) return
 var span = h2.firstChild
 if (!span || span.className != 'editsection') return
 var zero = span.cloneNode(true)
 body.insertBefore(zero, body.firstChild)
 var a = zero.getElementsByTagName('a')[0]
 if (a.href.indexOf('&section=T') == -1 )  a.title = a.title.replace(/:.*$/,': 0')
 else a.title = 'Править секцию: 0'
 a.setAttribute('href', wgScript + '?title='+encodeURIComponent(wgPageName) + '&action=edit&section=0')
}


function mainPage(){
 if (wgArticleId == 23 || wgArticleId == 4401){
  var li = addPortletLink('p-lang', wgArticlePath.replace(/\$1/, 'Википедия:Список_Википедий'), 'Полный список', 'interwiki-completelist')
  if (li) li.style.fontWeight = 'bold'
  var nstab = document.getElementById('ca-nstab-main') || document.getElementById('ca-current')
  if (nstab && wgUserLanguage == 'ru')  nstab.firstChild.firstChild.nodeValue = 'Заглавная'
 }
}


//Collapsiblе: [[ВП:СБ]]

var NavigationBarShowDefault = 2
var NavigationBarHide = '[скрыть]'
var NavigationBarShow = '[показать]'

var hasClass = (function (){
 var reCache = {}
 return function (element, className){
   return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className)
  }
})()

function collapsibleTables(){
 var Table, HRow,  HCell, btn, a, tblIdx = 0, colTables = []
 var allTables = document.getElementsByTagName('table')
 for (var i=0; Table = allTables[i]; i++){
   if (!hasClass(Table, 'collapsible')) continue
   if (!(HRow=Table.rows[0])) continue
   if (!(HCell=HRow.getElementsByTagName('th')[0])) continue
   Table.id = 'collapsibleTable' + tblIdx
   btn = document.createElement('span')
   btn.style.cssText = 'float:right; font-weight:normal; font-size:smaller'
   a = document.createElement('a')
   a.id = 'collapseButton' + tblIdx
   a.href = 'javascript:collapseTable(' + tblIdx + ');' 
   a.style.color = HCell.style.color
   a.appendChild(document.createTextNode(NavigationBarHide))
   btn.appendChild(a)
   HCell.insertBefore(btn, HCell.childNodes[0])
   colTables[tblIdx++] = Table
 }
 for (var i=0; i < tblIdx; i++)
   if ((tblIdx > NavigationBarShowDefault && hasClass(colTables[i], 'autocollapse')) || hasClass(colTables[i], 'collapsed'))
     collapseTable(i)
}

function collapseTable (idx){
 var Table = document.getElementById('collapsibleTable' + idx)
 var btn = document.getElementById('collapseButton' + idx)
 if (!Table || !btn) return false
 var Rows = Table.rows
 var isShown = (btn.firstChild.data == NavigationBarHide)
 btn.firstChild.data = isShown ?  NavigationBarShow : NavigationBarHide
 var disp = isShown ? 'none' : Rows[0].style.display
 for (var i=1; i < Rows.length; i++) 
    Rows[i].style.display = disp
}

function collapsibleDivs(){
 var navIdx = 0, colNavs = [], i, NavFrame
 var divs = document.getElementById('content').getElementsByTagName('div')
 for (i=0; NavFrame = divs[i]; i++) {
   if (!hasClass(NavFrame, 'NavFrame')) continue
   NavFrame.id = 'NavFrame' + navIdx
   var a = document.createElement('a')
   a.className = 'NavToggle'
   a.id = 'NavToggle' + navIdx
   a.href = 'javascript:collapseDiv(' + navIdx + ');'
   a.appendChild(document.createTextNode(NavigationBarHide))
   for (var j=0; j < NavFrame.childNodes.length; j++)
     if (hasClass(NavFrame.childNodes[j], 'NavHead'))
       NavFrame.childNodes[j].appendChild(a)
   colNavs[navIdx++] = NavFrame
 }
 for (i=0; i < navIdx; i++)
  if ((navIdx > NavigationBarShowDefault && !hasClass(colNavs[i], 'expanded')) || hasClass(colNavs[i], 'collapsed'))
     collapseDiv(i)
}

function collapseDiv(idx) {
 var div = document.getElementById('NavFrame' + idx)
 var btn = document.getElementById('NavToggle' + idx)
 if (!div || !btn) return false
 var isShown = (btn.firstChild.data == NavigationBarHide)
 btn.firstChild.data = isShown ? NavigationBarShow : NavigationBarHide 
 var disp = isShown ? 'none' : 'block'
 for (var child = div.firstChild;  child != null;  child = child.nextSibling)
   if (hasClass(child, 'NavPic') || hasClass(child, 'NavContent')) 
      child.style.display = disp
}

function voting8(){
 if (votingTrigger = document.getElementById('voting-trigger'))
  importScriptURI(wgServer+wgScript
   +'?title=MediaWiki:Voting8.js&action=raw&ctype=text/javascript&cversion='
   +encodeURIComponent(votingTrigger.innerHTML.replace(/\D+/g, '.')))
}

//Execution
if (wgCanonicalNamespace == 'Special'){
  switch (wgCanonicalSpecialPageName){
   case 'Upload': importScript_('MediaWiki:Upload.js'); break
   case 'Search': importScript_('MediaWiki:Search.js'); break
  }
}else if (wgAction != 'history'){
  addOnloadHook(editZeroSection)
  addOnloadHook(collapsibleDivs)
  addOnloadHook(collapsibleTables)
  addOnloadHook(mainPage)
  importScript('MediaWiki:Wikiminiatlas.js', 'meta.wikimedia.org')
  if (navigator.appName=='Microsoft Internet Explorer' && document.createStyleSheet)
    document.createStyleSheet().addRule('.IPA', 'font-family: "Doulos SIL", "Charis SIL", Gentium, "DejaVu Sans", Code2000, "TITUS Cyberbit Basic", "Arial Unicode MS", "Lucida Sans Unicode", "Chrysanthi Unicode";')
  if (wgNamespaceNumber==0 || wgNamespaceNumber==100)
    addOnloadHook(LinkFA)
  else {
    addOnloadHook(icqIcons)
    addOnloadHook(newSectionLink)
  }
  if (wgAction=='edit' || wgAction=='submit') importScript_('MediaWiki:Editpage.js')
  addOnloadHook(voting8)
}


if (wgUserGroups)
for (var i=0; i<wgUserGroups.length; i++) switch (wgUserGroups[i]){
 case 'editor': importStylesheet('MediaWiki:Gadget-FlaggedRevs.css'); break
 case 'sysop': importScript_('MediaWiki:Sysop.js'); break
}

//Сообщить об ошибке
importScript_('MediaWiki:Wikibugs.js')

//</source>
Персональные инструменты
Пространства имён

Варианты
Действия
Навигация
Инструменты