mirror of
https://shylinux.com/x/volcanos
synced 2025-04-26 17:24:06 +08:00
add location.js
This commit is contained in:
parent
742784d317
commit
28a1a7604a
32
frame.js
32
frame.js
@ -114,7 +114,9 @@ Volcanos(chat.ONDAEMON, {help: "推荐引擎", _init: function(can, name) { if (
|
|||||||
})
|
})
|
||||||
}, _list: [""],
|
}, _list: [""],
|
||||||
refresh: function(can, msg, sub) { sub.Update() },
|
refresh: function(can, msg, sub) { sub.Update() },
|
||||||
grow: function(can, msg, sub, arg) { sub.onimport._grow(sub, msg, can.page.Color(arg.join(""))) },
|
grow: function(can, msg, sub, arg) {
|
||||||
|
sub.onimport._grow(sub, msg, can.page.Color(arg.join("")))
|
||||||
|
},
|
||||||
toast: function(can, msg, arg) { can.core.CallFunc(can.user.toast, {can: can, msg: msg, cmds: arg}) },
|
toast: function(can, msg, arg) { can.core.CallFunc(can.user.toast, {can: can, msg: msg, cmds: arg}) },
|
||||||
pwd: function(can, msg, arg) { can.ondaemon._list[0] = arg[0] },
|
pwd: function(can, msg, arg) { can.ondaemon._list[0] = arg[0] },
|
||||||
exit: function(can, msg, sub) { can.user.close() },
|
exit: function(can, msg, sub) { can.user.close() },
|
||||||
@ -134,7 +136,7 @@ Volcanos(chat.ONAPPEND, {help: "渲染引擎", _init: function(can, meta, list,
|
|||||||
|
|
||||||
Status: function(key, value) {
|
Status: function(key, value) {
|
||||||
if (can.base.isObject(key)) { return can.core.Item(key, sub.Status), key }
|
if (can.base.isObject(key)) { return can.core.Item(key, sub.Status), key }
|
||||||
can.page.Select(can, status, [[[html.DIV, key], html.SPAN]], function(item) {
|
key && can.page.Select(can, status, [[[html.DIV, key], html.SPAN]], function(item) {
|
||||||
if (value && value.indexOf && value.indexOf("http") == 0) { value = can.page.Format(html.A, value) }
|
if (value && value.indexOf && value.indexOf("http") == 0) { value = can.page.Format(html.A, value) }
|
||||||
return value == undefined? (value = item.innerHTML): (item.innerHTML = value)
|
return value == undefined? (value = item.innerHTML): (item.innerHTML = value)
|
||||||
}); return value
|
}); return value
|
||||||
@ -301,14 +303,25 @@ Volcanos(chat.ONAPPEND, {help: "渲染引擎", _init: function(can, meta, list,
|
|||||||
case "": return can.page.Append(can, target, [item])
|
case "": return can.page.Append(can, target, [item])
|
||||||
case html.SPACE: return can.page.Append(can, target, [{view: can.base.join([html.ITEM, html.SPACE])}])
|
case html.SPACE: return can.page.Append(can, target, [{view: can.base.join([html.ITEM, html.SPACE])}])
|
||||||
}
|
}
|
||||||
|
|
||||||
var input = can.page.input(can, item, value)
|
var input = can.page.input(can, item, value)
|
||||||
|
if (item.range) {
|
||||||
|
input._init = function(target) { item.mode = "simple"
|
||||||
|
can.onappend.figure(can, item, target, function(sub, value, old) {
|
||||||
|
target.value = value, can.onaction[item.name](event, can, item.name)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
var br = input.type == html.TEXTAREA? [{type: html.BR, style: {clear: html.BOTH}}]: []
|
var br = input.type == html.TEXTAREA? [{type: html.BR, style: {clear: html.BOTH}}]: []
|
||||||
var title = can.Conf([ctx.FEATURE, chat.TITLE, item.name].join(ice.PT))||""; title && (input.title = title)
|
var title = can.Conf([ctx.FEATURE, chat.TITLE, item.name].join(ice.PT))||""; title && (input.title = title)
|
||||||
return can.page.Append(can, target, ([{view: style||can.base.join([html.ITEM, item.type]), onkeydown: function(event) {
|
return can.page.Append(can, target, ([{view: style||can.base.join([html.ITEM, item.type]), onkeydown: function(event) {
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case html.TEXT:
|
case html.TEXT:
|
||||||
switch (event.key) { case lang.ENTER: can.onkeymap.prevent(event); break }
|
switch (event.key) {
|
||||||
|
case lang.ENTER:
|
||||||
|
can.onkeymap.prevent(event);
|
||||||
|
can.onaction && can.onaction[item.name] && can.onaction[item.name](event, can, item.name);
|
||||||
|
break
|
||||||
|
}
|
||||||
can.onkeymap.input(event, can), can.onmotion.selectField(event, can)
|
can.onkeymap.input(event, can), can.onmotion.selectField(event, can)
|
||||||
break
|
break
|
||||||
case html.TEXTAREA:
|
case html.TEXTAREA:
|
||||||
@ -316,6 +329,7 @@ Volcanos(chat.ONAPPEND, {help: "渲染引擎", _init: function(can, meta, list,
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}, _init: function(target) {
|
||||||
}, list: [input]}]).concat(br))[item.name]
|
}, list: [input]}]).concat(br))[item.name]
|
||||||
},
|
},
|
||||||
table: function(can, msg, cb, target, sort) { if (msg.Length() == 0) { return }
|
table: function(can, msg, cb, target, sort) { if (msg.Length() == 0) { return }
|
||||||
@ -409,7 +423,13 @@ Volcanos(chat.ONAPPEND, {help: "渲染引擎", _init: function(can, meta, list,
|
|||||||
function _cbs(sub, value, old) { can.onmotion.hidden(can, sub._target), can.base.isFunc(cbs)? cbs(sub, value, old): target.value = value||"", can.onmotion.delay(can, function() { can.onmotion.focus(can, target) }) }
|
function _cbs(sub, value, old) { can.onmotion.hidden(can, sub._target), can.base.isFunc(cbs)? cbs(sub, value, old): target.value = value||"", can.onmotion.delay(can, function() { can.onmotion.focus(can, target) }) }
|
||||||
if (target._can) { return can.onmotion.toggle(can, target._can._target), can.base.isFunc(cb) && cb(target._can, _cbs) }
|
if (target._can) { return can.onmotion.toggle(can, target._can._target), can.base.isFunc(cb) && cb(target._can, _cbs) }
|
||||||
can.onappend._init(can, {type: html.INPUT, name: input, pos: chat.FLOAT, mode: meta.mode}, ["/plugin/input/"+input+".js"], function(sub) { sub.Conf(meta)
|
can.onappend._init(can, {type: html.INPUT, name: input, pos: chat.FLOAT, mode: meta.mode}, ["/plugin/input/"+input+".js"], function(sub) { sub.Conf(meta)
|
||||||
sub.run = function(event, cmds, cb) { (meta.run||can.run)(sub.request(event, can.Option()), cmds, cb, true) }
|
sub.run = function(event, cmds, cb) {
|
||||||
|
if (meta.range) {
|
||||||
|
var msg = can.request(event); for (var i = meta.range[0]; i < meta.range[1]; i += meta.range[2]||1) { msg.Push("value", i) } cb(msg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
(meta.run||can.run)(sub.request(event, can.Option()), cmds, cb, true)
|
||||||
|
}
|
||||||
can.onlayout.figure({target: target}, can, sub._target), can.page.style(sub, sub._target, meta.style)
|
can.onlayout.figure({target: target}, can, sub._target), can.page.style(sub, sub._target, meta.style)
|
||||||
target._can = sub, sub.close = function() { can.page.Remove(can, sub._target), delete(target._can) }
|
target._can = sub, sub.close = function() { can.page.Remove(can, sub._target), delete(target._can) }
|
||||||
can.base.isFunc(cb) && cb(sub, _cbs), can.base.isFunc(meta._init) && meta._init(sub, sub._target)
|
can.base.isFunc(cb) && cb(sub, _cbs), can.base.isFunc(meta._init) && meta._init(sub, sub._target)
|
||||||
@ -492,7 +512,7 @@ Volcanos(chat.ONLAYOUT, {help: "页面布局", _init: function(can, target) { ta
|
|||||||
},
|
},
|
||||||
profile: function(can, target) { target = target||can._output
|
profile: function(can, target) { target = target||can._output
|
||||||
function toggle(view) { var show = view.style.display == html.NONE
|
function toggle(view) { var show = view.style.display == html.NONE
|
||||||
can.onmotion.toggle(can, view, show), view._toggle && view._toggle(event, show)
|
can.onmotion.toggle(can, view, show), view._toggle? view._toggle(event, show): can.onimport.layout && can.onimport.layout(can)
|
||||||
return show
|
return show
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
lib/base.js
10
lib/base.js
@ -7,13 +7,11 @@ Volcanos("base", {help: "数据类型", Int: function(val, def) { return parseIn
|
|||||||
if (val.length > 0) { return val } for (var k in val) { return val } return def
|
if (val.length > 0) { return val } for (var k in val) { return val } return def
|
||||||
} catch (e) { return val && val.split && val.split(ice.FS) || def }
|
} catch (e) { return val && val.split && val.split(ice.FS) || def }
|
||||||
},
|
},
|
||||||
Copy: function(to, from) {
|
Copy: function(to, from, skip) { if (!from) { return to }
|
||||||
if (arguments.length == 2) {
|
if (arguments.length == 2 || typeof skip == "boolean") {
|
||||||
for (var k in from) {
|
for (var k in from) {
|
||||||
if (from[k] === "") {
|
if (skip && to[k] != undefined) { continue }
|
||||||
delete(to[k])
|
if (from[k] === "") { delete(to[k]); continue }
|
||||||
continue
|
|
||||||
}
|
|
||||||
to[k] = from[k]
|
to[k] = from[k]
|
||||||
}
|
}
|
||||||
return to
|
return to
|
||||||
|
@ -253,6 +253,8 @@ Volcanos("misc", {help: "通信协议", Message: function(event, can) { var msg
|
|||||||
for (var i in arguments) { args.push(arguments[i]) }
|
for (var i in arguments) { args.push(arguments[i]) }
|
||||||
args.push(this.fileLine(2, 3))
|
args.push(this.fileLine(2, 3))
|
||||||
console.log.apply(console, args)
|
console.log.apply(console, args)
|
||||||
|
var args = [this._time(), this.FileLine(2, 3), "debug"]
|
||||||
|
for (var i in arguments) { args.push(JSON.stringify(arguments[i])) }
|
||||||
navigator.userAgent.indexOf("Mobile") > -1 && alert(JSON.stringify(args.join(ice.SP)))
|
navigator.userAgent.indexOf("Mobile") > -1 && alert(JSON.stringify(args.join(ice.SP)))
|
||||||
},
|
},
|
||||||
FileLine: function(depth, length) {
|
FileLine: function(depth, length) {
|
||||||
|
@ -461,9 +461,8 @@ Volcanos("page", {help: "用户界面", ClassList: {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
insertBefore: function(can, list, before) {
|
insertBefore: function(can, list, before, parent) { parent = parent||before.parentNode
|
||||||
var item = can.page.Append(can, before.parentNode, list).first
|
var item = can.page.Append(can, parent, list).first
|
||||||
before.parentNode.insertBefore(item, before)
|
return parent.insertBefore(item, before), item
|
||||||
return item
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
10
lib/user.js
10
lib/user.js
@ -4,11 +4,13 @@ Volcanos("user", {help: "用户操作", info: {}, agent: {
|
|||||||
cb(list[0], can.base.ParseJSON(list[0]))
|
cb(list[0], can.base.ParseJSON(list[0]))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getLocation: function(cb) {
|
getLocation: function(cb) { var call = arguments.callee
|
||||||
|
if (call._res) { return cb(call._res) }
|
||||||
|
|
||||||
navigator.geolocation.getCurrentPosition(function(res) {
|
navigator.geolocation.getCurrentPosition(function(res) {
|
||||||
cb({latitude: parseInt(res.coords.latitude*100000), longitude: parseInt(res.coords.longitude*100000)})
|
cb(call._res = {latitude: parseInt(res.coords.latitude*100000), longitude: parseInt(res.coords.longitude*100000)})
|
||||||
}, function(some) {
|
}, function(some) {
|
||||||
typeof cb == lang.FUNCTION && cb({name: "some"})
|
typeof cb == lang.FUNCTION && cb({type: "unknown", name: "unknown", latitude: 3998412, longitude: 11630748})
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
openLocation: function(msg) {
|
openLocation: function(msg) {
|
||||||
@ -221,7 +223,7 @@ Volcanos("user", {help: "用户操作", info: {}, agent: {
|
|||||||
return text
|
return text
|
||||||
},
|
},
|
||||||
carte: function(event, can, meta, list, cb, parent) { // event item meta
|
carte: function(event, can, meta, list, cb, parent) { // event item meta
|
||||||
meta = meta||can.ondetail||can.onaction||{}, list = list&&list.length > 0? list: meta.list||[]; if (list.length == 0) { return }
|
meta = meta||can.ondetail||can.onaction||{}, list = list&&list.length > 0? list: meta.list||can.core.Item(meta)||[]; if (list.length == 0) { return }
|
||||||
cb = cb||function(event, button, meta) { var cb = meta[button]||meta["_engine"]; can.base.isFunc(cb) && cb(event, can, button) }
|
cb = cb||function(event, button, meta) { var cb = meta[button]||meta["_engine"]; can.base.isFunc(cb) && cb(event, can, button) }
|
||||||
|
|
||||||
var ui = can.page.Append(can, document.body, [{view: chat.CARTE, style: {left: 0, top: 0}, onmouseleave: function(event) {
|
var ui = can.page.Append(can, document.body, [{view: chat.CARTE, style: {left: 0, top: 0}, onmouseleave: function(event) {
|
||||||
|
@ -25,12 +25,12 @@ input[type=button][name=remove] { background-color:red; }
|
|||||||
|
|
||||||
table.layout { border-spacing:0; }
|
table.layout { border-spacing:0; }
|
||||||
table.layout td { vertical-align:top; }
|
table.layout td { vertical-align:top; }
|
||||||
table.layout div.toggle { background-color:#4682b46b; color:white; font-size:24px; position:absolute; z-index:10; }
|
table.layout td.content div.toggle { background-color:#4682b46b; color:white; font-size:24px; position:absolute; z-index:10; }
|
||||||
table.layout div.toggle>div { display:table-cell; }
|
table.layout td.content div.toggle>div { display:table-cell; }
|
||||||
table.layout div.toggle.project { padding-top: 50px; height:100px; width:15px; top:20%; left:0px; border-top-right-radius:10px; border-bottom-right-radius:10px; }
|
table.layout td.content div.toggle.project { padding-top: 50px; height:100px; width:15px; top:20%; left:0px; border-top-right-radius:10px; border-bottom-right-radius:10px; }
|
||||||
table.layout div.toggle.profile { padding-top: 50px; height:100px; width:15px; top:20%; right:0px; border-top-left-radius:10px; border-bottom-left-radius:10px; }
|
table.layout td.content div.toggle.profile { padding-top: 50px; height:100px; width:15px; top:20%; right:0px; border-top-left-radius:10px; border-bottom-left-radius:10px; }
|
||||||
table.layout div.toggle.display { margin-top:-15px; height:15px; width:100px; position:sticky; left:40%; border-top-left-radius:10px; border-top-right-radius:10px; }
|
table.layout td.content div.toggle.display { margin-top:-15px; height:15px; width:100px; position:sticky; left:40%; border-top-left-radius:10px; border-top-right-radius:10px; }
|
||||||
table.layout div.toggle.display>div { text-align:center; width:100px; transform: rotate(-90deg) translate(5px, 0px); }
|
table.layout td.content div.toggle.display>div { text-align:center; width:100px; transform: rotate(-90deg) translate(5px, 0px); }
|
||||||
table.content thead { position:sticky; top:2px; }
|
table.content thead { position:sticky; top:2px; }
|
||||||
table.content th { background-color:steelblue; padding:2px 6px; }
|
table.content th { background-color:steelblue; padding:2px 6px; }
|
||||||
table.content td { padding:2px 6px; }
|
table.content td { padding:2px 6px; }
|
||||||
@ -224,6 +224,9 @@ body.mobile fieldset.float input[type=button] { font-size:1.4rem; height:38px; }
|
|||||||
body.mobile table.layout div.toggle { font-size:48px; }
|
body.mobile table.layout div.toggle { font-size:48px; }
|
||||||
body.mobile table.content th { padding:6px 6px; }
|
body.mobile table.content th { padding:6px 6px; }
|
||||||
|
|
||||||
|
body.mobile table.layout td.content div.toggle.project { width:30px; }
|
||||||
|
body.mobile table.layout td.content div.toggle.profile { width:30px; }
|
||||||
|
|
||||||
body.mobile form.option>div.item { margin:0; height:38px; }
|
body.mobile form.option>div.item { margin:0; height:38px; }
|
||||||
body.mobile div.action>div.item { margin:0; height:38px; }
|
body.mobile div.action>div.item { margin:0; height:38px; }
|
||||||
body.mobile fieldset.word.float>div.output>div.project { top:38px; }
|
body.mobile fieldset.word.float>div.output>div.project { top:38px; }
|
||||||
@ -314,3 +317,13 @@ body.white.simple fieldset.plugin div.output.json div.item span.nonce { color:li
|
|||||||
body.white.simple div.output.card input[type=button] { background-color:#0152d9; font-size:0.8rem; padding:5px 10px; box-shadow:2px 2px 6px 1px gray; }
|
body.white.simple div.output.card input[type=button] { background-color:#0152d9; font-size:0.8rem; padding:5px 10px; box-shadow:2px 2px 6px 1px gray; }
|
||||||
body.white.simple div.output.card input[type=button]:hover { box-shadow:2px 2px 8px 2px gray; }
|
body.white.simple div.output.card input[type=button]:hover { box-shadow:2px 2px 8px 2px gray; }
|
||||||
body.white.simple div.output div.project div.zone>div.action>div.item input[type=text] { color:black; }
|
body.white.simple div.output div.project div.zone>div.action>div.item input[type=text] { color:black; }
|
||||||
|
|
||||||
|
body.white div.project.auto { background-color:whitesmoke; }
|
||||||
|
body.white div.profile.auto { background-color:whitesmoke; }
|
||||||
|
body.black div.project.auto { background-color:#1d3349; }
|
||||||
|
body.black div.profile.auto { background-color:#1d3349; }
|
||||||
|
div.project.auto { position:absolute; left:0; z-index:10; }
|
||||||
|
div.profile.auto { position:absolute; right:0; z-index:10; }
|
||||||
|
fieldset.plugin.location>div.action input[type=text] {
|
||||||
|
width:40px;
|
||||||
|
}
|
||||||
|
@ -7,7 +7,7 @@ Volcanos(chat.ONFIGURE, {help: "控件详情", key: {
|
|||||||
_show: function(can, msg, cbs, target, name) {
|
_show: function(can, msg, cbs, target, name) {
|
||||||
if (!can.onmotion.toggle(can, can._target, msg.Length() != 0)) { return }
|
if (!can.onmotion.toggle(can, can._target, msg.Length() != 0)) { return }
|
||||||
can.onmotion.clear(can), can.onappend.table(can, msg, function(value) {
|
can.onmotion.clear(can), can.onappend.table(can, msg, function(value) {
|
||||||
return {text: [value, html.TD], onclick: function(event) { can.base.isFunc(cbs) && cbs(can, value, target.value)
|
return {text: [value, html.TD], style: msg.Length() > 1? {"min-width": target.offsetWidth-16}: {}, onclick: function(event) { can.base.isFunc(cbs) && cbs(can, value, target.value)
|
||||||
msg.Option(ice.MSG_PROCESS) == ice.PROCESS_AGAIN && can.onmotion.delay(can, function() {
|
msg.Option(ice.MSG_PROCESS) == ice.PROCESS_AGAIN && can.onmotion.delay(can, function() {
|
||||||
can.onfigure.key._init(event, can, cbs, target, name, value)
|
can.onfigure.key._init(event, can, cbs, target, name, value)
|
||||||
})
|
})
|
||||||
|
@ -1,19 +1,306 @@
|
|||||||
|
Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, target) {
|
||||||
|
can.onmotion.clear(can), can.onlayout.profile(can), can.base.isFunc(cb) && cb(msg)
|
||||||
|
!can.isCmdMode() && can.ConfHeight(window.innerHeight - 5*html.ACTION_HEIGHT - 5*html.PLUGIN_MARGIN)
|
||||||
|
can.user.isMobile && can.ConfHeight(window.innerHeight-html.ACTION_HEIGHT)
|
||||||
|
can.user.isMobile && can.onmotion.hidden(can, can.ui.project)
|
||||||
|
can.user.isMobile && can.onmotion.hidden(can, can._action)
|
||||||
|
can.user.isMobile && can.onmotion.hidden(can, can._option)
|
||||||
|
can.user.isMobile && can.onmotion.hidden(can, can._status)
|
||||||
|
|
||||||
Volcanos("onimport", {help: "导入数据", _init: function(can, msg, cb, target) {
|
can.page.styleWidth(can, can.ui.project, 240), can.onmotion.toggle(can, can.ui.profile, true)
|
||||||
window._show_location = function(res) {
|
can.page.ClassList.add(can, can.ui.project, ice.AUTO)
|
||||||
console.log(res)
|
can.page.ClassList.add(can, can.ui.profile, ice.AUTO)
|
||||||
}
|
|
||||||
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)
|
|
||||||
|
|
||||||
})
|
can.onappend._status(can, can.onexport.list)
|
||||||
|
can.require([can.base.MergeURL("https://map.qq.com/api/gljs", "v", "1.exp", "libraries", "service", "key", can.Conf(aaa.TOKEN))], function() {
|
||||||
var center = new TMap.LatLng(39.984120, 116.307484)
|
var res = {type: "unknown", latitude: 3998412, longitude: 11630748}, current = can.base.Obj(msg.Option(chat.LOCATION))
|
||||||
new TMap.Map(can._output, {center: center, zoom: 17.2, pitch: 43.5, rotation: 45})
|
if (current.status === 0) { res = can.onexport.point(can, current.result.location, current.result.ad_info), res.type = "ip", res.name = current.result.ip, can.Status(res) }
|
||||||
|
can._current = res, can.onimport._layout(can), can.user.agent.getLocation(function(res) { res.type = "current", can.onimport.center(can, can._current = res) })
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
_layout: function(can) { can.onmotion.clear(can, can.ui.content), can.onmotion.clear(can, can.ui.project)
|
||||||
|
can.page.style(can, can.ui.content, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth())
|
||||||
|
can.page.style(can, can.ui.project, html.MAX_HEIGHT, can.ConfHeight())
|
||||||
|
|
||||||
|
can.onimport.zone(can, [
|
||||||
|
{name: "direction"},
|
||||||
|
{name: "favor", _menu: shy({"play": function(event, can, button) {
|
||||||
|
can.core.Next(can.page.Select(can, can.ui.favor._target, html.DIV_ITEM), function(item, next) {
|
||||||
|
item.click(), can.onmotion.delay(can, next, 2000)
|
||||||
|
}, function() { can.user.toastSuccess(can) })
|
||||||
|
}})},
|
||||||
|
{name: "explore", _init: function(target, zone) {
|
||||||
|
zone._search.onkeyup = function(event) { event.key == "Enter" && can.onimport._search0(can, event.target.value) }
|
||||||
|
}},
|
||||||
|
{name: "search", _init: function(target, zone) {
|
||||||
|
zone._search.onkeyup = function(event) { event.key == "Enter" && can.onimport._search(can, event.target.value) }
|
||||||
|
}},
|
||||||
|
{name: "district", _init: function(target, zone) {
|
||||||
|
can.onimport._province(can, target)
|
||||||
|
}},
|
||||||
|
], can.ui.project), can.onimport._show(can, can._current), can.onimport._mark(can)
|
||||||
|
can.mark && can.mark.add({position: can.onimport.point(can, can._current), properties: can._current})
|
||||||
|
can._msg.Table(function(item) { can.onimport._item(can, item) })
|
||||||
|
},
|
||||||
|
_search0: function(can, keyword) { var p = can.onimport.point(can, can.current.item)
|
||||||
|
can.runAction(can.request({}, {"boundary": "nearby("+can.base.join([p.lat, p.lng, "500"], ice.FS)+")", "page_index": 1, "keyword": keyword}), "search", [], function(msg) {
|
||||||
|
var res = can.base.Obj(msg.Result()); can.core.List(res.data, function(item) {
|
||||||
|
can.onimport._item(can, can.onexport.point(can, item.location, {type: item.category, name: item.title, text: item.address}), can.ui.explore._target)
|
||||||
|
}), can.misc.Debug(res)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
_search: function(can, keyword) { var p = can.onimport.point(can, can.current.item)
|
||||||
|
can.runAction(can.request({}, {"boundary": "region("+can.base.join([can.Status("city"), p.lat, p.lng], ice.FS)+")", "page_index": 1, "keyword": keyword}), "search", [], function(msg) {
|
||||||
|
var res = can.base.Obj(msg.Result()); can.core.List(res.data, function(item) {
|
||||||
|
can.onimport._item(can, can.onexport.point(can, item.location, {type: item.category, name: item.title, text: item.address}), can.ui.search._target)
|
||||||
|
}), can.misc.Debug(res)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
_list_result: function(can, msg, cb) { var res = can.base.Obj(msg.Result()); can.misc.Debug(res)
|
||||||
|
return can.core.List(res.result[0], function(item) { item.name = item.name||item.fullname; return can.base.isFunc(cb)? cb(item): item })
|
||||||
|
},
|
||||||
|
_district: function(can, id, cb) {
|
||||||
|
can.runAction(can.request({}, {id: id}), "district", [], cb)
|
||||||
|
},
|
||||||
|
_province: function(can, target) {
|
||||||
|
can.onimport._district(can, "", function(msg) {
|
||||||
|
can.onimport._list_result(can, msg, function(province) {
|
||||||
|
can.onimport.item(can, province, function(event, _, show) { if (show === false) { return }
|
||||||
|
can.onimport.center(can, can.onexport.point(can, province.location, {type: "province", name: province.name, text: province.fullname}))
|
||||||
|
can.map.setZoom(can.Action("zoom", 8)), can.Status({nation: "中国", province: province.fullname})
|
||||||
|
|
||||||
|
show === true || can.onimport._city(can, province, event.target)
|
||||||
|
}, function() {}, target)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
_city: function(can, province, target) {
|
||||||
|
can.onimport._district(can, province.id, function(msg) {
|
||||||
|
can.onimport.itemlist(can, can.onimport._list_result(can, msg), function(event, city, show) { if (show === false) { return }
|
||||||
|
can.onimport.center(can, can.onexport.point(can, city.location, {type: "city", name: city.name, text: city.fullname}))
|
||||||
|
can.map.setZoom(can.Action("zoom", 12)), can.Status({nation: "中国", province: province.fullname, city: city.fullname})
|
||||||
|
|
||||||
|
show === true || can.onimport._county(can, province, city, event.target)
|
||||||
|
}, function() {}, target)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
_county: function(can, province, city, target) {
|
||||||
|
can.onimport._district(can, city.id, function(msg) {
|
||||||
|
can.onimport.itemlist(can, can.onimport._list_result(can, msg), function(event, county) {
|
||||||
|
can.onimport.center(can, can.onexport.point(can, county.location, {type: "county", name: city.name, text: county.fullname}))
|
||||||
|
can.map.setZoom(can.Action("zoom", 15)), can.Status({nation: "中国", province: province.fullname, city: city.fullname})
|
||||||
|
}, function() {}, target)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
_show: function(can, item) {
|
||||||
|
can.map = new TMap.Map(can.ui.content, {center: can.onimport.point(can, item), zoom: can.Action("zoom"), pitch: can.Action("pitch"), rotation: can.Action("rotation"), mapStyleId: "style2"})
|
||||||
|
can.page.Select(can, can._target, "div.content>div", function(item) { can.page.style(can, item, {"z-index": 3}) })
|
||||||
|
can.current = {
|
||||||
|
label: new TMap.MultiLabel({map: can.map, geometries: [{id: "current", position: can.onimport.point(can, item), content: item.name}]}),
|
||||||
|
marker: new TMap.MultiMarker({map: can.map, geometries: [{id: "current", position: can.onimport.point(can, item)}]}),
|
||||||
|
info: can.onimport.info(can, item), hover: can.onimport.info(can, item),
|
||||||
|
circle: can.onimport.circle(can, item, 100), item: item,
|
||||||
|
}
|
||||||
|
|
||||||
|
can.map.on("rotate", function(event) { can.Action("rotation", can.map.getRotation()) })
|
||||||
|
can.map.on("pitch", function(event) { can.Action("pitch", can.map.getPitch()) })
|
||||||
|
can.map.on("zoom", function(event) { can.Action("zoom", can.map.getZoom()) })
|
||||||
|
can.map.on("click", function(event) {
|
||||||
|
var point = can.onaction._point(event, can, {name: event.poi? event.poi.name: ""}); can.onimport.center(can, point)
|
||||||
|
can.Action("mode") == "insert" && can.runAction(can.request({target: {getBoundingClientRect: function() { return point }}}, point), mdb.CREATE, function(msg) {
|
||||||
|
can.onimport._item(can, point)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
_item: function(can, item, target) { if (!item.latitude || !item.longitude) { return }
|
||||||
|
can.onimport.item(can, item, function(event) {
|
||||||
|
can.onimport.center(can, item), can.onimport.plugin(can, item)
|
||||||
|
}, function(event) {
|
||||||
|
can.onexport.hover(can, item), can.user.carteRight(event, can, {
|
||||||
|
direction: function(event, button) { can.onimport.center(can, item), can.onaction[button](event, can, button) },
|
||||||
|
favor: function(event) { can.request(event, item), can.onaction.create(event, can) },
|
||||||
|
plugin: function(event, button) { can.request(event, item, item.extra)
|
||||||
|
can.user.input(event, can, [ctx.INDEX, ctx.ARGS], function(args, data) {
|
||||||
|
can.base.Copy(item.extra, data), can.runAction(event, mdb.MODIFY, args)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}, target||can.ui.favor._target)
|
||||||
|
can.mark && can.mark.add({position: can.onimport.point(can, item), properties: item})
|
||||||
|
can.cluster && can.cluster.add({position: can.onimport.point(can, item)})
|
||||||
|
},
|
||||||
|
_cluster: function(can, msg) {
|
||||||
|
can.cluster = new TMap.MarkerCluster({map: can.map, geometries: []})
|
||||||
|
},
|
||||||
|
_mark: function(can, msg) {
|
||||||
|
can.mark = new TMap.MultiMarker({map: can.map})
|
||||||
|
can.mark.on("click", function(event) { if (!event.geometry) { return } var item = event.geometry.properties
|
||||||
|
can.onimport.center(can, item)
|
||||||
|
})
|
||||||
|
can.mark.on("hover", function(event) { if (!event.geometry) { return } var item = event.geometry.properties
|
||||||
|
can.onexport.hover(can, item)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
_polyline: function(can, path) {
|
||||||
|
return new TMap.MultiPolyline({
|
||||||
|
map: can.map,
|
||||||
|
styles: {
|
||||||
|
'style_blue': new TMap.PolylineStyle({
|
||||||
|
'color': '#3777FF', //线填充色
|
||||||
|
'width': 6, //折线宽度
|
||||||
|
'borderWidth': 5, //边线宽度
|
||||||
|
'borderColor': '#FFF', //边线颜色
|
||||||
|
'lineCap': 'butt' //线端头方式
|
||||||
|
}),
|
||||||
|
'style_red': new TMap.PolylineStyle({
|
||||||
|
'color': '#CC0000', //线填充色
|
||||||
|
'width': 6, //折线宽度
|
||||||
|
'borderWidth': 5, //边线宽度
|
||||||
|
'borderColor': '#CCC', //边线颜色
|
||||||
|
'lineCap': 'round' //线端头方式
|
||||||
|
})
|
||||||
|
},
|
||||||
|
geometries: [{'styleId': 'style_blue', 'paths': path}]
|
||||||
|
})
|
||||||
|
},
|
||||||
|
_move: function(can) {
|
||||||
|
can.mark.add({id: 'car', styleId: 'car-down', position: new TMap.LatLng(39.98481500648338, 116.30571126937866)})
|
||||||
|
can.mark.moveAlong({"car": {path: [
|
||||||
|
new TMap.LatLng(39.98481500648338, 116.30571126937866),
|
||||||
|
new TMap.LatLng(39.982266575222155, 116.30596876144409),
|
||||||
|
new TMap.LatLng(39.982348784165886, 116.3111400604248),
|
||||||
|
new TMap.LatLng(39.978813710266024, 116.3111400604248),
|
||||||
|
new TMap.LatLng(39.978813710266024, 116.31699800491333)
|
||||||
|
], speed: 70}}, {autoRotation:true})
|
||||||
|
},
|
||||||
|
|
||||||
|
point: function(can, item) {
|
||||||
|
return new TMap.LatLng(item.latitude/100000.0, item.longitude/100000.0)
|
||||||
|
},
|
||||||
|
center: function(can, item) { var point = can.onimport.point(can, item)
|
||||||
|
can.map.setCenter(point), can.Status("name", ""), can.Status("text", ""), can.Status(item), can.Status({latitude: point.lat, longitude: point.lng})
|
||||||
|
can.current.info.setPosition(point), can.current.info.setContent((item.name||"")+"<br/>"+(item.text||""))
|
||||||
|
can.current.label.updateGeometries([{id: "current", position: point, content: item.name}])
|
||||||
|
can.current.marker.updateGeometries([{id: "current", position: point}])
|
||||||
|
can.current.circle.setGeometries([{center: point, radius: 300}])
|
||||||
|
can.current.item = item
|
||||||
|
item._plugin && can.onmotion.toggle(can, item._plugin._target)
|
||||||
|
},
|
||||||
|
info: function(can, item) {
|
||||||
|
return new TMap.InfoWindow({map: can.map,
|
||||||
|
position: can.onimport.point(can, item), offset: {x: 0, y: -32},
|
||||||
|
content: (item.name||"")+"<br/>"+(item.text||""),
|
||||||
|
})
|
||||||
|
},
|
||||||
|
circle: function(can, item, radius) {
|
||||||
|
return new TMap.MultiCircle({
|
||||||
|
map: can.map, styles: {
|
||||||
|
circle: new TMap.CircleStyle({
|
||||||
|
color: 'rgba(41,91,255,0.16)',
|
||||||
|
showBorder: true,
|
||||||
|
borderColor: 'rgba(41,91,255,1)',
|
||||||
|
borderWidth: 2,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
geometries: [{styleId: 'circle', center: can.onimport.point(can, item), radius: radius||300}],
|
||||||
|
})
|
||||||
|
},
|
||||||
|
plugin: function(can, item) {
|
||||||
|
if (can.onmotion.cache(can, function() { return item.hash }, can.ui.profile)) {
|
||||||
|
|
||||||
|
} else { item.extra = can.base.Obj(item.extra, {})
|
||||||
|
item.extra.index && can.onimport.plug(can, {index: item.extra.index, args: item.extra.args}, can.ui.profile, function(sub) { item._plugin = sub
|
||||||
|
can.page.style(can, sub._target, html.MAX_HEIGHT, sub.ConfHeight(can.ConfHeight()), html.MAX_WIDTH, sub.ConfWidth(can.ConfWidth()*3/4))
|
||||||
|
can.page.style(can, sub._output, html.MAX_HEIGHT, sub.ConfHeight(can.ConfHeight()-2*html.ACTION_HEIGHT), html.MAX_WIDTH, sub.ConfWidth(can.ConfWidth()*3/4))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_plugin: function(can, item, meta) {
|
||||||
|
function myInfoWindow(options) { TMap.DOMOverlay.call(this, options) }
|
||||||
|
myInfoWindow.prototype = new TMap.DOMOverlay()
|
||||||
|
myInfoWindow.prototype.onInit = function(options) { this.position = options.position, this.meta = options.meta }
|
||||||
|
|
||||||
|
myInfoWindow.prototype.createDOM = function() {
|
||||||
|
var meta = this.meta, ui = can.onappend.field(can, chat.FLOAT, {}, can._output)
|
||||||
|
can.onappend.plugin(can, meta, function(sub) {
|
||||||
|
sub.run = function(event, cmds, cb) { can.runAction(can.request(event), ice.RUN, [meta.index].concat(cmds), cb) }
|
||||||
|
sub.onaction.close = function(event) { can.onmotion.hidden(can, sub._target) }
|
||||||
|
// can.page.style(can, sub._output, html.MAX_HEIGHT, sub.ConfHeight(can.ConfHeight()/2))
|
||||||
|
// can.page.style(can, sub._output, html.MAX_WIDTH, sub.ConfWidth(can.ConfWidth()/2))
|
||||||
|
item._plugin = sub
|
||||||
|
}, can._output, ui.fieldset)
|
||||||
|
return ui.fieldset
|
||||||
|
}
|
||||||
|
myInfoWindow.prototype.updateDOM = function() {
|
||||||
|
var pixel = this.map.projectToContainer(this.position); can.page.style(can, this.dom, {
|
||||||
|
left: pixel.getX(), top: pixel.getY()+2*html.ACTION_HEIGHT,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return new myInfoWindow({map: can.map, position: can.onimport.point(can, item), meta: meta})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Volcanos(chat.ONACTION, {help: "操作数据", list: [["mode", "select", "insert"],
|
||||||
|
{type: html.TEXT, name: "zoom", value: 17, range: [3, 21]},
|
||||||
|
{type: html.TEXT, name: "pitch", value: 30, range: [0, 80, 5]},
|
||||||
|
{type: html.TEXT, name: "rotation", value: "0", range: [0, 360, 10]},
|
||||||
|
"current", "explore", "create", "direction"],
|
||||||
|
_trans: {current: "定位", favor: "收藏"},
|
||||||
|
|
||||||
|
zoom: function(event, can) { can.map.setZoom(can.Action("zoom")) },
|
||||||
|
pitch: function(event, can) { can.map.setPitch(can.Action("pitch")) },
|
||||||
|
rotation: function(event, can) { can.map.setRotation(can.Action("rotation")) },
|
||||||
|
current: function(event, can) { can.onimport.center(can, can._current), can.map.setZoom(can.Action("zoom", 17)), can.map.setPitch(can.Action("pitch", 30)), can.map.setRotation(can.Action("rotation", 0)) },
|
||||||
|
|
||||||
|
explore: function(event, can, button) { var p = can.onimport.point(can, can.current.item); can.onmotion.clear(can, can.ui.explore._target)
|
||||||
|
for (var i = 1; i < 6; i++) {
|
||||||
|
can.runAction(can.request({}, {"boundary": "nearby("+can.base.join([p.lat, p.lng, "500"], ice.FS)+")", "page_index": i}), button, [], function(msg) {
|
||||||
|
var res = can.base.Obj(msg.Result()); can.core.List(res.data, function(item) {
|
||||||
|
can.onimport._item(can, can.onexport.point(can, item.location, {type: item.category, name: item.title, text: item.address}), can.ui.explore._target)
|
||||||
|
}), can.misc.Debug(res)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
direction: function(event, can, button) { var p = can.map.getCenter(); can.onmotion.clear(can, can.ui.direction._target)
|
||||||
|
can.user.input(event, can, [["type", "driving", "walking", "bicycling", "transit"]], function(list) {
|
||||||
|
var from = can.onimport.point(can, can._current), to = can.onimport.point(can, can.current.item)
|
||||||
|
var msg = can.request({}, {type: list[0], "from": can.base.join([from.lat, from.lng], ice.FS), "to": can.base.join([to.lat, to.lng], ice.FS)})
|
||||||
|
can.runAction(msg._event, button, [], function(msg) { var res = can.base.Obj(msg.Result()), route = res.result.routes[0]
|
||||||
|
var coors = route.polyline, pl = [], kr = 1000000
|
||||||
|
for (var i = 2; i < coors.length; i++) { coors[i] = Number(coors[i - 2]) + Number(coors[i]) / kr }
|
||||||
|
for (var i = 0; i < coors.length; i += 2) { pl.push(new TMap.LatLng(coors[i], coors[i+1])) }
|
||||||
|
can.onimport._polyline(can, pl)
|
||||||
|
|
||||||
|
can.core.List(route.steps, function(item) { var i = item.polyline_idx[0]
|
||||||
|
can.onimport._item(can, can.onexport.point(can, {lat: coors[i], lng: coors[i+1]}, {type: item.category, name: item.instruction, text: item.act_desc}), can.ui.direction._target)
|
||||||
|
}), can.user.toastProcess(can, "distance: "+route.distance+" duration: "+route.duration)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
create: function(event, can) { can.request(event, can.current.item)
|
||||||
|
can.user.input(event, can, can.core.Split("type,name,text"), function(args) { var p = can.onexport.center(can)
|
||||||
|
can.runAction(event, mdb.CREATE, args.concat("latitude", p.latitude, "longitude", p.longitude), function(msg) {
|
||||||
|
can.onimport._item(can, can.base.Copy(p, {name: msg.Option(mdb.NAME), text: msg.Option(mdb.TEXT)}))
|
||||||
|
}, true)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
_point: function(event, can, item) { var rect = can.ui.content.getBoundingClientRect()
|
||||||
|
return can.base.Copy({left: rect.left+event.point.x, bottom: rect.top+event.point.y, latitude: parseInt(event.latLng.lat*100000), longitude: parseInt(event.latLng.lng*100000)}, item, true)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
Volcanos(chat.ONEXPORT, {help: "导出数据", list: ["nation", "province", "city", "latitude", "longitude", "type", "name", "text"],
|
||||||
|
point: function(can, point, item) { return can.base.Copy({latitude: parseInt(point.lat*100000), longitude: parseInt(point.lng*100000)}, item, true) },
|
||||||
|
center: function(can) { return can.onexport.point(can, can.map.getCenter()) },
|
||||||
|
current: function(can) {
|
||||||
|
var p = can.onexport.center(can); p.latitude /= 100000, p.longitude /= 100000; can.Status(p)
|
||||||
|
can.current.marker.updateGeometries([{id: "current", position: can.map.getCenter()}])
|
||||||
|
can.current.label.updateGeometries([{id: "current", position: can.map.getCenter()}])
|
||||||
|
can.current.circle.setGeometries([{center: can.map.getCenter(), radius: 300}])
|
||||||
|
},
|
||||||
|
hover: function(can, item) {
|
||||||
|
can.current.hover.setPosition(can.onimport.point(can, item))
|
||||||
|
can.current.hover.setContent(item.name+"<br/>"+item.text)
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
@ -41,7 +41,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
ondragstart: function(event) { var target = event.target; can.drop = function(event, td, time) { td.append(target)
|
ondragstart: function(event) { var target = event.target; can.drop = function(event, td, time) { td.append(target)
|
||||||
can.onaction.modifyTask(event, can, task, "begin_time", time+task.begin_time.slice(time.length), task.begin_time)
|
can.onaction.modifyTask(event, can, task, "begin_time", time+task.begin_time.slice(time.length), task.begin_time)
|
||||||
} }, draggable: time != undefined, title: can.onexport.title(can, task), _init: function(target) {
|
} }, draggable: time != undefined, title: can.onexport.title(can, task), _init: function(target) {
|
||||||
var item = can.onimport.item(can, html.ITEM, {nick: task.name+":"+task.text}, function() { can.onmotion.delay(can, function() {
|
var item = can.onimport.item(can, {nick: task.name+":"+task.text}, function() { can.onmotion.delay(can, function() {
|
||||||
can.onmotion.select(can, can.ui.content, html.TD, target.parentNode), can.onimport._profile(can, task)
|
can.onmotion.select(can, can.ui.content, html.TD, target.parentNode), can.onimport._profile(can, task)
|
||||||
}) }, null, can.ui.project); task._target = target, target.onclick = function(event) { item.click() }
|
}) }, null, can.ui.project); task._target = target, target.onclick = function(event) { item.click() }
|
||||||
can.task = can.task||task, can.sup.task = can.sup.task||task, can.sup.task.zone == task.zone && can.sup.task.id == task.id && (can.sup.task._target = target)
|
can.task = can.task||task, can.sup.task = can.sup.task||task, can.sup.task.zone == task.zone && can.sup.task.id == task.id && (can.sup.task._target = target)
|
||||||
|
@ -35,7 +35,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
can.Action(key, target.Value(key)||can.Action(key))
|
can.Action(key, target.Value(key)||can.Action(key))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return (name || target == can.svg) && can.onimport.item(can, html.ITEM, {name: name||html.SVG}, function(event) {
|
return (name || target == can.svg) && can.onimport.item(can, {name: name||html.SVG}, function(event) {
|
||||||
show(event), can.onaction.show(event, can), can.Status(svg.GROUP, name||html.SVG)
|
show(event), can.onaction.show(event, can), can.Status(svg.GROUP, name||html.SVG)
|
||||||
}, function(event) {
|
}, function(event) {
|
||||||
can.user.carteRight(event, can, can.onaction, can.onaction.menu_list)
|
can.user.carteRight(event, can, can.onaction, can.onaction.menu_list)
|
||||||
|
@ -30,10 +30,10 @@ fieldset.word.float h1 { text-align:center; }
|
|||||||
fieldset.word.float h2 { text-align:center; }
|
fieldset.word.float h2 { text-align:center; }
|
||||||
fieldset.word.float h3 { text-align:center; }
|
fieldset.word.float h3 { text-align:center; }
|
||||||
|
|
||||||
fieldset.panel.cmd fieldset.word>legend { display:none; }
|
fieldset.word.cmd>legend { display:none; }
|
||||||
fieldset.panel.cmd fieldset.word>form.option { display:none; }
|
fieldset.word.cmd>form.option { display:none; }
|
||||||
fieldset.panel.cmd fieldset.word>div.action { display:none; }
|
fieldset.word.cmd>div.action { display:none; }
|
||||||
fieldset.panel.cmd fieldset.word>div.status { display:none; }
|
fieldset.word.cmd>div.status { display:none; }
|
||||||
|
|
||||||
div.story[data-type=spark][data-name=field]>div.menu { float:left; overflow:auto; }
|
div.story[data-type=spark][data-name=field]>div.menu { float:left; overflow:auto; }
|
||||||
div.story[data-type=spark][data-name=field]>div.list { float:left; overflow:auto; }
|
div.story[data-type=spark][data-name=field]>div.list { float:left; overflow:auto; }
|
||||||
|
@ -169,7 +169,7 @@ Volcanos(chat.ONACTION, {help: "控件交互",
|
|||||||
|
|
||||||
sub.ui = sub.page.Append(sub, sub._output, [{view: chat.PROJECT}, {view: chat.CONTENT}])
|
sub.ui = sub.page.Append(sub, sub._output, [{view: chat.PROJECT}, {view: chat.CONTENT}])
|
||||||
can.core.List(sub.list = list, function(page, index) {
|
can.core.List(sub.list = list, function(page, index) {
|
||||||
can.onimport.item(can, html.ITEM, {name: page[0].innerHTML}, function(event) {
|
can.onimport.item(can, {name: page[0].innerHTML}, function(event) {
|
||||||
can.ondetail.show(sub, index)
|
can.ondetail.show(sub, index)
|
||||||
}, function(event) {}, sub.ui.project)
|
}, function(event) {}, sub.ui.project)
|
||||||
|
|
||||||
|
@ -72,6 +72,11 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, conf, cb, ta
|
|||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
_grow: function(can, msg, _arg) {
|
_grow: function(can, msg, _arg) {
|
||||||
|
sub = can.core.Value(can, chat._OUTPUTS_CURRENT)
|
||||||
|
if (sub && sub.onimport && sub.onimport.grow) {
|
||||||
|
sub.onimport.grow(sub, _arg)
|
||||||
|
return true
|
||||||
|
}
|
||||||
if (can.page.Select(can, can._output, html.DIV_CODE, function(div) {
|
if (can.page.Select(can, can._output, html.DIV_CODE, function(div) {
|
||||||
can.page.style(can, div, html.MAX_HEIGHT, 400)
|
can.page.style(can, div, html.MAX_HEIGHT, 400)
|
||||||
can.page.Append(can, div, [{text: _arg}])
|
can.page.Append(can, div, [{text: _arg}])
|
||||||
@ -144,6 +149,7 @@ Volcanos(chat.ONACTION, {help: "交互操作", list: [
|
|||||||
"清空数据": function(event, can) { can.onmotion.clear(can, can._output) },
|
"清空数据": function(event, can) { can.onmotion.clear(can, can._output) },
|
||||||
"删除工具": function(event, can) { can.page.Remove(can, can._target) },
|
"删除工具": function(event, can) { can.page.Remove(can, can._target) },
|
||||||
"删除配置": function(event, can) { can.runAction(event, "config", ["reset"]) },
|
"删除配置": function(event, can) { can.runAction(event, "config", ["reset"]) },
|
||||||
|
"帮助文档": function(event, can) { can.runAction(event, "help") },
|
||||||
|
|
||||||
"打包页面": function(event, can) { can.onengine.signal(can, "onwebpack", can.request(event)) },
|
"打包页面": function(event, can) { can.onengine.signal(can, "onwebpack", can.request(event)) },
|
||||||
|
|
||||||
|
@ -17,11 +17,11 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
},
|
},
|
||||||
|
|
||||||
zone: function(can, list, target) { var color = [""]
|
zone: function(can, list, target) { var color = [""]
|
||||||
return can.page.Append(can, target, can.core.List(list, function(zone, index) { return zone && {view: html.ZONE+" "+zone.name, list: [
|
return can.page.Append(can, target, can.core.List(list, function(zone, index) { can.base.isString(zone) && (zone = {name: zone}); return zone && {view: html.ZONE+" "+zone.name, list: [
|
||||||
{view: html.NAME, inner: zone.name, style: {background: color[index%color.length]}, onclick: function() {
|
{view: html.NAME, inner: can.user.trans(can, zone.name), style: {background: color[index%color.length]}, onclick: function() {
|
||||||
can.onmotion.toggle(can, zone._action), can.onmotion.toggle(can, zone._target)
|
can.onmotion.toggle(can, zone._action), can.onmotion.toggle(can, zone._target)
|
||||||
}, onmouseenter: function(event) {
|
}, onmouseenter: function(event) {
|
||||||
zone._menu? can.user.carteRight(event, can, zone._menu.meta, zone._menu.list, function(event, button, meta) {
|
zone._menu? can.user.carteRight(event, can, zone._menu.meta, zone._menu.list||can.core.Item(zone._menu.meta), function(event, button, meta) {
|
||||||
(meta[button]||can.onaction[button])(event, can, button)
|
(meta[button]||can.onaction[button])(event, can, button)
|
||||||
}): can.user.carteRight(event, can, {
|
}): can.user.carteRight(event, can, {
|
||||||
"折叠": function() { can.page.Select(can, zone._target, html.DIV_LIST, function(item) { can.onmotion.toggle(can, item, false) }) },
|
"折叠": function() { can.page.Select(can, zone._target, html.DIV_LIST, function(item) { can.onmotion.toggle(can, item, false) }) },
|
||||||
@ -39,6 +39,7 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
can.onmotion.focus(can, event.target)
|
can.onmotion.focus(can, event.target)
|
||||||
}, _init: function(target) { zone._search = target
|
}, _init: function(target) { zone._search = target
|
||||||
can.onmotion.delay(can, function() { can.page.styleWidth(can, target, target.parentNode.parentNode.parentNode.offsetWidth-32) })
|
can.onmotion.delay(can, function() { can.page.styleWidth(can, target, target.parentNode.parentNode.parentNode.offsetWidth-32) })
|
||||||
|
// can.onappend.figure(can, {name: zone.name}, target)
|
||||||
}}], target, {})
|
}}], target, {})
|
||||||
}},
|
}},
|
||||||
{view: html.LIST, _init: function(target) { can.ui[zone.name] = zone
|
{view: html.LIST, _init: function(target) { can.ui[zone.name] = zone
|
||||||
@ -72,13 +73,20 @@ Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg, cb, tar
|
|||||||
}}, {view: html.LIST}]); can.onimport.list(can, item, cb, ui.list)
|
}}, {view: html.LIST}]); can.onimport.list(can, item, cb, ui.list)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
item: function(can, type, item, cb, cbs, target) { target = target||can._output
|
item: function(can, item, cb, cbs, target) { target = target||can._output
|
||||||
var ui = can.page.Append(can, target, [{view: [type, html.DIV, item.nick||item.name],
|
var ui = can.page.Append(can, target, [{view: [html.ITEM, html.DIV, item.nick||item.name],
|
||||||
onclick: function(event) { cb(event, ui.first)
|
onclick: function(event) { cb(event, ui.first, event.target._list && can.onmotion.toggle(can, event.target._list))
|
||||||
can.onmotion.select(can, target, can.core.Keys(html.DIV, type), ui.first)
|
can.onmotion.select(can, target, can.core.Keys(html.DIV, html.ITEM), ui.first)
|
||||||
}, onmouseenter: function(event) { cbs(event, ui.first) },
|
}, onmouseenter: function(event) { cbs(event, ui.first) },
|
||||||
}]); return ui.first
|
}]); return ui.first
|
||||||
},
|
},
|
||||||
|
itemlist: function(can, list, cb, cbs, target) {
|
||||||
|
return target._list = can.page.insertBefore(can, [{view: html.LIST, list: can.core.List(list, function(item) {
|
||||||
|
return {view: [html.ITEM, html.DIV, item.name], onclick: function(event) {
|
||||||
|
cb(event, item, event.target._list && can.onmotion.toggle(can, event.target._list))
|
||||||
|
}, onmouseenter: function(event) { cbs(event, item) }}
|
||||||
|
}) }], target.nextSibling, target.parentNode)
|
||||||
|
},
|
||||||
tabs: function(can, list, cb, cbs, action, each) { action = action||can._action
|
tabs: function(can, list, cb, cbs, action, each) { action = action||can._action
|
||||||
return can.page.Append(can, action, can.core.List(list, function(tabs) {
|
return can.page.Append(can, action, can.core.List(list, function(tabs) {
|
||||||
return {text: [tabs.name, html.DIV, html.TABS], title: tabs.text, onclick: function(event) {
|
return {text: [tabs.name, html.DIV, html.TABS], title: tabs.text, onclick: function(event) {
|
||||||
|
4
proto.js
4
proto.js
@ -104,6 +104,7 @@ var aaa = {
|
|||||||
PASSWORD: "password", USERNAME: "username", USERNICK: "usernick", BACKGROUND: "background", AVATAR: "avatar",
|
PASSWORD: "password", USERNAME: "username", USERNICK: "usernick", BACKGROUND: "background", AVATAR: "avatar",
|
||||||
LANGUAGE: "language", ENGLISH: "english", CHINESE: "chinese",
|
LANGUAGE: "language", ENGLISH: "english", CHINESE: "chinese",
|
||||||
LOGIN: "login", LOGOUT: "logout", INVITE: "invite",
|
LOGIN: "login", LOGOUT: "logout", INVITE: "invite",
|
||||||
|
TOKEN: "token",
|
||||||
}
|
}
|
||||||
var web = {
|
var web = {
|
||||||
SPACE: "space", DREAM: "dream", SHARE: "share",
|
SPACE: "space", DREAM: "dream", SHARE: "share",
|
||||||
@ -151,6 +152,7 @@ var chat = {
|
|||||||
AGENT: "agent", CHECK: "check", GRANT: "grant",
|
AGENT: "agent", CHECK: "check", GRANT: "grant",
|
||||||
STATE: "state", MENUS: "menus", TRANS: "trans",
|
STATE: "state", MENUS: "menus", TRANS: "trans",
|
||||||
SSO: "sso", WEBSITE: "website",
|
SSO: "sso", WEBSITE: "website",
|
||||||
|
LOCATION: "location",
|
||||||
|
|
||||||
libs: ["/lib/base.js", "/lib/core.js", "/lib/misc.js", "/lib/page.js", "/lib/user.js"],
|
libs: ["/lib/base.js", "/lib/core.js", "/lib/misc.js", "/lib/page.js", "/lib/user.js"],
|
||||||
panel_list: [
|
panel_list: [
|
||||||
@ -278,7 +280,7 @@ var lang = {
|
|||||||
|
|
||||||
function shy(help, meta, list, cb) { var index = 0, args = arguments
|
function shy(help, meta, list, cb) { var index = 0, args = arguments
|
||||||
function next(type) { if (index < args.length && (!type || type == typeof args[index])) { return args[index++] } }
|
function next(type) { if (index < args.length && (!type || type == typeof args[index])) { return args[index++] } }
|
||||||
return cb = args[args.length-1]||function() {}, cb.help = next(lang.STRING)||"", cb.meta = next(lang.OBJECT)||{}, cb.list = next(lang.OBJECT)||[], cb
|
return cb = typeof args[args.length-1] == lang.FUNCTION?args[args.length-1]:function() {}, cb.help = next(lang.STRING)||"", cb.meta = next(lang.OBJECT)||{}, cb.list = next(lang.OBJECT)||[], cb
|
||||||
}; var _can_name = "", _can_path = ""
|
}; var _can_name = "", _can_path = ""
|
||||||
var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", pack: {}, cache: {}}, function(name, can, libs, cb) {
|
var Volcanos = shy("火山架", {iceberg: "/chat/", volcano: "/frame.js", pack: {}, cache: {}}, function(name, can, libs, cb) {
|
||||||
var meta = arguments.callee.meta, list = arguments.callee.list
|
var meta = arguments.callee.meta, list = arguments.callee.list
|
||||||
|
Loading…
x
Reference in New Issue
Block a user