"मिडियाविकि:Common.js" को बिचमी भिन्नता

Content deleted Content added
rm unused dependency of jquery.client
Updating
पंक्ति ५:
* optimized ResourceLoader modules with possibility to add dependencies etc.)
*
* Since Commoncommon.js isn't a gadget, there is no place to declare itsit's
* dependencies, so we have to lazy load them with mw.loader.using on demand and
* then execute the rest in the callback. In most cases these dependencies will
पंक्ति ११:
* dependency hasn't arrived yet it'll make sure those are loaded before this.
*/
mw.loader.using( 'mediawiki.util', function() {
 
/* global mw, $ */
/* jshint strict:false, browser:true */
 
mw.loader.using( ['mediawiki.user', 'mediawiki.util', 'mediawiki.notify'] ).done( function () {
/* Begin of mw.loader.using callback */
 
/**
* Main Page layout fixes
*
* Description: Adds an additional link to the complete list of languages available.
* Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
*/
if ( mw.config.get( 'wgPageName' ) === 'Main_Page' || mw.config.get( 'wgPageName' ) === 'Talk:Main_Page' ) {
$( function () {
mw.util.addPortletLink( 'p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',
'Complete list', 'interwiki-completelist', 'Complete list of Wikipedias' );
} );
}
 
/**
Line ५२ ⟶ ३६:
 
/**
* Map addPortletLink to mw.util
*
* @deprecated: Use mw.util.addPortletLink instead.
*/
mw.log.deprecate( window, 'addPortletLink', mw.util.addPortletLink,
'Use mw.util.addPortletLink instead' );
 
/** extract a URL parameter from the current URL **********
/**
*
* Extract a URL parameter from the current URL
* @deprecated: Use mw.util.getParamValue with proper escaping
*/
window.getURLParamValue = function() {
mw.log.deprecate( window, 'getURLParamValue', mw.util.getParamValue, 'Use mw.util.getParamValue instead' );
return mw.util.getParamValue.apply( mw.util, arguments );
 
};
/** &withCSS= and &withJS= URL parameters *******
* Allow to try custom scripts from MediaWiki space
* without editing personal .css or .js files
*/
var extraCSS = mw.util.getParamValue("withCSS");
if ( extraCSS && extraCSS.match(/^MediaWiki:[^&<>=%]*\.css$/) ) {
importStylesheet(extraCSS);
}
var extraJS = mw.util.getParamValue("withJS");
if ( extraJS && extraJS.match(/^MediaWiki:[^&<>=%]*\.js$/) ) {
importScript(extraJS);
}
/**
* Import more specific scripts if necessary
* Test if an element has a certain class
* @deprecated: Use $(element).hasClass() instead.
*/
if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' || mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) {
mw.log.deprecate( window, 'hasClass', function ( element, className ) {
/* scripts specific to editing pages */
return $( element ).hasClass( className );
importScript( 'MediaWiki:Common.js/edit.js' );
}, 'Use jQuery.hasClass() instead' );
} else if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist' ) {
/* watchlist scripts */
importScript( 'MediaWiki:Common.js/watchlist.js' );
}
 
/** WikiMiniAtlas *******************************************************
*
* Description: WikiMiniAtlas is a popup click and drag world map.
* This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
* The script itself is located on meta because it is used by many projects.
* See [[Meta:WikiMiniAtlas]] for more information.
* Maintainers: [[User:Dschwen]]
*/
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
 
 
/**
* Load scripts specific to Internet Explorer
* @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
* @rev 6
*/
if ( $.client.profile().name === 'msie' ) {
var extraCSS = mw.util.getParamValue( 'withCSS' ),
importScript( 'MediaWiki:Common.js/IEFixes.js' );
extraJS = mw.util.getParamValue( 'withJS' );
 
if ( extraCSS ) {
if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) {
mw.loader.load( '/w/index.php?title=' + extraCSS + '&action=raw&ctype=text/css', 'text/css' );
} else {
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
}
}
 
/**
if ( extraJS ) {
* Fix for Windows XP Unicode font rendering
if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
*/
mw.loader.load( '/w/index.php?title=' + extraJS + '&action=raw&ctype=text/javascript' );
if ( navigator.appVersion.search(/windows nt 5/i) !== -1 ) {
} else {
mw.util.addCSS( '.IPA { font-family: "Lucida Sans Unicode", "Arial Unicode MS"; } ' +
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
'.Unicode { font-family: "Arial Unicode MS", "Lucida Sans Unicode"; } ' );
}
}
 
 
/**
/**
* WikiMiniAtlas
* Test if an element has a certain class
*
* @deprecated: Use $(element).hasClass() instead.
* Description: WikiMiniAtlas is a popup click and drag world map.
* This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
* The script itself is located on meta because it is used by many projects.
* See [[Meta:WikiMiniAtlas]] for more information.
* Maintainers: [[User:Dschwen]]
*/
mw.log.deprecate( window, 'hasClass', function ( element, className ) {
return $( element ).hasClass( className );
var require_wikiminiatlas = false;
}, 'Use jQuery.hasClass() instead' );
var coord_filter = /geohack/;
 
$( function () {
// Interwiki links to featured articles
$( 'a.external.text' ).each( function( key, link ) {
mw.loader.load('//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-featured-articles-links.js&action=raw&ctype=text/javascript');
if ( link.href && coord_filter.exec( link.href ) ) {
require_wikiminiatlas = true;
// break from loop
return false;
}
} );
if ( $( 'div.kmldata' ).length ) {
require_wikiminiatlas = true;
}
if ( require_wikiminiatlas ) {
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
}
} );
} )();
 
