[feature] new design
This commit is contained in:
parent
172ee8c3ee
commit
b0a42df184
@ -12,20 +12,18 @@
|
|||||||
<textarea id="send" placeholder="Say something or run a command..." spellcheck="false"></textarea>
|
<textarea id="send" placeholder="Say something or run a command..." spellcheck="false"></textarea>
|
||||||
<div class="top-box">
|
<div class="top-box">
|
||||||
<button class="send-button" onclick="clear_message()">Clear</button>
|
<button class="send-button" onclick="clear_message()">Clear</button>
|
||||||
<p><input id="scroll-option" type="checkbox" checked /> Enable auto scroll</p>
|
<p class="note"><input id="scroll-option" type="checkbox" checked /> Enable auto scroll</p>
|
||||||
<p>Version: WS_2.0</p>
|
<p class="note">Version: WS_2.0</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom-box">
|
<div class="bottom-box">
|
||||||
<span class="note">Press Ctrl + Enter to send </span>
|
<span class="note">Press Ctrl + Enter to send </span>
|
||||||
<button class="send-button" onclick="send()">Send</button>
|
<button class="send-button" onclick="send()">Send</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="prompt-box" hidden>
|
<div id="prompt-box" hidden>
|
||||||
<div id="prompt-box-title">
|
<div id="prompt-box-title"></div>
|
||||||
<soan id="prompt-box-title-text"></soan>
|
|
||||||
</div>
|
|
||||||
<div id="prompt-box-content">
|
<div id="prompt-box-content">
|
||||||
<input type="text" id="prompt-data" />
|
<input type="text" id="prompt-data" />
|
||||||
<input type="button" value="OK" id="comfirm-prompt" />
|
<input type="button" value="OK" id="confirm-prompt" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -35,13 +35,13 @@ function write_message(data) {
|
|||||||
message_source = 'COMMAND BLOCK';
|
message_source = 'COMMAND BLOCK';
|
||||||
}
|
}
|
||||||
|
|
||||||
let renderd_message;
|
let rendered_message;
|
||||||
if (!data.plain) {
|
if (!data.plain) {
|
||||||
renderd_message = md.render(message);
|
rendered_message = md.render(message);
|
||||||
} else {
|
} else {
|
||||||
renderd_message = `<pre>${message}</pre>`;
|
rendered_message = `<pre>${message}</pre>`;
|
||||||
}
|
}
|
||||||
renderd_message = DOMPurify.sanitize(renderd_message);
|
rendered_message = DOMPurify.sanitize(rendered_message);
|
||||||
|
|
||||||
$('#message').append(`
|
$('#message').append(`
|
||||||
<div class="msg">
|
<div class="msg">
|
||||||
@ -51,7 +51,7 @@ function write_message(data) {
|
|||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
<span class="msg-content">
|
<span class="msg-content">
|
||||||
${renderd_message}
|
${rendered_message}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
@ -61,7 +61,7 @@ function write_message(data) {
|
|||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
$('#prompt-data').on('keyup', (e) => {
|
$('#prompt-data').on('keyup', (e) => {
|
||||||
if (e.key === 'Enter') { $('#comfirm-prompt').click(); }
|
if (e.key === 'Enter') { $('#confirm-prompt').click(); }
|
||||||
});
|
});
|
||||||
|
|
||||||
clear_message();
|
clear_message();
|
||||||
@ -132,8 +132,8 @@ async function init() {
|
|||||||
return ws;
|
return ws;
|
||||||
}
|
}
|
||||||
|
|
||||||
function open_prompt(tilte) {
|
function open_prompt(title) {
|
||||||
$('#prompt-box-title-text').text(tilte);
|
$('#prompt-box-title').text(title);
|
||||||
$('#prompt-data').val('');
|
$('#prompt-data').val('');
|
||||||
$('#prompt-box').show('fast', () => { $('#prompt-data').focus(); });
|
$('#prompt-box').show('fast', () => { $('#prompt-data').focus(); });
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ function open_prompt(tilte) {
|
|||||||
resolve_callback = resolve;
|
resolve_callback = resolve;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#comfirm-prompt').one('click', () => {
|
$('#confirm-prompt').one('click', () => {
|
||||||
if (resolve_callback) {
|
if (resolve_callback) {
|
||||||
$('#prompt-box').hide('fast');
|
$('#prompt-box').hide('fast');
|
||||||
resolve_callback($('#prompt-data').val());
|
resolve_callback($('#prompt-data').val());
|
||||||
|
@ -12,12 +12,24 @@ input[type=checkbox] {
|
|||||||
background-color: #fcd363;
|
background-color: #fcd363;
|
||||||
}
|
}
|
||||||
|
|
||||||
button, input[type=button] {
|
button,
|
||||||
|
input[type=button] {
|
||||||
border: none;
|
border: none;
|
||||||
padding: 10px;
|
padding: 10px 25px 10px 25px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
background-color: #5bb2ec;
|
background-color: #0a84ff;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover,
|
||||||
|
input[type=button]:hover {
|
||||||
|
border: none;
|
||||||
|
padding: 10px 25px 10px 25px;
|
||||||
|
border-radius: 2px;
|
||||||
|
background-color: #0060df;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
@ -26,17 +38,17 @@ pre {
|
|||||||
|
|
||||||
.note {
|
.note {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
color: #888888;
|
color: #737373;
|
||||||
}
|
}
|
||||||
|
|
||||||
#message {
|
#message {
|
||||||
background-color: #f2f2f2;
|
background-color: #f9f9fa;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 20px;
|
font-size: 17px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
height: 70vh;
|
height: 70vh;
|
||||||
width: calc(100vw - 20px);
|
width: calc(100vw - 20px);
|
||||||
color: #000;
|
color: #38383d;
|
||||||
font-family: 'Fira Code', Consolas, monospace;
|
font-family: 'Fira Code', Consolas, monospace;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
@ -45,10 +57,12 @@ pre {
|
|||||||
#send {
|
#send {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 20px;
|
font-size: 17px;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 30vh;
|
height: 30vh;
|
||||||
|
|
||||||
|
box-shadow: 0 1px 3px rgba(50, 50, 93, .15), 0 1px 0 rgba(0, 0, 0, .02);
|
||||||
}
|
}
|
||||||
|
|
||||||
.send-button {
|
.send-button {
|
||||||
@ -72,22 +86,23 @@ pre {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.msg-content {
|
.msg-content {
|
||||||
color: #606266;
|
font-weight: 400;
|
||||||
|
color: #737373;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-private::after {
|
.msg-private::after {
|
||||||
content: " PRIVATE";
|
content: " PRIVATE";
|
||||||
color: #F7BA2A;
|
color: #ff9400;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-from {
|
.msg-from {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #303133;
|
color: #0c0c0d;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-time {
|
.msg-time {
|
||||||
font-weight: normal;
|
font-weight: 400;
|
||||||
color: #C0C4CC;
|
color: #b1b1b3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-from::before {
|
.msg-from::before {
|
||||||
@ -95,41 +110,38 @@ pre {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.msg-from-info {
|
.msg-from-info {
|
||||||
color: #5bb2ec;
|
color: #0a84ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg-from-cb {
|
.msg-from-cb {
|
||||||
color: #000000;
|
color: #0c0c0d;
|
||||||
}
|
}
|
||||||
|
|
||||||
#prompt-box {
|
#prompt-box {
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
height: 120px;
|
min-height: 120px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: calc(50% - 180px);
|
top: calc(50% - 180px);
|
||||||
left: calc(45% - 150px);
|
left: calc(45% - 150px);
|
||||||
|
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
padding: 20px;
|
||||||
|
box-shadow: 0 1px 3px rgba(50, 50, 93, .15), 0 1px 0 rgba(0, 0, 0, .02);
|
||||||
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#prompt-box-title {
|
#prompt-box-title {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
background-color: #606266;
|
color: #0c0c0d;
|
||||||
display: block;
|
font-size: 15px;
|
||||||
border-radius: 0px;
|
font-weight: 500;
|
||||||
color: white;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#prompt-box-title-text {
|
|
||||||
margin-left: 10px;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#prompt-box-content {
|
#prompt-box-content {
|
||||||
height: 90px;
|
height: 90px;
|
||||||
display: block;
|
display: block;
|
||||||
background-color: #C0C4CC;
|
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,16 +149,16 @@ pre {
|
|||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
border: 1px solid #606266;
|
border-radius: 5px;
|
||||||
|
padding: 8px;
|
||||||
|
color: #737373;
|
||||||
|
border: none;
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 18px;
|
font-size: 15px;
|
||||||
|
border: #0a84ff 2px solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
#comfirm-prompt {
|
#confirm-prompt {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 10px;
|
margin-top: 15px;
|
||||||
display: block;
|
}
|
||||||
margin-top: 25px;
|
|
||||||
padding-top: 5px;
|
|
||||||
padding-bottom: 5px;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user