test
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
mol
2024-07-06 22:23:31 +08:00
parent 08173d8497
commit 263cb5ef03
1663 changed files with 526884 additions and 0 deletions

View File

@ -0,0 +1,5 @@
# Simple Browser
**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
Provides a very basic browser preview using an iframe embedded in a [webviewW](). This extension is primarily meant to be used by other extensions for showing simple web content.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1 @@
function s(e){document.readyState==="loading"||document.readyState==="uninitialized"?document.addEventListener("DOMContentLoaded",e):e()}var d=acquireVsCodeApi();function i(){let e=document.getElementById("simple-browser-settings");if(e){let t=e.getAttribute("data-settings");if(t)return JSON.parse(t)}throw new Error("Could not load settings")}var r=i(),c=document.querySelector("iframe"),n=document.querySelector(".header"),a=n.querySelector(".url-input"),l=n.querySelector(".forward-button"),m=n.querySelector(".back-button"),g=n.querySelector(".reload-button"),E=n.querySelector(".open-external-button");window.addEventListener("message",e=>{switch(e.data.type){case"focus":{c.focus();break}case"didChangeFocusLockIndicatorEnabled":{u(e.data.enabled);break}}});s(()=>{setInterval(()=>{let t=document.activeElement?.tagName==="IFRAME";document.body.classList.toggle("iframe-focused",t)},50),c.addEventListener("load",()=>{}),a.addEventListener("change",t=>{let o=t.target.value;e(o)}),l.addEventListener("click",()=>{history.forward()}),m.addEventListener("click",()=>{history.back()}),E.addEventListener("click",()=>{d.postMessage({type:"openExternal",url:a.value})}),g.addEventListener("click",()=>{e(a.value)}),e(r.url),a.value=r.url,u(r.focusLockIndicatorEnabled);function e(t){try{let o=new URL(t);o.searchParams.append("vscodeBrowserReqId",Date.now().toString()),c.src=o.toString()}catch{c.src=t}d.setState({url:t})}});function u(e){document.body.classList.toggle("enable-focus-lock-indicator",e)}

View File

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
:root {
--container-paddding: 20px;
--input-padding-vertical: 2px;
--input-padding-horizontal: 4px;
--input-margin-vertical: 4px;
--input-margin-horizontal: 0;
}
html, body {
height: 100%;
min-height: 100%;
padding: 0;
margin: 0;
}
body {
display: grid;
grid-template-rows: auto 1fr;
}
input:not([type='checkbox']),
textarea {
display: block;
width: 100%;
border: none;
margin-right: 0.3em;
font-family: var(--vscode-font-family);
padding: var(--input-padding-vertical) var(--input-padding-horizontal);
color: var(--vscode-input-foreground);
outline-color: var(--vscode-input-border);
background-color: var(--vscode-input-background);
}
input::placeholder,
textarea::placeholder {
color: var(--vscode-input-placeholderForeground);
}
button {
border: none;
padding: 3px;
text-align: center;
outline: 1px solid transparent;
color: var(--vscode-icon-foreground);
background: none;
border-radius: 5px;
}
button:hover:not(:disabled) {
cursor: pointer;
color: var(--vscode-toolbar-hoverForeground);
background: var(--vscode-toolbar-hoverBackground);
}
button:disabled {
opacity: 0.5;
}
input:focus,
button:focus {
outline-color: var(--vscode-focusBorder);
}
.header {
display: flex;
margin: 0.4em 1em;
}
.url-input {
flex: 1;
}
.controls {
display: flex;
}
.controls button {
display: flex;
margin-right: 0.3em;
}
.content {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
}
iframe {
width: 100%;
height: 100%;
border: none;
background: white; /* Browsers default to a white background */
}
.iframe-focused-alert {
display: none;
position: absolute;
bottom: 1em;
background: var(--vscode-editorWidget-background);
color: var(--vscode-editorWidget-foreground);
padding: 0.2em 0.2em;
border-radius: 4px;
font-size: 8px;
font-family: monospace;
user-select: none;
pointer-events: none;
}
.iframe-focused.enable-focus-lock-indicator .iframe-focused-alert {
display: block;
}

View File

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 2L1 3V13L2 14H14L15 13V3L14 2H2ZM2 13V3H14V13H2ZM12 5H4V6H12V5ZM3 4V7H13V4H3ZM7 9H3V8H7V9ZM3 12H7V11H3V12ZM12 9H10V11H12V9ZM9 8V12H13V8H9Z" fill="#C5C5C5"/>
</svg>

After

Width:  |  Height:  |  Size: 312 B

View File

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 2L1 3V13L2 14H14L15 13V3L14 2H2ZM2 13V3H14V13H2ZM12 5H4V6H12V5ZM3 4V7H13V4H3ZM7 9H3V8H7V9ZM3 12H7V11H3V12ZM12 9H10V11H12V9ZM9 8V12H13V8H9Z" fill="#424242"/>
</svg>

After

Width:  |  Height:  |  Size: 312 B

View File

@ -0,0 +1 @@
{"name":"simple-browser","displayName":"%displayName%","description":"%description%","enabledApiProposals":["externalUriOpener"],"version":"1.0.0","icon":"media/icon.png","publisher":"vscode","license":"MIT","aiKey":"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255","engines":{"vscode":"^1.70.0"},"main":"./dist/extension","browser":"./dist/browser/extension","categories":["Other"],"extensionKind":["ui","workspace"],"activationEvents":["onCommand:simpleBrowser.api.open","onOpenExternalUri:http","onOpenExternalUri:https","onWebviewPanel:simpleBrowser.view"],"capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"contributes":{"commands":[{"command":"simpleBrowser.show","title":"Show","category":"Simple Browser"}],"configuration":[{"title":"Simple Browser","properties":{"simpleBrowser.focusLockIndicator.enabled":{"type":"boolean","default":true,"title":"Focus Lock Indicator Enabled","description":"%configuration.focusLockIndicator.enabled.description%"}}}]},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}}

View File

@ -0,0 +1 @@
{"displayName":"Simple Browser","description":"A very basic built-in webview for displaying web content.","configuration.focusLockIndicator.enabled.description":"Enable/disable the floating indicator that shows when focused in the simple browser."}