MediaWiki:Minerva.js: Difference between revisions

No edit summary
Tags: Mobile edit Mobile web edit
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
function wikiLink(title) {
function wikiLink(title) {
     // 공백 → _ 치환 후 절대 경로 생성
     // 공백 → _ 치환 후 절대 경로 생성
     return mw.config.get('wgServer') + '/' + title.replace(/ /g, '_');
     return mw.config.get('wgServer') + '/en/' + title.replace(/ /g, '_');
}
}


Line 11: Line 11:
         '<ul id="p-main-categories">'+
         '<ul id="p-main-categories">'+
         '<li class="title-recommended"><a><span>Recommended Documents</span></a><span class="ico-arrow"></span></li>'+
         '<li class="title-recommended"><a><span>Recommended Documents</span></a><span class="ico-arrow"></span></li>'+
             '<li class="recommended" style="display:none;"><a href="' + wikiLink("en/World Mission Society Church of God") + '"><span>Church of God(Document)</span></a></li>' +
             '<li class="recommended" style="display:none;"><a href="' + wikiLink("World Mission Society Church of God") + '"><span>Church of God(Document)</span></a></li>' +
             '<li class="recommended" style="display:none;"><a href="' + wikiLink("en/Ahnsahnghong") + '"><span>Christ Ahnsahnghong</span></a></li>' +
             '<li class="recommended" style="display:none;"><a href="' + wikiLink("Ahnsahnghong") + '"><span>Christ Ahnsahnghong</span></a></li>' +
             '<li class="recommended" style="display:none;"><a href="' + wikiLink("en/God the Mother") + '"><span>God the Mother</span></a></li>' +
             '<li class="recommended" style="display:none;"><a href="' + wikiLink("God the Mother") + '"><span>God the Mother</span></a></li>' +
             '<li class="recommended" style="display:none;"><a href="' + wikiLink("en/Sabbath") + '"><span>Sabbath</span></a></li>' +
             '<li class="recommended" style="display:none;"><a href="' + wikiLink("Sabbath") + '"><span>Sabbath</span></a></li>' +
             '<li class="recommended" style="display:none;"><a href="' + wikiLink("en/Passover") + '"><span>Passover</span></a></li>' +
             '<li class="recommended" style="display:none;"><a href="' + wikiLink("Passover") + '"><span>Passover</span></a></li>' +
             '<li class="recommended" style="display:none;"><a href="' + wikiLink("en/Gospel and the New Covenant") + '"><span>Gospel and New Covenant</span></a></li>' +
             '<li class="recommended" style="display:none;"><a href="' + wikiLink("Gospel and the New Covenant") + '"><span>Gospel and New Covenant</span></a></li>' +
         '<li class="title-category"><a><span>Browse by Category</span></a><span class="ico-arrow"></span></li>'+
         '<li class="title-category"><a><span>Browse by Category</span></a><span class="ico-arrow"></span></li>'+
  '<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Church of God") + '"><span>Church of God</span></a></li>' +
  '<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Church of God") + '"><span>Church of God</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:God the Father") + '"><span>God the Father</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("Category:God the Father") + '"><span>God the Father</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:God the Mother") + '"><span>God the Mother</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("Category:God the Mother") + '"><span>God the Mother</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Gospel of the New Covenant") + '"><span>Gospel of the New Covenant</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("Category:Gospel of the New Covenant") + '"><span>Gospel of the New Covenant</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Bible Knowledge") + '"><span>Bible Knowledge</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("Category:Bible Knowledge") + '"><span>Bible Knowledge</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Biblical Issues") + '"><span>Biblical Issues</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("Category:Biblical Issues") + '"><span>Biblical Issues</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Community Service") + '"><span>Community Service</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("Category:Community Service") + '"><span>Community Service</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("en/Category:Global Cooperation") + '"><span>Global Cooperation</span></a></li>' +
             '<li class="category" style="display:none;"><a href="' + wikiLink("Category:Global Cooperation") + '"><span>Global Cooperation</span></a></li>' +
         '</ul>'
         '</ul>'
     );
     );
Line 78: Line 78:
             }
             }
         });
         });
    });
});
/* -------------------------------
*  모바일 언어 메뉴 삽입
* ------------------------------- */
mw.loader.using(['jquery']).then(function() {
    $(function() {
        // ===== 기존 모달 코드 =====
        var modal = $('#myLayer');
        var btn = $('#selectLanguage'); // jQuery 선택자 사용
        var span = $('.close-button').first();
        btn.click(function() {
            modal.show();
        });
        span.click(function() {
            modal.hide();
        });
        $(window).click(function(event) {
            if ($(event.target).is(modal)) {
                modal.hide();
            }
        });
        // ===== 여기부터 모바일 언어 메뉴 삽입 =====
        if ( mw.config.get('skin') === 'minerva' ) {
            var langHTML = ''
            + '<ul id="mobile-language" class="recommended-open">'
    + '<li><a href="https://churchofgod.wiki">한국어 (Korean)</a></li>'
    + '<li><a href="https://churchofgod.wiki/es">Español (Spanish)</a></li>'
    + '<li><a href="https://churchofgod.wiki/vi">Tiếng Việt (Vietnamese)</a></li>'
    + '<li><a href="https://churchofgod.wiki/ne">नेपाली (Nepali)</a></li>'
    + '<li><a href="https://churchofgod.wiki/pt">Português (Portuguese)</a></li>';
                + '</ul>';
var $list = $('#mobile-language');
$list.html(langHTML);
        }
     });
     });
});
});