跳转到内容

MediaWiki:Gadget-libOOUIDialog.js

来自萌娘共享
AnnAngela-dbot留言 | 贡献2025年7月26日 (六) 00:12的版本 (代码变动:103d1a56 - feat: rename (#594) by U:AnnAngela, co-authored-by: GH:github-actions[bot])
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
/**
 * -------------------------------------------------------------------------
 * !!! DON'T MODIFY THIS PAGE MANUALLY, YOUR CHANGES WILL BE OVERWRITTEN !!!
 * -------------------------------------------------------------------------
 */
var _addText = '{{GHIACode|page=GHIA:MoegirlPediaInterfaceCodes/blob/master/src/gadgets/libOOUIDialog/Gadget-libOOUIDialog.js|user=[[U:AnnAngela]]|co-authors=GH:github-actions[bot]|longId=103d1a563ea4ccc8ff29fb55c9bcd88329a56eb5|shortId=103d1a56|summary=feat: rename (#594)|body=<nowiki>Co-authored-by: github-actions[bot] <41898282+github-actions[bot]📧users.noreply.github.com></nowiki>}}'; 

/* <pre> */

"use strict";(()=>{let t=!1;const e=[],n=["small","medium","large","larger"];window.oouiDialog=Object.fromEntries(["alert","confirm","prompt"].map(l=>[l,async(a,i)=>{const r=$.isPlainObject(i)?i:{},o={size:"medium"};if(!0!==r.allowFullscreen){const{rect:t}=OO.ui.Element.static.getDimensions(window),e=t.right-t.left,l=n.filter(t=>OO.ui.WindowManager.static.sizes[t].width<e);o.size=n.includes(r.size)&&l.length>0?l.includes(r.size)?r.size:l[l.length-1]:"small"}else o.size=[...n,"full"].includes(r.size)?r.size:"small";if("prompt"===l){const t=$.extend({autocomplete:!1},$.isPlainObject(r.textInput)?r.textInput:{});o.textInput=new OO.ui.TextInputWidget(t),r.required&&(o.textInput.setIndicator(t.indicator||"required"),o.textInput.setValidation(t.validate||"non-empty"))}await new Promise(n=>{t?e.push(n):(t=!0,n())});try{let t;for(;Number.MAX_SAFE_INTEGER>Number.MIN_SAFE_INTEGER;){t=await OO.ui[l](a instanceof $?a:$("<p>").html(a),$.extend({title:"萌娘百科提醒您"},r,o));try{o.textInput&&null!==t&&await o.textInput.getValidity();break}catch{await OO.ui.alert($("<p>").html("您没有在刚才的输入框内填写符合要求的信息,请重新填写!"),$.extend({},r,o,{title:"未填写符合要求的信息",textInput:null}));continue}}return t}finally{e.length>0?e.shift()():t=!1}}]));const l=$("<span>");window.oouiDialog.sanitize=t=>l.text(t).html()})(); 

/* </pre> */