390 lines
7.7 KiB
PHP
390 lines
7.7 KiB
PHP
|
|
<html>
|
|
|
|
<head>
|
|
<script src="/js/jquery.min.js"></script>
|
|
</head>
|
|
|
|
<style>
|
|
|
|
body {
|
|
background-color:#121212;
|
|
color:#eee;
|
|
// font-size:12px;
|
|
//font-size:30px;
|
|
}
|
|
|
|
pre {
|
|
font-size:14px;
|
|
}
|
|
|
|
.cmd_text {
|
|
width:500px;
|
|
// font-size:16px;
|
|
//background-color:#222;
|
|
// border:1px solid cyan;
|
|
//color:cyan;
|
|
//border:none;
|
|
//border-radius: 4px;
|
|
//padding: 4px 4px;
|
|
//outline: none;
|
|
//box-shadow: none;
|
|
//height:30px;
|
|
}
|
|
|
|
.cmd_input
|
|
{
|
|
// width:350px;
|
|
font-size:22px;
|
|
background-color:#212121;
|
|
// border:1px solid cyan;
|
|
//color:Aquamarine;
|
|
color:Beige;
|
|
|
|
border:none;
|
|
border-radius: 4px;
|
|
padding: 4px 6px;
|
|
outline: none;
|
|
box-shadow: none;
|
|
//height:30px;
|
|
}
|
|
|
|
.cmd_option {
|
|
width:90px;
|
|
color:Aquamarine;
|
|
}
|
|
.cmd_user
|
|
{
|
|
width:100px;
|
|
}
|
|
|
|
.cmd_hook
|
|
{
|
|
width:200px;
|
|
}
|
|
|
|
input:focus {
|
|
outline: none; /* 移除默认轮廓线 */
|
|
box-shadow: none; /* 移除可能存在的阴影 */
|
|
// border-color: #ccc; /* 保持与原边框相同颜色 */
|
|
}
|
|
|
|
.top {
|
|
width:100%;
|
|
// height:200px;
|
|
color:cyan;
|
|
text-align:center;
|
|
//margin-top:60px;
|
|
}
|
|
|
|
.main {
|
|
width:100%;
|
|
// height:200px;
|
|
color:pink;
|
|
text-align:center;
|
|
}
|
|
|
|
//.cmd {
|
|
// margin-top:60px;
|
|
// vertical-align: top;
|
|
//}
|
|
|
|
|
|
|
|
.cmd_r {
|
|
// width:100%;
|
|
|
|
//min-width:300px;
|
|
text-align:left;
|
|
display: inline-block;
|
|
}
|
|
|
|
|
|
|
|
.cmd {
|
|
//margin-top:60px;
|
|
list-style-type: none;
|
|
// margin: 0;
|
|
// padding: 0;
|
|
overflow: hidden;
|
|
// background-color: #333;
|
|
display: inline-block;
|
|
}
|
|
|
|
.cmd li {
|
|
float: left;
|
|
}
|
|
|
|
.cmd li a {
|
|
display: block;
|
|
// color: white;
|
|
text-align: center;
|
|
// padding: 14px 16px;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.cmd li a:hover {
|
|
// background-color: #111;
|
|
}
|
|
|
|
.cmd_table
|
|
{
|
|
display: inline-block;
|
|
margin-top: 50px;
|
|
}
|
|
|
|
.cmd_r_table
|
|
{
|
|
min-width:400px;
|
|
display: inline-block;
|
|
}
|
|
|
|
.cmd_btn
|
|
{
|
|
font-size:12px;
|
|
padding: 4px 7px;
|
|
}
|
|
|
|
.cmd_btn-back
|
|
{
|
|
height:26px;
|
|
font-size:12px;
|
|
background-color:#222;
|
|
border-radius: 20px;
|
|
border-color:#FFFACD;
|
|
color:#FFFACD;
|
|
}
|
|
|
|
.cmd_site
|
|
{
|
|
width:100px;
|
|
}
|
|
|
|
.cmd_area
|
|
{
|
|
padding: 10px 15px;
|
|
font-size:14px;
|
|
color: #eee;
|
|
}
|
|
|
|
.menu_top
|
|
{
|
|
color: #bbb;
|
|
font-size: 14px;
|
|
}
|
|
|
|
a{
|
|
color:#ddd;
|
|
text-decoration: none;
|
|
}
|
|
</style>
|
|
|
|
<body>
|
|
|
|
<div class="top">
|
|
<div class="menu_top">
|
|
<a href="/cmd/image/upload">图片上传</a>
|
|
</div>
|
|
<table id="cmd_table" class="cmd_table">
|
|
<tr>
|
|
<td>
|
|
<input class="cmd_user cmd_input" id="cmd_user" value="tom">
|
|
<input class="cmd_site cmd_input" id="cmd_site" value="master">
|
|
<input class="cmd_hook cmd_input" id="cmd_hook" value="">
|
|
<input id="cmd_option" class="cmd_option cmd_input">
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<input id="cmd_text" name="cmd_text" class="cmd_text cmd_input cmd_enter">
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
<!--
|
|
<div class="top_row cmd_bar">
|
|
<input class="cmd_user cmd_input" id="cmd_user">
|
|
<input class="cmd_hook cmd_input" id="cmd_hook">
|
|
</div>
|
|
<ul class="cmd">
|
|
<li>
|
|
<select class="cmd_option" id="cmd_option">
|
|
<option value="master">master</option>
|
|
<option value="fuc">fuc</option>
|
|
<option value="cfn">cfn</option>
|
|
<option value="github">github</option>
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<textarea id="cmd_text" class="cmd_text cmd_input"></textarea>
|
|
</li>
|
|
</ul>
|
|
-->
|
|
</div>
|
|
|
|
<div class="main">
|
|
<table class="cmd_r_table">
|
|
<tr>
|
|
<td>
|
|
<textarea class="cmd_input cmd_area" id="cmd_area" hidden ></textarea>
|
|
<div class="cmd_r" id="cmd_r"></div>
|
|
<div class="cmd_r_shadow" id="cmd_r_shadow" hidden ></div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="bottom">
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
<script>
|
|
$(document).ready(function(){
|
|
|
|
$('input[name="cmd_text"]').first().focus();
|
|
bind();
|
|
|
|
function toggleArea(type)
|
|
{
|
|
if (type == "e") {
|
|
$("#cmd_r").hide();
|
|
$("#cmd_area").show();
|
|
|
|
$("#cmd_area").width("500px");
|
|
$("#cmd_area").height("700px");
|
|
}
|
|
|
|
if (type == "ee") {
|
|
$("#cmd_r").hide();
|
|
$("#cmd_area").show();
|
|
|
|
$("#cmd_area").width("1000px");
|
|
$("#cmd_area").height("1200px");
|
|
}
|
|
|
|
if (type == "eee") {
|
|
$("#cmd_r").hide();
|
|
$("#cmd_area").show();
|
|
|
|
$("#cmd_area").width("1400px");
|
|
$("#cmd_area").height("2000px");
|
|
}
|
|
|
|
if (type == "i") {
|
|
$("#cmd_area").hide();
|
|
$("#cmd_r").show();
|
|
}
|
|
|
|
if (type == "+") {
|
|
var cmd_text_clone = $("#cmd_text").clone();
|
|
cmd_text_clone.val('');
|
|
cmd_text_clone.attr('id', 'cmd_text_' + Date.now());
|
|
$("#cmd_table").append("<tr class='clone'><td></td></tr>");
|
|
$("#cmd_table tr:last td").append(cmd_text_clone);
|
|
bind();
|
|
}
|
|
|
|
if (type == "-") {
|
|
$("#cmd_table tbody tr.clone:last").remove();
|
|
}
|
|
}
|
|
|
|
function submit(input, enterType)
|
|
{
|
|
var value = input.val();
|
|
var site = $("#cmd_site").val();
|
|
var hook = $("#cmd_hook").val();
|
|
var area = $("#cmd_area").val();
|
|
var user = $("#cmd_user").val();
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/cmd/send",
|
|
// dataType: "json",
|
|
data: {
|
|
site: site,
|
|
hook: hook,
|
|
value: value,
|
|
area: area,
|
|
user: user,
|
|
enterType: enterType
|
|
},
|
|
success: function(response){
|
|
|
|
$("#cmd_r").html("");
|
|
$("#cmd_area").val("");
|
|
|
|
$("#cmd_r_shadow").html(response);
|
|
$("#cmd_r").html("<pre>"+response+"</pre>");
|
|
$("#cmd_area").val(response);
|
|
},
|
|
error: function(xhr, status, error){
|
|
// console.error("提交失败:", error);
|
|
}
|
|
});
|
|
}
|
|
|
|
$(document).keydown(function(event) {
|
|
|
|
if (event.shiftKey && event.metaKey && event.key === 'k') {
|
|
|
|
if ($("#cmd_option").val() == "" || $("#cmd_option").val() == "i") {
|
|
$("#cmd_option").val("e");
|
|
} else if ($("#cmd_option").val() == "e") {
|
|
$("#cmd_option").val("i");
|
|
}
|
|
//else if ($("#cmd_option").val() == "ee") {
|
|
// $("#cmd_option").val("i");
|
|
//}
|
|
|
|
toggleArea($("#cmd_option").val());
|
|
}
|
|
|
|
if (event.shiftKey && event.metaKey && event.key === 'Enter') {
|
|
|
|
submit("input");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#cmd_option").keypress(function(e){
|
|
if (e.which == 13) {
|
|
var value = $(this).val();
|
|
toggleArea(value);
|
|
}
|
|
});
|
|
|
|
|
|
|
|
$("#cmd_area").keydown(function(event){
|
|
if (event.metaKey && event.key === 'Enter') {
|
|
submit($('input[name="cmd_text"]').last(), "area");
|
|
}
|
|
});
|
|
|
|
|
|
|
|
function bind() {
|
|
$('.cmd_enter').keypress(function(e){
|
|
|
|
if(e.which == 13){ // 检测回车键
|
|
//toggleArea($("#cmd_option").val());
|
|
|
|
submit($(this), "input");
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|