first commit
This commit is contained in:
65
src/launcherView.ts
Normal file
65
src/launcherView.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export class LauncherViewProvider implements vscode.WebviewViewProvider {
|
||||
resolveWebviewView(view: vscode.WebviewView) {
|
||||
view.webview.options = { enableScripts: true };
|
||||
view.webview.html = getHtml();
|
||||
view.webview.onDidReceiveMessage((msg) => {
|
||||
if (msg?.type === 'open' && typeof msg.command === 'string') {
|
||||
vscode.commands.executeCommand(msg.command);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getHtml(): string {
|
||||
return `<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<style>
|
||||
body { font-family: var(--vscode-font-family); color: var(--vscode-foreground); padding: 12px 8px; }
|
||||
h3 { margin: 0 0 12px 0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; opacity: 0.7; }
|
||||
.tool-btn {
|
||||
display: block; width: 100%; text-align: left;
|
||||
padding: 8px 10px; margin-bottom: 6px;
|
||||
background: var(--vscode-button-secondaryBackground);
|
||||
color: var(--vscode-button-secondaryForeground);
|
||||
border: 1px solid var(--vscode-panel-border);
|
||||
border-radius: 3px; cursor: pointer; font-size: 13px;
|
||||
}
|
||||
.tool-btn:hover {
|
||||
background: var(--vscode-button-secondaryHoverBackground);
|
||||
}
|
||||
.tool-desc { display: block; font-size: 11px; opacity: 0.7; margin-top: 2px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h3>HPL Toolbox</h3>
|
||||
<button class="tool-btn" data-cmd="hplToolbox.openPlecUpload">
|
||||
PLEC Upload
|
||||
<span class="tool-desc">Upload HTML to internal PLEC server</span>
|
||||
</button>
|
||||
<button class="tool-btn" data-cmd="hplToolbox.openApplovinUpload">
|
||||
AppLovin Demo Upload
|
||||
<span class="tool-desc">Upload to p.applov.in (QR preview)</span>
|
||||
</button>
|
||||
<button class="tool-btn" data-cmd="hplToolbox.openBase64Scanner">
|
||||
Base64 Scanner
|
||||
<span class="tool-desc">Find non-base64 assets in HTML</span>
|
||||
</button>
|
||||
<button class="tool-btn" data-cmd="hplToolbox.openDailyUpdate">
|
||||
Daily Update
|
||||
<span class="tool-desc">Compose & copy a daily status</span>
|
||||
</button>
|
||||
<script>
|
||||
const vscode = acquireVsCodeApi();
|
||||
document.querySelectorAll('.tool-btn').forEach((btn) => {
|
||||
btn.addEventListener('click', () => {
|
||||
vscode.postMessage({ type: 'open', command: btn.dataset.cmd });
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>`;
|
||||
}
|
||||
Reference in New Issue
Block a user