mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
opt some
This commit is contained in:
parent
fbf958ea92
commit
742784d317
21
frame.js
21
frame.js
@ -52,27 +52,22 @@ Volcanos(chat.ONENGINE, {help: "搜索引擎", _init: function(can, meta, list,
|
||||
}, mod)
|
||||
},
|
||||
_remote: function(event, can, msg, panel, cmds, cb) {
|
||||
msg.option = can.core.List(msg.option, function(item) {
|
||||
return {_toast: true, _handle: true}[item] && delete(msg[item])? undefined: item
|
||||
})
|
||||
|
||||
if (panel.onengine._engine(event, can, msg, panel, cmds, cb)) { return }
|
||||
if (panel.onengine._plugin(event, can, msg, panel, cmds, cb)) { return }
|
||||
|
||||
var key = can.core.Keys(panel._name, cmds.join(ice.FS))
|
||||
var keys = can.core.Keys(panel._name, cmds.join(ice.FS))
|
||||
if (can.user.isLocalFile) { var msg = can.request(event); msg.Clear(ice.MSG_APPEND)
|
||||
var res = Volcanos.meta.pack[key]; res? msg.Copy(res): can.user.toast(can, "缺失数据")
|
||||
var res = Volcanos.meta.pack[keys]; res? msg.Copy(res): can.user.toast(can, "缺失数据")
|
||||
return can.base.isFunc(cb) && cb(msg)
|
||||
}
|
||||
|
||||
var toast; if (msg.Option(chat._TOAST)) { can.core.Timer(1000, function() {
|
||||
toast = toast||can.user.toast(can, msg.Option(chat._TOAST), msg._can._name, -1)
|
||||
}) }
|
||||
var names = msg.Option(chat._NAMES)||panel._names||((can.Conf("iceberg")||Volcanos.meta.iceberg)+panel._name)
|
||||
var toast, _toast = msg.Option(chat._TOAST); if (_toast) { can.onmotion.delay(can, function() { toast = toast||can.user.toastProcess(can, _toast, msg._can._name) }) }
|
||||
msg.option = can.core.List(msg.option, function(item) { return {_toast: true, _handle: true}[item] && delete(msg[item])? undefined: item })
|
||||
can.onengine.signal(can, chat.ONREMOTE, can.request({}, {_follow: panel._follow, _msg: msg, _cmds: cmds}))
|
||||
|
||||
var names = msg.Option(chat._NAMES)||panel._names||((can.Conf("iceberg")||Volcanos.meta.iceberg)+panel._name)
|
||||
can.misc.Run(event, can, {names: names, daemon: can.core.Keys(can.ondaemon._list[0], msg._daemon)}, cmds, function(msg) {
|
||||
Volcanos.meta.pack[key] = msg, delete(msg._handle), can.base.isFunc(cb) && cb(msg)
|
||||
toast && toast.close(), toast = true, delete(msg._toast)
|
||||
Volcanos.meta.pack[keys] = msg, toast && toast.close(), toast = true, can.base.isFunc(cb) && cb(msg)
|
||||
})
|
||||
},
|
||||
_engine: function(event, can, msg, panel, cmds, cb) {
|
||||
@ -155,7 +150,7 @@ Volcanos(chat.ONAPPEND, {help: "渲染引擎", _init: function(can, meta, list,
|
||||
},
|
||||
Clone: function() { meta.args = can.page.SelectArgs(can, option, "")
|
||||
can.onappend._init(can, meta, list, function(sub) { can.base.isFunc(cb) && cb(sub, true)
|
||||
can.core.Timer(10, function() { for (var k in sub._inputs) { can.onmotion.focus(can, sub._inputs[k]._target); break } })
|
||||
can.onmotion.delay(can, function() { for (var k in sub._inputs) { can.onmotion.focus(can, sub._inputs[k]._target); break } })
|
||||
}, target)
|
||||
},
|
||||
}, list, function(sub) { sub.Conf(meta), meta.feature = can.base.Obj(meta.feature, {})
|
||||
|
@ -90,6 +90,14 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
|
||||
}
|
||||
return can.misc.proto(msg, proto)
|
||||
},
|
||||
GET: function(can, url, cb) { var xhr = new XMLHttpRequest()
|
||||
xhr.open("GET", url), xhr.onreadystatechange = function() {
|
||||
if (xhr.status == 200) {
|
||||
return can.base.isFunc(cb) && cb(xhr.responseText)
|
||||
}
|
||||
}
|
||||
try { xhr.send() } catch(e) { can.misc.Log(e) }
|
||||
},
|
||||
POST: function(can, msg, url, form, cb) { // _method _accept _upload _progress
|
||||
var xhr = new XMLHttpRequest(); msg._xhr = xhr
|
||||
xhr.open(msg._method||"POST", url), xhr.onreadystatechange = function() {
|
||||
|
@ -279,6 +279,8 @@ Volcanos("user", {help: "用户操作", info: {}, agent: {
|
||||
target.value = msg.Option(item.name)||can.Option(item.name)||target.value||""
|
||||
}
|
||||
item.mode = "simple"
|
||||
if (item.type == html.USERNAME) { return }
|
||||
if (item.type == html.PASSWORD) { return }
|
||||
can.onappend.figure(can, item, target)
|
||||
}
|
||||
|
||||
@ -307,7 +309,7 @@ Volcanos("user", {help: "用户操作", info: {}, agent: {
|
||||
if (button === true) { return action.submit(event, can, "submit"), action }
|
||||
|
||||
can.page.Select(can, ui._target, html.INPUT_ARGS, function(item, index) {
|
||||
index == 0 && can.core.Timer(100, function() { can.onmotion.focus(can, item) })
|
||||
index == 0 && can.onmotion.delay(can, function() { can.onmotion.focus(can, item) })
|
||||
})
|
||||
return action
|
||||
},
|
||||
|
@ -76,6 +76,7 @@ Volcanos(chat.ONENGINE, {help: "解析引擎", _engine: function(event, page, ms
|
||||
Volcanos(chat.ONPLUGIN, {help: "注册插件",
|
||||
"parse": shy("解析", {
|
||||
"show": function(can, msg, cmds) { var name = cmds[1]||"can"
|
||||
can.isCmdMode() && can.user.title(name)
|
||||
cmds && cmds[0] && Volcanos(name, {_follow: can.core.Keys(can._follow, name)}, ["/plugin/story/parse.js"], function(sub) {
|
||||
sub.run = can.run, sub.Option = function() {}, can.isCmdMode() && sub.ConfHeight(window.innerHeight)
|
||||
sub.onappend.parse(sub, sub.onappend._parse(sub, cmds[0], name, sub.ConfHeight()), can._output)
|
||||
@ -85,7 +86,7 @@ Volcanos(chat.ONPLUGIN, {help: "注册插件",
|
||||
})
|
||||
})
|
||||
},
|
||||
}, ["text", "show:button@auto", "clear:button"], function(can, msg, cmds, cb) {
|
||||
}, ["text", "name", "show:button@auto", "clear:button"], function(can, msg, cmds, cb) {
|
||||
cmds && cmds[0] && can._root.Action.run({}, cmds, cb, true)
|
||||
}),
|
||||
|
||||
|
@ -202,7 +202,7 @@ Volcanos(chat.ONDETAIL, {help: "菜单交互",
|
||||
can.getAction(ctx.ARGS, function(item, next, index, array) { var msg = can.request({}, {hash: storm, id: item.dataset.id})
|
||||
var toast = can.user.toast(can, (index+1)+ice.PS+array.length, button, 10000, (index+1)*100/array.length)
|
||||
can.run(msg, [river, chat.STORM, ctx.ACTION, mdb.MODIFY, ice.ARG, item.dataset.args], function(msg) {
|
||||
can.core.Timer(200, function() {
|
||||
can.onmotion.delay(can, function() {
|
||||
toast.close(), next(), index == array.length-1 && can.user.toastSuccess(can, button)
|
||||
})
|
||||
})
|
||||
|
@ -4,7 +4,7 @@ Volcanos(chat.ONACTION, {help: "控件交互", _init: function(can, meta, cb, ta
|
||||
case html.BUTTON: meta.action == ice.AUTO && target.click(); break
|
||||
}
|
||||
},
|
||||
run: function(event, can) { can.run(event) },
|
||||
run: function(event, can) { can.run(can.request(event, {_toast: "执行中..."})) },
|
||||
list: function(event, can) { can.sup.Conf("mode") != "simple" && can.run(event) },
|
||||
back: function(event, can) { can.sup.onimport._back(can.sup) },
|
||||
refresh: function(event, can) { can.run(event) },
|
||||
|
19
plugin/local/chat/location.js
Normal file
19
plugin/local/chat/location.js
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target) {
|
||||
window._show_location = function(res) {
|
||||
console.log(res)
|
||||
}
|
||||
can.require(["https://apis.map.qq.com/ws/location/v1/ip?callback=_show_location&key="+can.Conf("token")], function(res) {
|
||||
console.log(res)
|
||||
})
|
||||
can.require(["https://map.qq.com/api/gljs?v=1.exp&key="+can.Conf("token")], function() {
|
||||
can.user.agent.getLocation(function(res) {
|
||||
console.log(res)
|
||||
|
||||
})
|
||||
|
||||
var center = new TMap.LatLng(39.984120, 116.307484)
|
||||
new TMap.Map(can._output, {center: center, zoom: 17.2, pitch: 43.5, rotation: 45})
|
||||
})
|
||||
},
|
||||
})
|
@ -8,7 +8,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
return
|
||||
}
|
||||
if (cmds[1] == "main.go") { res.Echo(msg.Option("content"))
|
||||
can.core.Timer(100, function() { can.sub && can.sub.onaction["项目"]({}, can.sub) })
|
||||
can.onmotion.delay(can, function() { can.sub && can.sub.onaction["项目"]({}, can.sub) })
|
||||
}
|
||||
cb(res), can.sub = can.core.Value(sub, "_outputs.-1")
|
||||
}
|
||||
|
@ -103,7 +103,6 @@ Volcanos(chat.ONKEYMAP, {help: "键盘交互",
|
||||
_insert: function(event, can) { can.onkeymap._model(can, "insert")
|
||||
can.ui.current.focus(), can.ui.content.scrollLeft -= 10000
|
||||
can.onkeymap.prevent(event)
|
||||
// can._keylist = []
|
||||
},
|
||||
|
||||
_mode: {
|
||||
@ -271,7 +270,7 @@ Volcanos(chat.ONACTION, {help: "控件交互", list: [nfs.SAVE, code.COMPILE, co
|
||||
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)
|
||||
},
|
||||
website: function(event, can, button) {
|
||||
can.onaction._runs(can.request(event, {file: "hi.zml"}), can, button)
|
||||
can.onaction._runs(can.request(event, {file: (can.base.trimSuffix(can.Option(nfs.FILE), can.base.Ext(can.Option(nfs.FILE)))+nfs.ZML).split("/").pop()}), can, button)
|
||||
},
|
||||
dream: function(event, can, button) {
|
||||
can.onaction._runs(can.request(event), can, button, function(msg) { can.ui.dreams.refresh()
|
||||
|
@ -391,7 +391,7 @@ Volcanos(chat.ONDETAIL, {help: "组件详情", list: [cli.START, ice.RUN, ice.CO
|
||||
})
|
||||
}
|
||||
}
|
||||
can.core.Next(list, function(item, next) { can.core.Timer(3000, function() {
|
||||
can.core.Next(list, function(item, next) { can.onmotion.delay(can, function() {
|
||||
can.onmotion.show(can, {interval: 300, length: 10}, null, item)
|
||||
can.user.toast(can, item.Value("index"))
|
||||
can.ondetail.run({target: item}, can), next()
|
||||
|
@ -222,7 +222,7 @@ Volcanos(chat.ONDETAIL, {help: "交互操作", list: ["删除"],
|
||||
},
|
||||
flash: function(sub) {
|
||||
sub.core.Next(sub.page.Select(sub, sub.ui.content, wiki.DIV_PAGE), function(page, next) {
|
||||
sub.sup.ondetail.show(sub, page), sub.core.Timer(500, function() { next() })
|
||||
sub.sup.ondetail.show(sub, page), sub.onmotion.delay(sub, function() { next() })
|
||||
})
|
||||
},
|
||||
grid: function(sub) { sub.page.styleClass(sub, sub.ui.content, "content grid") },
|
||||
|
@ -4,7 +4,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
Volcanos(chat.ONACTION, {help: "操作数据", list: ["打开屏幕", "打开摄像", "打开录音"],
|
||||
_action: function(can, cb) {
|
||||
var ui = can.page.Append(can, can._output, [{view: html.ACTION}, {view: html.OUTPUT, list: [{type: html.VIDEO, style: {width: can.ConfWidth()}, _init: function(item) {
|
||||
can.core.Timer(10, function() { cb(item, ui) })
|
||||
can.onmotion.delay(can, function() { cb(item, ui) })
|
||||
}}]}])
|
||||
|
||||
can.onappend._action(can, [], ui.action, {
|
||||
|
@ -127,7 +127,7 @@ Volcanos(chat.ONAPPEND, {help: "渲染引擎", list: ["{", "}", html.HEAD, html.
|
||||
can.onappend.parse(can, item.list, target, can.core.Keys(meta.keys, item.name), data, html.ITEM)
|
||||
}}])
|
||||
})
|
||||
can.core.Timer(100, function() { var height = target.offsetHeight
|
||||
can.onmotion.delay(can, function() { var height = target.offsetHeight
|
||||
can.page.style(can, ui.page, html.HEIGHT, height-10-(meta.style? 0: ui.name.offsetHeight))
|
||||
can.page.style(can, _target, html.HEIGHT, height-10)
|
||||
}), can.page.Select(can, ui.name, html.DIV_ITEM)[0].click()
|
||||
|
@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
can.onimport.select(can, msg)
|
||||
can.onmotion.clear(can), can.base.isFunc(cb) && cb(msg)
|
||||
can.onappend.table(can, msg), can.onappend.board(can, msg)
|
||||
can.core.Timer(12000, function() { can.onaction.play(event, can) })
|
||||
can.onmotion.delay(can, function() { can.onaction.play(event, can) })
|
||||
can.page.Select(can, can._output, "td a", function(a) {
|
||||
can.page.Modify(can, a, {target: ""})
|
||||
})
|
||||
@ -12,7 +12,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
||||
msg.Push(mdb.INDEX, index)
|
||||
msg.Push(mdb.NAME, a.innerText)
|
||||
msg.Push(mdb.LINK, a.href)
|
||||
a.href == location.href && can.core.Timer(100, function() {
|
||||
a.href == location.href && can.onmotion.delay(can, function() {
|
||||
can.page.Select(can, can._output, html.TR, function(tr, i) {
|
||||
i-1 == index && can.page.ClassList.add(can, tr, "select")
|
||||
})
|
||||
|
3
proto.js
3
proto.js
@ -330,7 +330,7 @@ var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", pack:
|
||||
|
||||
// 加载模块
|
||||
libs[0] = libs[0].toLowerCase()
|
||||
var name = libs[0].split("?")[0]
|
||||
var name = libs[0].indexOf("http") == 0? libs[0]: libs[0].split("?")[0]
|
||||
function next() { can._load(name, each), can.require(libs.slice(1), cb, each) }
|
||||
meta.cache[name]? next(): (_can_path = libs[0], meta._load(name, next))
|
||||
},
|
||||
@ -442,6 +442,7 @@ try { if (typeof(window) == lang.OBJECT) { // nodejs
|
||||
item.href = url, item.onload = cb
|
||||
return document.head.appendChild(item), item
|
||||
case nfs.JS:
|
||||
default:
|
||||
var item = document.createElement(nfs.SCRIPT)
|
||||
item.src = url, item.onload = cb, item.onerror = cb
|
||||
return document.body.appendChild(item), item
|
||||
|
Loading…
x
Reference in New Issue
Block a user