/** * Copyright 2012-2026 ShopeX (https://www.shopex.cn) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /*! mobile-select-date v1.0.0 * author:tianxiangbing email:55342775@qq.com * demo:http://www.lovewebgames.com/jsmodule/mobile-select-date.html * git:https://github.com/tianxiangbing/mobile-select-date 2016-08-12 */ !function(a,b){"function"==typeof define&&define.amd?define(["$"],b):"object"==typeof exports?module.exports=b():a.MobileSelectDate=b(window.Zepto||window.jQuery||$)}(this,function(a){var b=function(){var a=Math.random().toString().replace(".","");this.id="scroller_"+a,this.scroller,this.data,this.index=0,this.value=[0,0,0],this.oldvalue,this.oldtext,this.text=["","",""],this.level=3,this.mtop=30,this.separator=" "};return b.prototype={init:function(b){this.settings=a.extend({},b),this.separator="/";var c=new Date;this.settings.value=this.settings.value||a(this.settings.trigger).val()||c.getFullYear()+"/"+("0"+(c.getMonth()+1)).slice(-2)+"/"+("0"+c.getDate()).slice(-2),this.settings.value=this.settings.value.replace(/\//g,","),this.settings.text=this.settings.value.split(","),void 0==this.settings.default?this.default=1:this.default=0,this.trigger=a(this.settings.trigger),this.trigger.attr("readonly","readonly"),this.value=this.settings.value&&this.settings.value.split(",")||[0,0,0],this.text=this.settings.text||this.trigger.val().split(" ")||["","",""],this.oldvalue=this.value.concat([]),this.oldtext=this.text.concat([]),this.min=new Date(this.settings.min||"1900/01/01"),this.settings.max?this.max=new Date(this.settings.max):this.max=new Date,this.getData(),this.bindEvent()},getData:function(){for(var a=[],b=this.min.getFullYear(),c=this.max.getFullYear();b<=c;b++){var d={};d.id=d.name=b,d.child=[];for(var e=1;e<=12;e++){var f={};f.id=f.name=("0"+e).slice(-2),f.child=[];for(var g=new Date(b,e,0).getDate(),h=1;h<=g;h++){var i={};i.id=i.name=("0"+h).slice(-2),e==this.max.getMonth()+1&&b==this.max.getFullYear()&&h>this.max.getDate()||f.child.push(i)}e>this.max.getMonth()+1&&b==this.max.getFullYear()||d.child.push(f)}a.push(d)}this.data=a},bindEvent:function(){var b=this;this.trigger.click(function(c){var d,e;if("bottom"==b.settings.position){d={position:"bottom",width:"100%",className:"ui-dialog-bottom",animate:!1};var e=[{no:"取消"},{yes:"确定"}]}a.confirm('