LLWiki正在建设中,欢迎加入我们

“MediaWiki:Gadget-inspect.js”的版本间差异

跳转到导航 跳转到搜索
添加423字节 、​ 2020年12月30日 (三) 05:19
无编辑摘要
/*global mw, $, OO, CodeMirror, wgULS*/
const id = mw.config.get( 'wgArticleId' ),
curRevid = mw.config.get( 'wgCurRevisionId' ),
script = mw.config.get('wgScript'),
page = mw.config.get( 'wgPageName' ),
inspect = gadgets.inspect || {},
rule = inspect.rule || true;
if (rule && id > 0 && (![10, 274].includes( mw.config.get( 'wgNamespaceNumber' ) ) || page.endsWith( '/doc' )) &&
mw.config.get('wgAction') == 'view' && mw.config.get( 'wgPageContentModel' ) == 'wikitext' &&
!mw.utilconfig.getParamValueget( 'oldidwgIsRedirect' ) && !mw.utilconfig.getParamValueget( 'diffwgDiffNewId' ) && !mw.configutil.getgetParamValue( 'wgIsProbablyEditableoldid' )) &&{
rule) {
const api = new mw.Api(),
getJSON = $.ajax({ dataType: 'json', cache: true,
btns = [new OO.ui.ButtonWidget({label: '提交', flags: ['primary', 'progressive']}).on('click', function() {
btns[0].setDisabled( true );
mw.safeEdit(api, mw.config.get( 'wgCurRevisionId' )curRevid, {pageid: id, text: editor.getValue(),
summary: wgULS('使用页面/文本对比查看器快速编辑', '使用頁面/文本對比察看器快速編輯')}).then(function() {
setTimeout(window.location.reload(), 500);
});
}), new OO.ui.ButtonWidget({label: wgULS('还原', '復原'), flags: 'destructive'}).on('click', function() {
OO.ui.confirm( wgULS("您确定要还原为未编辑的状态吗?建议您做好编辑内容备份。",
editor.setValue( text );
"您確認要復原為未編輯的狀態嗎?建議您做好編輯內容備份。"), {actions: [{label: "否"},
$content.children( '.mw-parser-output' ).replaceWith( original );
{label: "是", flags: ['primary', 'destructive'], action: 'accept'}]} ).then(function(confirm) {
if (mw.resizeLyrics) { mw.resizeLyrics(); }
if (!confirm) { return; }
editor.setValue( text );
$content.children( '.mw-parser-output' ).replaceWith( original );
if (mw.resizeLyrics) { mw.resizeLyrics(); }
});
}), new OO.ui.ButtonWidget({label: wgULS('显示', '顯示')}).on('click', function() {
css.disabled = !css.disabled;
16,874

个编辑

导航菜单