注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
?_=1
来访问最新页面。https://mzh.moegirl.org.cn/User:%E6%9C%BA%E6%99%BA%E7%9A%84%E5%B0%8F%E9%B1%BC%E5%90%9B/common.js?_=1
/** User Gadgets **/ mw.loader.load( 'https://zh.moegirl.org.cn/index.php?title=User:机智的小鱼君/gadget/index.js&action=raw&ctype=text/javascript' ) /** InPageEdit **/ // Global variable var InPageEdit = window.InPageEdit || {} // Load plugin import('http://127.0.0.1:1225/InPageEdit.js?_=' + Date.now()) .then( function (payload) { console.info('[InPageEdit] Connected to dev server') var config = mw.config.get() return payload.InPageEdit.newFromApiEndpoint( config.wgServer + config.wgScriptPath + '/api.php' ) }, function (e) { console.info('[InPageEdit] Cannot fetch dev server', e) mw.loader.load('https://unpkg.com/mediawiki-inpageedit') return Promise.reject(e) } ) .then(function (ctx) { console.info('[InPageEdit] Context', ctx) window.ipenext = ctx }) // Preferences InPageEdit.myPreference = { editMinor: false, editSummary: '$section快速小编辑$oldid // InPageEdit-v2', outSideClose: false, plugins: [ 'toolbox.js', 'edit-any-page.js', 'monaco/script.js', 'color-preview.js', 'quick-thank.js', ], codeMirrorTheme: 'mdn-like', } // Test linksHere mw.hook('InPageEdit').add(function () { $('#t-whatlinkshere').on('click', function (e) { if (!InPageEdit.linksHere) return e.preventDefault() InPageEdit.linksHere() }) }) // 修改 IPE 文字防止抑郁 InPageEdit.i18n = InPageEdit.i18n || {} InPageEdit.i18n['zh-hans'] = InPageEdit.i18n['zh-hans'] || {} InPageEdit.i18n['zh-hans']['quick-edit'] = 'IPE 快编' /** MoeSkin switcher */ $(function () { window.toggleMoeskin = function (status) { if (typeof status === 'undefined') { status = !(mw.user.options.get('skin') === 'moeskin') } else { status = !!status } var api = new mw.Api({ parameters: { format: 'json', formatversion: 2, }, }) return api .postWithToken('csrf', { format: 'json', action: 'options', change: 'skin=' + (status ? 'moeskin' : 'vector'), }) .then(function (data) { if (data.options === 'success') { return true } else { return false } }) } }) /** More portletLinks */ $(function () { var conf = mw.config.get() // prefix index if (conf.wgIsArticle) { var prefixIndex = mw.util.addPortletLink( 'p-tb', mw.util.getUrl( 'Special:PrefixIndex/' + mw.config.get('wgPageName') + '/' ), '前缀索引', '前缀索引' ) prefixIndex.querySelector('a').target = '_blank' } // MoeSkin switcher mw.util .addPortletLink( 'p-navigation', 'javascript:;', 'Toggle MoeSkin', 'Toggle MoeSkin' ) .addEventListener('click', function () { if (this.innerText !== 'Toggle MoeSkin') return var anchorEl = this.querySelector('a') anchorEl.innerText = 'Loading...' window.toggleMoeskin().then(function (res) { if (res) { anchorEl.innerText = 'Reloading page...' location.reload(true) } else { anchorEl.innerText = 'Toggle MoeSkin' } }) }) })