style: tab -> 2 spaces in all html files
This commit is contained in:
101
test/home.html
101
test/home.html
@@ -6,30 +6,40 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Embedded page</title>
|
||||
<link rel="stylesheet" href="web_src/css/themes/theme-gitea-auto.css">
|
||||
<style>
|
||||
/* 弹窗基本样式 */
|
||||
.modal {
|
||||
display: none; /* 默认隐藏 */
|
||||
position: fixed; /* 固定定位 */
|
||||
display: none;
|
||||
/* 默认隐藏 */
|
||||
position: fixed;
|
||||
/* 固定定位 */
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%; /* 全屏宽 */
|
||||
height: 100%; /* 全屏高 */
|
||||
background-color: rgba(0,0,0,0.5); /* 半透明黑色背景 */
|
||||
z-index: 1; /* 确保在顶部 */
|
||||
width: 100%;
|
||||
/* 全屏宽 */
|
||||
height: 100%;
|
||||
/* 全屏高 */
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
/* 半透明黑色背景 */
|
||||
z-index: 1;
|
||||
/* 确保在顶部 */
|
||||
}
|
||||
|
||||
/* 弹窗内容框样式 */
|
||||
.modal-content {
|
||||
background-color: #fefefe;
|
||||
margin: 15% auto; /* 15% 从顶部开始,自动水平居中 */
|
||||
margin: 15% auto;
|
||||
/* 15% 从顶部开始,自动水平居中 */
|
||||
padding: 20px;
|
||||
border: 1px solid #888;
|
||||
width: 30%; /* 弹窗宽度 */
|
||||
width: 30%;
|
||||
/* 弹窗宽度 */
|
||||
}
|
||||
|
||||
/* 关闭按钮样式 */
|
||||
@@ -49,9 +59,12 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
|
||||
.alert {
|
||||
position: fixed;
|
||||
top: 20px; /* 距离顶部20px */
|
||||
left: 50%; /* 水平居中 */
|
||||
transform: translateX(-50%); /* 水平居中调整 */
|
||||
top: 20px;
|
||||
/* 距离顶部20px */
|
||||
left: 50%;
|
||||
/* 水平居中 */
|
||||
transform: translateX(-50%);
|
||||
/* 水平居中调整 */
|
||||
background-color: green;
|
||||
color: white;
|
||||
text-align: center;
|
||||
@@ -59,42 +72,54 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
border-radius: 5px;
|
||||
display: none;
|
||||
z-index: 2;
|
||||
width: auto; /* 自动宽度 */
|
||||
max-width: 60%; /* 最大宽度60% */
|
||||
width: auto;
|
||||
/* 自动宽度 */
|
||||
max-width: 60%;
|
||||
/* 最大宽度60% */
|
||||
}
|
||||
|
||||
/* table样式 */
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
|
||||
th,
|
||||
td {
|
||||
border: 1px solid black;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.required::before {
|
||||
content: "*";
|
||||
color: red;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
label, input, textarea {
|
||||
label,
|
||||
input,
|
||||
textarea {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
input,
|
||||
textarea {
|
||||
padding: 8px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.button-container {
|
||||
display: flex;
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
ton {
|
||||
width: 100px;
|
||||
height: 30px;
|
||||
@@ -104,6 +129,7 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
@@ -116,6 +142,7 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
<div id="loginModal" class="modal">
|
||||
<div class="modal-content">
|
||||
<span class="close" onclick="closeLoginModal()">×</span>
|
||||
<div>
|
||||
<h2>Login</h2>
|
||||
<form id="loginForm">
|
||||
<label for="username">Username:</label>
|
||||
@@ -126,6 +153,7 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button onclick="openLoginModal()">Login</button>
|
||||
<button onclick="logout()">Logout</button>
|
||||
@@ -140,11 +168,12 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
<form>
|
||||
<!-- project settings -->
|
||||
<label class="required" for="projectName">Name</label>
|
||||
<input type="text" id="projectName" name="projectName" ><br><br>
|
||||
<input type="text" id="projectName" name="projectName"><br><br>
|
||||
<label for="projectDesc">Description</label>
|
||||
<textarea id="projectDesc" name="projectDesc" placeholder="(Optional)"></textarea><br><br>
|
||||
<label for="repoURL">Repo URL</label>
|
||||
<input type="text" id="repoURL" name="repoURL" placeholder="(Optional) Project repository you want to clone"><br><br>
|
||||
<input type="text" id="repoURL" name="repoURL"
|
||||
placeholder="(Optional) Project repository you want to clone"><br><br>
|
||||
<hr>
|
||||
<!-- repo settings-->
|
||||
<label for="template">
|
||||
@@ -200,7 +229,7 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
var REPOLIST = []
|
||||
var PROJECTLIST = []
|
||||
|
||||
window.onload = async function() {
|
||||
window.onload = async function () {
|
||||
await getUserTokenFromVSCode()
|
||||
.then(async userToken => {
|
||||
// verify user token
|
||||
@@ -257,7 +286,7 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
async function getUsernameFromVSCode() {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
await communicateVSCodeByWebview('getUsername', null)
|
||||
.then(async data=> {
|
||||
.then(async data => {
|
||||
const username = data.username
|
||||
if (username === undefined) {
|
||||
reject('username is undefined')
|
||||
@@ -384,7 +413,7 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
});
|
||||
}
|
||||
|
||||
function generateTokenName(length=10) {
|
||||
function generateTokenName(length = 10) {
|
||||
// tokenName is random string and number and _ combination (10 characters)
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_';
|
||||
let name = '';
|
||||
@@ -414,9 +443,9 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
communicateVSCodeByWebview('setUserToken', { userToken: userToken })
|
||||
.then(result => {
|
||||
if (result.ok) {
|
||||
console.log(removeUserToken ? 'User token has been removed from vscode' :'User token has been stored in vscode')
|
||||
console.log(removeUserToken ? 'User token has been removed from vscode' : 'User token has been stored in vscode')
|
||||
} else {
|
||||
console.error(removeUserToken ? 'Failed to remove user token from vscode': 'Failed to store user token into vscode')
|
||||
console.error(removeUserToken ? 'Failed to remove user token from vscode' : 'Failed to store user token into vscode')
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
@@ -430,12 +459,12 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
removeUsername = true;
|
||||
}
|
||||
|
||||
await communicateVSCodeByWebview('setUsername', {username: username})
|
||||
await communicateVSCodeByWebview('setUsername', { username: username })
|
||||
.then(result => {
|
||||
if (result.ok) {
|
||||
console.log(removeUsername ? 'User name has been removed from vscode': 'User name has been stored in vscode')
|
||||
console.log(removeUsername ? 'User name has been removed from vscode' : 'User name has been stored in vscode')
|
||||
} else {
|
||||
console.error(removeUsername ? 'Failed to removing user name from vscode': 'Failed to store user name in vscode')
|
||||
console.error(removeUsername ? 'Failed to removing user name from vscode' : 'Failed to store user name in vscode')
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
@@ -561,7 +590,7 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
document.getElementById('myModal').style.display = "none";
|
||||
}
|
||||
// 点击窗外关闭弹窗
|
||||
window.onclick = function(event) {
|
||||
window.onclick = function (event) {
|
||||
if (event.target == document.getElementById('myModal')) {
|
||||
closeModal();
|
||||
}
|
||||
@@ -679,7 +708,7 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
const devContainerWorkDir = data.data.devContainerWorkDir
|
||||
|
||||
// default: open with key
|
||||
communicateVSCodeByWebview('firstOpenRemoteFolder', {host: `${devContainerHost}`, username: `${devContainerUsername}`, port: `${devContainerPort}`, path: `${devContainerWorkDir}`})
|
||||
communicateVSCodeByWebview('firstOpenRemoteFolder', { host: `${devContainerHost}`, username: `${devContainerUsername}`, port: `${devContainerPort}`, path: `${devContainerWorkDir}` })
|
||||
} else {
|
||||
// show Error to User
|
||||
showAlert("打开容器失败!", 1500)
|
||||
@@ -822,11 +851,11 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
function firstOpenRemoteFolder(host, username, password, port, path) {
|
||||
const message = {
|
||||
action: 'firstOpenRemoteFolder',
|
||||
host : host,
|
||||
username : username,
|
||||
password : password,
|
||||
port : port,
|
||||
path : path,
|
||||
host: host,
|
||||
username: username,
|
||||
password: password,
|
||||
port: port,
|
||||
path: path,
|
||||
}
|
||||
// 向iframe父页面发送消息
|
||||
window.parent.postMessage(message, '*');
|
||||
@@ -835,8 +864,8 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
function openRemoteFolder(host, path) {
|
||||
const message = {
|
||||
action: 'openRemoteFolder',
|
||||
host : host,
|
||||
path : path,
|
||||
host: host,
|
||||
path: path,
|
||||
}
|
||||
// 向iframe父页面发送消息
|
||||
window.parent.postMessage(message, '*');
|
||||
@@ -848,7 +877,7 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
function showAlert(alertText, duration) {
|
||||
document.getElementById('alertBox').innerHTML = alertText;
|
||||
document.getElementById('alertBox').style.display = 'block';
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
document.getElementById('alertBox').style.display = 'none';
|
||||
}, duration); // 消息显示 duration/1000 秒后消失
|
||||
}
|
||||
|
@@ -14,12 +14,7 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<iframe
|
||||
id="embedded-devstar"
|
||||
src="http://localhost:8080/test/home.html"
|
||||
width="100%"
|
||||
height="100%"
|
||||
frameborder="0"
|
||||
<iframe id="embedded-devstar" src="http://localhost:8080/test/home.html" width="100%" height="100%" frameborder="0"
|
||||
style="border: 0; left: 0; right: 0; bottom: 0; top: 0; position:absolute;">
|
||||
</iframe>
|
||||
|
||||
@@ -92,8 +87,8 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
const dataFromVSCodeResponse = await communicateVSCode(actionFromHome, dataFromHome)
|
||||
|
||||
var iframe = document.getElementById('embedded-devstar');
|
||||
if(iframe && iframe.contentWindow) {
|
||||
iframe.contentWindow.postMessage({action: actionFromHome, data: dataFromVSCodeResponse}, '*')
|
||||
if (iframe && iframe.contentWindow) {
|
||||
iframe.contentWindow.postMessage({ action: actionFromHome, data: dataFromVSCodeResponse }, '*')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -102,4 +97,5 @@ header("Allow: GET, POST, OPTIONS, PUT, DELETE");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user