UNPKG

code-server

Version:

Run VS Code on a remote server.

2 lines (1 loc) 1.81 kB
function a(){let s=document.getElementById("vscode-markdown-preview-data");if(s){let e=s.getAttribute("data-strings");if(e)return JSON.parse(e)}throw new Error("Could not load strings")}var o=class{#e=!1;#s=!1;#t;#r;constructor(e){this.#r=e,document.addEventListener("securitypolicyviolation",()=>{this.#o()}),window.addEventListener("message",t=>{t?.data&&t.data.name==="vscode-did-block-svg"&&this.#o()})}setPoster(e){this.#t=e,this.#s&&this.#n()}#o(){this.#s=!0,this.#n()}#n(){let e=a(),t=this.#r.settings;if(this.#e||t.disableSecurityWarnings||!this.#t)return;this.#e=!0;let r=document.createElement("a");r.innerText=e.cspAlertMessageText,r.setAttribute("id","code-csp-warning"),r.setAttribute("title",e.cspAlertMessageTitle),r.setAttribute("role","button"),r.setAttribute("aria-label",e.cspAlertMessageLabel),r.onclick=()=>{this.#t.postMessage("showPreviewSecuritySelector",{source:t.source})},document.body.appendChild(r)}};var n=class{#e=[];#s=!1;#t;constructor(){let e=t=>{if(!(t instanceof Event))return;let r=t.target?.dataset.source;r&&this.#e.push(r)};window.addEventListener("DOMContentLoaded",()=>{for(let t of document.getElementsByClassName("code-user-style"))t.dataset.source&&(t.onerror=e)}),window.addEventListener("load",()=>{this.#e.length&&(this.#s=!0,this.#t?.postMessage("previewStyleLoadError",{unloadedStyles:this.#e}))})}setPoster(e){this.#t=e,this.#s&&e.postMessage("previewStyleLoadError",{unloadedStyles:this.#e})}};function d(s){let e=document.getElementById("vscode-markdown-preview-data");if(e){let t=e.getAttribute(s);if(t)return t}throw new Error(`Could not load data for ${s}`)}function l(s){return JSON.parse(d(s))}var i=class{#e=l("data-settings");get settings(){return this.#e}updateSettings(e){this.#e=e}};window.cspAlerter=new o(new i);window.styleLoadingMonitor=new n;