LLWiki正在建设中,欢迎加入我们!
User:Bhsd/vector.js
跳转到导航
跳转到搜索
注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- 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),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件。
//<nowiki> // 拆分自[[Special:Mypage/common.js]],不可使用ES6语法 "use strict"; window.InPageEdit = window.InPageEdit || {}; InPageEdit.myPreference = { editMinor: false, outSideClose: true, noConfirmEdit: true, watchList: 'nochange', editSummary: "[InPageEdit] $section $oldid", redLinkQuickEdit: false, noRedirectIfConvertedTitleExists: true, plugins: [ 'code-mirror/script.js', 'toolbox.js', 'edit-any-page.js', 'wiki-editor.js', 'fix-double-entrance.js' ], codeMirrorThemeNoCSS: true }; mw.hook('InPageEdit.quickEdit.codemirror').add(function(obj) { obj.cm.setOption('indentUnit', 4); obj.cm.setOption('indentWithTabs', true); }); if (mw.util.getParamValue('dev')) { $.getScript('http://127.0.0.1:1005/InPageEdit.js'); } // 应用mediawiki.util对页面名称进行转义 $.when($.ready, mw.loader.using( 'mediawiki.util' )).then(function() { const nsid = mw.config.get( 'wgNamespaceNumber' ), pageName = mw.util.wikiUrlencode( mw.config.get('wgPageName') ), title = mw.util.wikiUrlencode( mw.config.get('wgTitle') ), specialPage = mw.config.get( 'wgCanonicalSpecialPageName' ), action = mw.config.get( 'wgAction' ); if (nsid == 14 && action == 'view') { // 加载ext.gadget.Cat-a-lot;尽量避免htmlString $('<li>', {html: $('<a>', {text: 'Cat-a-lot'})}).appendTo( '#p-cactions ul' ) .click(function() { mw.loader.load( 'ext.gadget.Cat-a-lot' ); }); } else if (specialPage == 'Contributions') { const $nonCode = $('.mw-contributions-list').children().not(function() { return /(^Widget:|\.(js|css)$)/.test( $(this).find( '.mw-contributions-title' ).text() ); }); $('<a>', {text: '代码筛选'}).click(function() { $nonCode.toggle(); }).appendTo( '.mw-pager-navigation-bar' ); } else if (action == 'view' && mw.config.get('wgIsArticle')) { mw.loader.load('//unpkg.com/wikiplus-highlight/dist/main.min.js'); } else if (mw.loader.getState( 'ext.codeEditor' ) == 'ready') { $('.ace_text-input').keyup(function(e) { if (!e.metaKey || e.key != 'f') { return; } $('.ace_search_form > input').select(); }); } // 自定义左侧导航,使用短地址 const addToolLink = function(obj, nextNode) { // 如果能用对象解构就很舒服了…… mw.util.addPortletLink('p-tb', obj.href, obj.text, null, null, null, nextNode); }; $('#t-whatlinkshere a').attr('href', '/zh?hidelinks=1&hideredirs=1&namespace=0&title=Special:链入页面/' + pageName); $('#t-recentchangeslinked a').attr('href', '/zh?title=Special:链出更改&hidemyself=1&target=' + pageName); [{href: '/zh?title=Special:前缀索引&stripprefix=1&prefix=' + title + '/&namespace=' + nsid, text: "子页面"}, {href: '/zh?title=Special:展开模板&wpRemoveComments=1&wpGenerateRawHtml=true&wpInput={{:' + pageName + '}}', text: "展开模板"}].forEach(function(ele) { addToolLink(ele, '#t-recentchangeslinked'); }); [{href: '/zh/Special:版本', text: "版本"}, {href: '/zh?title=Special:用户列表&creationSort=1&desc=1', text: "用户列表"}, {href: '/zh?target=http://*&title=Special:链接搜索', text: "链接搜索"}, {href: '/zh/Special:滥用过滤器', text: "滥用过滤器"}, {href: '/zh/Special:替换文本', text: "替换文本"}, {href: '/zh?title=Special:所有页面&namespace=' + nsid, text: "所有页面"}] .forEach(function(ele) { addToolLink(ele, '#t-info'); }); // 自定义顶部导航,使用短地址 $('<a>', {href: '/zh/Help:沙盒', text: '沙盒'}).insertBefore( '#pt-preferences' ).wrap( '<li>' ); }); //</nowiki>