|
/ * * * 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, $, importStylesheet, importScript */ / * jshint strict:false, browser:true */ mw.loader.using( ('mediawiki.util', 'mediawiki.notify', 'jquery.client' ) ).done( function () / * * * Redirect User:Name/skin.js and skin.css to the current skin's pages * (unless the 'skin' page really exists) * @source: http://www.mediawiki.org/wiki/Snippets/Redirect_skin.js * @rev: 2 */ if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) } } / * * * 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 * @deprecated: Use mw.util.getParamValue with proper escaping */ mw.log.deprecate( window, 'getURLParamValue', mw.util.getParamValue, 'Use mw.util.getParamValue instead' ); / * * * Test if an element has a certain class * @deprecated: Use $(element).hasClass() instead. */ mw.log.deprecate( window, 'hasClass', function ( element, 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 ( extraJS ) ); } } / * * * Import more specific scripts if necessary */ if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' || mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) else if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist' ) / * * * Fix for Windows XP Unicode font rendering */ if ( navigator.appVersion.search(/windows nt 5/i) !== -1 ) ' ); } / * * * Add (faux) userpage link and (real) talkpage and contributions links for anon users in personal toolbar. * TODO(?): Load system messages using mw.msg(), but requires API call first. */ function addAnonToolbarLinks() if ( mw.user.isAnon() ) / * * * 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 */ ( function () ); if ( $( 'div.kmldata' ).length ) if ( require_wikiminiatlas ) } ); } )(); / * * * Collapsible tables * * Allows tables to be collapsed, showing only the header. See Wikipedia:NavFrame. * * @version 2.0.3 (2014-03-14) * @source https://www.mediawiki.org/wiki/MediaWiki:Gadget-collapsibleTables.js * @author User:R. Koot * @author User:Krinkle * @deprecated Since MediaWiki 1.20: Use class="mw-collapsible" instead which * is supported in MediaWiki core. */ var autoCollapse = 2; var collapseCaption = 'hide'; var expandCaption = 'show'; var tableIndex = 0; function collapseTable( tableIndex ) Button.firstChild.data = expandCaption; } else } function createClickHandler( tableIndex ) function createCollapseButtons( $content ) var Header = table.getElementsByTagName( 'th' )(); if ( !Header ) NavigationBoxes(tableIndex ) = table; table.setAttribute( 'id', 'collapsibleTable' + tableIndex ); var Button = document.createElement( 'span' ); var ButtonLink = document.createElement( 'a' ); var ButtonText = document.createTextNode( collapseCaption ); // Styles are declared in MediaWiki:Common.css Button.className = 'collapseButton'; ButtonLink.style.color = Header.style.color; ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex ); ButtonLink.setAttribute( 'href', '#' ); $( ButtonLink ).on( 'click', createClickHandler( tableIndex ) ); ButtonLink.appendChild( ButtonText ); Button.appendChild( document.createTextNode( '() ); Button.appendChild( ButtonLink ); Button.appendChild( document.createTextNode( ' )' ) ); Header.insertBefore( Button, Header.firstChild ); tableIndex++; } } ); for ( i = 0; i < tableIndex; i++ ) } } } } mw.hook( 'wikipage.content' ).add( createCollapseButtons ); / * * * Dynamic Navigation Bars (experimental) * * Description: See Wikipedia:NavFrame. * Maintainers: UNMAINTAINED */ / * set up the words in your language */ var NavigationBarHide = '(+ collapseCaption + ' )'; var NavigationBarShow = '(+ expandCaption + ' )'; var indexNavigationBar = 0; / * * * Shows and hides content and picture (if available) of navigation bars * Parameters: * indexNavigationBar: the index of navigation bar to be toggled * */ window.toggleNavigationBar = function ( indexNavigationBar, event ) } NavToggle.firstChild.data = NavigationBarShow; / * if hidden now */ } else if ( NavToggle.firstChild.data === NavigationBarShow ) NavToggle.firstChild.data = NavigationBarHide; } event.preventDefault(); }; / * adds show/hide-button to navigation bars */ function createNavigationBarToggleButton( $content ) } if ( isCollapsed ) } var 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) */ for( var j = 0; j < NavFrame.childNodes.length; j++ ) NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar ); } } ); } mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton ); / * * * Uploadwizard_newusers * Switches in a message for non-autoconfirmed users at Wikipedia:Upload * * Maintainers: User:Krimpet */ function uploadwizard_newusers() } oldDiv.style.display = 'none'; newDiv.style.display = 'block'; return; } } } $(uploadwizard_newusers); / * * * Magic editintros * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Description: Adds editintros on disambiguation pages and BLP pages. * Maintainers: User:RockMFR */ function addEditIntro( name ) if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) ); $( function () } ); } / * End of mw.loader.using callback */ } ); / * DO NOT ADD CODE BELOW THIS LINE */ 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「/** * 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, $, importStylesheet, importScript *//* jshint strict:false, browser:true */mw.loader.using( ('mediawiki.util', 'mediawiki.notify', 'jquery.client' ) ).done( function () /** * Redirect User:Name/skin.js and skin.css to the current skin's pages * (unless the 'skin' page really exists) * @source: http://www.mediawiki.org/wiki/Snippets/Redirect_skin.js * @rev: 2 */if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgNamespaceNumber' ) === 2 ) }}/** * 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 * @deprecated: Use mw.util.getParamValue with proper escaping */mw.log.deprecate( window, 'getURLParamValue', mw.util.getParamValue, 'Use mw.util.getParamValue instead' );/** * Test if an element has a certain class * @deprecated: Use $(element).hasClass() instead. */mw.log.deprecate( window, 'hasClass', function ( element, 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 ( extraJS ) ); }}/** * Import more specific scripts if necessary */if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' || mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) else if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist' ) /** * Fix for Windows XP Unicode font rendering */if ( navigator.appVersion.search(/windows nt 5/i) !== -1 ) ' );}/** * Add (faux) userpage link and (real) talkpage and contributions links for anon users in personal toolbar. * TODO(?): Load system messages using mw.msg(), but requires API call first. */function addAnonToolbarLinks() if ( mw.user.isAnon() ) /** * 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 */( function () ); if ( $( 'div.kmldata' ).length ) if ( require_wikiminiatlas ) } );} )();/** * Collapsible tables * * Allows tables to be collapsed, showing only the header. See Wikipedia:NavFrame. * * @version 2.0.3 (2014-03-14) * @source https://www.mediawiki.org/wiki/MediaWiki:Gadget-collapsibleTables.js * @author User:R. Koot * @author User:Krinkle * @deprecated Since MediaWiki 1.20: Use class="mw-collapsible" instead which * is supported in MediaWiki core. */var autoCollapse = 2;var collapseCaption = 'hide';var expandCaption = 'show';var tableIndex = 0;function collapseTable( tableIndex ) Button.firstChild.data = expandCaption; } else }function createClickHandler( tableIndex ) function createCollapseButtons( $content ) var Header = table.getElementsByTagName( 'th' )(); if ( !Header ) NavigationBoxes(tableIndex ) = table; table.setAttribute( 'id', 'collapsibleTable' + tableIndex ); var Button = document.createElement( 'span' ); var ButtonLink = document.createElement( 'a' ); var ButtonText = document.createTextNode( collapseCaption ); // Styles are declared in MediaWiki:Common.css Button.className = 'collapseButton'; ButtonLink.style.color = Header.style.color; ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex ); ButtonLink.setAttribute( 'href', '」の詳細全文を読む スポンサード リンク
|