mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 17:24:05 +08:00
opt code.tmpl
This commit is contained in:
parent
4ea1e963de
commit
5c5ea7d85e
@ -968,6 +968,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
msg.Log("fuck", "what %v", msg.Option("componet_name"))
|
||||||
|
|
||||||
// 添加设备
|
// 添加设备
|
||||||
arg = arg[:0]
|
arg = arg[:0]
|
||||||
|
@ -89,17 +89,21 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
"componet_group": &ctx.Config{Name: "component_group", Value: "index", Help: "默认组件"},
|
"componet_group": &ctx.Config{Name: "component_group", Value: "index", Help: "默认组件"},
|
||||||
"componet": &ctx.Config{Name: "componet", Value: map[string]interface{}{
|
"componet": &ctx.Config{Name: "componet", Value: map[string]interface{}{
|
||||||
"login": []interface{}{
|
"login": []interface{}{
|
||||||
map[string]interface{}{"name": "head", "template": "head"},
|
map[string]interface{}{"name": "code", "template": "head", "metas": []interface{}{
|
||||||
|
map[string]interface{}{"name": "viewport", "content": "width=device-width, initial-scale=0.7"},
|
||||||
|
map[string]interface{}{"name": "user-scalable", "content": "no"},
|
||||||
|
}, "favicon": "favicon.ico", "styles": []interface{}{"example.css", "code.css"}},
|
||||||
map[string]interface{}{"name": "login", "help": "login", "template": "componet",
|
map[string]interface{}{"name": "login", "help": "login", "template": "componet",
|
||||||
"componet_ctx": "aaa", "componet_cmd": "auth", "arguments": []interface{}{"@sessid", "ship", "username", "@username", "password", "@password"},
|
"componet_ctx": "aaa", "componet_cmd": "auth", "arguments": []interface{}{"@sessid", "ship", "username", "@username", "password", "@password"}, "inputs": []interface{}{
|
||||||
"inputs": []interface{}{
|
|
||||||
map[string]interface{}{"type": "text", "name": "username", "label": "username", "value": ""},
|
map[string]interface{}{"type": "text", "name": "username", "label": "username", "value": ""},
|
||||||
map[string]interface{}{"type": "password", "name": "password", "label": "password", "value": ""},
|
map[string]interface{}{"type": "password", "name": "password", "label": "password", "value": ""},
|
||||||
map[string]interface{}{"type": "button", "value": "login"},
|
map[string]interface{}{"type": "button", "value": "login"},
|
||||||
},
|
},
|
||||||
"display_append": "", "display_result": "",
|
"display_append": "", "display_result": "",
|
||||||
},
|
},
|
||||||
map[string]interface{}{"name": "tail", "template": "tail"},
|
map[string]interface{}{"name": "tail", "template": "tail",
|
||||||
|
"scripts": []interface{}{"toolkit.js", "context.js", "example.js", "code.js"},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"flash": []interface{}{
|
"flash": []interface{}{
|
||||||
map[string]interface{}{"name": "flash", "template": "head"},
|
map[string]interface{}{"name": "flash", "template": "head"},
|
||||||
@ -121,7 +125,11 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
map[string]interface{}{"name": "tail", "template": "tail"},
|
map[string]interface{}{"name": "tail", "template": "tail"},
|
||||||
},
|
},
|
||||||
"index": []interface{}{
|
"index": []interface{}{
|
||||||
map[string]interface{}{"name": "code", "template": "head"},
|
map[string]interface{}{"name": "code", "template": "head", "metas": []interface{}{
|
||||||
|
map[string]interface{}{"name": "viewport", "content": "width=device-width, initial-scale=0.7"},
|
||||||
|
map[string]interface{}{"name": "user-scalable", "content": "no"},
|
||||||
|
}, "favicon": "favicon.ico", "styles": []interface{}{"example.css", "code.css"}},
|
||||||
|
|
||||||
map[string]interface{}{"name": "toolkit", "help": "Ctrl+B", "template": "toolkit",
|
map[string]interface{}{"name": "toolkit", "help": "Ctrl+B", "template": "toolkit",
|
||||||
"componet_view": "KitList", "componet_init": "initKitList",
|
"componet_view": "KitList", "componet_init": "initKitList",
|
||||||
},
|
},
|
||||||
@ -138,7 +146,6 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
// "componet_ctx": "aaa", "componet_cmd": "login", "arguments": []interface{}{"@sessid"},
|
// "componet_ctx": "aaa", "componet_cmd": "login", "arguments": []interface{}{"@sessid"},
|
||||||
// "pre_run": true,
|
// "pre_run": true,
|
||||||
// },
|
// },
|
||||||
map[string]interface{}{"name": "clipboard", "help": "clipboard", "template": "clipboard"},
|
|
||||||
map[string]interface{}{"name": "buffer", "help": "buffer", "template": "componet",
|
map[string]interface{}{"name": "buffer", "help": "buffer", "template": "componet",
|
||||||
"componet_ctx": "cli", "componet_cmd": "tmux", "arguments": []interface{}{"buffer"}, "inputs": []interface{}{
|
"componet_ctx": "cli", "componet_cmd": "tmux", "arguments": []interface{}{"buffer"}, "inputs": []interface{}{
|
||||||
map[string]interface{}{"type": "text", "name": "limit", "label": "limit", "value": "3"},
|
map[string]interface{}{"type": "text", "name": "limit", "label": "limit", "value": "3"},
|
||||||
@ -211,7 +218,9 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
// map[string]interface{}{"name": "mp", "template": "mp"},
|
// map[string]interface{}{"name": "mp", "template": "mp"},
|
||||||
map[string]interface{}{"name": "tail", "template": "tail"},
|
map[string]interface{}{"name": "tail", "template": "tail",
|
||||||
|
"scripts": []interface{}{"toolkit.js", "context.js", "example.js", "code.js"},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}, Help: "组件列表"},
|
}, Help: "组件列表"},
|
||||||
"upgrade": &ctx.Config{Name: "upgrade", Value: map[string]interface{}{
|
"upgrade": &ctx.Config{Name: "upgrade", Value: map[string]interface{}{
|
||||||
|
@ -1,53 +1,60 @@
|
|||||||
fieldset {
|
/* ----- common ----- */
|
||||||
|
fieldset {
|
||||||
margin-top:8px;
|
margin-top:8px;
|
||||||
}
|
}
|
||||||
fieldset legend {
|
fieldset legend {
|
||||||
font-size:16px;
|
font-size:16px;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
font-family:monospace;
|
font-family:monospace;
|
||||||
}
|
}
|
||||||
fieldset form.option div {
|
fieldset form.option div {
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
fieldset form.option input {
|
fieldset form.option input {
|
||||||
margin-right:10px;
|
margin-right:10px;
|
||||||
}
|
}
|
||||||
fieldset form.option select {
|
fieldset form.option input.cmd {
|
||||||
|
color:white;
|
||||||
|
background-color:#272822;
|
||||||
|
padding-left:10px;
|
||||||
|
width:600px;
|
||||||
|
}
|
||||||
|
fieldset form.option select {
|
||||||
margin-right:10px;
|
margin-right:10px;
|
||||||
}
|
}
|
||||||
fieldset form.option hr {
|
fieldset form.option hr {
|
||||||
clear:both;
|
clear:both;
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldset table.append {
|
fieldset table.append {
|
||||||
font-size:14px;
|
font-size:14px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
fieldset table.append tr:hover {
|
fieldset table.append tr:hover {
|
||||||
background-color:lightgreen;
|
background-color:lightgreen;
|
||||||
}
|
}
|
||||||
fieldset table.append th {
|
fieldset table.append th {
|
||||||
font-family:monospace;
|
font-family:monospace;
|
||||||
background-color:lightgreen;
|
background-color:lightgreen;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
fieldset table.append th.order {
|
fieldset table.append th.order {
|
||||||
background-color:red;
|
background-color:red;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
fieldset table.append td {
|
fieldset table.append td {
|
||||||
max-width:1200px;
|
max-width:1200px;
|
||||||
font-family:monospace;
|
font-family:monospace;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
}
|
}
|
||||||
fieldset table.append td.clip {
|
fieldset table.append td.clip {
|
||||||
background-color:red;
|
background-color:red;
|
||||||
}
|
}
|
||||||
fieldset table.append td:hover {
|
fieldset table.append td:hover {
|
||||||
background-color:red;
|
background-color:red;
|
||||||
}
|
}
|
||||||
fieldset code.result pre {
|
fieldset code.result pre {
|
||||||
color:white;
|
color:white;
|
||||||
font-size:14px;
|
font-size:14px;
|
||||||
background-color:#272822;
|
background-color:#272822;
|
||||||
@ -56,64 +63,57 @@ fieldset code.result pre {
|
|||||||
border:solid 2px green;
|
border:solid 2px green;
|
||||||
border-left:solid 4px green;
|
border-left:solid 4px green;
|
||||||
margin:0;
|
margin:0;
|
||||||
}
|
}
|
||||||
fieldset code.result pre.clipboard {
|
fieldset code.result pre.clipboard {
|
||||||
height:2em;
|
height:2em;
|
||||||
}
|
}
|
||||||
|
/* ----- FlashList ----- */
|
||||||
|
fieldset.flasktext {
|
||||||
|
}
|
||||||
|
|
||||||
fieldset.flasktext {
|
fieldset.flasklist div.detail {
|
||||||
}
|
|
||||||
|
|
||||||
fieldset.flasklist div.detail {
|
|
||||||
border:ridge 2px green;
|
border:ridge 2px green;
|
||||||
border-bottom:0px;
|
border-bottom:0px;
|
||||||
margin-top:20px;
|
margin-top:20px;
|
||||||
padding:5px;
|
padding:5px;
|
||||||
}
|
}
|
||||||
fieldset.flasklist div.action {
|
fieldset.flasklist div.action {
|
||||||
border:ridge 2px green;
|
border:ridge 2px green;
|
||||||
border-top:0px;
|
border-top:0px;
|
||||||
border-bottom:0px;
|
border-bottom:0px;
|
||||||
}
|
}
|
||||||
fieldset.flasklist code.output pre {
|
fieldset.flasklist code.output pre {
|
||||||
border:ridge 2px green;
|
border:ridge 2px green;
|
||||||
margin:0px;
|
margin:0px;
|
||||||
padding:5px;
|
padding:5px;
|
||||||
border-top: 0px;
|
border-top: 0px;
|
||||||
}
|
}
|
||||||
|
/* ----- KitList ----- */
|
||||||
|
fieldset.KitList {
|
||||||
|
color:#e6dd37;
|
||||||
|
font-size:14px;
|
||||||
|
font-family:monospace;
|
||||||
|
background-color:#498bb1a8;
|
||||||
|
border:solid 3px red;
|
||||||
|
width:60px;
|
||||||
|
height:20px;
|
||||||
|
overflow:scroll;
|
||||||
|
position:fixed;
|
||||||
|
}
|
||||||
|
fieldset.KitList:hover, fieldset.KitList.max {}
|
||||||
|
fieldset.KitList div:hover, fieldset.KitList li li:hover {
|
||||||
|
background-color:red;
|
||||||
|
}
|
||||||
|
fieldset.KitList div.stick, fieldset.KitList li li.stick {
|
||||||
|
background-color:red;
|
||||||
|
}
|
||||||
|
fieldset.KitList li>label.result{
|
||||||
|
background-color:rgba(0,0,0,0.2);
|
||||||
|
padding:0 5px;
|
||||||
|
border:2px solid green;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
fieldset.KitList li>input {
|
||||||
|
background-color:rgba(0,0,0,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
textarea.clipboard {
|
|
||||||
color:white;
|
|
||||||
background-color:#272822;
|
|
||||||
width:600px;
|
|
||||||
}
|
|
||||||
|
|
||||||
form.option label.keymap {
|
|
||||||
color:red;
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
form.option label.keymap.show {
|
|
||||||
display:inline;
|
|
||||||
}
|
|
||||||
form.option input.cmd {
|
|
||||||
color:white;
|
|
||||||
background-color:#272822;
|
|
||||||
padding-left:10px;
|
|
||||||
width:600px;
|
|
||||||
}
|
|
||||||
form.option input.file_cmd {
|
|
||||||
color:white;
|
|
||||||
background-color:#272822;
|
|
||||||
padding-left:10px;
|
|
||||||
width:400px;
|
|
||||||
}
|
|
||||||
form.option input.file_name {
|
|
||||||
width:200px;
|
|
||||||
}
|
|
||||||
form.option.exec input {
|
|
||||||
color:white;
|
|
||||||
background-color:#272822;
|
|
||||||
padding-left:10px;
|
|
||||||
width:600px;
|
|
||||||
}
|
|
||||||
|
@ -7,11 +7,11 @@ var page = Page({
|
|||||||
initFlashList: function(page, field, option, append, result) {
|
initFlashList: function(page, field, option, append, result) {
|
||||||
option.dataset.flash_index = ctx.Search("flash_index")
|
option.dataset.flash_index = ctx.Search("flash_index")
|
||||||
option.onactions = function(msg) {
|
option.onactions = function(msg) {
|
||||||
page.onFlashShow(msg, field, option, append, result)
|
page.showFlashList(msg, option, append, result)
|
||||||
}
|
}
|
||||||
ctx.Run(page, option.dataset, [], option.onactions)
|
ctx.Run(page, option.dataset, [], option.onactions)
|
||||||
},
|
},
|
||||||
onFlashShow: function(msg, field, option, append, result) {
|
showFlashList: function(msg, option, append, result) {
|
||||||
var page = this
|
var page = this
|
||||||
result.innerHTML = ""
|
result.innerHTML = ""
|
||||||
ctx.Table(msg, function(tip) {
|
ctx.Table(msg, function(tip) {
|
||||||
@ -81,243 +81,6 @@ var page = Page({
|
|||||||
return {"button": ["ctx", "shy", "web", "mdb"], "action": change, "table": {"names": change}}
|
return {"button": ["ctx", "shy", "web", "mdb"], "action": change, "table": {"names": change}}
|
||||||
},
|
},
|
||||||
|
|
||||||
getCmdList: function(input, step, cmd) {
|
|
||||||
var history = kit.History.get("cmd")
|
|
||||||
var length = history.length
|
|
||||||
var last = (parseInt(input.dataset["history_last"]||length)+step+length)%length
|
|
||||||
if (0 <= last && last < length) {
|
|
||||||
input.dataset["history_last"] = last
|
|
||||||
cmd = history[last].data
|
|
||||||
}
|
|
||||||
return cmd
|
|
||||||
},
|
|
||||||
showCmdResult: function(page) {
|
|
||||||
page.conf.show_result = !page.conf.show_result
|
|
||||||
document.querySelectorAll("body>fieldset>code.result>pre").forEach(function(result) {
|
|
||||||
result.style.height = (page.conf.show_result || result.innerText=="")? "": page.conf.show_height
|
|
||||||
})
|
|
||||||
},
|
|
||||||
showCmdList: function(msg, option, append, result) {
|
|
||||||
append.innerHTML = ""
|
|
||||||
kit.AppendTable(append, ctx.Table(msg), msg.append)
|
|
||||||
result.innerHTML = ""
|
|
||||||
result.innerText = msg.result.join("")
|
|
||||||
return
|
|
||||||
},
|
|
||||||
initCmdList: function(page, field, option, append, result) {
|
|
||||||
option.dataset["componet_name_alias"] = "cmd"
|
|
||||||
option.dataset["componet_name_order"] = 0
|
|
||||||
option.onactions = function(msg) {
|
|
||||||
page.showCmdList(msg, option, append, result)
|
|
||||||
}
|
|
||||||
|
|
||||||
var cmd = option.querySelector("input[name=cmd]")
|
|
||||||
cmd.onkeyup = function(event) {
|
|
||||||
page.onCmdList("input", cmd, option, append, result, event)
|
|
||||||
}
|
|
||||||
|
|
||||||
var action = bench_data.action
|
|
||||||
if (action && action["cmd"]) {
|
|
||||||
cmd.value = action["cmd"].cmd[1]
|
|
||||||
ctx.Runs(page, option)
|
|
||||||
page.History.add("cmd", cmd.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
var max = 0
|
|
||||||
for (var k in action) {
|
|
||||||
var order = parseInt(action[k].order)
|
|
||||||
if (order > max) {
|
|
||||||
max = order
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 1; i <= max; i++) {
|
|
||||||
var ui = page.addCmdList("cmd", i)
|
|
||||||
if (action["cmd"+i]) {
|
|
||||||
ui.cmd.value = action["cmd"+i].cmd[1]
|
|
||||||
ctx.Runs(page, ui.option)
|
|
||||||
page.History.add("cmd", ui.cmd.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
page.conf.ncommand = i
|
|
||||||
return
|
|
||||||
},
|
|
||||||
addCmdList: function(name, order) {
|
|
||||||
var page = this
|
|
||||||
var alias = name+order
|
|
||||||
var ui = kit.AppendChild(document.querySelector("body"), [{"type": "fieldset", "data": {}, "list": [
|
|
||||||
{"text": [alias, "legend"]},
|
|
||||||
{"view": ["option "+alias, "form", "", "option"], "data": {"dataset": {
|
|
||||||
"componet_group": "index", "componet_name": name, "componet_name_alias": alias, "componet_name_order": order,
|
|
||||||
}, "onactions": function(msg) {
|
|
||||||
page.showCmdList(msg, ui.option, ui.append, ui.result)
|
|
||||||
}}, "list": [
|
|
||||||
{"type": "input", "data": {"style": {"display": "none"}}},
|
|
||||||
{"name": "cmd", "type": "input", "data": {"name": "cmd", "className": "cmd", "onkeyup": function(event) {
|
|
||||||
page.onCmdList("input", ui.cmd, ui.option, ui.append, ui.result, event)
|
|
||||||
}}},
|
|
||||||
]},
|
|
||||||
{"view": ["append "+alias, "table", "", "append"]},
|
|
||||||
{"code": ["", "result", "result "+alias]},
|
|
||||||
]}])
|
|
||||||
page.OrderTable(ui.append)
|
|
||||||
page.OrderCode(ui.code)
|
|
||||||
ui.cmd.focus()
|
|
||||||
return ui
|
|
||||||
},
|
|
||||||
delCmdList: function(name, order) {
|
|
||||||
var option = document.querySelector("form.option.cmd"+order)
|
|
||||||
option && document.body.removeChild(option.parentElement)
|
|
||||||
|
|
||||||
for (;order < page.conf.ncommand; order++) {
|
|
||||||
var input = document.querySelector("form.option.cmd"+order+" input[name=cmd]")
|
|
||||||
if (input) {
|
|
||||||
input.focus()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (;order >= 0; order--) {
|
|
||||||
var input = document.querySelector("form.option.cmd"+(order? order: "")+" input[name=cmd]")
|
|
||||||
page.conf.ncommand = order+1
|
|
||||||
if (input) {
|
|
||||||
input.focus()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onCmdList: function(action, target, option, append, result, event) {
|
|
||||||
var page = this
|
|
||||||
var order = option.dataset.componet_name_order
|
|
||||||
var prev_order = (parseInt(order)-1+page.conf.ncommand)%page.conf.ncommand||""
|
|
||||||
var next_order = (parseInt(order)+1)%page.conf.ncommand||""
|
|
||||||
|
|
||||||
switch (action) {
|
|
||||||
case "input":
|
|
||||||
if (event.key == "Escape") {
|
|
||||||
target.blur()
|
|
||||||
|
|
||||||
} else if (event.key == "Enter") {
|
|
||||||
target.dataset.history_last = page.History.get("cmd").length
|
|
||||||
page.History.add("cmd", target.value)
|
|
||||||
ctx.Runs(page, option)
|
|
||||||
|
|
||||||
} else if (event.ctrlKey) {
|
|
||||||
switch (event.key) {
|
|
||||||
case "0":
|
|
||||||
var pre_pre = document.querySelector("code.result.cmd"+(event.shiftKey? next_order: prev_order)+" pre")
|
|
||||||
pre_pre && (target.value += pre_pre.innerText)
|
|
||||||
break
|
|
||||||
case "1":
|
|
||||||
case "2":
|
|
||||||
case "3":
|
|
||||||
case "4":
|
|
||||||
case "5":
|
|
||||||
case "6":
|
|
||||||
case "7":
|
|
||||||
case "8":
|
|
||||||
case "9":
|
|
||||||
if (code.quick_txt) {
|
|
||||||
var item = document.querySelectorAll("div.workflow>ul>li>ul.txt>li[data-text]")
|
|
||||||
target.value += item[parseInt(event.key)-1].dataset["text"]
|
|
||||||
} else {
|
|
||||||
var item = document.querySelectorAll("table.append.cmd"+(event.shiftKey? next_order: prev_order)+" td")
|
|
||||||
target.value += item[parseInt(event.key)-1].innerText
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "p":
|
|
||||||
target.value = page.getCmdList(target, -1, target.value)
|
|
||||||
break
|
|
||||||
case "n":
|
|
||||||
target.value = page.getCmdList(target, 1, target.value)
|
|
||||||
break
|
|
||||||
case "g":
|
|
||||||
var value = target.value.substr(0, target.selectionStart)
|
|
||||||
var last = parseInt(target.dataset.search_last || kit.History.get("cmd").length-1)
|
|
||||||
for (var i = last; i >= 0; i--) {
|
|
||||||
var cmd = kit.History.get("cmd", i).data
|
|
||||||
if (cmd.startsWith(value)) {
|
|
||||||
target.value = cmd
|
|
||||||
target.dataset.search_last = i-1
|
|
||||||
target.setSelectionRange(value.length, cmd.length)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
target.dataset.search_last = ""
|
|
||||||
break
|
|
||||||
case "a":
|
|
||||||
case "e":
|
|
||||||
case "f":
|
|
||||||
case "b":
|
|
||||||
case "h":
|
|
||||||
case "d":
|
|
||||||
break
|
|
||||||
case "k":
|
|
||||||
kit.DelText(target, target.selectionStart)
|
|
||||||
break
|
|
||||||
case "u":
|
|
||||||
kit.DelText(target, 0, target.selectionEnd)
|
|
||||||
break
|
|
||||||
case "w":
|
|
||||||
var start = target.selectionStart-2
|
|
||||||
var end = target.selectionEnd-1
|
|
||||||
for (var i = start; i >= 0; i--) {
|
|
||||||
if (target.value[end] == " " && target.value[i] != " ") {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if (target.value[end] != " " && target.value[i] == " ") {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
kit.DelText(target, i+1, end-i)
|
|
||||||
break
|
|
||||||
case "c":
|
|
||||||
append.innerHTML = ""
|
|
||||||
result.innerHTML = ""
|
|
||||||
break
|
|
||||||
case "r":
|
|
||||||
append.innerHTML = ""
|
|
||||||
result.innerHTML = ""
|
|
||||||
case "j":
|
|
||||||
target.dataset.history_last = page.History.get("cmd").length
|
|
||||||
page.History.add("cmd", target.value)
|
|
||||||
ctx.Runs(page, option)
|
|
||||||
break
|
|
||||||
case "l":
|
|
||||||
window.scrollTo(0, option.parentElement.offsetTop)
|
|
||||||
break
|
|
||||||
case "m":
|
|
||||||
page.addCmdList("cmd", page.conf.ncommand++)
|
|
||||||
break
|
|
||||||
case "i":
|
|
||||||
var input = document.querySelector("form.option.cmd"+next_order+" input[name=cmd]")
|
|
||||||
input && input.focus()
|
|
||||||
break
|
|
||||||
case "o":
|
|
||||||
var input = document.querySelector("form.option.cmd"+prev_order+" input[name=cmd]")
|
|
||||||
input && input.focus()
|
|
||||||
break
|
|
||||||
case "x":
|
|
||||||
result.style.height = result.style.height? "": page.conf.hide_height
|
|
||||||
break
|
|
||||||
case "z":
|
|
||||||
result.style.height = result.style.height? "": page.conf.show_height
|
|
||||||
break
|
|
||||||
case "q":
|
|
||||||
page.delCmdList("cmd", order)
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
kit.History.add("key", event.key)
|
|
||||||
if (kit.HitText(target, "jk")) {
|
|
||||||
kit.DelText(target, target.selectionStart-2, 2)
|
|
||||||
target.blur()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
initKitList: function(page, field, option, append, result) {
|
initKitList: function(page, field, option, append, result) {
|
||||||
var ui = kit.AppendChild(field, [{"type": "ul", "list": [
|
var ui = kit.AppendChild(field, [{"type": "ul", "list": [
|
||||||
{"fork": ["粘贴板", [
|
{"fork": ["粘贴板", [
|
||||||
@ -334,7 +97,7 @@ var page = Page({
|
|||||||
{"fork": ["命令行", [
|
{"fork": ["命令行", [
|
||||||
{"leaf": ["+ 折叠命令行(Ctrl+Z)", function(event, target) {
|
{"leaf": ["+ 折叠命令行(Ctrl+Z)", function(event, target) {
|
||||||
target.className = page.conf.show_result? "": "stick"
|
target.className = page.conf.show_result? "": "stick"
|
||||||
page.showCmdResult(page)
|
page.showResult(page)
|
||||||
}]},
|
}]},
|
||||||
{"leaf": ["+ 添加命令行(Ctrl+M)", function(event) {
|
{"leaf": ["+ 添加命令行(Ctrl+M)", function(event) {
|
||||||
page.addCmdList("cmd", page.conf.ncommand++)
|
page.addCmdList("cmd", page.conf.ncommand++)
|
||||||
@ -507,8 +270,237 @@ var page = Page({
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
},
|
},
|
||||||
|
initCmdList: function(page, field, option, append, result) {
|
||||||
|
option.dataset["componet_name_alias"] = "cmd"
|
||||||
|
option.dataset["componet_name_order"] = 0
|
||||||
|
option.onactions = function(msg) {
|
||||||
|
page.showCmdList(msg, option, append, result)
|
||||||
|
}
|
||||||
|
|
||||||
onaction: function(action, target, event) {
|
var cmd = option.querySelector("input[name=cmd]")
|
||||||
|
cmd.onkeyup = function(event) {
|
||||||
|
page.onCmdList(event, cmd, "input", option, append, result)
|
||||||
|
}
|
||||||
|
|
||||||
|
var action = conf.bench_data.action
|
||||||
|
if (action && action["cmd"]) {
|
||||||
|
cmd.value = action["cmd"].cmd[1]
|
||||||
|
ctx.Runs(page, option)
|
||||||
|
page.History.add("cmd", cmd.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
var max = 0
|
||||||
|
for (var k in action) {
|
||||||
|
var order = parseInt(action[k].order)
|
||||||
|
if (order > max) {
|
||||||
|
max = order
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 1; i <= max; i++) {
|
||||||
|
var ui = page.addCmdList("cmd", i)
|
||||||
|
if (action["cmd"+i]) {
|
||||||
|
ui.cmd.value = action["cmd"+i].cmd[1]
|
||||||
|
ctx.Runs(page, ui.option)
|
||||||
|
page.History.add("cmd", ui.cmd.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
page.conf.ncommand = i
|
||||||
|
return
|
||||||
|
},
|
||||||
|
showCmdList: function(msg, option, append, result) {
|
||||||
|
append.innerHTML = ""
|
||||||
|
msg && msg.append && kit.AppendTable(append, ctx.Table(msg), msg.append)
|
||||||
|
result.innerText = (msg && msg.result)? msg.result.join(""): ""
|
||||||
|
return
|
||||||
|
},
|
||||||
|
getCmdList: function(input, step, cmd) {
|
||||||
|
var history = kit.History.get("cmd")
|
||||||
|
var length = history.length
|
||||||
|
var last = (parseInt(input.dataset["history_last"]||length)+step+length)%length
|
||||||
|
if (0 <= last && last < length) {
|
||||||
|
input.dataset["history_last"] = last
|
||||||
|
cmd = history[last].data
|
||||||
|
}
|
||||||
|
return cmd
|
||||||
|
},
|
||||||
|
addCmdList: function(name, order) {
|
||||||
|
var page = this
|
||||||
|
var alias = name+order
|
||||||
|
var ui = kit.AppendChild(document.querySelector("body"), [{"type": "fieldset", "data": {}, "list": [
|
||||||
|
{"text": [alias, "legend"]},
|
||||||
|
{"view": ["option "+alias, "form", "", "option"], "data": {"dataset": {
|
||||||
|
"componet_group": "index", "componet_name": name, "componet_name_alias": alias, "componet_name_order": order,
|
||||||
|
}, "onactions": function(msg) {
|
||||||
|
page.showCmdList(msg, ui.option, ui.append, ui.result)
|
||||||
|
}}, "list": [
|
||||||
|
{"type": "input", "data": {"style": {"display": "none"}}},
|
||||||
|
{"name": "cmd", "type": "input", "data": {"name": "cmd", "className": "cmd", "onkeyup": function(event) {
|
||||||
|
page.onCmdList(event, ui.cmd, "input", ui.option, ui.append, ui.result)
|
||||||
|
}}},
|
||||||
|
]},
|
||||||
|
{"view": ["append "+alias, "table", "", "append"]},
|
||||||
|
{"code": ["", "result", "result "+alias]},
|
||||||
|
]}])
|
||||||
|
page.OrderTable(ui.append)
|
||||||
|
page.OrderCode(ui.code)
|
||||||
|
ui.cmd.focus()
|
||||||
|
return ui
|
||||||
|
},
|
||||||
|
delCmdList: function(name, order) {
|
||||||
|
var option = document.querySelector("form.option.cmd"+order)
|
||||||
|
option && document.body.removeChild(option.parentElement)
|
||||||
|
|
||||||
|
for (;order < page.conf.ncommand; order++) {
|
||||||
|
var input = document.querySelector("form.option.cmd"+order+" input[name=cmd]")
|
||||||
|
if (input) {
|
||||||
|
input.focus()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (;order >= 0; order--) {
|
||||||
|
var input = document.querySelector("form.option.cmd"+(order? order: "")+" input[name=cmd]")
|
||||||
|
page.conf.ncommand = order+1
|
||||||
|
if (input) {
|
||||||
|
input.focus()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onCmdList: function(event, target, action, option, append, result) {
|
||||||
|
var page = this
|
||||||
|
var order = option.dataset.componet_name_order
|
||||||
|
var prev_order = (parseInt(order)-1+page.conf.ncommand)%page.conf.ncommand||""
|
||||||
|
var next_order = (parseInt(order)+1)%page.conf.ncommand||""
|
||||||
|
|
||||||
|
switch (action) {
|
||||||
|
case "input":
|
||||||
|
if (event.key == "Escape") {
|
||||||
|
target.blur()
|
||||||
|
|
||||||
|
} else if (event.key == "Enter") {
|
||||||
|
target.dataset.history_last = page.History.get("cmd").length
|
||||||
|
page.History.add("cmd", target.value)
|
||||||
|
ctx.Runs(page, option)
|
||||||
|
|
||||||
|
} else if (event.ctrlKey) {
|
||||||
|
switch (event.key) {
|
||||||
|
case "0":
|
||||||
|
var pre_pre = document.querySelector("code.result.cmd"+(event.shiftKey? next_order: prev_order)+" pre")
|
||||||
|
pre_pre && (target.value += pre_pre.innerText)
|
||||||
|
break
|
||||||
|
case "1":
|
||||||
|
case "2":
|
||||||
|
case "3":
|
||||||
|
case "4":
|
||||||
|
case "5":
|
||||||
|
case "6":
|
||||||
|
case "7":
|
||||||
|
case "8":
|
||||||
|
case "9":
|
||||||
|
if (code.quick_txt) {
|
||||||
|
var item = document.querySelectorAll("div.workflow>ul>li>ul.txt>li[data-text]")
|
||||||
|
target.value += item[parseInt(event.key)-1].dataset["text"]
|
||||||
|
} else {
|
||||||
|
var item = document.querySelectorAll("table.append.cmd"+(event.shiftKey? next_order: prev_order)+" td")
|
||||||
|
target.value += item[parseInt(event.key)-1].innerText
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case "p":
|
||||||
|
target.value = page.getCmdList(target, -1, target.value)
|
||||||
|
break
|
||||||
|
case "n":
|
||||||
|
target.value = page.getCmdList(target, 1, target.value)
|
||||||
|
break
|
||||||
|
case "g":
|
||||||
|
var value = target.value.substr(0, target.selectionStart)
|
||||||
|
var last = parseInt(target.dataset.search_last || kit.History.get("cmd").length-1)
|
||||||
|
for (var i = last; i >= 0; i--) {
|
||||||
|
var cmd = kit.History.get("cmd", i).data
|
||||||
|
if (cmd.startsWith(value)) {
|
||||||
|
target.value = cmd
|
||||||
|
target.dataset.search_last = i-1
|
||||||
|
target.setSelectionRange(value.length, cmd.length)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
target.dataset.search_last = ""
|
||||||
|
break
|
||||||
|
case "a":
|
||||||
|
case "e":
|
||||||
|
case "f":
|
||||||
|
case "b":
|
||||||
|
case "h":
|
||||||
|
case "d":
|
||||||
|
break
|
||||||
|
case "k":
|
||||||
|
kit.DelText(target, target.selectionStart)
|
||||||
|
break
|
||||||
|
case "u":
|
||||||
|
kit.DelText(target, 0, target.selectionEnd)
|
||||||
|
break
|
||||||
|
case "w":
|
||||||
|
var start = target.selectionStart-2
|
||||||
|
var end = target.selectionEnd-1
|
||||||
|
for (var i = start; i >= 0; i--) {
|
||||||
|
if (target.value[end] == " " && target.value[i] != " ") {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (target.value[end] != " " && target.value[i] == " ") {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
kit.DelText(target, i+1, end-i)
|
||||||
|
break
|
||||||
|
case "c":
|
||||||
|
append.innerHTML = ""
|
||||||
|
result.innerHTML = ""
|
||||||
|
break
|
||||||
|
case "r":
|
||||||
|
append.innerHTML = ""
|
||||||
|
result.innerHTML = ""
|
||||||
|
case "j":
|
||||||
|
target.dataset.history_last = page.History.get("cmd").length
|
||||||
|
page.History.add("cmd", target.value)
|
||||||
|
ctx.Runs(page, option)
|
||||||
|
break
|
||||||
|
case "l":
|
||||||
|
window.scrollTo(0, option.parentElement.offsetTop)
|
||||||
|
break
|
||||||
|
case "m":
|
||||||
|
page.addCmdList("cmd", page.conf.ncommand++)
|
||||||
|
break
|
||||||
|
case "i":
|
||||||
|
var input = document.querySelector("form.option.cmd"+next_order+" input[name=cmd]")
|
||||||
|
input && input.focus()
|
||||||
|
break
|
||||||
|
case "o":
|
||||||
|
var input = document.querySelector("form.option.cmd"+prev_order+" input[name=cmd]")
|
||||||
|
input && input.focus()
|
||||||
|
break
|
||||||
|
case "x":
|
||||||
|
result.style.height = result.style.height? "": page.conf.hide_height
|
||||||
|
break
|
||||||
|
case "z":
|
||||||
|
result.style.height = result.style.height? "": page.conf.show_height
|
||||||
|
break
|
||||||
|
case "q":
|
||||||
|
page.delCmdList("cmd", order)
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
kit.History.add("key", event.key)
|
||||||
|
if (kit.HitText(target, "jk")) {
|
||||||
|
kit.DelText(target, target.selectionStart-2, 2)
|
||||||
|
target.blur()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.stopPropagation()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onaction: function(event, target, action) {
|
||||||
var page = this
|
var page = this
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case "scroll":
|
case "scroll":
|
||||||
@ -569,7 +561,7 @@ var page = Page({
|
|||||||
page.addCmdList("cmd", page.conf.ncommand++)
|
page.addCmdList("cmd", page.conf.ncommand++)
|
||||||
return
|
return
|
||||||
case "z":
|
case "z":
|
||||||
page.showCmdResult(page)
|
page.showResult(page)
|
||||||
return
|
return
|
||||||
case "0":
|
case "0":
|
||||||
case "1":
|
case "1":
|
||||||
@ -587,14 +579,20 @@ var page = Page({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
showResult: function(page, type) {
|
||||||
|
page.conf.show_result = !page.conf.show_result
|
||||||
|
document.querySelectorAll("body>fieldset>code.result>pre").forEach(function(result) {
|
||||||
|
result.style.height = (page.conf.show_result || result.innerText=="")? "": page.conf.show_height
|
||||||
|
})
|
||||||
|
},
|
||||||
init: function(exp) {
|
init: function(exp) {
|
||||||
var page = this
|
var page = this
|
||||||
var body = document.body
|
var body = document.body
|
||||||
body.onkeydown = function(event) {
|
body.onkeydown = function(event) {
|
||||||
page.onaction("scroll", body, event)
|
page.onaction(event, body, "scroll")
|
||||||
}
|
}
|
||||||
body.onkeyup = function(event) {
|
body.onkeyup = function(event) {
|
||||||
page.onaction("keymap", body, event)
|
page.onaction(event, body, "keymap")
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelectorAll("body>fieldset").forEach(function(field) {
|
document.querySelectorAll("body>fieldset").forEach(function(field) {
|
||||||
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
@ -255,6 +255,11 @@ kit = toolkit = {
|
|||||||
case "button":
|
case "button":
|
||||||
input.onclick = function(event) {
|
input.onclick = function(event) {
|
||||||
if (index == array.length-1) {
|
if (index == array.length-1) {
|
||||||
|
if (input.value == "login") {
|
||||||
|
form.onactions = function(msg) {
|
||||||
|
page.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
page.Runs(page, form)
|
page.Runs(page, form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1,75 +1,34 @@
|
|||||||
{{define "head"}}
|
{{define "head"}}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=0.7">
|
{{range $index, $meta := option . "metas"}}
|
||||||
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
|
<meta name="{{index $meta "name"}}" content="{{index $meta "content"}}">
|
||||||
<title>{{option . "componet_name"}}</title>
|
{{end}}
|
||||||
<link rel="stylesheet" type="text/css" href="/static/librarys/example.css"></link>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/static/librarys/code.css"></link>
|
|
||||||
<style>
|
|
||||||
{{$toolkit_view := conf . "route" "toolkit_view"}}
|
|
||||||
fieldset.KitList {
|
|
||||||
color:#e6dd37;
|
|
||||||
font-size:14px;
|
|
||||||
font-family:monospace;
|
|
||||||
background-color:#498bb1a8;
|
|
||||||
border:solid 3px red;
|
|
||||||
width:60px;
|
|
||||||
height:20px;
|
|
||||||
overflow:scroll;
|
|
||||||
position:fixed;
|
|
||||||
top:{{index $toolkit_view "top"}}px;
|
|
||||||
left:{{index $toolkit_view "left"}}px;
|
|
||||||
}
|
|
||||||
fieldset.KitList:hover, fieldset.KitList.max {
|
|
||||||
width:{{index $toolkit_view "width"}}px;
|
|
||||||
height:{{index $toolkit_view "height"}}px;
|
|
||||||
}
|
|
||||||
fieldset.KitList div:hover, fieldset.KitList li li:hover {
|
|
||||||
background-color:red;
|
|
||||||
}
|
|
||||||
fieldset.KitList div.stick, fieldset.KitList li li.stick {
|
|
||||||
background-color:red;
|
|
||||||
}
|
|
||||||
fieldset.KitList li>label.result{
|
|
||||||
background-color:rgba(0,0,0,0.2);
|
|
||||||
padding:0 5px;
|
|
||||||
border:2px solid green;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
fieldset.KitList li>input {
|
|
||||||
background-color:rgba(0,0,0,0.2);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<script>
|
|
||||||
var session ={{option . "session"}}
|
|
||||||
var bench_data ={{option . "bench_data"}}
|
|
||||||
</script>
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{define "clipboard"}}
|
<title>{{option . "componet_name"|meta}}</title>
|
||||||
<fieldset><legend>clipboard</legend>
|
<link rel="shortcut icon" type="image/ico" href="/static/librarys/{{option . "favicon"|meta}}">
|
||||||
<datalist id="clipstack"></datalist>
|
{{range $index, $lib := option . "styles"}}
|
||||||
<datalist id="clistack"></datalist>
|
<link rel="stylesheet" type="text/css" href="/static/librarys/{{$lib}}"></link>
|
||||||
<textarea class="clipboard"></textarea>
|
{{end}}
|
||||||
</fieldset>
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
var conf = {
|
||||||
|
toolkit_view: {{conf . "route" "toolkit_view"}},
|
||||||
|
bench_data: {{option . "bench_data"}},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{define "toolkit"}}
|
{{define "toolkit"}}
|
||||||
{{$bench_data := option . "bench_data"}}
|
<fieldset class="{{option . "componet_view"|meta}}" data-init="{{option . "componet_init"|meta}}">
|
||||||
<fieldset class="{{option . "componet_view"|meta}}" data-init="{{option . "componet_init"|meta}}">
|
|
||||||
<div>{{option .Meta "name"}}({{option .Meta "help"}})</div>
|
<div>{{option .Meta "name"}}({{option .Meta "help"}})</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{define "componet"}}
|
{{define "componet"}}
|
||||||
<fieldset class="{{option . "componet_view"|meta}}" data-init="{{option . "componet_init"|meta}}">
|
<fieldset class="{{option . "componet_view"|meta}}" data-init="{{option . "componet_init"|meta}}">
|
||||||
<legend title="{{option .Meta "help"}}">{{option .Meta "name"}}({{option .Meta "help"}})</legend>
|
<legend title="{{option .Meta "help"}}">{{option .Meta "name"}}({{option .Meta "help"}})</legend>
|
||||||
{{$msg := .}}
|
{{$msg := .}} {{$form_type := option . "form_type"|meta}}
|
||||||
{{$form_type := option . "form_type"|meta}}
|
|
||||||
|
|
||||||
<form class="option {{option .Meta "componet_name"}}"
|
<form class="option {{option .Meta "componet_name"}}"
|
||||||
data-componet_group="{{option . "componet_group"|meta}}"
|
data-componet_group="{{option . "componet_group"|meta}}"
|
||||||
@ -80,9 +39,7 @@
|
|||||||
|
|
||||||
<input style="display:none"></input>
|
<input style="display:none"></input>
|
||||||
{{range $index, $input := option . "inputs"}}
|
{{range $index, $input := option . "inputs"}}
|
||||||
<div>
|
<div>{{$type := index $input "type"}} {{$value := index $input "value" | parse $msg}}
|
||||||
{{$type := index $input "type"}}
|
|
||||||
{{$value := index $input "value" | parse $msg}}
|
|
||||||
{{if index $input "label"}}
|
{{if index $input "label"}}
|
||||||
<label>{{index $input "label"}} : </label>
|
<label>{{index $input "label"}} : </label>
|
||||||
{{end}}
|
{{end}}
|
||||||
@ -93,11 +50,9 @@
|
|||||||
<input type="submit" value="{{$value}}">
|
<input type="submit" value="{{$value}}">
|
||||||
{{else if eq $type "file"}}
|
{{else if eq $type "file"}}
|
||||||
<input type="file" name="{{index $input "name"}}">
|
<input type="file" name="{{index $input "name"}}">
|
||||||
{{else if eq $type "choice"}}
|
{{else if eq $type "choice"}} {{$default_value := index $input "value"}}
|
||||||
{{$default_value := index $input "value"}}
|
|
||||||
<select name="{{index $input "name"}}">
|
<select name="{{index $input "name"}}">
|
||||||
{{range $index, $value := index $input "choice"}}
|
{{range $index, $value := index $input "choice"}} {{$val := index $value "value"}}
|
||||||
{{$val := index $value "value"}}
|
|
||||||
{{if eq $default_value $val}}
|
{{if eq $default_value $val}}
|
||||||
<option value="{{index $value "value"}}" selected>{{index $value "name"}}</option>
|
<option value="{{index $value "value"}}" selected>{{index $value "name"}}</option>
|
||||||
{{else}}
|
{{else}}
|
||||||
@ -112,36 +67,35 @@
|
|||||||
name="{{index $input "name"}}" class="{{index $input "class"}}">{{$value}}</textarea>
|
name="{{index $input "name"}}" class="{{index $input "class"}}">{{$value}}</textarea>
|
||||||
{{else}}
|
{{else}}
|
||||||
<input name="{{index $input "name"}}" value="{{$value}}" class="{{index $input "class"}}">
|
<input name="{{index $input "name"}}" value="{{$value}}" class="{{index $input "class"}}">
|
||||||
{{end}}
|
{{end}}</div>
|
||||||
</div>
|
|
||||||
{{end}}
|
{{end}}
|
||||||
<hr/>
|
<hr/>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{{if index .Meta "display_append"}} {{option .Meta "display_append"}} {{else}}
|
{{if index .Meta "display_append"}} {{option .Meta "display_append"}} {{else}}
|
||||||
<table class="append {{option .Meta "componet_name"}}">
|
<table class="append {{option .Meta "componet_name"}}"> {{$msg := .}}
|
||||||
{{$msg := .}}
|
|
||||||
<tr>{{range $field := append .}}<th>{{$field}}</th>{{end}}</tr>
|
<tr>{{range $field := append .}}<th>{{$field}}</th>{{end}}</tr>
|
||||||
{{range $line := table .}}
|
{{range $line := table .}}
|
||||||
<tr>{{range $field := append $msg}}<td>{{index $line $field|unescape}}</td>{{end}}</tr>
|
<tr>{{range $field := append $msg}}<td>{{index $line $field|unescape}}</td>{{end}}</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
</table>
|
</table>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{if index .Meta "display_result"}} {{option .Meta "display_result"}} {{else}}
|
{{if index .Meta "display_result"}} {{option .Meta "display_result"}} {{else}}
|
||||||
<code class="result {{option .Meta "componet_name"}}"><pre>{{result .Meta}}</pre></code>
|
<code class="result {{option .Meta "componet_name"}}"><pre>{{result .Meta}}</pre></code>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{if index .Meta "display_div"}} {{option .Meta "display_div"}} {{else}}
|
{{if index .Meta "display_div"}} {{option .Meta "display_div"}} {{else}}
|
||||||
<div class="result {{option .Meta "componet_name"}}"></div>
|
<div class="result {{option .Meta "componet_name"}}"></div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{define "mp"}}
|
{{define "mp"}}
|
||||||
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
|
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
|
||||||
<script src="/static/librarys/wexin.js"></script>
|
<script src="/static/librarys/wexin.js"></script>
|
||||||
<script>
|
<script>
|
||||||
{{$token := cmd . "context chat js_token"}}
|
{{$token := cmd . "context chat js_token"}}
|
||||||
wx.config({
|
wx.config({
|
||||||
debug: true,
|
debug: true,
|
||||||
appId: {{append $token "appid"|meta}},
|
appId: {{append $token "appid"|meta}},
|
||||||
timestamp: {{append $token "timestamp"|meta}},
|
timestamp: {{append $token "timestamp"|meta}},
|
||||||
@ -153,17 +107,15 @@ wx.config({
|
|||||||
"closeWindow",
|
"closeWindow",
|
||||||
"openAddress",
|
"openAddress",
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
wx.ready(function(){})
|
wx.ready(function(){})
|
||||||
wx.error(function(res){})
|
wx.error(function(res){})
|
||||||
</script>
|
</script>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{define "tail"}}
|
{{define "tail"}}
|
||||||
<script src="/static/librarys/toolkit.js"></script>
|
{{range $index, $lib := option . "scripts"}}
|
||||||
<script src="/static/librarys/context.js"></script>
|
<script src="/static/librarys/{{$lib}}"></script>
|
||||||
<script src="/static/librarys/example.js"></script>
|
{{end}}
|
||||||
<script src="/static/librarys/code.js"></script>
|
</body>
|
||||||
</body>
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user