MediaWiki:Common.js: Ózgerisler arasındaǵı ayırmashılıq
Content deleted Content added
Өңдеу түйіні жоқ |
update |
||
Qatar No 1: | Qatar No 1: | ||
/*<source lang="javascript">*/ |
|||
/* |
/* |
||
== Global configuration == |
== Global configuration == |
||
Qatar No 20: | Qatar No 19: | ||
*/ |
*/ |
||
var isMSIE = ((navigator.appName == 'Microsoft Internet Explorer' ) > 0); |
var isMSIE = ((navigator.appName == 'Microsoft Internet Explorer' ) > 0); |
||
var isNoSpecial = (wgCanonicalNamespace != "Special"); |
var isNoSpecial = (mw.config.get('wgCanonicalNamespace') != "Special"); |
||
var isUpload = ((wgCanonicalNamespace == "Special") && (wgCanonicalSpecialPageName == "Upload")); |
var isUpload = ((mw.config.get('wgCanonicalNamespace') == "Special") && (mw.config.get('wgCanonicalSpecialPageName') == "Upload")); |
||
var isEdit = ((document.URL.indexOf("action=edit") > 0 || document.URL.indexOf("action=submit") > 0) && !document.getElementById('ca-viewsource') > 0); |
var isEdit = ((document.URL.indexOf("action=edit") > 0 || document.URL.indexOf("action=submit") > 0) && !document.getElementById('ca-viewsource') > 0); |
||
Qatar No 28: | Qatar No 27: | ||
// Add Main page layout fix |
// Add Main page layout fix |
||
if (wgTitle == 'Bas bet') { importScript( "MediaWiki:Mainpage.js" ); } |
if mw.config.get('wgTitle') == 'Bas bet') { importScript( "MediaWiki:Mainpage.js" ); } |
||
// Add editing stuff (toolbar buttons, template pull-down menu etc) for registered users |
// Add editing stuff (toolbar buttons, template pull-down menu etc) for registered users |
||
Qatar No 48: | Qatar No 47: | ||
// uploadwizard_newusers Switches in a message for non-autoconfirmed users at [[Wikipedia:Aploud qılıw]] |
// uploadwizard_newusers Switches in a message for non-autoconfirmed users at [[Wikipedia:Aploud qılıw]] |
||
function uploadwizard_newusers() { |
function uploadwizard_newusers() { |
||
if (wgNamespaceNumber == 4 && wgTitle == "Aploud qılıw" && wgAction == "view") { |
if (mw.config.get('wgNamespaceNumber') == 4 && mw.config.get('wgTitle') == "Aploud qılıw" && mw.config.get('wgAction') == "view") { |
||
var oldDiv = document.getElementById("autoconfirmedusers"), |
var oldDiv = document.getElementById("autoconfirmedusers"), |
||
newDiv = document.getElementById("newusers"); |
newDiv = document.getElementById("newusers"); |
||
if (oldDiv && newDiv) { |
if (oldDiv && newDiv) { |
||
for (i = 0; i < wgUserGroups.length; i++) { |
for (i = 0; i < mw.config.get('wgUserGroups').length; i++) { |
||
if (wgUserGroups[i] == "autoconfirmed") { |
if (mw.config.get('wgUserGroups')[i] == "autoconfirmed") { |
||
oldDiv.style.display = "block"; |
oldDiv.style.display = "block"; |
||
newDiv.style.display = "none"; |
newDiv.style.display = "none"; |
||
Qatar No 65: | Qatar No 64: | ||
} |
} |
||
} |
} |
||
$(document).ready(uploadwizard_newusers); |
|||
// WikiMiniAtlas |
// WikiMiniAtlas |
||
/* |
|||
if (wgServer == "https://secure.wikimedia.org") { |
|||
var metaBase = "https://secure.wikimedia.org/wikipedia/meta"; |
|||
} else { |
|||
var metaBase = "http://meta.wikimedia.org"; |
|||
} |
|||
⚫ | |||
*/ |
|||
/* |
|||
== Execute function on page load == |
|||
*/ |
|||
function addLoadEvent( f ) { addOnloadHook( f ); } |
|||
/* |
/* |
||
⚫ | |||
== Test if an element has a certain class == |
|||
*/ |
*/ |
||
var hasClass = (function () { |
|||
var reCache = {}; |
|||
return function (element, className) { |
|||
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className); |
|||
}; |
|||
})(); |
|||
/* |
/* |
||
Qatar No 131: | Qatar No 110: | ||
for ( var i = 0; i < Tables.length; i++ ) { |
for ( var i = 0; i < Tables.length; i++ ) { |
||
if ( |
if ( $(Tables[i]).hasClass( "collapsible" ) ) { |
||
/* only add button and increment count if there is a header row to work with */ |
/* only add button and increment count if there is a header row to work with */ |
||
Qatar No 167: | Qatar No 146: | ||
for ( var i = 0; i < tableIndex; i++ ) { |
for ( var i = 0; i < tableIndex; i++ ) { |
||
if ( |
if ( $(NavigationBoxes[i]).hasClass( "collapsed" ) || ( tableIndex >= autoCollapse && $(NavigationBoxes[i]).hasClass( "autocollapse" ) ) ) { |
||
collapseTable( i ); |
collapseTable( i ); |
||
} |
} |
||
Qatar No 173: | Qatar No 152: | ||
} |
} |
||
$(document).ready( createCollapseButtons ); |
|||
/* |
/* |
||
Qatar No 200: | Qatar No 179: | ||
NavChild = NavChild.nextSibling |
NavChild = NavChild.nextSibling |
||
) { |
) { |
||
if ( |
if ( $(NavChild).hasClass( 'NavPic' ) ) { |
||
NavChild.style.display = 'none'; |
NavChild.style.display = 'none'; |
||
} |
} |
||
if ( |
if ( $(NavChild).hasClass( 'NavContent') ) { |
||
NavChild.style.display = 'none'; |
NavChild.style.display = 'none'; |
||
} |
} |
||
Qatar No 216: | Qatar No 195: | ||
NavChild = NavChild.nextSibling |
NavChild = NavChild.nextSibling |
||
) { |
) { |
||
if ( |
if ($(NavChild).hasClass( 'NavPic')) { |
||
NavChild.style.display = 'block'; |
NavChild.style.display = 'block'; |
||
} |
} |
||
if ( |
if ($(NavChild).hasClass( 'NavContent')) { |
||
NavChild.style.display = 'block'; |
NavChild.style.display = 'block'; |
||
} |
} |
||
Qatar No 238: | Qatar No 217: | ||
) { |
) { |
||
// if found a navigation bar |
// if found a navigation bar |
||
if ( |
if ($(NavFrame).hasClass( "NavFrame")) { |
||
indexNavigationBar++; |
indexNavigationBar++; |
||
Qatar No 252: | Qatar No 231: | ||
NavChild = NavChild.nextSibling |
NavChild = NavChild.nextSibling |
||
) { |
) { |
||
if ( hasClass( |
if ( $(NavChild).hasClass( 'NavPic' ) || $(NavChild).hasClass( 'NavContent' ) ) { |
||
if (NavChild.style.display == 'none') { |
if (NavChild.style.display == 'none') { |
||
NavToggleText = document.createTextNode(NavigationBarShow); |
NavToggleText = document.createTextNode(NavigationBarShow); |
||
Qatar No 267: | Qatar No 246: | ||
j++ |
j++ |
||
) { |
) { |
||
if |
if $(NavFrame.childNodes[j]).hasClass( "NavHead")) { |
||
NavFrame.childNodes[j].appendChild(NavToggle); |
NavFrame.childNodes[j].appendChild(NavToggle); |
||
} |
} |
||
Qatar No 276: | Qatar No 255: | ||
} |
} |
||
$(document).ready( createNavigationBarToggleButton ); |
|||
/* |
/* |
||
Qatar No 287: | Qatar No 266: | ||
} |
} |
||
$(document).ready(DiscussionBistro); |
|||
/* |
/* |
||
Qatar No 310: | Qatar No 289: | ||
} |
} |
||
$(document).ready(LinkFA ); |
|||
// Configuration for "star" logo at the top of Featured Articles |
// Configuration for "star" logo at the top of Featured Articles |
||
Qatar No 324: | Qatar No 303: | ||
} |
} |
||
$(document).ready(StarFA); |
|||
/*</source>*/ |
12:47, 2013 j. oktyabrdiń 30 waqtındaǵı nusqası
/*
== Global configuration ==
Override these default settings in your [[Special:Mypage/monobook.js]]
for Example: JSconfig.loadAutoInformationTemplate = false;
*/
var JSconfig =
{
loadAutoInformationTemplate : true,
loadEditToolsStyleCompact : true
};
/* Disable code in table sorting routine to set classes on even/odd rows [[User:Random832]] */
ts_alternate_row_colors = false;
/*
== Import an external JavaScript ==
*/
var isMSIE = ((navigator.appName == 'Microsoft Internet Explorer' ) > 0);
var isNoSpecial = (mw.config.get('wgCanonicalNamespace') != "Special");
var isUpload = ((mw.config.get('wgCanonicalNamespace') == "Special") && (mw.config.get('wgCanonicalSpecialPageName') == "Upload"));
var isEdit = ((document.URL.indexOf("action=edit") > 0 || document.URL.indexOf("action=submit") > 0) && !document.getElementById('ca-viewsource') > 0);
// Add MSIE fixes
if (isMSIE) { importScript( "MediaWiki:Iefixesplus.js" ); }
// Add Main page layout fix
if mw.config.get('wgTitle') == 'Bas bet') { importScript( "MediaWiki:Mainpage.js" ); }
// Add editing stuff (toolbar buttons, template pull-down menu etc) for registered users
if (isEdit && isNoSpecial) { importScript( "MediaWiki:Editplus.js" ); }
// Add script for charsets pull-down menu
if (isEdit || isUpload) { importScript( "MediaWiki:Edittools.js" ); }
//Fix "Upload file" link when using the secure proxy
//This is a workaround that can be removed when bug 10843 is fixed
addOnloadHook(function() {
if (document.getElementById("t-upload"))
{
document.getElementById("t-upload").getElementsByTagName("a")[0].href = wgArticlePath.replace("$1", "Wikipedia:Aploud_qılıw")
}
})
// uploadwizard_newusers Switches in a message for non-autoconfirmed users at [[Wikipedia:Aploud qılıw]]
function uploadwizard_newusers() {
if (mw.config.get('wgNamespaceNumber') == 4 && mw.config.get('wgTitle') == "Aploud qılıw" && mw.config.get('wgAction') == "view") {
var oldDiv = document.getElementById("autoconfirmedusers"),
newDiv = document.getElementById("newusers");
if (oldDiv && newDiv) {
for (i = 0; i < mw.config.get('wgUserGroups').length; i++) {
if (mw.config.get('wgUserGroups')[i] == "autoconfirmed") {
oldDiv.style.display = "block";
newDiv.style.display = "none";
return;
}
}
oldDiv.style.display = "none";
newDiv.style.display = "block";
}
}
}
$(document).ready(uploadwizard_newusers);
// WikiMiniAtlas
/*
importScriptURI("//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400")
*/
/*
== Collapsible tables ==
*/
var autoCollapse = 2;
var collapseCaption = "jasır";
var expandCaption = "ko'rset";
function collapseTable( tableIndex ) {
var Button = document.getElementById( "collapseButton" + tableIndex );
var Table = document.getElementById( "collapsibleTable" + tableIndex );
if ( !Table || !Button ) {
return false;
}
var Rows = Table.rows;
if ( Button.firstChild.data == collapseCaption ) {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = "none";
}
Button.firstChild.data = expandCaption;
} else {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = Rows[0].style.display;
}
Button.firstChild.data = collapseCaption;
}
}
function createCollapseButtons() {
var tableIndex = 0;
var NavigationBoxes = new Object();
var Tables = document.getElementsByTagName( "table" );
for ( var i = 0; i < Tables.length; i++ ) {
if ( $(Tables[i]).hasClass( "collapsible" ) ) {
/* only add button and increment count if there is a header row to work with */
var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
if (!HeaderRow) continue;
var Header = HeaderRow.getElementsByTagName( "th" )[0];
if (!Header) continue;
NavigationBoxes[ tableIndex ] = Tables[i];
Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
var Button = document.createElement( "span" );
var ButtonLink = document.createElement( "a" );
var ButtonText = document.createTextNode( collapseCaption );
Button.style.styleFloat = "right";
Button.style.cssFloat = "right";
Button.style.fontWeight = "normal";
Button.style.textAlign = "right";
Button.style.width = "6em";
ButtonLink.style.color = Header.style.color;
ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
ButtonLink.appendChild( ButtonText );
Button.appendChild( document.createTextNode( "[" ) );
Button.appendChild( ButtonLink );
Button.appendChild( document.createTextNode( "]" ) );
Header.insertBefore( Button, Header.childNodes[0] );
tableIndex++;
}
}
for ( var i = 0; i < tableIndex; i++ ) {
if ( $(NavigationBoxes[i]).hasClass( "collapsed" ) || ( tableIndex >= autoCollapse && $(NavigationBoxes[i]).hasClass( "autocollapse" ) ) ) {
collapseTable( i );
}
}
}
$(document).ready( createCollapseButtons );
/*
== Dynamic Navigation Bars ==
*/
var NavigationBarHide = "jasır";
var NavigationBarShow = "ko'rset";
// shows and hides content and picture (if available) of navigation bars
// Parameters:
// indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar(indexNavigationBar) {
var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
if (!NavFrame || !NavToggle) {
return false;
}
// if shown now
if (NavToggle.firstChild.data == NavigationBarHide) {
for (
var NavChild = NavFrame.firstChild;
NavChild != null;
NavChild = NavChild.nextSibling
) {
if ( $(NavChild).hasClass( 'NavPic' ) ) {
NavChild.style.display = 'none';
}
if ( $(NavChild).hasClass( 'NavContent') ) {
NavChild.style.display = 'none';
}
}
NavToggle.firstChild.data = NavigationBarShow;
// if hidden now
} else if (NavToggle.firstChild.data == NavigationBarShow) {
for (
var NavChild = NavFrame.firstChild;
NavChild != null;
NavChild = NavChild.nextSibling
) {
if ($(NavChild).hasClass( 'NavPic')) {
NavChild.style.display = 'block';
}
if ($(NavChild).hasClass( 'NavContent')) {
NavChild.style.display = 'block';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
}
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton() {
var indexNavigationBar = 0;
// iterate over all < div >-elements
var divs = document.getElementsByTagName("div");
for(
var i=0;
NavFrame = divs[i];
i++
) {
// if found a navigation bar
if ($(NavFrame).hasClass( "NavFrame")) {
indexNavigationBar++;
var NavToggle = document.createElement("a");
NavToggle.className = 'NavToggle';
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
var NavToggleText = document.createTextNode(NavigationBarHide);
for (
var NavChild = NavFrame.firstChild;
NavChild != null;
NavChild = NavChild.nextSibling
) {
if ( $(NavChild).hasClass( 'NavPic' ) || $(NavChild).hasClass( 'NavContent' ) ) {
if (NavChild.style.display == 'none') {
NavToggleText = document.createTextNode(NavigationBarShow);
break;
}
}
}
NavToggle.appendChild(NavToggleText);
// 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++
) {
if $(NavFrame.childNodes[j]).hasClass( "NavHead")) {
NavFrame.childNodes[j].appendChild(NavToggle);
}
}
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
}
}
}
$(document).ready( createNavigationBarToggleButton );
/*
== Transforming 'Village Pump' to Discussion pages ==
*/
function DiscussionBistro() {
if(document.title.search("Wikipedia:Forum") != -1)
document.body.className = "ns-1";
}
$(document).ready(DiscussionBistro);
/*
== "Star" logo for Featured Articles ==
*/
function LinkFA() {
if ( document.getElementById( "p-lang" ) ) {
var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );
for ( var i = 0; i < InterwikiLinks.length; i++ ) {
if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {
InterwikiLinks[i].className += " FA"
InterwikiLinks[i].title = "Bul basqa tildegi saylandı maqala.";
}
if ( document.getElementById( InterwikiLinks[i].className + "-ga" ) ) {
InterwikiLinks[i].className += " GA"
InterwikiLinks[i].title = "Bul basqa tildegi asqan maqala.";
}
}
}
}
$(document).ready(LinkFA );
// Configuration for "star" logo at the top of Featured Articles
function StarFA() {
if (document.getElementById("FA")) {
document.body.className += " FA";
for (var i = 0; a = document.getElementsByTagName("h1")[i]; i++) {
if (a.className == "firstHeading") {
a.title = "Saylandı maqala";
}
}
}
}
$(document).ready(StarFA);