diff --git a/src/contexts/cli/version.go b/src/contexts/cli/version.go index 82cf1ba9..7562d509 100644 --- a/src/contexts/cli/version.go +++ b/src/contexts/cli/version.go @@ -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, } diff --git a/src/plugin/love/index.css b/src/plugin/love/index.css index 7d94b715..74ab4a25 100644 --- a/src/plugin/love/index.css +++ b/src/plugin/love/index.css @@ -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; +} diff --git a/src/plugin/love/index.js b/src/plugin/love/index.js index af150342..4885559d 100644 --- a/src/plugin/love/index.js +++ b/src/plugin/love/index.js @@ -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('', arguments[i][0], "") + } + } + list.push("
") + 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) + }) + }) + }, }}} diff --git a/src/plugin/love/index.shy b/src/plugin/love/index.shy index e481542a..45055648 100644 --- a/src/plugin/love/index.shy +++ b/src/plugin/love/index.shy @@ -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\ diff --git a/usr/librarys/toolkit.js b/usr/librarys/toolkit.js index a9b66181..5781b0c4 100644 --- a/usr/librarys/toolkit.js +++ b/usr/librarys/toolkit.js @@ -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 },