forked from x/volcanos
opt cmd.js
This commit is contained in:
parent
12e123462e
commit
29dc5e72f2
@ -27,6 +27,7 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
isWindows: navigator.userAgent.indexOf("Windows") > -1,
|
isWindows: navigator.userAgent.indexOf("Windows") > -1,
|
||||||
isLocalFile: location && location.protocol && location.protocol == "file:",
|
isLocalFile: location && location.protocol && location.protocol == "file:",
|
||||||
isExtension: location && location.protocol && location.protocol == "chrome-extension:",
|
isExtension: location && location.protocol && location.protocol == "chrome-extension:",
|
||||||
|
isCmd: location && location.pathname && location.pathname.indexOf("/cmd/") > -1,
|
||||||
|
|
||||||
alert: function(text) { alert(JSON.stringify(text)) },
|
alert: function(text) { alert(JSON.stringify(text)) },
|
||||||
confirm: function(text) { return confirm(JSON.stringify(text)) },
|
confirm: function(text) { return confirm(JSON.stringify(text)) },
|
||||||
|
@ -15,7 +15,7 @@ Volcanos("onaction", {help: "交互操作", list: [], _init: function(can, msg,
|
|||||||
can.page.ClassList.add(can, can._target, "Action")
|
can.page.ClassList.add(can, can._target, "Action")
|
||||||
},
|
},
|
||||||
_plugin: function(can, index, args, next) {
|
_plugin: function(can, index, args, next) {
|
||||||
can.onappend.plugin(can, {type: "plugin", index: index, args: args, opts: can.user.Search(), width: window.innerWidth}, function(sub, meta) {
|
can.onappend.plugin(can, {type: "plugin", index: index, args: args, opts: can.user.Search(), height: window.innerHeight, width: window.innerWidth}, function(sub, meta) {
|
||||||
sub.run = function(event, cmds, cb) {
|
sub.run = function(event, cmds, cb) {
|
||||||
can.run(event, can.misc.Concat([ctx.ACTION, "run", index], cmds), cb)
|
can.run(event, can.misc.Concat([ctx.ACTION, "run", index], cmds), cb)
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb,
|
|||||||
can.base.isFunc(cb) && cb(msg)
|
can.base.isFunc(cb) && cb(msg)
|
||||||
},
|
},
|
||||||
_content: function(can, target) {
|
_content: function(can, target) {
|
||||||
var height = can.Conf("height")-320; height < 240 && (height = 240)
|
var height = can.Conf("height")-(can.user.isCmd? 54: 320); height < 240 && (height = 240)
|
||||||
can.page.Modify(can, can.ui.project, {style: {"max-height": height}})
|
can.page.Modify(can, can.ui.project, {style: {"max-height": height}})
|
||||||
can.page.Modify(can, can.ui.content, {style: {"max-height": height}})
|
can.page.Modify(can, can.ui.content, {style: {"max-height": height}})
|
||||||
can.page.Modify(can, can.ui.display, {style: {display: "none"}})
|
can.page.Modify(can, can.ui.display, {style: {display: "none"}})
|
||||||
|
@ -91,6 +91,29 @@ fieldset.word fieldset.story:hover {
|
|||||||
box-shadow: 12px 12px 12px 6px #5764efd1;
|
box-shadow: 12px 12px 12px 6px #5764efd1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.story[data-type=json] div.item {
|
||||||
|
margin-left:10px;
|
||||||
|
padding-left:10px;
|
||||||
|
border:solid 1px #ff000000;
|
||||||
|
border-left:dashed 1px gray;
|
||||||
|
}
|
||||||
|
div.story[data-type=json] div.item:hover {
|
||||||
|
border:solid 1px red;
|
||||||
|
}
|
||||||
|
div.story[data-type=json] span.key {
|
||||||
|
color:brown;
|
||||||
|
}
|
||||||
|
div.story[data-type=json] span.str {
|
||||||
|
color:magenta;
|
||||||
|
}
|
||||||
|
div.story[data-type=json] span.value {
|
||||||
|
cursor:copy;
|
||||||
|
}
|
||||||
|
div.story[data-type=json] span.toggle {
|
||||||
|
cursor:pointer;
|
||||||
|
color:gray;
|
||||||
|
}
|
||||||
|
|
||||||
fieldset.word.float {
|
fieldset.word.float {
|
||||||
width:-webkit-fill-available;
|
width:-webkit-fill-available;
|
||||||
position:fixed; left:0; top:0;
|
position:fixed; left:0; top:0;
|
||||||
|
@ -61,6 +61,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
table: function(can, data, target) {
|
table: function(can, data, target) {
|
||||||
|
can.page.OrderTable(can, target)
|
||||||
can.page.ClassList.add(can, target, "content")
|
can.page.ClassList.add(can, target, "content")
|
||||||
can.page.Select(can, target, "td", function(item) {
|
can.page.Select(can, target, "td", function(item) {
|
||||||
item.title = "点击复制", item.onclick = function(event) {
|
item.title = "点击复制", item.onclick = function(event) {
|
||||||
@ -68,6 +69,14 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
json: function(can, data, target) {
|
||||||
|
can.page.Select(can, target, "span.toggle", function(item) {
|
||||||
|
item.onclick = function(event) { can.onmotion.toggle(can, item.nextSibling) }
|
||||||
|
})
|
||||||
|
can.page.Select(can, target, "span.value", function(item) {
|
||||||
|
item.onclick = function(event) { can.user.copy(event, can, item.innerText) }
|
||||||
|
})
|
||||||
|
},
|
||||||
field: function(can, data, target) { var item = can.base.Obj(data.meta)
|
field: function(can, data, target) { var item = can.base.Obj(data.meta)
|
||||||
item.width = parseInt(can.Conf("width")||window.innerWidth-20), item.height = parseInt(can.Conf("height")||window.innerHeight)
|
item.width = parseInt(can.Conf("width")||window.innerWidth-20), item.height = parseInt(can.Conf("height")||window.innerHeight)
|
||||||
item.type = "story"
|
item.type = "story"
|
||||||
|
@ -119,8 +119,9 @@ Volcanos("onaction", {help: "交互操作", list: [
|
|||||||
},
|
},
|
||||||
|
|
||||||
"生成链接": function(event, can) { var meta = can.Conf()
|
"生成链接": function(event, can) { var meta = can.Conf()
|
||||||
var args = can.Option(); args._path = "/chat/cmd/"+(meta.index||can.core.Keys(meta.ctx, meta.cmd))
|
var pre = "/chat/cmd/"; if (can.user.Search(can, "pod")) { pre = "/chat/pod/"+can.user.Search(can, "pod")+"/cmd/" }
|
||||||
args._path == "/chat/cmd/web.wiki.word" && (args = {_path: "/chat/cmd/"+args.path})
|
var args = can.Option(); args._path = pre+(meta.index||can.core.Keys(meta.ctx, meta.cmd))
|
||||||
|
args._path.indexOf("/cmd/web.wiki.word") > -1 && (args = {_path: pre+args.path})
|
||||||
var msg = can.request(event, {link: can.user.MergeURL(can, args)})
|
var msg = can.request(event, {link: can.user.MergeURL(can, args)})
|
||||||
can.search(event, ["Header.onaction.share"])
|
can.search(event, ["Header.onaction.share"])
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user