点击此处会biu~的随机导向一个高级条目哦 ><
|
H萌娘上月访问数据报告
查看“MediaWiki:Common.js”的源代码
←
MediaWiki:Common.js
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
此页面为本wiki上的软件提供界面文本,并受到保护以防止滥用。 如欲修改所有wiki的翻译,请访问
translatewiki.net
上的MediaWiki本地化项目。
您无权编辑此JavaScript页面,因为编辑此页面可能会影响所有访问者。
您可以查看和复制此页面的源代码。
//编辑提示检查 if ($(".mw-summary-preset")[0]) { $(".CheckNewSectionOn").hide(); } else { $(".CheckNewSectionOff").hide(); $('.headerInputbox a[href*="preload=Template%3A权限申请%2F"]').attr("target", "_self"); } if ($(".AbusefilterWarningNoHttp")[0]) { $("#wpTextbox1").val($("#wpTextbox1").val().replace(/http:\/\/([a-z\d]+\.bilibili\.[a-z\d]+)/ig, "https://$1")); } // Customized File Insertion dialog // Copyright 2017 The Little Moe New LLC. All rights reserved. mw.loader.using(["oojs", "oojs-ui"]).then(function() { $("#wpTextbox1").on("wikiEditor-toolbar-doneInitialSections", function() { function FileInsertionDialog(config) { FileInsertionDialog.super.call(this, config); } OO.inheritClass(FileInsertionDialog, OO.ui.ProcessDialog); // Name FileInsertionDialog.static.name = "fileInsertionDialog"; FileInsertionDialog.static.title = mw.msg("wikieditor-toolbar-tool-file-title"); FileInsertionDialog.static.actions = [{ flags: "primary", label: mw.msg("wikieditor-toolbar-tool-file-insert"), action: "insert" }, { flags: "safe", label: mw.msg("wikieditor-toolbar-tool-file-cancel") }]; // Initialization FileInsertionDialog.prototype.initialize = function() { FileInsertionDialog.super.prototype.initialize.call(this); this.panel = new OO.ui.PanelLayout({ padded: true, expanded: false }); this.fileMetaContent = new OO.ui.FieldsetLayout(); this.alignmentContent = new OO.ui.FieldsetLayout(); this.formatContent = new OO.ui.FieldsetLayout(); this.fileNameInput = new OO.ui.TextInputWidget({ indicator: "required" }); this.fileNameField = new OO.ui.FieldLayout(this.fileNameInput, { label: mw.msg("wikieditor-toolbar-file-target"), align: "top" }); this.fileTitleInput = new OO.ui.TextInputWidget(); this.fileTitleField = new OO.ui.FieldLayout(this.fileTitleInput, { label: mw.msg("wikieditor-toolbar-file-caption"), align: "top" }); this.sizeInput = new OO.ui.TextInputWidget(); this.sizeField = new OO.ui.FieldLayout(this.sizeInput, { label: mw.msg("wikieditor-toolbar-file-size"), align: "top" }); this.fileMetaContent.addItems([this.fileNameField, this.fileTitleField, this.sizeField]); var alignOptionDefault = new OO.ui.ButtonOptionWidget({ data: "default", label: mw.msg("wikieditor-toolbar-file-default"), title: mw.msg("wikieditor-toolbar-file-default") }); var alignOptionNone = new OO.ui.ButtonOptionWidget({ data: "none", label: mw.msg("wikieditor-toolbar-file-format-none"), title: mw.msg("wikieditor-toolbar-file-format-none") }); var magicWords = mw.config.get("wgWikiEditorMagicWords"); var alignOptionMid = new OO.ui.ButtonOptionWidget({ data: "center", label: magicWords.img_center, title: magicWords.img_center }); var alignOptionLeft = new OO.ui.ButtonOptionWidget({ data: "left", label: magicWords.img_left, title: magicWords.img_left }); var alignOptionRight = new OO.ui.ButtonOptionWidget({ data: "right", label: magicWords.img_right, title: magicWords.img_right }); this.alignmentSelect = new OO.ui.ButtonSelectWidget({ items: [alignOptionNone, alignOptionDefault, alignOptionMid, alignOptionLeft, alignOptionRight] }); this.alignmentField = new OO.ui.FieldLayout(this.alignmentSelect, { label: mw.msg("wikieditor-toolbar-file-float"), align: "top" }); this.alignmentContent.addItems([this.alignmentField]); var formatOptionThumbnail = new OO.ui.ButtonOptionWidget({ data: "thumbnail", label: magicWords.img_thumbnail, title: magicWords.img_thumbnail }); var formatOptionFramed = new OO.ui.ButtonOptionWidget({ data: "framed", label: magicWords.img_framed, title: magicWords.img_framed }); var formatOptionFrameless = new OO.ui.ButtonOptionWidget({ data: "frameless", label: magicWords.img_frameless, title: magicWords.img_frameless }); var formatOptionNone = new OO.ui.ButtonOptionWidget({ data: "default", label: magicWords.img_none, title: magicWords.img_none }); this.formatSelect = new OO.ui.ButtonSelectWidget({ items: [formatOptionThumbnail, formatOptionFramed, formatOptionFrameless, formatOptionNone] }); this.formatField = new OO.ui.FieldLayout(this.formatSelect, { label: mw.msg("wikieditor-toolbar-file-format"), align: "top" }); this.formatContent.addItems([this.formatField]); this.panel.$element.append(this.fileMetaContent.$element); this.panel.$element.append(this.alignmentContent.$element); this.panel.$element.append(this.formatContent.$element); this.$body.append(this.panel.$element); this.fileNameInput.connect(this, { change: "onFileNameChange" }); }; // Specify the dialog height (or don"t to use the automatically generated height). FileInsertionDialog.prototype.getBodyHeight = function() { return this.panel.$element.outerHeight(true); }; // Name validation FileInsertionDialog.prototype.onFileNameChange = function(value) { this.actions.setAbilities({ insert: !!value.length }); }; // Default state initialization FileInsertionDialog.prototype.getSetupProcess = function(data) { data = data || {}; return FileInsertionDialog.super.prototype.getSetupProcess.call(this, data).next(function() { this.actions.setAbilities({ insert: false }); this.fileNameInput.setValue(""); this.fileTitleInput.setValue(""); this.sizeInput.setValue(""); this.alignmentSelect.selectItemByData("default"); this.formatSelect.selectItemByData("thumbnail"); }, this); }; // Context setup FileInsertionDialog.prototype.setContext = function(context) { this.editorContext = context; }; // Specify processes to handle the actions. FileInsertionDialog.prototype.getActionProcess = function(action) { if (action === "insert") { return new OO.ui.Process(function() { this.insertImage(); }, this); } // Fallback to parent handler return FileInsertionDialog.super.prototype.getActionProcess.call(this, action); }; // Handles image insertion. FileInsertionDialog.prototype.insertImage = function() { if (!this.editorContext) return; var fileName, caption, fileFloat, fileFormat, fileSize, fileTitle, options, fileUse, hasPxRgx = /.+px$/, magicWordsI18N = mw.config.get("wgWikiEditorMagicWords"); fileName = this.fileNameInput.getValue(); caption = this.fileTitleInput.getValue(); fileSize = this.sizeInput.getValue(); fileFloat = this.alignmentSelect.getSelectedItem().data; fileFormat = this.formatSelect.getSelectedItem().data; // Append px to end to size if not already contains it if (fileSize !== "" && !hasPxRgx.test(fileSize)) { fileSize += "px"; } if (fileName !== "") { fileTitle = new mw.Title(fileName); // Append file namespace prefix to filename if not already contains it if (fileTitle.getNamespaceId() !== 6) { fileTitle = new mw.Title(fileName, 6); } fileName = fileTitle.toText(); } options = [fileSize, fileFormat, fileFloat]; // Filter empty values options = $.grep(options, function(val) { return val.length && val !== "default"; }); if (caption.length) { options.push(caption); } fileUse = options.length === 0 ? fileName : fileName + "|" + options.join("|"); $.wikiEditor.modules.toolbar.fn.doAction(this.editorContext, { type: "replace", options: { pre: "[[", peri: fileUse, post: "]]", ownline: true } }); this.close(); }; }); }); });
返回
MediaWiki:Common.js
。
导航菜单
个人工具
中文
未登录
讨论
贡献
创建账号
登录
命名空间
消息
讨论
English
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
随机页面
最新图片
最近更改
讨论版
所有日志
分类
色情
政治
人物
帮助
沙盒
创建新条目
请求创建条目
交流社群
WIKI指南
帮助
工具
链入页面
相关更改
特殊页面
页面信息