bulma-extensions
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -5,2 +5,6 @@ # bulma-badge | ||
[![npm](https://img.shields.io/npm/v/bulma-badge.svg)](https://www.npmjs.com/package/bulma-badge) | ||
[![npm](https://img.shields.io/npm/dm/bulma-badge.svg)](https://www.npmjs.com/package/bulma-badge) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-badge.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-badge) | ||
<img src="https://img15.hostingpics.net/pics/241524ScreenShot20170726at124229.png" width="50%"> | ||
@@ -7,0 +11,0 @@ |
@@ -6,6 +6,6 @@ var datepicker_langs = { | ||
nextMonth: 'Next Month', | ||
months: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ], | ||
monthsShort : [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ], | ||
weekdays: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ], | ||
weekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ] | ||
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], | ||
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], | ||
weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], | ||
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] | ||
}, | ||
@@ -16,6 +16,15 @@ fr: { | ||
nextMonth: 'Mois suivant', | ||
months: [ 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre' ], | ||
monthsShort : [ 'Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Auo', 'Sep', 'Oct', 'Nov', 'Déc' ], | ||
weekdays: [ 'Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi' ], | ||
weekdaysShort: [ 'Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam' ] | ||
months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], | ||
monthsShort: ['Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Auo', 'Sep', 'Oct', 'Nov', 'Déc'], | ||
weekdays: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'], | ||
weekdaysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'] | ||
}, | ||
de: { | ||
weekStart: 1, | ||
previousMonth: 'Vorheriger Monat', | ||
nextMonth: 'Nächster Monat', | ||
months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], | ||
monthsShort: ['Jan', 'Febr', 'März', 'Apr', 'Mai', 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dez'], | ||
weekdays: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], | ||
weekdaysShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'] | ||
} | ||
@@ -25,4 +34,4 @@ } | ||
class DatePicker { | ||
constructor( selector, options ) { | ||
if ( !options ) options = {} | ||
constructor(selector, options) { | ||
if (!options) options = {} | ||
@@ -44,17 +53,17 @@ var defaultOptions = { | ||
this.element = typeof selector === 'string' ? document.querySelector( selector ) : selector; | ||
this.element = typeof selector === 'string' ? document.querySelector(selector) : selector; | ||
// An invalid selector or non-DOM node has been provided. | ||
if ( !this.element ) { | ||
throw new Error( 'An invalid selector or non-DOM node has been provided.' ); | ||
if (!this.element) { | ||
throw new Error('An invalid selector or non-DOM node has been provided.'); | ||
} | ||
this.parent = this.element.parentElement; | ||
this.lang = typeof datepicker_langs[ this.lang ] !== 'undefined' ? this.lang : 'en'; | ||
this.lang = typeof datepicker_langs[this.lang] !== 'undefined' ? this.lang : 'en'; | ||
this.options = Object.assign( {}, defaultOptions, options ); | ||
this.options = Object.assign({}, defaultOptions, options); | ||
this.month = this.options.startDate.getMonth(), | ||
this.year = this.options.startDate.getFullYear(), | ||
this.open = false; | ||
this.year = this.options.startDate.getFullYear(), | ||
this.open = false; | ||
@@ -67,24 +76,24 @@ this.build(); | ||
this.datePickerContainer = document.createElement( 'div' ); | ||
this.datePickerContainer = document.createElement('div'); | ||
this.datePickerContainer.id = 'datePicker' + ( new Date ).getTime(); | ||
this.datePickerContainer.classList.add( 'datepicker' ); | ||
this.datePickerContainer.classList.add('datepicker'); | ||
this.calendarContainer = document.createElement( 'div' ); | ||
this.calendarContainer = document.createElement('div'); | ||
this.calendarContainer.id = 'datePicker' + ( new Date ).getTime(); | ||
this.calendarContainer.classList.add( 'calendar' ); | ||
this.calendarContainer.classList.add('calendar'); | ||
this.renderCalendar(); | ||
if ( this.options.overlay ) { | ||
var datePickerOverlay = document.createElement( 'div' ); | ||
datePickerOverlay.classList.add( 'is-overlay' ); | ||
this.datePickerContainer.appendChild( datePickerOverlay ); | ||
if (this.options.overlay) { | ||
var datePickerOverlay = document.createElement('div'); | ||
datePickerOverlay.classList.add('is-overlay'); | ||
this.datePickerContainer.appendChild(datePickerOverlay); | ||
} | ||
this.datePickerContainer.appendChild( this.calendarContainer ); | ||
document.body.appendChild( this.datePickerContainer ); | ||
this.datePickerContainer.appendChild(this.calendarContainer); | ||
document.body.appendChild(this.datePickerContainer); | ||
this.element.addEventListener( 'click', function( e ) { | ||
this.element.addEventListener('click', function (e) { | ||
e.preventDefault(); | ||
if ( _this.open ) { | ||
if (_this.open) { | ||
_this.hide(); | ||
@@ -96,3 +105,3 @@ _this.open = false; | ||
} | ||
} ); | ||
}); | ||
} | ||
@@ -103,54 +112,54 @@ | ||
*/ | ||
renderDayName( day, abbr = false ) { | ||
day += datepicker_langs[ this.options.lang ].weekStart; | ||
while ( day >= 7 ) { | ||
renderDayName(day, abbr = false) { | ||
day += datepicker_langs[this.options.lang].weekStart; | ||
while (day >= 7) { | ||
day -= 7; | ||
} | ||
return abbr ? datepicker_langs[ this.options.lang ].weekdaysShort[ day ] : datepicker_langs[ this.options.lang ].weekdays[ day ]; | ||
return abbr ? datepicker_langs[this.options.lang].weekdaysShort[day] : datepicker_langs[this.options.lang].weekdays[day]; | ||
} | ||
renderDay( day, month, year, isSelected, isToday, isDisabled, isEmpty, isBetween, isSelectedIn, isSelectedOut ) { | ||
renderDay(day, month, year, isSelected, isToday, isDisabled, isEmpty, isBetween, isSelectedIn, isSelectedOut) { | ||
var _this = this; | ||
var newDayContainer = document.createElement( 'div' ); | ||
var newDay = document.createElement( 'div' ); | ||
var newDayButton = document.createElement( 'button' ); | ||
var newDayContainer = document.createElement('div'); | ||
var newDay = document.createElement('div'); | ||
var newDayButton = document.createElement('button'); | ||
newDayButton.classList.add( 'date-item' ); | ||
newDayButton.classList.add('date-item'); | ||
newDayButton.innerHTML = day; | ||
newDayButton.addEventListener( 'click', function( e ) { | ||
if ( typeof _this.options.onSelect != 'undefined' && | ||
_this.options.onSelect != null && | ||
_this.options.onSelect ) { | ||
_this.options.onSelect( new Date( year, month, day ) ); | ||
newDayButton.addEventListener('click', function (e) { | ||
if (typeof _this.options.onSelect != 'undefined' && | ||
_this.options.onSelect != null && | ||
_this.options.onSelect) { | ||
_this.options.onSelect(new Date(year, month, day)); | ||
} | ||
_this.element.value = _this.getFormatedDate( ( new Date( year, month, day ) ), _this.options.dataFormat ); | ||
if ( _this.options.closeOnSelect ) { | ||
_this.element.value = _this.getFormatedDate(( new Date(year, month, day) ), _this.options.dataFormat); | ||
if (_this.options.closeOnSelect) { | ||
_this.hide(); | ||
} | ||
} ); | ||
}); | ||
newDay.appendChild( newDayButton ); | ||
newDayContainer.classList.add( 'calendar-date' ); | ||
newDayContainer.appendChild( newDay ); | ||
newDay.appendChild(newDayButton); | ||
newDayContainer.classList.add('calendar-date'); | ||
newDayContainer.appendChild(newDay); | ||
newDay.classList.add( 'calendar-date' ); | ||
if ( isDisabled ) { | ||
newDayContainer.setAttribute( 'disabled', 'disabled' ); | ||
newDay.classList.add('calendar-date'); | ||
if (isDisabled) { | ||
newDayContainer.setAttribute('disabled', 'disabled'); | ||
} | ||
if ( isToday ) { | ||
newDayContainer.classList.add( 'is-today' ); | ||
if (isToday) { | ||
newDayContainer.classList.add('is-today'); | ||
} | ||
if ( isSelected ) { | ||
newDayContainer.classList.add( 'is-active' ); | ||
if (isSelected) { | ||
newDayContainer.classList.add('is-active'); | ||
} | ||
if ( isBetween ) { | ||
newDayContainer.classList.add( 'calendar-range' ); | ||
if (isBetween) { | ||
newDayContainer.classList.add('calendar-range'); | ||
} | ||
if ( isSelectedIn ) { | ||
newDayContainer.classList.add( 'range-start' ); | ||
if (isSelectedIn) { | ||
newDayContainer.classList.add('range-start'); | ||
} | ||
if ( isSelectedOut ) { | ||
newDayContainer.classList.add( 'range-end' ); | ||
if (isSelectedOut) { | ||
newDayContainer.classList.add('range-end'); | ||
} | ||
@@ -161,46 +170,74 @@ | ||
renderNav( year, month ) { | ||
renderNav(year, month) { | ||
var _this = this; | ||
var calendarNav = document.createElement( 'div' ); | ||
calendarNav.classList.add( 'calendar-nav' ); | ||
var calendarNav = document.createElement('div'); | ||
calendarNav.classList.add('calendar-nav'); | ||
var previousButtonContainer = document.createElement( 'div' ); | ||
previousButtonContainer.classList.add( 'calendar-nav-left' ); | ||
this.previousButton = document.createElement( 'div' ); | ||
this.previousButton.classList.add( 'button' ); | ||
this.previousButton.classList.add( 'is-link' ); | ||
var previousButtonIcon = document.createElement( 'i' ); | ||
previousButtonIcon.classList.add( 'fa' ); | ||
previousButtonIcon.classList.add( 'fa-chevron-left' ); | ||
this.previousButton.appendChild( previousButtonIcon ); | ||
this.previousButton.addEventListener( 'click', function( e ) { | ||
var previousButtonContainer = document.createElement('div'); | ||
previousButtonContainer.classList.add('calendar-nav-left'); | ||
this.previousYearButton = document.createElement('div'); | ||
this.previousYearButton.classList.add('button'); | ||
this.previousYearButton.classList.add('is-text'); | ||
var previousButtonIcon = document.createElement('i'); | ||
previousButtonIcon.classList.add('fa'); | ||
previousButtonIcon.classList.add('fa-backward'); | ||
this.previousYearButton.appendChild(previousButtonIcon); | ||
this.previousYearButton.addEventListener('click', function (e) { | ||
e.preventDefault(); | ||
_this.prevYear(); | ||
}); | ||
previousButtonContainer.appendChild(this.previousYearButton); | ||
this.previousMonthButton = document.createElement('div'); | ||
this.previousMonthButton.classList.add('button'); | ||
this.previousMonthButton.classList.add('is-text'); | ||
var previousMonthButtonIcon = document.createElement('i'); | ||
previousMonthButtonIcon.classList.add('fa'); | ||
previousMonthButtonIcon.classList.add('fa-chevron-left'); | ||
this.previousMonthButton.appendChild(previousMonthButtonIcon); | ||
this.previousMonthButton.addEventListener('click', function (e) { | ||
e.preventDefault(); | ||
_this.prevMonth(); | ||
} ); | ||
previousButtonContainer.appendChild( this.previousButton ); | ||
}); | ||
previousButtonContainer.appendChild(this.previousMonthButton); | ||
var calendarTitle = document.createElement( 'div' ); | ||
calendarTitle.innerHTML = datepicker_langs[ this.options.lang ].months[ month ] + ' ' + year; | ||
var nextButtonContainer = document.createElement( 'div' ); | ||
nextButtonContainer.classList.add( 'calendar-nav-right' ); | ||
this.nextButton = document.createElement( 'div' ); | ||
this.nextButton.classList.add( 'button' ); | ||
this.nextButton.classList.add( 'is-link' ); | ||
var nextButtonIcon = document.createElement( 'i' ); | ||
nextButtonIcon.classList.add( 'fa' ); | ||
nextButtonIcon.classList.add( 'fa-chevron-right' ); | ||
this.nextButton.appendChild( nextButtonIcon ); | ||
this.nextButton.addEventListener( 'click', function( e ) { | ||
var calendarTitle = document.createElement('div'); | ||
calendarTitle.innerHTML = datepicker_langs[this.options.lang].months[month] + ' ' + year; | ||
var nextButtonContainer = document.createElement('div'); | ||
nextButtonContainer.classList.add('calendar-nav-right'); | ||
this.nextMonthButton = document.createElement('div'); | ||
this.nextMonthButton.classList.add('button'); | ||
this.nextMonthButton.classList.add('is-text'); | ||
var nextMonthButtonIcon = document.createElement('i'); | ||
nextMonthButtonIcon.classList.add('fa'); | ||
nextMonthButtonIcon.classList.add('fa-chevron-right'); | ||
this.nextMonthButton.appendChild(nextMonthButtonIcon); | ||
this.nextMonthButton.addEventListener('click', function (e) { | ||
e.preventDefault(); | ||
_this.nextMonth(); | ||
} ); | ||
nextButtonContainer.appendChild( this.nextButton ); | ||
}); | ||
nextButtonContainer.appendChild(this.nextMonthButton); | ||
this.nextYearButton = document.createElement('div'); | ||
this.nextYearButton.classList.add('button'); | ||
this.nextYearButton.classList.add('is-text'); | ||
var nextYearButtonIcon = document.createElement('i'); | ||
nextYearButtonIcon.classList.add('fa'); | ||
nextYearButtonIcon.classList.add('fa-forward'); | ||
this.nextYearButton.appendChild(nextYearButtonIcon); | ||
this.nextYearButton.addEventListener('click', function (e) { | ||
e.preventDefault(); | ||
calendarNav.appendChild( previousButtonContainer ); | ||
calendarNav.appendChild( calendarTitle ); | ||
calendarNav.appendChild( nextButtonContainer ); | ||
_this.nextYear(); | ||
}); | ||
nextButtonContainer.appendChild(this.nextYearButton); | ||
calendarNav.appendChild(previousButtonContainer); | ||
calendarNav.appendChild(calendarTitle); | ||
calendarNav.appendChild(nextButtonContainer); | ||
return calendarNav; | ||
@@ -210,10 +247,10 @@ } | ||
renderHeader() { | ||
var calendarHeader = document.createElement( 'div' ); | ||
calendarHeader.classList.add( 'calendar-header' ); | ||
var calendarHeader = document.createElement('div'); | ||
calendarHeader.classList.add('calendar-header'); | ||
for( var i = 0; i < 7; i++ ) { | ||
var newDay = document.createElement( 'div' ); | ||
newDay.classList.add( 'calendar-date' ); | ||
newDay.innerHTML = this.renderDayName( i, true ); | ||
calendarHeader.appendChild( newDay ); | ||
for (var i = 0; i < 7; i++) { | ||
var newDay = document.createElement('div'); | ||
newDay.classList.add('calendar-date'); | ||
newDay.innerHTML = this.renderDayName(i, true); | ||
calendarHeader.appendChild(newDay); | ||
} | ||
@@ -225,4 +262,4 @@ | ||
renderBody() { | ||
var calendarBody = document.createElement( 'div' ); | ||
calendarBody.classList.add( 'calendar-body' ); | ||
var calendarBody = document.createElement('div'); | ||
calendarBody.classList.add('calendar-body'); | ||
@@ -235,22 +272,22 @@ return calendarBody; | ||
var calendarNav = this.renderNav( this.year, this.month ); | ||
var calendarNav = this.renderNav(this.year, this.month); | ||
var calendarHeader = this.renderHeader(); | ||
var calendarBody = this.renderBody(); | ||
this.calendarContainer.appendChild( calendarNav ); | ||
this.calendarContainer.appendChild( calendarHeader ); | ||
this.calendarContainer.appendChild( calendarBody ); | ||
this.calendarContainer.appendChild(calendarNav); | ||
this.calendarContainer.appendChild(calendarHeader); | ||
this.calendarContainer.appendChild(calendarBody); | ||
var days = this.getDaysInMonth( this.year, this.month ), | ||
before = new Date( this.year, this.month, 1 ).getDay(); | ||
var days = this.getDaysInMonth(this.year, this.month), | ||
before = new Date(this.year, this.month, 1).getDay(); | ||
if ( typeof this.options.onRender != 'undefined' && | ||
this.options.onRender != null && | ||
this.options.onRender ) { | ||
this.options.onRender( this ); | ||
if (typeof this.options.onRender != 'undefined' && | ||
this.options.onRender != null && | ||
this.options.onRender) { | ||
this.options.onRender(this); | ||
} | ||
if ( datepicker_langs[ this.options.lang ].weekStart > 0 ) { | ||
before -= datepicker_langs[ this.options.lang ].weekStart; | ||
if ( before < 0 ) { | ||
if (datepicker_langs[this.options.lang].weekStart > 0) { | ||
before -= datepicker_langs[this.options.lang].weekStart; | ||
if (before < 0) { | ||
before += 7; | ||
@@ -261,4 +298,4 @@ } | ||
var cells = days + before, | ||
after = cells; | ||
while ( after > 7 ) { | ||
after = cells; | ||
while (after > 7) { | ||
after -= 7; | ||
@@ -268,13 +305,13 @@ } | ||
cells += 7 - after; | ||
for ( var i = 0; i < cells; i++ ) { | ||
var day = new Date( this.year, this.month, 1 + ( i - before ) ), | ||
isBetween = false, | ||
isSelected = false, | ||
isSelectedIn = false, | ||
isSelectedOut = false, | ||
isToday = this.compareDates( day, now ), | ||
isEmpty = i < before || i >= ( days + before ), | ||
isDisabled = false; | ||
for (var i = 0; i < cells; i++) { | ||
var day = new Date(this.year, this.month, 1 + ( i - before )), | ||
isBetween = false, | ||
isSelected = false, | ||
isSelectedIn = false, | ||
isSelectedOut = false, | ||
isToday = this.compareDates(day, now), | ||
isEmpty = i < before || i >= ( days + before ), | ||
isDisabled = false; | ||
if ( !isSelected ) { | ||
if (!isSelected) { | ||
isSelectedIn = false; | ||
@@ -284,7 +321,7 @@ isSelectedOut = false; | ||
if ( day.getMonth() !== this.month ) { | ||
if (day.getMonth() !== this.month) { | ||
isDisabled = true; | ||
} | ||
calendarBody.append( this.renderDay( day.getDate(), this.month, this.year, isSelected, isToday, isDisabled, isEmpty, isBetween, isSelectedIn, isSelectedOut ) ); | ||
calendarBody.append(this.renderDay(day.getDate(), this.month, this.year, isSelected, isToday, isDisabled, isEmpty, isBetween, isSelectedIn, isSelectedOut)); | ||
} | ||
@@ -305,9 +342,21 @@ } | ||
prevYear() { | ||
this.year -= 1; | ||
this.adjustCalendar(); | ||
this.renderCalendar(); | ||
} | ||
nextYear() { | ||
this.year += 1; | ||
this.adjustCalendar(); | ||
this.renderCalendar(); | ||
} | ||
show() { | ||
if ( typeof this.options.onOpen != 'undefined' && | ||
this.options.onOpen != null && | ||
this.options.onOpen ) { | ||
this.options.onOpen( this ); | ||
if (typeof this.options.onOpen != 'undefined' && | ||
this.options.onOpen != null && | ||
this.options.onOpen) { | ||
this.options.onOpen(this); | ||
} | ||
this.datePickerContainer.classList.add( 'is-active' ); | ||
this.datePickerContainer.classList.add('is-active'); | ||
this.adjustPosition(); | ||
@@ -319,17 +368,17 @@ this.open = true; | ||
this.open = false; | ||
if ( typeof this.options.onClose != 'undefined' && | ||
this.options.onClose != null && | ||
this.options.onClose ) { | ||
this.options.onClose( this ); | ||
if (typeof this.options.onClose != 'undefined' && | ||
this.options.onClose != null && | ||
this.options.onClose) { | ||
this.options.onClose(this); | ||
} | ||
this.datePickerContainer.classList.remove( 'is-active' ); | ||
this.datePickerContainer.classList.remove('is-active'); | ||
} | ||
adjustCalendar() { | ||
if ( this.month < 0 ) { | ||
this.year -= Math.ceil( Math.abs( this.month ) / 12 ); | ||
if (this.month < 0) { | ||
this.year -= Math.ceil(Math.abs(this.month) / 12); | ||
this.month += 12; | ||
} | ||
if ( this.month > 11 ) { | ||
this.year += Math.floor( Math.abs( this.month ) / 12 ); | ||
if (this.month > 11) { | ||
this.year += Math.floor(Math.abs(this.month) / 12); | ||
this.month -= 12; | ||
@@ -343,9 +392,9 @@ } | ||
var width = this.calendarContainer.offsetWidth, | ||
height = this.calendarContainer.offsetHeight, | ||
viewportWidth = window.innerWidth || document.documentElement.clientWidth, | ||
viewportHeight = window.innerHeight || document.documentElement.clientHeight, | ||
scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop, | ||
left, top, clientRect; | ||
height = this.calendarContainer.offsetHeight, | ||
viewportWidth = window.innerWidth || document.documentElement.clientWidth, | ||
viewportHeight = window.innerHeight || document.documentElement.clientHeight, | ||
scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop, | ||
left, top, clientRect; | ||
if ( typeof this.element.getBoundingClientRect === 'function' ) { | ||
if (typeof this.element.getBoundingClientRect === 'function') { | ||
clientRect = this.element.getBoundingClientRect(); | ||
@@ -357,3 +406,3 @@ left = clientRect.left + window.pageXOffset; | ||
top = this.element.offsetTop + this.element.offsetHeight; | ||
while ( ( this.element = this.element.offsetParent ) ) { | ||
while (( this.element = this.element.offsetParent )) { | ||
left += this.element.offsetLeft; | ||
@@ -388,12 +437,12 @@ top += this.element.offsetTop; | ||
*/ | ||
getFormatedDate( dt, format ) { | ||
getFormatedDate(dt, format) { | ||
var items = { | ||
d : dt.getDate(), | ||
dd : dt.getDate(), | ||
D : dt.getDay(), | ||
m : dt.getMonth() + 1, | ||
mm : dt.getMonth() + 1, | ||
M : dt.getMonth(), | ||
MM : dt.getMonth(), | ||
yy : dt.getFullYear().toString().substr(-2), | ||
d: dt.getDate(), | ||
dd: dt.getDate(), | ||
D: dt.getDay(), | ||
m: dt.getMonth() + 1, | ||
mm: dt.getMonth() + 1, | ||
M: dt.getMonth(), | ||
MM: dt.getMonth(), | ||
yy: dt.getFullYear().toString().substr(-2), | ||
yyyy: dt.getFullYear() | ||
@@ -404,9 +453,9 @@ }; | ||
items.mm < 10 && ( items.mm = '0' + items.mm ); | ||
items.D = datepicker_langs[ this.options.lang ].weekdays[ items.D ? items.D - 1 : 6 ]; | ||
items.M = datepicker_langs[ this.options.lang ].monthsShort[ items.M ]; | ||
items.MM = datepicker_langs[ this.options.lang ].months[ items.MM ]; | ||
items.D = datepicker_langs[this.options.lang].weekdays[items.D ? items.D - 1 : 6]; | ||
items.M = datepicker_langs[this.options.lang].monthsShort[items.M]; | ||
items.MM = datepicker_langs[this.options.lang].months[items.MM]; | ||
return format.replace( /(?:[dmM]{1,2}|D|yyyy|yy)/g, function( m ) { | ||
return typeof items[ m ] !== 'undefined' ? items[ m ] : m; | ||
} ); | ||
return format.replace(/(?:[dmM]{1,2}|D|yyyy|yy)/g, function (m) { | ||
return typeof items[m] !== 'undefined' ? items[m] : m; | ||
}); | ||
} | ||
@@ -420,10 +469,10 @@ | ||
isActive() { | ||
return this.calendarContainer.classList.contains( 'is-active' ); | ||
return this.calendarContainer.classList.contains('is-active'); | ||
} | ||
isDate( obj ) { | ||
return ( /Date/ ).test( Object.prototype.toString.call( obj ) ) && !isNaN( obj.getTime() ); | ||
isDate(obj) { | ||
return ( /Date/ ).test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime()); | ||
} | ||
isLeapYear( year ) { | ||
isLeapYear(year) { | ||
// solution by Matti Virkkunen: http://stackoverflow.com/a/4881951 | ||
@@ -433,7 +482,7 @@ return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; | ||
getDaysInMonth( year, month ) { | ||
return [ 31, this.isLeapYear( year ) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ][ month ]; | ||
getDaysInMonth(year, month) { | ||
return [31, this.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; | ||
} | ||
compareDates( a, b ) { | ||
compareDates(a, b) { | ||
// weak date comparison (use setToStartOfDay(date) to ensure correct result) | ||
@@ -440,0 +489,0 @@ return a.getTime() === b.getTime(); |
{ | ||
"name": "bulma-calendar", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Display a calendar for date selection or for planning management, in different colors and sizes", | ||
"main": "index.js", | ||
"main": "calendar.sass", | ||
"scripts": { | ||
@@ -7,0 +7,0 @@ "test": "echo \"Error: no test specified\" && exit 1" |
@@ -5,2 +5,6 @@ # bulma-calendar | ||
[![npm](https://img.shields.io/npm/v/bulma-calendar.svg)](https://www.npmjs.com/package/bulma-calendar) | ||
[![npm](https://img.shields.io/npm/dm/bulma-calendar.svg)](https://www.npmjs.com/package/bulma-calendar) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-calendar.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-calendar) | ||
<img src="https://img4.hostingpics.net/pics/812322ScreenShot20170810at125834.png" width="50%"> | ||
@@ -7,0 +11,0 @@ |
{ | ||
"name": "bulma-checkradio", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Make classic checkbox and radio more sexy in different colors, sizes, and states ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,2 +5,6 @@ # bulma-checkradio | ||
[![npm](https://img.shields.io/npm/v/bulma-checkradio.svg)](https://www.npmjs.com/package/bulma-checkradio) | ||
[![npm](https://img.shields.io/npm/dm/bulma-checkradio.svg)](https://www.npmjs.com/package/bulma-checkradio) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-checkradio.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-checkradio) | ||
<img src="./checkradio-example.png" width="100%"> | ||
@@ -7,0 +11,0 @@ |
@@ -5,2 +5,6 @@ # bulma-divider | ||
[![npm](https://img.shields.io/npm/v/bulma-divider.svg)](https://www.npmjs.com/package/bulma-divider) | ||
[![npm](https://img.shields.io/npm/dm/bulma-divider.svg)](https://www.npmjs.com/package/bulma-divider) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-divider.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-divider) | ||
<img src="https://img4.hostingpics.net/pics/552370ScreenShot20170809at203028.png"> | ||
@@ -7,0 +11,0 @@ |
@@ -5,2 +5,6 @@ # bulma-pageloader | ||
[![npm](https://img.shields.io/npm/v/bulma-pageloader.svg)](https://www.npmjs.com/package/bulma-pageloader) | ||
[![npm](https://img.shields.io/npm/dm/bulma-pageloader.svg)](https://www.npmjs.com/package/bulma-pageloader) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-pageloader.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-pageloader) | ||
Overview | ||
@@ -7,0 +11,0 @@ --- |
@@ -5,2 +5,6 @@ # bulma-pricingtable | ||
[![npm](https://img.shields.io/npm/v/bulma-pricingtable.svg)](https://www.npmjs.com/package/bulma-pricingtable) | ||
[![npm](https://img.shields.io/npm/dm/bulma-pricingtable.svg)](https://www.npmjs.com/package/bulma-pricingtable) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-pricingtable.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-pricingtable) | ||
<img src="./pricingtable-example.png"> | ||
@@ -7,0 +11,0 @@ |
@@ -5,4 +5,8 @@ # bulma-quickview | ||
[![npm](https://img.shields.io/npm/v/bulma-quickview.svg)](https://www.npmjs.com/package/bulma-quickview) | ||
[![npm](https://img.shields.io/npm/dm/bulma-quickview.svg)](https://www.npmjs.com/package/bulma-quickview) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-quickview.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-quickview) | ||
Documentation & Demo | ||
--- | ||
You can find the Documentation and a demo [here](https://wikiki.github.io/bulma-extensions/quickview) |
@@ -5,2 +5,7 @@ # bulma-ribbon | ||
[![npm](https://img.shields.io/npm/v/bulma-ribbon.svg)](https://www.npmjs.com/package/bulma-ribbon) | ||
[![npm](https://img.shields.io/npm/dm/bulma-ribbon.svg)](https://www.npmjs.com/package/bulma-ribbon) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-ribbon.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-ribbon) | ||
![Ribbon Element](https://img4.hostingpics.net/pics/737717ScreenShot20170810at095724.png) | ||
@@ -7,0 +12,0 @@ |
@@ -5,2 +5,6 @@ # bulma-slider | ||
[![npm](https://img.shields.io/npm/v/bulma-slider.svg)](https://www.npmjs.com/package/bulma-slider) | ||
[![npm](https://img.shields.io/npm/dm/bulma-slider.svg)](https://www.npmjs.com/package/bulma-slider) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-slider.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-slider) | ||
<img src="./slider-example.png" width="100%"> | ||
@@ -7,0 +11,0 @@ |
@@ -5,2 +5,6 @@ # bulma-steps | ||
[![npm](https://img.shields.io/npm/v/bulma-steps.svg)](https://www.npmjs.com/package/bulma-steps) | ||
[![npm](https://img.shields.io/npm/dm/bulma-steps.svg)](https://www.npmjs.com/package/bulma-steps) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-steps.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-steps) | ||
Preview | ||
@@ -7,0 +11,0 @@ --- |
@@ -5,2 +5,6 @@ # bulma-switch | ||
[![npm](https://img.shields.io/npm/v/bulma-switch.svg)](https://www.npmjs.com/package/bulma-switch) | ||
[![npm](https://img.shields.io/npm/dm/bulma-switch.svg)](https://www.npmjs.com/package/bulma-switch) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-switch.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-switch) | ||
![Switch example](switch-example.png) | ||
@@ -7,0 +11,0 @@ |
{ | ||
"name": "bulma-timeline", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Display a vertical timeline, in different colors, sizes, and states ", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/Wikiki/bulma-badge.git" | ||
"url": "git+https://github.com/Wikiki/bulma-timeline" | ||
}, | ||
@@ -24,5 +24,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/Wikiki/bulma-badge/issues" | ||
"url": "https://github.com/Wikiki/bulma-timeline/issues" | ||
}, | ||
"homepage": "https://github.com/Wikiki/bulma-badge#readme" | ||
"homepage": "https://github.com/Wikiki/bulma-timeline#readme" | ||
} |
@@ -5,2 +5,6 @@ # bulma-timeline | ||
[![npm](https://img.shields.io/npm/v/bulma-timeline.svg)](https://www.npmjs.com/package/bulma-timeline) | ||
[![npm](https://img.shields.io/npm/dm/bulma-timeline.svg)](https://www.npmjs.com/package/bulma-timeline) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-timeline.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-timeline) | ||
<img src="https://img4.hostingpics.net/pics/887099ScreenShot20170812at150229.png" width="50%"> | ||
@@ -7,0 +11,0 @@ |
@@ -5,4 +5,8 @@ # bulma-tooltip | ||
[![npm](https://img.shields.io/npm/v/bulma-tooltip.svg)](https://www.npmjs.com/package/bulma-tooltip) | ||
[![npm](https://img.shields.io/npm/dm/bulma-tooltip.svg)](https://www.npmjs.com/package/bulma-tooltip) | ||
[![Build Status](https://travis-ci.org/Wikiki/bulma-tooltip.svg?branch=master)](https://travis-ci.org/Wikiki/bulma-tooltip) | ||
Documentation & Demo | ||
--- | ||
You can find the Documentation and a demo [here](https://wikiki.github.io/bulma-extensions/tooltip) |
{ | ||
"name": "bulma-extensions", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Set of extensions for Bulma.io CSS Framework", | ||
"main": "index.js", | ||
"main": "extensions.sass", | ||
"scripts": { | ||
@@ -7,0 +7,0 @@ "test": "echo \"Error: no test specified\" && exit 1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
529327
108
669