注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:前往菜单 → 设置(Mac为Opera → Preferences),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件。
// 引自[[wikipedia:mediawiki:gadget-MobileCategories.js]] mw.hook( 'wikipage.content' ).add( function() { if(mw.config.get('skin') == 'vector') { return; } var api = new mw.Api(), apiRequest = api.get( { 'action':'query', 'titles': mw.config.get('wgPageName'), 'prop': 'categories', 'clshow': '!hidden', 'cllimit': 50, 'indexpageids': true, 'formatversion': 2 } ), apiRequest2 = api.loadMessagesIfMissing( [ 'pagecategories', 'colon-separator' ] ); $.when( apiRequest, apiRequest2 ).done( function( data ) { var categories = [], response1Data = data[0], response2Data = data[1]; if( !response1Data.query.pages[0].categories ) { return; } function categoryHtmlGenerator(element, index, array) { var title = new mw.Title( element.title, mw.config.get( 'wgNamespaceIds' ).file ); categories.push( $('<li>').append( $( '<a>' ).attr( 'href', mw.util.getUrl( element.title ) ) .attr( 'title', title ) .append( document.createTextNode( title.getMainText() ) ) ).get( 0 ) ); } response1Data.query.pages[0].categories.forEach( categoryHtmlGenerator ); if( categories.length === 0 ) { return; } var catlinks = $( '<div>' ) .attr( 'id', 'mw-normal-catlinks' ) .addClass('mw-normal-catlinks') .append( $( '<ul>' ).append( categories ) ) .prepend( '<a href="/zh/Special:Categories" title="Special:页面分类">' + mw.message( 'pagecategories' ).escaped() + '</a>' + mw.message( 'colon-separator' ).escaped() ); $('.printfooter') .after( $( '<div>' ) .addClass( 'catlinks' ) .attr( 'id', 'catlinks' ) .data( 'mw', 'interface' ) .append( catlinks ) ); } ); } );