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

add love.days

This commit is contained in:
shaoying 2019-09-27 16:50:13 +08:00
parent 6d5d739778
commit 4a58e09fce
5 changed files with 77 additions and 3 deletions

View File

@ -4,5 +4,5 @@ var version = struct {
host string
self int
}{
"2019-09-27 08:55:10", "mac", 670,
"2019-09-27 10:34:50", "centos", 607,
}

View File

@ -2,3 +2,22 @@
fieldset.item.love.date table td.today {
border:solid 2px red;
}
fieldset.item.love.days div.day {
margin:8px;
border:solid 2px cyan;
padding:8px;
opacity:0;
float:left;
}
fieldset.item.love.days span.what {
font-size:24px;
}
fieldset.item.love.days span.day0 {
font-size:32px;
color:red;
}
fieldset.item.love.days span.day1 {
font-size:32px;
color:green;
}

View File

@ -15,4 +15,45 @@
play: function(event) {
kit.AppendChilds(output, [{type: "video", data: {src: option.url.value, autoplay: ""}}])
},
Quick: function(event) {
var msg = field.Plugin.msg
var now = new Date()
function show(t, cb, cbs) {
kit.List(ctx.Table(msg).concat([{when: "9999-01-08", what: "最后一次爱你"}]), function(line, index, array) {
var day = new Date(line.when)
var mis = parseInt((day.getTime() - now.getTime()) / 1000 / 3600 / 24)
if (index == array.length-1) {
mis = 999999
}
var list = []
list.span = function(value, style) {
for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] == "string") {
list.push(arguments[i])
} else {
list.push('<span class="'+arguments[i][1]+'">', arguments[i][0], "</span>")
}
}
list.push("<br/>")
return list
}
list.span(["距", "day"], line.when.split(" ")[0]).span([line.what, "what"])
list.span(mis>0? "还有": "过去", [mis, mis>0? "day1": "day0"], "天")
var elm = cb(output, [{text: [list.join(""), "div", "day"]}]).last
kit.List([0.2, 0.4, 0.6, 0.8, 1.0], function(value) {
elm.style.opacity = value
}, 150)
}, t, cbs)
}
show(3000, function(output, list) {
return kit.AppendChilds(output, list)
}, function() {
show(1000, function(output, list) {
return kit.AppendChild(output, list)
})
})
},
}}}

View File

@ -22,6 +22,20 @@ kit date "日历" "index.js" "index.css" protected "cli.date" _ nature _ \
button "查看" action auto \
button "显示" cb show
fun days "每一天" "index.js" "index.css" protected \
text "days" name table imports plugin_table \
text "" name when init date\
text "" name what view long \
button "记下了" \
button "记下了" cb Quick
if $2 == "" || $3 == ""
copy skip ssh.data show _
else
copy ssh.data insert _ when _ what __
end
end
fun delay "以后告诉你" protected \
text "delay" name table imports plugin_table \
text "" name when init date\

View File

@ -621,7 +621,7 @@ kit = toolkit = {__proto__: document,
if (interval) {
function loop(i) {
if (i >= obj.length) {typeof cbs == "function" && cbs(); return}
typeof cb == "function" && cb(obj[i], i)
typeof cb == "function" && cb(obj[i], i, obj)
setTimeout(function() {loop(i+1)}, interval)
}
obj.length > 0 && setTimeout(function() {loop(0)}, interval)
@ -629,7 +629,7 @@ kit = toolkit = {__proto__: document,
}
var list = []
for (var i = 0; i < obj.length; i++) {
list.push(typeof cb == "function"? cb(obj[i], i): obj[i])
list.push(typeof cb == "function"? cb(obj[i], i, obj): obj[i])
}
return list
},