미디어위키:Common.js: 두 판 사이의 차이
(아카디아 포럼 버튼 - 헤더 직접 주입 (모바일 가시성)) |
(로고 워드마크 "아카디아 위키"로 변경 + 포럼 버튼 위치 조정) |
||
| 1번째 줄: | 1번째 줄: | ||
/* 아카디아 위키 - 사용자 정의 JS */ | /* 아카디아 위키 - 사용자 정의 JS */ | ||
/* 로고 워드마크 텍스트 변경 */ | |||
(function() { | |||
function applyLogo() { | |||
var $wm = $('.mw-logo-wordmark'); | |||
if ($wm.length && $wm.text().indexOf('위키') === -1) { | |||
$wm.text('아카디아 위키'); | |||
} | |||
} | |||
if (window.jQuery) { | |||
jQuery(function() { applyLogo(); }); | |||
} | |||
// Also try once immediately in case DOM is already ready | |||
if (document.readyState !== 'loading') { | |||
var wm = document.querySelector('.mw-logo-wordmark'); | |||
if (wm && wm.textContent.indexOf('위키') === -1) wm.textContent = '아카디아 위키'; | |||
} else { | |||
document.addEventListener('DOMContentLoaded', function() { | |||
var wm = document.querySelector('.mw-logo-wordmark'); | |||
if (wm && wm.textContent.indexOf('위키') === -1) wm.textContent = '아카디아 위키'; | |||
}); | |||
} | |||
})(); | |||
/* 아카디아 포럼 - 헤더 알약 탭 삽입 */ | /* 아카디아 포럼 - 헤더 알약 탭 삽입 */ | ||
2026년 5월 12일 (화) 08:43 판
/* 아카디아 위키 - 사용자 정의 JS */
/* 로고 워드마크 텍스트 변경 */
(function() {
function applyLogo() {
var $wm = $('.mw-logo-wordmark');
if ($wm.length && $wm.text().indexOf('위키') === -1) {
$wm.text('아카디아 위키');
}
}
if (window.jQuery) {
jQuery(function() { applyLogo(); });
}
// Also try once immediately in case DOM is already ready
if (document.readyState !== 'loading') {
var wm = document.querySelector('.mw-logo-wordmark');
if (wm && wm.textContent.indexOf('위키') === -1) wm.textContent = '아카디아 위키';
} else {
document.addEventListener('DOMContentLoaded', function() {
var wm = document.querySelector('.mw-logo-wordmark');
if (wm && wm.textContent.indexOf('위키') === -1) wm.textContent = '아카디아 위키';
});
}
})();
/* 아카디아 포럼 - 헤더 알약 탭 삽입 */
$(function() {
if ($('.akadia-portal-links').length) return;
var $portal = $('<div class="akadia-portal-links"></div>');
$portal.append('<a href="https://forum.akadia.kr/" class="akadia-portal-link" title="아카디아 포럼">아카디아 포럼</a>');
var $header = $('header.mw-header, .mw-header').first();
if ($header.length) {
$header.append($portal);
} else {
var $userLinks = $('.vector-user-links').first();
if ($userLinks.length) { $userLinks.before($portal); }
else { $('#p-personal').before($portal); }
}
});
/* 모바일 viewport 대응 */
(function() {
var screenW = window.screen && window.screen.width;
if (screenW && screenW <= 720) {
var meta = document.querySelector('meta[name="viewport"]');
var content = 'width=device-width, initial-scale=1, shrink-to-fit=no';
if (meta) {
meta.setAttribute('content', content);
} else {
meta = document.createElement('meta');
meta.setAttribute('name', 'viewport');
meta.setAttribute('content', content);
document.head.appendChild(meta);
}
}
})();
/* 외부 링크 새 탭 열기 */
mw.hook('wikipage.content').add(function($content) {
$content.find('a.external').not('[href^="#"]').not('.mw-editsection a').each(function() {
var $a = $(this);
if (!$a.attr('target')) {
$a.attr('target', '_blank').attr('rel', 'noopener noreferrer');
}
});
});