LLWiki正在建设中,欢迎加入我们

“MediaWiki:Mobile.js”的版本间差异

来自LLWiki
跳转到导航 跳转到搜索
第5行: 第5行:
/* 特殊页面 */
/* 特殊页面 */
$('.page-Special_用户列表 h1').html('LLWiki上的LLer');
$('.page-Special_用户列表 h1').html('LLWiki上的LLer');

mw.loader.using('ext.gadget.site-lib').then(function() {
mw.loader.using('ext.gadget.site-lib').then(function() {
/* 沙盒顶部 */
/* 沙盒顶部 */
$('.page-LLWiki_沙盒 #mf-section-0').prepend('<table class="infobox" style="background-color:#F3F5F7;border:1px solid #D4DBE2;border-radius:5px;width:70%;border-left:10px solid #C5C5C5" cellpadding="4px" align="center"><tbody><tr><td width="15%"><div class="center"><div class="floatnone"><img src="/mediawiki/img_auth.php/thumb/0/04/Bandeau-avertisement-3.png/50px-Bandeau-avertisement-3.png" decoding="async" data-file-width="72" data-file-height="72" width="50" height="50"></div></div></td><td style="padding-left:5px"><span>' + wgUCS("欢迎来到沙盒!您可以在此进行编辑测试。", "歡迎來到沙盒!您可以在此進行編輯測試。") + '</span></td></tr></tbody></table>');
$('.page-LLWiki_沙盒 #mf-section-0').prepend('<table class="infobox" style="background-color:#F3F5F7;border:1px solid #D4DBE2;border-radius:5px;width:70%;border-left:10px solid #C5C5C5" cellpadding="4px" align="center"><tbody><tr><td width="15%"><div class="center"><div class="floatnone"><img src="/mediawiki/img_auth.php/thumb/0/04/Bandeau-avertisement-3.png/50px-Bandeau-avertisement-3.png" decoding="async" data-file-width="72" data-file-height="72" width="50" height="50"></div></div></td><td style="padding-left:5px"><span>' + wgUCS("欢迎来到沙盒!您可以在此进行编辑测试。", "歡迎來到沙盒!您可以在此進行編輯測試。") + '</span></td></tr></tbody></table>');

mw.loader.using('mediawiki.api').then(function() {
mw.loader.using('mediawiki.api').then(function() {
/* Mobile Navmenu by GFwiki */
/* Mobile Navmenu by GFwiki */
var api = new mw.Api();
var api = new mw.Api();
api.get( {
api.get( {
'action':'parse',
'action':'parse',
'page':'MediaWiki:MFSidebar' + wgULS("", "/zh-hant"),
'page':'MediaWiki:MFSidebar' + wgULS("", "/zh-hant"),
'dataType':'json'
'dataType':'json'
} ).then(function(data) {
} ).then(function(data) {
var navlist = data.parse.text["*"];
var navlist = data.parse.text["*"];
var timer = setInterval(function() {
var timer = setInterval(function() {
if($('.menu ul').length) {
if($('.menu ul').length) {
console.log("mobile menu exists");
console.log("mobile menu exists");
clearInterval(timer);
clearInterval(timer);
$(navlist).insertAfter(".menu > ul:first");
$(navlist).insertAfter(".menu > ul:first");
}
}
}, 100);
}, 100);
});
});
});
});
});
});

/* 引自zh.moegirl.org.cn/mediawiki:mobile.js */
/* 引自zh.moegirl.org.cn/mediawiki:mobile.js */
/* jquery.collapsible */
/* jquery.collapsible */
第37行: 第37行:
});
});
}
}

/* jquery.tablesorter */
/* jquery.tablesorter */
if ($('table.sortable').length) {
if ($('table.sortable').length) {

2020年8月20日 (四) 05:12的版本

/* 这里的任何JavaScript将为使用移动版网站的用户加载 */
//<nowiki>
(function($, mw) {
    $(function () {
        /* 特殊页面 */
        $('.page-Special_用户列表 h1').html('LLWiki上的LLer');

        mw.loader.using('ext.gadget.site-lib').then(function() {
            /* 沙盒顶部 */
            $('.page-LLWiki_沙盒 #mf-section-0').prepend('<table class="infobox" style="background-color:#F3F5F7;border:1px solid #D4DBE2;border-radius:5px;width:70%;border-left:10px solid #C5C5C5" cellpadding="4px" align="center"><tbody><tr><td width="15%"><div class="center"><div class="floatnone"><img src="/mediawiki/img_auth.php/thumb/0/04/Bandeau-avertisement-3.png/50px-Bandeau-avertisement-3.png" decoding="async" data-file-width="72" data-file-height="72" width="50" height="50"></div></div></td><td style="padding-left:5px"><span>' + wgUCS("欢迎来到沙盒!您可以在此进行编辑测试。", "歡迎來到沙盒!您可以在此進行編輯測試。") + '</span></td></tr></tbody></table>');

            mw.loader.using('mediawiki.api').then(function() {
                /* Mobile Navmenu by GFwiki */
                var api = new mw.Api();
                api.get( {
                    'action':'parse',
                    'page':'MediaWiki:MFSidebar' + wgULS("", "/zh-hant"),
                    'dataType':'json'
                } ).then(function(data) {
                    var navlist = data.parse.text["*"];
                    var timer = setInterval(function() {
                        if($('.menu ul').length) {
                            console.log("mobile menu exists");
                            clearInterval(timer);
                            $(navlist).insertAfter(".menu > ul:first");
                        }
                    }, 100);
                });
            });
        });

        /* 引自zh.moegirl.org.cn/mediawiki:mobile.js */
        /* jquery.collapsible */
        if ($('.mw-collapsible').length) {
            mw.loader.using('jquery.makeCollapsible').then(function() {
                $('.mw-collapsible').makeCollapsible();
            });
        }

        /* jquery.tablesorter */
        if ($('table.sortable').length) {
            mw.loader.using('jquery.tablesorter').then(function() {
                $('table.sortable').tablesorter();
            });
        }
    });
})(jQuery, mediaWiki);
//</nowiki>