npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

countdown22222

v1.0.3

Published

倒计时-countdown

Downloads

3

Readme

#倒计时(解决运行时间长后时间不同步问题) update

  • format支持Function格式,返回时间对象,this指向对应倒计时DOM

注意

使用

html结构

<div class="countdown" data-startDate="11/8/2015 16:21:00" data-endDate="11/9/2015 18:50:10"></div>

js调用(依赖jquery或zepto)

$(".countdown").countdown({
    rootTime:timeStamp,
	// d:h:m:s(默认)、h:m:s、m:s
    timeFormat:"h:m:s",
    willbe:{
        //format:'<span>距离开始时间还有:</span><span>{day}</span> 天 <span>{hour}</span> 时 <span>{min}</span> 分 <span>{sec}</span> 秒',
		//or
		format:function(time){
			if(time.hour>5){
                        
            }else{
                
            }
            
            $(this).html('<span>距离开始时间还有:</span><span>'+time.day+'</span> 天 <span>'+time.hour+'</span> 时 <span>'+time.min+'</span> 分 <span>'+time.sec+'</span> 秒');
		},

        callback:function(){}
    },
    start:{
        format:'',
        callback:function(){}
    },
    end:{
        format:'',
        callback:function(){}
    }
})

参数设置

  • rootTime {String||Number} 项目服务器的时间戳(ms)
  • timeFormat {String} 时间格式,三种:d:h:m:s(默认)、h:m:s、m:s
  • willbe{Object} 即将开始
  • start {Object}开始
  • end {Object} 结束
  • format {String||Function} 显示格式
  • callback {Function} 回调函数

获取服务器时间接口要求

  • 注意,每台服务器时间不同,需换成项目所部署服务器的接口
  • 支持callback形式,方便jsonp跨域请求
  • 返回时间的毫秒数

参考:http://zzsvn.pcauto.com.cn/svn/other/doc/common/countdown/getTime.php?callback=fn

点击查看demo