둘러보기 메뉴
검색
최근 바뀜
임의의 문서로
개인 도구
로그인하지 않음
토론
기여
계정 만들기
로그인
둘러보기
대문
최근 바뀜
임의의 문서로
읽기
대탈출위키 소개
의견 나누기
사랑방
도움 받기
질문방
문법
연습장
관리하기
관리 요청
이름공간
메시지
토론
미디어위키:Common.js 문서 원본 보기
TOOLBOX
여기를 가리키는 문서
가리키는 글의 최근 바뀜
문서 정보
더 보기
보기
보기
원본 보기
역사
←
미디어위키:Common.js
문서 편집 권한이 없습니다. 다음 이유를 확인해주세요:
이 문서는 대탈출위키의 소프트웨어 인터페이스에 쓰이는 문서로, 훼손을 막기 위해
보호
되어 있습니다.
편집 요청은
WIKI:관리자 요청
에서 해 주시고, 모든 위키에 대한 번역을 추가하거나 바꾸려면 미디어위키 지역화 프로젝트인
translatewiki.net
에 참여하시기 바랍니다.
모든 방문자에게 영향을 미칠 수 있기 때문에 이 자바스크립트 문서의 편집 권한이 없습니다.
문서의 원본을 보거나 복사할 수 있습니다.
/* 이 자바스크립트 설정은 모든 문서, 모든 사용자에게 적용됩니다. 편집 요약과 본문에 무슨 문서인지를 주석으로 남겨주세요. */ mw.loader.using( ['mediawiki.user', 'mediawiki.util'] ).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 ) { 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' ); } } } /** * Map addPortletLink to mw.util * @deprecated: Use mw.util.addPortletLink instead. */ mw.log.deprecate( window, 'addPortletLink', mw.util.addPortletLink, 'Use mw.util.addPortletLink 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$/ ) ) { mw.loader.load( '//ko.wikipedia.org/w/index.php?title=' + extraCSS + '&action=raw&ctype=text/css', 'text/css' ); } else { mw.notify( '미디어위키 이름공간의 문서만 허용됩니다.', { title: '유효하지 않은 withCSS 값' } ); } } if ( extraJS ) { if ( extraJS.match( /^(MediaWiki|미디어위키):[^&<>=%#]*\.js$/ ) ) { mw.loader.load( '//ko.wikipedia.org/w/index.php?title=' + extraJS + '&action=raw&ctype=text/javascript' ); } else { mw.notify( '미디어위키 이름공간의 문서만 허용됩니다.', { title: '유효하지 않은 withJS 값' } ); } } $( 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' ); } } ); function makeCollapsibleMwCollapsible( $content ) { var $tables = $content .find( 'table.collapsible:not(.mw-collapsible)' ) .addClass( 'mw-collapsible' ); $.each( $tables, function( index, table ) { // mw.log.warn( '이 문서는 구식 클래스 collapsible을 사용하고 있습니다. mw-collapsible로 변경해 주십시오.'); if( $( table ).hasClass( 'collapsed') ) { $( table ).addClass( 'mw-collapsed' ); // mw.log.warn( '이 문서는 구식 클래스 collapsed를 사용하고 있습니다. mw-collapsed로 변경해 주십시오.'); } } ); if( $tables.length > 0 ) { mw.loader.using( 'jquery.makeCollapsible' ).then( function() { $tables.makeCollapsible(); } ); } } mw.hook( 'wikipage.content' ).add( makeCollapsibleMwCollapsible ); /** * 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 ); /** * Dynamic Navigation Bars (experimental) * * Description: See [[Wikipedia:NavFrame]]. * Maintainers: UNMAINTAINED */ var collapseCaption = '숨기기'; var expandCaption = '보이기'; // Set up the words in your language var navigationBarHide = '[' + collapseCaption + ']'; var navigationBarShow = '[' + expandCaption + ']'; /** * 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 ) { return false; } // If shown now if ( navToggle.firstChild.data === navigationBarHide ) { for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) { if ( $( navChild ).hasClass( 'NavContent' ) ) { navChild.style.display = 'none'; } } navToggle.firstChild.data = navigationBarShow; // If hidden now } else if ( navToggle.firstChild.data === navigationBarShow ) { for ( navChild = navFrame.firstChild; navChild !== null; navChild = navChild.nextSibling ) { if ( $( navChild ).hasClass( 'NavContent' ) ) { navChild.style.display = 'block'; } } navToggle.firstChild.data = navigationBarHide; } event.preventDefault(); } /** * Adds show/hide-button to navigation bars. * * @param {jQuery} $content */ function createNavigationBarToggleButton( $content ) { var i, j, navChild, navToggle, navToggleText, isCollapsed, indexNavigationBar = 0; // 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' ); /** * Check if any children are already hidden. This loop is here for backwards compatibility: * the old way of making NavFrames start out collapsed was to manually add style="display:none" * 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) for ( j = 0; j < navFrame.childNodes.length; j++ ) { if ( $( navFrame.childNodes[j] ).hasClass( 'NavHead' ) ) { navToggle.style.color = navFrame.childNodes[j].style.color; navFrame.childNodes[j].appendChild( navToggle ); } } navFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar ); } ); } mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );
미디어위키:Common.js
문서로 돌아갑니다.