wikiplus-highlight 2.22.6 → 2.25.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,13 +11,13 @@
11
11
  在*个人 JS 页*添加以下代码:
12
12
 
13
13
  ```javascript
14
- mw.loader.load('//cdn.jsdelivr.net/npm/wikiplus-highlight@2.22.6');
14
+ mw.loader.load('//cdn.jsdelivr.net/npm/wikiplus-highlight@2.25.2');
15
15
  ```
16
16
 
17
17
 
18
18
 
19
19
  ```javascript
20
- mw.loader.load('//unpkg.com/wikiplus-highlight@2.22.6/dist/main.min.js');
20
+ mw.loader.load('//unpkg.com/wikiplus-highlight@2.25.2/dist/main.min.js');
21
21
  ```
22
22
 
23
23
  ### 稳定版本
package/dist/main.min.js CHANGED
@@ -4,5 +4,5 @@
4
4
  * @author 机智的小鱼君 <https://github.com/Dragon-Fish>
5
5
  * @license GPL-3.0
6
6
  */
7
- (async()=>{"use strict";if(mw.libs.wphl)return;mw.libs.wphl={};const i="2.22.6",w="object"==typeof mw.storage&&"function"==typeof mw.storage.getObject?mw.storage:{getObject(e){var i=localStorage.getItem(e);if(!1===i)return!1;try{return JSON.parse(i)}catch(e){return null}},setObject(e,i){try{return localStorage.setItem(e,JSON.stringify(i))}catch(e){return!1}}},h=Object.fromEntries||(e=>{const i={};for(var[t,o]of e)i[t]=o;return i}),P=e=>"function"==typeof e.flat?e.flat():e.reduce((e,i)=>e.concat(i),[]),r=(e=i)=>e.split(".").map(Number);const k=(e,...i)=>mw.msg("wphl-"+e,...i),a=(...e)=>$($.parseHTML(k(...e)));var e=(...i)=>()=>{var e=$("<p>",{html:k(...i)});return mw.notify(e,{type:"success",autoHideSeconds:"long",tag:"wikiplus-highlight"}),e},t=r().slice(0,2).join(".");const s="//fastly.jsdelivr.net",d="npm/codemirror@5.65.3",D="gh/bhsd-harry/codemirror-mediawiki@1.1.6",o="npm/wikiplus-highlight@"+t,{wgPageName:N,wgNamespaceNumber:f,wgPageContentModel:U,wgServerName:F,wgScriptPath:H,wgUserLanguage:V,skin:n}=mw["config"]["values"],u=null!==mw.loader.getState("ext.CodeMirror"),l=w.getObject("InPageEditMwConfig")||{},B=""+F+H,b=l[B]||{},y=!(b.time>Date.now()-2592e6),Q={css:"css","sanitized-css":"css",javascript:"javascript",json:"javascript",wikitext:"mediawiki"},c=u?{lib:"ext.CodeMirror.lib",css:"ext.CodeMirror.lib.mode.css",javascript:"ext.CodeMirror.lib.mode.javascript",lua:d+"/mode/lua/lua.min.js",mediawiki:y?"ext.CodeMirror.data":[],htmlmixed:"ext.CodeMirror.lib.mode.htmlmixed",xml:[]}:{lib:d+"/lib/codemirror.min.js",css:d+"/mode/css/css.min.js",javascript:d+"/mode/javascript/javascript.min.js",lua:d+"/mode/lua/lua.min.js",mediawiki:[],htmlmixed:d+"/mode/htmlmixed/htmlmixed.min.js",xml:d+"/mode/xml/xml.min.js"},m={searchcursor:d+"/addon/search/searchcursor.min.js",search:o+"/search.min.js",markSelection:d+"/addon/selection/mark-selection.min.js",activeLine:d+"/addon/selection/active-line.min.js",trailingspace:d+"/addon/edit/trailingspace.min.js",matchBrackets:d+"/addon/edit/matchbrackets.min.js",closeBrackets:d+"/addon/edit/closebrackets.min.js",matchTags:o+"/matchtags.min.js",fold:o+"/fold.min.js",wikiEditor:"ext.wikiEditor",contextmenu:"mediawiki.Title"},x=[{option:"styleSelectedText",addon:"search",download:"markSelection",only:!0,complex:()=>!C.has("wikiEditor")},{option:"styleActiveLine",addon:"activeLine"},{option:"showTrailingSpace",addon:"trailingspace"},{option:"matchBrackets",complex:(e,i)=>"mediawiki"!==e&&!i||{bracketRegex:/[{}[\]]/}},{option:"autoCloseBrackets",addon:"closeBrackets",complex:(e,i)=>"mediawiki"!==e&&!i||'()[]{}""'},{option:"matchTags",addon:["matchTags","fold"],modes:["mediawiki","widget"]},{option:"fold",modes:["mediawiki","widget"]}];let C=new Set(w.getObject("Wikiplus-highlight-addons")||["search"]),v=w.getObject("Wikiplus-highlight-indent")||4;const q={'"':"quot","'":"apos","<":"lt",">":"gt","&":"amp"," ":"nbsp"},g=i=>e=>{e.replaceSelection(e.getSelection().split("\n").map(i).join("\n"),"around")},p=g(e=>[...e].map(e=>{if(e in q)return`&${q[e]};`;const i=e.codePointAt();return i<256?`&#${i};`:`&#x${i.toString(16)};`}).join("")),j=({keyMap:e})=>e.default===e.pcDefault,K={"Ctrl-/":p,"Ctrl-\\":g(encodeURIComponent)},J={"Cmd-/":p,"Cmd-\\":g(encodeURIComponent)},S=(u,e)=>{if(("mediawiki"===e||"widget"===e)&&C.has("contextmenu")){const t=$(u.getWrapperElement()).addClass("CodeMirror-contextmenu"),[o]=(mw.config.get("extCodeMirrorConfig")||{functionSynonyms:[{invoke:"invoke","调用":"invoke",widget:"widget","小工具":"widget"}]})["functionSynonyms"];var i=i=>Object.keys(o).filter(e=>o[e]===i).map(e=>e.startsWith("#")?e:"#"+e);const w=i("invoke"),h=i("widget");t.contextmenu(({pageX:e,pageY:i})=>{const t=u.coordsChar({left:e,top:i}),{line:o,ch:a}=t,n=u.getTokenTypeAt(t);if(/\bmw-(?:template-name|parserfunction)\b/.test(n)){const c=u.getLineTokens(o);for(let e=c.length-1;0<e;e--){var{type:r,end:s,string:d}=c[e];c[e-1].type===r&&(c[e-1].end=s,c[e-1].string+=d,c.splice(e,1))}const m=c.findIndex(({start:e,end:i})=>e<a&&i>=a),g=c[m].string.replace(/\u200E/g,"").replace(/_/g," ").trim();if(/\bmw-template-name\b/.test(n)){const p=new mw.Title(g);return 0!==p.namespace||g.startsWith(":")?open(p.getUrl(),"_blank"):open(mw.util.getUrl("Template:"+g),"_blank"),!1}if(!(m<2)&&/\bmw-parserfunction-delimiter\b/.test(c[m-1].type)&&/\bmw-parserfunction-name\b/.test(c[m-2].type)){var l=c[m-2].string.trim().toLowerCase();if(w.includes(l))open(mw.util.getUrl("Module:"+g),"_blank");else{if(!h.includes(l))return;open(mw.util.getUrl("Widget:"+g,{action:"edit"}),"_blank")}return!1}}})}};let M=w.getObject("Wikiplus-highlight-i18n"),W;M?((e,i)=>{var[t,o]=r(e),[a,n]=r(i);return t<a||t===a&&o<n})(M["wphl-version"],i)&&(W=e("welcome-upgrade",i,0)):(M={},W=e("welcome"));const E={zh:"zh-hans","zh-hans":"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hant":"zh-hant","zh-tw":"zh-hant","zh-hk":"zh-hant","zh-mo":"zh-hant",ka:"ka"}[V]||"en",R=`${s}/${o}/i18n/${E}.json`,G=M["wphl-version"]===t;e=async()=>{G&&M["wphl-lang"]===E||(M=await $.ajax(R,{dataType:"json",cache:!0}),w.setObject("Wikiplus-highlight-i18n",M)),mw.messages.set(M)},t=Promise.all([mw.loader.using("mediawiki.util"),e()]);const X=e=>0<e.length?mw.loader.using(e):Promise.resolve(),Y=e=>0<e.length?$.ajax(s+"/"+(1<e.length?"combine/":"")+e.join(),{dataType:"script",cache:!0}):Promise.resolve(),Z=async(e,i)=>{var t=e.filter(e=>!e.includes("/")),o=e.filter(e=>e.includes("/"));return!0===i?(await X(t),Y(o)):!1===i?(await Y(o),X(t)):Promise.all([X(t),Y(o)])};let O;const ee=(e,i=!1)=>{const t=[];for(var{option:o,addon:a=o,download:n=Array.isArray(a)?o:a,only:r}of x)r&&i||o in e.optionHandlers||!ie(a,C)||t.push(m[n]);return t},ie=(e,i)=>Array.isArray(e)?e.some(e=>i.has(e)):i.has(e),te=e=>{let i=[];var t,o="function"==typeof window.CodeMirror,a=o?window.CodeMirror:{modes:{},prototype:{},commands:{},optionHandlers:{}};if(o||(i.push(c.lib),u||mw.loader.load(`${s}/${d}/lib/codemirror.min.css`,"text/css")),"mediawiki"!==(e="mediawiki"===e&&b.config&&b.config.tags.html?"html":e)&&"widget"!==e||a.modes.mediawiki||(mw.loader.load(`${s}/${D}/mediawiki.min.css`,"text/css"),i.push(D+"/mediawiki.min.js")),"widget"===e||"html"===e)for(const n of["css","javascript","mediawiki","htmlmixed","xml"])a.modes[n]||(i=i.concat(c[n]));else i=i.concat(c[e]);return a.prototype.getSearchCursor||!C.has("search")||C.has("wikiEditor")||i.push(m.searchcursor),a.commands.findForward||!C.has("search")||C.has("wikiEditor")||i.push(m.search),C.has("wikiEditor")&&((t=mw.loader.getState("ext.wikiEditor"))?"ready"!==t&&i.push(m.wikiEditor):C.delete("wikiEditor")),"ready"!==mw.loader.getState("mediawiki.Title")&&C.has("contextmenu")&&i.push(m.contextmenu),i.push(...ee(a)),Z(i,o?void 0:u)},oe=e=>{l[B]={config:e,time:Date.now()},w.setObject("InPageEditMwConfig",l)},_=e=>P(e.map(({aliases:e,name:i})=>e.map(e=>({alias:e,name:i})))),z=e=>h(e.map(({alias:e,name:i})=>[e.replace(/:$/,""),i])),ae=async(e,i)=>{if("mediawiki"===e||"widget"===e){u&&y&&await i;let e=mw.config.get("extCodeMirrorConfig");if(e||y||!G||({config:e}=b,e.tags.ref&&(e.tagModes.ref="text/mediawiki"),mw.config.set("extCodeMirrorConfig",e)),e&&e.redirect&&e.img)return e;if(e)return e;const{magicwords:a,extensiontags:n,functionhooks:r,variables:s}=(await(new mw.Api).get({meta:"siteinfo",siprop:e?"magicwords":"magicwords|extensiontags|functionhooks|variables",formatversion:2}))["query"],d=["msg","raw","msgnw","subst","safesubst"];if(e){const[l]=e["functionSynonyms"];var t,o;if(!l.subst)for({alias:t,name:o}of _(a.filter(({name:e})=>d.includes(e))))l[t.replace(/:$/,"")]=o}else{e={tagModes:{pre:"mw-tag-pre",nowiki:"mw-tag-nowiki",ref:"text/mediawiki"},tags:h(n.map(e=>[e.slice(1,-1),!0])),urlProtocols:mw.config.get("wgUrlProtocols")};const c=new Set([...r,...s,...d]),m=a.filter(({name:e,aliases:i})=>i.some(e=>/^__.+__$/.test(e))||c.has(e)),g=_(m.filter(e=>e["case-sensitive"])),p=_(m.filter(e=>!e["case-sensitive"])).map(({alias:e,name:i})=>({alias:e.toLowerCase(),name:i}));e.doubleUnderscore=[z(p.filter(({alias:e})=>/^__.+__$/.test(e))),z(g.filter(({alias:e})=>/^__.+__$/.test(e)))],e.functionSynonyms=[z(p.filter(({alias:e})=>!/^__.+__|^#$/.test(e))),z(g.filter(({alias:e})=>!/^__.+__|^#$/.test(e)))]}return e.redirect=a.find(({name:e})=>"redirect"===e).aliases,e.img=z(_(a.filter(({name:e})=>e.startsWith("img_")))),mw.config.set("extCodeMirrorConfig",e),oe(e),e}},ne={getContents(){return O.getValue()},setContents(e){return O.setValue(e),this},getSelection(){return O.getSelection()},setSelection(e){return O.setSelection(O.posFromIndex(e.start),"end"in e?O.posFromIndex(e.end):void 0),O.focus(),this},replaceSelection(e){return O.replaceSelection(e),this},getCaretPosition(e){var i=O.indexFromPos(O.getCursor("from")),t=O.indexFromPos(O.getCursor("to"));return e.startAndEnd?[i,t]:i},scrollToCaretPosition(){return O.scrollIntoView(),this}},re=async(e,i)=>{const n=i?"javascript":await(async()=>{if(274!==f&&828!==f||N.endsWith("/doc"))return N.endsWith("/doc")?"mediawiki":Q[U];{const e=274===f?"Widget":"Lua";return await mw.loader.using(["oojs-ui-windows","oojs-ui.styles.icons-content"]),await OO.ui.confirm(k("contentmodel"),{actions:[{label:e},{label:"Wikitext",action:"accept"}]})?"mediawiki":e.toLowerCase()}})(),t=te(n),[o]=await Promise.all([ae(n,t),t]);if(!i&&C.has("wikiEditor"))try{if("function"==typeof mw.addWikiEditor)mw.addWikiEditor(e);else{const{modules:{dialogs:{config:s}}}=$["wikiEditor"];e.wikiEditor("addModule",{...$.wikiEditor.modules.toolbar.config.getDefaultConfig(),...s.getDefaultConfig()}),s.replaceIcons(e)}}catch(e){C.delete("wikiEditor"),mw.notify("WikiEditor工具栏加载失败。",{type:"error"}),console.error(e)}"mediawiki"===n&&o.tags.html?(o.tagModes.html="htmlmixed",await te("html")):"widget"!==n||CodeMirror.mimeModes.widget||CodeMirror.defineMIME("widget",{name:"htmlmixed",tags:{noinclude:[[null,null,"mediawiki"]]}});var a=e.height();O&&O.toTextArea();const r=i||"json"===U;if((O=CodeMirror.fromTextArea(e[0],$.extend({inputStyle:"contenteditable",lineNumbers:!/Android\b/.test(navigator.userAgent),lineWrapping:!0,mode:n,mwConfig:o,json:r},h(x.map(({option:e,addon:i=e,modes:t,complex:o=e=>!t||t.includes(e)})=>{var a=Array.isArray(i)?i[0]:i;return[e,C.has(a)&&o(n,r)]})),"mediawiki"===n?{extraKeys:C.has("escape")&&(j(CodeMirror)?K:J)}:{indentUnit:C.has("indentWithSpace")?v:4,indentWithTabs:!C.has("indentWithSpace")}))).setSize(null,a),O.getWrapperElement().id="Wikiplus-CodeMirror",$.fn.textSelection&&e.textSelection("register",ne),C.has("wikiEditor")){const d=e.data("wikiEditorContext"),l=CodeMirror["keyMap"],c=()=>{$.wikiEditor.modules.dialogs.api.openDialog(d,"search-and-replace")};O.addKeyMap(l.default===l.pcDefault?{"Ctrl-F":c}:{"Cmd-F":c})}if(S(O,n),$("#Wikiplus-Quickedit-Jump").children("a").attr("href","#Wikiplus-CodeMirror"),!i){const m="object"==typeof window.Wikiplus?window.Wikiplus:{getSetting(e){var i=w.getObject("Wikiplus_Settings");return i&&i[e]}},g=m.getSetting("esc_to_exit_quickedit"),p=()=>{$("#Wikiplus-Quickedit-Submit").triggerHandler("click")},u=()=>{$("#Wikiplus-Quickedit-MinorEdit").click(),$("#Wikiplus-Quickedit-Submit").triggerHandler("click")};O.addKeyMap($.extend(j(CodeMirror)?{"Ctrl-S":p,"Shift-Ctrl-S":u}:{"Cmd-S":p,"Shift-Cmd-S":u},!0===g||"true"===g?{Esc(){$("#Wikiplus-Quickedit-Back").triggerHandler("click")}}:{}))}O.refresh(),mw.hook("wiki-codemirror").fire(O)},se=document["body"],de=new MutationObserver(e=>{const i=$(P(e.map(({addedNodes:e})=>[...e]))).find("#Wikiplus-Quickedit, #Wikiplus-Setting-Input");0!==i.length&&re(i,"Wikiplus-Setting-Input"===i.attr("id"))}),le=(de.observe(se,{childList:!0}),$(se).on("keydown.wphl",".ui-dialog",function(e){if("Escape"===e.key){const i=$(this).children(".ui-dialog-content").data("context");i&&i.$textarea&&"Wikiplus-Quickedit"===i.$textarea.attr("id")&&e.stopPropagation()}}),document.querySelector("#wphl-style")||mw.loader.addStyleTag("#Wikiplus-CodeMirror{border:1px solid #c8ccd1;line-height:1.3;clear:both;-moz-user-select:auto;-webkit-user-select:auto;user-select:auto}#Wikiplus-CodeMirror .CodeMirror-gutter-wrapper{-moz-user-select:none;-webkit-user-select:none;user-select:none}div.Wikiplus-InterBox{font-size:14px;z-index:100}.skin-minerva .Wikiplus-InterBox{font-size:16px}.cm-trailingspace{text-decoration:underline wavy red}div.CodeMirror span.CodeMirror-matchingbracket{box-shadow:0 0 0 2px #9aef98}div.CodeMirror span.CodeMirror-nonmatchingbracket{box-shadow:0 0 0 2px #eace64}#Wikiplus-highlight-dialog .oo-ui-messageDialog-title{margin-bottom:0.28571429em}#Wikiplus-highlight-dialog .oo-ui-flaggedElement-notice{font-weight:normal;margin:0}.CodeMirror-contextmenu .cm-mw-template-name{cursor:pointer}.skin-moeskin #ca-more-actions li>a{display:inline-block;padding:0.4rem 0.8rem;line-height:1.5}")),{get:ce=e=>e.value,set:me=(e,i)=>{e.value=i}}=(le.id="wphl-style",$.valHooks.textarea||{}),ge=e=>"Wikiplus-Quickedit"===e.id||"Wikiplus-Setting-Input"===e.id;$.valHooks.textarea={get(e){return ge(e)&&O?O.getValue():ce(e)},set(e,i){ge(e)&&O?O.setValue(i):me(e,i)}},await t;let I,T,pe,ue,A,we,L;const he=(e=[...C])=>{L.toggle(e.includes("indentWithSpace"))};const ke=$(mw.util.addPortletLink({minerva:"page-actions-overflow",citizen:"p-actions",moeskin:"ca-more-actions"}[n]||"p-cactions","#",k("portlet"),"wphl-settings")).click(async e=>{if(e.preventDefault(),I)T.setValue([...C]),A.setValue(v);else{await mw.loader.using(["oojs-ui-windows","oojs-ui.styles.icons-content"]),I=new OO.ui.MessageDialog({id:"Wikiplus-highlight-dialog"});const t=new OO.ui.WindowManager,o=(t.$element.appendTo(se),t.addWindows([I]),T=new OO.ui.CheckboxMultiselectInputWidget({options:[...x.map(({option:e,addon:i=e})=>{const t=Array.isArray(i)?i[0]:i;return{data:t,label:a("addon-"+t.toLowerCase())}}),...["wikiEditor","escape","contextmenu","indentWithSpace","otherEditors"].map(e=>({data:e,label:a("addon-"+e.toLowerCase())}))],value:[...C]}).on("change",he))["checkboxMultiselectWidget"];pe=o.findItemFromData("search"),ue=o.findItemFromData("wikiEditor"),A=new OO.ui.NumberInputWidget({min:0,value:v}),we=new OO.ui.FieldLayout(T,{label:k("addon-label"),notices:[k("addon-notice")],align:"top"}),L=new OO.ui.FieldLayout(A,{label:k("addon-indent")}),he(),Object.assign(mw.libs.wphl,{widget:T,indentWidget:A})}var i="object"==typeof window.Wikiplus||"object"==typeof window.Pages,i=(pe.setDisabled(!i),ue.setDisabled(!i||!mw.loader.getState("ext.wikiEditor")),await I.open({title:k("addon-title"),message:we.$element.add(L.$element).add($("<p>",{html:k("feedback")})),actions:[{action:"reject",label:mw.msg("ooui-dialog-message-reject")},{action:"accept",label:mw.msg("ooui-dialog-message-accept"),flags:"progressive"}],size:"en"===E||"minerva"===n?"medium":"small"}).closing);we.$element.detach(),L.$element.detach(),"object"==typeof i&&"accept"===i.action&&(i=T.getValue(),C=new Set(i),v=Number(A.getValue()),w.setObject("Wikiplus-highlight-addons",i),w.setObject("Wikiplus-highlight-indent",v))}),fe=("minerva"===n&&ke.find(".mw-ui-icon").addClass("mw-ui-icon-minerva-settings"),"function"==typeof W&&W().find("#wphl-settings-notify").click(e=>{e.preventDefault(),$("#wphl-settings").triggerHandler("click")}),async i=>{if(C.has("otherEditors")){let e=i.getOption("mode");e="text/mediawiki"===e?"mediawiki":e;var t=ee(CodeMirror,!0),o=i.getOption("json");await Z(t);for(const{option:n,addon:r=n,modes:s,complex:d=e=>!s||s.includes(e)}of x.filter(({only:e})=>!e)){var a=Array.isArray(r)?r[0]:r;void 0===i.getOption(n)&&C.has(a)&&i.setOption(n,d(e,o))}"mediawiki"!==e&&C.has("indentWithSpace")?(i.setOption("indentUnit",v),i.setOption("indentWithTabs",!1)):"mediawiki"===e&&C.has("escape")&&i.addKeyMap(j(CodeMirror)?K:J,!0),S(i,e)}});mw.hook("InPageEdit.quickEdit.codemirror").add(({cm:e})=>fe(e)),mw.hook("inspector").add(e=>fe(e)),mw.libs.wphl={version:i,options:x,addons:C,i18n:M,i18nLang:E,wphlStyle:le,$portlet:ke,USING_LOCAL:u,MODE_LIST:c,ADDON_LIST:m,msg:k,htmlMsg:a,escapeHTML:p,handleContextMenu:S,setI18N:e,getAddonScript:ee,updateCachedConfig:oe,getMwConfig:ae,renderEditor:re,handleOtherEditors:fe}})();
7
+ (async()=>{"use strict";if(mw.libs.wphl)return;mw.libs.wphl={};const i="2.25.2",w="object"==typeof mw.storage&&"function"==typeof mw.storage.getObject?mw.storage:{getObject(e){var i=localStorage.getItem(e);if(!1===i)return!1;try{return JSON.parse(i)}catch(e){return null}},setObject(e,i){try{return localStorage.setItem(e,JSON.stringify(i))}catch(e){return!1}}},P=(Object.fromEntries=Object.fromEntries||(e=>{const i={};for(var[t,o]of e)i[t]=o;return i}),e=>"function"==typeof e.flat?e.flat():e.reduce((e,i)=>e.concat(i),[])),r=(e=i)=>e.split(".").map(Number);const h=(e,...i)=>mw.msg("wphl-"+e,...i),n=(...e)=>$($.parseHTML(h(...e)));var e=(...i)=>()=>{var e=$("<p>",{html:h(...i)});return mw.notify(e,{type:"success",autoHideSeconds:"long",tag:"wikiplus-highlight"}),e},t=r().slice(0,2).join(".");const s="//fastly.jsdelivr.net",l="npm/codemirror@5.65.3",D="gh/bhsd-harry/codemirror-mediawiki@1.1.6",o="npm/wikiplus-highlight@"+t,{wgPageName:N,wgNamespaceNumber:k,wgPageContentModel:F,wgServerName:H,wgScriptPath:U,wgUserLanguage:V,skin:d}=mw["config"]["values"],u=null!==mw.loader.getState("ext.CodeMirror"),a=w.getObject("InPageEditMwConfig")||{},B=""+H+U,f=a[B]||{},b=!(f.time>Date.now()-2592e6),Q={css:"css","sanitized-css":"css",javascript:"javascript",json:"javascript",wikitext:"mediawiki"},c=u?{lib:"ext.CodeMirror.lib",css:"ext.CodeMirror.lib.mode.css",javascript:"ext.CodeMirror.lib.mode.javascript",lua:l+"/mode/lua/lua.min.js",mediawiki:b?"ext.CodeMirror.data":[],htmlmixed:"ext.CodeMirror.lib.mode.htmlmixed",xml:[]}:{lib:l+"/lib/codemirror.min.js",css:l+"/mode/css/css.min.js",javascript:l+"/mode/javascript/javascript.min.js",lua:l+"/mode/lua/lua.min.js",mediawiki:[],htmlmixed:l+"/mode/htmlmixed/htmlmixed.min.js",xml:l+"/mode/xml/xml.min.js"},m={searchcursor:l+"/addon/search/searchcursor.min.js",search:o+"/search.min.js",markSelection:l+"/addon/selection/mark-selection.min.js",activeLine:l+"/addon/selection/active-line.min.js",trailingspace:l+"/addon/edit/trailingspace.min.js",matchBrackets:l+"/addon/edit/matchbrackets.min.js",closeBrackets:l+"/addon/edit/closebrackets.min.js",matchTags:o+"/matchtags.min.js",fold:o+"/fold.min.js",wikiEditor:"ext.wikiEditor",contextmenu:"mediawiki.Title",lint:l+"/addon/lint/lint.min.js",annotateScrollbar:l+"/addon/scroll/annotatescrollbar.min.js",parser:"gh/bhsd-harry/wikiparser-node@0.5.4-b/bundle/bundle.min.js",lintWikitext:o+"/lint.min.js"},x=[{option:"styleSelectedText",addon:"search",download:"markSelection",only:!0,complex:()=>!y.has("wikiEditor")},{option:"styleActiveLine",addon:"activeLine"},{option:"showTrailingSpace",addon:"trailingspace"},{option:"matchBrackets",complex:(e,i)=>"mediawiki"!==e&&!i||{bracketRegex:/[{}[\]]/}},{option:"autoCloseBrackets",addon:"closeBrackets",complex:(e,i)=>"mediawiki"!==e&&!i||'()[]{}""'},{option:"matchTags",addon:["matchTags","fold"],modes:["mediawiki","widget"]},{option:"fold",modes:["mediawiki","widget"]}],y=new Set(w.getObject("Wikiplus-highlight-addons")||["search"]);let v=w.getObject("Wikiplus-highlight-indent")||4;const q={'"':"quot","'":"apos","<":"lt",">":"gt","&":"amp"," ":"nbsp"},g=i=>e=>{e.replaceSelection(e.getSelection().split("\n").map(i).join("\n"),"around")},p=g(e=>[...e].map(e=>{if(e in q)return`&${q[e]};`;const i=e.codePointAt();return i<256?`&#${i};`:`&#x${i.toString(16)};`}).join("")),C=({keyMap:e})=>e.default===e.pcDefault,K={"Ctrl-/":p,"Ctrl-\\":g(encodeURIComponent)},J={"Cmd-/":p,"Cmd-\\":g(encodeURIComponent)},j=(u,e)=>{if(("mediawiki"===e||"widget"===e)&&y.has("contextmenu")){const t=$(u.getWrapperElement()).addClass("CodeMirror-contextmenu"),[o]=(mw.config.get("extCodeMirrorConfig")||{functionSynonyms:[{invoke:"invoke","调用":"invoke",widget:"widget","小工具":"widget"}]})["functionSynonyms"];var i=i=>Object.keys(o).filter(e=>o[e]===i).map(e=>e.startsWith("#")?e:"#"+e);const w=i("invoke"),h=i("widget");t.contextmenu(({pageX:e,pageY:i})=>{const t=u.coordsChar({left:e,top:i}),{line:o,ch:a}=t,n=u.getTokenTypeAt(t);if(/\bmw-(?:template-name|parserfunction)\b/.test(n)){const c=u.getLineTokens(o);for(let e=c.length-1;0<e;e--){var{type:r,end:s,string:l}=c[e];c[e-1].type===r&&(c[e-1].end=s,c[e-1].string+=l,c.splice(e,1))}const m=c.findIndex(({start:e,end:i})=>e<a&&i>=a),g=c[m].string.replace(/\u200E/g,"").replace(/_/g," ").trim();if(/\bmw-template-name\b/.test(n)){const p=new mw.Title(g);return 0!==p.namespace||g.startsWith(":")?open(p.getUrl(),"_blank"):open(mw.util.getUrl("Template:"+g),"_blank"),!1}if(!(m<2)&&/\bmw-parserfunction-delimiter\b/.test(c[m-1].type)&&/\bmw-parserfunction-name\b/.test(c[m-2].type)){var d=c[m-2].string.trim().toLowerCase();if(w.includes(d))open(mw.util.getUrl("Module:"+g),"_blank");else{if(!h.includes(d))return;open(mw.util.getUrl("Widget:"+g,{action:"edit"}),"_blank")}return!1}}})}},S=w.getObject("Wikiplus-highlight-i18n")||{};let M;S["wphl-version"]?((e,i)=>{var[t,o]=r(e),[a,n]=r(i);return t<a||t===a&&o<n})(S["wphl-version"],i)&&(M=e("welcome-new-addon",i,1)):M=e("welcome");const W={zh:"zh-hans","zh-hans":"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hant":"zh-hant","zh-tw":"zh-hant","zh-hk":"zh-hant","zh-mo":"zh-hant",ka:"ka"}[V]||"en",R=`${s}/${o}/i18n/${W}.json`,G=S["wphl-version"]===t;e=async()=>{G&&S["wphl-lang"]===W||(Object.assign(S,await $.ajax(R,{dataType:"json",cache:!0})),w.setObject("Wikiplus-highlight-i18n",S)),mw.messages.set(S)},t=Promise.all([mw.loader.using("mediawiki.util"),e()]);const X=e=>0<e.length?mw.loader.using(e):Promise.resolve(),Y=e=>0<e.length?$.ajax(s+"/"+(1<e.length?"combine/":"")+e.join(),{dataType:"script",cache:!0}):Promise.resolve(),Z=async(e,i)=>{var t=e.filter(e=>!e.includes("/")),o=e.filter(e=>e.includes("/"));return!0===i?(await X(t),Y(o)):!1===i?(await Y(o),X(t)):Promise.all([X(t),Y(o)])};let O;const ee=(e,i=!1)=>{const t=[];for(var{option:o,addon:a=o,download:n=Array.isArray(a)?o:a,only:r}of x)r&&i||o in e.optionHandlers||!ie(a,y)||t.push(m[n]);return t},ie=(e,i)=>Array.isArray(e)?e.some(e=>i.has(e)):i.has(e),te=e=>{let i=[];var t,o="function"==typeof window.CodeMirror,a=o?window.CodeMirror:{modes:{},prototype:{},commands:{},optionHandlers:{},helpers:{}};if(o||(i.push(c.lib),u||mw.loader.load(`${s}/${l}/lib/codemirror.min.css`,"text/css")),"mediawiki"!==(e="mediawiki"===e&&f.config&&f.config.tags.html?"html":e)&&"widget"!==e||a.modes.mediawiki||(mw.loader.load(`${s}/${D}/mediawiki.min.css`,"text/css"),i.push(D+"/mediawiki.min.js")),"widget"===e||"html"===e)for(const n of["css","javascript","mediawiki","htmlmixed","xml"])a.modes[n]||(i=i.concat(c[n]));else i=i.concat(c[e]);return a.prototype.getSearchCursor||!y.has("search")||y.has("wikiEditor")||i.push(m.searchcursor),!a.prototype.annotateScrollbar&&"mediawiki"===e&&y.has("lint")&&i.push(m.annotateScrollbar),a.commands.findForward||!y.has("search")||y.has("wikiEditor")||i.push(m.search),!window.Parser&&"mediawiki"===e&&y.has("lint")&&i.push(m.parser),!a.optionHandlers.lint&&"mediawiki"===e&&y.has("lint")&&(mw.loader.load(`${s}/${l}/addon/lint/lint.min.css`,"text/css"),i.push(m.lint)),a.helpers.lint&&a.helpers.lint.mediawiki||"mediawiki"!==e||!y.has("lint")||i.push(m.lintWikitext),y.has("wikiEditor")&&((t=mw.loader.getState("ext.wikiEditor"))?"ready"!==t&&i.push(m.wikiEditor):y.delete("wikiEditor")),"ready"!==mw.loader.getState("mediawiki.Title")&&y.has("contextmenu")&&i.push(m.contextmenu),i.push(...ee(a)),Z(i,o?void 0:u)},oe=e=>{a[B]={config:e,time:Date.now()},w.setObject("InPageEditMwConfig",a)},E=e=>P(e.map(({aliases:e,name:i})=>e.map(e=>({alias:e,name:i})))),_=e=>Object.fromEntries(e.map(({alias:e,name:i})=>[e.replace(/:$/,""),i])),ae=async(e,i)=>{if("mediawiki"===e||"widget"===e){u&&b&&await i;let e=mw.config.get("extCodeMirrorConfig");if(e||b||!G||({config:e}=f,e.tags.ref&&(e.tagModes.ref="text/mediawiki"),mw.config.set("extCodeMirrorConfig",e)),e&&e.redirect&&e.img)return e;const{magicwords:a,extensiontags:n,functionhooks:r,variables:s}=(await(new mw.Api).get({meta:"siteinfo",siprop:e?"magicwords":"magicwords|extensiontags|functionhooks|variables",formatversion:2}))["query"],l=["msg","raw","msgnw","subst","safesubst"];if(e){const[d]=e["functionSynonyms"];var t,o;if(!d.subst)for({alias:t,name:o}of E(a.filter(({name:e})=>l.includes(e))))d[t.replace(/:$/,"")]=o}else{e={tagModes:{pre:"mw-tag-pre",nowiki:"mw-tag-nowiki",ref:"text/mediawiki"},tags:Object.fromEntries(n.map(e=>[e.slice(1,-1),!0])),urlProtocols:mw.config.get("wgUrlProtocols")};const c=new Set([...r,...s,...l]),m=a.filter(({name:e,aliases:i})=>i.some(e=>/^__.+__$/.test(e))||c.has(e)),g=E(m.filter(e=>e["case-sensitive"])),p=E(m.filter(e=>!e["case-sensitive"])).map(({alias:e,name:i})=>({alias:e.toLowerCase(),name:i}));e.doubleUnderscore=[_(p.filter(({alias:e})=>/^__.+__$/.test(e))),_(g.filter(({alias:e})=>/^__.+__$/.test(e)))],e.functionSynonyms=[_(p.filter(({alias:e})=>!/^__.+__|^#$/.test(e))),_(g.filter(({alias:e})=>!/^__.+__|^#$/.test(e)))]}return e.redirect=a.find(({name:e})=>"redirect"===e).aliases,e.img=_(E(a.filter(({name:e})=>e.startsWith("img_")))),mw.config.set("extCodeMirrorConfig",e),oe(e),e}},ne={getContents(){return O.getValue()},setContents(e){return O.setValue(e),this},getSelection(){return O.getSelection()},setSelection(e){return O.setSelection(O.posFromIndex(e.start),"end"in e?O.posFromIndex(e.end):void 0),O.focus(),this},replaceSelection(e){return O.replaceSelection(e),this},getCaretPosition(e){var i=O.indexFromPos(O.getCursor("from")),t=O.indexFromPos(O.getCursor("to"));return e.startAndEnd?[i,t]:i},scrollToCaretPosition(){return O.scrollIntoView(),this}},re=async(e,i)=>{const n=i?"javascript":await(async()=>{if(N.endsWith("/doc"))return"mediawiki";if(274!==k&&828!==k)return Q[F];const e=274===k?"Widget":"Lua";return await mw.loader.using(["oojs-ui-windows","oojs-ui.styles.icons-content"]),await OO.ui.confirm(h("contentmodel"),{actions:[{label:e},{label:"Wikitext",action:"accept"}]})?"mediawiki":e.toLowerCase()})(),t=te(n),[o]=await Promise.all([ae(n,t),t]);if(!i&&y.has("wikiEditor"))try{if("function"==typeof mw.addWikiEditor)mw.addWikiEditor(e);else{const{modules:{dialogs:{config:s}}}=$["wikiEditor"];e.wikiEditor("addModule",{...$.wikiEditor.modules.toolbar.config.getDefaultConfig(),...s.getDefaultConfig()}),s.replaceIcons(e)}}catch(e){y.delete("wikiEditor"),mw.notify("WikiEditor工具栏加载失败。",{type:"error"}),console.error(e)}"mediawiki"===n&&o.tags.html?(o.tagModes.html="htmlmixed",await te("html")):"widget"!==n||CodeMirror.mimeModes.widget||CodeMirror.defineMIME("widget",{name:"htmlmixed",tags:{noinclude:[[null,null,"mediawiki"]]}});var a=e.height();O&&O.toTextArea();const r=i||"json"===F;if((O=CodeMirror.fromTextArea(e[0],$.extend({inputStyle:"contenteditable",lineNumbers:!/Android\b/.test(navigator.userAgent),lineWrapping:!0,mode:n,mwConfig:o,json:r},Object.fromEntries(x.map(({option:e,addon:i=e,modes:t,complex:o=e=>!t||t.includes(e)})=>{var a=Array.isArray(i)?i[0]:i;return[e,y.has(a)&&o(n,r)]})),"mediawiki"===n?{extraKeys:y.has("escape")&&(C(CodeMirror)?K:J)}:{indentUnit:y.has("indentWithSpace")?v:4,indentWithTabs:!y.has("indentWithSpace")}))).setSize(null,a),O.getWrapperElement().id="Wikiplus-CodeMirror",$.fn.textSelection&&e.textSelection("register",ne),y.has("wikiEditor")){const l=e.data("wikiEditorContext"),d=CodeMirror["keyMap"],c=()=>{$.wikiEditor.modules.dialogs.api.openDialog(l,"search-and-replace")};O.addKeyMap(d.default===d.pcDefault?{"Ctrl-F":c}:{"Cmd-F":c})}if(j(O,n),$("#Wikiplus-Quickedit-Jump").children("a").attr("href","#Wikiplus-CodeMirror"),!i){const m="object"==typeof window.Wikiplus?window.Wikiplus:{getSetting(e){var i=w.getObject("Wikiplus_Settings");return i&&i[e]}},g=m.getSetting("esc_to_exit_quickedit"),p=()=>{$("#Wikiplus-Quickedit-Submit").triggerHandler("click")},u=()=>{$("#Wikiplus-Quickedit-MinorEdit").click(),$("#Wikiplus-Quickedit-Submit").triggerHandler("click")};O.addKeyMap($.extend(C(CodeMirror)?{"Ctrl-S":p,"Shift-Ctrl-S":u}:{"Cmd-S":p,"Shift-Cmd-S":u},!0===g||"true"===g?{Esc(){$("#Wikiplus-Quickedit-Back").triggerHandler("click")}}:{}))}O.refresh(),mw.hook("wiki-codemirror").fire(O)},se=document["body"],le=new MutationObserver(e=>{const i=$(P(e.map(({addedNodes:e})=>[...e]))).find("#Wikiplus-Quickedit, #Wikiplus-Setting-Input");0!==i.length&&re(i,"Wikiplus-Setting-Input"===i.attr("id"))}),de=(le.observe(se,{childList:!0}),$(se).on("keydown.wphl",".ui-dialog",function(e){if("Escape"===e.key){const i=$(this).children(".ui-dialog-content").data("context");i&&i.$textarea&&"Wikiplus-Quickedit"===i.$textarea.attr("id")&&e.stopPropagation()}}),document.querySelector("#wphl-style")||mw.loader.addStyleTag("#Wikiplus-CodeMirror{border:1px solid #c8ccd1;line-height:1.3;clear:both;-moz-user-select:auto;-webkit-user-select:auto;user-select:auto}#Wikiplus-CodeMirror .CodeMirror-gutter-wrapper{-moz-user-select:none;-webkit-user-select:none;user-select:none}div.Wikiplus-InterBox{font-size:14px;z-index:100}.skin-minerva .Wikiplus-InterBox{font-size:16px}.cm-trailingspace{text-decoration:underline wavy red}div.CodeMirror span.CodeMirror-matchingbracket{box-shadow:0 0 0 2px #9aef98}div.CodeMirror span.CodeMirror-nonmatchingbracket{box-shadow:0 0 0 2px #eace64}#Wikiplus-highlight-dialog .oo-ui-messageDialog-title{margin-bottom:0.28571429em}#Wikiplus-highlight-dialog .oo-ui-flaggedElement-notice{font-weight:normal;margin:0}.CodeMirror-contextmenu .cm-mw-template-name{cursor:pointer}.skin-moeskin #ca-more-actions li>a{display:inline-block;padding:0.4rem 0.8rem;line-height:1.5}")),{get:ce=e=>e.value,set:me=(e,i)=>{e.value=i}}=(de.id="wphl-style",$.valHooks.textarea||{}),ge=e=>"Wikiplus-Quickedit"===e.id||"Wikiplus-Setting-Input"===e.id;$.valHooks.textarea={get(e){return ge(e)&&O?O.getValue():ce(e)},set(e,i){ge(e)&&O?O.setValue(i):me(e,i)}},await t;let z,I,pe,ue,we,T,he,A;const ke=(e=[...y])=>{A.toggle(e.includes("indentWithSpace"))};const fe=$(mw.util.addPortletLink({minerva:"page-actions-overflow",citizen:"p-actions",moeskin:"ca-more-actions"}[d]||"p-cactions","#",h("portlet"),"wphl-settings")).click(async e=>{if(e.preventDefault(),z)I.setValue([...y]),T.setValue(v);else{await mw.loader.using(["oojs-ui-windows","oojs-ui.styles.icons-content"]),z=new OO.ui.MessageDialog({id:"Wikiplus-highlight-dialog"});const t=new OO.ui.WindowManager,o=(t.$element.appendTo(se),t.addWindows([z]),I=new OO.ui.CheckboxMultiselectInputWidget({options:[...x.map(({option:e,addon:i=e})=>{const t=Array.isArray(i)?i[0]:i;return{data:t,label:n("addon-"+t.toLowerCase())}}),...["wikiEditor","escape","contextmenu","lint","indentWithSpace","otherEditors"].map(e=>({data:e,label:n("addon-"+e.toLowerCase())}))],value:[...y]}).on("change",ke))["checkboxMultiselectWidget"];pe=o.findItemFromData("search"),ue=o.findItemFromData("wikiEditor"),we=o.findItemFromData("lint"),T=new OO.ui.NumberInputWidget({min:0,value:v}),he=new OO.ui.FieldLayout(I,{label:h("addon-label"),notices:[h("addon-notice")],align:"top"}),A=new OO.ui.FieldLayout(T,{label:h("addon-indent")}),ke(),Object.assign(mw.libs.wphl,{widget:I,indentWidget:T})}var i="object"==typeof window.Wikiplus||"object"==typeof window.Pages,i=(pe.setDisabled(!i),ue.setDisabled(!i||!mw.loader.getState("ext.wikiEditor")),we.setDisabled(!i),await z.open({title:h("addon-title"),message:he.$element.add(A.$element).add($("<p>",{html:h("feedback")})),actions:[{action:"reject",label:mw.msg("ooui-dialog-message-reject")},{action:"accept",label:mw.msg("ooui-dialog-message-accept"),flags:"progressive"}],size:"en"===W||"minerva"===d?"medium":"small"}).closing);if(he.$element.detach(),A.$element.detach(),"object"==typeof i&&"accept"===i.action){i=I.getValue();y.clear();for(const a of i)y.add(a);v=Number(T.getValue()),w.setObject("Wikiplus-highlight-addons",i),w.setObject("Wikiplus-highlight-indent",v)}}),L=("minerva"===d&&fe.find(".mw-ui-icon").addClass("mw-ui-icon-minerva-settings"),"function"==typeof M&&M().find("#wphl-settings-notify").click(e=>{e.preventDefault(),$("#wphl-settings").triggerHandler("click")}),async i=>{if(y.has("otherEditors")){let e=i.getOption("mode");e="text/mediawiki"===e?"mediawiki":e;var t=ee(CodeMirror,!0),o=i.getOption("json");await Z(t);for(const{option:n,addon:r=n,modes:s,complex:l=e=>!s||s.includes(e)}of x.filter(({only:e})=>!e)){var a=Array.isArray(r)?r[0]:r;void 0===i.getOption(n)&&y.has(a)&&i.setOption(n,l(e,o))}"mediawiki"===e&&y.has("escape")?i.addKeyMap(C(CodeMirror)?K:J,!0):"mediawiki"!==e&&y.has("indentWithSpace")&&(i.setOption("indentUnit",v),i.setOption("indentWithTabs",!1)),j(i,e)}});mw.hook("InPageEdit.quickEdit.codemirror").add(({cm:e})=>L(e)),mw.hook("inspector").add(e=>L(e)),mw.hook("wiki-codemirror").add(e=>{e.getTextArea&&ge(e.getTextArea())||L(e)}),mw.libs.wphl={version:i,options:x,addons:y,i18n:S,i18nLang:W,wphlStyle:de,$portlet:fe,USING_LOCAL:u,MODE_LIST:c,ADDON_LIST:m,msg:h,htmlMsg:n,escapeHTML:p,handleContextMenu:j,setI18N:e,getAddonScript:ee,updateCachedConfig:oe,getMwConfig:ae,renderEditor:re,handleOtherEditors:L}})();
8
8
  //# sourceMappingURL=main.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"../","sources":["main.js"],"names":["mw","libs","wphl","version","storage","getObject","key","json","localStorage","getItem","JSON","parse","e","setObject","value","setItem","stringify","fromEntries","Object","entries","obj","flatten","arr","flat","reduce","acc","cur","concat","getVersion","str","split","map","Number","msg","args","htmlMsg","$","parseHTML","notify","$p","html","type","autoHideSeconds","tag","majorVersion","slice","join","CDN","CM_CDN","MW_CDN","REPO_CDN","wgPageName","page","wgNamespaceNumber","ns","wgPageContentModel","contentmodel","wgServerName","server","wgScriptPath","scriptPath","wgUserLanguage","userLang","skin","config","values","USING_LOCAL","loader","getState","ALL_SETTINGS_CACHE","SITE_ID","SITE_SETTINGS","EXPIRED","time","Date","now","CONTENTMODEL","css","sanitized-css","javascript","wikitext","MODE_LIST","lib","lua","mediawiki","htmlmixed","xml","ADDON_LIST","searchcursor","search","markSelection","activeLine","trailingspace","matchBrackets","closeBrackets","matchTags","fold","wikiEditor","contextmenu","options","option","addon","download","only","complex","addons","has","mode","bracketRegex","modes","let","Set","indent","entity","\"","'","<",">","&"," ","convert","func","doc","replaceSelection","getSelection","escapeHTML","c","code","codePointAt","toString","isPc","keyMap","default","pcDefault","extraKeysPc","Ctrl-/","Ctrl-\\","encodeURIComponent","extraKeysMac","Cmd-/","Cmd-\\","handleContextMenu","$wrapper","getWrapperElement","addClass","synonyms","get","functionSynonyms","invoke","调用","widget","小工具","getSysnonyms","keys","filter","startsWith","pageX","pageY","pos","coordsChar","left","top","line","ch","curType","getTokenTypeAt","test","tokens","getLineTokens","i","length","end","string","splice","index","findIndex","start","text","replace","trim","title","Title","namespace","open","getUrl","util","parserFunction","toLowerCase","includes","action","i18n","welcome","a","b","a0","a1","b0","b1","cmpVersion","i18nLang","zh","zh-hans","zh-cn","zh-my","zh-sg","zh-hant","zh-tw","zh-hk","zh-mo","ka","I18N_CDN","isLatest","setI18N","async","ajax","dataType","cache","messages","set","i18nPromise","Promise","all","using","getInternalScript","exts","resolve","getExternalScript","urls","getScript","local","internal","url","external","cm","getAddonScript","CM","other","addonScript","Array","isArray","optionHandlers","intersect","push","some","ele","initMode","scripts","state","loaded","window","CodeMirror","prototype","commands","load","tags","lang","getSearchCursor","findForward","delete","undefined","updateCachedConfig","getAliases","words","aliases","name","alias","getConfig","getMwConfig","initModePromise","ref","tagModes","redirect","img","magicwords","extensiontags","functionhooks","variables","Api","meta","siprop","formatversion","query","otherMagicwords","insensitive","subst","pre","nowiki","urlProtocols","realMagicwords","allMagicwords","sensitive","word","doubleUnderscore","find","cmTextSelection","getContents","getValue","setContents","content","setValue","this","setSelection","posFromIndex","focus","getCaretPosition","caretPos","indexFromPos","getCursor","endPos","startAndEnd","scrollToCaretPosition","scrollIntoView","renderEditor","$target","setting","endsWith","pageMode","OO","ui","confirm","actions","label","getPageMode","mwConfig","addWikiEditor","modules","dialogs","toolbar","getDefaultConfig","replaceIcons","console","error","mimeModes","defineMIME","noinclude","height","toTextArea","fromTextArea","extend","inputStyle","lineNumbers","navigator","userAgent","lineWrapping","mod","mainAddon","extraKeys","indentUnit","indentWithTabs","setSize","id","fn","textSelection","context","data","callback","api","openDialog","addKeyMap","Ctrl-F","Cmd-F","children","attr","Wikiplus","getSetting","settings","escToExitQuickEdit","submit","triggerHandler","submitMinor","click","Ctrl-S","Shift-Ctrl-S","Cmd-S","Shift-Cmd-S","Esc","refresh","hook","fire","body","document","observer","MutationObserver","records","$editArea","addedNodes","wphlStyle","observe","childList","on","$textarea","stopPropagation","querySelector","addStyleTag","elem","valHooks","textarea","isWikiplus","dialog","searchWidget","wikiEditorWidget","indentWidget","field","indentField","toggleIndent","toggle","$portlet","addPortletLink","minerva","citizen","moeskin","preventDefault","MessageDialog","windowManager","WindowManager","checkboxMultiselectWidget","$element","appendTo","addWindows","CheckboxMultiselectInputWidget","findItemFromData","NumberInputWidget","min","FieldLayout","notices","align","assign","wikiplusLoaded","Pages","setDisabled","message","add","flags","size","closing","detach","handleOtherEditors","getOption","setOption"],"mappings":";;;;;;CAOA,uBAIC,GAAIA,GAAGC,KAAKC,KACX,OAEDF,GAAGC,KAAKC,KAAO,GAEf,MAAMC,EAAU,SAIVC,EAAgC,iBAAfJ,GAAGI,SAAwD,mBAAzBJ,GAAGI,QAAQC,UACjEL,GAAGI,QACH,CAEDC,UAAUC,GACT,IAAMC,EAAOC,aAAaC,QAAQH,GAClC,IAAa,IAATC,EACH,OAAO,EAER,IACC,OAAOG,KAAKC,MAAMJ,GACjB,MAAOK,GACR,OAAO,OAITC,UAAUP,E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AAOL,QAAAA,EAAU,IAAgCK,GAASA,EAAM+E,SAAS4J,MAC7FrP,EAAQuD,OAAO,CAAA,CAAEnD,KAAAA,MAAWA,GAAO,CACvC,IAAMkP,EAAY3G,MAAMC,QAAQ1I,GAASA,EAAM,GAAKA,OACtB8J,IAA1BzI,EAAI2T,UAAUjV,IAAyBK,EAAOC,IAAI+O,IACrD/N,EAAI4T,UAAUlV,EAAQI,EAAQG,EAAMpG,IAGzB,cAAToG,GAAwBF,EAAOC,IAAI,oBACtCgB,EAAI4T,UAAU,aAActU,GAC5BU,EAAI4T,UAAU,kBAAkB,IACb,cAAT3U,GAAwBF,EAAOC,IAAI,WAC7CgB,EAAI4O,UAAUpO,EAAKwH,YAAcpH,EAAcI,GAAc,GAE9DG,EAAkBnB,EAAKf,MAGxB3G,GAAGyX,KAAK,mCAAmCsD,IACF,CAAA,CAAEtM,GAAI/G,KAAS0T,GAAmB1T,IAE3E1H,GAAGyX,KAAK,aAAasD,IAA0CrT,GAAO0T,GAAmB1T,IAEzF1H,GAAGC,KAAKC,KAAO,CACdC,QAAAA,EACAgG,QAAAA,EACAM,OAAAA,EACAqF,KAAAA,EACAS,SAAAA,EACA2L,UAAAA,GACAoB,SAAAA,GACApV,YAAAA,EACAe,UAAAA,EACAM,WAAAA,EACAtD,IAAAA,EACAE,QAAAA,EACA0F,WAAAA,EACAgB,kBAAAA,EACAuE,QAAAA,EACAsB,eAAAA,GACA0B,mBAAAA,GACAO,YAAAA,GACA6C,aAAAA,GACA4H,mBAAAA,KAh+BF"}
1
+ {"version":3,"sourceRoot":"../","sources":["main.js"],"names":["mw","libs","wphl","version","storage","getObject","key","json","localStorage","getItem","JSON","parse","e","setObject","value","setItem","stringify","flatten","Object","fromEntries","entries","obj","arr","flat","reduce","acc","cur","concat","getVersion","str","split","map","Number","msg","args","htmlMsg","$","parseHTML","notify","$p","html","type","autoHideSeconds","tag","majorVersion","slice","join","CDN","CM_CDN","MW_CDN","REPO_CDN","wgPageName","page","wgNamespaceNumber","ns","wgPageContentModel","contentmodel","wgServerName","server","wgScriptPath","scriptPath","wgUserLanguage","userLang","skin","config","values","USING_LOCAL","loader","getState","ALL_SETTINGS_CACHE","SITE_ID","SITE_SETTINGS","EXPIRED","time","Date","now","CONTENTMODEL","css","sanitized-css","javascript","wikitext","MODE_LIST","lib","lua","mediawiki","htmlmixed","xml","ADDON_LIST","searchcursor","search","markSelection","activeLine","trailingspace","matchBrackets","closeBrackets","matchTags","fold","wikiEditor","contextmenu","lint","annotateScrollbar","parser","lintWikitext","options","option","addon","download","only","complex","addons","has","mode","bracketRegex","modes","Set","let","indent","entity","\"","'","<",">","&"," ","convert","func","doc","replaceSelection","getSelection","escapeHTML","c","code","codePointAt","toString","isPc","keyMap","default","pcDefault","extraKeysPc","Ctrl-/","Ctrl-\\","encodeURIComponent","extraKeysMac","Cmd-/","Cmd-\\","handleContextMenu","$wrapper","getWrapperElement","addClass","synonyms","get","functionSynonyms","invoke","调用","widget","小工具","getSysnonyms","keys","filter","startsWith","pageX","pageY","pos","coordsChar","left","top","line","ch","curType","getTokenTypeAt","test","tokens","getLineTokens","i","length","end","string","splice","index","findIndex","start","text","replace","trim","title","Title","namespace","open","getUrl","util","parserFunction","toLowerCase","includes","action","i18n","welcome","a","b","a0","a1","b0","b1","cmpVersion","i18nLang","zh","zh-hans","zh-cn","zh-my","zh-sg","zh-hant","zh-tw","zh-hk","zh-mo","ka","I18N_CDN","isLatest","setI18N","async","assign","ajax","dataType","cache","messages","set","i18nPromise","Promise","all","using","getInternalScript","exts","resolve","getExternalScript","urls","getScript","local","internal","url","external","cm","getAddonScript","CM","other","addonScript","Array","isArray","optionHandlers","intersect","push","some","ele","initMode","scripts","state","loaded","window","CodeMirror","prototype","commands","helpers","load","tags","lang","getSearchCursor","findForward","Parser","delete","undefined","updateCachedConfig","getAliases","words","aliases","name","alias","getConfig","getMwConfig","initModePromise","ref","tagModes","redirect","img","magicwords","extensiontags","functionhooks","variables","Api","meta","siprop","formatversion","query","otherMagicwords","insensitive","subst","pre","nowiki","urlProtocols","realMagicwords","allMagicwords","sensitive","word","doubleUnderscore","find","cmTextSelection","getContents","getValue","setContents","content","setValue","this","setSelection","posFromIndex","focus","getCaretPosition","caretPos","indexFromPos","getCursor","endPos","startAndEnd","scrollToCaretPosition","scrollIntoView","renderEditor","$target","setting","endsWith","pageMode","OO","ui","confirm","actions","label","getPageMode","mwConfig","addWikiEditor","modules","dialogs","toolbar","getDefaultConfig","replaceIcons","console","error","mimeModes","defineMIME","noinclude","height","toTextArea","fromTextArea","extend","inputStyle","lineNumbers","navigator","userAgent","lineWrapping","mod","mainAddon","extraKeys","indentUnit","indentWithTabs","setSize","id","fn","textSelection","context","data","callback","api","openDialog","addKeyMap","Ctrl-F","Cmd-F","children","attr","Wikiplus","getSetting","settings","escToExitQuickEdit","submit","triggerHandler","submitMinor","click","Ctrl-S","Shift-Ctrl-S","Cmd-S","Shift-Cmd-S","Esc","refresh","hook","fire","body","document","observer","MutationObserver","records","$editArea","addedNodes","wphlStyle","observe","childList","on","$textarea","stopPropagation","querySelector","addStyleTag","elem","valHooks","textarea","isWikiplus","dialog","searchWidget","wikiEditorWidget","lintWidget","indentWidget","field","indentField","toggleIndent","toggle","$portlet","addPortletLink","minerva","citizen","moeskin","preventDefault","MessageDialog","windowManager","WindowManager","checkboxMultiselectWidget","$element","appendTo","addWindows","CheckboxMultiselectInputWidget","findItemFromData","NumberInputWidget","min","FieldLayout","notices","align","wikiplusLoaded","Pages","setDisabled","message","add","flags","size","closing","detach","clear","handleOtherEditors","getOption","setOption","getTextArea"],"mappings":";;;;;;CAOA,uBAIC,GAAIA,GAAGC,KAAKC,KACX,OAEDF,GAAGC,KAAKC,KAAO,GAEf,MAAMC,EAAU,SAIVC,EAAgC,iBAAfJ,GAAGI,SAAwD,mBAAzBJ,GAAGI,QAAQC,UACjEL,GAAGI,QACH,CAEDC,UAAUC,GACT,IAAMC,EAAOC,aAAaC,QAAQH,GAClC,IAAa,IAATC,EACH,O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,EAAIgU,UAAU,kBAAkB,IAEjC7S,EAAkBnB,EAAKf,MAGxB/G,GAAGgY,KAAK,mCAAmCsD,IACF,CAAA,CAAExM,GAAIhH,KAAS8T,EAAmB9T,IAE3E9H,GAAGgY,KAAK,aAAasD,IAA0CxT,GAAO8T,EAAmB9T,IACzF9H,GAAGgY,KAAK,mBAAmBsD,IAA0CxT,IAC/DA,EAAIiU,aAAgB3C,GAAWtR,EAAIiU,gBACvCH,EAAmB9T,KAIrB9H,GAAGC,KAAKC,KAAO,CACdC,QAAAA,EACAoG,QAAAA,EACAM,OAAAA,EACAqF,KAAAA,EACAS,SAAAA,EACA8L,UAAAA,GACAqB,SAAAA,GACA5V,YAAAA,EACAe,UAAAA,EACAM,WAAAA,EACAtD,IAAAA,EACAE,QAAAA,EACA8F,WAAAA,EACAgB,kBAAAA,EACAuE,QAAAA,EACAuB,eAAAA,GACA4B,mBAAAA,GACAO,YAAAA,GACA6C,aAAAA,GACA6H,mBAAAA,IA9+BF"}
package/fold.js CHANGED
@@ -132,12 +132,9 @@
132
132
  return undefined;
133
133
  }
134
134
  const {to: bracket} = scanForDelimiterAndBracket(cm, cursor, -1);
135
- if (!bracket) {
136
- return undefined;
137
- }
138
- const {from, to} = scanForDelimiterAndBracket(cm, bracket, 1);
139
- if (typeof from === 'object' && (from.line < to.line || from.ch < to.ch - 2)) {
140
- return {from, to};
135
+ if (bracket) {
136
+ const {from, to} = scanForDelimiterAndBracket(cm, bracket, 1);
137
+ return typeof from === 'object' && (from.line < to.line || from.ch < to.ch - 2) ? {from, to} : undefined;
141
138
  }
142
139
  return undefined;
143
140
  };
package/i18n/en.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "wphl-version": "2.22.6",
2
+ "wphl-version": "2.25.2",
3
3
  "wphl-lang": "en",
4
4
  "wphl-addon-search": "<span title=\"Search with a string or a regular expression\">Search</span>",
5
5
  "wphl-addon-activeline": "Show the active line",
@@ -14,6 +14,7 @@
14
14
  "wphl-addon-indentwithspace": "Indent JavaScript/CSS/Lua codes with spaces instead of tabs",
15
15
  "wphl-addon-indent": "Indent",
16
16
  "wphl-addon-othereditors": "Apply selected addons to other editors",
17
+ "wphl-addon-lint": "Wikitext linter (Beta)",
17
18
  "wphl-addon-label": "Please select the addons you wish to load",
18
19
  "wphl-addon-notice": "Changes will apply when opening a new Wikiplus dialog.",
19
20
  "wphl-addon-title": "Wikiplus Highlight Addons",
package/i18n/ka.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "wphl-version": "2.22.6",
2
+ "wphl-version": "2.25.2",
3
3
  "wphl-lang": "ka",
4
4
  "wphl-addon-search": "<span title=\"ძებნა ნიშნების მწკრივით ან რეგულარული გაფართოებით\">ძებნა</span>",
5
5
  "wphl-addon-activeline": "აქტიური ხაზის მონიშვნა",
package/i18n/zh-hans.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "wphl-version": "2.22.6",
2
+ "wphl-version": "2.25.2",
3
3
  "wphl-lang": "zh-hans",
4
4
  "wphl-addon-search": "<span title=\"搜索字符串或正则表达式\">搜索</span>",
5
5
  "wphl-addon-activeline": "高亮显示光标所在行",
@@ -14,6 +14,7 @@
14
14
  "wphl-addon-indentwithspace": "代码缩进使用空格而非Tab",
15
15
  "wphl-addon-indent": "缩进",
16
16
  "wphl-addon-othereditors": "将选中的插件用于其他编辑器",
17
+ "wphl-addon-lint": "维基语法检查(测试版)",
17
18
  "wphl-addon-label": "请选择您希望加载的插件",
18
19
  "wphl-addon-notice": "更改将于打开新的Wikiplus编辑区时生效。",
19
20
  "wphl-addon-title": "Wikiplus高亮插件",
package/i18n/zh-hant.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "wphl-version": "2.22.6",
2
+ "wphl-version": "2.25.2",
3
3
  "wphl-lang": "zh-hant",
4
4
  "wphl-addon-search": "<span title=\"搜尋字串或正規表示式\">搜尋</span>",
5
5
  "wphl-addon-activeline": "突出顯示游標所在行",
@@ -14,6 +14,7 @@
14
14
  "wphl-addon-indentwithspace": "代碼縮排使用空格而非Tab",
15
15
  "wphl-addon-indent": "縮排",
16
16
  "wphl-addon-othereditors": "將選中的外掛程式用於其他編輯器",
17
+ "wphl-addon-lint": "維基語法檢查(測試版)",
17
18
  "wphl-addon-label": "請選擇您希望載入的外掛程式",
18
19
  "wphl-addon-notice": "更改將於打開新的Wikiplus編輯區時生效。",
19
20
  "wphl-addon-title": "Wikiplus突顯外掛程式",
package/lint.js CHANGED
@@ -26,38 +26,48 @@
26
26
  });
27
27
  };
28
28
 
29
- /** download */
30
- const loadLinter = async () => {
31
- mw.loader.load('//cdn.jsdelivr.net/npm/codemirror@5.65.3/addon/lint/lint.min.css', 'text/css');
32
- mw.loader.addStyleTag(
33
- '.CodeMirror-lint-scroll-warn{'
34
- + 'background:#fc3;border-top:1px solid #fc3;border-bottom:1px solid #fc3;box-sizing:border-box'
35
- + '}'
36
- + '.CodeMirror-lint-scroll-error{'
37
- + 'background:#d33;border-top:1px solid #d33;border-bottom:1px solid #d33;box-sizing:border-box'
38
- + '}',
39
- );
40
- await $.ajax(
41
- `//cdn.jsdelivr.net/combine/${[
42
- 'npm/codemirror@5.65.3/addon/lint/lint.min.js',
43
- 'npm/codemirror@5.65.3/addon/scroll/annotatescrollbar.min.js',
44
- 'gh/bhsd-harry/wikiparser-node@0.4.9-b/bundle/bundle.min.js',
45
- ].join()}`,
46
- {dataType: 'script', cache: true},
47
- );
48
- CodeMirror.registerHelper('lint', 'mediawiki', annotate);
49
- };
29
+ mw.loader.addStyleTag(
30
+ '.CodeMirror-line .CodeMirror-lint-mark-warning{background:#ffbf00;color:#fff}'
31
+ + '.CodeMirror-line .CodeMirror-lint-mark-error{background:#d33;color:#fff}'
32
+ + '.CodeMirror-lint-scroll-warn{'
33
+ + 'background:#fc3;border-top:1px solid #fc3;border-bottom:1px solid #fc3;box-sizing:border-box'
34
+ + '}'
35
+ + '.CodeMirror-lint-scroll-error{'
36
+ + 'background:#d33;border-top:1px solid #d33;border-bottom:1px solid #d33;box-sizing:border-box'
37
+ + '}',
38
+ );
39
+ CodeMirror.registerHelper('lint', 'mediawiki', annotate);
50
40
 
51
41
  /**
52
42
  * start linting
53
43
  * @param {CodeMirror.Editor} cm
54
44
  */
55
- const lint = async cm => {
45
+ const lint = cm => {
56
46
  if (!['mediawiki', 'text/mediawiki'].includes(cm.getOption('mode'))) {
57
47
  return;
48
+ } else if (!Parser.config) {
49
+ const {config: {values: {wgFormattedNamespaces, wgNamespaceIds}}} = mw,
50
+ {minConfig: {parserFunction}} = Parser,
51
+ {
52
+ tags, functionSynonyms: [insensitive, sensitive], doubleUnderscore, urlProtocols, img,
53
+ } = cm.getOption('mwConfig');
54
+ Parser.config = {
55
+ ext: Object.keys(tags),
56
+ namespaces: wgFormattedNamespaces,
57
+ nsid: wgNamespaceIds,
58
+ parserFunction: [
59
+ mw.loader.getState('ext.CodeMirror.data') === 'ready'
60
+ ? Object.keys(insensitive)
61
+ : parserFunction[0],
62
+ Object.keys(sensitive),
63
+ ...parserFunction.slice(2),
64
+ ],
65
+ doubleUnderscore: doubleUnderscore.map(Object.keys),
66
+ protocol: urlProtocols.replaceAll('\\:', ':'),
67
+ img: Object.fromEntries(Object.entries(img).map(([k, v]) => [k, v.slice(4)])),
68
+ };
58
69
  }
59
70
  cm.setOption('scrollButtonHeight', 0);
60
- await ('lint' in CodeMirror.optionHandlers ? null : loadLinter());
61
71
  const annotateScrollError = cm.annotateScrollbar('CodeMirror-lint-scroll-error'),
62
72
  annotateScrollWarn = cm.annotateScrollbar('CodeMirror-lint-scroll-warn');
63
73
 
@@ -83,10 +93,10 @@
83
93
  }
84
94
  });
85
95
  };
86
- mw.hook('wiki-codemirror').add(cm => {
87
- lint(cm);
88
- });
89
- mw.hook('InPageEdit.quickEdit.codemirror').add(/** @param {{cm: CodeMirror.Editor}} */ ({cm}) => {
90
- lint(cm);
96
+
97
+ mw.hook('wiki-codemirror').add(/** @param {CodeMirror.Editor} cm */ cm => {
98
+ if (mw.libs.wphl.addons.has('lint') && cm.getTextArea && cm.getTextArea().id === 'Wikiplus-Quickedit') {
99
+ lint(cm);
100
+ }
91
101
  });
92
102
  })();
package/main.js CHANGED
@@ -14,8 +14,8 @@
14
14
  }
15
15
  mw.libs.wphl = {}; // 开始加载
16
16
 
17
- const version = '2.22.6',
18
- newAddon = 0;
17
+ const version = '2.25.2',
18
+ newAddon = 1;
19
19
 
20
20
  /** @type {typeof mw.storage} */
21
21
  const storage = typeof mw.storage === 'object' && typeof mw.storage.getObject === 'function'
@@ -43,12 +43,7 @@
43
43
  },
44
44
  };
45
45
 
46
- /**
47
- * polyfill for `Object.fromEntries`
48
- * @type {(entries: Iterable<[string, T]>) => Record<string, T>}
49
- * @template T
50
- */
51
- const fromEntries = Object.fromEntries || (entries => { // eslint-disable-line es-x/no-object-fromentries
46
+ Object.fromEntries = Object.fromEntries || (entries => {
52
47
  const /** @type {Record<string, T>} */ obj = {};
53
48
  for (const [key, value] of entries) {
54
49
  obj[key] = value;
@@ -58,15 +53,13 @@
58
53
 
59
54
  /**
60
55
  * polyfill for `Array.prototype.flat`
61
- * @type {(arr: HTMLElement[][]) => HTMLElement[]}
56
+ * @template {*} T
57
+ * @param {(T|T[])[]} arr 任意数组
58
+ * @returns {T[]}
62
59
  */
63
- const flatten = arr => {
64
- if (typeof arr.flat === 'function') {
65
- return arr.flat();
66
- }
67
- // eslint-disable-next-line unicorn/no-array-reduce
68
- return arr.reduce((acc, cur) => acc.concat(cur), []);
69
- };
60
+ const flatten = arr => typeof arr.flat === 'function'
61
+ ? arr.flat()
62
+ : arr.reduce((acc, cur) => acc.concat(cur), []); // eslint-disable-line unicorn/no-array-reduce
70
63
 
71
64
  /**
72
65
  * 解析版本号
@@ -116,6 +109,7 @@
116
109
  const CDN = '//fastly.jsdelivr.net',
117
110
  CM_CDN = 'npm/codemirror@5.65.3',
118
111
  MW_CDN = 'gh/bhsd-harry/codemirror-mediawiki@1.1.6',
112
+ PARSER_CDN = 'gh/bhsd-harry/wikiparser-node@0.5.4-b',
119
113
  REPO_CDN = `npm/wikiplus-highlight@${majorVersion}`;
120
114
 
121
115
  const {config: {values: {
@@ -176,6 +170,10 @@
176
170
  fold: `${REPO_CDN}/fold.min.js`,
177
171
  wikiEditor: 'ext.wikiEditor',
178
172
  contextmenu: 'mediawiki.Title',
173
+ lint: `${CM_CDN}/addon/lint/lint.min.js`,
174
+ annotateScrollbar: `${CM_CDN}/addon/scroll/annotatescrollbar.min.js`,
175
+ parser: `${PARSER_CDN}/bundle/bundle.min.js`,
176
+ lintWikitext: `${REPO_CDN}/lint.min.js`,
179
177
  };
180
178
 
181
179
  /**
@@ -216,9 +214,9 @@
216
214
  ];
217
215
 
218
216
  const defaultAddons = ['search'],
219
- defaultIndent = 4;
220
- let /** @type {Set<string>} */ addons = new Set(storage.getObject('Wikiplus-highlight-addons') || defaultAddons),
221
- /** @type {number} */ indent = storage.getObject('Wikiplus-highlight-indent') || defaultIndent;
217
+ defaultIndent = 4,
218
+ /** @type {Set<string>} */ addons = new Set(storage.getObject('Wikiplus-highlight-addons') || defaultAddons);
219
+ let /** @type {number} */ indent = storage.getObject('Wikiplus-highlight-indent') || defaultIndent;
222
220
 
223
221
  /** @type {Record<string, string>} */
224
222
  const entity = {'"': 'quot', "'": 'apos', '<': 'lt', '>': 'gt', '&': 'amp', ' ': 'nbsp'},
@@ -303,10 +301,9 @@
303
301
  });
304
302
  };
305
303
 
306
- let /** @type {Record<string, string>} */ i18n = storage.getObject('Wikiplus-highlight-i18n'),
307
- /** @type {() => JQuery<HTMLElement>} */ welcome;
308
- if (!i18n) { // 首次安装
309
- i18n = {};
304
+ const /** @type {Record<string, string>} */ i18n = storage.getObject('Wikiplus-highlight-i18n') || {};
305
+ let /** @type {() => JQuery<HTMLElement>} */ welcome;
306
+ if (!i18n['wphl-version']) { // 首次安装
310
307
  welcome = notify('welcome');
311
308
  } else if (cmpVersion(i18n['wphl-version'], version)) { // 更新版本
312
309
  welcome = notify(`welcome-${newAddon ? 'new-addon' : 'upgrade'}`, version, newAddon);
@@ -331,10 +328,10 @@
331
328
  /** 加载 I18N */
332
329
  const setI18N = async () => {
333
330
  if (!isLatest || i18n['wphl-lang'] !== i18nLang) {
334
- i18n = await $.ajax(`${I18N_CDN}`, { // eslint-disable-line require-atomic-updates
331
+ Object.assign(i18n, await $.ajax(`${I18N_CDN}`, { // eslint-disable-line require-atomic-updates
335
332
  dataType: 'json',
336
333
  cache: true,
337
- });
334
+ }));
338
335
  storage.setObject('Wikiplus-highlight-i18n', i18n);
339
336
  }
340
337
  mw.messages.set(i18n);
@@ -417,7 +414,9 @@
417
414
  * 代替`CodeMirror`的局部变量
418
415
  * @type {typeof CodeMirror}
419
416
  */
420
- const CM = loaded ? window.CodeMirror : {modes: {}, prototype: {}, commands: {}, optionHandlers: {}};
417
+ const CM = loaded
418
+ ? window.CodeMirror
419
+ : {modes: {}, prototype: {}, commands: {}, optionHandlers: {}, helpers: {}};
421
420
 
422
421
  // lib
423
422
  if (!loaded) {
@@ -451,9 +450,22 @@
451
450
  if (!CM.prototype.getSearchCursor && addons.has('search') && !addons.has('wikiEditor')) {
452
451
  scripts.push(ADDON_LIST.searchcursor);
453
452
  }
453
+ if (!CM.prototype.annotateScrollbar && type === 'mediawiki' && addons.has('lint')) {
454
+ scripts.push(ADDON_LIST.annotateScrollbar);
455
+ }
454
456
  if (!CM.commands.findForward && addons.has('search') && !addons.has('wikiEditor')) {
455
457
  scripts.push(ADDON_LIST.search);
456
458
  }
459
+ if (!window.Parser && type === 'mediawiki' && addons.has('lint')) {
460
+ scripts.push(ADDON_LIST.parser);
461
+ }
462
+ if (!CM.optionHandlers.lint && type === 'mediawiki' && addons.has('lint')) {
463
+ mw.loader.load(`${CDN}/${CM_CDN}/addon/lint/lint.min.css`, 'text/css');
464
+ scripts.push(ADDON_LIST.lint);
465
+ }
466
+ if (!(CM.helpers.lint && CM.helpers.lint.mediawiki) && type === 'mediawiki' && addons.has('lint')) {
467
+ scripts.push(ADDON_LIST.lintWikitext);
468
+ }
457
469
  if (addons.has('wikiEditor')) {
458
470
  const state = mw.loader.getState('ext.wikiEditor');
459
471
  if (!state) {
@@ -482,18 +494,15 @@
482
494
  /**
483
495
  * 展开别名列表
484
496
  * @param {{aliases: string[], name: string}[]} words 原名
485
- * @returns {{alias: string, name: string}[]}
486
497
  */
487
- const getAliases = words => flatten(
488
- words.map(({aliases, name}) => aliases.map(alias => ({alias, name}))),
489
- );
498
+ const getAliases = words => flatten(words.map(({aliases, name}) => aliases.map(alias => ({alias, name}))));
490
499
 
491
500
  /**
492
501
  * 将别名信息转换为CodeMirror接受的设置
493
502
  * @param {{alias: string, name: string}[]} aliases 别名
494
503
  * @returns {Record<string, string>}
495
504
  */
496
- const getConfig = aliases => fromEntries(
505
+ const getConfig = aliases => Object.fromEntries(
497
506
  aliases.map(({alias, name}) => [alias.replace(/:$/, ''), name]),
498
507
  );
499
508
 
@@ -521,8 +530,6 @@
521
530
  }
522
531
  if (config && config.redirect && config.img) { // 情形1:config已更新,可能来自localStorage
523
532
  return config;
524
- } else if (config) { /** @todo 暂不需要`redirect`和`img`相关设置 */
525
- return config;
526
533
  }
527
534
 
528
535
  /*
@@ -553,7 +560,7 @@
553
560
  nowiki: 'mw-tag-nowiki',
554
561
  ref: 'text/mediawiki',
555
562
  },
556
- tags: fromEntries(
563
+ tags: Object.fromEntries(
557
564
  extensiontags.map(tag => [tag.slice(1, -1), true]),
558
565
  ),
559
566
  urlProtocols: mw.config.get('wgUrlProtocols'),
@@ -588,17 +595,17 @@
588
595
 
589
596
  /** 检查页面语言类型 */
590
597
  const getPageMode = async () => {
591
- if ((ns === 274 || ns === 828) && !page.endsWith('/doc')) {
592
- const pageMode = ns === 274 ? 'Widget' : 'Lua';
593
- await mw.loader.using(['oojs-ui-windows', 'oojs-ui.styles.icons-content']);
594
- const bool = await OO.ui.confirm(msg('contentmodel'), {
595
- actions: [{label: pageMode}, {label: 'Wikitext', action: 'accept'}],
596
- });
597
- return bool ? 'mediawiki' : pageMode.toLowerCase();
598
- } else if (page.endsWith('/doc')) {
598
+ if (page.endsWith('/doc')) {
599
599
  return 'mediawiki';
600
+ } else if (ns !== 274 && ns !== 828) {
601
+ return CONTENTMODEL[contentmodel];
600
602
  }
601
- return CONTENTMODEL[contentmodel];
603
+ const pageMode = ns === 274 ? 'Widget' : 'Lua';
604
+ await mw.loader.using(['oojs-ui-windows', 'oojs-ui.styles.icons-content']);
605
+ const bool = await OO.ui.confirm(msg('contentmodel'), {
606
+ actions: [{label: pageMode}, {label: 'Wikitext', action: 'accept'}],
607
+ });
608
+ return bool ? 'mediawiki' : pageMode.toLowerCase();
602
609
  };
603
610
 
604
611
  /**
@@ -631,10 +638,7 @@
631
638
  /** @override */ getCaretPosition(option) {
632
639
  const caretPos = cm.indexFromPos(cm.getCursor('from')),
633
640
  endPos = cm.indexFromPos(cm.getCursor('to'));
634
- if (option.startAndEnd) {
635
- return [caretPos, endPos];
636
- }
637
- return caretPos;
641
+ return option.startAndEnd ? [caretPos, endPos] : caretPos;
638
642
  },
639
643
  /** @override */ scrollToCaretPosition() {
640
644
  cm.scrollIntoView();
@@ -698,7 +702,7 @@
698
702
  mwConfig,
699
703
  json,
700
704
  },
701
- fromEntries(
705
+ Object.fromEntries(
702
706
  options.map(({option, addon = option, modes, complex = mod => !modes || modes.includes(mod)}) => {
703
707
  const mainAddon = Array.isArray(addon) ? addon[0] : addon;
704
708
  return [option, addons.has(mainAddon) && complex(mode, json)];
@@ -772,9 +776,8 @@
772
776
 
773
777
  // 监视 Wikiplus 编辑框
774
778
  const observer = new MutationObserver(records => {
775
- const $editArea = $(flatten(
776
- records.map(({addedNodes}) => [...addedNodes]),
777
- )).find('#Wikiplus-Quickedit, #Wikiplus-Setting-Input');
779
+ const $editArea = $(flatten(records.map(({addedNodes}) => [...addedNodes])))
780
+ .find('#Wikiplus-Quickedit, #Wikiplus-Setting-Input');
778
781
  if ($editArea.length === 0) {
779
782
  return;
780
783
  }
@@ -851,6 +854,7 @@
851
854
  /** @type {OOUI.CheckboxMultiselectInputWidget} */ widget,
852
855
  /** @type {OOUI.CheckboxMultioptionWidget} */ searchWidget,
853
856
  /** @type {OOUI.CheckboxMultioptionWidget} */ wikiEditorWidget,
857
+ /** @type {OOUI.CheckboxMultioptionWidget} */ lintWidget,
854
858
  /** @type {OOUI.NumberInputWidget} */ indentWidget,
855
859
  /** @type {OOUI.FieldLayout} */ field,
856
860
  /** @type {OOUI.FieldLayout} */ indentField;
@@ -886,7 +890,7 @@
886
890
  const mainAddon = Array.isArray(addon) ? addon[0] : addon;
887
891
  return {data: mainAddon, label: htmlMsg(`addon-${mainAddon.toLowerCase()}`)};
888
892
  }),
889
- ...['wikiEditor', 'escape', 'contextmenu', 'indentWithSpace', 'otherEditors']
893
+ ...['wikiEditor', 'escape', 'contextmenu', 'lint', 'indentWithSpace', 'otherEditors']
890
894
  .map(addon => ({data: addon, label: htmlMsg(`addon-${addon.toLowerCase()}`)})),
891
895
  ],
892
896
  value: [...addons],
@@ -894,6 +898,7 @@
894
898
  const {checkboxMultiselectWidget} = widget;
895
899
  searchWidget = checkboxMultiselectWidget.findItemFromData('search');
896
900
  wikiEditorWidget = checkboxMultiselectWidget.findItemFromData('wikiEditor');
901
+ lintWidget = checkboxMultiselectWidget.findItemFromData('lint');
897
902
  indentWidget = new OO.ui.NumberInputWidget({min: 0, value: indent});
898
903
  field = new OO.ui.FieldLayout(widget, {
899
904
  label: msg('addon-label'),
@@ -907,6 +912,7 @@
907
912
  const wikiplusLoaded = typeof window.Wikiplus === 'object' || typeof window.Pages === 'object';
908
913
  searchWidget.setDisabled(!wikiplusLoaded);
909
914
  wikiEditorWidget.setDisabled(!wikiplusLoaded || !mw.loader.getState('ext.wikiEditor'));
915
+ lintWidget.setDisabled(!wikiplusLoaded);
910
916
  const data = await dialog.open({
911
917
  title: msg('addon-title'),
912
918
  message: field.$element.add(indentField.$element).add(
@@ -923,7 +929,10 @@
923
929
  if (typeof data === 'object' && data.action === 'accept') {
924
930
  /* eslint-disable require-atomic-updates */
925
931
  const value = widget.getValue();
926
- addons = new Set(value);
932
+ addons.clear();
933
+ for (const addon of value) {
934
+ addons.add(addon);
935
+ }
927
936
  indent = Number(indentWidget.getValue());
928
937
  storage.setObject('Wikiplus-highlight-addons', value);
929
938
  storage.setObject('Wikiplus-highlight-indent', indent);
@@ -963,11 +972,11 @@
963
972
  doc.setOption(option, complex(mode, json));
964
973
  }
965
974
  }
966
- if (mode !== 'mediawiki' && addons.has('indentWithSpace')) {
975
+ if (mode === 'mediawiki' && addons.has('escape')) {
976
+ doc.addKeyMap(isPc(CodeMirror) ? extraKeysPc : extraKeysMac, true);
977
+ } else if (mode !== 'mediawiki' && addons.has('indentWithSpace')) {
967
978
  doc.setOption('indentUnit', indent);
968
979
  doc.setOption('indentWithTabs', false);
969
- } else if (mode === 'mediawiki' && addons.has('escape')) {
970
- doc.addKeyMap(isPc(CodeMirror) ? extraKeysPc : extraKeysMac, true);
971
980
  }
972
981
  handleContextMenu(doc, mode);
973
982
  };
@@ -976,6 +985,11 @@
976
985
  /** @param {{cm: CodeMirror.Editor}} */ ({cm: doc}) => handleOtherEditors(doc),
977
986
  );
978
987
  mw.hook('inspector').add(/** @param {CodeMirror.Editor} doc */ doc => handleOtherEditors(doc));
988
+ mw.hook('wiki-codemirror').add(/** @param {CodeMirror.Editor} doc */ doc => {
989
+ if (!doc.getTextArea || !isWikiplus(doc.getTextArea())) {
990
+ handleOtherEditors(doc);
991
+ }
992
+ });
979
993
 
980
994
  mw.libs.wphl = {
981
995
  version,
package/matchtags.js ADDED
@@ -0,0 +1,335 @@
1
+ /*
2
+ * CodeMirror, copyright (c) by Marijn Haverbeke and others
3
+ * Distributed under an MIT license: https://codemirror.net/LICENSE
4
+ * Modified for MediaWiki by Bhsd <https://github.com/bhsd-harry>
5
+ */
6
+
7
+ (() => {
8
+ 'use strict';
9
+
10
+ const {Pos, cmpPos, Init} = CodeMirror;
11
+
12
+ const tagStart = /<(\/?)([_a-z]\w*)/giu,
13
+ voidTags = ['br', 'wbr', 'hr', 'img'],
14
+ maxScanLines = 1000;
15
+
16
+ /** @ignore */
17
+ class Iter {
18
+ /**
19
+ * @param {CodeMirror.Editor} cm
20
+ * @param {CodeMirror.Position} pos 当前位置
21
+ */
22
+ constructor(cm, pos) {
23
+ const {line, ch} = pos;
24
+ this.line = line;
25
+ this.ch = ch;
26
+ this.cm = cm;
27
+ this.text = cm.getLine(line);
28
+ this.min = Math.max(line - maxScanLines + 1, cm.firstLine());
29
+ this.max = Math.min(line + maxScanLines - 1, cm.lastLine());
30
+ }
31
+
32
+ /** 是否是标签 */
33
+ isTag() {
34
+ const type = this.cm.getTokenTypeAt(Pos(this.line, this.ch));
35
+ return /\b(?:mw-(?:html|ext)tag|tag\b)/u.test(type);
36
+ }
37
+
38
+ /**
39
+ * 判断是否是括号
40
+ * @param {number} ch 列号
41
+ */
42
+ bracketAt(ch) {
43
+ const type = this.cm.getTokenTypeAt(Pos(this.line, ch + 1));
44
+ return /\b(?:mw-(?:html|ext)tag-)?bracket\b/u.test(type);
45
+ }
46
+
47
+ /** Jump to the start of the next line */
48
+ nextLine() {
49
+ if (this.line >= this.max) {
50
+ return false;
51
+ }
52
+ this.ch = 0;
53
+ this.text = this.cm.getLine(++this.line);
54
+ return true;
55
+ }
56
+
57
+ /** Jump to the end of the previous line */
58
+ prevLine() {
59
+ if (this.line <= this.min) {
60
+ return false;
61
+ }
62
+ this.text = this.cm.getLine(--this.line);
63
+ this.ch = this.text.length;
64
+ return true;
65
+ }
66
+
67
+ /** Jump to the letter after a `>` towards the line end */
68
+ toTagEnd() {
69
+ for (;;) {
70
+ const gt = this.text.indexOf('>', this.ch);
71
+ if (gt === -1) {
72
+ return undefined;
73
+ }
74
+ this.ch = gt + 1;
75
+ if (this.bracketAt(gt)) {
76
+ return this.text[gt - 1] === '/' ? 'selfClose' : 'regular';
77
+ }
78
+ }
79
+ }
80
+
81
+ /** Jump to a `<` towards the line start */
82
+ toTagStart() {
83
+ for (;;) {
84
+ const lt = this.ch ? this.text.lastIndexOf('<', this.ch - 1) : -1;
85
+ if (lt === -1) {
86
+ return undefined;
87
+ } else if (!this.bracketAt(lt)) {
88
+ this.ch = lt;
89
+ continue;
90
+ }
91
+ tagStart.lastIndex = lt;
92
+ this.ch = lt;
93
+ const match = tagStart.exec(this.text);
94
+ if (match && match.index === lt) {
95
+ return match;
96
+ }
97
+ }
98
+ }
99
+
100
+ /** Jump to the start of the last line, or the letter after a `tagStart` */
101
+ toNextTag() {
102
+ for (;;) {
103
+ tagStart.lastIndex = this.ch;
104
+ const found = tagStart.exec(this.text);
105
+ if (!found) {
106
+ if (this.nextLine()) {
107
+ continue;
108
+ } else {
109
+ return undefined;
110
+ }
111
+ }
112
+ this.ch = found.index + found[0].length;
113
+ if (this.bracketAt(found.index)) {
114
+ return found;
115
+ }
116
+ }
117
+ }
118
+
119
+ /** Jump to the end of the first line, or a non-bracket `>`, or the letter after a tag bracket `>` */
120
+ toPrevTag() {
121
+ for (;;) {
122
+ const gt = this.ch ? this.text.lastIndexOf('>', this.ch - 1) : -1;
123
+ if (gt === -1) {
124
+ if (this.prevLine()) {
125
+ continue;
126
+ } else {
127
+ return undefined;
128
+ }
129
+ }
130
+ if (this.bracketAt(gt)) {
131
+ const lastSlash = this.text.lastIndexOf('/', gt);
132
+ const selfClose = lastSlash > -1 && !/\S/u.test(this.text.slice(lastSlash + 1, gt));
133
+ this.ch = gt + 1;
134
+ return selfClose ? 'selfClose' : 'regular';
135
+ }
136
+ this.ch = gt;
137
+ }
138
+ }
139
+
140
+ // eslint-disable-next-line jsdoc/require-returns-check
141
+ /**
142
+ * 搜索匹配的闭合标签
143
+ * @param {string} tag 标签名
144
+ * @returns {CodeMirror.MatchingTag}
145
+ */
146
+ findMatchingClose(tag) {
147
+ const /** @type {string[]} */ stack = [];
148
+ for (;;) {
149
+ const next = this.toNextTag();
150
+ if (!next) {
151
+ return undefined;
152
+ }
153
+ const start = this.ch - next[0].length,
154
+ end = this.toTagEnd(),
155
+ tagName = next[2].toLowerCase();
156
+ if (!end) {
157
+ return undefined;
158
+ } else if (end === 'selfClose' || voidTags.includes(tagName)) {
159
+ continue;
160
+ } else if (next[1]) { // closing tag
161
+ let i = stack.length - 1;
162
+ for (; i >= 0; --i) {
163
+ if (stack[i] === tagName) {
164
+ stack.length = i;
165
+ break;
166
+ }
167
+ }
168
+ if (i < 0 && (!tag || tag === tagName)) {
169
+ return {tag: tagName, from: Pos(this.line, start), to: Pos(this.line, this.ch)};
170
+ }
171
+ } else { // opening tag
172
+ stack.push(tagName);
173
+ }
174
+ }
175
+ }
176
+
177
+ // eslint-disable-next-line jsdoc/require-returns-check
178
+ /**
179
+ * 搜索匹配的开启标签
180
+ * @param {string|undefined} tag 标签名
181
+ * @returns {CodeMirror.MatchingTag}
182
+ */
183
+ findMatchingOpen(tag) {
184
+ const /** @type {string[]} */ stack = [];
185
+ for (;;) {
186
+ const prev = this.toPrevTag();
187
+ if (!prev) {
188
+ return undefined;
189
+ }
190
+ const {ch: end} = this,
191
+ start = this.toTagStart();
192
+ if (!start) {
193
+ return undefined;
194
+ }
195
+ const tagName = start[2].toLowerCase();
196
+ if (prev === 'selfClose' || voidTags.includes(tagName)) {
197
+ continue;
198
+ } else if (start[1]) { // closing tag
199
+ stack.push(tagName);
200
+ } else { // opening tag
201
+ let i = stack.length - 1;
202
+ for (; i >= 0; --i) {
203
+ if (stack[i] === tagName) {
204
+ stack.length = i;
205
+ break;
206
+ }
207
+ }
208
+ if (i < 0 && (!tag || tag === tagName)) {
209
+ // eslint-disable-next-line unicorn/consistent-destructuring
210
+ return {tag: tagName, from: Pos(this.line, this.ch), to: Pos(this.line, end)};
211
+ }
212
+ }
213
+ }
214
+ }
215
+ }
216
+
217
+ CodeMirror.defineExtension(
218
+ 'findMatchingTag',
219
+
220
+ /**
221
+ * @this {CodeMirror.Editor}
222
+ * @param {CodeMirror.Position} pos 当前位置
223
+ * @returns {CodeMirror.MatchingTagPair}
224
+ */
225
+ function(pos) {
226
+ let iter = new Iter(this, pos);
227
+ if (!iter.isTag()) {
228
+ return undefined;
229
+ }
230
+ const end = iter.toTagEnd(),
231
+ to = end && Pos(iter.line, iter.ch);
232
+ const start = end && iter.toTagStart();
233
+ if (!start || cmpPos(iter, pos) > 0) {
234
+ return undefined;
235
+ }
236
+ const tag = start[2].toLowerCase(),
237
+ here = {from: Pos(iter.line, iter.ch), to, tag};
238
+ if (end === 'selfClose' || voidTags.includes(tag)) {
239
+ return {open: here, close: null, at: 'self'};
240
+ }
241
+
242
+ if (start[1]) { // closing tag
243
+ return {open: iter.findMatchingOpen(tag), close: here, at: 'close'};
244
+ } // opening tag
245
+ iter = new Iter(this, to);
246
+ return {open: here, close: iter.findMatchingClose(tag), at: 'open'};
247
+ },
248
+ );
249
+
250
+ CodeMirror.defineExtension(
251
+ 'findEnclosingTag',
252
+
253
+ /**
254
+ * @this {CodeMirror.Editor}
255
+ * @param {CodeMirror.Position} pos
256
+ * @param {string} tag
257
+ * @returns {CodeMirror.MatchingTagPair}
258
+ */
259
+ function(pos, tag) {
260
+ const iter = new Iter(this, pos),
261
+ open = iter.findMatchingOpen(tag);
262
+ if (!open) {
263
+ return undefined;
264
+ }
265
+ const forward = new Iter(this, pos),
266
+ close = forward.findMatchingClose(open.tag);
267
+ return close ? {open, close} : undefined;
268
+ },
269
+ );
270
+
271
+ /** Used by addon/edit/closetag.js */
272
+ CodeMirror.scanForClosingTag = (cm, pos, tagName) => {
273
+ const iter = new Iter(cm, pos);
274
+ return iter.findMatchingClose(tagName);
275
+ };
276
+
277
+ CodeMirror.defineOption('matchTags', false, (cm, val, old) => {
278
+ if (old && old !== Init) {
279
+ cm.off('cursorActivity', doMatchTags);
280
+ clear(cm);
281
+ }
282
+ if (val) {
283
+ cm.on('cursorActivity', doMatchTags);
284
+ doMatchTags(cm);
285
+ }
286
+ });
287
+
288
+ /**
289
+ * 清除高亮
290
+ * @param {CodeMirror.EditorWithMatchingTags} cm
291
+ */
292
+ const clear = cm => {
293
+ if (cm.state.tagHit) {
294
+ cm.state.tagHit.clear();
295
+ }
296
+ if (cm.state.tagOther) {
297
+ cm.state.tagOther.clear();
298
+ }
299
+ cm.state.tagHit = null;
300
+ cm.state.tagOther = null;
301
+ };
302
+
303
+ /**
304
+ * 搜索并高亮匹配的标签
305
+ * @param {CodeMirror.EditorWithMatchingTags} cm
306
+ */
307
+ const doMatchTags = cm => {
308
+ cm.operation(() => {
309
+ clear(cm);
310
+ if (cm.somethingSelected()) {
311
+ return;
312
+ }
313
+ const match = cm.findMatchingTag(cm.getCursor());
314
+ if (!match) {
315
+ return;
316
+ } else if (match.at === 'self') {
317
+ cm.state.tagHit = cm.markText(match.open.from, match.open.to, {className: 'cm-matchingtag'});
318
+ return;
319
+ }
320
+ const hit = match.at === 'open' ? match.open : match.close,
321
+ other = match.at === 'close' ? match.open : match.close;
322
+ if (hit) {
323
+ cm.state.tagHit = cm.markText(hit.from, hit.to, {className: `cm-${other ? '' : 'non'}matchingtag`});
324
+ }
325
+ if (other) {
326
+ cm.state.tagOther = cm.markText(other.from, other.to, {className: 'cm-matchingtag'});
327
+ }
328
+ });
329
+ };
330
+
331
+ mw.loader.addStyleTag(
332
+ '.cm-matchingtag{background-color:#c9ffc8}'
333
+ + '.cm-nonmatchingtag{background-color:#fff0a8}',
334
+ );
335
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikiplus-highlight",
3
- "version": "2.22.6",
3
+ "version": "2.25.3",
4
4
  "description": "A plugin for the MediaWiki front-end add-on \"Wikiplus\"",
5
5
  "keywords": [
6
6
  "mediawiki",
@@ -16,11 +16,7 @@
16
16
  "files": [
17
17
  "/dist/",
18
18
  "/i18n/",
19
- "/fold.js",
20
- "/lint.js",
21
- "/main.js",
22
- "/matchtag.js",
23
- "/search.js"
19
+ "/*.js"
24
20
  ],
25
21
  "browser": "/main.js",
26
22
  "repository": {