1
0
forked from x/ContextOS

mac add check_argument

This commit is contained in:
shaoying 2018-10-25 09:29:51 +08:00
parent ed98ff1795
commit 2465289666
5 changed files with 22 additions and 13 deletions

View File

@ -21,7 +21,7 @@ build:
go build $(BENCH)
run:
etc/run.sh
etc/run.sh 2>var/error.log
win64:
GOARCH=amd64 GOOS=windows go build $(BENCH)

View File

@ -8,6 +8,8 @@
"加载插件"{{{
call plug#begin()
Plug 'vim-scripts/tComment'
Plug 'gcmt/taboo.vim'
Plug 'vim-scripts/tComment'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'vim-airline/vim-airline'
@ -15,9 +17,6 @@ Plug 'vim-airline/vim-airline-themes'
Plug 'ntpeters/vim-better-whitespace'
Plug 'easymotion/vim-easymotion'
Plug 'gcmt/taboo.vim'
set sessionoptions+=tabpages,globals
Plug 'vim-scripts/taglist.vim'
let g:Tlist_WinWidth=45
let g:Tlist_Exit_OnlyWindow=1

View File

@ -131,6 +131,8 @@ func dir(m *ctx.Message, name string, level int, deep bool, fields []string) {
case "filename":
m.Add("append", "filename", filename)
case "is_dir":
f, e := os.Stat(filename)
m.Assert(e)
m.Add("append", "is_dir", f.IsDir())
case "size":
m.Add("append", "size", f.Size())

View File

@ -63,14 +63,27 @@ function send_command(form, cb) {
typeof(cb) == "function" && cb(msg)
})
}
function check_argument(form, target) {
for (var i = 0; i < form.length-1; i++) {
if (form[i] == target) {
if (form[i+1].type == "button") {
form[i+1].click()
} else {
form[i+1].focus()
}
return false
}
}
send_command(form)
}
function onaction(event, action) {
switch (action) {
case "click":
if (event.target.nodeName == "INPUT") {
if (event.altKey) {
console.log("fuck")
var board = document.querySelector("#clipboard")
event.target.value = board.value
check_argument(event.target.form, event.target)
}
}
break
@ -80,13 +93,7 @@ function onaction(event, action) {
case "input":
switch (event.key) {
case "Enter":
var form = event.target.form
for (var i = 0; i < form.length; i++) {
if (form[i] == event.target) {
continue
}
(i == form.length-1)? send_command(form): form[i+1].focus()
}
check_argument(event.target.form, event.target)
break
case "Escape":
event.target.value = ""

View File

@ -97,13 +97,14 @@
{{if eq $form_type "upload"}}
method="POST" action="/upload" enctype="multipart/form-data"
{{end}}
onsubmit="onaction(event,'submit')"
>
<input style="display:none"></input>
{{range $index, $input := option . "inputs"}}
<div>
{{$type := index $input "type"}}
{{if eq $type "button"}}
<input type="button" name="{{index $input "name"}}" value="{{index $input "value"}}" onclick="return onaction(event, 'command')">
<button onclick="return onaction(event, 'command')">{{index $input "value"}}</button>
{{else if eq $type "submit"}}
<input type="submit" value="{{index $input "value"}}">
{{else if eq $type "file"}}