MediaWiki:Common.js — различия между версиями

Материал из roboforum.ru Wiki
Перейти к: навигация, поиск
 
Строка 1: Строка 1:
//<source lang=javascript>
+
//See http://ru.wikipedia.org/wiki/project:code //<source lang=javascript>
  
//import module
+
importScript_ = importScript
importedScripts = {}
+
importScript = function (page, proj){
function importScript(page, lang) {
+
  if (!proj) importScript_(page)
  page = '?title=' + encodeURIComponent(page.replace(' ','_'))
+
else {
if (lang) page = 'http://' + lang + '.wikipedia.org/w/index.php' + page
+
  if (proj.indexOf('.')==-1) proj += '.wikipedia.org'
else page = wgScript + page
+
  importScriptURI('http://'+proj+'/w/index.php?action=raw&ctype=text/javascript&title='+encodeURIComponent(page.replace(/ /g,'_')))
if (importedScripts[page]) return
+
}
importedScripts[page] = true
 
var s = document.createElement('script')
 
s.type = 'text/javascript'
 
s.src = page + '&action=raw&ctype=text/javascript'
 
document.getElementsByTagName('head')[0].appendChild(s)
 
 
}
 
}
  
 +
addLoadEvent = addOnloadHook
  
//hasClass, from en.wp
 
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 addLoadEvent(f) {addOnloadHook(f)} //for backwards compatibility
 
  
 
+
function ts_parseFloat(n){
//fix for sortable tables: comma as decimal dot
+
  if (!n) return 0
function ts_parseFloat(num){
+
  n = parseFloat(n.replace(/\./g, '').replace(/,/, '.'))
  if (!num) return 0
+
  return (isNaN(n) ? 0 : n)
  num = parseFloat(num.replace(/\./g, '').replace(/,/, '.'))
 
  return (isNaN(num) ? 0 : num)
 
 
}
 
}
  
  
 
