initial commit
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
/*!
|
||||
* datepair.js v0.4.15 - A javascript plugin for intelligently selecting date and time ranges inspired by Google Calendar.
|
||||
* Copyright (c) 2016 Jon Thornton - http://jonthornton.github.com/Datepair.js
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
if(!$) {
|
||||
return;
|
||||
}
|
||||
|
||||
////////////
|
||||
// Plugin //
|
||||
////////////
|
||||
|
||||
$.fn.datepair = function(option) {
|
||||
var out;
|
||||
this.each(function() {
|
||||
var $this = $(this);
|
||||
var data = $this.data('datepair');
|
||||
var options = typeof option === 'object' && option;
|
||||
|
||||
if (!data) {
|
||||
data = new Datepair(this, options);
|
||||
$this.data('datepair', data);
|
||||
}
|
||||
|
||||
if (option === 'remove') {
|
||||
out = data['remove']();
|
||||
$this.removeData('datepair', data);
|
||||
}
|
||||
|
||||
if (typeof option === 'string') {
|
||||
out = data[option]();
|
||||
}
|
||||
});
|
||||
|
||||
return out || this;
|
||||
};
|
||||
|
||||
//////////////
|
||||
// Data API //
|
||||
//////////////
|
||||
|
||||
$('[data-datepair]').each(function() {
|
||||
var $this = $(this);
|
||||
$this.datepair($this.data());
|
||||
});
|
||||
|
||||
}(window.Zepto || window.jQuery));
|
||||
Reference in New Issue
Block a user