|
查看“︁MediaWiki:Gadget-PreviewWithVariant.js”︁的源代码
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您可以查看和复制此页面的源代码。
// script from https://zh.wikipedia.org/wiki/MediaWiki:Gadget-PreviewWithVariant.js
/**
* @file Add a "Preview with variant" option to the edit form.
* @author [[zh:User:Diskdance]]
* @author [[zh:User:Lt2818]]
* @license MIT
*/
// <nowiki>
( function () {
var conv = require( 'ext.gadget.HanAssist' ).conv;
var initialized = false;
mw.hook( 'wikipage.editform' ).add( function ( $editForm ) {
if ( initialized ) {
return;
}
var $templateSandboxPreview = $editForm.find( 'input[name="wpPreview"]' );
// It is possible that a user want to preview a page with a non-wikitext module
// Do not return in this case
if (
mw.config.get( 'wgPageContentModel' ) !== 'wikitext' &&
!$templateSandboxPreview.length
000
1:0