//{Link FA}: interwiki to featured articles
 
 
function LinkFA(){
 
function LinkFA(){
 
  var pLang = document.getElementById('p-lang')
 
  var pLang = document.getElementById('p-lang')
Строка 46: Строка 28:
 
     iw[i].className += ' FA'
 
     iw[i].className += ' FA'
 
     iw[i].title = 'Эта статья является избранной в другом языковом разделе'
 
     iw[i].title = 'Эта статья является избранной в другом языковом разделе'
 +
  }else if (document.getElementById(iw[i].className+'-ga')){
 +
    iw[i].className += ' GA'
 +
    iw[i].title = 'Эта статья является хорошей в другом языковом разделе'
 
   }
 
   }
 
}
 
}
  
  
//{ICQ}
 
 
function icqIcons(){
 
function icqIcons(){
 
  var a, spans = document.getElementById('content').getElementsByTagName('span')
 
  var a, spans = document.getElementById('content').getElementsByTagName('span')
  for (var i=0; a = spans[i]; i++)
+
  for (var i=0; a=spans[i]; i++)
 
   if (a.className == 'ICQ')  
 
   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)+"')"
 
     a.style.backgroundImage = "url('http://status.icq.com/online.gif?icq="+a.id+"&img=5&randseed="+Math.floor(Math.random()*10000000)+"')"
Строка 59: Строка 43:
  
  
//{Modifynewsectionlink}
 
 
function newSectionLink(){
 
function newSectionLink(){
 
  var plus = document.getElementById('ca-addsection')
 
  var plus = document.getElementById('ca-addsection')
Строка 65: Строка 48:
 
  var custom = document.getElementById('add-custom-section')
 
  var custom = document.getElementById('add-custom-section')
 
  if (!custom) return
 
  if (!custom) return
  plus.firstChild.setAttribute('href', custom.getElementsByTagName('A')[0].href)
+
  plus.firstChild.setAttribute('href', custom.getElementsByTagName('a')[0].href)
 
}
 
}
  
  
//{Неверный заголовок}
 
function correctTitle(){
 
if (window.disableRealTitle) return
 
var toHide = document.getElementById('trestrictions_replace')
 
if (!toHide) return
 
var newTitle = document.getElementById('trestrictions_correct')
 
if (!newTitle) return
 
document.getElementsByTagName('h1')[0].innerHTML  = newTitle.innerHTML
 
toHide.style.display = 'none'
 
document.getElementById('trestrictions_replaced').style.display = 'block'
 
}
 
 
 
//[edit] zero section
 
 
function editZeroSection(){
 
function editZeroSection(){
 
  var body = document.getElementById('bodyContent')
 
  var body = document.getElementById('bodyContent')
  if (!body || window.disable_zero_section) return
+
  if (!body) return
 
  var h2s = body.getElementsByTagName('H2')
 
  var h2s = body.getElementsByTagName('H2')
 
  var h2 = h2s[0]
 
  var h2 = h2s[0]
Строка 96: Строка 65:
 
  body.insertBefore(zero, body.firstChild)
 
  body.insertBefore(zero, body.firstChild)
 
  var a = zero.getElementsByTagName('a')[0]
 
  var a = zero.getElementsByTagName('a')[0]
  a.title = a.title.replace(/:.*$/,': 0')
+
if (a.href.indexOf('&section=T') == -1 ) a.title = a.title.replace(/:.*$/,': 0')
  a.setAttribute('href', a.href.replace(/&section=1/,'&section=0'))
+
else a.title = 'Править секцию: 0'
 +
  a.setAttribute('href', wgScript + '?title='+encodeURIComponent(wgPageName) + '&action=edit&section=0')
 
}
 
}
  
  
//Mainpage: tab  «статья» -> «заглавная»
+
function mainPage(){
function mainPageTab(){
+
  if (wgArticleId == 23 || wgArticleId == 4401){
  if (wgArticleId == 4401 || wgArticleId == 23){
+
  var li = addPortletLink('p-lang', wgArticlePath.replace(/\$1/, 'Википедия:Список_Википедий'), 'Полный список', 'interwiki-completelist')
   var nstab = document.getElementById('ca-nstab-main')
+
  if (li) li.style.fontWeight = 'bold'
   if (!nstab || wgUserLanguage != 'ru') return //other skins
+
   var nstab = document.getElementById('ca-nstab-main') || document.getElementById('ca-current')
  var a = nstab.firstChild
+
   if (nstab && wgUserLanguage == 'ru') nstab.firstChild.firstChild.nodeValue = 'Заглавная'
  if (a.textContent) a.textContent = 'Заглавная'
 
  else a.innerText = 'Заглавная'
 
 
  }
 
  }
 
}
 
}
  
  
 +
//Collapsiblе: [[ВП:СБ]]
  
//Collapsible Tables and Divs, [[ВП:СБ]]
+
var NavigationBarShowDefault = 2
 +
var NavigationBarHide = '[скрыть]'
 +
var NavigationBarShow = '[показать]'
  
var autoCollapse = 2
+
var hasClass = (function (){
var collapseCaption = 'скрыть'
+
var reCache = {}
var expandCaption = 'показать'
+
return function (element, className){
 +
  return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className)
 +
  }
 +
})()
  
 
function collapsibleTables(){
 
function collapsibleTables(){
  var Table, HRow, THs, Header, btn, a, tblIdx = 0, colTables = []
+
  var Table, HRow, HCell, btn, a, tblIdx = 0, colTables = []
 
  var allTables = document.getElementsByTagName('table')
 
  var allTables = document.getElementsByTagName('table')
 
  for (var i=0; Table = allTables[i]; i++){
 
  for (var i=0; Table = allTables[i]; i++){
 
   if (!hasClass(Table, 'collapsible')) continue
 
   if (!hasClass(Table, 'collapsible')) continue
   if (!(HRow = Table.rows[0])) continue
+
   if (!(HRow=Table.rows[0])) continue
   THs = HRow.getElementsByTagName('th')  
+
   if (!(HCell=HRow.getElementsByTagName('th')[0])) continue
  if (THs.length == 0) continue
 
  Header = THs[THs.length-1] //last TH, not 1st like in en.wp
 
 
   Table.id = 'collapsibleTable' + tblIdx
 
   Table.id = 'collapsibleTable' + tblIdx
 
   btn = document.createElement('span')
 
   btn = document.createElement('span')
   btn.style.styleFloat = btn.style.cssFloat = 'right'
+
   btn.style.cssText = 'float:right; font-weight:normal; font-size:smaller'
  btn.style.fontWeight = 'normal'
 
 
   a = document.createElement('a')
 
   a = document.createElement('a')
 
   a.id = 'collapseButton' + tblIdx
 
   a.id = 'collapseButton' + tblIdx
 
   a.href = 'javascript:collapseTable(' + tblIdx + ');'  
 
   a.href = 'javascript:collapseTable(' + tblIdx + ');'  
   a.appendChild(document.createTextNode(collapseCaption))
+
   a.style.color = HCell.style.color
   btn.appendChild(document.createTextNode('['))
+
   a.appendChild(document.createTextNode(NavigationBarHide))
 
   btn.appendChild(a)
 
   btn.appendChild(a)
   btn.appendChild(document.createTextNode(']'))
+
   HCell.insertBefore(btn, HCell.childNodes[0])
  Header.insertBefore(btn, Header.childNodes[0])
 
 
   colTables[tblIdx++] = Table
 
   colTables[tblIdx++] = Table
 
  }
 
  }
 
  for (var i=0; i < tblIdx; i++)
 
  for (var i=0; i < tblIdx; i++)
   if ((tblIdx > autoCollapse && hasClass(colTables[i], 'autocollapse')) || hasClass(colTables[i], 'collapsed'))
+
   if ((tblIdx > NavigationBarShowDefault && hasClass(colTables[i], 'autocollapse')) || hasClass(colTables[i], 'collapsed'))
 
     collapseTable(i)
 
     collapseTable(i)
 
}
 
}
Строка 153: Строка 123:
 
  if (!Table || !btn) return false
 
  if (!Table || !btn) return false
 
  var Rows = Table.rows
 
  var Rows = Table.rows
  var isShown = (btn.firstChild.data == collapseCaption)
