forked from x/volcanos
opt code
This commit is contained in:
parent
9008e1bb4d
commit
f397ce266a
2
frame.js
2
frame.js
@ -540,7 +540,7 @@ Volcanos(chat.ONLAYOUT, {help: "页面布局", _init: function(can, target) { ta
|
|||||||
var rect = event.target == document.body? {left: window.innerWidth/2, top: 200, right: window.innerWidth/2, bottom: 200}: event.target.getBoundingClientRect()
|
var rect = event.target == document.body? {left: window.innerWidth/2, top: 200, right: window.innerWidth/2, bottom: 200}: event.target.getBoundingClientRect()
|
||||||
var layout = right? {left: rect.right, top: rect.top}: {left: rect.left, top: rect.bottom}
|
var layout = right? {left: rect.right, top: rect.top}: {left: rect.left, top: rect.bottom}
|
||||||
can.getActionSize(function(left, top, width, height) { left = left||0, top = top||0
|
can.getActionSize(function(left, top, width, height) { left = left||0, top = top||0
|
||||||
if (layout.top+target.offsetHeight > window.innerHeight) { layout.top = "", layout.bottom = window.innerHeight-top-height, layout.left += rect.width }
|
if (layout.top+target.offsetHeight > window.innerHeight) { layout.top = "", layout.bottom = window.innerHeight-top-height }
|
||||||
if (layout.left+target.offsetWidth > window.innerWidth) { layout.left = "", layout.right = 0 }
|
if (layout.left+target.offsetWidth > window.innerWidth) { layout.left = "", layout.right = 0 }
|
||||||
})
|
})
|
||||||
return can.onmotion.move(can, target, layout), layout
|
return can.onmotion.move(can, target, layout), layout
|
||||||
|
@ -30,7 +30,7 @@ Volcanos(chat.ONFIGURE, {help: "索引导航",
|
|||||||
can.isCmdMode()? can.onappend._action(can, can.base.Obj(can._msg.Option(ice.MSG_ACTION)).concat(window.webview? ["vim", "录屏", "日志", "编辑器", "浏览器"]: []), target): can.onmotion.hidden(can, target.parentNode)
|
can.isCmdMode()? can.onappend._action(can, can.base.Obj(can._msg.Option(ice.MSG_ACTION)).concat(window.webview? ["vim", "录屏", "日志", "编辑器", "浏览器"]: []), target): can.onmotion.hidden(can, target.parentNode)
|
||||||
},
|
},
|
||||||
recent: function(can, target, zone, path) { var total = 0
|
recent: function(can, target, zone, path) { var total = 0
|
||||||
can.runAction(can.request({}), code.FAVOR, ["_vimer"], function(msg) {
|
can.runAction(can.request({}), code.FAVOR, ["_recent_cmd"], function(msg) {
|
||||||
var list = {}; msg.Table(function(item) { list[item.path+item.file] = item }), can.core.Item(list, function(path, item) {
|
var list = {}; msg.Table(function(item) { list[item.path+item.file] = item }), can.core.Item(list, function(path, item) {
|
||||||
zone._total(++total)
|
zone._total(++total)
|
||||||
can.page.Append(can, target, [{text: [item.name||item.file, html.DIV, html.ITEM], onclick: function(event) {
|
can.page.Append(can, target, [{text: [item.name||item.file, html.DIV, html.ITEM], onclick: function(event) {
|
||||||
@ -38,7 +38,7 @@ Volcanos(chat.ONFIGURE, {help: "索引导航",
|
|||||||
}}])
|
}}])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
can.runAction(can.request({}), code.FAVOR, ["_recent"], function(msg) {
|
can.runAction(can.request({}), code.FAVOR, ["_recent_file"], function(msg) {
|
||||||
var list = {}; msg.Table(function(item) { list[item.path+item.file] = item }), can.core.Item(list, function(path, item) {
|
var list = {}; msg.Table(function(item) { list[item.path+item.file] = item }), can.core.Item(list, function(path, item) {
|
||||||
zone._total(++total)
|
zone._total(++total)
|
||||||
can.page.Append(can, target, [{text: [path.split(ice.PS).slice(-2).join(ice.PS), html.DIV, html.ITEM], onclick: function(event) {
|
can.page.Append(can, target, [{text: [path.split(ice.PS).slice(-2).join(ice.PS), html.DIV, html.ITEM], onclick: function(event) {
|
||||||
@ -273,7 +273,7 @@ Volcanos(chat.ONACTION, {help: "控件交互",
|
|||||||
can.onmotion.delay(can, function() { toast.close(), can.onaction[cli.SHOW]({}, can) }, 3000)
|
can.onmotion.delay(can, function() { toast.close(), can.onaction[cli.SHOW]({}, can) }, 3000)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
autogen: function(event, can, button) { can.onaction._runs(event, can, button, function(msg) {
|
autogen: function(event, can, button) { can.onaction._runs(can.request(event, {path: "src/"}), can, button, function(msg) {
|
||||||
can.onimport.tabview(can, msg.Option(nfs.PATH), msg.Option(cli.MAIN), "", function() {
|
can.onimport.tabview(can, msg.Option(nfs.PATH), msg.Option(cli.MAIN), "", function() {
|
||||||
can.onimport.tabview(can, msg.Option(nfs.PATH), msg.Option(nfs.FILE), "", function() {
|
can.onimport.tabview(can, msg.Option(nfs.PATH), msg.Option(nfs.FILE), "", function() {
|
||||||
can.ui.source.refresh(), can.user.toastSuccess(can)
|
can.ui.source.refresh(), can.user.toastSuccess(can)
|
||||||
@ -281,7 +281,7 @@ Volcanos(chat.ONACTION, {help: "控件交互",
|
|||||||
}, true)
|
}, true)
|
||||||
}) },
|
}) },
|
||||||
script: function(event, can, button) {
|
script: function(event, can, button) {
|
||||||
can.onaction._runs(can.request(event, {file: can.base.trimSuffix(can.Option(nfs.FILE), can.base.Ext(can.Option(nfs.FILE)))+nfs.JS}), can, button)
|
can.onaction._runs(can.request(event, {path: "src/", file: can.base.trimSuffix(can.Option(nfs.FILE), can.base.Ext(can.Option(nfs.FILE)))+nfs.JS}), can, button)
|
||||||
},
|
},
|
||||||
website: function(event, can, button) {
|
website: function(event, can, button) {
|
||||||
can.onaction._runs(can.request(event, {path: "src/website/", file: (can.base.trimSuffix(can.Option(nfs.FILE), can.base.Ext(can.Option(nfs.FILE)))+nfs.ZML).split(ice.PS).pop()}), can, button)
|
can.onaction._runs(can.request(event, {path: "src/website/", file: (can.base.trimSuffix(can.Option(nfs.FILE), can.base.Ext(can.Option(nfs.FILE)))+nfs.ZML).split(ice.PS).pop()}), can, button)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user