forked from x/volcanos
opt some
This commit is contained in:
parent
d63260e7d1
commit
58f746753c
10
frame.js
10
frame.js
@ -120,7 +120,17 @@ Volcanos(chat.ONDAEMON, {help: "推荐引擎", _init: function(can, name) { if (
|
||||
pwd: function(can, msg, arg) { can._wss_name = can.ondaemon._list[0] = arg[0] },
|
||||
toast: function(can, msg, arg) { can.core.CallFunc(can.user.toast, {can: can, msg: msg, cmds: arg}) },
|
||||
refresh: function(can, msg, sub) { sub.Update() },
|
||||
input: function(can, msg, sub, arg) {
|
||||
can.page.Select(can, sub._target, "input:focus", function(target) {
|
||||
// can.page.Select(can, sub._target, "input", function(target) {
|
||||
target.value += arg[0]
|
||||
})
|
||||
},
|
||||
action: function(can, msg, sub, arg) {
|
||||
if (can.page.Select(can, sub._option, "input.args[name="+arg[0]+"]", function(target) {
|
||||
target.focus()
|
||||
return target
|
||||
}).length > 0) { return }
|
||||
var _sub = can.core.Value(sub, chat._OUTPUTS_CURRENT)
|
||||
if (_sub && _sub.onaction) {
|
||||
_sub.onaction && _sub.onaction._daemon({}, _sub, arg)
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=0.8,maximum-scale=0.8,user-scalable=0">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=0.8,maximum-scale=0.8,user-scalable=no">
|
||||
<meta charset="utf-8"><title>volcanos</title>
|
||||
<link rel="stylesheet" type="text/css" href="/page/index.css">
|
||||
<link rel="stylesheet" type="text/css" href="/page/cache.css">
|
||||
|
@ -1,72 +1,70 @@
|
||||
fieldset.input.keyboard div.output div.small.key {
|
||||
fieldset.keyboard div.output div.key {
|
||||
font-size:24px; text-align:center;
|
||||
background-color:green; color:white; padding:0; margin:5px;
|
||||
height:40px; width:40px; float:left;
|
||||
}
|
||||
fieldset.keyboard div.output div.key.double {
|
||||
font-size:16px; white-space:pre;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key {
|
||||
color:white;
|
||||
margin:5px;
|
||||
background-color:green;
|
||||
font-size:24px; text-align:center;
|
||||
height:40px; width:40px; float:left;
|
||||
padding:0;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.Tab {
|
||||
width:60px;
|
||||
background-color:red;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.CapsLock {
|
||||
width:70px;
|
||||
background-color:red;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.Ctrl {
|
||||
width:70px;
|
||||
background-color:red;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.Win {
|
||||
width:60px;
|
||||
background-color:red;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.special {
|
||||
fieldset.keyboard div.output div.key.special {
|
||||
font-size:16px;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key span {
|
||||
display:block;
|
||||
margin-top:2px;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.special span {
|
||||
display:block;
|
||||
margin-top:10px;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.Alt {
|
||||
width:60px;
|
||||
background-color:red;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.Shift {
|
||||
width:90px;
|
||||
background-color:red;
|
||||
fieldset.keyboard div.output div.key.special.hold {
|
||||
background-color:green;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.tail {
|
||||
fieldset.keyboard div.output div.key.tail {
|
||||
width:70px;
|
||||
background-color:red;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.Shift.tail {
|
||||
width:140px;
|
||||
background-color:red;
|
||||
fieldset.keyboard div.output div.key.Tab {
|
||||
width:60px;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.Enter {
|
||||
width:110px;
|
||||
background-color:red;
|
||||
fieldset.keyboard div.output div.key.Ctrl {
|
||||
width:70px;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.Space {
|
||||
width:300px;
|
||||
background-color:red;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key.Backspace {
|
||||
fieldset.keyboard div.output div.key.Shift {
|
||||
width:90px;
|
||||
background-color:red;
|
||||
}
|
||||
fieldset.input.keyboard div.output br {
|
||||
fieldset.keyboard div.output div.key.Win {
|
||||
width:60px;
|
||||
}
|
||||
fieldset.keyboard div.output div.key.Alt {
|
||||
width:60px;
|
||||
}
|
||||
fieldset.keyboard div.output div.key.Space {
|
||||
width:300px;
|
||||
}
|
||||
fieldset.keyboard div.output div.key.Shift.tail {
|
||||
width:140px;
|
||||
}
|
||||
fieldset.keyboard div.output div.key.Enter {
|
||||
width:110px;
|
||||
}
|
||||
fieldset.keyboard div.output div.key.Backspace {
|
||||
width:90px;
|
||||
}
|
||||
fieldset.keyboard div.output div.key span {
|
||||
margin-top:2px; display:block;
|
||||
}
|
||||
fieldset.keyboard div.output div.key.special span {
|
||||
margin-top:10px; display:block;
|
||||
}
|
||||
fieldset.keyboard div.output br {
|
||||
clear:both;
|
||||
}
|
||||
fieldset.input.keyboard div.output div.key:hover {
|
||||
fieldset.keyboard div.output div.key:hover {
|
||||
background-color:red;
|
||||
}
|
||||
fieldset.keyboard div.output div.key.special:hover {
|
||||
background-color:green;
|
||||
}
|
||||
fieldset.keyboard div.output {
|
||||
min-width:750px;
|
||||
}
|
||||
|
||||
table.content td input {
|
||||
width:50px;
|
||||
}
|
||||
body.mobile table.content td input {
|
||||
width:80px;
|
||||
}
|
||||
|
@ -8,22 +8,23 @@ Volcanos(chat.ONFIGURE, {help: "控件详情", keyboard: {
|
||||
_make: function(event, can, meta, cb, target, last) {
|
||||
var sub = target._can; if (sub && sub._cbs) { return }
|
||||
cb(function(sub, cbs) { sub._cbs = cbs
|
||||
can.onfigure.keyboard._show(can, sub, target)
|
||||
|
||||
})
|
||||
},
|
||||
_show: function(can, sub, target) {
|
||||
can.require(["/plugin/input/keyboard.css"])
|
||||
var msg = can.request({}); can.onfigure.keyboard._normal(can, msg)
|
||||
var keys = {}
|
||||
var msg = can.request({}); can.onfigure.keyboard._normal(can, msg)
|
||||
var keys = {}; function hold(value, div) { keys[value.name] = div, can.page.ClassList.add(can, div, "hold") }
|
||||
msg.Table(function(value) { value.type == "head" && can.page.Append(can, can._output, "br")
|
||||
var t = value.type+" "+value.name+(value.name.indexOf("\n")>-1? " small": value.name.length>1? " special": "")
|
||||
var t = value.type+" "+value.name+(value.name.indexOf("\n")>-1? " double": value.name.length>1? " special": "")
|
||||
var div = can.page.Append(can, sub._output, [{view: t, list: [{text: [value.name]}], onclick: function(event) {
|
||||
switch (value.name) {
|
||||
case "Ctrl":
|
||||
can._ctrl = !can._ctrl
|
||||
keys[value.name] = div
|
||||
can.page.style(can, div, "background-color", "green")
|
||||
can._ctrl = !can._ctrl, hold(value, div)
|
||||
break
|
||||
case "Shift":
|
||||
can._shift = !can._shift
|
||||
keys[value.name] = div
|
||||
can.page.style(can, div, "background-color", "green")
|
||||
can._shift = !can._shift, hold(value, div)
|
||||
break
|
||||
case "Backspace":
|
||||
target.value = target.value.slice(0, -1)
|
||||
@ -33,6 +34,10 @@ Volcanos(chat.ONFIGURE, {help: "控件详情", keyboard: {
|
||||
case "Esc":
|
||||
break
|
||||
default:
|
||||
if (can.base.isFunc(target)) {
|
||||
target(value.name)
|
||||
return
|
||||
}
|
||||
can._shift = can._shift||event.shiftKey
|
||||
if (value.name == "Space") {
|
||||
target.value += " "
|
||||
@ -44,14 +49,13 @@ Volcanos(chat.ONFIGURE, {help: "控件详情", keyboard: {
|
||||
} else {
|
||||
target.value += value.name
|
||||
}
|
||||
can.core.Item(keys, function(key, target) {
|
||||
can.page.style(can, target, "background-color", "")
|
||||
can.core.Item(keys, function(key, div) {
|
||||
can.page.ClassList.del(can, div, "hold")
|
||||
}), can._ctrl = false, can._shift = false
|
||||
}
|
||||
target.focus(), can.user.toast(can, value.name)
|
||||
} }]).first
|
||||
})
|
||||
})
|
||||
},
|
||||
_normal: function(can, msg) {
|
||||
msg.Push({type: "key head", name: "Esc"})
|
||||
|
11
plugin/local/chat/keyboard.js
Normal file
11
plugin/local/chat/keyboard.js
Normal file
@ -0,0 +1,11 @@
|
||||
Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg) {
|
||||
can.onappend.table(can, msg)
|
||||
can.onappend.board(can, msg)
|
||||
var meta = {}
|
||||
msg.Table(function(value, key) { meta[value.key] = value.value })
|
||||
can.require(["/plugin/input/keyboard.js"], function() {
|
||||
can.onfigure.keyboard._show(can, can, function(value) {
|
||||
can.runAction(can.request({}, meta, can.Option()), "input", [value])
|
||||
})
|
||||
})
|
||||
}})
|
Loading…
x
Reference in New Issue
Block a user