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

편집 요약 없음
편집 요약 없음
318번째 줄: 318번째 줄:


// 데스크탑 언어
// 데스크탑 언어
var langDiv = document.getElementById('right-navigation');
$(document).ready(function () {
if(langDiv){
 
var navHTML = '<nav id="p-cactions" class="mw-portlet mw-portlet-cactions vector-menu-dropdown-noicon vector-menu vector-menu-dropdown" aria-labelledby="p-cactions-label" role="navigation">' +
    // 왼쪽 인터랭 리스트 가져오기
'<input type="checkbox" id="p-cactions-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-cactions" class="vector-menu-checkbox" aria-labelledby="p-cactions-label">' +
    const $interLangList = $('#p-lang .vector-menu-content-list');
'<label id="p-cactions-label" aria-label="" class="vector-menu-heading">' +
 
  '<span class="select-language"></span>' +
    if ($interLangList.length === 0) return;
  '<span class="vector-menu-heading-label">Language</span>' +
 
'</label>' +
    // 헤더 삽입 위치
'<div class="vector-menu-content">' +
    var langDiv = document.getElementById('right-navigation');
  '<ul class="vector-menu-content-list">' +
    if (!langDiv) return;
    '<li class="mw-list-item"><a href="https://watv.kr/en" title="Church of God Knowledge Encyclopedia"><span>English (영어)</span></a></li>' +
 
    '<li class="mw-list-item"><a href="https://watv.kr/es" title="ChurchEnciclopedia de conocimiento de la Iglesia de Dios"><span>Spanish</span></a></li>' +
    // 헤더 기본 틀 생성
    '<li class="mw-list-item"><a href="https://watv.kr/vi" title="Từ điển tri thức Hội Thánh của Đức Chúa Trời"><span>Vietnamese</span></a></li>' +
    var navHTML =
    '<li class="mw-list-item"><a href="https://watv.kr/ne" title="नेपाली"><span>Nepali</span></a></li>' +
        '<nav id="p-cactions" class="mw-portlet mw-portlet-cactions vector-menu-dropdown-noicon vector-menu vector-menu-dropdown" aria-labelledby="p-cactions-label" role="navigation">' +
    '<li class="mw-list-item"><a href="https://watv.kr/pt" title="ENCICLOPÉDIA DO CONHECIMENTO DA IGREJA DE DEUS"><span>português</span></a></li>' +
        '<input type="checkbox" id="p-cactions-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-cactions" class="vector-menu-checkbox" aria-labelledby="p-cactions-label">' +
  '</ul>' +
        '<label id="p-cactions-label" aria-label="" class="vector-menu-heading">' +
'</div>' +
        '<span class="select-language"></span>' +
'</nav>';
        '<span class="vector-menu-heading-label">Language</span>' +
langDiv.insertAdjacentHTML('afterbegin', navHTML);
        '</label>' +
}
        '<div class="vector-menu-content">' +
        '<ul class="vector-menu-content-list" id="header-lang-list"></ul>' +
        '</div>' +
        '</nav>';
 
    langDiv.insertAdjacentHTML('afterbegin', navHTML);
 
    // 헤더 ul
    const $headerList = $('#header-lang-list');
 
    // 왼쪽 언어 li 를 하나씩 읽어서 헤더에 복사
    $interLangList.find('li.interlanguage-link').each(function () {
        const $oldA = $(this).find('a');
 
        const href = $oldA.attr('href');
        const title = $oldA.attr('title');
        const text = $oldA.text();
 
        const newLi =
            '<li class="mw-list-item">' +
            '<a href="' + href + '" title="' + title + '">' +
            '<span>' + text + '</span>' +
            '</a>' +
            '</li>';
 
        $headerList.append(newLi);
    });
});