편집 요약 없음 태그: 수동 되돌리기 되돌려진 기여 |
편집 요약 없음 |
||
(같은 사용자의 중간 판 11개는 보이지 않습니다) | |||
5번째 줄: | 5번째 줄: | ||
* 스크립트를 넣을 때는 충분한 설명, 출처를 넣어주세요! 이후 관리가 어려워집니다. | * 스크립트를 넣을 때는 충분한 설명, 출처를 넣어주세요! 이후 관리가 어려워집니다. | ||
**/ | **/ | ||
mw.loader.using( ['mediawiki.util', 'mediawiki.notify', 'jquery.client'], function () { | mw.loader.using( ['mediawiki.util', 'mediawiki.notify', 'jquery.client'], function () { | ||
385번째 줄: | 349번째 줄: | ||
* | * | ||
*/ | */ | ||
function wikilink1() { | |||
location.href='https://jwiki.kr/wiki/index.php/철통같은_믿음으로'; | |||
} | |||
/* End of mw.loader.using callback */ | |||
} ); | |||
$(document).ready(function () { | $(document).ready(function () { | ||
function getExactScrollHeight(el) { | /* ---------- helper for sub-pixel scroll height ---------- */ | ||
/* ---------- helper for sub-pixel scroll height (accurate & shift-free) ---------- */ | |||
function getExactScrollHeight(el) { | |||
/* 1 — snapshot the current inline width so the clone wraps exactly the same */ | |||
const liveRect = el.getBoundingClientRect(); // fractional width! | |||
const liveW = liveRect.width + "px"; | |||
/* 2 — make a deep clone and neutralise its layout impact */ | |||
const clone = el.cloneNode(true); | |||
Object.assign(clone.style, { | |||
position : "absolute", // out of normal flow | |||
left : "-9999px", // off-screen (but in the DOM) | |||
top : "0", | |||
width : liveW, // lock wrapping width | |||
height : "auto", | |||
overflow : "visible", | |||
visibility : "hidden", | |||
pointerEvents : "none", | |||
transition : "none" | |||
}); | |||
/* 3 — measure, then discard */ | |||
el.parentNode.appendChild(clone); // within same ancestor → exact CSS context | |||
const h = clone.getBoundingClientRect().height; // accurate, fractional OK | |||
clone.remove(); | |||
return h; // sub-pixel-precise | |||
} | |||
/* -------------------------------------------------------- */ | |||
$('.toggleBtn').click(function () { | $('.toggleBtn').click(function () { | ||
411번째 줄: | 397번째 줄: | ||
var targetId = $button.data('target'); | var targetId = $button.data('target'); | ||
var growDiv = document.getElementById(targetId); | var growDiv = document.getElementById(targetId); | ||
var $growDiv = $('#' + targetId); | var $growDiv = $('#' + targetId); | ||
421번째 줄: | 407번째 줄: | ||
if (growDiv.clientHeight) { | if (growDiv.clientHeight) { | ||
/* ---------- COLLAPSE ---------- */ | |||
growDiv.style.height = 0; | growDiv.style.height = 0; | ||
var heightDifference = 0 - oldHeight - paddingAndBorder; | |||
} else { | } else { | ||
/* ---------- EXPAND ---------- */ | |||
const exactScrollHeight = getExactScrollHeight(growDiv); | const exactScrollHeight = getExactScrollHeight(growDiv); | ||
if ($growDiv.hasClass('textcollapsible')) { | if ($growDiv.hasClass('textcollapsible')) { | ||
growDiv.style.height = (exactScrollHeight + 6) + "px"; | growDiv.style.height = (exactScrollHeight + 6) + "px"; | ||
} else { | } else { | ||
growDiv.style.height = (exactScrollHeight + 6.5) + "px"; | growDiv.style.height = (exactScrollHeight + 6.5) + "px"; | ||
} | } | ||
var heightDifference = exactScrollHeight - oldHeight - paddingAndBorder; | |||
} | |||
if ($growDiv.hasClass('textcollapsible') && !$growDiv.hasClass('collapsed')) { | |||
heightDifference += 6; | |||
} else if (!$growDiv.hasClass('textcollapsible') && !$growDiv.hasClass('collapsed')) { | |||
heightDifference += 6.5; | |||
} | } | ||
console.log(heightDifference); | |||
animateParentHeights(growDiv, heightDifference); | |||
setTimeout(() => $button.data('animating', false), 300); | setTimeout(() => $button.data('animating', false), 300); | ||
}); | }); | ||
function animateParentHeights(element, difference) { | |||
var parent = element.parentElement.closest('.collapsible'); | |||
while (parent) { | |||
var intervalId = setInterval(() => { | |||
const p = element.parentElement.closest('.collapsible'); | |||
while ( | p.style.height = getExactScrollHeight(p) + 5 + 'px'; // float | ||
}, 30); | |||
setTimeout(() => { | |||
clearInterval(intervalId); | |||
const p = element.parentElement.closest('.collapsible'); | |||
p.style.animation = ''; | |||
p.style.height = getExactScrollHeight(p) + 5 + 'px'; // float | |||
}, 310); | |||
parent = parent.parentElement.closest('.collapsible'); | |||
} | |||
} | |||
} | } | ||
}); | }); | ||
528번째 줄: | 510번째 줄: | ||
} | } | ||
} | } | ||
const head = document.head; | |||
const link3 = document.createElement('link'); | |||
link3.rel = 'stylesheet'; | |||
link3.href = 'https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+JP:wght@100;200;300;400;500;600;700&display=swap'; | |||
head.appendChild(link3); | |||
// Call the function | // Call the function | ||
updateBackgroundColor(); | updateBackgroundColor(); | ||
/* DO NOT ADD CODE BELOW THIS LINE */ | /* DO NOT ADD CODE BELOW THIS LINE */ |
2025년 6월 14일 (토) 20:13 기준 최신판
/**
* 이 스크립트는 위키백과 전체에 적용됩니다. 고칠 때는 주의해주세요.
* [[위키백과:위키프로젝트 시스템]] 참고
*
* 스크립트를 넣을 때는 충분한 설명, 출처를 넣어주세요! 이후 관리가 어려워집니다.
**/
mw.loader.using( ['mediawiki.util', 'mediawiki.notify', 'jquery.client'], function () {
/* Begin of mw.loader.using callback */
/**
* 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 ) {
return $( element ).hasClass( className );
}, 'Use jQuery.hasClass() instead' );
/**
* @source www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
* @rev 5
*/
// CSS
var extraCSS = mw.util.getParamValue( 'withCSS' );
if ( extraCSS ) {
if ( extraCSS.match( /^MediaWiki:[^&<>=%#]*\.css$/ ) ) {
importStylesheet( extraCSS );
} else {
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withCSS value' } );
}
}
// JS
var extraJS = mw.util.getParamValue( 'withJS' );
if ( extraJS ) {
if ( extraJS.match( /^MediaWiki:[^&<>=%#]*\.js$/ ) ) {
importScript( extraJS );
} else {
mw.notify( 'Only pages from the MediaWiki namespace are allowed.', { title: 'Invalid withJS value' } );
}
}
/**
* Import more specific scripts if necessary
*/
if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) {
/* file description page scripts */
importScript( 'MediaWiki:Common.js/file.js' );
}
/* ([[위키백과:관리자 요청/2007년 5월#스크립트 추가 요청]]) */
/** Collapsible tables *********************************************************
*
* Description: Allows tables to be collapsed, showing only the header. See
* [[:en:Wikipedia:NavFrame]].
* Maintainers: [[:en:User:R. Koot]]
*/
var autoCollapse = 2;
var collapseCaption = '숨기기';
var expandCaption = '보이기';
window.collapseTable = function ( tableIndex ) {
var Button = document.getElementById( 'collapseButton' + tableIndex );
var Table = document.getElementById( 'collapsibleTable' + tableIndex );
if ( !Table || !Button ) {
return false;
}
var Rows = Table.rows;
var i;
if ( Button.firstChild.data === collapseCaption ) {
for ( i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = 'none';
}
Button.firstChild.data = expandCaption;
} else {
for ( 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 = {};
var Tables = document.getElementsByTagName( 'table' );
var i;
function handleButtonLink( index, e ) {
window.collapseTable( index );
e.preventDefault();
}
for ( 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.className = 'collapseButton'; /* Styles are declared in Common.css */
ButtonLink.style.color = Header.style.color;
ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
ButtonLink.setAttribute( 'href', '#' );
$( ButtonLink ).on( 'click', $.proxy( handleButtonLink, ButtonLink, 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++ ) {
if ( $( NavigationBoxes[i] ).hasClass( 'collapsed' ) || ( tableIndex >= autoCollapse && $( NavigationBoxes[i] ).hasClass( 'autocollapse' ) ) ) {
window.collapseTable( i );
}
else if ( $( NavigationBoxes[i] ).hasClass ( 'innercollapse' ) ) {
var element = NavigationBoxes[i];
while ((element = element.parentNode)) {
if ( $( element ).hasClass( 'outercollapse' ) ) {
window.collapseTable ( i );
break;
}
}
}
}
}
mw.hook( 'wikipage.content' ).add( createCollapseButtons );
/* ([[위키백과:관리자 요청/2007년 5월#스크립트 추가 요청]]) */
/** Dynamic Navigation Bars (experimental) *************************************
*
* Description: See [[:en:Wikipedia:NavFrame]].
* Maintainers: UNMAINTAINED
*/
// set up the words in your language
/* set up the words in your language */
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';
/**
* 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 ) {
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 ).hasClass( 'NavPic' ) ) {
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 ).hasClass( 'NavPic' ) ) {
NavChild.style.display = 'block';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
event.preventDefault();
};
/* adds show/hide-button to navigation bars */
function createNavigationBarToggleButton() {
var indexNavigationBar = 0;
var NavFrame;
var NavChild;
/* 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', '#' );
$( NavToggle ).on( 'click', $.proxy( window.toggleNavigationBar, window, indexNavigationBar ) );
var 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';
}
}
}
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++ ) {
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 );
/***** 그림 정보 틀을 자동으로 불러옴 ********
* Adds a link to subpages of current page
* from commons.wikimedia.org
* Maintainers: [[User:Yonidebest]], [[User:Dschwen]]
* [[사용자:Kwj2772]]가 수정
* JSconfig items: bool 'loadAutoInformationTemplate'
* (true=enabled (default), false=disabled)
* JSConfig를 사용하지 않도록 수정함. --[[사용자:Klutzy|klutzy]] ([[사용자토론:Klutzy|토론]]) 2009년 9월 27일 (일) 20:33 (KST)
****/
if (mw.config.get('wgCanonicalSpecialPageName') == 'Upload') {
importScript('MediaWiki:Upload.js');
}
/* 인터랙티브 지도. 영어 위키백과에서 가져옴. -- [[사용자:ChongDae]] 2010년 3월 28일 (일) 02:08 (KST) */
/**
* 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 () {
var require_wikiminiatlas = false;
var coord_filter = /geohack/;
$( function () {
$( 'a.external.text' ).each( function( key, link ) {
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' );
}
} );
} )();
/**
* Fix for Windows XP Unicode font rendering
*/
if ( navigator.appVersion.search(/windows nt 5/i) !== -1 ) {
mw.util.addCSS( '.IPA { font-family: "Lucida Sans Unicode", "Arial Unicode MS"; } ' +
'.Unicode { font-family: "Arial Unicode MS", "Lucida Sans Unicode"; } ' );
}
/**
* 편집 안내 ****************************************************
*
* 생존 인물에 대한 편집 안내. 영어 위키백과에서 가져옴 - ChongDae
* Maintainers: [[User:RockMFR]]
*/
function addEditIntro( name ) {
$( '.mw-editsection, #ca-edit' ).find( 'a' ).each( function ( i, el ) {
el.href = $( this ).attr( 'href' ) + '&editintro=' + name;
} );
}
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
$( function () {
var cats = mw.config.get('wgCategories');
if ( !cats ) {
return;
}
if ( $.inArray( '살아있는 사람', cats ) !== -1 || $.inArray( '생사 불명', cats ) !== -1 ) {
addEditIntro( '틀:BLP_편집_안내' );
}
} );
}
/**
*
*
*
*/
function wikilink1() {
location.href='https://jwiki.kr/wiki/index.php/철통같은_믿음으로';
}
/* End of mw.loader.using callback */
} );
$(document).ready(function () {
/* ---------- helper for sub-pixel scroll height ---------- */
/* ---------- helper for sub-pixel scroll height (accurate & shift-free) ---------- */
function getExactScrollHeight(el) {
/* 1 — snapshot the current inline width so the clone wraps exactly the same */
const liveRect = el.getBoundingClientRect(); // fractional width!
const liveW = liveRect.width + "px";
/* 2 — make a deep clone and neutralise its layout impact */
const clone = el.cloneNode(true);
Object.assign(clone.style, {
position : "absolute", // out of normal flow
left : "-9999px", // off-screen (but in the DOM)
top : "0",
width : liveW, // lock wrapping width
height : "auto",
overflow : "visible",
visibility : "hidden",
pointerEvents : "none",
transition : "none"
});
/* 3 — measure, then discard */
el.parentNode.appendChild(clone); // within same ancestor → exact CSS context
const h = clone.getBoundingClientRect().height; // accurate, fractional OK
clone.remove();
return h; // sub-pixel-precise
}
/* -------------------------------------------------------- */
$('.toggleBtn').click(function () {
var $button = $(this);
if ($button.data('animating')) return;
$button.data('animating', true);
var targetId = $button.data('target');
var growDiv = document.getElementById(targetId);
var $growDiv = $('#' + targetId);
const cs = window.getComputedStyle(growDiv);
var oldHeight = growDiv.getBoundingClientRect().height;
var paddingAndBorder = parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom);
$growDiv.toggleClass('collapsed');
if (growDiv.clientHeight) {
/* ---------- COLLAPSE ---------- */
growDiv.style.height = 0;
var heightDifference = 0 - oldHeight - paddingAndBorder;
} else {
/* ---------- EXPAND ---------- */
const exactScrollHeight = getExactScrollHeight(growDiv);
if ($growDiv.hasClass('textcollapsible')) {
growDiv.style.height = (exactScrollHeight + 6) + "px";
} else {
growDiv.style.height = (exactScrollHeight + 6.5) + "px";
}
var heightDifference = exactScrollHeight - oldHeight - paddingAndBorder;
}
if ($growDiv.hasClass('textcollapsible') && !$growDiv.hasClass('collapsed')) {
heightDifference += 6;
} else if (!$growDiv.hasClass('textcollapsible') && !$growDiv.hasClass('collapsed')) {
heightDifference += 6.5;
}
console.log(heightDifference);
animateParentHeights(growDiv, heightDifference);
setTimeout(() => $button.data('animating', false), 300);
});
function animateParentHeights(element, difference) {
var parent = element.parentElement.closest('.collapsible');
while (parent) {
var intervalId = setInterval(() => {
const p = element.parentElement.closest('.collapsible');
p.style.height = getExactScrollHeight(p) + 5 + 'px'; // float
}, 30);
setTimeout(() => {
clearInterval(intervalId);
const p = element.parentElement.closest('.collapsible');
p.style.animation = '';
p.style.height = getExactScrollHeight(p) + 5 + 'px'; // float
}, 310);
parent = parent.parentElement.closest('.collapsible');
}
}
});
const gemstoneColors = {
"흙": "#4b4b4b", // Coal - Dark gray
"구리": "#c68346", // Copper - Reddish-brown
"청동": "#547865", // Bronze - Warm brown
"은": "#c0c0c0", // Silver - Metallic silver
"금": "#efbf04", // Gold - Golden yellow
"자수정": "#9966cc", // Amethyst - Purple
"터키석": "#069e80", // Turquoise - Light blue
"가넷": "#9b111e", // Garnet - Deep red
"토파즈": "#f0a641", // Topaz - Golden orange
"페리도트": "#81b11f", // Peridot - Light green
"에메랄드 I": "#39b647", // Emerald - Bright green
"에메랄드 II": "#39b647",// Emerald - Bright green (variant)
"에메랄드 III": "#39b647",// Emerald - Bright green (variant)
"사파이어 I": "#0f52ba", // Sapphire - Rich blue
"사파이어 II": "#0f52ba",// Sapphire - Rich blue (variant)
"사파이어 III": "#0f52ba",// Sapphire - Rich blue (variant)
"루비 I": "#e0115f", // Ruby - Vivid red
"루비 II": "#e0115f", // Ruby - Vivid red (variant)
"루비 III": "#e0115f", // Ruby - Vivid red (variant)
"다이아몬드 I": "#b9fcff", // Diamond - Pale blue/white
"다이아몬드 II": "#b9fcff",// Diamond - Pale blue/white (variant)
"다이아몬드 III": "#b9fcff"
};
// Function to update background color
function updateBackgroundColor() {
const element = document.getElementById("honorific-level");
const leveler = document.getElementById("points-level");
const childElement = leveler.firstElementChild; // Access the first child of leveler
const text = element.textContent.trim().replace(/[()]/g, ""); // Remove parentheses
// Check if the text matches specific diamond levels and update the child element color
if (text === "다이아몬드 I" || text === "다이아몬드 II" || text === "다이아몬드 III") {
leveler.style.background = gemstoneColors[text] || "transparent";
leveler.style.borderColor = "#22636652";
if (childElement) {
childElement.style.color = "#226366cc"; // Set the child element's text color to red
}
} else if (gemstoneColors[text]) {
leveler.style.background = gemstoneColors[text];
leveler.style.borderColor = gemstoneColors[text] + "52";
if (childElement) {
childElement.style.color = ""; // Reset child element's text color
}
} else {
leveler.style.background = "transparent"; // Default if no match
leveler.style.borderColor = "";
if (childElement) {
childElement.style.color = ""; // Reset child element's text color
}
}
}
const head = document.head;
const link3 = document.createElement('link');
link3.rel = 'stylesheet';
link3.href = 'https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+JP:wght@100;200;300;400;500;600;700&display=swap';
head.appendChild(link3);
// Call the function
updateBackgroundColor();
/* DO NOT ADD CODE BELOW THIS LINE */