MediaWiki:Common.js
Курӑнакан калӑплав
Асӑрхани: Улшӑнусене курмашкӑн, тен, сирӗн хӑвӑрӑн браузерӑн кэшне тасатма тивӗ.
- Firefox / Safari: Shift пускӑч ҫине пусса тӑрса, хатӗр-хӗтӗрсен панелӗ ҫинче Ҫӗнет ҫине пусӑр, е Ctrl+F5 (Ctrl+R / Mac ҫинче — ⌘+R) пусӑр.
- Google Chrome: Ctrl+Shift+R пусӑр (Mac ҫинче ⌘+Shift+R)
- Edge: Ctrl пусса тӑнӑ май Ҫӗнет ҫине пусӑр, е Ctrl+F5 пусӑр.
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('§ion=T') == -1) a.title = a.title.replace(/:.*$/,': 0')
else a.title = 'Пайне тӳрлет: 0'
a.setAttribute('href', mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit§ion=0')
}
var NavigationBarShowDefault = 2
var NavigationBarHide = '[пытармалла]'
var NavigationBarShow = '[кăтартмалла]'
function setModifySectionStyle()
{
var process = function(list)
{
for(var i=0;i!=list.length;i++)
{
var span=list[i].firstChild
if (span.className == "editsection")
{
span.style.fontFamily = "serif";
span.style.fontSize = "small";
span.style.fontStyle = "italic";
span.style.cssFloat = span.style.styleFloat = "none";
span.parentNode.appendChild(document.createTextNode(" "));
span.parentNode.appendChild(span);
}
}
}
try
{
if (!(typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false)) return;
process(document.getElementsByTagName("h2"));
process(document.getElementsByTagName("h3"));
process(document.getElementsByTagName("h4"));
process(document.getElementsByTagName("h5"));
process(document.getElementsByTagName("h6"));
}
catch (e) { }
}
$(setModifySectionStyle);
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 (!$(Table).hasClass('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 && $(colTables[i]).hasClass('autocollapse')) || $(colTables[i]).hasClass('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 (!$(NavFrame).hasClass('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 ($(NavFrame.childNodes[j]).hasClass('NavHead'))
NavFrame.childNodes[j].appendChild(a)
colNavs[navIdx++] = NavFrame
}
for (i = 0; i < navIdx; i++)
if ((navIdx > NavigationBarShowDefault && !$(colNavs[i]).hasClass('expanded')) || $(colNavs[i]).hasClass('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 ($(child).hasClass('NavPic') || $(child).hasClass('NavContent'))
child.style.display = disp
}
// Execution
if (mw.config.get('wgCanonicalNamespace') == 'Special'){
/*if (/^(Uplo|Sear|Stat|Spec|Abus)/i.test(wgCanonicalSpecialPageName))
importScript('MediaWiki:'+wgCanonicalSpecialPageName+'.js')*/
}else if (mw.config.get('wgAction') != 'history'){
$(editZeroSection)
$(collapsibleDivs)
$(collapsibleTables)
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400')
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)
importScript('MediaWiki:Collapserefs.js')
if (wgArticleId == 4401) importScript('MediaWiki:Mainpage.js')
else {
if (wgNamespaceNumber == 4){
if (/^(Статья ăçти|Инкубатор)/.test(wgTitle)) importScript('MediaWiki:Incubator.js')
if (wgTitle == 'Скриптсем') importScript('MediaWiki:Scripts.js')
}
}
if (mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit') importScript('MediaWiki:Editpage.js')*/
}