LLWiki正在建设中,欢迎加入我们!
“MediaWiki:Mobile.js”的版本间差异
跳转到导航
跳转到搜索
小 |
小 |
||
第43行: | 第43行: | ||
/* 特殊页面 */ |
/* 特殊页面 */ |
||
$('.page-Special_用户列表 h1').html('LLWiki上的LLer'); |
$('.page-Special_用户列表 h1').html('LLWiki上的LLer'); |
||
if(mw.config.get('wgPageName') == 'Special:最近更改') { |
|||
var timerFilter = setInterval(function() { |
|||
if($( '.mw-rcfilters-ui-itemMenuOptionWidget-view-namespaces' ).length) { |
|||
clearInterval(timerFilter); |
|||
const isReverted = /invert=1/.test(window.location.href); |
|||
var node = $( '.mw-rcfilters-ui-itemMenuOptionWidget-view-namespaces:first' ).clone().insertAfter( '.mw-rcfilters-ui-filterMenuSectionOptionWidget:first' ) |
|||
.attr('id','ooui-invert') |
|||
.removeClass('oo-ui-element-hidden') |
|||
.on('click',function() { |
|||
if(isReverted) { window.location.href = window.location.href + '&invert=0'; } |
|||
else { window.location.href = window.location.href + '&invert=1'; } |
|||
}), |
|||
inputbox = node.find( 'input' ); |
|||
inputbox[0].checked = isReverted; |
|||
if(isReverted) { inputbox.next().addClass('oo-ui-icon-check'); } |
|||
else { inputbox.next().removeClass('oo-ui-icon-check'); } |
|||
node.find( 'span.oo-ui-labelElement-label' ).text( wgULS("排除选项", "排除選項") ); |
|||
} |
|||
}, 100); |
|||
} |
|||
mw.loader.using(['mediawiki.api', 'ext.gadget.site-lib']).then(function() { |
mw.loader.using(['mediawiki.api', 'ext.gadget.site-lib']).then(function() { |
2020年8月21日 (五) 14:52的版本
/* 这里的任何JavaScript将为使用移动版网站的用户加载 */ //<nowiki> (function($, mw) { mw.hook('wikipage.content').add( function($content) { /* 沙盒顶部 */ if(mw.config.get('wgPageName') == 'LLWiki:沙盒' && mw.config.get('wgAction') == 'view') { var sandboxTop = $('<div>'); sandboxTop.load('/zh?title=LLWiki:沙盒/顶部&variant=' + mw.config.get('wgUserVariant') + ' #mw-content-text', function() { $content.prepend(sandboxTop); }); } /* 引自zh.moegirl.org.cn/mediawiki:mobile.js */ /* jquery.collapsible */ if ($content.find('.mw-collapsible').length) { mw.loader.using('jquery.makeCollapsible').then(function() { $('.mw-collapsible').makeCollapsible(); }); } /* jquery.tablesorter */ if ($content.find('table.sortable').length) { mw.loader.using('jquery.tablesorter').then(function() { $('table.sortable').tablesorter(); }); } }); $(function () { // 页顶图标 const restrictionEdit = mw.config.get('wgRestrictionEdit') || [], restrictionMove = mw.config.get('wgRestrictionMove') || [], isSysop = mw.config.get('wgUserGroups').includes('sysop'), isProtected = restrictionEdit.length + restrictionMove.length, fullurl = '/zh?title=' + mw.config.get('wgPageName'), isMovable = restrictionMove.length === 0 || mw.config.get('wgUserGroups').includes(restrictionMove[0]); if(mw.config.get('wgAction') == 'view' && mw.config.get('wgIsArticle')) { $( (isSysop ? '<li id="page-actions-protect" class="page-actions-menu__list-item"><a id="ca-protect" href="' + fullurl + '&action=protect" data-event-name="menu.protect" role="button" title="更改保护"><i class="fa fa-' + (isProtected? 'unlock' : 'lock') + '"></i></a></li><li id="page-actions-delete" class="page-actions-menu__list-item"><a id="ca-delete" href="' + fullurl + '&action=delete" data-event-name="menu.delete" role="button" title="删除"><i class="fa fa-cut"></i></a></li>' : '') + (isMovable ? '<li id="page-actions-move" class="page-actions-menu__list-item"><a id="ca-move" href="/zh/special:移动页面/' + mw.config.get('wgPageName') + '" data-event-name="menu.move" role="button" title="移动"><i class="fa fa-truck"></i></a></li>' : '') ).insertAfter('#language-selector'); } /* 特殊页面 */ $('.page-Special_用户列表 h1').html('LLWiki上的LLer'); if(mw.config.get('wgPageName') == 'Special:最近更改') { var timerFilter = setInterval(function() { if($( '.mw-rcfilters-ui-itemMenuOptionWidget-view-namespaces' ).length) { clearInterval(timerFilter); const isReverted = /invert=1/.test(window.location.href); var node = $( '.mw-rcfilters-ui-itemMenuOptionWidget-view-namespaces:first' ).clone().insertAfter( '.mw-rcfilters-ui-filterMenuSectionOptionWidget:first' ) .attr('id','ooui-invert') .removeClass('oo-ui-element-hidden') .on('click',function() { if(isReverted) { window.location.href = window.location.href + '&invert=0'; } else { window.location.href = window.location.href + '&invert=1'; } }), inputbox = node.find( 'input' ); inputbox[0].checked = isReverted; if(isReverted) { inputbox.next().addClass('oo-ui-icon-check'); } else { inputbox.next().removeClass('oo-ui-icon-check'); } node.find( 'span.oo-ui-labelElement-label' ).text( wgULS("排除选项", "排除選項") ); } }, 100); } mw.loader.using(['mediawiki.api', 'ext.gadget.site-lib']).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) { const 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); }); }); }); })(jQuery, mediaWiki); //</nowiki>