User:机智的小鱼君/global.js

/** * Import scripts from dev wiki */ importArticles({ type: 'script',  articles: [    'u:dev:MediaWiki:BlogLink/code.js', //右上角博客链接    'u:dev:MediaWiki:BotManagement.js', //快速切换bot权限    'u:dev:MediaWiki:CategoryRenameAuto-update/code.js', //重命名系列分类    'u:dev:MediaWiki:CodeQuickLinks/code.js', //查看社区所有JS    'u:dev:MediaWiki:DisplayTimer/code.js', //右下角的刷新时钟    'u:dev:MediaWiki:GlobalEditcount/code.js', //全域编辑信息    'u:dev:MediaWiki:LangSetup.js', //为一个wiki快速添加魔术字    'u:dev:MediaWiki:LastEdited/code.js', //页面最近更改摘要    'u:dev:MediaWiki:MobilePreview.js', //快速预览手机版页面    'u:dev:MediaWiki:QuickCreateUserPage/code.js', //快速建立用户页    'u:dev:MediaWiki:QuickDelete/code.js', //删除分类下页面    'u:dev:MediaWiki:RedirectManagement/code.js', //快速解决损坏重定向    'u:dev:MediaWiki:ReferencePopups/code.js', //注释弹窗    'u:dev:MediaWiki:ShortUrl.js', // 页面短链接    'u:dev:MediaWiki:ShowUserGroups.js', //显示用户组    'u:dev:MediaWiki:StickyRail/code.js', //StickyRail 'u:dev:MediaWiki:UserBadge/code.js', // UserBadge ], })

// Quick Tools mw.loader.load( 'https://internal-soap.fandom.com/index.php?title=User:' +    mw.config.get('wgUserName') +    '/tools-loader.js&action=raw&ctype=text/javascript' )

/** InPageEdit */ $.ajax({ url: 'http://127.0.0.1:1005/InPageEdit.js',  cache: false,  dataType: 'script', }).then(  function  {    console.info('[InPageEdit] Enable dev mode')  },  function  {    console.info('[InPageEdit] Cannot fetch dev server')    mw.loader.load( 'https://cdn.jsdelivr.net/npm/mediawiki-inpageedit@latest/dist/InPageEdit.min.js' ) } ) // Preferences editMinor: false, editSummary: '$section$oldid // Via InPageEdit-v2', outSideClose: false, // redLinkQuickEdit: true, watchList: true, plugins: [ 'toolbox.js', 'edit-any-page.js', 'code-mirror/script.js', 'color-preview.js', 'fix-double-entrance.js', 'quick-thank.js', 'wiki-editor.js', ], }
 * (window.InPageEdit = window.InPageEdit || {}).myPreference = {

/** Add sidetool */ mw.hook('dev.addSideTool').add(function (addSideTool) { addSideTool('IPE', '快速编辑').$button.on('click', function  { InPageEdit.quickEdit({     page: wgPageName,      revision: wgRevisionId,    }) }) })

/** Show wiki details */ !(function {  $('.page-header__title-wrapper').append( $(' ')     .css({        color: 'gray',        'font-family': 'sans-serif',        'font-size': '12px',        'border-left': '4px solid #ccc',        'padding-left': '8px',      }) .append(       'wgSiteName: ' + wgSiteName,        ' | ',        'wgContentLanguage: ' + wgContentLanguage,        ' | ',        'wgCityId: ' + wgCityId,        ' | ',        'wgDBname: ' + wgDBname,        ' | ',        $('', { text: 'purge page', href: 'javascript:;' }).click( function { ssi_modal.confirm(             {                className: 'in-page-edit',                center: true,                title: 'Confirm',                content: 'Purge page?',                okBtn: { className: 'btn btn-primary' },                cancelBtn: { className: 'btn' },              },              function (res) {                if (res) {                  new mw.Api                    .post({ action: 'purge', format: 'json', })                   .done(function  { location.reload })               }              }            )          }        ),        ' | ',        $('', { text: 'clear cache', href: 'javascript:;' }).click( function { ssi_modal.confirm(             {                className: 'in-page-edit',                center: true,                title: 'Confirm',                content: 'Purge page?',                okBtn: { className: 'btn btn-danger' },                cancelBtn: { className: 'btn' },              },              function (res) {                if (res) {                  location.href += '?mcache=writeonly'                }              }            ) }       ),        ' | ',        $('', { text: '+ show all', href: 'javascript:;' }).click( function { ssi_modal.show({             className: 'in-page-edit allConf',              center: true,              title: 'All mw config settings',              content: function  {                var conf = mw.config.get                var list = $(' ').addClass('wikitable')                list.append( $(' ').append(                   $(' ', { text: 'Key' }),                    $(' ', { text: 'Value' })                  ) )               $.each(conf, function (k, v) { list.append(                   $(' ').append( $(' ', { text: k }), $(' ', { style: 'text-align: left' }).append(                       $(' ', { style: 'max-width: 50vw; overflow: auto', html: '' + JSON.stringify(v, null, 2) + ' ',                       })                      )                    )                  )                })                return list              },            }) }       )      )  ) })

/** 移除最近更改 URL 里那一长串鬼玩意儿 */ if (mw.config.get('wgCanonicalSpecialPageName') === 'Recentchanges') { history.pushState({}, '', location.href.split('?')[0]) }

/** 移动端调试 */ !(function {  var loadScript = function (url) {    if (!/^(https?:)?\/\//.test(url))      url = mw.util.getUrl(url, { action: 'raw', ctype: 'text/javascript' })    return $.ajax({ url: url, dataType: 'script', cache: true, }) }  mw.loader.using('mediawiki.util').then(function  { var url = mw.util.getParamValue('console') if (url === '0' || url === 'false' || url === 'disable') { localStorage.setItem('loadConsole', 'false') } else if (url) { localStorage.setItem('loadConsole', 'true') }   if (localStorage.getItem('loadConsole') === 'true') { Promise.all([       loadScript('https://cdn.jsdelivr.net/npm/eruda'),        loadScript('https://cdn.jsdelivr.net/npm/eruda-dom'),        loadScript('https://cdn.jsdelivr.net/npm/eruda-code'),      ]).then(function  {        // 初始化实例        eruda.init({ defaults: { displaySize: 50, },       })        // 注册插件        eruda.add(erudaDom)        eruda.add(erudaCode)        // 点击外侧关闭        $('body').click(function  { eruda.hide })     })    }  }) })