LLWiki正在建设中,欢迎加入我们!
“MediaWiki:Gadget-site-shared.js”的版本间差异
跳转到导航
跳转到搜索
小 (// 使用Wikiplus小工具快速编辑) 标签:移动版网页编辑 移动版编辑 |
小 |
||
第10行: | 第10行: | ||
window.location.replace( url ); |
window.location.replace( url ); |
||
} |
} |
||
mw.hook( 'wikipage.content' ).add(function($content) { |
|||
$content.find( '.mw-userlink.new' ).attr('href', function() { |
|||
const uri = new mw.Uri( this.href ), |
|||
title = new mw.Title( uri.query.title ); |
|||
if (title.getMainText() == mw.config.get('wgUserName')) { return; } |
|||
delete uri.query.action; |
|||
delete uri.query.redlink; |
|||
this.href = uri.toString(); |
|||
}); |
|||
}); |
|||
mw.hook( 'wikipage.categories' ).add(function($content) { |
mw.hook( 'wikipage.categories' ).add(function($content) { |
2021年1月5日 (二) 04:26的版本
"use strict"; /*global mw, $, OO, wgULS*/ // Unslashifier by [[wikipedia:User:Majavah]] const pagename = mw.config.get('wgPageName'), specialPage = mw.config.get( 'wgCanonicalSpecialPageName' ), action = mw.config.get('wgAction'), editable = mw.config.get( 'wgIsProbablyEditable' ); if (pagename.endsWith('/') && specialPage != 'Prefixindex') { const url = '/zh/' + pagename.slice(0, -1); window.location.replace( url ); } mw.hook( 'wikipage.content' ).add(function($content) { $content.find( '.mw-userlink.new' ).attr('href', function() { const uri = new mw.Uri( this.href ), title = new mw.Title( uri.query.title ); if (title.getMainText() == mw.config.get('wgUserName')) { return; } delete uri.query.action; delete uri.query.redlink; this.href = uri.toString(); }); }); mw.hook( 'wikipage.categories' ).add(function($content) { $content.find('a').filter(function() { return /(Μ's|Lily white)/.test( this.textContent ); }) .each(function() { $(this).text( this.textContent.replace("Μ's", "μ's").replace('Lily white', 'lily white') ); }); }); if (['edit', 'submit'].includes( action ) && editable) { $('body').on('click', 'span.mw-charinsert-item', function(e) { $('#wpTextbox1').textSelection( 'encapsulateSelection', { pre: $(this).data('mw-charinsert-start') || $(this).data('start'), peri: '', post: $(this).data('mw-charinsert-end') || $(this).data('end') } ); }); } $(function() { /* 沙盒顶部 */ var uri = new mw.Uri(); if ( ['LLWiki:沙盒', 'Template:Sandbox'].includes(pagename) && action == 'view' && !(uri.query.diff || uri.query.oldid) ) { $('#mw-content-text').prepend('<table class="infobox" style="background-color:#f3f5f7;width:70%;border-left-color:#c5c5c5" cellpadding="2" align="center">' + '<tbody><tr>' + '<td width="15%">' + '<img src="/mediawiki/img_auth.php/0/04/Bandeau-avertisement-3.png" width="50" height="50">' + '</td>' + '<td><span style="color:">欢迎来到沙盒!您可以在此进行编辑测试。</span></td>' + '</tr></tbody>' + '</table>'); } }); mw.hook('wikipage.content').add( function($content) { if (['edit', 'submit'].includes(action) && !editable && $('.editRequest').length == 1) { var ele = $('.editRequest > a'), href = new mw.Uri(ele.attr('href')), date = new Date(); href.query.preloadtitle = '编辑请求' + ' - ' + mw.config.get('wgUserName') + ' (' + date.getFullYear() + '-' + date.getMonth() + '-' + date.getDate() + ')'; ele.attr('href', href.toString()); } // 引自[[moegirl:mediawiki:common.js]] if (top !== window || location.host !== 'llwiki.org') { var messageDialog = new OO.ui.MessageDialog(), windowManager = new OO.ui.WindowManager(); $("body").append(windowManager.$element); windowManager.addWindows([messageDialog]); messageDialog.title.$label.html('<p>LLWiki提醒您</p><p>您正在非LLWiki域名' + wgULS('访问', '訪問') + '</p>'); messageDialog.message.$label.html('<p>' + wgULS('请注意不要在此域名下输入您的用户名或密码', '請注意不要在此域名下輸入您的用戶名或密碼') + ',以策安全!</p><p>LLWiki' + wgULS('域名为 ', '域名為') + ' llwiki.org</p>'); windowManager.openWindow(messageDialog, { actions: [{ action: "continue", label: "我知道了", flags: ["primary", "destructive"] }, { action: "jump", label: "前往LLWiki", flags: ["primary", "progressive"], href: top === window ? "https://llwiki.org" : location.href, target: "_blank" }] }); var timer = setInterval(function() { if ($('.oo-ui-windowManager .oo-ui-buttonElement-button').length) { clearInterval(timer); $('.oo-ui-windowManager .oo-ui-buttonElement-button').each(function() { if (this.href) { $(this).off('click'); } }); } }, 100); } });