+
  var isShown = (btn.firstChild.data == NavigationBarHide)
  btn.firstChild.data = isShown ?  expandCaption : collapseCaption
+
  btn.firstChild.data = isShown ?  NavigationBarShow : NavigationBarHide
 
  var disp = isShown ? 'none' : Rows[0].style.display
 
  var disp = isShown ? 'none' : Rows[0].style.display
 
  for (var i=1; i < Rows.length; i++)  
 
  for (var i=1; i < Rows.length; i++)  
Строка 160: Строка 130:
 
}
 
}
  
var NavigationBarHide = '[' + collapseCaption + ']'
 
var NavigationBarShow = '[' + expandCaption + ']'
 
var NavigationBarShowDefault = autoCollapse
 
 
 
function collapsibleDivs(){
 
function collapsibleDivs(){
 
  var navIdx = 0, colNavs = [], i, NavFrame
 
  var navIdx = 0, colNavs = [], i, NavFrame
Строка 175: Строка 141:
 
   a.href = 'javascript:collapseDiv(' + navIdx + ');'
 
   a.href = 'javascript:collapseDiv(' + navIdx + ');'
 
   a.appendChild(document.createTextNode(NavigationBarHide))
 
   a.appendChild(document.createTextNode(NavigationBarHide))
  // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
 
 
   for (var j=0; j < NavFrame.childNodes.length; j++)
 
   for (var j=0; j < NavFrame.childNodes.length; j++)
 
     if (hasClass(NavFrame.childNodes[j], 'NavHead'))
 
     if (hasClass(NavFrame.childNodes[j], 'NavHead'))
Строка 198: Строка 163:
 
}
 
}
  
//[[Special:Search]] extended
+
//Execution
function searchPage() {
 
var search = document.forms['search']
 
if (!search) return
 
var div = document.createElement('div')
 
div.innerHTML = '\
 
<table style="margin-left:75%;padding-left:4px;"><tr><td>\
 
<form action="http://www.yandex.ru/yandsearch" name="yandex" target="_blank" id="yandex">\
 
<input type="hidden" name="text">\
 
<input type="hidden" name="site" value="ru.wikipedia.org">\
 
<input type="hidden" name="ras" value="1">\
 
<input type="hidden" name="site_manually"  value="true">\
 
<input type="hidden" name="server_name" value="Википедия">\
 
<input type="button" value="Яндекс по Википедии"  onclick="document.yandex.text.value = document.forms[0].search.value; this.form.submit();" style="width:12em;">\
 
</form></td></tr><tr><td>\
 
<form action="http://www.google.com/custom" method="get" name="google" target="_blank" id="google">\
 
<input type="hidden" name="hl" value="ru">\
 
<input type="hidden" name="domains" value="ru.wikipedia.org">\
 
<input type="hidden" name="q">\
 
<input type="hidden" name="sitesearch" value="ru.wikipedia.org">\
 
<input type="button" value="Google по Википедии" onclick="document.google.q.value = document.forms[0].search.value; this.form.submit();" style="width:12em;">\
 
</form></td></tr></table>'
 
  search.parentNode.insertBefore(div, search.nextSibling)
 
}
 
 
 
 
 
