4 lines
2.0 KiB
JavaScript
4 lines
2.0 KiB
JavaScript
|
|
(function() {
|
||
|
|
"use strict";const n={debug:(...a)=>{}},l="drawio_";class g{constructor(){this.callbacks={},window.addEventListener("message",e=>{if(e.origin!==window.location.origin){n.debug("Rejected message from invalid origin:",e.origin);return}switch(n.debug("Received message:",e.data,e.payload),e.data.type){case l+"callback":var t=e.data,r=t.callbackId,s=t.payload;r&&this.callbacks[r]&&(this.callbacks[r].apply(null,s),delete this.callbacks[r]);return}})}sendMessage(e,t,r,s){r&&(this.callbacks[r]=s),window.parent.postMessage({type:l+e,payload:t,callbackId:r})}}class w{sendMessage(e,t,r,s){}}class d{constructor(e=!1){this.storage=window.localStorage,this.debug=e,this.electron=new w}setElectron(e){this.electron=e}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}key(e){return this.storage.key(e)}get length(){return this.storage.length}}window.isLocalStorage=!0;const p=window.storage=new d;function m(){let a=parent==null?void 0:parent.siyuan.config.lang;if(a!=null){var e=a.indexOf("_");e>=0&&(a=a.substring(0,e)),a=a.toLowerCase()}return a}window.DRAWIO_PUBLIC_BUILD=!0;var o,c,u;window.PLANT_URL=((u=(c=(o=parent==null?void 0:parent.siyuan)==null?void 0:o.config)==null?void 0:c.editor)==null?void 0:u.plantUMLServePath.replace("/svg/~1",""))??"https://www.plantuml.com/plantuml";window.DRAWIO_BASE_URL="/plugins/siyuan-drawio-plugin/webapp/";window.DRAWIO_VIEWER_URL="/plugins/siyuan-drawio-plugin/webapp/js/viewer.min.js";window.DRAWIO_LIGHTBOX_URL="/plugins/siyuan-drawio-plugin/webapp";window.DRAW_MATH_URL="math/es5";window.DRAWIO_CONFIG=null;urlParams.sync="manual";urlParams.mode="device";urlParams.gapi=0;urlParams.db=0;urlParams.od=0;urlParams.tr=0;urlParams.gh=0;urlParams.gl=0;parent.siyuan&&(urlParams.lang=m(),window.electron=new g,p.setElectron(electron));const i=new URLSearchParams(location.search);i.get("lightbox")==="1"&&!i.get("toolbar-config")&&(urlParams["toolbar-config"]=JSON.stringify({refreshBtn:{}}));
|
||
|
|
|
||
|
|
})();
|