Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Commit

Permalink
third party library updates and some code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kalepail committed Jun 28, 2017
1 parent 89e0e22 commit 2435365
Show file tree
Hide file tree
Showing 10 changed files with 3,048 additions and 69 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ new Calendar({
- **days_array** `[array]`
- Array of the 7 strings you'd like to represent your days in the calendar
```js
days_array: ['Su','Mo','Tu','We','Th','Fr','Sa']
days_array: ['S','M','T','W','T','F','S']
```

### Single Calendar Params
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "BaremetricsCalendar",
"version": "1.0.10",
"version": "1.0.11",
"homepage": "https://github.com/Baremetrics/calendar",
"authors": [
"Tyler van der Hoeven <[email protected]>"
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.11 Update
- Third party library updates
- Typos and code formatting. Because I'm paranoid

## 1.0.10 Update
- Better iOS support. The date inputs are no longer editable. Having a keyboard popup for editing dates was a lot slower then just tapping stuff. So we cut it. Thanks [azaytsev-csr](https://github.com/azaytsev-csr)!
- Minor tweaks and outlier bug fixes Thanks [Paul Ryan](https://github.com/paullryan)!
Expand Down
58 changes: 30 additions & 28 deletions dev/js/Calendar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';


(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
Expand Down Expand Up @@ -331,7 +332,7 @@
// Today
if (d === 'today' || d === 'now')
return moment().isAfter(this.latest_date) ? this.latest_date :
moment().isBefore(this.earliest_date) ? this.earliest_date : moment();
moment().isBefore(this.earliest_date) ? this.earliest_date : moment();

// Earliest
if (d === 'earliest')
Expand Down Expand Up @@ -563,20 +564,20 @@
}
});

if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
$('.dr-day', this.element).on({
touchstart: function() {
selectOneDate(other, self, $(this).data('date'));
}
});
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
$('.dr-day', this.element).on({
touchstart: function() {
self.selectOneDate(other, self, $(this).data('date'));
}
});

$('div[contenteditable]', this.element).removeAttr('contenteditable');
$('div[contenteditable]', this.element).removeAttr('contenteditable');
} else {
$('.dr-day', this.element).on({
mousedown: function () {
selectOneDate(other, self, $(this).data('date'));
}
});
$('.dr-day', this.element).on({
mousedown: function () {
self.selectOneDate(other, self, $(this).data('date'));
}
});
}

$('.dr-calendar', this.element)
Expand Down Expand Up @@ -760,24 +761,25 @@
return range;
}

function selectOneDate(other, cal, date) {
var string = moment(date).format(cal.format.input);

if (other) {
$('.dr-date', cal.element)
.not(cal.selected)
.html(other.format(cal.format.input));
}
Calendar.prototype.selectOneDate = function(other, cal, date) {
var string = moment(date).format(cal.format.input);

$(cal.selected).html(string);
cal.calendarOpen(cal.selected);
if (other) {
$('.dr-date', cal.element)
.not(cal.selected)
.html(other.format(cal.format.input));
}

if ($(cal.selected).hasClass('dr-date-start')) {
$('.dr-date-end', cal.element).trigger('click');
} else {
cal.calendarSaveDates();
cal.calendarClose('force');
}
$(cal.selected).html(string);
cal.calendarOpen(cal.selected);

if ($(cal.selected).hasClass('dr-date-start')) {
$('.dr-date-end', cal.element).trigger('click');
} else {
cal.calendarSaveDates();
cal.calendarClose('force');
}
}


Expand Down
4 changes: 2 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var gulp = require('gulp'),
ghPages = require('gulp-gh-pages'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
cleancss = require('gulp-clean-css'),
uglify = require('gulp-uglify'),
livereload = require('gulp-livereload'),
newer = require('gulp-newer');
Expand All @@ -15,7 +15,7 @@ gulp.task('css', function() {
.pipe(sass())
.on('error', handleError)
.pipe(autoprefixer({cascade: false, browsers: ['last 10 versions']})) // auto prefix
.pipe(minifycss()) // minify everything
.pipe(cleancss()) // minify everything
.pipe(gulp.dest('public/css'));
});

Expand Down
Loading

0 comments on commit 2435365

Please sign in to comment.