//[[Special:Upload]]: insert {Изображение} automatically, insert {Обоснование добросовестного использования} with click
 
function uploadPage(){
 
var desc = document.getElementById('wpUploadDescription')
 
var tmpl = document.getElementById('imageinfo')
 
if (tmpl && desc && !desc.value) desc.value = tmpl.innerHTML
 
var span = document.getElementById('insertlink')
 
if (!span) return
 
var a = document.createElement('a')
 
a.href = 'javascript:addRationaleTemplate()'
 
span.parentNode.insertBefore(a, span)
 
a.appendChild(span)
 
span.style.display = 'inline'
 
}
 
function addRationaleTemplate(){
 
var desc = document.getElementById('wpUploadDescription')
 
var tmpl = document.getElementById('rationale')
 
if (desc && tmpl && desc.value.indexOf(tmpl.innerHTML.substring(0,8)) == -1){
 
  desc.value += '\n' + tmpl.innerHTML
 
  desc.rows = 15
 
}
 
}
 
 
 
 
 
 
 
//Load functions on special pages
 
 
if (wgCanonicalNamespace == 'Special'){
 
if (wgCanonicalNamespace == 'Special'){
   if (wgCanonicalSpecialPageName == 'Upload')
+
   switch (wgCanonicalSpecialPageName){
    addOnloadHook(uploadPage)
+
  case 'Upload': importScript_('MediaWiki:Upload.js'); break
  else if  (wgCanonicalSpecialPageName == 'Search')
+
  case 'Search': importScript_('MediaWiki:Search.js'); break
    addOnloadHook(searchPage)
+
  }
 
 
//Load functions on normal pages
 
 
}else if (wgAction != 'history'){
 
}else if (wgAction != 'history'){
 
   addOnloadHook(editZeroSection)
 
   addOnloadHook(editZeroSection)
 
   addOnloadHook(collapsibleDivs)
 
   addOnloadHook(collapsibleDivs)
 
   addOnloadHook(collapsibleTables)
 
   addOnloadHook(collapsibleTables)
   addOnloadHook(correctTitle)
+
   addOnloadHook(mainPage)
   addOnloadHook(mainPageTab)
+
   importScript('MediaWiki:Wikiminiatlas.js', 'meta.wikimedia.org')
  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>')
+
  if (navigator.appName=='Microsoft Internet Explorer' && document.createStyleSheet)
   if (wgNamespaceNumber == 0)
+
    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)
 
     addOnloadHook(LinkFA)
   else{
+
   else {
 
     addOnloadHook(icqIcons)
 
     addOnloadHook(icqIcons)
 
     addOnloadHook(newSectionLink)
 
     addOnloadHook(newSectionLink)
 
   }
 
   }
if (wgAction == 'edit' || wgAction == 'submit' || wgAction == 'editredlink')
+
  if (wgAction=='edit' || wgAction=='submit') importScript_('MediaWiki:Editpage.js')
  document.write('<script type="text/javascript" src="http://ru.wikipedia.org/w/index.php?title=MediaWiki:Editpage.js&action=raw&ctype=text/javascript"><\/script>')
+
}
}
+
 
 +
 
 +
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
 +
}
  
if (navigator.appName == 'Microsoft Internet Explorer')
+
//Сообщить об ошибке
addOnloadHook(function(){
+
importScript_('MediaWiki:Wikibugs.js')
  if (!window.IEFixesDisabled) importScript('MediaWiki:IEFixes.js')
 
})
 
  
 
//</source>
 
//</source>

Текущая версия на 11:04, 13 мая 2009

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

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


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>