1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 08:48:06 +08:00

opt plugin

This commit is contained in:
shylinux 2020-04-14 09:35:34 +08:00
parent 46e38158a6
commit 62d4e73cc9
23 changed files with 7 additions and 307 deletions

View File

@ -275,9 +275,9 @@ var can = Volcanos("chat", {
run: function(event, cmd, cb, silent) {var msg = can.Event(event);
msg.Option("_action", item.name);
cb = typeof input[item.cb] == "function" && input[item.cb]
var cbs = typeof input[item.cb] == "function" && input[item.cb]
|| typeof can[item.cb] == "function" && can[item.cb] || can.Check
cb(event, event.target, cb);
cbs(event, event.target, cb);
},
}, Config.libs.concat(["plugin/"+type, "plugin/input/"+(item.figure||"")]), function(input) {
var target = input.onimport.init(input, item, name, value, option);

View File

@ -9,8 +9,8 @@
<link rel="stylesheet" type="text/css" href="/static/volcanos/style.css">
</head>
<body>
<script src="/static/volcanos/page/index.js"></script>
<script src="/static/volcanos/proto.js"></script>
<script src="/static/volcanos/index.js"></script>
<script src="/static/volcanos/frame.js"></script>
</body>

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -8,8 +8,8 @@
<link rel="stylesheet" type="text/css" href="/static/volcanos/style.css">
</head>
<body>
<script src="/static/volcanos/page/share.js"></script>
<script src="/static/volcanos/proto.js"></script>
<script src="/static/volcanos/share.js"></script>
<script src="/static/volcanos/frame.js"></script>
</body>

View File

@ -126,7 +126,7 @@ Volcanos("onimport", {help: "导入数据", list: [],
call(prefix.concat(list.list))
return can.keys = [], can.Status(event, can.keys, "keys")
},
}, ["/plugin/wiki/draw.css"])
}, ["/plugin/local/wiki/draw.css"])
Volcanos("onfigure", {help: "图形绘制", list: [],
_spawn: function(sup, can) {can.sup = sup},
_swell: function(can, sub) {
@ -483,7 +483,7 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
return value.tagName + ": (" + value.points.baseVal.value + ")"
},
},
}, Config.libs.concat(["/plugin/wiki/draw/heart"]))
}, Config.libs.concat(["/plugin/local/wiki/draw/heart"]))
Volcanos("onaction", {help: "组件菜单", list: ["保存", "清空", "删除", "添加",
["group", "svg"],
["font-size", 12, 16, 18, 24, 32],

View File

@ -34,7 +34,7 @@ Volcanos("onimport", {help: "导入数据", list: [],
})
return typeof cb == "function" && cb(msg)
},
}, ["/plugin/wiki/word.css"])
}, ["/plugin/local/wiki/word.css"])
Volcanos("onfigure", {help: "图形绘制", list: [],
_spawn: function(sup, can) {can.sup = sup},
_swell: function(can, sub) {},

View File

@ -1,32 +0,0 @@
Volcanos("onimport", {help: "导入数据", list: [],
init: function(can, msg, cb, output, option) {output.innerHTML = msg.Result();
can.page.Append(can, output, [{type: "img", src: "data:image/jpg;base64,"+msg.image[0], onclick: function(event) {
var p = can.page.Append(can, output, [{view: ["what", "div"], dataset: {meta: ""+(event.offsetX+1)+","+(event.offsetY-30+1)+""}, style: {
background: "red", position: "absolute", width: "10px", height: "10px",
left: event.offsetX+1+"px", top: event.offsetY+30+1+"px",
}, onclick: function(event) {
p.parentNode.removeChild(p)
}}]).what
}}])
},
})
Volcanos("onaction", {help: "组件交互", list: [],
})
Volcanos("onchoice", {help: "组件菜单", list: ["提交"],
"提交": function(event, can, msg, key, target) {
can.run(event, ["check", can.page.Select(can, can.target, "div.what", function(item) {return item.dataset.meta}).join(",")], function(msg) {
can.user.toast(msg.result_message[0])
}, true)
},
})
Volcanos("ondetail", {help: "组件详情", list: ["选择", "修改", "复制"],
"选择": "select",
"删除": "delete",
"复制": function(event, can, msg, cmd, target) {
can.user.toast(can.page.CopyText(can, svg.innerHTML), "复制成功")
},
})
Volcanos("onexport", {help: "导出数据", list: []})

View File

@ -1,4 +0,0 @@
Volcanos("onimport", {help: "you",
init: function(event, can, value, cmd, target) {var data = target.dataset
},
})

View File

@ -1,133 +0,0 @@
Volcanos("onimport", {help: "导入数据", list: [],
init: function(can, msg, cb, output, action, option) {output.innerHTML = "";
// can.page.Append(can, action, [{type: "script", src: "https://cdn.bootcss.com/echarts/4.2.0-rc.2/echarts.js"}]);
can.page.Append(can, output, [{include: ["/plugin/github.com/shylinux/echarts/echarts.js", function(event) {
can.page.Append(can, output, [{include: ["/plugin/github.com/shylinux/echarts/china.js", function(event) {
var china_chart = echarts.init(can.page.Append(can, output, [{type: "div", style: {width: "600px", height: "400px"}}]).last);
var data = msg.Table()
var yData = [];
var barData = [];
for (var i = 0; i < (data.length>10? 10: data.length); i++) {
yData.push(i + data[i].name);
barData.push(data[i]);
}
var option = {
title: [{
text: msg.Option("title"),
show: true, right: 250, top: 10,
textStyle: {color: '#2D3E53', fontSize: 18},
}],
tooltip: {
show: true, formatter: function(params) {
return params.name + "<br/>"
+ ' 确认病例:' + params.data['confirm'] + '人<br/>'
+ ' 死亡病例:' + params.data['dead'] + '人<br/>'
},
},
visualMap: {
type: 'continuous',
orient: 'horizontal',
itemWidth: 10,
itemHeight: 80,
text: ['高', '低'],
showLabel: true,
seriesIndex: [0],
min: 0,
max: data[1].value,
inRange: {
color: ['#6FCF6A', '#FFFD64', '#FF5000']
},
textStyle: {
color: '#7B93A7'
},
bottom: 30,
left: 'left',
},
grid: {right: 10, top: 135, bottom: 100, width: '20%'},
xAxis: {show: false},
yAxis: {
type: 'category',
inverse: true,
nameGap: 16,
axisLine: {show: false, lineStyle: {color: '#ddd'}},
axisTick: {show: false, lineStyle: {color: '#ddd'}},
axisLabel: {
margin: 0,
interval: 0,
textStyle: {color: '#455A74', align: 'left', fontSize: 14},
rich: {
a: {
color: '#fff',
backgroundColor: '#FAAA39',
width: 20,
height: 20,
align: 'center',
borderRadius: 2
},
b: {
color: '#fff',
backgroundColor: '#4197FD',
width: 20,
height: 20,
align: 'center',
borderRadius: 2
}
},
formatter: function(params) {
if (parseInt(params.slice(0, 1)) < 3) {
return [
'{a|' + (parseInt(params.slice(0, 1)) + 1) + '}' + ' ' + params.slice(1)
].join('\n')
} else {
return [
'{b|' + (parseInt(params.slice(0, 1)) + 1) + '}' + ' ' + params.slice(1)
].join('\n')
}
}
},
data: yData
},
geo: {
map: 'china', left: 'left', right: '100',
label: {emphasis: {show: false}},
itemStyle: {emphasis: {areaColor: '#fff464'}},
},
series: [{
roam: false, type: 'map', name: 'mapSer',
geoIndex: 0, label: {show: false},
data: data
}, {
roam: false, type: 'bar', name: 'barSer',
visualMap: false, barGap: 0, barMaxWidth: 8,
zlevel: 100, itemStyle: {
normal: {
color: function(params) {
// build a color map as your need.
var colorList = [{colorStops: [
{offset: 0, color: '#FFD119'}, // 0% 处的颜色
{offset: 1, color: '#FFAC4C'}, // 100% 处的颜色
]}, {colorStops: [
{offset: 0, color: '#00C0FA'}, // 0% 处的颜色
{offset: 1, color: '#2F95FA'}, // 100% 处的颜色
]}];
return params.dataIndex < 3? colorList[0]: colorList[1]
},
barBorderRadius: 15
}
},
data: barData
}]
};
china_chart.setOption(option);
}]}]);
}]}]);
},
})
Volcanos("onaction", {help: "组件交互", list: []})
Volcanos("onchoice", {help: "组件菜单", list: []})
Volcanos("ondetail", {help: "组件详情", list: []})
Volcanos("onexport", {help: "导出数据", list: []})

View File

@ -1,12 +0,0 @@
Volcanos("onimport", {help: "导入数据", list: [],
init: function(can, msg, cb, output, action, option) {
can.page.Appends(can, output, [{img: [window.URL.createObjectURL(new Blob(msg.result, {type: "image/png"}))]}])
},
})
Volcanos("onaction", {help: "组件交互", list: []})
Volcanos("onchoice", {help: "组件菜单", list: []})
Volcanos("ondetail", {help: "组件详情", list: []})
Volcanos("onexport", {help: "导出数据", list: []})

View File

@ -1,102 +0,0 @@
Volcanos("onimport", {help: "导入数据", list: [],
init: function(can, msg, cb, output, action, option) {output.innerHTML = msg.Result();
can.page.Select(can, output, "table", function(table) {can.page.OrderTable(can, table)})
can.page.Select(can, output, ".story", function(story) {var data = story.dataset||{};
story.oncontextmenu = function(event) {var detail = can.feature.detail || can.ondetail.list;
switch (data.type) {
case "shell":
detail = ["运行"]
}
can.user.carte(event, shy("", can.ondetail, detail, function(event, cmd, meta) {var cb = meta[cmd];
typeof cb == "function"? cb(event, can, msg, cmd, story):
can.run(event, ["story", typeof cb == "string"? cb: cmd, data.type, data.name, data.text], function(msg) {
var timer = msg.Result()? can.user.toast(msg.Result()): can.user.toast({
duration: -1, text: cmd, width: 800, height: 400,
list: [{type: "table", list: [{row: msg.append, sub: "th"}].concat(msg.Table(function(line, index) {
return {row: can.core.List(msg.append, function(key) {return msg[key][index]})}
}))}, {button: ["关闭", function(event) {timer.stop = true}]}],
})
}, true)
}))
}
})
can.page.Select(can, output, "div.stack", function(stack) {var data = stack.dataset||{};
function fold(stack) {
stack.nextSibling && (stack.nextSibling.style.display = "none")
can.page.Select(can, stack, "span.state", function(state) {
if (state.innerText == "o") {return}
can.page.ClassList.add(can, stack, "fold")
can.page.ClassList.del(can, stack, "span")
state.innerText = ">"
})
}
function span(stack) {
stack.nextSibling && (stack.nextSibling.style.display = "")
can.page.Select(can, stack, "span.state", function(state) {
if (state.innerText == "o") {return}
can.page.ClassList.add(can, stack, "span")
can.page.ClassList.del(can, stack, "fold")
state.innerText = "v"
})
}
function mark(stack, color) {
stack.style.background = color;
stack.style.color = color == ""? "": "white";
}
stack.oncontextmenu = function(event) {var detail = can.feature.detail || can.ondetail.list, target = event.target;
can.user.carte(event, shy("", can.ondetail, ["全部折叠", "全部展开", "标记颜色", "清除颜色", "red", "green", "blue"], function(event, cmd, meta) {var cb = meta[cmd];
switch (cmd) {
case "red":
case "green":
case "blue":
mark(target, cmd)
break
case "标记颜色":
can.user.prompt("请输入颜色:", function(color) {
mark(target, color)
})
break
case "清除颜色":
mark(target, "")
break
case "全部折叠":
fold(stack), can.page.Select(can, stack.nextSibling, "div.stack", fold)
break
case "全部展开":
span(stack), can.page.Select(can, stack.nextSibling, "div.stack", span)
break
}
}))
}
stack.onclick = function(event) {stack.nextSibling && (stack.nextSibling.style.display == "none"? span(stack): fold(stack))}
})
},
favor: function(event, can, msg, cmd, output) {var key = msg.detail[0];
var cb = can.onaction[key]; if (typeof cb == "function") {cb(event, can, msg, cmd, output); return msg.Echo(can._name, " onaction ", key), msg._hand = true}
var cb = can.onchoice[key]; if (typeof cb == "function") {cb(event, can, msg, cmd, output); return msg.Echo(can._name, " onchoice ", key), msg._hand = true}
},
})
Volcanos("onaction", {help: "组件交互", list: []})
Volcanos("onchoice", {help: "组件菜单", list: ["返回", "清空", "复制", "下载", "表格", "绘图", "媒体"],
"返回": function(event, can, msg, key, target) {
can.run(event, ["", "Last"])
},
"清空": function(event, can, msg, key, target) {
can.target.innerHTML = "";
},
"复制": function(event, can, msg, key, target) {
var list = can.onexport.Format(can, msg, "data");
can.user.toast(can.page.CopyText(can, list[2]), "复制成功")
},
"下载": function(event, can, msg, key, target) {
var list = can.onexport.Format(can, msg, msg._plugin_name||"data");
can.page.Download(can, list[0]+list[1], list[2]);
},
})
Volcanos("ondetail", {help: "组件详情", list: []})
Volcanos("onexport", {help: "导出数据", list: []})

View File

@ -1,17 +0,0 @@
Volcanos("onimport", {help: "导入数据", list: [],
_init: function(can, output, action, option, field) {
output.innerHTML = msg.Result();
},
init: function(can, msg, cb, output, action, option) {output.innerHTML = msg.Result();
},
favor: function(event, can, msg, cmd, output) {var key = msg.detail[0];
var cb = can.onaction[key]; if (typeof cb == "function") {cb(event, can, msg, cmd, output); return msg.Echo(can._name, " onaction ", key), msg._hand = true}
var cb = can.onchoice[key]; if (typeof cb == "function") {cb(event, can, msg, cmd, output); return msg.Echo(can._name, " onchoice ", key), msg._hand = true}
},
})
Volcanos("onaction", {help: "组件交互", list: []})
Volcanos("onchoice", {help: "组件菜单", list: []})
Volcanos("ondetail", {help: "组件详情", list: []})
Volcanos("onexport", {help: "导出数据", list: []})