├── .gitignore ├── Gruntfile.js ├── README.md ├── css ├── font │ ├── iconfont.svg │ ├── iconfont.ttf │ └── iconfont.woff ├── jdate.css └── reset.css ├── dist ├── font │ ├── iconfont.svg │ ├── iconfont.ttf │ └── iconfont.woff ├── zepto.jdate-min.css └── zepto.jdate-min.js ├── index.html ├── js ├── jdate.js ├── swipe.js └── zepto-min.js ├── package.json └── readme.png /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.initConfig({ 4 | pkg: grunt.file.readJSON('package.json'), 5 | //Js min task 6 | uglify: { 7 | 'dist/zepto.jdate-min.js':['js/swipe.js','js/jdate.js'] 8 | }, 9 | //Css min task 10 | cssmin: { 11 | 'dist/zepto.jdate-min.css':['css/reset.css','css/jdate.css'] 12 | }, 13 | //Copy fonts task 14 | copy:{ 15 | file:{ 16 | expand: true, 17 | cwd:'css/font/', 18 | src: ['*.*'], 19 | dest: 'dist/font', 20 | filter: 'isFile' 21 | } 22 | }, 23 | //watch 24 | watch: { 25 | watchFiles: { 26 | files: ['*.html','css/*.css', '!**/*-min.css','js/*.js', '!**/*-min.js'] 27 | }, 28 | options: { 29 | livereload: 8080 30 | }, 31 | configFiles: { 32 | files: ['Gruntfile.js'], 33 | options: { 34 | reload: true 35 | } 36 | } 37 | } 38 | }); 39 | 40 | // load npm tasks 41 | grunt.loadNpmTasks('grunt-contrib-uglify'); 42 | grunt.loadNpmTasks('grunt-contrib-cssmin'); 43 | grunt.loadNpmTasks('grunt-contrib-watch'); 44 | grunt.loadNpmTasks('grunt-contrib-copy'); 45 | 46 | // resgister tasks 47 | grunt.registerTask('wh', ['watch']); 48 | grunt.registerTask('build', ['uglify','cssmin','copy']); 49 | 50 | }; 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jDate 2 | ==== 3 | 4 | 基于zepto开发的一款专注于移动设备的日期选择控件(For pad/phone) 5 | 6 | 7 | 8 | 点击查看Demo 9 | 10 | ###使用方法 11 | 12 | ```js 13 | $(".test").jdate(); 14 | ``` -------------------------------------------------------------------------------- /css/font/iconfont.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Created by FontForge 20120731 at Wed May 14 14:20:35 2014 6 | By Ads 7 | 8 | 9 | 10 | 24 | 26 | 28 | 30 | 32 | 36 | 38 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /css/font/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iancj/jDate/96b7de55e19bc2d8f986ce12a667db66a3bd2f56/css/font/iconfont.ttf -------------------------------------------------------------------------------- /css/font/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iancj/jDate/96b7de55e19bc2d8f986ce12a667db66a3bd2f56/css/font/iconfont.woff -------------------------------------------------------------------------------- /css/jdate.css: -------------------------------------------------------------------------------- 1 | /*swipe base start*/ 2 | .swipe { 3 | overflow: hidden; 4 | visibility: hidden; 5 | position: relative; 6 | } 7 | .swipe-wrap { 8 | overflow: hidden; 9 | position: relative; 10 | } 11 | .swipe-wrap > li { 12 | float:left; 13 | width:100%; 14 | position: relative; 15 | } 16 | /*swipe base end*/ 17 | #slider{ 18 | height:200px; 19 | } 20 | .swipe-wrap { 21 | height:100%; 22 | } 23 | .swipe-wrap > li{ 24 | text-align: center; 25 | height:100%; 26 | } 27 | /*jdate*/ 28 | #jdate{ 29 | position:fixed; 30 | top:0; 31 | left:0; 32 | width:100%; 33 | font-size:16px; 34 | background:#f8f8f8; 35 | z-index:99999; 36 | } 37 | #jdate-header{ 38 | position:relative; 39 | background:#F4F4F4; 40 | line-height:45px; 41 | text-align: center; 42 | border-bottom:1px solid #E8E8E8; 43 | } 44 | .jdate-week{ 45 | padding:7px 0; 46 | font-size:14px; 47 | } 48 | .jdate-table .row{ 49 | line-height:32px; 50 | } 51 | 52 | .table{ 53 | width:100%; 54 | display:table; 55 | } 56 | .row{ 57 | display:table-row; 58 | } 59 | .col{ 60 | display: table-cell; 61 | text-align:center; 62 | color:#a5a5a5; 63 | width:14.28571%; 64 | } 65 | .col-today{ 66 | color:#ffaa00; 67 | } 68 | .selected{ 69 | color:#fff; 70 | background:#53B8C0; 71 | } 72 | 73 | @font-face { 74 | font-family: 'iconfont'; 75 | src: url('font/iconfont.woff') format('woff'), /* chrome、firefox */ 76 | url('font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ 77 | url('font/iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */ 78 | } 79 | 80 | .icon{ 81 | font-family:"iconfont" !important; 82 | font-size:16px; 83 | font-style:normal; 84 | -webkit-font-smoothing: antialiased; 85 | -webkit-text-stroke-width: 0.2px; 86 | -moz-osx-font-smoothing: grayscale; 87 | } 88 | .ftsize20{font-size:20px;} 89 | 90 | .icon-check:before { content: "\e606"; } 91 | .icon-remove:before { content: "\e602"; } 92 | 93 | .icon-arrowright::before, 94 | .icon-arrowleft::before{ 95 | position:absolute; 96 | top:17px; 97 | display:block; 98 | content:" "; 99 | height:0; 100 | width:0; 101 | border:5px solid #000; 102 | } 103 | 104 | .icon-arrowright::before{border-color:transparent transparent transparent #000;left:5px;} 105 | .icon-arrowleft::before{border-color:transparent #000 transparent transparent;right:10px;} 106 | 107 | #jdate-btn-check, 108 | #jdate-btn-remove{ 109 | display:block; 110 | position:absolute; 111 | top:0; 112 | width:45px; 113 | height:45px; 114 | } 115 | 116 | #jdate-btn-check{right: 0;} 117 | #jdate-btn-remove{left:0;} 118 | 119 | .jdate-header-info{ 120 | position: relative; 121 | width: 30%; 122 | margin:0 auto; 123 | } 124 | #jdate-btn-prev, 125 | #jdate-btn-next{ 126 | display: block; 127 | width:20px; 128 | height:100%; 129 | position: absolute; 130 | /*background: red;*/ 131 | } 132 | 133 | #jdate-btn-prev{left:-10px;} 134 | #jdate-btn-next{right:-10px;} 135 | 136 | /*jdate-overlay*/ 137 | #jdate-overlay{ 138 | position:fixed; 139 | top:0; 140 | left:0; 141 | width:100%; 142 | height:100%; 143 | background:rgba(0,0,0,0.2); 144 | z-index:9999; 145 | } -------------------------------------------------------------------------------- /css/reset.css: -------------------------------------------------------------------------------- 1 | /*reset*/ 2 | *{ 3 | margin:0; 4 | padding:0; 5 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 6 | outline: 0; 7 | } 8 | ul,dl{list-style:none;} 9 | body{font:normal 16px/1 "Helvetica Neue", Helvetica, STHeiTi, sans-serif} 10 | html,body{height:100%;width:100%;} -------------------------------------------------------------------------------- /dist/font/iconfont.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Created by FontForge 20120731 at Wed May 14 14:20:35 2014 6 | By Ads 7 | 8 | 9 | 10 | 24 | 26 | 28 | 30 | 32 | 36 | 38 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /dist/font/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iancj/jDate/96b7de55e19bc2d8f986ce12a667db66a3bd2f56/dist/font/iconfont.ttf -------------------------------------------------------------------------------- /dist/font/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iancj/jDate/96b7de55e19bc2d8f986ce12a667db66a3bd2f56/dist/font/iconfont.woff -------------------------------------------------------------------------------- /dist/zepto.jdate-min.css: -------------------------------------------------------------------------------- 1 | *{margin:0;padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0);outline:0}dl,ul{list-style:none}body{font:400 16px/1 "Helvetica Neue",Helvetica,STHeiTi,sans-serif}body,html{height:100%;width:100%}.swipe{overflow:hidden;visibility:hidden;position:relative}.swipe-wrap{overflow:hidden;position:relative}.swipe-wrap>li{float:left;width:100%;position:relative}#slider{height:200px}.swipe-wrap{height:100%}.swipe-wrap>li{text-align:center;height:100%}#jdate{position:fixed;top:0;left:0;width:100%;font-size:16px;background:#f8f8f8;z-index:99999}#jdate-header{position:relative;background:#F4F4F4;line-height:45px;text-align:center;border-bottom:1px solid #E8E8E8}.jdate-week{padding:7px 0;font-size:14px}.jdate-table .row{line-height:32px}.table{width:100%;display:table}.row{display:table-row}.col{display:table-cell;text-align:center;color:#a5a5a5;width:14.28571%}.col-today{color:#fa0}.selected{color:#fff;background:#53B8C0}@font-face{font-family:iconfont;src:url(font/iconfont.woff) format('woff'),url(font/iconfont.ttf) format('truetype'),url(font/iconfont.svg#iconfont) format('svg')}.icon{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:.2px;-moz-osx-font-smoothing:grayscale}.ftsize20{font-size:20px}.icon-check:before{content:"\e606"}.icon-remove:before{content:"\e602"}.icon-arrowleft::before,.icon-arrowright::before{position:absolute;top:17px;display:block;content:" ";height:0;width:0;border:5px solid #000}.icon-arrowright::before{border-color:transparent transparent transparent #000;left:5px}.icon-arrowleft::before{border-color:transparent #000 transparent transparent;right:10px}#jdate-btn-check,#jdate-btn-remove{display:block;position:absolute;top:0;width:45px;height:45px}#jdate-btn-check{right:0}#jdate-btn-remove{left:0}.jdate-header-info{position:relative;width:30%;margin:0 auto}#jdate-btn-next,#jdate-btn-prev{display:block;width:20px;height:100%;position:absolute}#jdate-btn-prev{left:-10px}#jdate-btn-next{right:-10px}#jdate-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.2);z-index:9999} -------------------------------------------------------------------------------- /dist/zepto.jdate-min.js: -------------------------------------------------------------------------------- 1 | function Swipe(a,b){"use strict";function c(){p=t.children,s=p.length,p.length<2&&(b.continuous=!1),o.transitions&&b.continuous&&p.length<3&&(t.appendChild(p[0].cloneNode(!0)),t.appendChild(t.children[1].cloneNode(!0)),p=t.children),q=new Array(p.length),r=a.getBoundingClientRect().width||a.offsetWidth,t.style.width=p.length*r+"px";for(var c=p.length;c--;){var d=p[c];d.style.width=r+"px",d.setAttribute("data-index",c),o.transitions&&(d.style.left=c*-r+"px",h(c,u>c?-r:c>u?r:0,0))}b.continuous&&o.transitions&&(h(f(u-1),-r,0),h(f(u+1),r,0)),o.transitions||(t.style.left=u*-r+"px"),a.style.visibility="visible"}function d(){b.continuous?g(u-1):u&&g(u-1)}function e(){b.continuous?g(u+1):uu?a:u)-g-1),r*d,0);a=f(a),h(u,r*d,c||v),h(a,0,c||v),b.continuous&&h(f(a-d),-(r*d),0)}else a=f(a),j(u*-r,a*-r,c||v);u=a,n(b.callback&&b.callback(u,p[u]))}}function h(a,b,c){i(a,b,c),q[a]=b}function i(a,b,c){var d=p[a],e=d&&d.style;e&&(e.webkitTransitionDuration=e.MozTransitionDuration=e.msTransitionDuration=e.OTransitionDuration=e.transitionDuration=c+"ms",e.webkitTransform="translate("+b+"px,0)translateZ(0)",e.msTransform=e.MozTransform=e.OTransform="translateX("+b+"px)")}function j(a,c,d){if(!d)return void(t.style.left=c+"px");var e=+new Date,f=setInterval(function(){var g=+new Date-e;return g>d?(t.style.left=c+"px",y&&k(),b.transitionEnd&&b.transitionEnd.call(event,u,p[u]),void clearInterval(f)):void(t.style.left=(c-a)*(Math.floor(g/d*100)/100)+a+"px")},4)}function k(){w=setTimeout(e,y)}function l(){y=0,clearTimeout(w)}var m=function(){},n=function(a){setTimeout(a||m,0)},o={addEventListener:!!window.addEventListener,touch:"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,transitions:function(a){var b=["transitionProperty","WebkitTransition","MozTransition","OTransition","msTransition"];for(var c in b)if(void 0!==a.style[b[c]])return!0;return!1}(document.createElement("swipe"))};if(a){var p,q,r,s,t=a.children[0];b=b||{};var u=parseInt(b.startSlide,10)||0,v=b.speed||300;b.continuous=void 0!==b.continuous?b.continuous:!0;var w,x,y=b.auto||0,z={},A={},B={handleEvent:function(a){switch(a.type){case"touchstart":this.start(a);break;case"touchmove":this.move(a);break;case"touchend":n(this.end(a));break;case"webkitTransitionEnd":case"msTransitionEnd":case"oTransitionEnd":case"otransitionend":case"transitionend":n(this.transitionEnd(a));break;case"resize":n(c)}b.stopPropagation&&a.stopPropagation()},start:function(a){var b=a.touches[0];z={x:b.pageX,y:b.pageY,time:+new Date},x=void 0,A={},t.addEventListener("touchmove",this,!1),t.addEventListener("touchend",this,!1)},move:function(a){if(!(a.touches.length>1||a.scale&&1!==a.scale)){b.disableScroll&&a.preventDefault();var c=a.touches[0];A={x:c.pageX-z.x,y:c.pageY-z.y},"undefined"==typeof x&&(x=!!(x||Math.abs(A.x)0||u==p.length-1&&A.x<0?Math.abs(A.x)/r+1:1),i(u-1,A.x+q[u-1],0),i(u,A.x+q[u],0),i(u+1,A.x+q[u+1],0)))}},end:function(){var a=+new Date-z.time,c=Number(a)<250&&Math.abs(A.x)>20||Math.abs(A.x)>r/2,d=!u&&A.x>0||u==p.length-1&&A.x<0;b.continuous&&(d=!1);var e=A.x<0;x||(c&&!d?(e?(b.continuous?(h(f(u-1),-r,0),h(f(u+2),r,0)):h(u-1,-r,0),h(u,q[u]-r,v),h(f(u+1),q[f(u+1)]-r,v),u=f(u+1)):(b.continuous?(h(f(u+1),r,0),h(f(u-2),-r,0)):h(u+1,r,0),h(u,q[u]+r,v),h(f(u-1),q[f(u-1)]+r,v),u=f(u-1)),b.callback&&b.callback(u,p[u])):b.continuous?(h(f(u-1),-r,v),h(u,0,v),h(f(u+1),r,v)):(h(u-1,-r,v),h(u,0,v),h(u+1,r,v))),t.removeEventListener("touchmove",B,!1),t.removeEventListener("touchend",B,!1)},transitionEnd:function(a){parseInt(a.target.getAttribute("data-index"),10)==u&&(y&&k(),b.transitionEnd&&b.transitionEnd.call(a,u,p[u]))}};return c(),y&&k(),o.addEventListener?(o.touch&&t.addEventListener("touchstart",B,!1),o.transitions&&(t.addEventListener("webkitTransitionEnd",B,!1),t.addEventListener("msTransitionEnd",B,!1),t.addEventListener("oTransitionEnd",B,!1),t.addEventListener("otransitionend",B,!1),t.addEventListener("transitionend",B,!1)),window.addEventListener("resize",B,!1)):window.onresize=function(){c()},{setup:function(){c()},slide:function(a,b){l(),g(a,b)},prev:function(){l(),d()},next:function(){l(),e()},stop:function(){l()},getPos:function(){return u},getNumSlides:function(){return s},kill:function(){l(),t.style.width="",t.style.left="";for(var a=p.length;a--;){var b=p[a];b.style.width="",b.style.left="",o.transitions&&i(a,0,0)}o.addEventListener?(t.removeEventListener("touchstart",B,!1),t.removeEventListener("webkitTransitionEnd",B,!1),t.removeEventListener("msTransitionEnd",B,!1),t.removeEventListener("oTransitionEnd",B,!1),t.removeEventListener("otransitionend",B,!1),t.removeEventListener("transitionend",B,!1),window.removeEventListener("resize",B,!1)):window.onresize=null}}}}(window.jQuery||window.Zepto)&&!function(a){a.fn.Swipe=function(b){return this.each(function(){a(this).data("Swipe",new Swipe(a(this)[0],b))})}}(window.jQuery||window.Zepto),function(a,b){function c(){this.swipe=null,this.tablePanels=null}function d(a,b){if(a&&b){if(2==b)return a%4==0&&a%100!=0||a%400==0?29:28;var c=[1,3,5,7,8,10,12],d=[4,6,9,11];for(var e in c)if(c[e]==b)return 31;for(var e in d)if(d[e]==b)return 30}}function e(b,c){if(b&&c){for(var e=new Date(b,c-1,1),f=e.getDay(),g=d(b,c),h=Math.floor((g+f)/7),k=(g+f)%7==0?h:h+1,l=1,m=a(''),n=1;k>=n;n++){for(var o=a('
  • '),p=1;7>=p;p++)if(1==n&&f>=p||l>g)o.append('');else{var q="col jdate-col ",r="",s='data-year="'+b+'" data-month="'+c+'" data-date="'+l+'"';i.date==l&&i.month==c&&i.year==b?(q+="col-today ",r="今天"):r=l,j.year==b&&j.month==c&&j.date==l&&(q+="selected "),o.append('"+r+""),l++}m.append(o)}return m.find(".jdate-col").tap(function(){var b=a(this);a("#jdate-container .jdate-col").removeClass("selected"),b.toggleClass("selected"),j.year=b.data("year"),j.month=b.data("month"),j.date=b.data("date")}),m}}function f(b){j={year:i.year,month:i.month,date:i.date},b.fadeOut(300,function(){a(this).remove()}),a("#jdate-overlay").fadeOut(300)}function g(b){b.fadeIn(300);var c=a("#jdate-overlay");c.length<1&&a("body").append('
    '),c.fadeIn(300)}var h=new Date,i={year:h.getFullYear(),month:h.getMonth()+1,date:h.getDate()},j={year:i.year,month:i.month,date:i.date};c.prototype.init=function(b,c,d){var e=a("#jdate")||null;if(e.length<1){e=a('
    ');var h=a('
    '),i=a(''),k=a(''),l=a('
    '),m=a(''),n=a(''),o=a(""),p=a('
    '),q=a('
    '),r=a(''),s=this;m.tap(function(){s.swipe.prev()}),n.tap(function(){s.swipe.next()}),k.click(function(){f(e)}),i.click(function(){b.val(j.year+"-"+j.month+"-"+j.date).change(),f(e)}),o.text(c+"年"+d+"月"),l.append(m,n,o),h.append(i,k,l),p.append('','','','','','','');var t=[a('
  • '),a('
  • '),a('
  • ')];this.tablePanels=t;for(var u=0;uspan").text(f+"年"+g+"月"),b){case 0:c.updateTable(1,f,g+1),c.updateTable(2,f,g-1);break;case 1:c.updateTable(0,f,g-1),c.updateTable(2,f,g+1);break;case 2:c.updateTable(1,f,g-1),c.updateTable(0,f,g+1)}}})},c.prototype.updateTable=function(a,b,c){var d=this.tablePanels[a];if(c>12)var b=b+1,c=1;else if(1>c)var b=b-1,c=12;d.data("month",c),d.data("year",b),d.empty().append(e(b,c))},a.fn.jdate=function(){return a(this).each(function(){var b=a(this),d=function(){var a=""==b.val()?null:b.val().replace(/-/g,"/"),d=new c;if(a){var e=new Date(a);j.year=e.getFullYear(),j.month=e.getMonth()+1,j.date=e.getDate(),d.init(b,j.year,j.month)}else d.init(b,i.year,i.month,i.date)};b.focus(d)})}}(Zepto,document,window); -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | demo: 16 | 17 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /js/jdate.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Zepto DatePicker Plugin 3 | * Version 1.0 4 | * Author iancj 2014-05-14 5 | * Visit http://github.com/iancj/jdate for more information 6 | * 7 | */ 8 | ;(function($, document, window) { 9 | 10 | //今天 11 | var nowdate=new Date(), 12 | now={ 13 | year:nowdate.getFullYear(), 14 | month:nowdate.getMonth()+1, 15 | date:nowdate.getDate() 16 | } 17 | 18 | //当前选择的日期 19 | var selectedDate={ 20 | year:now.year, 21 | month:now.month, 22 | date:now.date 23 | } 24 | 25 | function Jdate() { 26 | this.swipe = null; //滑动对象 27 | this.tablePanels = null; //表格容器 28 | } 29 | 30 | //初始化 31 | Jdate.prototype.init = function($target,year,month) { 32 | 33 | var $jdate=$("#jdate") || null; 34 | 35 | //如果页面不存在jdate则创建 36 | if ($jdate.length < 1) { 37 | 38 | $jdate = $('
    '); 39 | 40 | var $jdateheader = $('
    '),//头部 41 | $jdateheader_btn_check=$(''), 42 | $jdateheader_btn_remove=$(''), 43 | $jdateheaderinfo=$('
    '),//头部信息 44 | $jdateheader_btn_prev=$(''), 45 | $jdateheader_btn_next=$(''), 46 | $jdateheaderinfo_txt=$(''), 47 | $jdateweek = $('
    '),//星期 48 | $slider = $('
    '),//滑动容器 49 | $jdatecontainer = $('
      ');//日期表格 50 | 51 | var self=this; 52 | 53 | $jdateheader_btn_prev.tap(function(){ 54 | self.swipe.prev(); 55 | }); 56 | 57 | $jdateheader_btn_next.tap(function(){ 58 | self.swipe.next(); 59 | }); 60 | 61 | $jdateheader_btn_remove.click(function(){ 62 | _close($jdate); 63 | }); 64 | 65 | $jdateheader_btn_check.click(function(){ 66 | //写入表单元素中,并触发change事件 67 | $target.val(selectedDate.year+"-"+selectedDate.month+"-"+selectedDate.date).change(); 68 | _close($jdate); 69 | }); 70 | 71 | //头部 72 | $jdateheaderinfo_txt.text(year+"年"+month+"月"); 73 | 74 | $jdateheaderinfo.append( 75 | $jdateheader_btn_prev, 76 | $jdateheader_btn_next, 77 | $jdateheaderinfo_txt 78 | ); 79 | 80 | $jdateheader.append( 81 | $jdateheader_btn_check, 82 | $jdateheader_btn_remove, 83 | $jdateheaderinfo 84 | ); 85 | 86 | //星期 87 | $jdateweek.append( 88 | '', 89 | '', 90 | '', 91 | '', 92 | '', 93 | '', 94 | '' 95 | ); 96 | 97 | //日期表格容器 98 | var tablePanels=[ 99 | $('
    • '), 100 | $('
    • '), 101 | $('
    • ') 102 | ]; 103 | this.tablePanels = tablePanels; 104 | 105 | //将日期表格容器插入到container 106 | for(var i=0;ispan").text(year + "年" + month + "月"); 146 | 147 | //更新当前焦点容器两边的月份容器 148 | switch (index) { 149 | case 0: 150 | self.updateTable(1, year, month + 1) 151 | self.updateTable(2, year, month - 1) 152 | break; 153 | case 1: 154 | self.updateTable(0, year, month - 1) 155 | self.updateTable(2, year, month + 1) 156 | break; 157 | case 2: 158 | self.updateTable(1, year, month - 1) 159 | self.updateTable(0, year, month + 1) 160 | break; 161 | } 162 | } 163 | }); 164 | } 165 | 166 | //更新table容器 167 | Jdate.prototype.updateTable = function(index, year, month) { 168 | var $ele = this.tablePanels[index]; 169 | //月份超过12,增年份+1,月份设为1 170 | if (month > 12) { 171 | var year = year + 1; 172 | var month = 1; 173 | } 174 | //月份小于1,增年份-1,月份设为12 175 | else if (month < 1) { 176 | var year = year - 1; 177 | var month = 12; 178 | } 179 | $ele.data("month", month); 180 | $ele.data("year", year); 181 | $ele.empty().append(_getCalendar(year, month)); 182 | } 183 | 184 | //得到每月的天数 185 | function _getDaysOfMonth(year, month) { 186 | if (year && month) { 187 | if (month == 2) { 188 | //2月闰年判断 189 | if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) { 190 | return 29; 191 | } 192 | return 28; 193 | } 194 | var bigMonth = [1, 3, 5, 7, 8, 10, 12]; 195 | var littleMonth = [4, 6, 9, 11]; 196 | for (var m in bigMonth) { 197 | if (bigMonth[m] == month) 198 | return 31; 199 | } 200 | for (var m in littleMonth) { 201 | if (littleMonth[m] == month) 202 | return 30; 203 | } 204 | } 205 | } 206 | 207 | //根据年月生成日历 208 | function _getCalendar(year, month) { 209 | if (year && month) { 210 | 211 | var date = new Date(year, month - 1, 1), //每月的第一天 212 | week = date.getDay(), //星期几 213 | days = _getDaysOfMonth(year, month), //month月的总天数 214 | temp_rows = Math.floor((days + week) / 7), 215 | rows = (days + week) % 7 == 0 ? temp_rows : (temp_rows + 1); //要输出的行数 216 | 217 | var count = 1, //天数计算器 218 | $table = $('
        '); 219 | 220 | for (var i = 1; i <= rows; i++) { 221 | var $row = $('
      • '); 222 | 223 | for (var j = 1; j <= 7; j++) { 224 | //如果是第一行,这个月第一天之前的cell输出空值 225 | //这个月最后一天之后的单元格输出空值 226 | if ((i == 1 && j <= week) || count > days) { 227 | $row.append(''); 228 | } else { 229 | var dom_class="col jdate-col ",//dom的class 230 | dom_text="",//dom显示的文字 231 | dom_data='data-year="'+year+'" data-month="'+month+'" data-date="'+count+'"'; 232 | //判断是否是今天 233 | if(now.date==count && now.month==month && now.year==year){ 234 | dom_class+="col-today "; 235 | dom_text="今天"; 236 | } 237 | else{ 238 | dom_text=count; 239 | } 240 | //如果当前输出日期与之前选择的一致,则加上选中样式 241 | if(selectedDate.year==year && selectedDate.month==month && selectedDate.date==count){ 242 | dom_class+="selected "; 243 | } 244 | $row.append(''+dom_text+''); 245 | count++; 246 | } 247 | 248 | } 249 | 250 | $table.append($row); 251 | } 252 | 253 | $table.find(".jdate-col").tap(function() { 254 | var $self=$(this); 255 | $("#jdate-container .jdate-col").removeClass("selected"); 256 | $self.toggleClass("selected"); 257 | 258 | selectedDate.year=$self.data("year"); 259 | selectedDate.month=$self.data("month"); 260 | selectedDate.date=$self.data("date"); 261 | }); 262 | 263 | return $table; 264 | } 265 | } 266 | 267 | //关闭 268 | function _close(ele){ 269 | selectedDate={ 270 | year:now.year, 271 | month:now.month, 272 | date:now.date 273 | }; 274 | ele.fadeOut(300,function(){ 275 | $(this).remove(); 276 | }); 277 | $("#jdate-overlay").fadeOut(300); 278 | } 279 | 280 | //显示 281 | function _show(ele){ 282 | ele.fadeIn(300); 283 | var $overlay=$("#jdate-overlay"); 284 | if($overlay.length<1){ 285 | $("body").append('
        '); 286 | } 287 | $overlay.fadeIn(300); 288 | } 289 | 290 | $.fn.jdate = function() { 291 | return $(this).each(function() { 292 | var $self = $(this); 293 | 294 | var init=function(){ 295 | 296 | var val = $self.val()=="" ? null: $self.val().replace(/-/g,"/"); 297 | var jdate = new Jdate(); 298 | //如果input没有值的话,日期初始化以今天为准,否则以input中的日期为准 299 | if(!val){ 300 | jdate.init($self,now.year,now.month,now.date); 301 | } 302 | else{ 303 | var tempdate=new Date(val); 304 | //设置当前选中的日期为input中的日期 305 | selectedDate.year=tempdate.getFullYear(); 306 | selectedDate.month=tempdate.getMonth()+1; 307 | selectedDate.date=tempdate.getDate(); 308 | jdate.init($self,selectedDate.year,selectedDate.month); 309 | } 310 | }; 311 | //当input获取焦点时打开日期选择器 312 | $self.focus(init); 313 | }); 314 | } 315 | 316 | })(Zepto, document, window); -------------------------------------------------------------------------------- /js/swipe.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Swipe 2.0 3 | * 4 | * Brad Birdsall 5 | * Copyright 2013, MIT License 6 | * 7 | */ 8 | 9 | function Swipe(container, options) { 10 | 11 | "use strict"; 12 | 13 | // utilities 14 | var noop = function() {}; // simple no operation function 15 | var offloadFn = function(fn) { setTimeout(fn || noop, 0) }; // offload a functions execution 16 | 17 | // check browser capabilities 18 | var browser = { 19 | addEventListener: !!window.addEventListener, 20 | touch: ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch, 21 | transitions: (function(temp) { 22 | var props = ['transitionProperty', 'WebkitTransition', 'MozTransition', 'OTransition', 'msTransition']; 23 | for ( var i in props ) if (temp.style[ props[i] ] !== undefined) return true; 24 | return false; 25 | })(document.createElement('swipe')) 26 | }; 27 | 28 | // quit if no root element 29 | if (!container) return; 30 | var element = container.children[0]; 31 | var slides, slidePos, width, length; 32 | options = options || {}; 33 | var index = parseInt(options.startSlide, 10) || 0; 34 | var speed = options.speed || 300; 35 | options.continuous = options.continuous !== undefined ? options.continuous : true; 36 | 37 | function setup() { 38 | 39 | // cache slides 40 | slides = element.children; 41 | length = slides.length; 42 | 43 | // set continuous to false if only one slide 44 | if (slides.length < 2) options.continuous = false; 45 | 46 | //special case if two slides 47 | if (browser.transitions && options.continuous && slides.length < 3) { 48 | element.appendChild(slides[0].cloneNode(true)); 49 | element.appendChild(element.children[1].cloneNode(true)); 50 | slides = element.children; 51 | } 52 | 53 | // create an array to store current positions of each slide 54 | slidePos = new Array(slides.length); 55 | 56 | // determine width of each slide 57 | width = container.getBoundingClientRect().width || container.offsetWidth; 58 | 59 | element.style.width = (slides.length * width) + 'px'; 60 | 61 | // stack elements 62 | var pos = slides.length; 63 | while(pos--) { 64 | 65 | var slide = slides[pos]; 66 | 67 | slide.style.width = width + 'px'; 68 | slide.setAttribute('data-index', pos); 69 | 70 | if (browser.transitions) { 71 | slide.style.left = (pos * -width) + 'px'; 72 | move(pos, index > pos ? -width : (index < pos ? width : 0), 0); 73 | } 74 | 75 | } 76 | 77 | // reposition elements before and after index 78 | if (options.continuous && browser.transitions) { 79 | move(circle(index-1), -width, 0); 80 | move(circle(index+1), width, 0); 81 | } 82 | 83 | if (!browser.transitions) element.style.left = (index * -width) + 'px'; 84 | 85 | container.style.visibility = 'visible'; 86 | 87 | } 88 | 89 | function prev() { 90 | 91 | if (options.continuous) slide(index-1); 92 | else if (index) slide(index-1); 93 | 94 | } 95 | 96 | function next() { 97 | 98 | if (options.continuous) slide(index+1); 99 | else if (index < slides.length - 1) slide(index+1); 100 | 101 | } 102 | 103 | function circle(index) { 104 | 105 | // a simple positive modulo using slides.length 106 | return (slides.length + (index % slides.length)) % slides.length; 107 | 108 | } 109 | 110 | function slide(to, slideSpeed) { 111 | 112 | // do nothing if already on requested slide 113 | if (index == to) return; 114 | 115 | if (browser.transitions) { 116 | 117 | var direction = Math.abs(index-to) / (index-to); // 1: backward, -1: forward 118 | 119 | // get the actual position of the slide 120 | if (options.continuous) { 121 | var natural_direction = direction; 122 | direction = -slidePos[circle(to)] / width; 123 | 124 | // if going forward but to < index, use to = slides.length + to 125 | // if going backward but to > index, use to = -slides.length + to 126 | if (direction !== natural_direction) to = -direction * slides.length + to; 127 | 128 | } 129 | 130 | var diff = Math.abs(index-to) - 1; 131 | 132 | // move all the slides between index and to in the right direction 133 | while (diff--) move( circle((to > index ? to : index) - diff - 1), width * direction, 0); 134 | 135 | to = circle(to); 136 | 137 | move(index, width * direction, slideSpeed || speed); 138 | move(to, 0, slideSpeed || speed); 139 | 140 | if (options.continuous) move(circle(to - direction), -(width * direction), 0); // we need to get the next in place 141 | 142 | } else { 143 | 144 | to = circle(to); 145 | animate(index * -width, to * -width, slideSpeed || speed); 146 | //no fallback for a circular continuous if the browser does not accept transitions 147 | } 148 | 149 | index = to; 150 | offloadFn(options.callback && options.callback(index, slides[index])); 151 | } 152 | 153 | function move(index, dist, speed) { 154 | 155 | translate(index, dist, speed); 156 | slidePos[index] = dist; 157 | 158 | } 159 | 160 | function translate(index, dist, speed) { 161 | 162 | var slide = slides[index]; 163 | var style = slide && slide.style; 164 | 165 | if (!style) return; 166 | 167 | style.webkitTransitionDuration = 168 | style.MozTransitionDuration = 169 | style.msTransitionDuration = 170 | style.OTransitionDuration = 171 | style.transitionDuration = speed + 'ms'; 172 | 173 | style.webkitTransform = 'translate(' + dist + 'px,0)' + 'translateZ(0)'; 174 | style.msTransform = 175 | style.MozTransform = 176 | style.OTransform = 'translateX(' + dist + 'px)'; 177 | 178 | } 179 | 180 | function animate(from, to, speed) { 181 | 182 | // if not an animation, just reposition 183 | if (!speed) { 184 | 185 | element.style.left = to + 'px'; 186 | return; 187 | 188 | } 189 | 190 | var start = +new Date; 191 | 192 | var timer = setInterval(function() { 193 | 194 | var timeElap = +new Date - start; 195 | 196 | if (timeElap > speed) { 197 | 198 | element.style.left = to + 'px'; 199 | 200 | if (delay) begin(); 201 | 202 | options.transitionEnd && options.transitionEnd.call(event, index, slides[index]); 203 | 204 | clearInterval(timer); 205 | return; 206 | 207 | } 208 | 209 | element.style.left = (( (to - from) * (Math.floor((timeElap / speed) * 100) / 100) ) + from) + 'px'; 210 | 211 | }, 4); 212 | 213 | } 214 | 215 | // setup auto slideshow 216 | var delay = options.auto || 0; 217 | var interval; 218 | 219 | function begin() { 220 | 221 | interval = setTimeout(next, delay); 222 | 223 | } 224 | 225 | function stop() { 226 | 227 | delay = 0; 228 | clearTimeout(interval); 229 | 230 | } 231 | 232 | 233 | // setup initial vars 234 | var start = {}; 235 | var delta = {}; 236 | var isScrolling; 237 | 238 | // setup event capturing 239 | var events = { 240 | 241 | handleEvent: function(event) { 242 | 243 | switch (event.type) { 244 | case 'touchstart': this.start(event); break; 245 | case 'touchmove': this.move(event); break; 246 | case 'touchend': offloadFn(this.end(event)); break; 247 | case 'webkitTransitionEnd': 248 | case 'msTransitionEnd': 249 | case 'oTransitionEnd': 250 | case 'otransitionend': 251 | case 'transitionend': offloadFn(this.transitionEnd(event)); break; 252 | case 'resize': offloadFn(setup); break; 253 | } 254 | 255 | if (options.stopPropagation) event.stopPropagation(); 256 | 257 | }, 258 | start: function(event) { 259 | 260 | var touches = event.touches[0]; 261 | 262 | // measure start values 263 | start = { 264 | 265 | // get initial touch coords 266 | x: touches.pageX, 267 | y: touches.pageY, 268 | 269 | // store time to determine touch duration 270 | time: +new Date 271 | 272 | }; 273 | 274 | // used for testing first move event 275 | isScrolling = undefined; 276 | 277 | // reset delta and end measurements 278 | delta = {}; 279 | 280 | // attach touchmove and touchend listeners 281 | element.addEventListener('touchmove', this, false); 282 | element.addEventListener('touchend', this, false); 283 | 284 | }, 285 | move: function(event) { 286 | 287 | // ensure swiping with one touch and not pinching 288 | if ( event.touches.length > 1 || event.scale && event.scale !== 1) return 289 | 290 | if (options.disableScroll) event.preventDefault(); 291 | 292 | var touches = event.touches[0]; 293 | 294 | // measure change in x and y 295 | delta = { 296 | x: touches.pageX - start.x, 297 | y: touches.pageY - start.y 298 | } 299 | 300 | // determine if scrolling test has run - one time test 301 | if ( typeof isScrolling == 'undefined') { 302 | isScrolling = !!( isScrolling || Math.abs(delta.x) < Math.abs(delta.y) ); 303 | } 304 | 305 | // if user is not trying to scroll vertically 306 | if (!isScrolling) { 307 | 308 | // prevent native scrolling 309 | event.preventDefault(); 310 | 311 | // stop slideshow 312 | stop(); 313 | 314 | // increase resistance if first or last slide 315 | if (options.continuous) { // we don't add resistance at the end 316 | 317 | translate(circle(index-1), delta.x + slidePos[circle(index-1)], 0); 318 | translate(index, delta.x + slidePos[index], 0); 319 | translate(circle(index+1), delta.x + slidePos[circle(index+1)], 0); 320 | 321 | } else { 322 | 323 | delta.x = 324 | delta.x / 325 | ( (!index && delta.x > 0 // if first slide and sliding left 326 | || index == slides.length - 1 // or if last slide and sliding right 327 | && delta.x < 0 // and if sliding at all 328 | ) ? 329 | ( Math.abs(delta.x) / width + 1 ) // determine resistance level 330 | : 1 ); // no resistance if false 331 | 332 | // translate 1:1 333 | translate(index-1, delta.x + slidePos[index-1], 0); 334 | translate(index, delta.x + slidePos[index], 0); 335 | translate(index+1, delta.x + slidePos[index+1], 0); 336 | } 337 | 338 | } 339 | 340 | }, 341 | end: function(event) { 342 | 343 | // measure duration 344 | var duration = +new Date - start.time; 345 | 346 | // determine if slide attempt triggers next/prev slide 347 | var isValidSlide = 348 | Number(duration) < 250 // if slide duration is less than 250ms 349 | && Math.abs(delta.x) > 20 // and if slide amt is greater than 20px 350 | || Math.abs(delta.x) > width/2; // or if slide amt is greater than half the width 351 | 352 | // determine if slide attempt is past start and end 353 | var isPastBounds = 354 | !index && delta.x > 0 // if first slide and slide amt is greater than 0 355 | || index == slides.length - 1 && delta.x < 0; // or if last slide and slide amt is less than 0 356 | 357 | if (options.continuous) isPastBounds = false; 358 | 359 | // determine direction of swipe (true:right, false:left) 360 | var direction = delta.x < 0; 361 | 362 | // if not scrolling vertically 363 | if (!isScrolling) { 364 | 365 | if (isValidSlide && !isPastBounds) { 366 | 367 | if (direction) { 368 | 369 | if (options.continuous) { // we need to get the next in this direction in place 370 | 371 | move(circle(index-1), -width, 0); 372 | move(circle(index+2), width, 0); 373 | 374 | } else { 375 | move(index-1, -width, 0); 376 | } 377 | 378 | move(index, slidePos[index]-width, speed); 379 | move(circle(index+1), slidePos[circle(index+1)]-width, speed); 380 | index = circle(index+1); 381 | 382 | } else { 383 | if (options.continuous) { // we need to get the next in this direction in place 384 | 385 | move(circle(index+1), width, 0); 386 | move(circle(index-2), -width, 0); 387 | 388 | } else { 389 | move(index+1, width, 0); 390 | } 391 | 392 | move(index, slidePos[index]+width, speed); 393 | move(circle(index-1), slidePos[circle(index-1)]+width, speed); 394 | index = circle(index-1); 395 | 396 | } 397 | 398 | options.callback && options.callback(index, slides[index]); 399 | 400 | } else { 401 | 402 | if (options.continuous) { 403 | 404 | move(circle(index-1), -width, speed); 405 | move(index, 0, speed); 406 | move(circle(index+1), width, speed); 407 | 408 | } else { 409 | 410 | move(index-1, -width, speed); 411 | move(index, 0, speed); 412 | move(index+1, width, speed); 413 | } 414 | 415 | } 416 | 417 | } 418 | 419 | // kill touchmove and touchend event listeners until touchstart called again 420 | element.removeEventListener('touchmove', events, false) 421 | element.removeEventListener('touchend', events, false) 422 | 423 | }, 424 | transitionEnd: function(event) { 425 | 426 | if (parseInt(event.target.getAttribute('data-index'), 10) == index) { 427 | 428 | if (delay) begin(); 429 | 430 | options.transitionEnd && options.transitionEnd.call(event, index, slides[index]); 431 | 432 | } 433 | 434 | } 435 | 436 | } 437 | 438 | // trigger setup 439 | setup(); 440 | 441 | // start auto slideshow if applicable 442 | if (delay) begin(); 443 | 444 | 445 | // add event listeners 446 | if (browser.addEventListener) { 447 | 448 | // set touchstart event on element 449 | if (browser.touch) element.addEventListener('touchstart', events, false); 450 | 451 | if (browser.transitions) { 452 | element.addEventListener('webkitTransitionEnd', events, false); 453 | element.addEventListener('msTransitionEnd', events, false); 454 | element.addEventListener('oTransitionEnd', events, false); 455 | element.addEventListener('otransitionend', events, false); 456 | element.addEventListener('transitionend', events, false); 457 | } 458 | 459 | // set resize event on window 460 | window.addEventListener('resize', events, false); 461 | 462 | } else { 463 | 464 | window.onresize = function () { setup() }; // to play nice with old IE 465 | 466 | } 467 | 468 | // expose the Swipe API 469 | return { 470 | setup: function() { 471 | 472 | setup(); 473 | 474 | }, 475 | slide: function(to, speed) { 476 | 477 | // cancel slideshow 478 | stop(); 479 | 480 | slide(to, speed); 481 | 482 | }, 483 | prev: function() { 484 | 485 | // cancel slideshow 486 | stop(); 487 | 488 | prev(); 489 | 490 | }, 491 | next: function() { 492 | 493 | // cancel slideshow 494 | stop(); 495 | 496 | next(); 497 | 498 | }, 499 | stop: function() { 500 | 501 | // cancel slideshow 502 | stop(); 503 | 504 | }, 505 | getPos: function() { 506 | 507 | // return current index position 508 | return index; 509 | 510 | }, 511 | getNumSlides: function() { 512 | 513 | // return total number of slides 514 | return length; 515 | }, 516 | kill: function() { 517 | 518 | // cancel slideshow 519 | stop(); 520 | 521 | // reset element 522 | element.style.width = ''; 523 | element.style.left = ''; 524 | 525 | // reset slides 526 | var pos = slides.length; 527 | while(pos--) { 528 | 529 | var slide = slides[pos]; 530 | slide.style.width = ''; 531 | slide.style.left = ''; 532 | 533 | if (browser.transitions) translate(pos, 0, 0); 534 | 535 | } 536 | 537 | // removed event listeners 538 | if (browser.addEventListener) { 539 | 540 | // remove current event listeners 541 | element.removeEventListener('touchstart', events, false); 542 | element.removeEventListener('webkitTransitionEnd', events, false); 543 | element.removeEventListener('msTransitionEnd', events, false); 544 | element.removeEventListener('oTransitionEnd', events, false); 545 | element.removeEventListener('otransitionend', events, false); 546 | element.removeEventListener('transitionend', events, false); 547 | window.removeEventListener('resize', events, false); 548 | 549 | } 550 | else { 551 | 552 | window.onresize = null; 553 | 554 | } 555 | 556 | } 557 | } 558 | 559 | } 560 | 561 | 562 | if ( window.jQuery || window.Zepto ) { 563 | (function($) { 564 | $.fn.Swipe = function(params) { 565 | return this.each(function() { 566 | $(this).data('Swipe', new Swipe($(this)[0], params)); 567 | }); 568 | } 569 | })( window.jQuery || window.Zepto ) 570 | } 571 | -------------------------------------------------------------------------------- /js/zepto-min.js: -------------------------------------------------------------------------------- 1 | var Zepto=function(){function a(a){return null==a?String(a):U[V.call(a)]||"object"}function b(b){return"function"==a(b)}function c(a){return null!=a&&a==a.window}function d(a){return null!=a&&a.nodeType==a.DOCUMENT_NODE}function e(b){return"object"==a(b)}function f(a){return e(a)&&!c(a)&&Object.getPrototypeOf(a)==Object.prototype}function g(a){return"number"==typeof a.length}function h(a){return D.call(a,function(a){return null!=a})}function i(a){return a.length>0?x.fn.concat.apply([],a):a}function j(a){return a.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function k(a){return a in G?G[a]:G[a]=new RegExp("(^|\\s)"+a+"(\\s|$)")}function l(a,b){return"number"!=typeof b||H[j(a)]?b:b+"px"}function m(a){var b,c;return F[a]||(b=E.createElement(a),E.body.appendChild(b),c=getComputedStyle(b,"").getPropertyValue("display"),b.parentNode.removeChild(b),"none"==c&&(c="block"),F[a]=c),F[a]}function n(a){return"children"in a?C.call(a.children):x.map(a.childNodes,function(a){return 1==a.nodeType?a:void 0})}function o(a,b,c){for(w in b)c&&(f(b[w])||Z(b[w]))?(f(b[w])&&!f(a[w])&&(a[w]={}),Z(b[w])&&!Z(a[w])&&(a[w]=[]),o(a[w],b[w],c)):b[w]!==v&&(a[w]=b[w])}function p(a,b){return null==b?x(a):x(a).filter(b)}function q(a,c,d,e){return b(c)?c.call(a,d,e):c}function r(a,b,c){null==c?a.removeAttribute(b):a.setAttribute(b,c)}function s(a,b){var c=a.className,d=c&&c.baseVal!==v;return b===v?d?c.baseVal:c:void(d?c.baseVal=b:a.className=b)}function t(a){var b;try{return a?"true"==a||("false"==a?!1:"null"==a?null:/^0/.test(a)||isNaN(b=Number(a))?/^[\[\{]/.test(a)?x.parseJSON(a):a:b):a}catch(c){return a}}function u(a,b){b(a);for(var c in a.childNodes)u(a.childNodes[c],b)}var v,w,x,y,z,A,B=[],C=B.slice,D=B.filter,E=window.document,F={},G={},H={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},I=/^\s*<(\w+|!)[^>]*>/,J=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,K=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,L=/^(?:body|html)$/i,M=/([A-Z])/g,N=["val","css","html","text","data","width","height","offset"],O=["after","prepend","before","append"],P=E.createElement("table"),Q=E.createElement("tr"),R={tr:E.createElement("tbody"),tbody:P,thead:P,tfoot:P,td:Q,th:Q,"*":E.createElement("div")},S=/complete|loaded|interactive/,T=/^[\w-]*$/,U={},V=U.toString,W={},X=E.createElement("div"),Y={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},Z=Array.isArray||function(a){return a instanceof Array};return W.matches=function(a,b){if(!b||!a||1!==a.nodeType)return!1;var c=a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.matchesSelector;if(c)return c.call(a,b);var d,e=a.parentNode,f=!e;return f&&(e=X).appendChild(a),d=~W.qsa(e,b).indexOf(a),f&&X.removeChild(a),d},z=function(a){return a.replace(/-+(.)?/g,function(a,b){return b?b.toUpperCase():""})},A=function(a){return D.call(a,function(b,c){return a.indexOf(b)==c})},W.fragment=function(a,b,c){var d,e,g;return J.test(a)&&(d=x(E.createElement(RegExp.$1))),d||(a.replace&&(a=a.replace(K,"<$1>")),b===v&&(b=I.test(a)&&RegExp.$1),b in R||(b="*"),g=R[b],g.innerHTML=""+a,d=x.each(C.call(g.childNodes),function(){g.removeChild(this)})),f(c)&&(e=x(d),x.each(c,function(a,b){N.indexOf(a)>-1?e[a](b):e.attr(a,b)})),d},W.Z=function(a,b){return a=a||[],a.__proto__=x.fn,a.selector=b||"",a},W.isZ=function(a){return a instanceof W.Z},W.init=function(a,c){var d;if(!a)return W.Z();if("string"==typeof a)if(a=a.trim(),"<"==a[0]&&I.test(a))d=W.fragment(a,RegExp.$1,c),a=null;else{if(c!==v)return x(c).find(a);d=W.qsa(E,a)}else{if(b(a))return x(E).ready(a);if(W.isZ(a))return a;if(Z(a))d=h(a);else if(e(a))d=[a],a=null;else if(I.test(a))d=W.fragment(a.trim(),RegExp.$1,c),a=null;else{if(c!==v)return x(c).find(a);d=W.qsa(E,a)}}return W.Z(d,a)},x=function(a,b){return W.init(a,b)},x.extend=function(a){var b,c=C.call(arguments,1);return"boolean"==typeof a&&(b=a,a=c.shift()),c.forEach(function(c){o(a,c,b)}),a},W.qsa=function(a,b){var c,e="#"==b[0],f=!e&&"."==b[0],g=e||f?b.slice(1):b,h=T.test(g);return d(a)&&h&&e?(c=a.getElementById(g))?[c]:[]:1!==a.nodeType&&9!==a.nodeType?[]:C.call(h&&!e?f?a.getElementsByClassName(g):a.getElementsByTagName(b):a.querySelectorAll(b))},x.contains=function(a,b){return a!==b&&a.contains(b)},x.type=a,x.isFunction=b,x.isWindow=c,x.isArray=Z,x.isPlainObject=f,x.isEmptyObject=function(a){var b;for(b in a)return!1;return!0},x.inArray=function(a,b,c){return B.indexOf.call(b,a,c)},x.camelCase=z,x.trim=function(a){return null==a?"":String.prototype.trim.call(a)},x.uuid=0,x.support={},x.expr={},x.map=function(a,b){var c,d,e,f=[];if(g(a))for(d=0;d=0?a:a+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(a){return B.every.call(this,function(b,c){return a.call(b,c,b)!==!1}),this},filter:function(a){return b(a)?this.not(this.not(a)):x(D.call(this,function(b){return W.matches(b,a)}))},add:function(a,b){return x(A(this.concat(x(a,b))))},is:function(a){return this.length>0&&W.matches(this[0],a)},not:function(a){var c=[];if(b(a)&&a.call!==v)this.each(function(b){a.call(this,b)||c.push(this)});else{var d="string"==typeof a?this.filter(a):g(a)&&b(a.item)?C.call(a):x(a);this.forEach(function(a){d.indexOf(a)<0&&c.push(a)})}return x(c)},has:function(a){return this.filter(function(){return e(a)?x.contains(this,a):x(this).find(a).size()})},eq:function(a){return-1===a?this.slice(a):this.slice(a,+a+1)},first:function(){var a=this[0];return a&&!e(a)?a:x(a)},last:function(){var a=this[this.length-1];return a&&!e(a)?a:x(a)},find:function(a){var b,c=this;return b="object"==typeof a?x(a).filter(function(){var a=this;return B.some.call(c,function(b){return x.contains(b,a)})}):1==this.length?x(W.qsa(this[0],a)):this.map(function(){return W.qsa(this,a)})},closest:function(a,b){var c=this[0],e=!1;for("object"==typeof a&&(e=x(a));c&&!(e?e.indexOf(c)>=0:W.matches(c,a));)c=c!==b&&!d(c)&&c.parentNode;return x(c)},parents:function(a){for(var b=[],c=this;c.length>0;)c=x.map(c,function(a){return(a=a.parentNode)&&!d(a)&&b.indexOf(a)<0?(b.push(a),a):void 0});return p(b,a)},parent:function(a){return p(A(this.pluck("parentNode")),a)},children:function(a){return p(this.map(function(){return n(this)}),a)},contents:function(){return this.map(function(){return C.call(this.childNodes)})},siblings:function(a){return p(this.map(function(a,b){return D.call(n(b.parentNode),function(a){return a!==b})}),a)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(a){return x.map(this,function(b){return b[a]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=m(this.nodeName))})},replaceWith:function(a){return this.before(a).remove()},wrap:function(a){var c=b(a);if(this[0]&&!c)var d=x(a).get(0),e=d.parentNode||this.length>1;return this.each(function(b){x(this).wrapAll(c?a.call(this,b):e?d.cloneNode(!0):d)})},wrapAll:function(a){if(this[0]){x(this[0]).before(a=x(a));for(var b;(b=a.children()).length;)a=b.first();x(a).append(this)}return this},wrapInner:function(a){var c=b(a);return this.each(function(b){var d=x(this),e=d.contents(),f=c?a.call(this,b):a;e.length?e.wrapAll(f):d.append(f)})},unwrap:function(){return this.parent().each(function(){x(this).replaceWith(x(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(a){return this.each(function(){var b=x(this);(a===v?"none"==b.css("display"):a)?b.show():b.hide()})},prev:function(a){return x(this.pluck("previousElementSibling")).filter(a||"*")},next:function(a){return x(this.pluck("nextElementSibling")).filter(a||"*")},html:function(a){return 0===arguments.length?this.length>0?this[0].innerHTML:null:this.each(function(b){var c=this.innerHTML;x(this).empty().append(q(this,a,b,c))})},text:function(a){return 0===arguments.length?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=a===v?"":""+a})},attr:function(a,b){var c;return"string"==typeof a&&b===v?0==this.length||1!==this[0].nodeType?v:"value"==a&&"INPUT"==this[0].nodeName?this.val():!(c=this[0].getAttribute(a))&&a in this[0]?this[0][a]:c:this.each(function(c){if(1===this.nodeType)if(e(a))for(w in a)r(this,w,a[w]);else r(this,a,q(this,b,c,this.getAttribute(a)))})},removeAttr:function(a){return this.each(function(){1===this.nodeType&&r(this,a)})},prop:function(a,b){return a=Y[a]||a,b===v?this[0]&&this[0][a]:this.each(function(c){this[a]=q(this,b,c,this[a])})},data:function(a,b){var c=this.attr("data-"+a.replace(M,"-$1").toLowerCase(),b);return null!==c?t(c):v},val:function(a){return 0===arguments.length?this[0]&&(this[0].multiple?x(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value):this.each(function(b){this.value=q(this,a,b,this.value)})},offset:function(a){if(a)return this.each(function(b){var c=x(this),d=q(this,a,b,c.offset()),e=c.offsetParent().offset(),f={top:d.top-e.top,left:d.left-e.left};"static"==c.css("position")&&(f.position="relative"),c.css(f)});if(0==this.length)return null;var b=this[0].getBoundingClientRect();return{left:b.left+window.pageXOffset,top:b.top+window.pageYOffset,width:Math.round(b.width),height:Math.round(b.height)}},css:function(b,c){if(arguments.length<2){var d=this[0],e=getComputedStyle(d,"");if(!d)return;if("string"==typeof b)return d.style[z(b)]||e.getPropertyValue(b);if(Z(b)){var f={};return x.each(Z(b)?b:[b],function(a,b){f[b]=d.style[z(b)]||e.getPropertyValue(b)}),f}}var g="";if("string"==a(b))c||0===c?g=j(b)+":"+l(b,c):this.each(function(){this.style.removeProperty(j(b))});else for(w in b)b[w]||0===b[w]?g+=j(w)+":"+l(w,b[w])+";":this.each(function(){this.style.removeProperty(j(w))});return this.each(function(){this.style.cssText+=";"+g})},index:function(a){return a?this.indexOf(x(a)[0]):this.parent().children().indexOf(this[0])},hasClass:function(a){return a?B.some.call(this,function(a){return this.test(s(a))},k(a)):!1},addClass:function(a){return a?this.each(function(b){y=[];var c=s(this),d=q(this,a,b,c);d.split(/\s+/g).forEach(function(a){x(this).hasClass(a)||y.push(a)},this),y.length&&s(this,c+(c?" ":"")+y.join(" "))}):this},removeClass:function(a){return this.each(function(b){return a===v?s(this,""):(y=s(this),q(this,a,b,y).split(/\s+/g).forEach(function(a){y=y.replace(k(a)," ")}),void s(this,y.trim()))})},toggleClass:function(a,b){return a?this.each(function(c){var d=x(this),e=q(this,a,c,s(this));e.split(/\s+/g).forEach(function(a){(b===v?!d.hasClass(a):b)?d.addClass(a):d.removeClass(a)})}):this},scrollTop:function(a){if(this.length){var b="scrollTop"in this[0];return a===v?b?this[0].scrollTop:this[0].pageYOffset:this.each(b?function(){this.scrollTop=a}:function(){this.scrollTo(this.scrollX,a)})}},scrollLeft:function(a){if(this.length){var b="scrollLeft"in this[0];return a===v?b?this[0].scrollLeft:this[0].pageXOffset:this.each(b?function(){this.scrollLeft=a}:function(){this.scrollTo(a,this.scrollY)})}},position:function(){if(this.length){var a=this[0],b=this.offsetParent(),c=this.offset(),d=L.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(x(a).css("margin-top"))||0,c.left-=parseFloat(x(a).css("margin-left"))||0,d.top+=parseFloat(x(b[0]).css("border-top-width"))||0,d.left+=parseFloat(x(b[0]).css("border-left-width"))||0,{top:c.top-d.top,left:c.left-d.left}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||E.body;a&&!L.test(a.nodeName)&&"static"==x(a).css("position");)a=a.offsetParent;return a})}},x.fn.detach=x.fn.remove,["width","height"].forEach(function(a){var b=a.replace(/./,function(a){return a[0].toUpperCase()});x.fn[a]=function(e){var f,g=this[0];return e===v?c(g)?g["inner"+b]:d(g)?g.documentElement["scroll"+b]:(f=this.offset())&&f[a]:this.each(function(b){g=x(this),g.css(a,q(this,e,b,g[a]()))})}}),O.forEach(function(b,c){var d=c%2;x.fn[b]=function(){var b,e,f=x.map(arguments,function(c){return b=a(c),"object"==b||"array"==b||null==c?c:W.fragment(c)}),g=this.length>1;return f.length<1?this:this.each(function(a,b){e=d?b:b.parentNode,b=0==c?b.nextSibling:1==c?b.firstChild:2==c?b:null,f.forEach(function(a){if(g)a=a.cloneNode(!0);else if(!e)return x(a).remove();u(e.insertBefore(a,b),function(a){null==a.nodeName||"SCRIPT"!==a.nodeName.toUpperCase()||a.type&&"text/javascript"!==a.type||a.src||window.eval.call(window,a.innerHTML)})})})},x.fn[d?b+"To":"insert"+(c?"Before":"After")]=function(a){return x(a)[b](this),this}}),W.Z.prototype=x.fn,W.uniq=A,W.deserializeValue=t,x.zepto=W,x}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(a){function b(a){return a._zid||(a._zid=m++)}function c(a,c,f,g){if(c=d(c),c.ns)var h=e(c.ns);return(q[b(a)]||[]).filter(function(a){return!(!a||c.e&&a.e!=c.e||c.ns&&!h.test(a.ns)||f&&b(a.fn)!==b(f)||g&&a.sel!=g)})}function d(a){var b=(""+a).split(".");return{e:b[0],ns:b.slice(1).sort().join(" ")}}function e(a){return new RegExp("(?:^| )"+a.replace(" "," .* ?")+"(?: |$)")}function f(a,b){return a.del&&!s&&a.e in t||!!b}function g(a){return u[a]||s&&t[a]||a}function h(c,e,h,i,k,m,n){var o=b(c),p=q[o]||(q[o]=[]);e.split(/\s/).forEach(function(b){if("ready"==b)return a(document).ready(h);var e=d(b);e.fn=h,e.sel=k,e.e in u&&(h=function(b){var c=b.relatedTarget;return!c||c!==this&&!a.contains(this,c)?e.fn.apply(this,arguments):void 0}),e.del=m;var o=m||h;e.proxy=function(a){if(a=j(a),!a.isImmediatePropagationStopped()){a.data=i;var b=o.apply(c,a._args==l?[a]:[a].concat(a._args));return b===!1&&(a.preventDefault(),a.stopPropagation()),b}},e.i=p.length,p.push(e),"addEventListener"in c&&c.addEventListener(g(e.e),e.proxy,f(e,n))})}function i(a,d,e,h,i){var j=b(a);(d||"").split(/\s/).forEach(function(b){c(a,b,e,h).forEach(function(b){delete q[j][b.i],"removeEventListener"in a&&a.removeEventListener(g(b.e),b.proxy,f(b,i))})})}function j(b,c){return(c||!b.isDefaultPrevented)&&(c||(c=b),a.each(y,function(a,d){var e=c[a];b[a]=function(){return this[d]=v,e&&e.apply(c,arguments)},b[d]=w}),(c.defaultPrevented!==l?c.defaultPrevented:"returnValue"in c?c.returnValue===!1:c.getPreventDefault&&c.getPreventDefault())&&(b.isDefaultPrevented=v)),b}function k(a){var b,c={originalEvent:a};for(b in a)x.test(b)||a[b]===l||(c[b]=a[b]);return j(c,a)}var l,m=1,n=Array.prototype.slice,o=a.isFunction,p=function(a){return"string"==typeof a},q={},r={},s="onfocusin"in window,t={focus:"focusin",blur:"focusout"},u={mouseenter:"mouseover",mouseleave:"mouseout"};r.click=r.mousedown=r.mouseup=r.mousemove="MouseEvents",a.event={add:h,remove:i},a.proxy=function(c,d){if(o(c)){var e=function(){return c.apply(d,arguments)};return e._zid=b(c),e}if(p(d))return a.proxy(c[d],c);throw new TypeError("expected function")},a.fn.bind=function(a,b,c){return this.on(a,b,c)},a.fn.unbind=function(a,b){return this.off(a,b)},a.fn.one=function(a,b,c,d){return this.on(a,b,c,d,1)};var v=function(){return!0},w=function(){return!1},x=/^([A-Z]|returnValue$|layer[XY]$)/,y={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};a.fn.delegate=function(a,b,c){return this.on(b,a,c)},a.fn.undelegate=function(a,b,c){return this.off(b,a,c)},a.fn.live=function(b,c){return a(document.body).delegate(this.selector,b,c),this},a.fn.die=function(b,c){return a(document.body).undelegate(this.selector,b,c),this},a.fn.on=function(b,c,d,e,f){var g,j,m=this;return b&&!p(b)?(a.each(b,function(a,b){m.on(a,c,d,b,f)}),m):(p(c)||o(e)||e===!1||(e=d,d=c,c=l),(o(d)||d===!1)&&(e=d,d=l),e===!1&&(e=w),m.each(function(l,m){f&&(g=function(a){return i(m,a.type,e),e.apply(this,arguments)}),c&&(j=function(b){var d,f=a(b.target).closest(c,m).get(0);return f&&f!==m?(d=a.extend(k(b),{currentTarget:f,liveFired:m}),(g||e).apply(f,[d].concat(n.call(arguments,1)))):void 0}),h(m,b,e,d,c,j||g)}))},a.fn.off=function(b,c,d){var e=this;return b&&!p(b)?(a.each(b,function(a,b){e.off(a,c,b)}),e):(p(c)||o(d)||d===!1||(d=c,c=l),d===!1&&(d=w),e.each(function(){i(this,b,d,c)}))},a.fn.trigger=function(b,c){return b=p(b)||a.isPlainObject(b)?a.Event(b):j(b),b._args=c,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(b):a(this).triggerHandler(b,c)})},a.fn.triggerHandler=function(b,d){var e,f;return this.each(function(g,h){e=k(p(b)?a.Event(b):b),e._args=d,e.target=h,a.each(c(h,b.type||b),function(a,b){return f=b.proxy(e),e.isImmediatePropagationStopped()?!1:void 0})}),f},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(b){a.fn[b]=function(a){return a?this.bind(b,a):this.trigger(b)}}),["focus","blur"].forEach(function(b){a.fn[b]=function(a){return a?this.bind(b,a):this.each(function(){try{this[b]()}catch(a){}}),this}}),a.Event=function(a,b){p(a)||(b=a,a=b.type);var c=document.createEvent(r[a]||"Events"),d=!0;if(b)for(var e in b)"bubbles"==e?d=!!b[e]:c[e]=b[e];return c.initEvent(a,d,!0),j(c)}}(Zepto),function(a){function b(b,c,d){var e=a.Event(c);return a(b).trigger(e,d),!e.isDefaultPrevented()}function c(a,c,d,e){return a.global?b(c||s,d,e):void 0}function d(b){b.global&&0===a.active++&&c(b,null,"ajaxStart")}function e(b){b.global&&!--a.active&&c(b,null,"ajaxStop")}function f(a,b){var d=b.context;return b.beforeSend.call(d,a,b)===!1||c(b,d,"ajaxBeforeSend",[a,b])===!1?!1:void c(b,d,"ajaxSend",[a,b])}function g(a,b,d,e){var f=d.context,g="success";d.success.call(f,a,g,b),e&&e.resolveWith(f,[a,g,b]),c(d,f,"ajaxSuccess",[b,d,a]),i(g,b,d)}function h(a,b,d,e,f){var g=e.context;e.error.call(g,d,b,a),f&&f.rejectWith(g,[d,b,a]),c(e,g,"ajaxError",[d,e,a||b]),i(b,d,e)}function i(a,b,d){var f=d.context;d.complete.call(f,b,a),c(d,f,"ajaxComplete",[b,d]),e(d)}function j(){}function k(a){return a&&(a=a.split(";",2)[0]),a&&(a==x?"html":a==w?"json":u.test(a)?"script":v.test(a)&&"xml")||"text"}function l(a,b){return""==b?a:(a+"&"+b).replace(/[&?]{1,2}/,"?")}function m(b){b.processData&&b.data&&"string"!=a.type(b.data)&&(b.data=a.param(b.data,b.traditional)),!b.data||b.type&&"GET"!=b.type.toUpperCase()||(b.url=l(b.url,b.data),b.data=void 0)}function n(b,c,d,e){return a.isFunction(c)&&(e=d,d=c,c=void 0),a.isFunction(d)||(e=d,d=void 0),{url:b,data:c,success:d,dataType:e}}function o(b,c,d,e){var f,g=a.isArray(c),h=a.isPlainObject(c);a.each(c,function(c,i){f=a.type(i),e&&(c=d?e:e+"["+(h||"object"==f||"array"==f?c:"")+"]"),!e&&g?b.add(i.name,i.value):"array"==f||!d&&"object"==f?o(b,i,d,c):b.add(c,i)})}var p,q,r=0,s=window.document,t=/)<[^<]*)*<\/script>/gi,u=/^(?:text|application)\/javascript/i,v=/^(?:text|application)\/xml/i,w="application/json",x="text/html",y=/^\s*$/;a.active=0,a.ajaxJSONP=function(b,c){if(!("type"in b))return a.ajax(b);var d,e,i=b.jsonpCallback,j=(a.isFunction(i)?i():i)||"jsonp"+ ++r,k=s.createElement("script"),l=window[j],m=function(b){a(k).triggerHandler("error",b||"abort")},n={abort:m};return c&&c.promise(n),a(k).on("load error",function(f,i){clearTimeout(e),a(k).off().remove(),"error"!=f.type&&d?g(d[0],n,b,c):h(null,i||"error",n,b,c),window[j]=l,d&&a.isFunction(l)&&l(d[0]),l=d=void 0}),f(n,b)===!1?(m("abort"),n):(window[j]=function(){d=arguments},k.src=b.url.replace(/\?(.+)=\?/,"?$1="+j),s.head.appendChild(k),b.timeout>0&&(e=setTimeout(function(){m("timeout")},b.timeout)),n)},a.ajaxSettings={type:"GET",beforeSend:j,success:j,error:j,complete:j,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:w,xml:"application/xml, text/xml",html:x,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},a.ajax=function(b){var c=a.extend({},b||{}),e=a.Deferred&&a.Deferred();for(p in a.ajaxSettings)void 0===c[p]&&(c[p]=a.ajaxSettings[p]);d(c),c.crossDomain||(c.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(c.url)&&RegExp.$2!=window.location.host),c.url||(c.url=window.location.toString()),m(c),c.cache===!1&&(c.url=l(c.url,"_="+Date.now()));var i=c.dataType,n=/\?.+=\?/.test(c.url);if("jsonp"==i||n)return n||(c.url=l(c.url,c.jsonp?c.jsonp+"=?":c.jsonp===!1?"":"callback=?")),a.ajaxJSONP(c,e);var o,r=c.accepts[i],s={},t=function(a,b){s[a.toLowerCase()]=[a,b]},u=/^([\w-]+:)\/\//.test(c.url)?RegExp.$1:window.location.protocol,v=c.xhr(),w=v.setRequestHeader;if(e&&e.promise(v),c.crossDomain||t("X-Requested-With","XMLHttpRequest"),t("Accept",r||"*/*"),(r=c.mimeType||r)&&(r.indexOf(",")>-1&&(r=r.split(",",2)[0]),v.overrideMimeType&&v.overrideMimeType(r)),(c.contentType||c.contentType!==!1&&c.data&&"GET"!=c.type.toUpperCase())&&t("Content-Type",c.contentType||"application/x-www-form-urlencoded"),c.headers)for(q in c.headers)t(q,c.headers[q]);if(v.setRequestHeader=t,v.onreadystatechange=function(){if(4==v.readyState){v.onreadystatechange=j,clearTimeout(o);var b,d=!1;if(v.status>=200&&v.status<300||304==v.status||0==v.status&&"file:"==u){i=i||k(c.mimeType||v.getResponseHeader("content-type")),b=v.responseText;try{"script"==i?(1,eval)(b):"xml"==i?b=v.responseXML:"json"==i&&(b=y.test(b)?null:a.parseJSON(b))}catch(f){d=f}d?h(d,"parsererror",v,c,e):g(b,v,c,e)}else h(v.statusText||null,v.status?"error":"abort",v,c,e)}},f(v,c)===!1)return v.abort(),h(null,"abort",v,c,e),v;if(c.xhrFields)for(q in c.xhrFields)v[q]=c.xhrFields[q];var x="async"in c?c.async:!0;v.open(c.type,c.url,x,c.username,c.password);for(q in s)w.apply(v,s[q]);return c.timeout>0&&(o=setTimeout(function(){v.onreadystatechange=j,v.abort(),h(null,"timeout",v,c,e)},c.timeout)),v.send(c.data?c.data:null),v},a.get=function(){return a.ajax(n.apply(null,arguments))},a.post=function(){var b=n.apply(null,arguments);return b.type="POST",a.ajax(b)},a.getJSON=function(){var b=n.apply(null,arguments);return b.dataType="json",a.ajax(b)},a.fn.load=function(b,c,d){if(!this.length)return this;var e,f=this,g=b.split(/\s/),h=n(b,c,d),i=h.success;return g.length>1&&(h.url=g[0],e=g[1]),h.success=function(b){f.html(e?a("
        ").html(b.replace(t,"")).find(e):b),i&&i.apply(f,arguments)},a.ajax(h),this};var z=encodeURIComponent;a.param=function(a,b){var c=[];return c.add=function(a,b){this.push(z(a)+"="+z(b))},o(c,a,b),c.join("&").replace(/%20/g,"+")}}(Zepto),function(a){a.fn.serializeArray=function(){var b,c=[];return a([].slice.call(this.get(0).elements)).each(function(){b=a(this);var d=b.attr("type");"fieldset"!=this.nodeName.toLowerCase()&&!this.disabled&&"submit"!=d&&"reset"!=d&&"button"!=d&&("radio"!=d&&"checkbox"!=d||this.checked)&&c.push({name:b.attr("name"),value:b.val()})}),c},a.fn.serialize=function(){var a=[];return this.serializeArray().forEach(function(b){a.push(encodeURIComponent(b.name)+"="+encodeURIComponent(b.value))}),a.join("&")},a.fn.submit=function(b){if(b)this.bind("submit",b);else if(this.length){var c=a.Event("submit");this.eq(0).trigger(c),c.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(a){function b(a,b,c,d){return Math.abs(a-b)>=Math.abs(c-d)?a-b>0?"Left":"Right":c-d>0?"Up":"Down"}function c(){k=null,m.last&&(m.el.trigger("longTap"),m={})}function d(){k&&clearTimeout(k),k=null}function e(){h&&clearTimeout(h),i&&clearTimeout(i),j&&clearTimeout(j),k&&clearTimeout(k),h=i=j=k=null,m={}}function f(a){return("touch"==a.pointerType||a.pointerType==a.MSPOINTER_TYPE_TOUCH)&&a.isPrimary}function g(a,b){return a.type=="pointer"+b||a.type.toLowerCase()=="mspointer"+b}var h,i,j,k,l,m={},n=750;a(document).ready(function(){var o,p,q,r,s=0,t=0;"MSGesture"in window&&(l=new MSGesture,l.target=document.body),a(document).bind("MSGestureEnd",function(a){var b=a.velocityX>1?"Right":a.velocityX<-1?"Left":a.velocityY>1?"Down":a.velocityY<-1?"Up":null;b&&(m.el.trigger("swipe"),m.el.trigger("swipe"+b))}).on("touchstart MSPointerDown pointerdown",function(b){(!(r=g(b,"down"))||f(b))&&(q=r?b:b.touches[0],b.touches&&1===b.touches.length&&m.x2&&(m.x2=void 0,m.y2=void 0),o=Date.now(),p=o-(m.last||o),m.el=a("tagName"in q.target?q.target:q.target.parentNode),h&&clearTimeout(h),m.x1=q.pageX,m.y1=q.pageY,p>0&&250>=p&&(m.isDoubleTap=!0),m.last=o,k=setTimeout(c,n),l&&r&&l.addPointer(b.pointerId))}).on("touchmove MSPointerMove pointermove",function(a){(!(r=g(a,"move"))||f(a))&&(q=r?a:a.touches[0],d(),m.x2=q.pageX,m.y2=q.pageY,s+=Math.abs(m.x1-m.x2),t+=Math.abs(m.y1-m.y2))}).on("touchend MSPointerUp pointerup",function(c){(!(r=g(c,"up"))||f(c))&&(d(),m.x2&&Math.abs(m.x1-m.x2)>30||m.y2&&Math.abs(m.y1-m.y2)>30?j=setTimeout(function(){m.el.trigger("swipe"),m.el.trigger("swipe"+b(m.x1,m.x2,m.y1,m.y2)),m={}},0):"last"in m&&(30>s&&30>t?i=setTimeout(function(){var b=a.Event("tap");b.cancelTouch=e,m.el.trigger(b),m.isDoubleTap?(m.el&&m.el.trigger("doubleTap"),m={}):h=setTimeout(function(){h=null,m.el&&m.el.trigger("singleTap"),m={}},250)},0):m={}),s=t=0)}).on("touchcancel MSPointerCancel pointercancel",e),a(window).on("scroll",e)}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(b){a.fn[b]=function(a){return this.on(b,a)}})}(Zepto),function(a){function b(b){return b=a(b),!(!b.width()&&!b.height())&&"none"!==b.css("display")}function c(a,b){a=a.replace(/=#\]/g,'="#"]');var c,d,e=h.exec(a);if(e&&e[2]in g&&(c=g[e[2]],d=e[3],a=e[1],d)){var f=Number(d);d=isNaN(f)?d.replace(/^["']|["']$/g,""):f}return b(a,c,d)}var d=a.zepto,e=d.qsa,f=d.matches,g=a.expr[":"]={visible:function(){return b(this)?this:void 0},hidden:function(){return b(this)?void 0:this},selected:function(){return this.selected?this:void 0},checked:function(){return this.checked?this:void 0},parent:function(){return this.parentNode},first:function(a){return 0===a?this:void 0},last:function(a,b){return a===b.length-1?this:void 0},eq:function(a,b,c){return a===c?this:void 0},contains:function(b,c,d){return a(this).text().indexOf(d)>-1?this:void 0},has:function(a,b,c){return d.qsa(this,c).length?this:void 0}},h=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),i=/^\s*>/,j="Zepto"+ +new Date;d.qsa=function(b,f){return c(f,function(c,g,h){try{var k;!c&&g?c="*":i.test(c)&&(k=a(b).addClass(j),c="."+j+" "+c);var l=e(b,c)}catch(m){throw console.error("error performing selector: %o",f),m}finally{k&&k.removeClass(j)}return g?d.uniq(a.map(l,function(a,b){return g.call(a,b,l,h)})):l})},d.matches=function(a,b){return c(b,function(b,c,d){return!(b&&!f(a,b)||c&&c.call(a,null,d)!==a)})}}(Zepto),function(a,b){function c(a){return a.replace(/([a-z])([A-Z])/,"$1-$2").toLowerCase()}function d(a){return e?e+a:a.toLowerCase()}var e,f,g,h,i,j,k,l,m,n,o="",p={Webkit:"webkit",Moz:"",O:"o"},q=window.document,r=q.createElement("div"),s=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,t={};a.each(p,function(a,c){return r.style[a+"TransitionProperty"]!==b?(o="-"+a.toLowerCase()+"-",e=c,!1):void 0}),f=o+"transform",t[g=o+"transition-property"]=t[h=o+"transition-duration"]=t[j=o+"transition-delay"]=t[i=o+"transition-timing-function"]=t[k=o+"animation-name"]=t[l=o+"animation-duration"]=t[n=o+"animation-delay"]=t[m=o+"animation-timing-function"]="",a.fx={off:e===b&&r.style.transitionProperty===b,speeds:{_default:400,fast:200,slow:600},cssPrefix:o,transitionEnd:d("TransitionEnd"),animationEnd:d("AnimationEnd")},a.fn.animate=function(c,d,e,f,g){return a.isFunction(d)&&(f=d,e=b,d=b),a.isFunction(e)&&(f=e,e=b),a.isPlainObject(d)&&(e=d.easing,f=d.complete,g=d.delay,d=d.duration),d&&(d=("number"==typeof d?d:a.fx.speeds[d]||a.fx.speeds._default)/1e3),g&&(g=parseFloat(g)/1e3),this.anim(c,d,e,f,g)},a.fn.anim=function(d,e,o,p,q){var r,u,v,w={},x="",y=this,z=a.fx.transitionEnd,A=!1;if(e===b&&(e=a.fx.speeds._default/1e3),q===b&&(q=0),a.fx.off&&(e=0),"string"==typeof d)w[k]=d,w[l]=e+"s",w[n]=q+"s",w[m]=o||"linear",z=a.fx.animationEnd;else{u=[];for(r in d)s.test(r)?x+=r+"("+d[r]+") ":(w[r]=d[r],u.push(c(r)));x&&(w[f]=x,u.push(f)),e>0&&"object"==typeof d&&(w[g]=u.join(", "),w[h]=e+"s",w[j]=q+"s",w[i]=o||"linear")}return v=function(b){if("undefined"!=typeof b){if(b.target!==b.currentTarget)return;a(b.target).unbind(z,v)}else a(this).unbind(z,v);A=!0,a(this).css(t),p&&p.call(this)},e>0&&(this.bind(z,v),setTimeout(function(){A||v.call(y)},1e3*e+25)),this.size()&&this.get(0).clientLeft,this.css(w),0>=e&&setTimeout(function(){y.each(function(){v.call(this)})},0),this},r=null}(Zepto),function(a,b){function c(c,d,e,f,g){"function"!=typeof d||g||(g=d,d=b);var h={opacity:e};return f&&(h.scale=f,c.css(a.fx.cssPrefix+"transform-origin","0 0")),c.animate(h,d,null,g)}function d(b,d,e,f){return c(b,d,0,e,function(){g.call(a(this)),f&&f.call(this)})}var e=window.document,f=(e.documentElement,a.fn.show),g=a.fn.hide,h=a.fn.toggle;a.fn.show=function(a,d){return f.call(this),a===b?a=0:this.css("opacity",0),c(this,a,1,"1,1",d)},a.fn.hide=function(a,c){return a===b?g.call(this):d(this,a,"0,0",c)},a.fn.toggle=function(c,d){return c===b||"boolean"==typeof c?h.call(this,c):this.each(function(){var b=a(this);b["none"==b.css("display")?"show":"hide"](c,d)})},a.fn.fadeTo=function(a,b,d){return c(this,a,b,null,d)},a.fn.fadeIn=function(a,b){var c=this.css("opacity");return c>0?this.css("opacity",0):c=1,f.call(this).fadeTo(a,c,b)},a.fn.fadeOut=function(a,b){return d(this,a,null,b)},a.fn.fadeToggle=function(b,c){return this.each(function(){var d=a(this);d[0==d.css("opacity")||"none"==d.css("display")?"fadeIn":"fadeOut"](b,c)})}}(Zepto); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jdate", 3 | "version": "0.1.0", 4 | "devDependencies": { 5 | "grunt": "~0.4.2", 6 | "grunt-contrib-cssmin": "~0.7.0", 7 | "grunt-contrib-uglify": "~0.2.7", 8 | "grunt-contrib-watch": "^0.6.1", 9 | "grunt-contrib-copy": "^0.5.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /readme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iancj/jDate/96b7de55e19bc2d8f986ce12a667db66a3bd2f56/readme.png --------------------------------------------------------------------------------