|
|
| (未显示3个用户的17个中间版本) |
| 第1行: |
第1行: |
| var thisHref = window.location.href | | var thisHref = window.location.href |
| /* Wikiplus */ | | try { |
| mw.loader.load('https://wikiplus-app.com/Main.js') | | mw.loader.load('https://cdn.jsdelivr.net/npm/mediawiki-inpageedit') |
| | } catch (error) { |
| | mw.loader.load('https://unpkg.com/mediawiki-inpageedit') |
| | } |
|
| |
|
| /* 部分链接新窗口打开 */ | | /* 部分链接新窗口打开 */ |
| 第15行: |
第18行: |
| for (var i = a_mct.length - 1; i >= 0; i--) { | | for (var i = a_mct.length - 1; i >= 0; i--) { |
| a_mct[i].setAttribute("target","_blank") | | a_mct[i].setAttribute("target","_blank") |
| }; | | } |
| } | | } |
|
| |
|
| $('#p-personal ul').append('<li><a href="?action=purge">强制刷新</a><li>') | | $('#p-personal ul').append('<li><a href="?action=purge">强制刷新</a><li>') |
| $('#p-personal ul').append('<li><a href="https://mcbbs-wiki.cn/wiki/User:QWERTY_52_38/common.js">js</a></li>') | | $('#p-personal ul').append('<li><a href="?action=info">info</a></li>'); |
| $('#p-personal ul').append('<li><a href="https://mcbbs-wiki.cn/wiki/User:QWERTY_52_38/common.css">css</a></li>') | | $('#p-personal ul').append('<li><a href="https://mcbbs.wiki/wiki/User:QWERTY770/common.js">js</a></li>') |
| $('#p-help ul').append('<li><a href="https://mcbbs-wiki.cn/wiki/%E7%89%B9%E6%AE%8A:%E7%BC%96%E8%BE%91%E8%AE%A1%E6%95%B0">编辑数</a></li>') | | $('#p-personal ul').append('<li><a href="https://mcbbs.wiki/wiki/User:QWERTY770/common.css">css</a></li>') |
| $('#p-help ul').append('<li><a href="https://mcbbs-wiki.cn/wiki/%E6%A8%A1%E6%9D%BF:MCBBS%E6%A2%97%E6%96%87%E5%8C%96">MCBBS梗</a></li>')
| |
| $('#p-help ul').append('<li><a href="https://mcbbs-wiki.cn/wiki/%E6%A8%A1%E6%9D%BF:MCBBS%E8%AE%BA%E5%9D%9B%E4%BA%8B%E4%BB%B6">MCBBS事件</a></li>')
| |
| $('#p-help ul').append('<li><a href="https://mcbbs-wiki.cn/wiki/%E6%A8%A1%E6%9D%BF:MCBBS%E8%AE%BA%E5%9D%9B%E6%9C%BA%E5%88%B6">MCBBS机制</a></li>')
| |
| $('#p-help ul').append('<li><a href="https://mcbbs-wiki.cn/wiki/%E6%A8%A1%E6%9D%BF:MCBBS%E8%AE%BA%E5%9D%9B%E7%94%A8%E6%88%B7">MCBBS用户</a></li>')
| |
| $('#p-help ul').append('<li><a href="https://mcbbs-wiki.cn/wiki/%E6%A8%A1%E6%9D%BF:MCBBS%E8%AE%BA%E5%9D%9B%E7%89%88%E5%9D%97">MCBBS板块</a></li>')
| |
| $('#p-help ul').append('<li><a href="https://mcbbs-wiki.cn/wiki/%E5%88%86%E7%B1%BB:%E7%B4%A2%E5%BC%95">索引</a></li>')
| |
| $('#p-help ul').append('<li><a href="https://mcbbs-wiki.cn/wiki/MCBBS_Wiki:%E7%94%B3%E8%AF%B7%E8%81%8C%E4%BD%8D">申请职位</a></li>')
| |
| | |
| | |
| /* Widget代码显示 */
| |
| if (thisHref.indexOf("Widget:") != -1){
| |
| if (thisHref.indexOf("&") == -1){
| |
| $.ajax({url: "?action=edit", type: "GET", success: function(data){var result = $(data).find("#wpTextbox1");$("#bodyContent").html(result);}})
| |
| }
| |
| }
| |
| | |
| $('#mw-panel .portal:eq(2)').remove()
| |
|
| |
|
| // 在 $(document).ready 中调用 | | // 在 $(document).ready 中调用 |
| 第46行: |
第32行: |
| // 这个函数封装了 mw.loader | | // 这个函数封装了 mw.loader |
| function loadAddon(s) { | | function loadAddon(s) { |
| mw.loader.load("//mcbbs-wiki.cn/index.php?title=MediaWiki:Addon-" + s + ".js&action=raw&ctype=text/javascript" | | mw.loader.load("//mcbbs.wiki/index.php?title=MediaWiki:Addon-" + s + ".js&action=raw&ctype=text/javascript" |
| , "text/javascript"); | | , "text/javascript"); |
| } | | } |
|
| |
|
| var d = new Date()
| | /* 强制显示头像&用户名 */ |
| if (d.getDate() == 13 && d.getMonth() == 11){
| | $('head').append("<style>.comment-post .comment-avatar {opacity: 1;transition: all .3s;}.comment-post .comment-user {opacity: 1;transition: all .3s;}</style>") |
| $('head').append("<style>html{-webkit-filter:grayscale(0%);filter:grayscale(0%);}body{background-image:url(https://www.mcbbs.net/template/mcbbs/image/body_bg.jpg);background-color:#fff}</style>")
| |
| }
| |
|
| |
|
| // 取自 https://minecraft-zh.gamepedia.com/User:Ff98sha/common.js,仅供学习研究用 | | /* 手机版左端导航添加 */ |
| mw.loader.using(['oojs-ui-windows', 'oojs-ui-core'],
| | $('#p-tb').append('<div class="mbwh-mb-pl-btn"><li class=""><button onclick="getRevIds(window.alert);">getRevIds</button></li><li class=""><button onclick="patrolAll();">patrolAll</button></li><li class=""><button onclick="inPageAPITest();">inPageAPITest</button></li><li class=""><button onclick="massSearchReplacePrompt();">批量搜索替换</button></li><li class=""><button onclick="deepMovePrompt();">DeepMove</button></li></div>'); |
| function() {
| |
| $('.mw-rollback-link a').each(function() {
| |
| var href = $(this).attr('href');
| |
| $(this).click(function(e) {
| |
| e.preventDefault();
| |
| OO.ui.confirm('你确定要回退此页面吗?').done(function(confirmed) {
| |
| if (confirmed) { location.href = href; }
| |
| });
| |
| });
| |
| });
| |
| });
| |
|
| |
|
| // 阻止Salt_lovely改名 | | /* Wikiplus (Deprecated, use InPageEdit instead) |
| (function () {
| | mw.loader.load('https://wikiplus-app.com/Main.js'); */ |
| let map = [
| |
| ['Beanflame', 'beanflame'],
| |
| ['盐酱', 'Salt_lovely'],
| |
| ['Bleake','bleake'],
| |
| ]
| |
| // 执行一次
| |
| replaceUsername()
| |
| // 窗口加载完毕后再运行一次,以防漏网之鱼
| |
| window.addEventListener('load', replaceUsername)
| |
| /**修改用户名显示功能 */
| |
| function replaceUsername() {
| |
| for (let el of getUname()) {
| |
| for (let m of map) {
| |
| if (el.textContent == m[0] || el.textContent == mwUsernameTurn(m[0])) {
| |
| el.textContent = m[1]
| |
| if (el.hasAttribute('title')) {
| |
| el.setAttribute('title', el.getAttribute('title') + ' | 原名: ' + m[0])
| |
| } else {
| |
| el.setAttribute('title', '原名: ' + m[0])
| |
| }
| |
| break
| |
| }
| |
| }
| |
| el.setAttribute('renamed', '')
| |
| }
| |
| /**获取可能出现用户名的元素 */
| |
| function getUname() {
| |
| // 所有常见的用户名链接
| |
| let a = Array.from(document.querySelectorAll('a.mw-userlink bdi:not([renamed])'))
| |
| // 顶栏的用户名
| |
| let topyn = document.querySelector('#pt-userpage a:not([renamed])')
| |
| if (topyn)
| |
| a.push(topyn)
| |
| return a
| |
| }
| |
| /**MediaWiki会在一些地方用空格代替下划线 */
| |
| function mwUsernameTurn(unRaw) {
| |
| while (unRaw.indexOf('_') != -1)
| |
| unRaw = unRaw.replace('_', ' ')
| |
| return unRaw
| |
| }
| |
| }
| |
| })()
| |