mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 09:14:06 +08:00
add focus color
This commit is contained in:
parent
72f57af479
commit
4b6f98256d
@ -152,7 +152,7 @@ Page({
|
|||||||
}}])
|
}}])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
Clear: function(name) {
|
clear: function(name) {
|
||||||
table.innerHTML = "", ui.list.innerHTML = "", ui.name.value = name, ui.name.focus()
|
table.innerHTML = "", ui.list.innerHTML = "", ui.name.value = name, ui.name.focus()
|
||||||
},
|
},
|
||||||
Create: function(name, list) {
|
Create: function(name, list) {
|
||||||
@ -162,7 +162,7 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
Show: function() {var pane = field.Pane
|
Show: function() {var pane = field.Pane
|
||||||
pane.Dialog() && (pane.Clear("good"), pane.Run([], pane.Append))
|
pane.Dialog() && (pane.clear("good"), pane.Run([], pane.Append))
|
||||||
},
|
},
|
||||||
Action: {
|
Action: {
|
||||||
"取消": function(event) {
|
"取消": function(event) {
|
||||||
@ -230,7 +230,7 @@ Page({
|
|||||||
initSource: function(page, field, option, output) {
|
initSource: function(page, field, option, output) {
|
||||||
var ui = kit.AppendChild(field, [{"view": ["input", "textarea"], "data": {"onkeyup": function(event){
|
var ui = kit.AppendChild(field, [{"view": ["input", "textarea"], "data": {"onkeyup": function(event){
|
||||||
page.oninput(event), kit.isSpace(event.key) && field.Pane.which.set(event.target.value)
|
page.oninput(event), kit.isSpace(event.key) && field.Pane.which.set(event.target.value)
|
||||||
event.key == "Enter" && !event.shiftKey && page.target.Pane.Send("text", event.target.value, field.Pane.Clear)
|
event.key == "Enter" && !event.shiftKey && page.target.Pane.Send("text", event.target.value, field.Pane.clear)
|
||||||
}, "onkeydown": function(event) {
|
}, "onkeydown": function(event) {
|
||||||
event.key == "Enter" && !event.shiftKey && event.preventDefault()
|
event.key == "Enter" && !event.shiftKey && event.preventDefault()
|
||||||
}}}])
|
}}}])
|
||||||
@ -238,7 +238,7 @@ Page({
|
|||||||
Select: function() {
|
Select: function() {
|
||||||
ui.first.focus()
|
ui.first.focus()
|
||||||
},
|
},
|
||||||
Clear: function(value) {
|
clear: function(value) {
|
||||||
ui.first.value = ""
|
ui.first.value = ""
|
||||||
},
|
},
|
||||||
Size: function(width, height) {
|
Size: function(width, height) {
|
||||||
@ -295,8 +295,8 @@ Page({
|
|||||||
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 && typeof page.plugin.Plugin[args[0]] == "function") {
|
||||||
return kit._call(page.plugin[args[0]], args.slice(1))
|
return kit._call(page.plugin.Plugin[args[0]], args.slice(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page.dialog && page.dialog.Pane.Jshy(event, args)) {return true}
|
if (page.dialog && page.dialog.Pane.Jshy(event, args)) {return true}
|
||||||
@ -330,7 +330,7 @@ Page({
|
|||||||
Show: function() {var pane = field.Pane
|
Show: function() {var pane = field.Pane
|
||||||
if (field.Pane.Back(river+storm, output)) {return}
|
if (field.Pane.Back(river+storm, output)) {return}
|
||||||
|
|
||||||
pane.Clear(), pane.Update([river, storm], "plugin", ["node", "name"], "index", false, function(line, index, event, args, cbs) {
|
pane.clear(), pane.Update([river, storm], "plugin", ["node", "name"], "index", false, function(line, index, event, args, cbs) {
|
||||||
pane.Core(event, line, args, cbs)
|
pane.Core(event, line, args, cbs)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -507,7 +507,7 @@ Page({
|
|||||||
list.push(item.dataset.index)
|
list.push(item.dataset.index)
|
||||||
list.push(item.dataset.name)
|
list.push(item.dataset.name)
|
||||||
})
|
})
|
||||||
if (list.length == 0) {kit.alert("请添加命令"); return}
|
// if (list.length == 0) {kit.alert("请添加命令"); return}
|
||||||
|
|
||||||
field.Pane.Create(ui.name.value, list)
|
field.Pane.Create(ui.name.value, list)
|
||||||
|
|
||||||
|
@ -255,6 +255,10 @@ fieldset.item>div.output>div.status>input.cmd {
|
|||||||
width:250px;
|
width:250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fieldset.item.select {
|
||||||
|
background-color:gold;
|
||||||
|
}
|
||||||
|
|
||||||
fieldset table {
|
fieldset table {
|
||||||
font-size:14px;
|
font-size:14px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
@ -467,6 +467,7 @@ function Page(page) {
|
|||||||
page.action.Pane.Core(event, {}, ["_cmd", event.target.value]), event.target.value = ""
|
page.action.Pane.Core(event, {}, ["_cmd", event.target.value]), event.target.value = ""
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
ui.magic.focus()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,7 +541,7 @@ function Pane(page, field) {
|
|||||||
last = index, list[index] && (list[index].className = "item select")
|
last = index, list[index] && (list[index].className = "item select")
|
||||||
key && pane.which.set(key)
|
key && pane.which.set(key)
|
||||||
},
|
},
|
||||||
Clear: function() {
|
clear: function() {
|
||||||
output.innerHTML = "", list = [], last = -1
|
output.innerHTML = "", list = [], last = -1
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -572,6 +573,7 @@ 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") {
|
||||||
|
pane[args[0]].Plugin.Select()
|
||||||
return pane[args[0]].Plugin.Jshy(event, args.slice(1))
|
return pane[args[0]].Plugin.Jshy(event, args.slice(1))
|
||||||
}
|
}
|
||||||
if (typeof pane.Action[args[0]] == "function") {
|
if (typeof pane.Action[args[0]] == "function") {
|
||||||
@ -703,8 +705,11 @@ function Plugin(page, pane, field, run) {
|
|||||||
page.plugin = field.previousSibling
|
page.plugin = field.previousSibling
|
||||||
field.parentNode.removeChild(field)
|
field.parentNode.removeChild(field)
|
||||||
},
|
},
|
||||||
Select: function() {
|
Select: function(focus) {
|
||||||
option.querySelectorAll("input")[1].focus()
|
field.scrollIntoView()
|
||||||
|
page.plugin && (page.plugin.className = "item")
|
||||||
|
page.plugin = field, field.className = "item select"
|
||||||
|
focus && option.querySelectorAll("input")[1].focus()
|
||||||
},
|
},
|
||||||
Reveal: function(msg) {
|
Reveal: function(msg) {
|
||||||
return msg.append && msg.append[0]? ["table", JSON.stringify(ctx.Tables(msg))]: ["code", msg.result? msg.result.join(""): ""]
|
return msg.append && msg.append[0]? ["table", JSON.stringify(ctx.Tables(msg))]: ["code", msg.result? msg.result.join(""): ""]
|
||||||
@ -744,8 +749,10 @@ function Plugin(page, pane, field, run) {
|
|||||||
if (typeof plugin[args[0]] == "function") {
|
if (typeof plugin[args[0]] == "function") {
|
||||||
return kit._call(plugin[args[0]], args.slice(1))
|
return kit._call(plugin[args[0]], args.slice(1))
|
||||||
}
|
}
|
||||||
if (args.length > 1) {
|
if (args.length > 0) {
|
||||||
return kit._call(plugin.Run, [event].concat(args.slice(1)))
|
kit.Selector(option, ".args", function(item, index) {
|
||||||
|
index < args.length && (item.value = args[index])
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return kit._call(plugin.Runs, [event])
|
return kit._call(plugin.Runs, [event])
|
||||||
},
|
},
|
||||||
@ -777,6 +784,9 @@ function Plugin(page, pane, field, run) {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clear: function() {
|
||||||
|
output.innerHTML = ""
|
||||||
|
},
|
||||||
display: function(arg, cb) {
|
display: function(arg, cb) {
|
||||||
display.deal = arg, plugin.ondaemon[display.deal||"table"](plugin.msg, cb)
|
display.deal = arg, plugin.ondaemon[display.deal||"table"](plugin.msg, cb)
|
||||||
},
|
},
|
||||||
@ -826,11 +836,12 @@ function Plugin(page, pane, field, run) {
|
|||||||
},
|
},
|
||||||
onaction: {
|
onaction: {
|
||||||
onfocus: function(event, action, type, name, item) {
|
onfocus: function(event, action, type, name, item) {
|
||||||
page.pane = pane.target, page.plugin = plugin.target, page.input = event.target
|
page.input = event.target
|
||||||
},
|
},
|
||||||
onclick: function(event, action, type, name, item) {
|
onclick: function(event, action, type, name, item) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "button":
|
case "button":
|
||||||
|
plugin.Select()
|
||||||
action[item.click]? action[item.click](event, item, option, field):
|
action[item.click]? action[item.click](event, item, option, field):
|
||||||
plugin[item.click]? plugin[item.click](event, item, option, field): plugin.Runs(event)
|
plugin[item.click]? plugin[item.click](event, item, option, field): plugin.Runs(event)
|
||||||
break
|
break
|
||||||
|
@ -525,9 +525,9 @@ kit = toolkit = {
|
|||||||
|
|
||||||
Selector: function(obj, item, cb) {
|
Selector: function(obj, item, cb) {
|
||||||
var list = []
|
var list = []
|
||||||
obj.querySelectorAll(item).forEach(function(item, index) {
|
obj.querySelectorAll(item).forEach(function(item, index, array) {
|
||||||
if (typeof cb == "function") {
|
if (typeof cb == "function") {
|
||||||
var value = cb(item)
|
var value = cb(item, index, array)
|
||||||
value != undefined && list.push(value)
|
value != undefined && list.push(value)
|
||||||
} else {
|
} else {
|
||||||
list.push(item)
|
list.push(item)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user