1
0
forked from x/ContextOS

opt code.login.ship

This commit is contained in:
shaoying 2019-11-17 19:36:11 +08:00
parent b936d4dbb9
commit b5292c33ce
10 changed files with 126 additions and 75 deletions

View File

@ -6,7 +6,7 @@ fi
ctx_url=$ctx_dev"/code/zsh" ctx_url=$ctx_dev"/code/zsh"
ctx_get=${ctx_get:="wget -q"} ctx_get=${ctx_get:="wget -q"}
ctx_curl=${ctx_curl:="curl -s"} ctx_curl=${ctx_curl:="curl"}
ctx_head=${ctx_head:="Content-Type: application/json"} ctx_head=${ctx_head:="Content-Type: application/json"}
ctx_sync=${ctx_sync:=""} ctx_sync=${ctx_sync:=""}
ctx_sid=${ctx_sid:=""} ctx_sid=${ctx_sid:=""}
@ -59,24 +59,24 @@ ShyPost() {
else else
local data=`ShyJSON "$@" SHELL "${SHELL}" pwd "${PWD}" sid "${ctx_sid}"` local data=`ShyJSON "$@" SHELL "${SHELL}" pwd "${PWD}" sid "${ctx_sid}"`
fi fi
${ctx_curl} "${ctx_url}" -H "${ctx_head}" -d "${data}" ${ctx_curl} -s "${ctx_url}" -H "${ctx_head}" -d "${data}"
} }
ShyDownload() { ShyDownload() {
${ctx_curl} "${ctx_url}" -F "cmd=download" -F "arg=$1" -F "sid=$ctx_sid" ${ctx_curl} -s "${ctx_url}" -F "cmd=download" -F "arg=$1" -F "sid=$ctx_sid"
} }
ShyUpdate() { ShyUpdate() {
${ctx_curl} "${ctx_dev}/publish/$1" > $1 ${ctx_curl} -s "${ctx_dev}/publish/$1" > $1
} }
ShyUpload() { ShyUpload() {
${ctx_curl} "${ctx_url}" -F "cmd=upload" -F "sid=$ctx_sid" -F "upload=@$1" ${ctx_curl} -s "${ctx_url}" -F "cmd=upload" -F "sid=$ctx_sid" -F "upload=@$1"
} }
ShyBench() { ShyBench() {
${ctx_curl} "${ctx_dev}/publish/boot.sh" | sh -s installs context ${ctx_curl} -s "${ctx_dev}/publish/boot.sh" | sh -s installs context
} }
ShySend() { ShySend() {
local TEMP=`mktemp /tmp/tmp.XXXXXX` && "$@" > $TEMP local TEMP=`mktemp /tmp/tmp.XXXXXX` && "$@" > $TEMP
ShyRight "$ctx_silent" || cat $TEMP ShyRight "$ctx_silent" || cat $TEMP
${ctx_curl} "${ctx_url}" -F "cmd=sync" -F "arg=$1" -F "args=$*" -F "sub=@$TEMP"\ ${ctx_curl} -s "${ctx_url}" -F "cmd=sync" -F "arg=$1" -F "args=$*" -F "sub=@$TEMP"\
-F "SHELL=${SHELL}" -F "pwd=${PWD}" -F "sid=${ctx_sid}" -F "SHELL=${SHELL}" -F "pwd=${PWD}" -F "sid=${ctx_sid}"
} }
ShyRun() { ShyRun() {
@ -104,8 +104,8 @@ ShyFavor() {
ShyPost cmd favor arg "`history|tail -n2|head -n1`" tab "${ctx_tab}" note "${ctx_note}" ShyPost cmd favor arg "`history|tail -n2|head -n1`" tab "${ctx_tab}" note "${ctx_note}"
} }
ShyFavors() { ShyFavors() {
[ "$READLINE_LINE" == "" ] && ShyPost cmd favor && return [ "$READLINE_LINE" = "" ] && ShyPost cmd favor tab "$1" && return
ShyPost cmd favor >$READLINE_LINE ShyPost cmd favor tab "$1" >$READLINE_LINE
READLINE_LINE="" READLINE_LINE=""
} }
ShySync() { ShySync() {

View File

@ -31,7 +31,7 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
Caches: map[string]*ctx.Cache{}, Caches: map[string]*ctx.Cache{},
Configs: map[string]*ctx.Config{ Configs: map[string]*ctx.Config{
"login": {Name: "login", Value: map[string]interface{}{"check": false, "local": true, "expire": "720h", "meta": map[string]interface{}{ "login": {Name: "login", Value: map[string]interface{}{"check": false, "local": true, "expire": "720h", "meta": map[string]interface{}{
"fields": "time sid type status table dream pwd pid pane hostname username", "fields": "time sid type status ship.dream ship.stage pwd pid pane hostname username",
}}, Help: "用户登录"}, }}, Help: "用户登录"},
"prefix": {Name: "prefix", Help: "外部命令", Value: map[string]interface{}{ "prefix": {Name: "prefix", Help: "外部命令", Value: map[string]interface{}{
"zsh": []interface{}{"cli.system", "zsh"}, "zsh": []interface{}{"cli.system", "zsh"},
@ -129,6 +129,7 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
return return
} }
// 添加终端
name := kit.Hashs(m.Option("pid"), m.Option("hostname"), m.Option("username")) name := kit.Hashs(m.Option("pid"), m.Option("hostname"), m.Option("username"))
m.Conf(cmd, []string{"hash", name}, map[string]interface{}{ m.Conf(cmd, []string{"hash", name}, map[string]interface{}{
"time": m.Time(), "time": m.Time(),
@ -143,38 +144,55 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
m.Echo(name) m.Echo(name)
case "list": case "list":
if len(arg) > 2 { // 清理终端
switch arg[2] { if len(arg) > 2 && arg[2] == "prune" {
case "prune": m.Cmd(".prune", m.Conf("login", []string{"hash", arg[1], "type"}), arg[1])
m.Cmd(".prune", m.Conf("login", []string{"hash", arg[1], "type"}), arg[1]) arg = arg[:1]
arg = arg[:1]
}
} }
if len(arg) > 3 && arg[3] != "" { // 终端列表
m.Conf(cmd, []string{"hash", arg[1], "dream"}, arg[3]) if len(arg) == 1 || arg[1] == "" {
} fields := strings.Split(m.Conf(cmd, "meta.fields"), " ")
if len(arg) > 2 && arg[2] != "" { m.Confm(cmd, "hash", func(key string, value map[string]interface{}) {
m.Conf(cmd, []string{"hash", arg[1], "table"}, arg[2]) value["sid"] = key
m.Conf(cmd, []string{"hash", arg[1], "river"}, m.Option("river")) m.Push(fields, kit.Shortm(value, "times", "files", "sids"))
}
if len(arg) > 1 && arg[1] != "" {
m.Option("table.format", "table")
m.Confm(cmd, []string{"hash", arg[1]}, func(key string, value string) {
m.Push(key, value)
}) })
m.Sort("key") m.Table()
break break
} }
fields := strings.Split(m.Conf(cmd, "meta.fields"), " ") // 终端数据
m.Confm(cmd, "hash", func(key string, value map[string]interface{}) { if len(arg) > 6 && arg[6] != "" {
value["sid"] = key m.Conf(cmd, []string{"hash", arg[1], "ship", "order"}, arg[6])
m.Push(fields, kit.Shortm(value, "times", "files", "sids")) }
if len(arg) > 5 && arg[5] != "" {
m.Conf(cmd, []string{"hash", arg[1], "ship", "stage"}, arg[5])
}
if len(arg) > 4 && arg[4] != "" {
m.Conf(cmd, []string{"hash", arg[1], "ship", "story"}, arg[4])
}
if len(arg) > 3 && arg[3] != "" {
m.Conf(cmd, []string{"hash", arg[1], "ship", "favor"}, arg[3])
m.Conf(cmd, []string{"hash", arg[1], "ship", "river"}, m.Option("river"))
}
if len(arg) > 2 && arg[2] != "" {
m.Conf(cmd, []string{"hash", arg[1], "ship", "dream"}, arg[2])
}
// 终端详情
m.Option("table.format", "table")
m.Confm(cmd, []string{"hash", arg[1], "ship"}, func(key string, value string) {
m.Push("ship."+key, value)
}) })
m.Table() m.Confm(cmd, []string{"hash", arg[1]}, func(key string, value string) {
if key != "ship" {
m.Push(key, value)
}
})
m.Sort("key")
case "exit": case "exit":
// 退出终端
m.Conf(cmd, []string{"hash", m.Option("sid"), "status"}, "logout") m.Conf(cmd, []string{"hash", m.Option("sid"), "status"}, "logout")
m.Conf(cmd, []string{"hash", m.Option("sid"), "time"}, m.Time()) m.Conf(cmd, []string{"hash", m.Option("sid"), "time"}, m.Time())
case "quit": case "quit":
@ -184,17 +202,21 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
"favor": {Name: "favor post|list", Help: "收藏", Hand: func(m *ctx.Message, c *ctx.Context, cmd string, arg ...string) (e error) { "favor": {Name: "favor post|list", Help: "收藏", Hand: func(m *ctx.Message, c *ctx.Context, cmd string, arg ...string) (e error) {
switch arg[0] { switch arg[0] {
case "download": case "download":
// 下载文件
if len(arg) > 1 && arg[1] != "" { if len(arg) > 1 && arg[1] != "" {
m.Cmd("/download/", "", arg[1]) m.Cmd("/download/", "", arg[1])
break break
} }
// 下载列表
m.Cmd("ssh._route", m.Option("dream"), "ssh.data", "show", "file").Table(func(index int, value map[string]string) { m.Cmd("ssh._route", m.Option("dream"), "ssh.data", "show", "file").Table(func(index int, value map[string]string) {
m.Echo("%v %v %v\n", value["hash"], kit.FmtSize(int64(kit.Int(value["size"]))), value["name"]) m.Echo("%v %v %v\n", value["hash"], kit.FmtSize(int64(kit.Int(value["size"]))), value["name"])
}) })
case "upload": case "upload":
// 上传文件
m.Option("agent", "favor") m.Option("agent", "favor")
if m.Cmd("/upload"); m.Options("dream") { if m.Cmd("/upload"); m.Options("dream") {
// 转发文件
m.Cmd("ssh._route", m.Option("dream"), "web.get", "dev", m.Cmd("ssh._route", m.Option("dream"), "web.get", "dev",
"/download/"+m.Append("hash"), "save", "usr/script/"+m.Append("name")) "/download/"+m.Append("hash"), "save", "usr/script/"+m.Append("name"))
} }
@ -205,6 +227,7 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
m.Echo("size: %s\n", m.Append("size")) m.Echo("size: %s\n", m.Append("size"))
m.Set("append") m.Set("append")
case "file": case "file":
// 文件列表
m.Cmd("ssh._route", arg[1], "ssh.data", "show", arg[2]).Table(func(index int, value map[string]string) { m.Cmd("ssh._route", arg[1], "ssh.data", "show", arg[2]).Table(func(index int, value map[string]string) {
m.Push("id", value["id"]) m.Push("id", value["id"])
m.Push("kind", value["kind"]) m.Push("kind", value["kind"])
@ -216,21 +239,19 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
m.Table() m.Table()
case "post": case "post":
m.Option("river", m.Conf("login", []string{"hash", m.Option("sid"), "river"})) // 上传记录
dream := m.Conf("login", []string{"hash", m.Option("sid"), "dream"}) m.Log("info", "river: %v dream: %v favor: %v", m.Option("river"), m.Option("dream"), m.Option("favor"))
table := kit.Select("tip", m.Conf("login", []string{"hash", m.Option("sid"), "table"}))
m.Log("info", "river: %v dream: %v table: %v", m.Option("river"), dream, table)
if prefix := []string{"ssh._route", dream, "ssh.data"}; len(arg) > 1 { if prefix := []string{"ssh._route", m.Option("dream"), "ssh.data"}; len(arg) > 1 {
m.Cmdy(prefix, "insert", table, arg[1:]) m.Cmdy(prefix, "insert", m.Option("favor"), arg[1:])
} else { } else {
m.Cmdy(prefix, "show", table) m.Cmdy(prefix, "show", m.Option("favor"))
} }
case "list": case "list":
if len(arg) > 2 && arg[2] == "modify" { if len(arg) > 2 && arg[2] == "modify" {
m.Cmdy("ssh._route", m.Option("dream"), "ssh.data", "update", m.Option("table"), arg[1], arg[3], arg[4]) m.Cmdy("ssh._route", m.Option("dream"), "ssh.data", "update", m.Option("favor"), arg[1], arg[3], arg[4])
arg = []string{"list", m.Option("dream"), m.Option("table")} arg = []string{"list", m.Option("dream"), m.Option("favor")}
} }
if len(arg) > 1 { if len(arg) > 1 {
m.Cmdy("ssh._route", arg[1], "ssh.data", "show", arg[2:]) m.Cmdy("ssh._route", arg[1], "ssh.data", "show", arg[2:])
@ -306,8 +327,7 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
} }
} }
m.Log("info", "%v %v %v %v", cmd, m.Option("cmd"), m.Option("arg"), m.Option("sub")) m.Log("info", "%v %v %v %v", cmd, m.Option("cmd"), m.Option("arg"), m.Option("sub"))
m.Option("river", m.Conf("login", []string{"hash", m.Option("sid"), "river"})) m.Confm("login", []string{"hash", m.Option("sid"), "ship"}, func(key string, value string) { m.Option(key, value) })
m.Option("dream", m.Conf("login", []string{"hash", m.Option("sid"), "dream"}))
switch m.Option("cmd") { switch m.Option("cmd") {
case "help": case "help":
@ -321,23 +341,21 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
case "download": case "download":
m.Cmd("favor", "download", m.Option("arg")) m.Cmd("favor", "download", m.Option("arg"))
case "favor": case "favor":
if m.Options("tab") { // 添加收藏
switch path.Base(m.Option("SHELL")) { if m.Options("arg") {
case "zsh": m.Option("arg", strings.SplitN(strings.TrimSpace(m.Option("arg")), " ", 2)[1])
m.Option("arg", strings.SplitN(m.Option("arg"), ";", 2)[1])
default:
m.Option("arg", strings.SplitN(strings.TrimSpace(m.Option("arg")), " ", 2)[1])
}
m.Cmd("favor", "post", "tab", m.Option("tab"), "note", m.Option("note"), "word", m.Option("arg")) m.Cmd("favor", "post", "tab", m.Option("tab"), "note", m.Option("note"), "word", m.Option("arg"))
m.Set("append") m.Set("append")
return break
} }
// 生成脚本
m.Echo("#/bin/sh\n\n") m.Echo("#/bin/sh\n\n")
m.Cmd(".favor", "post").Table(func(index int, value map[string]string) { m.Cmd(".favor", "post").Table(func(index int, value map[string]string) {
m.Echo("# %v:%v\n%v\n\n", value["tab"], value["note"], value["word"]) if !m.Options("tab") || value["tab"] == m.Option("tab") {
m.Echo("# %v:%v\n%v\n\n", value["tab"], value["note"], value["word"])
}
}) })
return
case "historys": case "historys":
vs := strings.SplitN(strings.TrimSpace(m.Option("arg")), " ", 2) vs := strings.SplitN(strings.TrimSpace(m.Option("arg")), " ", 2)
@ -865,8 +883,7 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
m.Option("arg", strings.Replace(m.Option("arg"), "XXXXXsingleXXXXX", "'", -1)) m.Option("arg", strings.Replace(m.Option("arg"), "XXXXXsingleXXXXX", "'", -1))
m.Option("sub", strings.Replace(m.Option("sub"), "XXXXXsingleXXXXX", "'", -1)) m.Option("sub", strings.Replace(m.Option("sub"), "XXXXXsingleXXXXX", "'", -1))
m.Log("info", "%v %v %v %v", cmd, m.Option("cmd"), m.Option("arg"), m.Option("sub")) m.Log("info", "%v %v %v %v", cmd, m.Option("cmd"), m.Option("arg"), m.Option("sub"))
m.Option("river", m.Conf("login", []string{"hash", m.Option("sid"), "river"})) m.Confm("login", []string{"hash", m.Option("sid"), "ship"}, func(key string, value string) { m.Option(key, value) })
m.Option("dream", m.Conf("login", []string{"hash", m.Option("sid"), "dream"}))
switch m.Option("cmd") { switch m.Option("cmd") {
case "help": case "help":

View File

@ -43,13 +43,17 @@ var Index = &ctx.Context{Name: "team", Help: "团队中心",
case "create": case "create":
// 创建任务 // 创建任务
if len(arg) < 9 { if len(arg) > 7 {
arg = append(arg, "") if len(arg) < 9 {
arg = append(arg, "")
}
m.Cmdy("ssh.data", "insert", arg[1], "level", arg[2], "class", arg[3],
"status", arg[4], "begin_time", arg[5], "close_time", arg[6],
"target", arg[7], "detail", arg[8], arg[9:])
} }
m.Cmdy("ssh.data", "insert", arg[1], "level", arg[2], "class", arg[3],
"status", arg[4], "begin_time", arg[5], "close_time", arg[6],
"target", arg[7], "detail", arg[8], arg[9:])
arg = []string{arg[1]}
fallthrough
default: default:
// 修改任务 // 修改任务
if len(arg) > 1 && arg[1] == "modify" { if len(arg) > 1 && arg[1] == "modify" {

View File

@ -210,6 +210,7 @@ var Index = &ctx.Context{Name: "wiki", Help: "文档中心",
m.Option("scene", cmd) m.Option("scene", cmd)
m.Option("enjoy", arg[0]) m.Option("enjoy", arg[0])
m.Option("happy", arg[1]) m.Option("happy", arg[1])
m.Option("render", cmd)
head := []string{} head := []string{}
for i, l := range strings.Split(strings.TrimSpace(arg[1]), "\n") { for i, l := range strings.Split(strings.TrimSpace(arg[1]), "\n") {
@ -223,6 +224,20 @@ var Index = &ctx.Context{Name: "wiki", Help: "文档中心",
} }
return return
}}, }},
"order": {Name: "order", Help: "列表", Hand: func(m *ctx.Message, c *ctx.Context, cmd string, arg ...string) (e error) {
if len(arg) < 2 {
return
}
m.Option("scene", cmd)
m.Option("enjoy", arg[0])
m.Option("happy", arg[1])
m.Option("render", cmd)
for _, l := range strings.Split(strings.TrimSpace(arg[1]), "\n") {
m.Push("list", l)
}
return
}},
"refer": {Name: "refer", Help: "链接地址", Hand: func(m *ctx.Message, c *ctx.Context, cmd string, arg ...string) (e error) { "refer": {Name: "refer", Help: "链接地址", Hand: func(m *ctx.Message, c *ctx.Context, cmd string, arg ...string) (e error) {
m.Set("option", "render", "raw").Echo(`%s: <a href="%s" target="_blank">%s</a>`, arg[0], arg[1], arg[1]) m.Set("option", "render", "raw").Echo(`%s: <a href="%s" target="_blank">%s</a>`, arg[0], arg[1], arg[1])
return return

View File

@ -1,6 +1,6 @@
kit note "记事本" public "ssh._route" _ "web.wiki.note" \ kit note "记事本" public "ssh._route" _ "web.wiki.note" \
text "" name dream imports plugin_dream action auto \ text "" name dream imports plugin_dream action auto \
text "" name story imports plugin_story view long action auto \ text "miss.md" name story imports plugin_story view long action auto \
button "查看" action auto \ button "查看" action auto \
button "返回" cb Last \ button "返回" cb Last \
exports story file \ exports story file \
@ -17,7 +17,7 @@ kit favor "收藏夹" public "ssh._route" _ "web.wiki.story" favor \
kit commit "记录" public "ssh._route" _ "web.wiki.story" commit \ kit commit "记录" public "ssh._route" _ "web.wiki.story" commit \
text "" name dream imports plugin_dream \ text "" name dream imports plugin_dream \
text "" name story imports plugin_story \ text "miss.md" name story imports plugin_story \
text "table" name sence \ text "table" name sence \
text "hello" name enjoy \ text "hello" name enjoy \
textarea "" name happy half 4 \ textarea "" name happy half 4 \

View File

@ -1,16 +1,19 @@
kit tips "便签" private "web.code.favor" list \ kit tips "便签" private "web.code.favor" list \
text "" name dream imports plugin_you action auto \ text "" name dream imports plugin_you action auto \
text "tip" name table imports plugin_vim_table action auto \ text "tip" name favor imports plugin_vim_favor action auto \
text "" name index imports plugin_tip_id view tiny action auto \ text "" name index imports plugin_tip_id view tiny action auto \
feature detail "修改" "复制" "下载" \ feature detail "修改" "复制" "下载" \
exports vim_table table "" tip_id id "" \ exports vim_favor table "" tip_id id "" \
button "记录" action auto \ button "记录" action auto \
button "返回" cb Last button "返回" cb Last
kit editor "编辑器" private "web.code.login" list \ kit editor "编辑器" private "web.code.login" list \
text "" name sid imports plugin_vim_sid action auto \ text "" name sid imports plugin_vim_sid action auto \
text "" name table imports plugin_vim_table \ text "" name dream imports plugin_you \
text "" name you imports plugin_you \ text "tip" name favor imports plugin_vim_favor \
text "miss.md" name story imports plugin_story \
text "task" name stage imports plugin_stage \
text "feed" name order imports plugin_order \
feature detail "prune" "复制" "下载" \ feature detail "prune" "复制" "下载" \
exports vim_sid sid \ exports vim_sid sid \
button "查看" action auto button "查看" action auto

View File

@ -6,17 +6,20 @@ kit file "文件" private "web.code.favor" file \
kit taps "便签" private "web.code.favor" list \ kit taps "便签" private "web.code.favor" list \
text "" name dream imports plugin_you action auto \ text "" name dream imports plugin_you action auto \
text "tap" name table imports plugin_zsh_table action auto \ text "tap" name favor imports plugin_zsh_favor action auto \
text "" name index imports plugin_tap_id view tiny action auto \ text "" name index imports plugin_tap_id view tiny action auto \
feature detail "修改" "复制" "下载" \ feature detail "修改" "复制" "下载" \
exports zsh_table table "" tap_id id "" \ exports zsh_favor table "" tap_id id "" \
button "记录" action auto \ button "记录" action auto \
button "返回" cb Last button "返回" cb Last
kit terminal "终端" private "web.code.login" list \ kit terminal "终端" private "web.code.login" list \
text "" name sid imports plugin_zsh_sid action auto \ text "" name sid imports plugin_zsh_sid action auto \
text "" name table imports plugin_zsh_table \ text "" name dream imports plugin_you \
text "" name you imports plugin_you \ text "tap" name favor imports plugin_zsh_favor \
text "miss.md" name story imports plugin_story \
text "task" name stage imports plugin_stage \
text "feed" name order imports plugin_order \
feature detail "prune" "复制" "下载" \ feature detail "prune" "复制" "下载" \
exports zsh_sid sid \ exports zsh_sid sid \
button "查看" action auto button "查看" action auto

View File

@ -457,3 +457,6 @@ fieldset.item>div.output>div.code div.number {
float:left; float:left;
} }
fieldset ul.story li:hover {
background-color:red;
}

View File

@ -1433,8 +1433,8 @@ function Inputs(plugin, meta, item, target, option) {
kit.Log("init", "input", input.Zones(), input) kit.Log("init", "input", input.Zones(), input)
input.onimport() input.onimport()
target.value = input.onformat(item.init, item.value) target.value = input.onformat(item.init, item.value);
type == "text" && !target.placeholder && (target.placeholder = item.name) (type == "text" || type == "textarea") && !target.placeholder && (target.placeholder = item.name)
type == "text" && !target.title && (target.title = item.placeholder || item.name || "") type == "text" && !target.title && (target.title = item.placeholder || item.name || "")
return plugin.Inputs[item.name] = target, target.Input = input return plugin.Inputs[item.name] = target, target.Input = input
} }
@ -1536,12 +1536,13 @@ function Output(plugin, type, msg, cb, target, option) {
target.innerHTML = "", plugin.onfigure.meta.max(target) target.innerHTML = "", plugin.onfigure.meta.max(target)
output.onimport.meta._table(msg, msg.append) || kit.OrderCode(kit.ModifyNode(target, msg.result.join(""))) output.onimport.meta._table(msg, msg.append) || kit.OrderCode(kit.ModifyNode(target, msg.result.join("")))
kit._call(cb, [msg]) kit._call(cb, [msg])
kit.Selector(target, "table.story", function(item) { kit.Selector(target, ".story", function(item) {
var data = item.dataset var data = item.dataset
item.oncontextmenu = function(event) { item.oncontextmenu = function(event) {
plugin.oncarte(event, shy("", { plugin.oncarte(event, shy("", {
"提交": function(event) { "提交": function(event) {
plugin.Run(event, [option.dream.value, "commit", option.story.value, data.scene, data.enjoy, data.happy], function(msg) { plugin.Run(event, [option.dream.value, "commit", option.story.value, data.scene, data.enjoy, data.happy], function(msg) {
plugin.ontoast(msg.Result())
}, true) }, true)
}, },
"复制": function(event) { "复制": function(event) {

View File

@ -8,4 +8,9 @@
{{end}} {{end}}
{{end}}</table>{{end}} {{end}}</table>{{end}}
{{define "order"}}<ul class="story" data-scene='{{options . "scene"}}'
data-enjoy='{{options . "enjoy"}}' data-happy='{{options . "happy"}}'>
{{range $i, $line := .Meta.list}}<li>{{$line}}</li>{{end}}
</ul>{{end}}
{{define "code"}}<div>{{results .}}</div>{{end}} {{define "code"}}<div>{{results .}}</div>{{end}}