MediaWiki:Gadget-FastWriterPage.js:修订间差异
跳转到导航
跳转到搜索
创建页面,内容为“mw.loader.using(['oojs-ui-core', 'oojs-ui-windows']).then(function () { var button = new OO.ui.ButtonWidget({ label: '点击我', icon: 'check', flags: ['primary'], classes: ['my-custom-button'] }); button.on('click', function () { var windowManager = new OO.ui.WindowManager(); $('body').append(windowManager.$element); var messageDialog = new OO.ui.MessageDialog(); windowManager.addWin…” |
无编辑摘要 |
||
第1行: | 第1行: | ||
mw.loader.using(['oojs-ui-core', 'oojs-ui-windows']).then(function () { | mw.loader.using(['oojs-ui-core', 'oojs-ui-windows']).then(function () { | ||
var | var btn_submit = new OO.ui.ButtonWidget({ | ||
label: ' | label: '提交', | ||
icon: 'check', | icon: 'check', | ||
flags: ['primary | flags: ['primary'] | ||
}); | }); | ||
var input1 = new OO.ui.TextInputWidget( { | |||
placeholder: '请输入文手名称' | |||
} ), | |||
input2 = new OO.ui.DropdownInputWidget( { | |||
placeholder: '请选择文手标签(默认:同人)', | |||
options: [ | |||
{ data: '同人', label: '同人' } | |||
] | |||
} ), | |||
input3 = new OO.ui.TextInputWidget( { | |||
placeholder: '请输入文手活跃平台' | |||
} ), | |||
input4 = new OO.ui.CheckboxInputWidget( { | |||
selected: true | |||
} ), | |||
fieldset = new OO.ui.FieldsetLayout( { | |||
label: '文手页面快速生成器', | |||
classes: [ 'container' ] | |||
} ); | |||
fieldset.addItems( [ | |||
new OO.ui.FieldLayout( input1, { | |||
label: '文手名称:', | |||
align: 'top', | |||
help: '名称请使用符合URL规则的纯文本(可以使用unicode),不要使用任何wikitext、HTML之类的语法。由于MediaWiki限制,空格会被转为下划线', | |||
helpInline: true | |||
} ), | |||
new OO.ui.FieldLayout( input2, { | |||
label: '文手标签:', | |||
align: 'top' | |||
} ), | |||
new OO.ui.FieldLayout( input3, { | |||
label: '文手活跃平台:', | |||
align: 'top' | |||
} ), | |||
new OO.ui.FieldLayout( input4, { | |||
label: '覆盖已存在的页面【危险!可能会覆盖手工加入的信息】', | |||
align: 'inline' | |||
} ), | |||
new OO.ui.FieldLayout( button ) | |||
] ); | |||
button.on('click', function () { | button.on('click', function () { | ||
var name = input1.getValue(); | |||
var tag = input2.getValue(); | |||
var platform = input3.getValue(); | |||
var windowManager = new OO.ui.WindowManager(); | var windowManager = new OO.ui.WindowManager(); | ||
$('body').append(windowManager.$element); | $('body').append(windowManager.$element); | ||
第13行: | 第62行: | ||
windowManager.addWindows([messageDialog]); | windowManager.addWindows([messageDialog]); | ||
windowManager.openWindow(messageDialog, { | windowManager.openWindow(messageDialog, { | ||
message: | message: name+tag+platform, | ||
title: '提示' | title: '提示' | ||
}); | }); | ||
第19行: | 第68行: | ||
// 添加到页面顶部 | // 添加到页面顶部 | ||
$('#mw-content-text').prepend( | $('#mw-content-text').prepend(fieldset.$element); | ||
}); | }); |
2025年3月16日 (日) 09:33的版本
mw.loader.using(['oojs-ui-core', 'oojs-ui-windows']).then(function () {
var btn_submit = new OO.ui.ButtonWidget({
label: '提交',
icon: 'check',
flags: ['primary']
});
var input1 = new OO.ui.TextInputWidget( {
placeholder: '请输入文手名称'
} ),
input2 = new OO.ui.DropdownInputWidget( {
placeholder: '请选择文手标签(默认:同人)',
options: [
{ data: '同人', label: '同人' }
]
} ),
input3 = new OO.ui.TextInputWidget( {
placeholder: '请输入文手活跃平台'
} ),
input4 = new OO.ui.CheckboxInputWidget( {
selected: true
} ),
fieldset = new OO.ui.FieldsetLayout( {
label: '文手页面快速生成器',
classes: [ 'container' ]
} );
fieldset.addItems( [
new OO.ui.FieldLayout( input1, {
label: '文手名称:',
align: 'top',
help: '名称请使用符合URL规则的纯文本(可以使用unicode),不要使用任何wikitext、HTML之类的语法。由于MediaWiki限制,空格会被转为下划线',
helpInline: true
} ),
new OO.ui.FieldLayout( input2, {
label: '文手标签:',
align: 'top'
} ),
new OO.ui.FieldLayout( input3, {
label: '文手活跃平台:',
align: 'top'
} ),
new OO.ui.FieldLayout( input4, {
label: '覆盖已存在的页面【危险!可能会覆盖手工加入的信息】',
align: 'inline'
} ),
new OO.ui.FieldLayout( button )
] );
button.on('click', function () {
var name = input1.getValue();
var tag = input2.getValue();
var platform = input3.getValue();
var windowManager = new OO.ui.WindowManager();
$('body').append(windowManager.$element);
var messageDialog = new OO.ui.MessageDialog();
windowManager.addWindows([messageDialog]);
windowManager.openWindow(messageDialog, {
message: name+tag+platform,
title: '提示'
});
});
// 添加到页面顶部
$('#mw-content-text').prepend(fieldset.$element);
});