미디어위키:Common.js: 두 판 사이의 차이

639 바이트 추가됨 ,  2026년 5월 12일 (화)
아카디아 게시판 -> 아카디아 포럼 명칭 변경, 모바일 viewport 대응 추가
(본문 하이퍼링크를 새 탭에서 열기 (mw.hook wikipage.content))
(아카디아 게시판 -> 아카디아 포럼 명칭 변경, 모바일 viewport 대응 추가)
1번째 줄: 1번째 줄:
/* 아카디아 포털 — 우측 상단 알약 탭 삽입 */
/* 아카디아 포럼 - 우측 상단 알약 탭 삽입 */
$(function() {
$(function() {
     if ($('.akadia-portal-links').length) return;
     if ($('.akadia-portal-links').length) return;
     var $portal = $('<div class="akadia-portal-links"></div>');
     var $portal = $('<div class="akadia-portal-links"></div>');
     $portal.append('<a href="https://forum.akadia.kr/" class="akadia-portal-link" title="아카디아 게시판">아카디아 게시판</a>');
     $portal.append('<a href="https://forum.akadia.kr/" class="akadia-portal-link" title="아카디아 포럼">아카디아 포럼</a>');
     var $target = $('.vector-user-links').first();
     var $target = $('.vector-user-links').first();
     if ($target.length) { $target.before($portal); } else { $('#p-personal').before($portal); }
     if ($target.length) { $target.before($portal); } else { $('#p-personal').before($portal); }
});
});


/* 본문 하이퍼링크를 새 탭에서 열기 */
/* 모바일 viewport 대응: 기본 viewport가 width=1000으로 고정되어 있어 디바이스 폭에 맞게 재설정 */
(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.name = 'viewport';
            meta.content = content;
            document.head.appendChild(meta);
        }
    }
})();
 
/* 본문 하이퍼링크를 새 탭으로 열기 */
mw.hook('wikipage.content').add(function ($content) {
mw.hook('wikipage.content').add(function ($content) {
     $content.find('a').each(function () {
     $content.find('a').each(function () {