mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 09:14:06 +08:00
opt Jshy
This commit is contained in:
parent
f6f22b1bc2
commit
72f57af479
@ -84,16 +84,16 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onaction: {
|
onaction: {
|
||||||
title: function(event, item, value) {
|
title: function(event, item, value, page) {
|
||||||
ctx.Search({"river": page.river.Pane.which.get(), "storm": page.storm.Pane.which.get(), "layout": page.action.Pane.Layout()})
|
ctx.Search({"river": page.river.Pane.which.get(), "storm": page.storm.Pane.which.get(), "layout": page.action.Pane.Layout()})
|
||||||
},
|
},
|
||||||
user: function(event, item, value) {
|
user: function(event, item, value, page) {
|
||||||
var name = kit.prompt("new name")
|
var name = kit.prompt("new name")
|
||||||
name && page.login.Pane.Run(["rename", name], function(msg) {
|
name && page.login.Pane.Run(["rename", name], function(msg) {
|
||||||
page.header.Pane.State("user", name)
|
page.header.Pane.State("user", name)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
logout: function(event, item, value) {
|
logout: function(event, item, value, page) {
|
||||||
kit.confirm("logout?") && page.login.Pane.Exit()
|
kit.confirm("logout?") && page.login.Pane.Exit()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -279,7 +279,6 @@ Page({
|
|||||||
echo: function(one, two) {
|
echo: function(one, two) {
|
||||||
kit.Log(one, two)
|
kit.Log(one, two)
|
||||||
},
|
},
|
||||||
_split: function(str) {return str.trim().split(" ")},
|
|
||||||
help: function() {
|
help: function() {
|
||||||
var args = kit.List(arguments)
|
var args = kit.List(arguments)
|
||||||
if (args.length > 1 && page[args[0]] && page[args[0]].Pane[args[1]]) {
|
if (args.length > 1 && page[args[0]] && page[args[0]].Pane[args[1]]) {
|
||||||
@ -290,25 +289,23 @@ Page({
|
|||||||
}
|
}
|
||||||
return kit._call(page.Help, args)
|
return kit._call(page.Help, args)
|
||||||
},
|
},
|
||||||
|
_split: function(str) {return str.trim().split(" ")},
|
||||||
_cmd: function(arg) {
|
_cmd: function(arg) {
|
||||||
var args = engine._split(arg[1]);
|
var args = engine._split(arg[1]);
|
||||||
if (typeof engine[args[0]] == "function") {
|
if (typeof engine[args[0]] == "function") {
|
||||||
return kit._call(engine[args[0]], args.slice(1))
|
return kit._call(engine[args[0]], args.slice(1))
|
||||||
}
|
}
|
||||||
|
if (page.plugin && typeof page.plugin[args[0]] == "function") {
|
||||||
if (page.plugin && page.plugin.Plugin.Jshy(event, args)) {return true}
|
return kit._call(page.plugin[args[0]], args.slice(1))
|
||||||
if (page.dialog && page.dialog.Pane.Jshy(event, args)) {return true}
|
|
||||||
if (page.pane && page.pane.Pane.Jshy(event, args)) {return true}
|
|
||||||
if (page && page.Jshy(event, args)) {return true}
|
|
||||||
|
|
||||||
if (page.plugin) {
|
|
||||||
if (args.length > 1) {
|
|
||||||
return kit._call(page.plugin.Plugin.Run, [window.event].concat(args.slice(1)))
|
|
||||||
} else {
|
|
||||||
return kit._call(page.plugin.Plugin.Runs, [window.event])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (page.dialog && page.dialog.Pane.Jshy(event, args)) {return true}
|
||||||
|
if (page.pane && page.pane.Pane.Jshy(event, args)) {return true}
|
||||||
|
if (page.storm && page.storm.Pane.Jshy(event, args)) {return true}
|
||||||
|
if (page.river && page.river.Pane.Jshy(event, args)) {return true}
|
||||||
|
|
||||||
|
if (page && page.Jshy(event, args)) {return true}
|
||||||
|
if (page.plugin && page.plugin.Plugin.Jshy(event, args)) {return true}
|
||||||
kit.Log("not find", arg[1])
|
kit.Log("not find", arg[1])
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
@ -405,7 +402,7 @@ Page({
|
|||||||
page.input && page.plugin.Plugin.Delete()
|
page.input && page.plugin.Plugin.Delete()
|
||||||
},
|
},
|
||||||
"加参": function(event, value) {
|
"加参": function(event, value) {
|
||||||
page.plugin && page.plugin.Plugin.Append({})
|
page.plugin && page.plugin.Plugin.Append({className: "args temp"})
|
||||||
},
|
},
|
||||||
"减参": function(event, value) {
|
"减参": function(event, value) {
|
||||||
page.plugin && page.plugin.Plugin.Remove()
|
page.plugin && page.plugin.Plugin.Remove()
|
||||||
@ -421,10 +418,10 @@ Page({
|
|||||||
page.plugin && page.plugin.Plugin.display("canvas")
|
page.plugin && page.plugin.Plugin.display("canvas")
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Button: [["layout", "聊天", "办公", "工作", "最高", "最宽", "最大"], "",
|
Button: [["layout", "聊天", "办公", "工作", "最高", "最宽", "最大"],
|
||||||
"刷新", "清空", "并行", "串行", "",
|
"", "刷新", "清空", "并行", "串行",
|
||||||
["display", "表格", "编辑", "绘图"],
|
"", ["display", "表格", "编辑", "绘图"],
|
||||||
"添加", "删除", "加参", "减参", "",
|
"", "添加", "删除", "加参", "减参",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -565,14 +562,11 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
init: function(page) {
|
init: function(page) {
|
||||||
page.onlayout(window.event, page.conf.layout)
|
page.footer.Pane.Order({"ncmd": "", "ntxt": ""}, ["ncmd", "ntxt"], function(event, item, value) {})
|
||||||
page.action.Pane.Layout(ctx.Search("layout")? ctx.Search("layout"): kit.isMobile? "办公": "工作")
|
|
||||||
page.footer.Pane.Order({"ncmd": "", "ntxt": "", ":":""}, kit.isMobile? ["ncmd", "ntxt"]: ["ncmd", "ntxt", ":"], function(event, item, value) {})
|
|
||||||
page.header.Pane.Order({"logout": "logout", "user": ""}, ["logout", "user"], function(event, item, value) {
|
page.header.Pane.Order({"logout": "logout", "user": ""}, ["logout", "user"], function(event, item, value) {
|
||||||
page.onaction[item] && page.onaction[item](event, item, value)
|
page.onaction[item] && page.onaction[item](event, item, value, page)
|
||||||
})
|
})
|
||||||
page.river.Pane.Show()
|
page.river.Pane.Show(), page.pane = page.action, page.plugin = kit.Selector(page.action, "fieldset")[0]
|
||||||
page.pane = page.action
|
page.action.Pane.Layout(ctx.Search("layout")? ctx.Search("layout"): kit.isMobile? "办公": "工作")
|
||||||
page.plugin = kit.Selector(page.action, "fieldset")[0]
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -17,20 +17,16 @@ legend {
|
|||||||
margin-left:10px;
|
margin-left:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldset>div.Help {
|
.hidden {
|
||||||
position:absolute;
|
display:none;
|
||||||
left:0px;
|
|
||||||
top:0px;
|
|
||||||
width:calc(100% - 4px);
|
|
||||||
height:calc(100% - 4px);
|
|
||||||
}
|
}
|
||||||
fieldset>div.Help>div{
|
.normal {
|
||||||
border:solid 2px red;
|
|
||||||
background-color:cyan;
|
|
||||||
color:blue;
|
|
||||||
opacity:0.7;
|
|
||||||
overflow:auto;
|
|
||||||
}
|
}
|
||||||
|
.choice {
|
||||||
|
}
|
||||||
|
.select {
|
||||||
|
}
|
||||||
|
|
||||||
fieldset>form.option div {
|
fieldset>form.option div {
|
||||||
margin-right:6px;
|
margin-right:6px;
|
||||||
float:left;
|
float:left;
|
||||||
@ -38,6 +34,12 @@ fieldset>form.option div {
|
|||||||
fieldset>form.option div.hide {
|
fieldset>form.option div.hide {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
fieldset>form.option div.clear {
|
||||||
|
clear:both;
|
||||||
|
}
|
||||||
|
fieldset>form.option label {
|
||||||
|
margin-right:6px;
|
||||||
|
}
|
||||||
fieldset>form.option div input.args {
|
fieldset>form.option div input.args {
|
||||||
width:80px;
|
width:80px;
|
||||||
}
|
}
|
||||||
@ -46,19 +48,13 @@ fieldset>form.option div.cmd input.args {
|
|||||||
background-color: black;
|
background-color: black;
|
||||||
width:160px;
|
width:160px;
|
||||||
}
|
}
|
||||||
fieldset>form.option div.clear {
|
|
||||||
clear:both;
|
|
||||||
}
|
|
||||||
fieldset>form.option div.long input.args {
|
fieldset>form.option div.long input.args {
|
||||||
width:240px;
|
width:240px;
|
||||||
}
|
}
|
||||||
fieldset>form.option label {
|
|
||||||
margin-right:6px;
|
|
||||||
}
|
|
||||||
fieldset>div.action {
|
fieldset>div.action {
|
||||||
padding:6px;
|
padding:6px;
|
||||||
}
|
}
|
||||||
fieldset>div.action>div.space {
|
fieldset>div.action div.space {
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
width:10px;
|
width:10px;
|
||||||
}
|
}
|
||||||
@ -98,24 +94,39 @@ fieldset>div.output table td {
|
|||||||
word-break:keep-all;
|
word-break:keep-all;
|
||||||
min-width:40px;
|
min-width:40px;
|
||||||
}
|
}
|
||||||
fieldset>div.output>table.edit {
|
fieldset>div.output table.edit {
|
||||||
}
|
}
|
||||||
fieldset>div.output>table.edit td {
|
fieldset>div.output table.edit td {
|
||||||
min-width:4px;
|
min-width:4px;
|
||||||
padding:0px;
|
padding:0px;
|
||||||
}
|
}
|
||||||
fieldset>div.output>table.edit td>input {
|
fieldset>div.output table.edit td>input {
|
||||||
width:600px;
|
width:600px;
|
||||||
padding:0px;
|
padding:0px;
|
||||||
}
|
}
|
||||||
fieldset>div.output table.edit {
|
fieldset>div.output table.edit {
|
||||||
}
|
}
|
||||||
|
fieldset>div.Help {
|
||||||
|
position:absolute;
|
||||||
|
width:calc(100% - 4px);
|
||||||
|
height:calc(100% - 4px);
|
||||||
|
left:0px;
|
||||||
|
top:0px;
|
||||||
|
}
|
||||||
|
fieldset>div.Help>div {
|
||||||
|
color:blue;
|
||||||
|
opacity:0.7;
|
||||||
|
background-color:cyan;
|
||||||
|
border:solid 2px red;
|
||||||
|
overflow:auto;
|
||||||
|
}
|
||||||
|
|
||||||
fieldset.toast {
|
fieldset.toast {
|
||||||
border:solid 2px red;
|
border:solid 2px red;
|
||||||
background-color:#ffffff;
|
background-color:#ffffff;
|
||||||
position:absolute;
|
position:absolute;
|
||||||
display:none;
|
display:none;
|
||||||
|
z-index:100;
|
||||||
}
|
}
|
||||||
fieldset.toast>div.output {
|
fieldset.toast>div.output {
|
||||||
padding:0 10px;
|
padding:0 10px;
|
||||||
@ -139,6 +150,7 @@ fieldset.dialog {
|
|||||||
padding:10px;
|
padding:10px;
|
||||||
display:none;
|
display:none;
|
||||||
position:absolute;
|
position:absolute;
|
||||||
|
z-index:10;
|
||||||
}
|
}
|
||||||
fieldset.dialog>div.output {
|
fieldset.dialog>div.output {
|
||||||
padding:10px;
|
padding:10px;
|
||||||
@ -157,12 +169,26 @@ fieldset.dialog>div.create {
|
|||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fieldset.Login {
|
||||||
|
font-size:28px;
|
||||||
|
z-index:20;
|
||||||
|
}
|
||||||
|
fieldset.Login>form.option input {
|
||||||
|
font-size:18px;
|
||||||
|
height:28px;
|
||||||
|
}
|
||||||
|
fieldset.Login>form.option button {
|
||||||
|
font-size:18px;
|
||||||
|
height:28px;
|
||||||
|
}
|
||||||
fieldset.Header {
|
fieldset.Header {
|
||||||
height:32px;
|
height:32px;
|
||||||
clear:both;
|
clear:both;
|
||||||
|
min-width:640px;
|
||||||
}
|
}
|
||||||
fieldset.Header>div.output div.title {
|
fieldset.Header>div.output div.title {
|
||||||
float:left;
|
float:left;
|
||||||
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
fieldset.Header>div.output div.state {
|
fieldset.Header>div.output div.state {
|
||||||
float:right;
|
float:right;
|
||||||
@ -174,6 +200,7 @@ fieldset.Header>div.output div.state div {
|
|||||||
}
|
}
|
||||||
fieldset.Footer {
|
fieldset.Footer {
|
||||||
clear:both;
|
clear:both;
|
||||||
|
overflow:hidden;
|
||||||
height:32px;
|
height:32px;
|
||||||
}
|
}
|
||||||
fieldset.Footer>div.output div.title {
|
fieldset.Footer>div.output div.title {
|
||||||
@ -193,16 +220,9 @@ fieldset.Footer>div.output div.state div {
|
|||||||
margin-left:5px;
|
margin-left:5px;
|
||||||
float:right;
|
float:right;
|
||||||
}
|
}
|
||||||
fieldset.Login {
|
|
||||||
font-size:28px;
|
fieldset.Source {
|
||||||
}
|
overflow:hidden;
|
||||||
fieldset.Login>form.option input {
|
|
||||||
font-size:18px;
|
|
||||||
height:28px;
|
|
||||||
}
|
|
||||||
fieldset.Login>form.option button {
|
|
||||||
font-size:18px;
|
|
||||||
height:28px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldset.item {
|
fieldset.item {
|
||||||
@ -235,14 +255,6 @@ fieldset.item>div.output>div.status>input.cmd {
|
|||||||
width:250px;
|
width:250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
.normal {
|
|
||||||
}
|
|
||||||
.choice {
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldset table {
|
fieldset table {
|
||||||
font-size:14px;
|
font-size:14px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
@ -187,6 +187,17 @@ function Page(page) {
|
|||||||
}, document.body.onkeydown = function(event) {
|
}, document.body.onkeydown = function(event) {
|
||||||
if (page.localMap && page.localMap(event)) {return}
|
if (page.localMap && page.localMap(event)) {return}
|
||||||
page.oncontrol && page.oncontrol(event, document.body, "control")
|
page.oncontrol && page.oncontrol(event, document.body, "control")
|
||||||
|
if (event.ctrlKey && kit.isWindows) {
|
||||||
|
event.stopPropagation()
|
||||||
|
event.preventDefault()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}, document.body.onkeyup = function(event) {
|
||||||
|
if (event.ctrlKey && kit.isWindows) {
|
||||||
|
event.stopPropagation()
|
||||||
|
event.preventDefault()
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ontoast: function(text, title, duration) {
|
ontoast: function(text, title, duration) {
|
||||||
@ -253,7 +264,7 @@ function Page(page) {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
var his = target.History
|
var his = target.History
|
||||||
var pos = target.Current
|
var pos = target.Current || -1
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "p":
|
case "p":
|
||||||
if (!his) { break }
|
if (!his) { break }
|
||||||
@ -298,6 +309,7 @@ function Page(page) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
event.preventDefault()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
@ -425,12 +437,12 @@ function Page(page) {
|
|||||||
}}})},
|
}}})},
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
|
Help: function() {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
initFooter: function(page, field, option, output) {
|
initFooter: function(page, field, option, output) {
|
||||||
var state = {}, list = [], cb = function(event, item, value) {}
|
var state = {}, list = [], cb = function(event, item, value) {}
|
||||||
field.onclick = function(event) {page.pane && page.pane.scrollTo(0,page.pane.scrollHeight)}
|
var ui, w = 0, history
|
||||||
var ui, w = 0
|
|
||||||
return {
|
return {
|
||||||
Select: function() {
|
Select: function() {
|
||||||
ui.magic.focus()
|
ui.magic.focus()
|
||||||
@ -450,35 +462,41 @@ function Page(page) {
|
|||||||
output.innerHTML = "", ui = kit.AppendChild(output, [
|
output.innerHTML = "", ui = kit.AppendChild(output, [
|
||||||
{"view": ["title", "div", "<a href='mailto:shylinux@163.com'>shylinux@163.com</>"]},
|
{"view": ["title", "div", "<a href='mailto:shylinux@163.com'>shylinux@163.com</>"]},
|
||||||
{"view": ["magic"], style: {"margin-top": "-4px"}, list: [{input: ["magic", function(event) {
|
{"view": ["magic"], style: {"margin-top": "-4px"}, list: [{input: ["magic", function(event) {
|
||||||
if (event.type != "keydown") {return}
|
if (event.key == "Enter" || event.ctrlKey && event.key == "j") {
|
||||||
|
ui.magic.History.push(event.target.value)
|
||||||
|
page.action.Pane.Core(event, {}, ["_cmd", event.target.value]), event.target.value = ""
|
||||||
|
event.stopPropagation()
|
||||||
|
event.preventDefault()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case " ":
|
case " ":
|
||||||
return
|
return true
|
||||||
case "Enter":
|
|
||||||
page.action.Pane.Core(event, {}, ["_cmd", event.target.value]), event.target.value = ""
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
page.oninput(event, function(event) {
|
page.oninput(event, function(event) {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "j":
|
case "j":
|
||||||
page.action.Pane.Core(event, {}, ["_cmd", event.target.value]), event.target.value = ""
|
|
||||||
break
|
break
|
||||||
case "Enter":
|
case "Enter":
|
||||||
kit.Log(event.target.value)
|
kit.Log(event.target.value)
|
||||||
break
|
break
|
||||||
|
default:
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
})
|
})
|
||||||
return true
|
|
||||||
|
|
||||||
}], style: {width: w, "margin-top": "-2px", "font-size": "16px"}}]},
|
}], style: {width: w, "margin-top": "-2px", "font-size": "16px"}}]},
|
||||||
{"view": ["state"], list: list.map(function(item) {return {text: [item+":"+state[item], "div"], click: function(item) {
|
{"view": ["state"], list: list.map(function(item) {return {text: [item+":"+state[item], "div"], click: function(item) {
|
||||||
cb(event, item, state[item])
|
cb(event, item, state[item])
|
||||||
}}})},
|
}}})},
|
||||||
])
|
])
|
||||||
|
ui.magic.History = []
|
||||||
field.Pane.Size(field.clientWidth, field.clientHeight)
|
field.Pane.Size(field.clientWidth, field.clientHeight)
|
||||||
},
|
},
|
||||||
|
Help: function() {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Pane: Pane,
|
Pane: Pane,
|
||||||
@ -491,15 +509,16 @@ function Pane(page, field) {
|
|||||||
var output = field.querySelector("div.output")
|
var output = field.querySelector("div.output")
|
||||||
|
|
||||||
var timer = ""
|
var timer = ""
|
||||||
var list = [], last = -1
|
var list = [], last = -1, member = {}
|
||||||
var name = option.dataset.name
|
var name = option.dataset.name
|
||||||
var pane = Meta(field, (page[field.dataset.init] || function() {
|
var pane = Meta(field, (page[field.dataset.init] || function() {
|
||||||
})(page, field, option, output) || {}, {
|
})(page, field, option, output) || {}, {
|
||||||
Append: function(type, line, key, which, cb) {
|
Append: function(type, line, key, which, cb) {
|
||||||
type = type || line.type
|
type = type || line.type
|
||||||
var index = list.length, ui = pane.View(output, type, line, key, function(event, cmds, cbs) {
|
var index = list.length, ui = pane.View(output, type, line, key, function(event, cmds, cbs) {
|
||||||
pane.Select(index), pane.which.set(line[which])
|
pane.Select(index, line[which])
|
||||||
})
|
})
|
||||||
|
key && key.length > 0 && (member[line[which]] = member[line[key[0]]] = {index:index, key:line[which]})
|
||||||
list.push(ui.last), field.scrollBy(0, field.scrollHeight+100);
|
list.push(ui.last), field.scrollBy(0, field.scrollHeight+100);
|
||||||
(type == "plugin" || type == "field") && pane.Plugin(page, pane, ui.field, function(event, cmds, cbs) {
|
(type == "plugin" || type == "field") && pane.Plugin(page, pane, ui.field, function(event, cmds, cbs) {
|
||||||
typeof cb == "function" && cb(line, index, event, cmds, cbs)
|
typeof cb == "function" && cb(line, index, event, cmds, cbs)
|
||||||
@ -516,9 +535,10 @@ function Pane(page, field) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
Select: function(index) {
|
Select: function(index, key) {
|
||||||
-1 < last && last < list.length && (list[last].className = "item")
|
-1 < last && last < list.length && (list[last].className = "item")
|
||||||
last = index, list[index] && (list[index].className = "item select")
|
last = index, list[index] && (list[index].className = "item select")
|
||||||
|
key && pane.which.set(key)
|
||||||
},
|
},
|
||||||
Clear: function() {
|
Clear: function() {
|
||||||
output.innerHTML = "", list = [], last = -1
|
output.innerHTML = "", list = [], last = -1
|
||||||
@ -552,15 +572,15 @@ function Pane(page, field) {
|
|||||||
},
|
},
|
||||||
Jshy: function(event, args) {
|
Jshy: function(event, args) {
|
||||||
if (pane[args[0]] && pane[args[0]].type == "fieldset") {
|
if (pane[args[0]] && pane[args[0]].type == "fieldset") {
|
||||||
if (args.length > 1) {
|
return pane[args[0]].Plugin.Jshy(event, args.slice(1))
|
||||||
return kit._call(pane[args[0]].Plugin.Run, [event].concat(args.slice(1)))
|
|
||||||
} else {
|
|
||||||
return kit._call(pane[args[0]].Plugin.Runs, [event])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (typeof pane.Action[args[0]] == "function") {
|
if (typeof pane.Action[args[0]] == "function") {
|
||||||
return kit._call(pane.Action[args[0]], [event, args[0]])
|
return kit._call(pane.Action[args[0]], [event, args[0]])
|
||||||
}
|
}
|
||||||
|
if (member[args[0]] != undefined) {
|
||||||
|
pane.Select(member[args[0]].index, member[args[0]].key)
|
||||||
|
return true
|
||||||
|
}
|
||||||
return typeof pane[args[0]] == "function" && kit._call(pane[args[0]], args.slice(1))
|
return typeof pane[args[0]] == "function" && kit._call(pane[args[0]], args.slice(1))
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -631,7 +651,6 @@ function Plugin(page, pane, field, run) {
|
|||||||
var action = field.querySelector("div.action")
|
var action = field.querySelector("div.action")
|
||||||
var output = field.querySelector("div.output")
|
var output = field.querySelector("div.output")
|
||||||
|
|
||||||
var count = 0
|
|
||||||
var plugin = Meta(field, (field.Script && field.Script.init || function() {
|
var plugin = Meta(field, (field.Script && field.Script.init || function() {
|
||||||
})(run, field, option, output)||{}, {
|
})(run, field, option, output)||{}, {
|
||||||
Append: function(item, name, value) {
|
Append: function(item, name, value) {
|
||||||
@ -641,9 +660,10 @@ function Plugin(page, pane, field, run) {
|
|||||||
}: cb)
|
}: cb)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var count = kit.Selector(option, "args").length
|
||||||
args && count < args.length && (item.value = value||args[count++]||item.value||"")
|
args && count < args.length && (item.value = value||args[count++]||item.value||"")
|
||||||
name = item.name || "input"
|
|
||||||
|
|
||||||
|
name = item.name || "input"
|
||||||
var input = {type: "input", name: name, data: item}
|
var input = {type: "input", name: name, data: item}
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case "select":
|
case "select":
|
||||||
@ -676,8 +696,8 @@ function Plugin(page, pane, field, run) {
|
|||||||
return action
|
return action
|
||||||
},
|
},
|
||||||
Remove: function() {
|
Remove: function() {
|
||||||
var list = option.querySelectorAll(".args")
|
var list = option.querySelectorAll("input.temp")
|
||||||
list.length > 0 && (option.removeChild(list[list.length-1].parentNode), count--)
|
list.length > 0 && (option.removeChild(list[list.length-1].parentNode))
|
||||||
},
|
},
|
||||||
Delete: function() {
|
Delete: function() {
|
||||||
page.plugin = field.previousSibling
|
page.plugin = field.previousSibling
|
||||||
@ -721,7 +741,13 @@ function Plugin(page, pane, field, run) {
|
|||||||
setTimeout(function() {plugin.Help("", "hide")}, delay)
|
setTimeout(function() {plugin.Help("", "hide")}, delay)
|
||||||
},
|
},
|
||||||
Jshy: function(event, args) {
|
Jshy: function(event, args) {
|
||||||
return typeof plugin[args[0]] == "function" && kit._call(plugin[args[0]], args.slice(1))
|
if (typeof plugin[args[0]] == "function") {
|
||||||
|
return kit._call(plugin[args[0]], args.slice(1))
|
||||||
|
}
|
||||||
|
if (args.length > 1) {
|
||||||
|
return kit._call(plugin.Run, [event].concat(args.slice(1)))
|
||||||
|
}
|
||||||
|
return kit._call(plugin.Runs, [event])
|
||||||
},
|
},
|
||||||
|
|
||||||
Delay: function(time, event, text) {
|
Delay: function(time, event, text) {
|
||||||
@ -822,8 +848,15 @@ function Plugin(page, pane, field, run) {
|
|||||||
plugin.Check(action)
|
plugin.Check(action)
|
||||||
},
|
},
|
||||||
onkeyup: function(event, action, type, name, item) {
|
onkeyup: function(event, action, type, name, item) {
|
||||||
|
switch (event.key) {
|
||||||
|
case " ":
|
||||||
|
event.stopPropagation()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
page.oninput(event, function(event) {
|
page.oninput(event, function(event) {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
|
case " ":
|
||||||
case "w":
|
case "w":
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
@ -835,8 +868,15 @@ function Plugin(page, pane, field, run) {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
onkeydown: function(event, action, type, name, item) {
|
onkeydown: function(event, action, type, name, item) {
|
||||||
|
switch (event.key) {
|
||||||
|
case " ":
|
||||||
|
event.stopPropagation()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
page.oninput(event, function(event) {
|
page.oninput(event, function(event) {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
|
case " ":
|
||||||
case "w":
|
case "w":
|
||||||
break
|
break
|
||||||
case "p":
|
case "p":
|
||||||
|
@ -189,7 +189,7 @@ kit = toolkit = {
|
|||||||
} else if (child.input) {
|
} else if (child.input) {
|
||||||
child.type = "input"
|
child.type = "input"
|
||||||
child.data["name"] = child.input[0]
|
child.data["name"] = child.input[0]
|
||||||
child.data["onkeyup"] = child.input[1]
|
// child.data["onkeyup"] = child.input[1]
|
||||||
child.data["onkeydown"] = child.input[1]
|
child.data["onkeydown"] = child.input[1]
|
||||||
child.name = child.name || child.input[0]
|
child.name = child.name || child.input[0]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user