mirror of
				https://github.com/mashirozx/sakura.git
				synced 2025-05-29 01:49:21 +08:00 
			
		
		
		
	update the support of footer countdown
This commit is contained in:
		
							parent
							
								
									f7d23d4ad8
								
							
						
					
					
						commit
						26cdac7be3
					
				
							
								
								
									
										43
									
								
								footer.php
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								footer.php
									
									
									
									
									
								
							@ -149,6 +149,49 @@
 | 
			
		||||
    data-theme="orange">
 | 
			
		||||
</div>
 | 
			
		||||
<style>.skin-menu{left:auto;right:10px;}.changeSkin-gear{left:auto;right:5px;}</style>
 | 
			
		||||
<script>
 | 
			
		||||
    function secondToDate(second) {
 | 
			
		||||
        if (!second) {
 | 
			
		||||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
        var time = new Array(0, 0, 0, 0, 0);
 | 
			
		||||
        if (second >= 365 * 24 * 3600) {
 | 
			
		||||
            time[0] = parseInt(second / (365 * 24 * 3600));
 | 
			
		||||
            second %= 365 * 24 * 3600;
 | 
			
		||||
        }
 | 
			
		||||
        if (second >= 24 * 3600) {
 | 
			
		||||
            time[1] = parseInt(second / (24 * 3600));
 | 
			
		||||
            second %= 24 * 3600;
 | 
			
		||||
        }
 | 
			
		||||
        if (second >= 3600) {
 | 
			
		||||
            time[2] = parseInt(second / 3600);
 | 
			
		||||
            second %= 3600;
 | 
			
		||||
        }
 | 
			
		||||
        if (second >= 60) {
 | 
			
		||||
            time[3] = parseInt(second / 60);
 | 
			
		||||
            second %= 60;
 | 
			
		||||
        }
 | 
			
		||||
        if (second > 0) {
 | 
			
		||||
            time[4] = second;
 | 
			
		||||
        }
 | 
			
		||||
        return time;
 | 
			
		||||
    }
 | 
			
		||||
</script>
 | 
			
		||||
<script type="text/javascript" language="javascript">
 | 
			
		||||
    function setTime() {
 | 
			
		||||
        // 博客创建时间秒数,时间格式中,月比较特殊,是从0开始的,所以想要显示5月,得写4才行,如下
 | 
			
		||||
        var create_time = Math.round(new Date(Date.UTC(2018, 6, 03, 14, 30, 0))
 | 
			
		||||
                .getTime() / 1000);
 | 
			
		||||
        // 当前时间秒数,增加时区的差异
 | 
			
		||||
        var timestamp = Math.round((new Date().getTime() + 8 * 60 * 60 * 1000) / 1000);
 | 
			
		||||
        currentTime = secondToDate((timestamp - create_time));
 | 
			
		||||
        currentTimeHtml = currentTime[0] + '年' + currentTime[1] + '天'
 | 
			
		||||
                + currentTime[2] + '时' + currentTime[3] + '分' + currentTime[4]
 | 
			
		||||
                + '秒';
 | 
			
		||||
        document.getElementById("htmer_time").innerHTML = currentTimeHtml;
 | 
			
		||||
    }
 | 
			
		||||
    setInterval(setTime, 1000);
 | 
			
		||||
</script>
 | 
			
		||||
<?php endif; ?>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user