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

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

跳转到导航 跳转到搜索
添加395字节 、​ 2020年12月18日 (五) 02:23
无编辑摘要
"use strict";
/*global mw, $, OO, CodeMirror*/
mw.util.addCSS( '#mw-content-text > .mwoo-parserui-output, .CodeMirrorbuttonWidget { displaymargin:inline-block; width:49%0.5em; }' +);
'.CodeMirror { float:right; position:sticky; top:7px; border:1px solid; height:calc(100vh - 55px); }' +
'.oo-ui-buttonWidget { margin:0.5em; } #mw-content-text p { border:1px dashed; }');
$.getJSON( '/zh?title=mediawiki:gadget-CodeMirror.json&action=raw&ctype=application/json', config => {
let text = '';
const $contentcss = $mw.util.addCSS( '#mw-content-text p { border:1px dashed; }'), +
'#mw-content-text > .mw-parser-output, .CodeMirror { display:inline-block; width:49%; }' +
'.CodeMirror { float:right; position:sticky; top:7px; border:1px solid; height:calc(100vh - 55px); }' +),
$content = $('#mw-content-text'),
id = mw.config.get( 'wgArticleId' ),
api = new mw.Api(),
editor = new CodeMirror($content[0], {mode: 'text/mediawiki', mwConfig: config, lineWrapping: true}),
wrapper = $( editor.getWrapperElement() ),
btn1btns = [new OO.ui.ButtonWidget({label: '提交', flags: ['primary', 'progressive']}).on('click', () => {
console.log('API request: 查询最新编辑时间戳');
const now = mw.now();
}, reason => { mw.notify(`编辑失败!错误信息:${reason}`, {type: 'error'}); });
}, reason => { mw.notify(`无法获得最新编辑时间戳!错误信息:${reason}`, {type: 'error'}); });
btn2 =}), new OO.ui.ButtonWidget({label: '预览'}).on('click', () => {
}),
btn2 = new OO.ui.ButtonWidget({label: '预览'}).on('click', () => {
console.log('API request: 请求预览');
const now = mw.now();
console.log(`End API request: 已生成预览,用时 ${mw.now() - now} ms`);
$content.children( '.mw-parser-output' ).replaceWith( html );
mw.hook( 'wikipage.content' ).fire($content);
}, reason => { mw.notify(`无法生成预览!错误信息:${reason}`, {type: 'error'}); });
btn3 =}), new OO.ui.ButtonWidget({label: '还原', flags: ['destructive']}).on('click', () => {
}),
btn3 = new OO.ui.ButtonWidget({label: '还原', flags: ['destructive']}).on('click', () => {
editor.setValue( text );
}), new OO.ui.ButtonWidget({label: '隐藏'}).on('click', () => {
});
css.disabled = !css.disabled;
$('<div>', {html: [btn1.$element, btn2.$element, btn3.$element]}).appendTo( $content )
wrapper.toggle();
}), new OO.ui.ButtonWidget({label: '继续', flags: 'progressive', icon: 'next'}).on('click', () => {
window.href = `/?redirect=no&curid=${id + 1}`; })];
$('<div>', {html: [btn1btns.$element,map(ele btn2.$element,=> btn3ele.$element])}).appendTo( $content )
.css({float: 'right', clear: 'right', position: 'sticky', bottom: 0});
mw.request = mw.request || api.get({action: 'query', revids: mw.config.get('wgRevisionId'), prop: 'revisions',
16,874

个编辑

导航菜单