/**
* Collapsible tables
*
* Allows tables to be collapsed, showing only the header. See [[HelpWikipedia:CollapsingNavFrame]].
*
* @version 2.0.3 (2014-03-14)
Line १३७ ⟶ १२९:
 
var autoCollapse = 2;
var collapseCaption = 'hideनुकाबी';
var expandCaption = 'showदेखाबी';
var tableIndex = 0;
 
Line १५१ ⟶ १४३:
var Rows = Table.rows;
var i;
var $row0 = $(Rows[0]);
 
if ( Button.firstChild.data === collapseCaption ) {
Line १६० ⟶ १५१:
} else {
for ( i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = $row0Rows[0].style.css( 'display' );
}
Button.firstChild.data = collapseCaption;
Line २३४ ⟶ २२५:
 
mw.hook( 'wikipage.content' ).add( createCollapseButtons );
 
/**
* Add support to mw-collapsible for autocollapse, innercollapse and outercollapse
*
* Maintainers: TheDJ
*/
function mwCollapsibleSetup( $collapsibleContent ) {
var $element,
$toggle,
autoCollapseThreshold = 2;
$.each( $collapsibleContent, function (index, element) {
$element = $( element );
if ( $collapsibleContent.length > autoCollapseThreshold && $element.hasClass( 'autocollapse' ) ) {
$element.data( 'mw-collapsible' ).collapse();
} else if ( $element.hasClass( 'innercollapse' ) ) {
if ( $element.parents( '.outercollapse' ).length > 0 ) {
$element.data( 'mw-collapsible' ).collapse();
}
}
$toggle = $element.find( '.mw-collapsible-toggle' );
if ( $toggle.length ) {
// Make the toggle inherit text color
if( $toggle.parent()[0].style.color ) {
$toggle.find( 'a' ).css( 'color', 'inherit' );
}
}
} );
}
 
mw.hook( 'wikipage.collapsibleContent' ).add( mwCollapsibleSetup );
 
/**
* Dynamic Navigation Bars (experimental)
Line ३६८ ⟶ ३२९:
mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );
 
/**
* Main Page layout fixes
*
* Description: Adds an additional link to the complete list of languages available.
* Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
*/
if ( mw.config.get( 'wgPageName' ) === 'सम्मुख_पन्ना' || mw.config.get( 'wgPageName' ) === 'वार्ता:सम्मुख_पन्ना' ) {
$( function () {
mw.util.addPortletLink( 'p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias/bn?uselang=mai',
'पूर्ण तालिका', 'interwiki-completelist', 'सब विकिपिडियाक सूची' );
} );
}
 
/**
* Uploadwizard_newusers
Line ३९५ ⟶ ३७०:
}
}
 
$(uploadwizard_newusers);
 
Line ४१८ ⟶ ३९३:
 
$( function () {
var cats = mwdocument.config.getgetElementById( 'wgCategoriesmw-normal-catlinks' );
if ( !cats ) {
return;
}
cats = cats.getElementsByTagName( 'a' );
if ( $.inArray( 'Living people', cats ) !== -1 || $.inArray( 'Possibly living people', cats ) !== -1 ) {
for ( var i = 0; i < cats.length; i++ ) {
addEditIntro( 'Template:BLP_editintro' );
if ( cats[i].title === 'श्रेणी:जीवित लोग' || cats[i].title === 'श्रेणी:सम्भावित जीवित लोग' ) {
addEditIntro( 'Template:BLP_editintro' );
break;
}
}
} );
}
/**
 
* Description: Stay on the secure server as much as possible
/* Actions specific to the edit page */
* Maintainers: [[User:TheDJ]]
if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' ) {
*/**
if ( document.location && document.location.protocol === 'https:' ) {
* Fix edit summary prompt for undo
/* New secure servers */
*
importScript( 'MediaWiki:Common.js/secure new.js' );
* Fixes the fact that the undo function combined with the "no edit summary prompter"
* complains about missing editsummary, if leaving the edit summary unchanged.
* Added by [[User:Deskana]], code by [[User:Tra]].
* See also [[phab:T10912]].
*/
$(function () {
if (document.location.search.indexOf('undo=') !== -1 && document.getElementsByName('wpAutoSummary')[0]) {
document.getElementsByName('wpAutoSummary')[0].value = '1';
}
});
}
 
/* End of mw.loader.using callback */
} );
/* अहिसँ निचा पङ्क्ति नै जोडी */
/* DO NOT ADD CODE BELOW THIS LINE */