mirror of
https://shylinux.com/x/community
synced 2025-07-01 21:21:19 +08:00
46 lines
2.0 KiB
JavaScript
46 lines
2.0 KiB
JavaScript
Volcanos(chat.ONIMPORT, {
|
|
_init: function(can, msg) {
|
|
can.page.Append(can, can._output, msg.Table(function(value) {
|
|
if (value.type == "title") {
|
|
return {view: [[html.ITEM, html.TITLE], "", can.user.trans(can, value.name, value.help)]}
|
|
}
|
|
return {view: [[html.ITEM, value.type, value.name]], list: [{text: [value.help||can.user.trans(can, value.name, null, "value.setting"), "", mdb.NAME]}, can.onimport[value.type](can, value)]}
|
|
}))
|
|
if (!can.misc.isDebug(can)) { return }
|
|
can.user.isTechOrRoot(can) && can.onimport._plugin(can, {index: "can.cookie"})
|
|
localStorage.length && can.onimport._plugin(can, {index: "can.localStorage"})
|
|
sessionStorage.length && can.onimport._plugin(can, {index: "can.sessionStorage"})
|
|
// can.onimport._plugin(can, {index: "can.runtime"})
|
|
},
|
|
_plugin: function(can, value) { value.width = can.ConfWidth()-20
|
|
can.onappend.plugin(can, value, function(sub) {
|
|
sub.onexport.output = function() {
|
|
if (!sub._output.innerHTML) { can.onmotion.hidden(can, sub._target) }
|
|
}
|
|
})
|
|
},
|
|
title: function(can, value) {
|
|
return {text: [value.name, "", value.type]}
|
|
},
|
|
radio: function(can, value) {
|
|
return {text: ["", "", ["outer", value.value]], list: [{text: ["", "", "inner"]}], onclick: function(event) {
|
|
if (value.value == "on") { value.value = "off" } else { value.value = "on" }
|
|
can.runAction(can.request(event, value, can.Option(), {_toast: value.name}), mdb.UPDATE, [])
|
|
}}
|
|
},
|
|
input: function(can, value) {
|
|
return {type: "input", data: {type: "text", value: value.value}, onkeyup: function(event) {
|
|
if (event.key == code.ENTER) {
|
|
can.runAction(can.request(event, {value: event.target.value}, value, can.Option(), {_toast: value.name}), mdb.UPDATE, [])
|
|
}
|
|
}}
|
|
},
|
|
story: function(can, value) {
|
|
return {text: ["", "i", "bi bi-chevron-double-right"], _init: function(target) {
|
|
target.parentNode.onclick = function() {
|
|
var list = can.core.Split(value.value)
|
|
can.onimport.myStory(can, {index: list[0], args: list.slice(1)})
|
|
}
|
|
}}
|
|
},
|
|
}) |