This commit is contained in:
xiayuqi 2023-10-09 00:31:31 -07:00
commit c5a4279e04
1 changed files with 1 additions and 101 deletions

View File

@ -3,13 +3,6 @@
(function () {
const vscode = acquireVsCodeApi();
// const oldState = vscode.getState() || { colors: [] };
/** @type {Array<{ value: string }>} */
// let colors = oldState.colors;
// updateColorList(colors);
// Handle messages sent from the extension to the webview
window.addEventListener('message', event => {
const message = event.data; // The json data that the extension sent
@ -26,34 +19,9 @@
initButtons(message.list);
break;
}
// case 'clearColors':
// {
// colors = [];
// updateColorList(colors);
// break;
// }
}
});
// document.querySelector('.build-button').addEventListener('click', () => {
// operationProject('build');
// });
// document.querySelector('.run-button').addEventListener('click', () => {
// operationProject('run');
// });
// document.querySelector('.package-button').addEventListener('click', () => {
// operationProject('package');
// });
// document.querySelector('.create-button').addEventListener('click', () => {
// operationProject('create');
// });
// document.querySelector('.config-button').addEventListener('click', () => {
// operationProject('config');
// });
operationInit();
function initButtons(list){
@ -65,18 +33,12 @@
if(list != undefined && list.length > 0){
for(var i = 0; i < list.length; i++) {
let item = list[i];
// // 添加按钮
// part.innerHTML += '<button class="' + item.type + '-button">' + item.title + '</button>';
// // 添加点击事件
// document.querySelector("." + item.type + '-button').addEventListener(item.type, () => {
// operationProject(item.type);
// });
if(item.status < 0){
// 忽略/
continue;
}
let btn = document.createElement("button");
btn.innerHTML = item.title;
btn.textContent = item.title;
let className = item.type + "-button";
btn.setAttribute("class", className);
var p_style = document.createAttribute("style");
@ -98,27 +60,6 @@
}
}
// for(var i = childs.length - 1; i >= 0; i--) {
// part.removeChild(childs[i]);
// }
// if(list != undefined && list.length > 0){
// for(var i = 0; i < list.length; i++) {
// let item = list[i];
// // 添加按钮
// let btn = document.createElement("button");
// btn.
// part.appendChild(
// '<button class="' + item.type + '-button">' + item.title + '</button>'
// )
// // 添加点击事件
// document.querySelector(item.type + '.config-button').addEventListener(item.type, () => {
// operationProject(item.type);
// });
// }
// }
}
function showStatus(status){
@ -132,47 +73,6 @@
}
}
// /**
// * @param {Array<{ value: string }>} colors
// */
// function updateColorList(colors) {
// const ul = document.querySelector('.color-list');
// ul.textContent = '';
// for (const color of colors) {
// const li = document.createElement('li');
// li.className = 'color-entry';
// const colorPreview = document.createElement('div');
// colorPreview.className = 'color-preview';
// colorPreview.style.backgroundColor = `#${color.value}`;
// colorPreview.addEventListener('click', () => {
// onColorClicked(color.value);
// });
// li.appendChild(colorPreview);
// const input = document.createElement('input');
// input.className = 'color-input';
// input.type = 'text';
// input.value = color.value;
// input.addEventListener('change', (e) => {
// const value = e.target.value;
// if (!value) {
// // Treat empty value as delete
// colors.splice(colors.indexOf(color), 1);
// } else {
// color.value = value;
// }
// updateColorList(colors);
// });
// li.appendChild(input);
// ul.appendChild(li);
// }
// // Update the saved state
// vscode.setState({ colors: colors });
// }
/**
* @param {string} color
*/