1/*! 2 * datepair.js v0.4.15 - A javascript plugin for intelligently selecting date and time ranges inspired by Google Calendar. 3 * Copyright (c) 2016 Jon Thornton - http://jonthornton.github.com/Datepair.js 4 * License: MIT 5 */ 6 7(function(jQuery) { 8 9 if(!jQuery) { 10 return; 11 } 12 13 //////////// 14 // Plugin // 15 //////////// 16 17 jQuery.fn.datepair = function(option) { 18 var out; 19 this.each(function() { 20 var $this = jQuery(this); 21 var data = $this.data('datepair'); 22 var options = typeof option === 'object' && option; 23 24 if (!data) { 25 data = new Datepair(this, options); 26 $this.data('datepair', data); 27 } 28 29 if (option === 'remove') { 30 out = data['remove'](); 31 $this.removeData('datepair', data); 32 } 33 34 if (typeof option === 'string') { 35 out = data[option](); 36 } 37 }); 38 39 return out || this; 40 }; 41 42 ////////////// 43 // Data API // 44 ////////////// 45 46 jQuery('[data-datepair]').each(function() { 47 var $this = jQuery(this); 48 $this.datepair($this.data()); 49 }); 50 51}(window.Zepto || window.jQuery)); 52