User:Jonathan5566/js/inpageedit.js

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
//from 使用者:機智的小魚君/InPageEdit @https://cdn.jsdelivr.net/npm/mediawiki-inpageedit@latest/dist/InPageEdit.js@2021/8/7
/**
 * Minified by jsDelivr using Terser v5.3.5.
 * Original file: /npm/mediawiki-inpageedit@14.1.8/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
/**
 * @license GPL-3.0 GNU GENERAL PUBLIC LICENSE 3.0
 *
 * @name InPageEdit
 * @description A useful MediaWiki JavaScript Plugin written with jQuery
 * @author 机智的小鱼君 Dragon-Fish <dragon-fish@qq.com>
 * @url https://github.com/Dragon-Fish/InPageEdit-v2
 */

(()=>{var e={619:e=>{const t=((i=document.currentScript.src.split("/")).pop(),i.pop(),i=i.join("/"));var i;e.exports=t},185:e=>{var t=new mw.Api;e.exports={getUserInfo:function(){t.getUserInfo().then((e=>{console.info("[InPageEdit] 成功获取用户权限信息"),mw.config.set("wgUserRights",e.rights)}),(e=>{console.warn("[InPageEdit] 警告:无法获取用户权限信息",e),mw.config.set("wgUserRights",[])})),null!==mw.config.get("wgUserName")&&t.get({action:"query",list:"users",usprop:"blockinfo",ususers:mw.config.get("wgUserName")}).then((e=>{e.query.users[0].blockid?mw.config.set("wgUserIsBlocked",!0):mw.config.set("wgUserIsBlocked",!1)}))}}},67:(e,t,i)=>{const a=i(619),{loadScript:n}=i(719),{getUserInfo:o}=i(185),{loadStyles:s}=i(500),{updateNotice:r}=i(458),{syncI18nData:l}=i(407),d=i(547);e.exports=async function(){mw.hook("InPageEdit.init.before").fire(),await mw.loader.using(["mediawiki.api","mediawiki.util","mediawiki.user"]);const e=Boolean("nocache"===mw.util.getParamValue("ipe",location.href)||d!==localStorage.getItem("InPageEditVersion"));s(e),await l(e),mw.hook("InPageEdit.init.i18n").fire({_msg:i(133)._msg}),await n(a+"/src/ssi_modal/ssi-modal.min.js"),mw.hook("InPageEdit.init.modal").fire({ssi_modal:window.ssi_modal});const{_analysis:t}=i(616),{_msg:c}=i(133),{about:p}=i(15),f=i(342),{articleLink:m}=i(463),{findAndReplace:g}=i(775),{loadQuickDiff:u}=i(780),{preference:h}=i(511),{pluginStore:b}=i(188),{progress:v}=i(562),{quickDelete:w}=i(758),{quickDiff:$}=i(179),{quickEdit:k}=i(790),{quickPreview:y}=i(795),{quickRedirect:x}=i(201),{quickRename:_}=i(100),{specialNotice:P}=i(871),{versionInfo:I}=i(209);h.set(),o(),u(),m(),r(),b.initUserPlugin();var N={_dir:a,about:p,api:f,articleLink:m,findAndReplace:g,loadQuickDiff:u,preference:h,progress:v,quickDelete:w,quickDiff:$,quickEdit:k,quickPreview:y,quickRedirect:x,quickRename:_,specialNotice:P,version:d,versionInfo:I,fnr:g,delete:w,diff:$,edit:k,preview:y,redirect:x,quickMove:_,rename:_};return["_dir","api","version"].forEach((e=>{try{Object.freeze(N[e])}catch(e){}})),mw.hook("InPageEdit").fire({_analysis:t,_msg:c,InPageEdit:N}),console.info("    ____      ____                   ______    ___ __ \n   /  _/___  / __ \\____ _____ ____  / ____/___/ (_) /_\n   / // __ \\/ /_/ / __ `/ __ `/ _ \\/ __/ / __  / / __/\n _/ // / / / ____/ /_/ / /_/ /  __/ /___/ /_/ / / /_  \n/___/_/ /_/_/    \\__,_/\\__, /\\___/_____/\\__,_/_/\\__/  \n                      /____/                v"+d),N}},719:e=>{e.exports={loadScript:function(e,t){return $.ajax({url:e,dataType:"script",crossDomain:!0,cache:!t})}}},500:(e,t,i)=>{const a=i(619);e.exports={loadStyles:function(e){["/src/skin/ipe-default.min.css","/src/ssi_modal/ssi-modal.min.css","https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css"].forEach((t=>{!0!==/^https?:\/\//.test(t)&&(t=a+t),e&&(t+="?timestamp"+(new Date).getTime()),$("head").prepend($("<link>",{href:t,rel:"stylesheet","data-ipe":"style"}))}))}}},407:(e,t,i)=>{var a=mw.config.get();const n=i(619)+"/i18n/languages.json",o="i18n-cache-InPageEdit-content",s="i18n-cache-InPageEdit-timestamp";async function r(){console.time("[InPageEdit] 从远程获取 i18n 数据");var e=await $.getJSON(n,{cache:!1,timestamp:(new Date).getTime()});return"object"!=typeof e&&(e={}),function(e){const t=(new Date).getTime();e=JSON.stringify(e),localStorage.setItem(o,e),localStorage.setItem(s,t)}(e),console.timeEnd("[InPageEdit] 从远程获取 i18n 数据"),e}e.exports={syncI18nData:async function(e){const t=(new Date).getTime();if("qqx"===a.wgUserLanguage)return console.warn("[InPageEdit] User language is qqx"),!0;if(localStorage.getItem(o)&&t-localStorage.getItem(s)<72e5&&!e){var i={};try{i=JSON.parse(localStorage.getItem(o))}catch(e){return console.warn("[InPageEdit] i18n 数据不合法"),await r(),!0}return i.en||(console.warn("[InPageEdit] i18n 数据可能已损坏"),await r()),!0}return await r(),!0}}},458:(e,t,i)=>{const a=i(547),{_msg:n}=i(133),{versionInfo:o}=i(209),{specialNotice:s}=i(871);e.exports={updateNotice:function(){localStorage.getItem("InPageEditVersion")!==a&&ssi_modal.notify("",{title:n("updatelog-update-success-title"),content:n("updatelog-update-success",a),className:"in-page-edit",buttons:[{className:"btn btn-primary",label:n("updatelog-button-versioninfo"),method(e,t){localStorage.setItem("InPageEditVersion",a),o(),t.close()}}],closeAfter:{time:10,resetOnHover:!0},onClose(){localStorage.setItem("InPageEditVersion",a)}}),localStorage.getItem("InPageEditNoticeId")!==n("noticeid")&&s()}}},616:(e,t,i)=>{var a=mw.config.get(),n=i(342);e.exports={_analysis:function(e){InPageEdit.doNotCollectMyInfo;var t={url:a.wgServer+a.wgArticlePath.replace("$1",""),sitename:a.wgSiteName,username:a.wgUserName,function:e};$.ajax({url:`${n.analysisApi}/submit`,data:t,type:"post",dataType:"json"}).done((function(e){console.log("[InPageEdit] Analysis response","Status: "+e.status,e.msg)}))}}},37:e=>{var t="<br>",i="<hr>",a='<div class="ipe-progress" style="width: 100%"><div class="ipe-progress-bar"></div></div>';e.exports={$br:t,br:t,$hr:i,hr:i,$progress:a,progress:a}},258:e=>{var t=mw.config.get();e.exports={_hasRight:function(e){return!0!==t.wgUserIsBlocked&&mw.config.get("wgUserRights").indexOf(e)>-1}}},133:e=>{const t=mw.config.get("wgUserLanguage"),i={ab:"ru",ace:"id",aln:"sq",als:"gsw",an:"es",anp:"hi",arn:"es",arz:"ar",av:"ru",ay:"es",ba:"ru",bar:"de","bat-smg":"sgs",bcc:"fa","be-x-old":"be-tarask",bh:"bho",bjn:"id",bm:"fr",bpy:"bn",bqi:"fa",bug:"id","cbk-zam":"es",ce:"ru",ckb:"ckb-arab",crh:"crh-latn","crh-cyrl":"ru",csb:"pl",cv:"ru","de-at":"de","de-ch":"de","de-formal":"de",dsb:"de",dtp:"ms",eml:"it",ff:"fr","fiu-vro":"vro",frc:"fr",frp:"fr",frr:"de",fur:"it",gag:"tr",gan:"gan-hant","gan-hans":"zh-hans","gan-hant":"zh-hant",gl:"pt",glk:"fa",gn:"es",gsw:"de",hif:"hif-latn",hsb:"de",ht:"fr",ii:"zh-cn",inh:"ru",iu:"ike-cans",jut:"da",jv:"id",kaa:"kk-latn",kbd:"kbd-cyrl","kbd-cyrl":"ru",khw:"ur",kiu:"tr",kk:"kk-cyrl","kk-arab":"kk-cyrl","kk-cn":"kk-arab","kk-kz":"kk-cyrl","kk-latn":"kk-cyrl","kk-tr":"kk-latn",kl:"da",koi:"ru","ko-kp":"ko",krc:"ru",ks:"ks-arab",ksh:"de",ku:"ku-latn","ku-arab":"ckb",kv:"ru",lad:"es",lb:"de",lbe:"ru",lez:"ru",li:"nl",lij:"it",liv:"et",lmo:"it",ln:"fr",ltg:"lv",lzz:"tr",mai:"hi","map-bms":"jv",mg:"fr",mhr:"ru",min:"id",mo:"ro",mrj:"ru",mwl:"pt",myv:"ru",mzn:"fa",nah:"es",nap:"it",nds:"de","nds-nl":"nl","nl-informal":"nl",no:"nb",os:"ru",pcd:"fr",pdc:"de",pdt:"de",pfl:"de",pms:"it","pt-br":"pt",qu:"es",qug:"qu",rgn:"it",rmy:"ro",rue:"uk",ruq:"ruq-latn","ruq-cyrl":"mk","ruq-latn":"ro",sa:"hi",sah:"ru",scn:"it",sg:"fr",sgs:"lt",shi:"ar",simple:"en",sli:"de",sr:"sr-ec",srn:"nl",stq:"de",su:"id",szl:"pl",tcy:"kn",tg:"tg-cyrl",tt:"tt-cyrl","tt-cyrl":"ru",ty:"fr",udm:"ru",ug:"ug-arab",uk:"ru",vec:"it",vep:"et",vls:"nl",vmf:"de",vot:"fi",vro:"et",wa:"fr",wo:"fr",wuu:"zh-hans",xal:"ru",xmf:"ka",yi:"he",za:"zh-hans",zea:"nl",zh:"zh-hans","zh-classical":"lzh","zh-cn":"zh-hans","zh-hant":"zh-hans","zh-hk":"zh-hant","zh-min-nan":"nan","zh-mo":"zh-hk","zh-my":"zh-sg","zh-sg":"zh-hans","zh-tw":"zh-hant","zh-yue":"yue"};function a(e,t,i,a){return t=t||e,e=i?e:mw.util.getUrl(e),t=mw.html.escape(t),'<a href="'+(e=mw.html.escape(e))+'" title="'+t+'"'+(a=a?'target="_blank"':"")+">"+t+"</a>"}function n(e,...t){return(i=e=function(e,...t){return t.forEach((function(t,i){var a=new RegExp("\\$"+(i+1),"g");e=e.replace(a,t)})),e}(e,...t)).indexOf("<")>-1&&(n=i,o=document.implementation.createHTMLDocument(""),s=$.parseHTML(n,o,!1),r=$("<div>",o).append(s),l=["title","style","class"],d=["b","br","code","del","em","i","s","strong","span"],r.find("*").each((function(){var e,t,i=$(this),a=i.prop("tagName").toLowerCase();if(-1===d.indexOf(a))return mw.log("[I18n-js] Disallowed tag in message: "+a),void i.remove();e=i.prop("attributes"),Array.prototype.slice.call(e).forEach((function(e){if(-1===l.indexOf(e.name))return mw.log("[I18n-js] Disallowed attribute in message: "+e.name+", tag: "+a),void i.removeAttr(e.name);"style"===e.name&&((t=i.attr("style")).indexOf("url(")>-1?(mw.log("[I18n-js] Disallowed url() in style attribute"),i.removeAttr("style")):t.indexOf("var(")>-1&&(mw.log("[I18n-js] Disallowed var() in style attribute"),i.removeAttr("style")))}))})),i=r.prop("innerHTML")),i.replace(/\[((?:https?:)?\/\/.+?) (.+?)\]/g,(function(e,t,i){return a(t,i,!0,!0)})).replace(/\[\[([^|]*?)\]\]/g,(function(e,t){return a(t)})).replace(/\[\[(.+?)\|(.+?)\]\]/g,(function(e,t,i){return a(t,i)})).replace(/\{\{PLURAL:(\d+)\|(.+?)\}\}/gi,(function(e,t,i){return mw.language.convertPlural(Number(t),i.split("|"))})).replace(/\{\{GENDER:([^|]+)\|(.+?)\}\}/gi,(function(e,t,i){return mw.language.gender(t,i.split("|"))}));var i,n,o,s,r,l,d}function o(e,t,...a){const s=localStorage.getItem("i18n-cache-InPageEdit-content")||"{}";if("qqx"===e){var r="";return a.length>0&&(r=": "+a.join(", ")),`(${"InPageEdit".toLowerCase()}-${t}${r})`}var l=function(e){try{return JSON.parse(e)}catch(e){return{}}}(s),d=(window.InPageEdit||{}).i18n||{};return d[e]&&d[e][t]?n(d[e][t],...a):d[t]?n(d[t],...a):l[e]&&l[e][t]?n(l[e][t],...a):"en"===e?`<InPageEdit-${t}>`:o(e=i[e]||"en",t,...a)}e.exports={_msg:function(e,...i){return o(t,e,...i)}}},781:(e,t,i)=>{const{_msg:a}=i(133),{_hasRight:n}=i(258),{quickDelete:o}=i(758),{quickEdit:s}=i(790);e.exports={_resolveExists:function(e,t={}){var i=n("delete");"string"==typeof t&&(t={delete:t,edit:t}),ssi_modal.show({className:"in-page-edit resovle-exists",sizeClass:"dialog",center:!0,outSideClose:!1,title:a("target-exists-title"),content:a(i?"target-exists-can-delete":"target-exists-no-delete",e),buttons:[{className:"btn btn-danger btn-exists-delete-target",label:a("quick-delete"),method(i,a){a.close(),o(e,t.delete||null)}},{className:"btn btn-primary",label:a("quick-edit"),method(){s({page:e,summary:t.edit?"[InPageEdit] "+t:null,reload:!1})}},{className:"btn btn-secondary"+(i?" btn-single":""),label:a("cancel"),method:(e,t)=>{t.close()}}],onShow:()=>{i||$(".btn-exists-delete-target").hide()}})}}},15:(e,t,i)=>{const{_msg:a}=i(133),n=i(342);e.exports={about:function(){ssi_modal.show({title:a("preference-about-label"),className:"in-page-edit in-page-edit-about",content:$("<section>").append($("<iframe>",{style:"margin: 0;padding: 0;width: 100%;height: 80vh;border: 0;",src:n.aboutUrl}))})}}},342:e=>{"use strict";e.exports=JSON.parse('{"aboutUrl":"https://ipe.js.org/","analysisApi":"https://analysis.ipe.wjghj.cn/api","analysisUrl":"https://blog.wjghj.cn/inpageedit-v2/analysis/","githubLink":"https://github.com/InPageEdit/InPageEdit","pluginCDN":"https://ipe-plugins.js.org","pluginGithub":"https://github.com/InPageEdit/InPageEdit-Plugins","specialNotice":"https://ipe-plugins.js.org/specialNotice.json","updatelogsUrl":"https://ipe.js.org/update/"}')},463:(e,t,i)=>{var a=mw.config.get();const{_msg:n}=i(133),{preference:o}=i(511),{quickEdit:s}=i(790),{getParamValue:r}=mw.util;e.exports={articleLink:function(e){void 0===e&&(e=!0===o.get("redLinkQuickEdit")?$("#mw-content-text a"):$("#mw-content-text a:not(.new)")),e=$(e),$.each(e,(function(e,t){var i=$(t);if(void 0!==i.attr("href")){var o=i.attr("href"),l=r("action",o)||r("veaction",o),d=r("title",o),c=r("section",o)?r("section",o).replace(/T-/,""):null,p=r("oldid",o);(RegExp("^"+a.wgServer).test(o)||RegExp("^/").test(o))&&(null===d&&(d=(d=(d=o.replace(a.wgServer,"")).split("?")[0]).replace(a.wgArticlePath.replace("$1",""),"")),"edit"===l&&void 0!==d&&i.addClass("ipe-articleLink-resolved").after($("<span>",{class:"in-page-edit-article-link-group"}).append($("<a>",{href:"javascript:void(0)",class:"in-page-edit-article-link",text:n("quick-edit")}).click((function(){var e={};e.page=decodeURI(d),null!==p?e.revision=p:null!==c&&(e.section=c),a.wgIsArticle||(e.reload=!1),s(e)})))))}}))}}},775:(e,t,i)=>{const{_msg:a}=i(133),{$br:n}=i(37);e.exports={findAndReplace:function(e){void 0===e&&(e=$(".in-page-edit.ipe-editor:last .editArea"));var t=e.val();ssi_modal.show({className:"in-page-edit",sizeClass:"dialog",center:!0,outSideClose:!1,title:a("fAndR-title"),content:$("<div>",{class:"module far-module"}).append($("<div>",{class:"module_content",id:"findfielddiv"}).append($("<section>").append($("<h4>",{text:a("fAndR-find-text")}),$("<textarea>",{id:"find_this",style:"margin: 0",rows:4}),$("<h4>",{text:a("fAndR-replace-text")}),$("<textarea>",{id:"replace_with",style:"margin: 0",rows:4})),$("<section>",{style:"padding: 7px 0"}).append($("<label>").append($("<input>",{type:"checkbox",id:"globl",checked:""}),$("<span>",{text:a("fAndR-globl")})),n,$("<label>").append($("<input>",{type:"checkbox",id:"case_sen"}),$("<span>",{text:a("fAndR-case-sen")})),n,$("<label>").append($("<input>",{type:"checkbox",id:"regex_search"}),$("<span>",{text:a("fAndR-enable-regex")}))))),buttons:[{label:a("fAndR-button-undo"),className:"btn btn-danger",method(){e.val(t),ssi_modal.notify("info",{className:"in-page-edit",title:a("notify-info"),content:a("notify-fAndR-undo")})}},{className:"btn btn-primary",label:a("fAndR-button-replace"),method(){if(""!==$("#find_this").val()){var t,i,n=e,o=$("#replace_with").val().replace(/\r/gi,""),s=n.val().replace(/\r/gi,""),r="g",l="i",d=0;!1===$("#globl").prop("checked")&&(r=""),!0===$("#case_sen").prop("checked")&&(l=""),!0===$("#regex_search").prop("checked")&&(d=1);var c=r+l+"m";i=1===d?$("#find_this").val():$("#find_this").val().replace(/\r/gi,"").replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),t=new RegExp(i,c);var p=0,f=s.match(t);null!==f&&(p=f.length),s=s.replace(t,o),n.val(s),ssi_modal.notify("success",{className:"in-page-edit",title:a("notify-success"),content:a("notify-fAndR-done",p)})}}}]})}}},780:(e,t,i)=>{var a=mw.config.get();const{_msg:n}=i(133),{_analysis:o}=i(616),{quickDiff:s}=i(179);e.exports={loadQuickDiff:function(){function e(){$(".mw-changeslist-groupdiff, .mw-changeslist-diff, .mw-changeslist-diff-cur, .mw-history-histlinks a").unbind("click",e);var e=$(".mw-changeslist-groupdiff, .mw-changeslist-diff, .mw-changeslist-diff-cur, .mw-history-histlinks a").click((function(e){e.preventDefault(),o("quick_diff_recentchanges");var t=$(this).attr("href"),i=mw.util.getParamValue("diff",t),a=mw.util.getParamValue("curid",t),n=mw.util.getParamValue("oldid",t);s("0"===i?{fromrev:n,toid:a}:"prev"===i||"next"===i||"cur"===i?{fromrev:n,torelative:i}:{fromrev:n,torev:i})}))}$(".mw-rcfilters-enabled").length>0?(setInterval(e,500),$(".mw-rcfilters-enabled").addClass("ipe-continuous-active")):e(),"history"===a.wgAction&&($(".historysubmit.mw-history-compareselectedversions-button").after($("<button>").text(n("quick-diff")).click((function(e){e.preventDefault(),o("quick_diff_history_page");var t=$(".selected.before").attr("data-mw-revid"),i=$(".selected.after").attr("data-mw-revid");s({fromrev:i,torev:t})}))),$("[data-mw-revid]").each((function(){var e=$(this),t=e.attr("data-mw-revid");e.find(".mw-history-undo").after($("<span>").html(' | <a class="in-page-edit-article-link" href="javascript:void(0);" onclick="InPageEdit.quickEdit({page:mw.config.get(\'wgPageName\'),revision:'+t+'});">'+n("quick-edit")+"</a>"))})))}}},188:(e,t,i)=>{const a=i(342).pluginCDN;var n={get:()=>$.ajax({url:a+"/index.json",dataType:"json",crossDomain:!0,cache:!1}),saveCache(e){var t=window.InPageEdit||{};t.cache=t.cache||{},t.cache.pluginList=e,window.InPageEdit=t},loadCache(){var e=window.InPageEdit||{};return e.cache=e.cache||{},e.cache.pluginList},load(e){if(/^https?:\/\//.test(e))mw.loader.load(e),console.info("[InPageEdit] 从远程加载非官方插件",e);else{const{loadScript:t}=i(719);t(a+"/plugins/"+e).then((()=>console.info("[InPageEdit] 插件 "+e+" 加载成功")),(t=>console.warn("[InPageEdit] 插件 "+e+" 加载失败",t))),console.info("[InPageEdit] 从官方插件商店加载插件",e)}},initUserPlugin(){const{preference:e}=i(511);var t=e.get("plugins");"object"==typeof t&&t.length>0&&$.each(t,((e,t)=>{n.load(t)}))}};e.exports={pluginStore:n}},511:(e,t,i)=>{var a=window.InPageEdit||{},n=mw.config.get();const{_analysis:o}=i(616),{_msg:s}=i(133),{$br:r,$hr:l,$progress:d}=i(37),c=i(342),p=i(547),{pluginStore:f}=i(188),m=i(619);var g={default:{doNotCollectMyInfo:!1,doNotShowLocalWarn:!1,editMinor:!1,editSummary:s("preference-summary-default"),lockToolBox:!1,redLinkQuickEdit:!0,outSideClose:!0,watchList:Boolean(mw.user.options.get("watchdefault")),plugins:["toolbox.js"]},get(e){var t=localStorage.getItem("InPageEditPreference")||"{}";try{t=JSON.parse(t)}catch(e){t={}}"object"==typeof a.myPreference&&(t=$.extend({},t,a.myPreference));var i=$.extend({},g.default,t);return"string"==typeof e&&""!==e?i[e]?i[e]:null:i},set(e={},t){var i={};if("string"==typeof e&&void 0!==t)i[e]=t;else{if("object"!=typeof e)return;i=e}i=$.extend({},g.get(),i),i=JSON.stringify(i),localStorage.setItem("InPageEditPreference",i)},modal(){if(!($("#ipe-preference-form").length>0)){mw.hook("pluginPreference").fire(),g.set();var e=g.get();o("plugin_setting");var t=$("<ul>",{class:"tab-list"}).append($("<li>").append($("<a>",{text:s("preference-tab-editor"),href:"#editor"})),$("<li>").append($("<a>",{text:s("preference-tab-plugin"),href:"#plugin"})),$("<li>").append($("<a>",{text:s("preference-tab-analysis"),href:"#analysis"})),$("<li>").append($("<a>",{text:s("preference-tab-another"),href:"#another"})),$("<li>").append($("<a>",{text:s("preference-tab-about"),href:"#about"}))),i=$("<div>",{class:"tab-content",style:"position: relative;"}).append($("<section>",{id:"editor"}).append($("<h3>",{text:s("preference-editor-title")}),$("<h4>",{text:s("preference-editHobits-label")}),$("<label>").append($("<input>",{type:"checkbox",id:"editMinor"}),$("<span>",{text:s("preference-setMinor")})),$("<label>").append($("<input>",{type:"checkbox",id:"watchList"}),$("<span>",{text:s("preference-watchList")})),$("<label>").append($("<input>",{type:"checkbox",id:"outSideClose"}),$("<span>",{text:s("preference-outSideClose")})),$("<h4>",{text:s("preference-summary-label")}),$("<label>",{for:"editSummary",style:"padding-left: 0; font-size: small",html:s("preference-editSummary")}),$("<input>",{id:"editSummary",style:"width: 96%",placeholder:"Edit via InPageEdit, yeah~"})),$("<section>",{id:"plugin"}).append($("<h3>",{text:s("preference-plugin-title")}),$("<div>",{id:"plugin-container",html:$(d).css({width:"96%",position:"absolute",top:"50%",transform:"translateY(-50%)"})}),$("<div>",{class:"plugin-footer"}).html(s("preference-plugin-footer",c.pluginGithub))),$("<section>",{id:"analysis"}).append($("<h3>",{text:s("preference-analysis-title")}),$("<div>",{id:"analysis-container",html:$(d).css({width:"96%",position:"absolute",top:"50%",transform:"translateY(-50%)"})})),$("<section>",{id:"another"}).append($("<h3>",{text:s("preference-another-title")}),$("<h4>",{text:s("preference-display-label")}),$("<label>").append($("<input>",{type:"checkbox",id:"redLinkQuickEdit"}),$("<span>",{text:s("preference-redLinkQuickEdit")})),$("<div>").append($("<h4>",{text:"Custom skin (Not available yet)"}),$("<label>",{class:"choose-skin"}).append($("<input>",{type:"checkbox",id:"useCustomSkin",disabled:!0}),$("<span>"),$("<input>",{id:"skinUrl",disabled:!0,style:"width: calc(96% - 30px)",value:m+"/src/skin/ipe-default.css"}))),$("<h4>",{text:s("preference-savelocal-popup-title")}),$("<button>",{class:"btn btn-secondary",id:"ipeSaveLocalShow",text:s("preference-savelocal-btn")}).click((function(){var e=$("<section>").append(s("preference-savelocal-popup"),r,$("<textarea>",{style:"font-size: 12px; resize: none; width: 100%; height: 10em;",readonly:!0}).click((function(){this.select()})).val("/** InPageEdit Preferences **/\nwindow.InPageEdit = window.InPageEdit || {}; // Keep this line\nInPageEdit.myPreference = "+JSON.stringify(u.data(),null,2)));ssi_modal.dialog({className:"in-page-edit",center:!0,title:s("preference-savelocal-popup-title"),content:e,okBtn:{className:"btn btn-primary btn-single",label:s("ok")}})}))),$("<section>",{id:"about"}).append($("<h3>",{text:s("preference-about-label")}),$("<div>",{style:"font-size: 12px; font-style: italic;"}).html((function(){var e=/(alpha|beta|pre)/i.test(p);return"v"+p+(e?" - You are running the Canary version of InPageEdit<br>"+s("version-notice-canary"):"")})),$("<button>",{class:"btn btn-secondary btn-single",onclick:"InPageEdit.about()",text:s("preference-aboutAndHelp")}),$("<button>",{class:"btn btn-secondary btn-single",style:"margin-top: .5em;",onclick:"InPageEdit.versionInfo()",text:s("preference-updatelog")}),$("<a>",{href:"https://ipe.miraheze.org/wiki/",target:"_blank",style:"margin-top: .5em; display: block;"}).append($("<button>",{class:"btn btn-secondary btn-single",text:s("preference-translate")})),$("<a>",{href:"https://discord.gg/VUVAh8w",target:"_blank",style:"margin-top: .5em; display: block;"}).append($("<button>",{class:"btn btn-secondary btn-single",text:s("preference-discord")})),l,$("<p>",{text:"InPageEdit is a useful MediaWiki JavaScript Plugin written with jQuery"}),$("<p>").append("© InPageEdit Copyright (C)"," 2019 - "+(new Date).getFullYear()," Wjghj Project (机智的小鱼君), ",$("<a>",{href:"https://www.gnu.org/licenses/gpl-3.0-standalone.html",text:"GNU General Public License 3.0"})))),u=$("<div>",{class:"preference-tabber"}).append(t,i);t.find("a").click((function(e){e.preventDefault();var a=$(this),n=a.attr("href");n&&(t.find("a").removeClass("active"),i.find("section").removeClass("active"),a.addClass("active"),i.find(""+n).addClass("active"))})),i.find("input").change((function(){var e,t=$(this),i=t.attr("id");e="checkbox"===t.prop("type")?t.prop("checked"):t.val(),u.data(i,e),console.log("[InPageEdit] Preset preference",u.data())})),t.find("a:first").addClass("active"),i.find("section:first").addClass("active"),ssi_modal.show({sizeClass:"dialog",className:"in-page-edit ipe-preference",outSideClose:!1,title:s("preference-title")+" - "+p,content:u,buttons:[{label:s("preference-reset"),className:"btn btn-danger",method:function(e,t){ssi_modal.confirm({title:s("preference-reset-confirm-title"),content:s("preference-reset-confirm"),className:"in-page-edit",center:!0,okBtn:{label:s("ok"),className:"btn btn-danger"},cancelBtn:{label:s("cancel"),className:"btn"}},(e=>{if(!e)return!1;g.set(g.default),t.close()}))}},{label:s("preference-save"),className:"btn btn-primary",method:function(e,t){g.set(u.data()),t.close()}}],onShow(o){var r=$("#"+o.modalId);mw.hook("InPageEdit.preference.modal").fire({$modal:o,$modalWindow:r}),void 0!==a.myPreference&&(r.find(".ssi-modalBtn.btn").attr({disabled:!0}),i.find("input").attr({disabled:!0}),t.before($("<div>",{class:"has-local-warn",style:"padding-left: 8px; border-left: 6px solid orange; font-size: small;",html:s("preference-savelocal-popup-haslocal")}))),$.each(e,((e,t)=>{if("plugins"!==e){var a=i.find("#"+e);a.length>0&&(u.data(e,t),"string"==typeof t&&a.val(t),"boolean"==typeof t&&a.prop("checked",t))}else u.data(e,t)}));var l=g.get("plugins"),d=f.loadCache();function p(e){i.find("#plugin-container").html($("<ul>")),$.each(e,((e,t)=>{var n=t.name||"Unknown",o=t.description||"",s=t.author?$("<a>",{href:"https://github.com/"+t.author,target:"_balnk",text:"@"+t.author}):"-";i.find("#plugin-container > ul").append($("<li>").append($("<label>").append($("<input>",{class:"plugin-checkbox",id:e,type:"checkbox",checked:Boolean(l.indexOf(e)>=0||!0===t._force),disabled:void 0!==a.myPreference||!0===t._force}).change((function(){var t=$(this).prop("checked"),i=u.data("plugins"),a=i.indexOf(e);t&&a<0&&i.push(e),!t&&a>=0&&i.splice(a,1),u.data("plugins",i)})),$("<span>"),$("<div>",{class:"plugin-name",text:n}),$("<div>",{class:"plugin-author",html:s}),$("<div>",{class:"plugin-description",text:o}))))}))}d?p(d):f.get().then((e=>{f.saveCache(e),p(e)}));var m=n.wgUserName;$.get(`${c.analysisApi}/query/wiki`,{siteurl:n.wgServer+n.wgArticlePath.replace("$1",""),prop:"users."+m+"._total|users."+m+".functions"}).then((e=>{i.find("#analysis-container").html("");var t=e.query[0].users[m],a=t._total,o=t.functions,r=$("<table>",{class:"wikitable",style:"width: 96%"}).append($("<tr>").append($("<th>",{text:"ID"}),$("<th>",{text:"Times"}),$("<th>",{text:"Percents"})));$.each(o,((e,t)=>{r.append($("<tr>").append($("<th>",{text:e}),$("<td>",{text:t}),$("<td>",{text:(t/a*100).toFixed(2)+"%"})))})),i.find("#analysis-container").append($("<h4>",{text:n.wgUserName+" - "+n.wgSiteName}),$("<p>").append(s("preference-analysis-totaluse",a)),r)}))}})}}};e.exports={preference:g}},562:(e,t,i)=>{const{_msg:a}=i(133),{$progress:n}=i(37);e.exports={progress:function(e){if(!0===e)$(".in-page-edit.loadingbox .ssi-modalTitle").html(a("done")),$(".in-page-edit.loadingbox .ipe-progress").addClass("done");else if(!1===e)$(".in-page-edit.loadingbox").length>0&&($(".in-page-edit.loadingbox").appendTo("body"),ssi_modal.close());else{if($(".in-page-edit.loadingbox").length>0)return;void 0===e&&(e="Loading..."),ssi_modal.show({title:e,content:n,className:"in-page-edit loadingbox",center:!0,sizeClass:"dialog",closeIcon:!1,outSideClose:!1})}}}},758:(e,t,i)=>{var a=new mw.Api,n=mw.config.get();const{_analysis:o}=i(616),{_msg:s}=i(133),{_hasRight:r}=i(258),{$br:l}=i(37);e.exports={quickDelete:function(e,t=""){var i;mw.hook("InPageEdit.quickDelete").fire(),console.log("Quick delete",e,t),e=e||n.wgPageName,ssi_modal.show({outSideClose:!1,className:"in-page-edit quick-delete",center:!0,sizeClass:"dialog",title:s("delete-title"),content:$("<div>").append($("<section>",{id:"InPageEditDeletepage"}).append($("<span>",{html:s("delete-reason","<b>"+e.replace(/_/g," ")+"</b>")}),l,$("<label>",{for:"delete-reason",text:s("editSummary")}),$("<input>",{id:"delete-reason",style:"width:96%",onclick:"$(this).css('box-shadow', '')",value:t}))),beforeShow:function(){if(!r("delete"))return ssi_modal.dialog({title:s("notify-no-right"),content:s("delete-no-right"),className:"in-page-edit quick-deletepage",center:!0,okBtn:{className:"btn btn-primary btn-single"}}),!1},buttons:[{label:s("cancel"),className:"btn btn-primary",method:function(e,t){t.close()}},{label:s("confirm"),className:"btn btn-danger",method:function(t,n){""!==(i=$("#InPageEditDeletepage #delete-reason").val())?(o("quick_delete"),ssi_modal.confirm({center:!0,className:"in-page-edit",title:s("delete-confirm-title"),content:s("delete-confirm-content"),okBtn:{label:s("confirm"),className:"btn btn-danger"},cancelBtn:{label:s("cancel"),className:"btn"}},(function(t){if(!t)return!1;i=s("delete-title")+" ("+i+")",a.postWithToken("csrf",{action:"delete",title:e,reason:i,format:"json"}).then((()=>{ssi_modal.notify("success",{className:"in-page-edit",title:s("notify-success"),content:s("notify-delete-success",e)})})).fail((function(e,t,i){ssi_modal.notify("error",{className:"in-page-edit",title:s("notify-error"),content:s("notify-delete-error")+': <br/><span style="font-size:amall">'+i.error["*"]+"(<code>"+i.error.code+"</code>)</span>"})})),n.close()}))):$("#InPageEditDeletepage #delete-reason").css("box-shadow","0 0 4px #f00")}}]})}}},179:(e,t,i)=>{var a=new mw.Api,n=mw.config.get();const{_analysis:o}=i(616),{_msg:s}=i(133),{$br:r,$progress:l}=i(37);var d=function(e){var t,c,p;mw.hook("InPageEdit.quickDiff").fire(),o("quick_diff"),$('[href*="mediawiki.diff.styles"]').length<1&&mw.loader.load(mw.util.wikiScript("load")+"?modules=mediawiki.legacy.shared|mediawiki.diff.styles&only=styles","text/css"),$(".quick-diff").length>0?(console.info("[InPageEdit] Quick diff 正在加载新内容"),t=$(".quick-diff .pageName"),c=$(".quick-diff .diffArea"),p=$(".quick-diff .ipe-progress"),t.text(s("diff-loading")),c.hide(),$(".quick-diff").appendTo("body")):(t=$("<span>",{class:"pageName",text:s("diff-loading")}),c=$("<div>",{class:"diffArea",style:"display: none"}),p=$(l),ssi_modal.show({className:"in-page-edit quick-diff",sizeClass:"large",fixedHeight:!0,fitScreen:!0,title:t,content:$("<div>").append(p,c),buttons:[{label:s("diff-button-todiffpage"),className:"btn btn-secondary toDiffPage"}]})),p.show().css("margin-top",$(".quick-diff .ssi-modalContent").height()/2),$(".quick-diff .toDiffPage").unbind(),e.action="compare",e.prop="diff|diffsize|rel|ids|title|user|comment|parsedcomment|size",e.format="json",e.totext?e.topst=!0:e.fromtext&&(e.frompst=!0),a.post(e).done((function(a){var l,f=a.compare["*"];function m(e){return'<a class="diff-user" href="'+mw.util.getUrl("User:"+e)+'">'+e+'</a> (<a href="'+mw.util.getUrl("User_talk:"+e)+'">'+s("diff-usertalk")+'</a> | <a href="'+mw.util.getUrl("Special:Contributions/"+e)+'">'+s("diff-usercontrib")+'</a> | <a href="'+mw.util.getUrl("Special:Block/"+e)+'">'+s("diff-userblock")+"</a>)"}p.hide(),l=void 0===e.pageName?a.compare.totitle:e.pageName,t.html(s("diff-title")+": <u>"+l+"</u>"),c.show().html("").append($("<table>",{class:"diff difftable"}).append($("<colgroup>").append($("<col>",{class:"diff-marker"}),$("<col>",{class:"diff-content"}),$("<col>",{class:"diff-marker"}),$("<col>",{class:"diff-content"})),$("<tbody>").append($("<tr>").append($("<td>",{colspan:2,class:"diff-otitle"}).append($("<a>",{href:n.wgScript+"?oldid="+a.compare.fromrevid,text:a.compare.fromtitle})," (",$("<span>",{class:"diff-version",text:s("diff-version")+a.compare.fromrevid}),") (",$("<a>",{class:"editLink",href:n.wgScript+"?action=edit&title="+a.compare.fromtitle+"&oldid="+a.compare.fromrevid,text:s("diff-edit")}),")",r,m(a.compare.fromuser),r," (",$("<span>",{class:"diff-comment",html:a.compare.fromparsedcomment}),") ",r,$("<a>",{class:"prevVersion ipe-analysis-quick_diff_modalclick",href:"javascript:void(0);",text:"←"+s("diff-prev")}).click((()=>{d({fromrev:a.compare.fromrevid,torelative:"prev"})}))),$("<td>",{colspan:2,class:"diff-ntitle"}).append($("<a>",{href:n.wgScript+"?oldid="+a.compare.torevid,text:a.compare.totitle})," (",$("<span>",{class:"diff-version",text:s("diff-version")+a.compare.torevid}),") (",$("<a>",{class:"editLink",href:n.wgScript+"?action=edit&title="+a.compare.totitle+"&oldid="+a.compare.torevid,text:s("diff-edit")}),")",r,m(a.compare.touser),r," (",$("<span>",{class:"diff-comment",html:a.compare.toparsedcomment}),") ",r,$("<a>",{class:"nextVersion ipe-analysis-quick_diff_modalclick",href:"javascript:void(0);",text:s("diff-nextv")+"→"}).click((()=>{o("quick_diff_modalclick"),d({fromrev:a.compare.torevid,torelative:"next"})})))),f,$("<tr>",{class:"diffSize",style:"text-align: center"}).append($("<td>",{colspan:"2",text:a.compare.fromsize+s("diff-bytes")}),$("<td>",{colspan:"2",text:a.compare.tosize+s("diff-bytes")}))))),$(".quick-diff button.toDiffPage").click((function(){location.href=n.wgScript+"?oldid="+a.compare.fromrevid+"&diff="+a.compare.torevid})),i(463).articleLink($(".quick-diff .editLink")),!0===e.isPreview&&($(".quick-diff button.toDiffPage").hide(),c.find(".diff-otitle").html("<b>"+s("diff-title-original-content")+"</b>"),c.find(".diff-ntitle").html("<b>"+s("diff-title-your-content")+"</b>")),void 0!==a.compare.fromsize&&void 0!==a.compare.tosize||c.find(".diffSize").hide(),void 0===a.compare.fromrevid&&!0!==e.isPreview?c.find(".diff-otitle").html('<span class="noPrevVerson">'+a.warnings.compare["*"]+"</span>"):void 0===a.compare.torevid&&!0!==e.isPreview&&c.find(".diff-ntitle").html('<span class="noNextVerson">'+a.warnings.compare["*"]+"</span>"),void 0!==a.compare.fromtexthidden&&c.find(".diff-otitle .diff-version").addClass("diff-hidden-history"),void 0!==a.compare.totexthidden&&c.find(".diff-ntitle .diff-version").addClass("diff-hidden-history"),void 0!==a.compare.fromuserhidden&&c.find(".diff-otitle .diff-user").addClass("diff-hidden-history"),void 0!==a.compare.touserhidden&&c.find(".diff-ntitle .diff-user").addClass("diff-hidden-history"),void 0!==a.compare.fromcommenthidden&&c.find(".diff-comment").addClass("diff-hidden-history"),void 0!==a.compare.tocommenthidden&&c.find(".diff-ntitle .diff-comment").addClass("diff-hidden-history"),a.error&&(console.warn("[InPageEdit] 快速差异获取时系统告知出现问题"),c.html(s("diff-error")+": "+a.error.info+"(<code>"+a.error.code+"</code>)"))})).fail((function(e,t){console.warn("[InPageEdit] 快速差异获取失败"),p.hide(),t.error&&t.error.info&&t.error.code?c.show().html(s("diff-error")+": "+t.error.info+"(<code>"+t.error.code+"</code>)"):c.show().html(s("diff-error"))}))};e.exports={quickDiff:d}},790:(e,t,i)=>{var a=new mw.Api,n=mw.config.get();const{_analysis:o}=i(616),{_msg:s}=i(133),{_hasRight:r}=i(258),{$br:l,$progress:d}=i(37),{findAndReplace:c}=i(775),{preference:p}=i(511),{progress:f}=i(562),{quickPreview:m}=i(795),{quickDiff:g}=i(179);var u=function(e){"string"==typeof(e=e||{})&&(e={page:e||n.wgPageName});var t={page:n.wgPageName,pageId:-1,revision:null,summaryRevision:"",section:null,editText:"",editMinor:!1,editSummary:s("preference-summary-default"),editNotice:"",outSideClose:!0,jsonGet:{action:"parse",page:e.page||n.wgPageName,prop:"wikitext|langlinks|categories|templates|images|sections",format:"json"},jsonPost:{},pageDetail:{},jumpTo:"",reload:!0},i=p.get(),h=new Date,b=h.getTime(),v=h.toUTCString();(e=$.extend({},t,e,i)).page=decodeURI(e.page),o("quick_edit"),e.revision&&e.revision!==n.wgCurRevisionId&&(ssi_modal.notify("warning",{className:"in-page-edit",content:s("notify-editing-history"),title:s("notify-info")}),delete e.jsonGet.page,e.jsonGet.oldid=e.revision,e.summaryRevision="("+s("editor-summary-rivision")+"[[Special:Diff/"+e.revision+"]])"),e.section&&(e.jsonGet.section=e.section);var w=$("<span>").append(s("editor-title-editing")+': <u class="editPage">'+e.page.replace(/_/g," ")+"</u>"),k=$("<div>",{class:"editTools"}).append($("<div>",{class:"btnGroup"}).append($("<div>",{class:"toolSelect"}).append($("<div>",{class:"label",text:s("editor-edittool-header")}),$("<ul>",{class:"ul-list"}).append($("<li>",{class:"editToolBtn","data-open":"\n== ","data-middle":s("editor-edittool-header-text"),"data-close":" ==\n",text:"H2"}),$("<li>",{class:"editToolBtn","data-open":"\n=== ","data-middle":s("editor-edittool-header-text"),"data-close":" ===\n",text:"H3"}),$("<li>",{class:"editToolBtn","data-open":"\n==== ","data-middle":s("editor-edittool-header-text"),"data-close":" ====\n",text:"H4"}),$("<li>",{class:"editToolBtn","data-open":"\n===== ","data-middle":s("editor-edittool-header-text"),"data-close":" =====\n",text:"H5"})))),$("<div>",{class:"btnGroup"}).append($("<span>",{class:"label",text:"格式"}),$("<button>",{class:"editToolBtn fa fa-bold btn","data-open":"'''","data-middle":s("editor-edittool-bold"),"data-close":"'''"}),$("<button>",{class:"editToolBtn fa fa-italic btn","data-open":"''","data-middle":s("editor-edittool-italic"),"data-close":"''"}),$("<button>",{class:"editToolBtn fa fa-list-ul btn","data-open":"\n* ","data-middle":s("editor-edittool-list-bulleted"),"data-close":"\n"}),$("<button>",{class:"editToolBtn fa fa-list-ol btn","data-open":"\n# ","data-middle":s("editor-edittool-list-numbered"),"data-close":"\n"}),$("<button>",{class:"editToolBtn fa fa-won btn","data-open":"<nowiki>","data-middle":s("editor-edittool-nowiki"),"data-close":"</nowiki>"}),$("<button>",{class:"editToolBtn fa fa-level-down fa-rotate-90 btn","data-open":"<br>\n","data-middle":"","data-close":""})),$("<div>",{class:"btnGroup"}).append($("<span>",{class:"label",text:"插入"}),$("<button>",{class:"editToolBtn fa fa-link btn","data-open":"[[","data-middle":s("editor-edittool-internal-link"),"data-close":"]]"}),$("<button>",{class:"editToolBtn fa fa-file-image-o btn","data-open":"[[File:","data-middle":"Example.png","data-close":"|thumb]]"}),$("<button>",{class:"editToolBtn btn","data-open":"\n<gallery>\n","data-middle":"Example1.jpg|Description\nExample2.png|Description","data-close":"\n</gallery>\n",html:'<span class="fa-stack"><i class="fa fa-picture-o fa-stack-1x"></i><i class="fa fa-picture-o fa-stack-1x" style="left: 2px;top: 2px;text-shadow: 1px 1px 0 #fff;"></i></span>'})),$("<div>",{class:"btnGroup extra",style:"display: none"}).append($("<span>",{class:"label",text:"自定义"})),$("<div>",{class:"btnGroup special-tools",style:"float: right"}).append($("<button>",{class:"btn fa fa-search"}).click((function(){c(y)})))),y=$("<textarea>",{class:"editArea",style:"margin-top: 0;"}),x=$("<div>",{class:"editOptionsLabel hideBeforeLoaded"}).append($("<aside>",{class:"detailArea"}).append($("<label>",{class:"detailToggle",text:s("editor-detail-button-toggle")}),$("<div>",{class:"detailBtnGroup"}).append($("<a>",{href:"javascript:;",class:"detailBtn",id:"showTemplates",text:s("editor-detail-button-templates")})," | ",$("<a>",{href:"javascript:;",class:"detailBtn",id:"showImages",text:s("editor-detail-button-images")}))),$("<label>",{for:"editSummary",text:s("editSummary")}),l,$("<input>",{class:"editSummary",id:"editSummary",placeholder:"Edit via InPageEdit~",value:e.editSummary.replace(/\$oldid/gi,e.summaryRevision)}),l,$("<label>").append($("<input>",{type:"checkbox",class:"editMinor",id:"editMinor",checked:e.editMinor}),$("<span>",{text:s("markAsMinor")})),l,$("<label>").append($("<input>",{type:"checkbox",class:"reloadPage",id:"reloadPage",checked:e.reload}),$("<span>",{text:s("editor-reload-page")}))),_=$("<div>").append(d,$("<section>",{class:"hideBeforeLoaded"}).append(k,y));console.time("[InPageEdit] 获取页面源代码"),console.info("[InPageEdit] QuickEdit start with options:"),console.table(e),ssi_modal.show({title:w,content:_,outSideClose:e.outSideClose,className:"in-page-edit ipe-editor timestamp-"+b,sizeClass:"large",buttons:[{side:"left",label:s("editor-button-save"),className:"btn btn-primary leftBtn hideBeforeLoaded save-btn",method(t,i){ssi_modal.confirm({className:"in-page-edit",center:!0,content:s("editor-confirm-save"),okBtn:{className:"btn btn-primary",label:s("confirm")},cancelBtn:{className:"btn btn-secondary",label:s("cancel")}},(function(t){if(t){var r=y.val(),l=x.find(".editMinor").prop("checked"),d=e.section,c=x.find(".editSummary").val();!function({text:t,page:i,minor:r,summary:l,section:d},c){function p(e,t,i){f(!1);var a,n=i||e,o="";void 0!==n.errors?(e=n.errors[0].code,a=n.errors[0]["*"],o=""):"Success"!==n.edit.result?(e=n.edit.code||"Unknown",a=n.edit.info||"Reason unknown.",o=n.edit.warning||""):(e="unknown",a="Reason unknown.",o="Please contact plug-in author or try again."),ssi_modal.show({className:"in-page-edit",sizeClass:"dialog",center:!0,title:s("editor-save-error"),content:a+'<hr style="clear: both" />'+o}),ssi_modal.notify("error",{className:"in-page-edit",position:"right top",closeAfter:{time:15},title:s("notify-error"),content:s("editor-save-error")+":<code>"+e+"</code>"}),console.error("[InPageEdit] Submit failed: \nCode: "+e)}o("quick_edit_save"),f(s("editor-title-saving")),e.jsonPost={action:"edit",basetimestamp:_.data("basetimestamp"),starttimestamp:v,text:t,title:i,minor:r,summary:l,errorformat:"plaintext"},void 0!==d&&""!==d&&null!==d&&(e.jsonPost.section=d,delete e.jsonPost.basetimestamp),a.postWithToken("csrf",e.jsonPost).done((function(t,a,o){var r;"Success"===t.edit.result?(f(!0),x.find(".reloadPage").prop("checked")?($(window).unbind("beforeunload"),r=s("notify-save-success"),setTimeout((function(){i===n.wgPageName?(window.location=mw.util.getUrl(i)+e.jumpTo,window.location.reload()):window.location.reload()}),500)):(console.info("[InPageEdit] 将不会重载页面!"),r=s("notify-save-success-noreload"),setTimeout((function(){f(!1),y.attr("data-confirmclose","true"),c.close()}),1500)),ssi_modal.notify("success",{className:"in-page-edit",position:"right top",title:s("notify-success"),content:r})):p(t,0,o)})).fail(p)}({text:r,page:e.page,minor:l,section:d,summary:c},i)}}))}},{side:"left",label:s("editor-button-preview"),className:"btn btn-secondary leftBtn hideBeforeLoaded",method(){o("preview_edit");var t=y.val();m({title:e.page,text:t,pst:!0})}},{side:"left",label:s("editor-button-diff"),className:"btn btn-secondary leftBtn hideBeforeLoaded diff-btn"},{label:s("cancel"),className:"btn btn-danger",method(e,t){t.close()}}],beforeShow(e){var t,i,a,n,o=$("#"+e.modalId);if(o.find(".hideBeforeLoaded").hide(),_.find(".ipe-progress").css("margin",Number($(window).height()/3-50)+"px 0"),y.css("height",$(window).height()/3*2-100),o.find(".ssi-buttons").prepend(x),o.find(".ssi-modalTitle").append($("<a>",{class:"showEditNotice",href:"javascript:void(0);",html:'<i class="fa fa-info-circle"></i> '+s("editor-has-editNotice"),style:"display: none;"}).click((function(){ssi_modal.show({className:"in-page-edit",center:!0,title:s("editor-title-editNotice"),content:'<section class="editNotice">'+_.data("editNotice")+"</section>"})}))),InPageEdit.buttons){var r=InPageEdit.buttons;k.find(".btnGroup.extra").show();for(var l=0;l<r.length;l++){var d=r[l];t=(t=d.open)||"",i=(i=d.middle)||"",a=(a=d.close)||"",n="fa-"+(n=d.text)||0,_.find(".btnGroup.extra").append($("<button>",{class:"editToolBtn btn","data-open":t,"data-middle":i,"data-close":a,html:`<i class="fa ${n}"></i>`}))}}k.find(".editToolBtn").click((function(e){e.preventDefault();var t=$(this);!function(e,t){var i=t||y[0],a=i.selectionStart,n=i.selectionEnd,o=i.value.slice(a,n);i.value=i.value.slice(0,a)+(e.open||"")+(o||e.middle||"")+(e.close||"")+i.value.slice(n);var s=a+(e.open.length||0);i.setSelectionRange(s,s+(o.length||e.middle.length||0)),i.focus()}({open:t.attr("data-open")||"",middle:t.attr("data-middle")||"",close:t.attr("data-close")||""},y[0])}))},onShow(t){var i=$("#"+t.modalId);function l(t){var l;e.pageDetail=t,t.error?(console.warn("[InPageEdit]警告:无法获取页面内容"),e.editText="\x3c!-- "+t.error.info+" --\x3e",e.pageId=-1,x.find(".detailArea").hide()):(e.editText=t.parse.wikitext["*"],e.pageId=t.parse.pageid),_.find(".ipe-progress").hide(),i.find(".hideBeforeLoaded").fadeIn(500),y.val(e.editText+"\n"),null!==e.section?(l=(l=x.find(".editSummary").val()).replace(/\$section/gi,"/* "+t.parse.sections[0].line+" */"),x.find(".editSummary").val(l),w.find(".editPage").after('<span class="editSection">→'+t.parse.sections[0].line+"</span>"),e.jumpTo="#"+t.parse.sections[0].anchor):(l=(l=x.find(".editSummary").val()).replace(/\$section/gi,""),x.find(".editSummary").val(l),e.jumpTo=""),null!==e.revision&&""!==e.revision&&e.revision!==n.wgCurRevisionId?(w.find(".editPage").after('<span class="editRevision">('+s("editor-title-editRevision")+":"+e.revision+")</span>"),i.find(".diff-btn").click((function(){o("quick_diff_edit");var t=y.val(),i={fromrev:e.revision,totext:t,hideBtn:!0,pageName:e.page,isPreview:!0};e.section&&(i.fromsection=e.section),g(i)}))):i.find(".diff-btn").attr("disabled",!0),console.time("[InPageEdit] 获取页面基础信息");var d={action:"query",prop:"revisions|info",inprop:"protection",format:"json"};function c(t){if(e.namespace=t.query.pages[e.pageId].ns,e.protection=t.query.pages[e.pageId].protection||[],t.query.pages[e.pageId].revisions&&(e.revision=t.query.pages[e.pageId].revisions[0].revid),e.page=t.query.pages[e.pageId].title,w.find(".editPage").text(e.page),e.revision&&i.find(".diff-btn").attr("disabled",!1).click((function(){o("quick_diff_edit");var t=y.val(),i={fromrev:e.revision,totext:t,hideBtn:!0,pageName:e.page,isPreview:!0};e.section&&(i.fromsection=e.section),g(i)})),e.protection.length>0)for(var l=0;l<e.protection.length;l++)"edit"===e.protection[l].type&&("autoconfirmed"===e.protection[l].level&&!r("autoconfirmed")||"sysop"===e.protection[l].level&&!r("editprotected")||8===n.wgNamespaceNumber&&!r("editinterface"))&&(ssi_modal.notify("dialog",{className:"in-page-edit",position:"center bottom",title:s("notify-no-right"),content:s("editor-no-right"),okBtn:{label:s("ok"),className:"btn btn-primary",method(e,t){t.close()}}}),i.find(".save-btn").addClass("btn-danger"));var d="Editnotice-"+e.namespace,c=d+"-"+e.page.replace(/_/g," ").replace(n.wgFormattedNamespaces[e.namespace]+":","");a.get({action:"query",meta:"allmessages",ammessages:d+"|"+c}).done((function(t){var i=t.query.allmessages[0]["*"]||"",n=t.query.allmessages[1]["*"]||"";""===i&&""===n||a.post({action:"parse",title:e.page,contentmodel:"wikitext",preview:!0,text:n+"\n"+i}).done((function(t){e.editNotice=t.parse.text["*"];var i=_.data("editNotice")||"";i+="\n"+e.editNotice,_.data("editNotice",i),_.find(".showEditNotice").show()}))}))}-1!==e.pageId?d.pageids=e.pageId:d.titles=e.page,a.get(d).done((function(t){console.info("[InPageEdit] 获取页面基础信息成功"),console.timeEnd("[InPageEdit] 获取页面基础信息"),_.data("basetimestamp",t.query.pages[e.pageId].revisions?t.query.pages[e.pageId].revisions[0].timestamp:v),c(t)})).fail((function(e,t,i){var a=i;console.timeEnd("[InPageEdit] 获取页面基础信息"),console.warn("[InPageEdit] 获取页面基础信息失败"),_.data("basetimestamp",v),c(a)}))}mw.hook("InPageEdit.quickEdit").fire({$modal:t,$modalWindow:i,$modalTitle:w,$modalContent:_,$editArea:y,$editTools:k,$optionsLabel:x}),y.change((function(){$(this).attr("data-modifiled","true"),$(window).bind("beforeunload",(function(){return s("window-leave-confirm")}))})),r("edit")||(ssi_modal.notify("dialog",{className:"in-page-edit",position:"center bottom",title:s("notify-no-right"),content:s("editor-no-right"),okBtn:{label:s("ok"),className:"btn btn-primary",method(e,t){t.close()}}}),i.find(".save-btn").addClass("btn-danger")),a.get(e.jsonGet).done((function(e){console.timeEnd("[InPageEdit] 获取页面源代码"),l(e)})).fail((function(e,t,i){console.timeEnd("[InPageEdit] 获取页面源代码"),console.warn("[InPageEdit]警告:无法获取页面内容"),l(i)}))},beforeClose(e){if("true"===y.attr("data-modifiled"))return"true"===y.attr("data-confirmclose")?($(window).unbind("beforeunload"),e.options.keepContent=!1,e.options.beforeClose="",void e.close()):(ssi_modal.confirm({className:"in-page-edit",center:!0,content:s("editor-leave-confirm"),okBtn:{className:"btn btn-danger",label:s("confirm")},cancelBtn:{className:"btn btn-secondary",label:s("cancel")}},(function(e){!0===e&&t()})),!1);function t(){$(window).unbind("beforeunload"),e.options.keepContent=!1,e.options.beforeClose="",e.close(),ssi_modal.notify("info",{className:"in-page-edit",position:"right top",title:s("cancel"),content:s("notify-no-change")})}t()}}),x.find(".detailBtnGroup .detailBtn").click((function(){o("quick_edit_pagedetail");var t=$(this).attr("id"),i=$("<ul>");switch(t){case"showTemplates":var r,l=e.pageDetail.parse.templates;for(let e=0;e<l.length;e++)r=l[e]["*"],$("<li>").append($("<a>",{href:mw.util.getUrl(r),target:"_blank",text:r})," (",$("<a>",{href:"javascript:;",text:s("quick-edit"),class:"quickEditTemplate","data-template-name":r}),")").appendTo(i);ssi_modal.show({className:"in-page-edit quick-edit-detail",sizeClass:"dialog",title:s("editor-detail-title-templates"),content:i});break;case"showImages":var c,p=e.pageDetail.parse.images;for(let e=0;e<p.length;e++)c=p[e],$("<li>").append($("<a>",{href:mw.util.getUrl("File:"+c),target:"_balnk",text:c})," (",$("<a>",{href:"javascript:;",class:"quickViewImage",text:s("editor-detail-images-quickview"),"data-image-name":c})," | ",$("<a>",{href:n.wgScript+"?title=Special:Upload&wpDestFile="+c+"&wpForReUpload=1",target:"_balnk",text:s("editor-detail-images-upload")}),")").appendTo(i);ssi_modal.show({className:"in-page-edit quick-edit-detail",sizeClass:"dialog",title:s("editor-detail-title-images"),content:i})}$(".in-page-edit.quick-edit-detail .quickEditTemplate").click((function(){o("quick_edit_pagedetail_edit_template");var e=$(this).attr("data-template-name");u({page:e})})),$(".in-page-edit.quick-edit-detail .quickViewImage").click((function(){o("quick_edit_pagedetail_view_image");var e=$(this).attr("data-image-name");ssi_modal.show({className:"in-page-edit quick-view-image",center:!0,title:e.replace(/_/g," "),content:$("<center>",{id:"imageLayer"}).append(d),buttons:[{label:s("editor-detail-images-upload"),className:"btn btn-primary",method(){window.open(n.wgScript+"?title=Special:Upload&wpDestFile="+e+"&wpForReUpload=1")}},{label:s("close"),className:"btn btn-secondary",method(e,t){t.close()}}],onShow(){a.get({action:"query",format:"json",prop:"imageinfo",titles:"File:"+e.replace(/file:/g,""),iiprop:"url"}).done((function(e){$(".quick-view-image .ipe-progress").hide(),$(".quick-view-image #imageLayer").append($("<img>",{src:e.query.pages[-1].imageinfo[0].url,class:"loading",style:"max-width: 80%; max-height: 60vh"})),$(".quick-view-image #imageLayer img").load((function(){$(this).removeClass("loading")}))}))}})}))}))};e.exports={quickEdit:u}},795:(e,t,i)=>{const{_msg:a}=i(133),{$progress:n}=i(37);var o=new mw.Api;e.exports={quickPreview:function(e,t="large",i=!1){var s=$.extend({},{action:"parse",preview:!0,disableeditsection:!0,prop:"text",format:"json"},e);mw.hook("InPageEdit.quickPreview").fire();var r=(new Date).getTime();console.time("[InPageEdit] Request preview"),ssi_modal.show({sizeClass:new RegExp(/dialog|small|smallToMedium|medium|mediumToLarge|large|full|auto/).test(t)?t:"large",center:Boolean(i),className:"in-page-edit previewbox",title:a("preview-title"),content:$("<section>").append(n,$("<div>",{class:"InPageEditPreview","data-timestamp":r,style:"display:none",text:a("preview-placeholder")})),fixedHeight:!0,fitScreen:!0,buttons:[{label:"",className:"hideThisBtn"}],onShow(){$(".previewbox .ipe-progress").css("margin-top",$(".previewbox .ipe-progress").parent().height()/2),$(".previewbox .hideThisBtn").hide(),o.post(s).then((function(e){console.timeEnd("[InPageEdit] Request preview");var t=e.parse.text["*"];$(".previewbox .ipe-progress").hide(150),$('.InPageEditPreview[data-timestamp="'+r+'"]').fadeIn(500).html(t)})).fail((function(){console.timeEnd("[InPageEdit] Request preview"),console.warn("[InPageEdit] 预览失败"),$(".previewbox .ipe-progress").hide(150),$('.InPageEditPreview[data-timestamp="'+r+'"]').fadeIn(500).html(a("preview-error"))}))}})}}},201:(e,t,i)=>{var a=new mw.Api,n=mw.config.get();const{_analysis:o}=i(616),{_msg:s}=i(133),{$br:r,$progress:l}=i(37),{_resolveExists:d}=i(781),{preference:c}=i(511);e.exports={quickRedirect:function(e="to"){mw.hook("InPageEdit.quickRedirect").fire();var t,i,p,f="#REDIRECT [[:$1]]",m={action:"edit",createonly:1,minor:c.get("editMinor"),format:"json",errorformat:"plaintext"};if("to"===e)m.title=n.wgPageName,t=s("redirect-question-to","<b>"+n.wgPageName.replace(/_/g," ")+"</b>");else{if("from"!==e)return void console.error('[InPageEdit] quickRedirect only accept "from" or "to"');t=s("redirect-question-from","<b>"+n.wgPageName.replace(/_/g," ")+"</b>"),p=s("redirect-summary")+" → [[:"+n.wgPageName+"]]",m.text=f.replace("$1",n.wgPageName)}ssi_modal.show({outSideClose:!1,className:"in-page-edit quick-redirect",center:!0,sizeClass:"dialog",title:s("redirect-title"),content:$("<div>").append($("<section>").append($("<span>",{html:t}),r,$("<input>",{id:"redirect-page",style:"width:96%"}).click((function(){$(this).css("box-shadow","")})),r,$("<label>",{for:"redirect-reason",text:s("editSummary")}),$("<input>",{id:"redirect-reason",style:"width:96%"})),$(l).css("display","none")),buttons:[{label:s("confirm"),className:"btn btn-primary btn-single okBtn",method:function(t,r){function l(t,a){var o,r;$(".in-page-edit.quick-redirect .ipe-progress").hide(),$(".in-page-edit.quick-redirect section").show(),$(".in-page-edit.quick-redirect .okBtn").attr("disabled",!1),$(".in-page-edit.quick-redirect .ipe-progress").addClass("done"),ssi_modal.notify("error",{className:"in-page-edit",content:s("notify-redirect-error")+"<br>"+a.errors[0]["*"]+" (<code>"+t+"</code>)",title:s("notify-error")}),"articleexists"===t&&("from"===e?(o=i,r=n.wgPageName):"to"===e&&(o=n.wgPageName,r=i),d(o,{delete:"Delete for redirect to [["+r+"]]",edit:"Modify for redirect"}))}""!==(i=$(".in-page-edit.quick-redirect #redirect-page").val())&&i.replace(/_/g," ")!==n.wgPageName.replace(/_/g," ")?(o("quick_redirect"),"to"===e?(p=s("redirect-summary")+" → [[:"+i+"]]",m.text=f.replace("$1",i)):"from"===e&&(m.title=i),""!==$(".in-page-edit.quick-redirect #redirect-reason").val()&&(p=p+" ("+$(".in-page-edit.quick-redirect #redirect-reason").val()+")"),m.summary=p,$(".in-page-edit.quick-redirect .ipe-progress").show(),$(".in-page-edit.quick-redirect section").hide(),$(".in-page-edit.quick-redirect .okBtn").attr("disabled","disabled"),a.postWithToken("csrf",m).done((function(t){t.errors?l(t.errors[0].code,t):($(".in-page-edit.quick-redirect .ipe-progress").addClass("done"),ssi_modal.notify("success",{className:"in-page-edit",content:s("notify-redirect-success"),title:s("notify-success")}),"to"===e?window.location.reload():($(".in-page-edit.quick-redirect .ipe-progress").addClass("done"),setTimeout((function(){r.close()}),2e3)))})).fail(l)):$(".in-page-edit.quick-redirect #redirect-page").css("box-shadow","0 0 4px #f00")}}]})}}},100:(e,t,i)=>{var a=new mw.Api,n=mw.config.get();const{_analysis:o}=i(616),{_msg:s}=i(133),{_hasRight:r}=i(258),{_resolveExists:l}=i(781),{$br:d}=i(37),{progress:c}=i(562);e.exports={quickRename:function(e,t){var i,p,f,m;mw.hook("InPageEdit.quickRename").fire(),e=e||n.wgPageName,t=t||"",ssi_modal.show({outSideClose:!1,className:"in-page-edit quick-rename",center:!0,sizeClass:"dialog",title:s("rename-title"),content:$("<section>").append($("<label>",{for:"move-to",html:s("rename-moveTo","<b>"+e.replace(/_/g," ")+"</b>")}),d,$("<input>",{id:"move-to",style:"width:96%",onclick:"$(this).css('box-shadow','')"}),d,$("<label>",{for:"move-reason",text:s("editSummary")}),d,$("<input>",{id:"move-reason",style:"width:96%"}),d,$("<label>").append($("<input>",{type:"checkbox",id:"movetalk",checked:"checked"}),$("<span>",{text:s("rename-movetalk")})),d,$("<label>").append($("<input>",{type:"checkbox",id:"movesubpages",checked:"checked"}),$("<span>",{text:s("rename-movesubpages")})),d,$("<label>").append($("<input>",{type:"checkbox",id:"noredirect"}),$("<span>",{text:s("rename-noredirect")}))),buttons:[{label:s("cancel"),className:"btn btn-secondary",method:function(e,t){t.close()}},{label:s("confirm"),className:"btn btn-primary",method:function(){""!==(t=$(".in-page-edit.quick-rename #move-to").val())&&t!==n.wgPageName&&t!==n.wgPageName.replace(/_/g," ")?(o("quick_move"),c(s("editor-title-saving")),p=$(".in-page-edit.quick-rename #movetalk").prop("checked"),f=$(".in-page-edit.quick-rename #movesubpages").prop("checked"),m=$(".in-page-edit.quick-rename #noredirect").prop("checked"),i=""===(i=$(".in-page-edit.quick-rename #move-reason").val())?s("rename-summary")+" → [[:"+t+"]]":s("rename-summary")+" → [[:"+t+"]] ("+i+")",a.postWithToken("csrf",{action:"move",from:e,to:t,reason:i,movetalk:p,movesubpages:f,noredirect:m}).done((function(){c(!0),ssi_modal.notify("success",{className:"in-page-edit",content:s("notify-rename-success"),title:s("notify-success")}),location.href=n.wgArticlePath.replace("$1",t)})).fail((function(i,a,n){c(!1),ssi_modal.notify("error",{className:"in-page-edit",content:s("notify-rename-error")+": "+n.error.info+"<code>"+n.error.code+"</code>",title:s("notify-error")}),"articleexists"===n.error.code&&l(t,"For move page [["+e+"]] to here.")}))):$(".in-page-edit.quick-rename #move-to").css("box-shadow","0 0 4px #f00")}}],beforeShow:function(){if(!r("move"))return ssi_modal.dialog({title:s("notify-no-right"),content:s("rename-no-right"),className:"in-page-edit quick-deletepage",center:!0,okBtn:{className:"btn btn-primary btn-single"}}),!1}})}}},871:(e,t,i)=>{const{_msg:a}=i(133);e.exports={specialNotice:function(){ssi_modal.notify("dialog",{className:"in-page-edit ipe-special-notice",title:a("version-notice-title"),content:a("version-notice"),okBtn:{label:a("updatelog-dismiss"),className:"btn btn-primary"}},(function(e,t){localStorage.setItem("InPageEditNoticeId",a("noticeid")),t.close()}))}}},547:(e,t,i)=>{const a=i(306).i8;e.exports=a},209:(e,t,i)=>{const{_msg:a}=i(133),n=i(342),o=i(547);e.exports={versionInfo:function(){ssi_modal.show({className:"in-page-edit update-logs-modal",title:a("updatelog-title")+' - <span id="yourVersion">'+o+"</span>",content:$("<section>").append($("<iframe>",{style:"margin: 0;padding: 0;width: 100%;height: 80vh;border: 0;",src:n.updatelogsUrl})),buttons:[{label:"GitHub",className:"btn btn-secondary",method:function(){window.open(n.githubLink)}},{label:a("updatelog-about"),className:"btn btn-secondary",method:function(){window.open(n.aboutUrl)}},{label:a("close"),className:"btn btn-primary",method:function(e,t){t.close()}}]})}}},306:e=>{"use strict";e.exports={i8:"14.1.8"}}},t={};function i(a){var n=t[a];if(void 0!==n)return n.exports;var o=t[a]={exports:{}};return e[a](o,o.exports,i),o.exports}!async function(){"use strict";if(void 0!==(window.InPageEdit||{}).version)throw"[InPageEdit] InPageEdit 已经在运行了";var e=i(67),t=await e();window.InPageEdit=$.extend({},window.InPageEdit,t)}()})();
//# sourceMappingURL=InPageEdit.min.js.map