From 5cd2db88e27fb68ea2985539c175a4a57cd95c6a Mon Sep 17 00:00:00 2001 From: zhangyun Date: Sat, 7 Oct 2023 11:11:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=A3=E5=86=B3innerHtml?= =?UTF-8?q?=E6=BC=8F=E6=B4=9E=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- media/operation.js | 102 +-------------------------------------------- 1 file changed, 1 insertion(+), 101 deletions(-) diff --git a/media/operation.js b/media/operation.js index 2e7df4d..5564f3f 100644 --- a/media/operation.js +++ b/media/operation.js @@ -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 += ''; - // // 添加点击事件 - // 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( - // '' - // ) - - // // 添加点击事件 - // 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 */