|
|
第1行: |
第1行: |
| /* Copy of en.wikipedia.org MediaWiki:Commmon.js */ | | /* |
| | 模拟中维 |
| | */ |
|
| |
|
| /**
| | window["test_global_attr_20200331113399999"] = "exists" |
| * Keep code in MediaWiki:Common.js to a minimum as it is unconditionally
| |
| * loaded for all users on every wiki page. If possible create a gadget that is
| |
| * enabled by default instead of adding it here (since gadgets are fully
| |
| * optimized ResourceLoader modules with possibility to add dependencies etc.)
| |
| *
| |
| * Since Common.js isn't a gadget, there is no place to declare its
| |
| * 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
| |
| * be loaded (or loading) already and the callback will not be delayed. In case a
| |
| * dependency hasn't arrived yet it'll make sure those are loaded before this.
| |
| */
| |
|
| |
|
| /* global mw, $ */
| | mw.log.deprecate( window, 'JSConfig', {} ); |
| /* jshint strict:false, browser:true */
| |
|
| |
|
| mw.loader.using( ['mediawiki.util'] ).done( function () { | | mw.loader.using(['mediawiki.util', 'ext.gadget.site-lib'], function () { |
| /* Begin of mw.loader.using callback */
| | (function ($, mw) { |
|
| |
|
| /** | | /* 當需要時載入對應的 scripts */ |
| * Main Page layout fixes | | var importScriptRL=function(page){ |
| *
| | mw.loader.load(mw.config.get('wgScript')+'?title='+mw.util.wikiUrlencode(page)+'&action=raw&ctype=text/javascript&_='+Math.floor((new Date())/1000/60/60/24/7)); |
| * 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' );
| |
| } );
| |
| }
| |
|
| |
|
| /**
| | if (mw.config.get('wgAction') == "edit" || mw.config.get('wgAction') == "submit" || mw.config.get('wgCanonicalSpecialPageName') == 'Search') { // scripts specific to editing pages |
| * Redirect User:Name/skin.js and skin.css to the current skin's pages
| | importScriptRL('MediaWiki:Common.js\/edit.js'); |
| * (unless the 'skin' page really exists)
| | } else { |
| * @source: http://www.mediawiki.org/wiki/Snippets/Redirect_skin.js
| | mw.loader.using('ext.visualEditor.desktopArticleTarget.init', function () { |
| * @rev: 2
| | mw.libs.ve.addPlugin(function () { |
| */
| | importScriptRL('MediaWiki:Common.js\/edit.js'); |
| if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) { | | }); |
| var titleParts = mw.config.get( 'wgPageName' ).split( '/' );
| | }); |
| /* Make sure there was a part before and after the slash
| | } |
| and that the latter is 'skin.js' or 'skin.css' */
| |
| if ( titleParts.length == 2 ) {
| |
| var userSkinPage = titleParts.shift() + '/' + mw.config.get( 'skin' );
| |
| if ( titleParts.slice( -1 ) == 'skin.js' ) {
| |
| window.location.href = mw.util.getUrl( userSkinPage + '.js' );
| |
| } else if ( titleParts.slice( -1 ) == 'skin.css' ) {
| |
| window.location.href = mw.util.getUrl( userSkinPage + '.css' );
| |
| }
| |
| }
| |
| } | |
|
| |
|
| /** | | // wiki URL |
| * Map addPortletLink to mw.util
| | window.wgProjectURL = { |
| * @deprecated: Use mw.util.addPortletLink instead. | | en: '//en.wikipedia.org', |
| */
| | de: '//de.wikipedia.org', |
| mw.log.deprecate( window, 'addPortletLink', mw.util.addPortletLink, 'Use mw.util.addPortletLink instead' );
| | fr: '//fr.wikipedia.org', |
| | pl: '//pl.wikipedia.org', |
| | ja: '//ja.wikipedia.org', |
| | it: '//it.wikipedia.org', |
| | nl: '//nl.wikipedia.org', |
| | pt: '//pt.wikipedia.org', |
| | es: '//es.wikipedia.org', |
| | sv: '//sv.wikipedia.org', |
| | // 僅列前十名其它語言百科 |
| | m: '//meta.wikimedia.org', |
| | b: '//zh.wikibooks.org', |
| | q: '//zh.wikiquote.org', |
| | n: '//zh.wikinews.org', |
| | wikt: '//zh.wiktionary.org', |
| | mw: '//www.mediawiki.org', |
| | commons: '//commons.wikimedia.org' |
| | }; |
|
| |
|
| /** | | /** |
| * Extract a URL parameter from the current URL
| | * Helper script for .hlist class in Common.css |
| * @deprecated: Use mw.util.getParamValue with proper escaping
| | * Add pseudo-selector class to last-child list items in IE8 |
| */
| | * @source mediawiki.org/wiki/Snippets/Horizontal_lists |
| mw.log.deprecate( window, 'getURLParamValue', mw.util.getParamValue, 'Use mw.util.getParamValue instead' );
| | * @revision 6 (2014-08-23) |
| | * @author [[User:Edokter]] |
| | */ |
| | var profile = $.client.profile(); |
| | if ( profile.name === 'msie' && profile.versionNumber === 8 ) { |
| | mw.hook( 'wikipage.content' ).add( function ( $content ) { |
| | $content.find( '.hlist' ).find( 'dd:last-child, dt:last-child, li:last-child' ) |
| | .addClass( 'hlist-last-child' ); |
| | } ); |
| | } |
|
| |
|
| /** | | /* Fixes for Windows XP font rendering */ |
| * Test if an element has a certain class
| | if (navigator.appVersion.search(/windows nt 5/i) != -1) { |
| * @deprecated: Use $(element).hasClass() instead.
| | mw.util.addCSS('.IPA {font-family: "Lucida Sans Unicode", "Arial Unicode MS";} ' + |
| */
| | '.Unicode {font-family: "Arial Unicode MS", "Lucida Sans Unicode";}'); |
| mw.log.deprecate( window, 'hasClass', function ( element, className ) { | | } |
| return $( element ).hasClass( className );
| |
| }, 'Use jQuery.hasClass() instead' ); | |
|
| |
|
| /**
| |
| * @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
| |
| * @rev 6
| |
| */
| |
| var extraCSS = mw.util.getParamValue( 'withCSS' ),
| |
| extraJS = mw.util.getParamValue( 'withJS' );
| |
|
| |
|
| if ( extraCSS ) {
| | // 修正摺疊後定位變化 |
| if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) {
| | $(function () { |
| mw.loader.load( '/w/index.php?title=' + extraCSS + '&action=raw&ctype=text/css', 'text/css' );
| | if (location.hash) { |
| } else {
| | location.href = location.hash; |
| mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
| | } |
| }
| | }); |
| }
| |
|
| |
|
| if ( extraJS ) {
| | /* 避免在主條目的註腳中出現捲軸框 */ |
| if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
| | if (!mw.config.get("wgCanonicalNamespace")) $(function () { |
| mw.loader.load( '/w/index.php?title=' + extraJS + '&action=raw&ctype=text/javascript' );
| |
| } else {
| |
| mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
| |
| }
| |
| }
| |
|
| |
|
| /**
| | $("div#mw-content-text ol.references") |
| * WikiMiniAtlas
| | .each(function(){ |
| *
| | var needobjs=[], $curobj=$(this); |
| * 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.
| |
| * Note - use of this service is recommended to be replaced with mw:Help:Extension:Kartographer
| |
| */
| |
| $( function () {
| |
| var require_wikiminiatlas = $( 'a.external.text[href*="geohack"]' ).length || $( 'div.kmldata' ).length;
| |
| if ( require_wikiminiatlas ) {
| |
| mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
| |
| }
| |
| } );
| |
|
| |
|
| /**
| | do{ |
| * Collapsible tables; reimplemented with mw-collapsible
| | $curobj=$curobj.parent(); |
| * Styling is also in place to avoid FOUC
| | if( !$curobj ) break; |
| *
| | if( $curobj.attr("id")=="mw-content-text" || $curobj.prop("tagName").toLowerCase()=="body") break; |
| * Allows tables to be collapsed, showing only the header. See [[Help:Collapsing]].
| |
| * @version 3.0.0 (2018-05-20)
| |
| * @source https://www.mediawiki.org/wiki/MediaWiki:Gadget-collapsibleTables.js
| |
| * @author [[User:R. Koot]]
| |
| * @author [[User:Krinkle]]
| |
| * @author [[User:TheDJ]]
| |
| * @deprecated Since MediaWiki 1.20: Use class="mw-collapsible" instead which
| |
| * is supported in MediaWiki core. Shimmable since MediaWiki 1.32
| |
| */
| |
| function makeCollapsibleMwCollapsible( $content ) {
| |
| var $tables = $content
| |
| .find( 'table.collapsible:not(.mw-collapsible)' )
| |
| .addClass( 'mw-collapsible' );
| |
|
| |
|
| $.each( $tables, function( index, table ) {
| | if( |
| // mw.log.warn( 'This page is using the deprecated class collapsible. Please replace it with mw-collapsible.');
| | $curobj.css("overflow").match(/(?:auto|scroll)/i) |
| if( $( table ).hasClass( 'collapsed') ) {
| | || $curobj.css("overflow-x").match(/(?:auto|scroll)/i) |
| $( table ).addClass( 'mw-collapsed' );
| | || $curobj.css("overflow-y").match(/(?:auto|scroll)/i) |
| // mw.log.warn( 'This page is using the deprecated class collapsed. Please replace it with mw-collapsed.');
| | ){}else continue; |
| }
| |
| } );
| |
| if( $tables.length > 0 ) {
| |
| mw.loader.using( 'jquery.makeCollapsible' ).then( function() {
| |
| $tables.makeCollapsible();
| |
| } );
| |
| }
| |
| } | |
| mw.hook( 'wikipage.content' ).add( makeCollapsibleMwCollapsible );
| |
|
| |
|
| /**
| | if( (""+$curobj.attr("class")).split(" ").indexOf("noprint")>=0 ) return; |
| * 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 ( $element.hasClass( 'collapsible' ) ) {
| |
| $element.find('tr:first > th:first').prepend( $element.find('tr:first > * > .mw-collapsible-toggle'));
| |
| }
| |
| 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();
| |
| }
| |
| }
| |
| // because of colored backgrounds, style the link in the text color
| |
| // to ensure accessible contrast
| |
| $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 );
| | needobjs.push($curobj.get(0)); |
|
| |
|
| /**
| | }while(true); |
| * Dynamic Navigation Bars (experimental)
| |
| *
| |
| * Description: See [[Wikipedia:NavFrame]].
| |
| * Maintainers: UNMAINTAINED
| |
| */
| |
|
| |
| var collapseCaption = 'hide';
| |
| var expandCaption = 'show';
| |
|
| |
|
| // Set up the words in your language
| | $(needobjs) |
| var navigationBarHide = '[' + collapseCaption + ']';
| | .css("overflow","visible") |
| var navigationBarShow = '[' + expandCaption + ']';
| | .css("overflow-x","visible") |
| | .css("overflow-y","visible") |
| | .css("height","") |
| | .css("max-height","") |
| | .css("border","") |
| | ; |
| | }); |
| | }); |
|
| |
|
| /**
| |
| * Shows and hides content and picture (if available) of navigation bars.
| |
| *
| |
| * @param {number} indexNavigationBar The index of navigation bar to be toggled
| |
| * @param {jQuery.Event} event Event object
| |
| */
| |
| function toggleNavigationBar( indexNavigationBar, event ) {
| |
| var navToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
| |
| var navFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
| |
| var navChild;
| |
|
| |
|
| if ( !navFrame || !navToggle ) {
| | /** metaBox |
| return false;
| | * |
| }
| | * Funcionament de la Plantilla:Metacaixa |
| | * Implementat per: Usuari:Peleguer. |
| | * Actualitzat per Joanjoc seguint les indicacions d'en Martorell |
| | */ |
| | function MetaCaixaInit() { |
| | // S'executa al carregar-se la pàgina, si hi ha metacaixes, |
| | // s'assignen els esdeveniments als botons |
| | //alert("MetaCaixaInit"); |
| | var i = 0; // Inicialitzem comptador de caixes |
| | for (i = 0; i <= 9; i++) { |
| | var vMc = document.getElementById("mc" + i); |
| | if (!vMc) break; |
| | //alert("MetaCaixaInit, trobada Metacaixa mc"+i); |
| | var j = 1; // Inicialitzem comptador de botons dins de la caixa |
| | var vPsIni = 0; // Pestanya visible inicial |
| | for (j = 1; j <= 9; j++) { |
| | var vBt = document.getElementById("mc" + i + "bt" + j); |
| | if (!vBt) break; |
| | //alert("MetaCaixaInit, trobat botó mc"+i+"bt"+j); |
| | vBt.onclick = MetaCaixaMostraPestanya; // A cada botó assignem l'esdeveniment onclick |
| | //alert (vBt.className); |
| | if (vBt.className == "mcBotoSel") vPsIni = j; // Si tenim un botó seleccionat, en guardem l'index |
| | } |
| | //alert ("mc="+i+", ps="+j+", psini="+vPsIni ); |
| | if (vPsIni === 0) { // Si no tenim cap botó seleccionat, n'agafem un aleatòriament |
| | vPsIni = 1 + Math.floor((j - 1) * Math.random()); |
| | //alert ("Activant Pestanya a l'atzar; _mc"+i+"bt"+vPsIni +"_"); |
| | document.getElementById("mc" + i + "ps" + vPsIni).style.display = "block"; |
| | document.getElementById("mc" + i + "ps" + vPsIni).style.visibility = "visible"; |
| | document.getElementById("mc" + i + "bt" + vPsIni).className = "mcBotoSel"; |
| | } |
| | } |
| | } |
|
| |
|
| // If shown now
| | function MetaCaixaMostraPestanya() { |
| if ( navToggle.firstChild.data === navigationBarHide ) {
| | // S'executa al clicar una pestanya, |
| for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {
| | // aquella es fa visible i les altres s'oculten |
| if ( $( navChild ).hasClass( 'NavContent' ) ) {
| | var vMcNom = this.id.substr(0, 3); // A partir del nom del botó, deduïm el nom de la caixa |
| navChild.style.display = 'none';
| | var vIndex = this.id.substr(5, 1); // I l'index |
| }
| | var i = 1; |
| }
| | for (i = 1; i <= 9; i++) { // busquem totes les pestanyes d'aquella caixa |
| navToggle.firstChild.data = navigationBarShow;
| | //alert(vMcNom+"ps"+i); |
|
| | var vPsElem = document.getElementById(vMcNom + "ps" + i); |
| // If hidden now
| | if (!vPsElem) break; |
| } else if ( navToggle.firstChild.data === navigationBarShow ) {
| | if (vIndex == i) { // Si és la pestanya bona la mostrem i canviem la classe de botó |
| for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {
| | vPsElem.style.display = "block"; |
| if ( $( navChild ).hasClass( 'NavContent' ) ) {
| | vPsElem.style.visibility = "visible"; |
| navChild.style.display = 'block';
| | document.getElementById(vMcNom + "bt" + i).className = "mcBotoSel"; |
| }
| | } else { // Sinó, l'ocultem i canviem la classe de botó |
| }
| | vPsElem.style.display = "none"; |
| navToggle.firstChild.data = navigationBarHide;
| | vPsElem.style.visibility = "hidden"; |
| }
| | document.getElementById(vMcNom + "bt" + i).className = "mcBoto"; |
| | } |
| | } |
| | return false; // evitem la recàrrega de la pàgina |
| | } |
| | $(MetaCaixaInit); |
|
| |
|
| event.preventDefault();
| | /* 智能讨论页编辑(新建) */ |
| } | | $(function () { |
| | var catalk = $('#ca-talk'); |
| | if (catalk.hasClass('new') && mw.config.get('wgNamespaceNumber') != 2) { |
| | var a = $('a:first', catalk); |
| | a.attr('href', a.attr('href') + '§ion=new'); |
| | } |
| | }); |
|
| |
|
| /** | | /** |
| * Adds show/hide-button to navigation bars. | | * Magic editintros **************************************************** |
| * | | * |
| * @param {jQuery} $content | | * Description: Adds editintros on disambiguation pages, BLP pages, policy pages and guidlines. |
| | * Maintainers: [[User:RockMFR]] |
| */ | | */ |
| function createNavigationBarToggleButton( $content ) { | | function addEditIntro( name ) { |
| var i, j, navChild, navToggle, navToggleText, isCollapsed,
| | $( '.mw-editsection, #ca-edit' ).find( 'a' ).each( function ( i, el ) { |
| indexNavigationBar = 0;
| | el.href = $( this ).attr( 'href' ) + '&editintro=' + name; |
| // Iterate over all < div >-elements
| | } ); |
| var $divs = $content.find( 'div.NavFrame:not(.mw-collapsible)' );
| | } |
| $divs.each( function ( i, navFrame ) {
| |
| indexNavigationBar++;
| |
| navToggle = document.createElement( 'a' );
| |
| navToggle.className = 'NavToggle';
| |
| navToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
| |
| navToggle.setAttribute( 'href', '#' );
| |
| $( navToggle ).on( 'click', $.proxy( toggleNavigationBar, null, indexNavigationBar ) );
| |
|
| |
|
| isCollapsed = $( navFrame ).hasClass( 'collapsed' );
| | if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) { |
| /**
| | $( function () { |
| * Check if any children are already hidden. This loop is here for backwards compatibility:
| | if ( document.getElementById( 'disambigbox' ) ) { |
| * the old way of making NavFrames start out collapsed was to manually add style="display:none"
| | addEditIntro( 'Template:Disambig_editintro' ); |
| * to all the NavPic/NavContent elements. Since this was bad for accessibility (no way to make
| | } |
| * the content visible without JavaScript support), the new recommended way is to add the class
| | } ); |
| * "collapsed" to the NavFrame itself, just like with collapsible tables.
| |
| */
| |
| for ( navChild = navFrame.firstChild; navChild !== null && !isCollapsed; navChild = navChild.nextSibling ) {
| |
| if ( $( navChild ).hasClass( 'NavPic' ) || $( navChild ).hasClass( 'NavContent' ) ) {
| |
| if ( navChild.style.display === 'none' ) {
| |
| isCollapsed = true;
| |
| }
| |
| }
| |
| }
| |
| if ( isCollapsed ) {
| |
| for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) {
| |
| if ( $( navChild ).hasClass( 'NavPic' ) || $( navChild ).hasClass( 'NavContent' ) ) {
| |
| navChild.style.display = 'none';
| |
| }
| |
| }
| |
| }
| |
| navToggleText = document.createTextNode( isCollapsed ? navigationBarShow : navigationBarHide );
| |
| navToggle.appendChild( navToggleText );
| |
|
| |
|
| // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
| | $( function () { |
| for ( j = 0; j < navFrame.childNodes.length; j++ ) {
| | var cats = mw.config.get('wgCategories'); |
| if ( $( navFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
| | if ( !cats ) { |
| navToggle.style.color = navFrame.childNodes[j].style.color;
| | return; |
| navFrame.childNodes[j].appendChild( navToggle );
| | } |
| }
| | if ( $.inArray( '在世人物', cats ) !== -1 ) { |
| }
| | addEditIntro( 'Template:BLP_editintro' ); |
| navFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
| | } |
| } );
| | } ); |
| | } else if ( mw.config.get( 'wgNamespaceNumber' ) === 4 ) { |
| | $( function () { |
| | var cats = mw.config.get('wgCategories'); |
| | if ( !cats ) { |
| | return; |
| | } |
| | if ( $.inArray( '维基百科方针', cats ) !== -1 || |
| | $.inArray( '维基百科指引', cats ) !== -1 || |
| | $.inArray( ' 维基百科方针与指引', cats ) !== -1) { |
| | addEditIntro( 'Template:Policy editintro' ); |
| | } |
| | } ); |
| } | | } |
|
| |
|
| mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );
| | /* 引用錯誤標籤名字解碼 */ |
| | $(function () { |
| | $('.anchordecodeme').each(function () { |
| | $(this).text(decodeURIComponent($(this).text().replace(/\.([0-9A-F]{2})/g, '%$1'))); |
| | }); |
| | }); |
|
| |
|
| | /** &withCSS= and &withJS= URL parameters |
| | * Allow to try custom scripts from MediaWiki space |
| | * without editing personal .css or .js files |
| | */ |
| /** | | /** |
| * Magic editintros **************************************************** | | * @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL |
| *
| | * @rev 6 |
| * Description: Adds editintros on disambiguation pages and BLP pages.
| |
| * Maintainers: [[User:RockMFR]] | |
| */ | | */ |
| function addEditIntro( name ) {
| | var extraCSS = mw.util.getParamValue( 'withCSS' ), |
| $( '.mw-editsection, #ca-edit, #ca-ve-edit' ).find( 'a' ).each( function ( i, el ) {
| | extraJS = mw.util.getParamValue( 'withJS' ); |
| el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
| | |
| } );
| | if ( extraCSS ) { |
| | if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) { |
| | importStylesheet( extraCSS ); |
| | } else { |
| | mw.notify( ' 只允许从MediaWiki名字空间加载。', { title: ' 无效的withCSS值' } ); |
| | } |
| | } |
| | |
| | if ( extraJS ) { |
| | if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) { |
| | importScript( extraJS ); |
| | } else { |
| | mw.notify( ' 只允许从MediaWiki名字空间加载。', { title: ' 无效的withJS值' } ); |
| | } |
| } | | } |
|
| |
|
| if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
| |
| $( function () {
| |
| if ( document.getElementById( 'disambigbox' ) ) {
| |
| addEditIntro( 'Template:Disambig_editintro' );
| |
| }
| |
| } );
| |
|
| |
|
| $( function () {
| | /* 页面历史加&hilight=高亮 */ |
| var cats = mw.config.get('wgCategories');
| | { |
| if ( !cats ) {
| | var hilight = mw.util.getParamValue('hilight'); |
| return;
| | if (mw.config.get('wgAction') === 'history' && hilight) { |
| }
| | $.each(hilight.split(','), function (_, v) { |
| if ( $.inArray( 'Living people', cats ) !== -1 || $.inArray( 'Possibly living people', cats ) !== -1 ) {
| | $('input[name=oldid][value=' + v + ']').parent().addClass('not-patrolled'); |
| addEditIntro( 'Template:BLP_editintro' );
| | }); |
| }
| | } |
| } );
| | } |
| } | |
|
| |
|
| /* Actions specific to the edit page */ | | /* Main page hacks */ |
| if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' ) { | | if ( mw.config.get( 'wgIsMainPage' ) && mw.config.get( 'wgAction' ) == 'view' ) { |
| /**
| | /* 维基百科语言列表 */ |
| * Fix edit summary prompt for undo
| | $( function () { |
| *
| | mw.util.addPortletLink( |
| * Fixes the fact that the undo function combined with the "no edit summary prompter"
| | 'p-lang', |
| * complains about missing editsummary, if leaving the edit summary unchanged.
| | mw.util.getUrl( 'Wikipedia:维基百科语言列表' ), |
| * Added by [[User:Deskana]], code by [[User:Tra]].
| | wgULS( ' 维基百科语言列表', '維基百科語言列表' ), |
| * See also [[phab:T10912]].
| | 'interwiki-completelist', |
| */
| | wgULS( ' 维基百科的完整各语言列表', '維基百科的完整各語言列表' ) |
| $(function () {
| | ); |
| if (document.location.search.indexOf('undo=') !== -1 && document.getElementsByName('wpAutoSummary')[0]) {
| | } ); |
| document.getElementsByName('wpAutoSummary')[0].value = '1';
| | /* Remove red links */ |
| }
| | $( '#mw-content-text a.new' ).contents().unwrap(); |
| });
| | } |
| } | | })(jQuery, mediaWiki); |
| | }); |
|
| |
|
| /* End of mw.loader.using callback */ | | /* Check for any client-side simplified/traditional Chinese conversion */ |
| } );
| | /* This routine must be placed here to make sure the field is inserted in time */ |
| /* DO NOT ADD CODE BELOW THIS LINE */ | | $('#antispam-container').append( |
| | $('<input type="text" />').attr({ |
| | id: 'wpAntiConv', |
| | value: '\u6c49\u6f22' |
| | }) |
| | ); |