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

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

跳转到导航 跳转到搜索
添加2,387字节 、​ 2021年1月12日 (二) 05:10
无编辑摘要
.addClass('empty');
},
placeholder = [
$placeholder = $('<div>', {class: "mw-parser-output"}).css('display', 'none'), // 用于替换时保留原始数据
$('<h1>', {id: 'firstHeading', class: 'firstHeading'}),
$('<div>', {id: 'catlinks'}).css('display', 'none'),
$('.mw-indicators')
], // 用于替换时保留原始数据
$warning = $('<div>', {html: [wgULS("确定要还原为未编辑的状态吗?", "確認要復原為未編輯的狀態嗎?"), '<br>',
wgULS("建议您做好编辑内容备份。", "建議您做好編輯內容備份。")]}),
$heading = $('#firstHeading'),
$cat = $('#catlinks'),
$indicator = $('.mw-indicator'),
$body = $('#bodyContent'),
btns = [new OO.ui.ButtonWidget({label: '提交', flags: ['primary', 'progressive']}).on('click', () => {
backup();
// 改变CSS样式表示预览中
btns[1].setDisabled( true );
apimw.parsetimedQuery(api, {action: 'parse', text: editor.getValue(), {title: page, uselang: lang, disablelimitreport: 1, disableeditsection: 1})
console.log('API request: 请求预览');
prop: 'text|categories|displaytitle|indicators', disablelimitreport: 1, disableeditsection: 1},
const now = mw.now();
wgULS('预览', '預覽')).then(r => {
api.parse(editor.getValue(), {title: page, uselang: lang, disablelimitreport: 1, disableeditsection: 1})
if ($.thencontains(html =>$content[0], $original[0] )) {
console.log(`End API request: 已生成预览,用时 ${mworiginal.nowafter() -placeholder[0] now} ms`).detach();
if ($.contains( $content[0], $original[0] )) { $originalheading.after( $placeholder[1] ).detach(); }
$contentcat.childrenafter( '.mw-parser-output'placeholder[2] ).replaceWithdetach( html );
$indicator.detach();
}
$content.children( '.mw-parser-output' ).replaceWith( r.parse.text );
pEmpty( $content.children( '.mw-parser-output' ) );
if (mw.resizeLyrics) { mw.resizeLyrics(); }
mw.hook( 'wikipage.content' ).fire($content);
placeholder[1].html( r.parse.displaytitle );
}, reason => { mw.apiFailure(reason, wgULS('预览', '預覽')); }) // mw.apiFailure不会抛出错误
placeholder[3].thenhtml(() => { btns[1]Object.setDisabledentries( falser.parse.indicators );.map(ele });=>
$('<div>', {class: 'mw-indicator', id: `mw-indicator-${ele[0]}`, html: ele[1]})) );
const showhidden = mw.user.options.get( 'showhiddencats' ),
normalCats = r.parse.categories.filter(ele => !ele.hidden).map(ele => ele.category),
hiddenCats = (showhidden ? r.parse.categories.filter(ele => ele.hidden) : []).map(ele => ele.category);
if (normalCats.length + hiddenCats.length === 0) { return; }
const $parseCat = $('<div>', {id: 'catlinks', class: 'catlinks', 'data-mw': 'interface'});
if (normalCats.length) {
$parseCat.append( $('<div>', {id: 'mw-normal-catlinks', class: 'mw-normal-catlinks', html: [
$('<a>', {title: wgULS('页面分类', '頁面分類'), text: wgULS('分类', '分類'),
href: '/zh/special:页面分类'}),
':',
$('<ul>', {html: normalCats.map(ele => $('<li>', {html: $('<a>', {href: mw.util.getUrl(ele),
title: `Category:${ele}`, text: ele})}))})
const now = mw.now( ]}) );
}
if (hiddenCats.length) {
$parseCat.append( $('<div>', {id: 'mw-hidden-catlinks',
class: 'mw-hidden-catlinks mw-hidden-cats-user-shown', html: [
wgULS('隐藏分类:', '隱藏分類:'),
$('<ul>', {html: hiddenCats.map(ele => $('<li>', {html: $('<a>', {href: mw.util.getUrl(ele),
title: `Category:${ele}`, text: ele})}))})
]}) );
}
$('#catlinks').replaceWith( $parseCat );
}, () => {}).then(() => { btns[1].setDisabled( false ); });
}), new OO.ui.ButtonWidget({label: wgULS('还原', '復原'), flags: 'destructive', disabled: true}).on('click', () => {
mw.confirm($warning, ['primary', 'destructive']).then(confirm => {
section = undefined;
editor.setValue( text );
if ($.contains( $content[0], $original[0] )) { return; } // 无事发生
$content.children( '.mw-parser-output' ).replaceWith( $original );
placeholder[1].replaceWith( $heading );
$('#catlinks').replaceWith( $cat );
placeholder[3].html( $indicator );
if (mw.resizeLyrics) { mw.resizeLyrics(); }
});
updateHints();
} : () => {};
mw.loader.using(['jquery.ui', 'user.options']).then(() => {
const actionP = new OO.ui.ActionWidget({label: '是', target: '_blank', flags: 'progressive'}),
actionD = new OO.ui.ActionWidget({label: '否'}),
16,874

个编辑

导航菜单