From 7eb6f9ccab3b7b1695c38dd3b4e101579655450e Mon Sep 17 00:00:00 2001 From: Leon Xu <6479451-leonxu260@users.noreply.gitlab.com> Date: Sat, 17 Jul 2021 21:18:12 -0700 Subject: [PATCH] doc: add functions to runtime.js --- themes/butterfly/source/js/runtime.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/themes/butterfly/source/js/runtime.js b/themes/butterfly/source/js/runtime.js index e69de29..5ef2821 100644 --- a/themes/butterfly/source/js/runtime.js +++ b/themes/butterfly/source/js/runtime.js @@ -0,0 +1,19 @@ +$(function(){ + var NY = Math.round((new Date('7/02/2021 00:00:00')).getTime()/1000); //Date修改为你的建站时间。 + $('#runtime').flipcountdown({ + size:"xs",//可以自定义翻页计时器大小。从大到小依次是lg、md、sm、xs。 + tick:function(){ + var nol = function(h){ + return h>9?h:'0'+h; + } + var range = Math.abs(Math.round((new Date()).getTime()/1000)-NY), + secday = 86400, sechour = 3600, + days = parseInt(range/secday), + hours = parseInt((range%secday)/sechour), + min = parseInt(((range%secday)%sechour)/60), + sec = ((range%secday)%sechour)%60; + return nol(days)+' '+nol(hours)+' '+nol(min)+' '+nol(sec); + } + }); + }); + \ No newline at end of file