diff --git a/dist/datepickk.css b/dist/datepickk.css index 2ad4842..4dade4e 100644 --- a/dist/datepickk.css +++ b/dist/datepickk.css @@ -1,6 +1,6 @@ /*Main color*/ /*Datepickk*/ -.d-noscroll { +.dp-noscroll { overflow: hidden; } #Datepickk { @@ -18,29 +18,29 @@ color: #333; user-select: none; } -#Datepickk.MSIE:not(.wrapped):not(.inline) .d-calendar { +#Datepickk.MSIE:not(.wrapped):not(.inline) .dp-calendar { height: 560px; } -#Datepickk.d-show .d-overlay { +#Datepickk.dp-show .dp-overlay { animation-name: show; animation-duration: .2s; animation-timing-function: ease-out; animation-fill-mode: both; } -#Datepickk.d-hide > * { +#Datepickk.dp-hide > * { animation-name: DatepickkHide; animation-duration: .2s; animation-timing-function: linear; animation-fill-mode: both; } -#Datepickk.d-hide .d-overlay { +#Datepickk.dp-hide .dp-overlay { animation-name: show; animation-duration: .15s; animation-timing-function: ease-out; animation-fill-mode: both; animation-direction: reverse; } -#Datepickk .d-overlay { +#Datepickk .dp-overlay { position: absolute; top: 0; left: 0; @@ -49,7 +49,7 @@ background-color: rgba(55, 58, 71, 0.95); z-index: 1; } -#Datepickk .d-title { +#Datepickk .dp-title { color: white; text-align: center; position: relative; @@ -57,7 +57,7 @@ margin: 25px 0; z-index: 2; } -#Datepickk .d-confirm { +#Datepickk .dp-confirm { border: none; position: relative; background-color: transparent; @@ -71,29 +71,29 @@ padding: 0; z-index: 2; } -#Datepickk .d-title:empty, -#Datepickk .d-confirm:empty { +#Datepickk .dp-title:empty, +#Datepickk .dp-confirm:empty { display: none; } @media (max-height: 528px) { - #Datepickk .d-title, - #Datepickk .d-confirm { + #Datepickk .dp-title, + #Datepickk .dp-confirm { font-size: 20px; margin: 15px 0; } - #Datepickk .d-calendar { + #Datepickk .dp-calendar { font-size: 20px; } } -#Datepickk.multi .d-calendar, -#Datepickk.multi .d-legend { +#Datepickk.multi .dp-calendar, +#Datepickk.multi .dp-legend { max-width: 800px; } -#Datepickk.multi .d-table { +#Datepickk.multi .dp-table { position: relative; padding-top: 35px; } -#Datepickk.multi .d-table:before { +#Datepickk.multi .dp-table:before { content: attr(data-month); text-align: right; width: 100%; @@ -105,7 +105,7 @@ left: 0; top: 0; } -#Datepickk.inline.d-show .d-calendar { +#Datepickk.inline.dp-show .dp-calendar { animation: none; } #Datepickk.inline, @@ -113,46 +113,46 @@ position: static; z-index: 0; } -#Datepickk.inline .d-calendar, -#Datepickk.wrapped .d-calendar { +#Datepickk.inline .dp-calendar, +#Datepickk.wrapped .dp-calendar { box-shadow: none; z-index: 0; max-width: none; max-height: none; } -#Datepickk.inline .d-confirm, -#Datepickk.wrapped .d-confirm, -#Datepickk.inline .d-title, -#Datepickk.wrapped .d-title { +#Datepickk.inline .dp-confirm, +#Datepickk.wrapped .dp-confirm, +#Datepickk.inline .dp-title, +#Datepickk.wrapped .dp-title { color: #222; } -#Datepickk.inline .d-overlay, -#Datepickk.wrapped .d-overlay { +#Datepickk.inline .dp-overlay, +#Datepickk.wrapped .dp-overlay { display: none; } -#Datepickk.inline .d-legend, -#Datepickk.wrapped .d-legend { +#Datepickk.inline .dp-legend, +#Datepickk.wrapped .dp-legend { color: #222!important; max-width: none; max-height: none; } -#Datepickk.fullscreen .d-calendar { +#Datepickk.fullscreen .dp-calendar { max-width: none; max-height: none; } -#Datepickk.fullscreen .d-calendar input + label { +#Datepickk.fullscreen .dp-calendar input + label { outline: 1px solid #eaeaea; box-sizing: border-box; align-items: flex-start !important; justify-content: flex-end !important; } -#Datepickk.fullscreen .d-calendar input + label text { +#Datepickk.fullscreen .dp-calendar input + label text { padding: 5px 10px 0 0; } -#Datepickk.fullscreen .d-legend { +#Datepickk.fullscreen .dp-legend { max-width: none; } -#Datepickk .d-legend { +#Datepickk .dp-legend { display: flex; flex-wrap: wrap; justify-content: center; @@ -163,10 +163,10 @@ position: relative; color: white; } -#Datepickk .d-legend:empty { +#Datepickk .dp-legend:empty { height: 0; } -#Datepickk .d-legend p { +#Datepickk .dp-legend p { backface-visibility: visible !important; animation-name: DatepickfadeInUp; animation-duration: .5s; @@ -177,10 +177,10 @@ cursor: pointer; color: #1B353F; } -#Datepickk .d-legend p:after { +#Datepickk .dp-legend p:after { content: attr(data-legend); } -#Datepickk .d-legend p span { +#Datepickk .dp-legend p span { width: 20px; height: 20px; border-radius: 100%; @@ -188,7 +188,7 @@ display: inline-block; margin-right: 10px; } -#Datepickk .d-calendar { +#Datepickk .dp-calendar { margin: 0; background-color: white; box-shadow: 0px 2px 10px -2px rgba(0, 0, 0, 0.6); @@ -203,17 +203,17 @@ flex-grow: 1; z-index: 2; } -#Datepickk .d-header { +#Datepickk .dp-header { position: relative; background-color: #1B363F; color: white; font-size: 1.5em; } -#Datepickk .d-header p { +#Datepickk .dp-header p { margin: .5em 0; text-align: center; } -#Datepickk .d-header i { +#Datepickk .dp-header i { position: absolute; top: 50%; width: 30px; @@ -224,67 +224,67 @@ transition: background-color 0.2s ease; transform: translateY(-50%); } -#Datepickk .d-header i:before, -#Datepickk .d-header i:after { +#Datepickk .dp-header i:before, +#Datepickk .dp-header i:after { content: ''; width: 0; height: 0; position: absolute; } -#Datepickk .d-header i:before { +#Datepickk .dp-header i:before { border-top: 10px solid rgba(0, 0, 0, 0); border-bottom: 10px solid rgba(0, 0, 0, 0); } -#Datepickk .d-header i:after { +#Datepickk .dp-header i:after { border-top: 7px solid rgba(0, 0, 0, 0); border-bottom: 7px solid rgba(0, 0, 0, 0); transition: border-color 0.2s ease; } -#Datepickk .d-header i#d-previous { +#Datepickk .dp-header i#dp-previous { left: 20px; } -#Datepickk .d-header i#d-previous:before { +#Datepickk .dp-header i#dp-previous:before { border-right: 10px solid #FFF; top: 5px; left: 7px; } -#Datepickk .d-header i#d-previous:after { +#Datepickk .dp-header i#dp-previous:after { border-right: 7px solid #1B363F; top: 8px; left: 10px; } -#Datepickk .d-header i#d-next { +#Datepickk .dp-header i#dp-next { right: 20px; } -#Datepickk .d-header i#d-next:before { +#Datepickk .dp-header i#dp-next:before { border-left: 10px solid #FFF; top: 5px; left: 12px; } -#Datepickk .d-header i#d-next:after { +#Datepickk .dp-header i#dp-next:after { border-left: 7px solid #1B363F; top: 8px; left: 12px; } -#Datepickk .d-header i:hover { +#Datepickk .dp-header i:hover { background-color: #5E7178; } -#Datepickk .d-header i:hover:after { +#Datepickk .dp-header i:hover:after { border-left-color: #5E7178!important; border-right-color: #5E7178!important; } -#Datepickk .d-month { +#Datepickk .dp-month { cursor: pointer; white-space: nowrap; } -#Datepickk .d-year { +#Datepickk .dp-year { margin-left: 10px; cursor: pointer; } -#Datepickk .d-year:before { +#Datepickk .dp-year:before { content: ""; } -#Datepickk .d-month-picker { +#Datepickk .dp-month-picker { display: flex; justify-content: space-between; background-color: rgba(27, 54, 63, 0.9); @@ -293,27 +293,27 @@ pointer-events: none; transition: height .2s ease; } -#Datepickk .d-month-picker.d-show { +#Datepickk .dp-month-picker.dp-show { height: 44px; pointer-events: auto; } -#Datepickk .d-month-picker > div { +#Datepickk .dp-month-picker > div { width: calc(100% / 12); text-align: center; line-height: 44px; color: white; cursor: pointer; } -#Datepickk .d-month-picker > div:hover, -#Datepickk .d-month-picker > div:focus { +#Datepickk .dp-month-picker > div:hover, +#Datepickk .dp-month-picker > div:focus { background-color: #e32d2d; color: white; } -#Datepickk .d-month-picker > div.current { +#Datepickk .dp-month-picker > div.current { background-color: #e9965a; color: white; } -#Datepickk .d-year-picker { +#Datepickk .dp-year-picker { display: flex; justify-content: space-between; background-color: rgba(27, 54, 63, 0.9); @@ -322,73 +322,73 @@ pointer-events: none; transition: height .2s ease; } -#Datepickk .d-year-picker.d-show { +#Datepickk .dp-year-picker.dp-show { height: 44px; pointer-events: auto; } -#Datepickk .d-year-picker > div { +#Datepickk .dp-year-picker > div { width: calc(100% / 11); text-align: center; line-height: 44px; color: white; cursor: pointer; } -#Datepickk .d-year-picker > div:hover, -#Datepickk .d-year-picker > div:focus { +#Datepickk .dp-year-picker > div:hover, +#Datepickk .dp-year-picker > div:focus { background-color: #e32d2d; color: white; } -#Datepickk .d-year-picker > div.current { +#Datepickk .dp-year-picker > div.current { background-color: #e9965a; color: white; } -#Datepickk .d-weekdays { +#Datepickk .dp-weekdays { display: flex; } -#Datepickk .d-week { +#Datepickk .dp-week { background-color: #E95A5A; color: white; display: flex; width: 100%; } -#Datepickk .d-week + .d-week { +#Datepickk .dp-week + .dp-week { border-left: 1px solid rgba(255, 255, 255, 0.05); } -#Datepickk .d-week > div { +#Datepickk .dp-week > div { flex-basis: calc(100% / 7); text-align: center; } -#Datepickk .d-week > div p { +#Datepickk .dp-week > div p { margin: .8em 0; } @media (max-height: 540px) { - #Datepickk .d-week { + #Datepickk .dp-week { display: none; } } -#Datepickk .d-table { +#Datepickk .dp-table { width: 100%; display: flex; flex-wrap: wrap; flex: 1; } -#Datepickk .d-table:first-child:nth-last-child(n + 3), -#Datepickk .d-table:first-child:nth-last-child(n + 3) ~ div { +#Datepickk .dp-table:first-child:nth-last-child(n + 3), +#Datepickk .dp-table:first-child:nth-last-child(n + 3) ~ div { flex: 0; flex-basis: calc(100% / 3 - 1px); /*-1px due to browser render*/ border-bottom: 1px solid rgba(0, 0, 0, 0.05); } -#Datepickk .d-table label:nth-of-type(7n) .d-date-legends { +#Datepickk .dp-table label:nth-of-type(7n) .dp-date-legends { padding-right: 0; } -#Datepickk .d-table label:nth-last-of-type(-n + 7) .d-date-legends { +#Datepickk .dp-table label:nth-last-of-type(-n + 7) .dp-date-legends { padding-bottom: 0; } -#Datepickk .d-table input { +#Datepickk .dp-table input { display: none; } -#Datepickk .d-table input + label { +#Datepickk .dp-table input + label { flex-basis: calc(100% / 7); -ms-flex-preferred-size: 14.28%; /*Keep -> IE render fail*/ @@ -401,15 +401,15 @@ -webkit-tap-highlight-color: rgba(0, 0, 0, 0); box-sizing: border-box; } -#Datepickk .d-table input + label text { +#Datepickk .dp-table input + label text { z-index: 9; pointer-events: none; position: relative; } -#Datepickk .d-table input + label[style*="linear-gradient"] text { +#Datepickk .dp-table input + label[style*="linear-gradient"] text { text-shadow: 0 0 20px black; } -#Datepickk .d-table input + label.today text:before { +#Datepickk .dp-table input + label.today text:before { content: ''; width: 100%; height: 2px; @@ -418,7 +418,7 @@ bottom: -5px; left: 0; } -#Datepickk .d-table input + label:before { +#Datepickk .dp-table input + label:before { content: ''; position: absolute; top: 12.5%; @@ -431,7 +431,7 @@ transform: scaleX(0); transform-origin: left; } -#Datepickk .d-table input + label.legend-hover { +#Datepickk .dp-table input + label.legend-hover { animation: legendhover 1s infinite; z-index: 10; } @@ -446,11 +446,11 @@ transform: translate(0, 0px); } } -#Datepickk .d-table input + label.next, -#Datepickk .d-table input + label.prev { +#Datepickk .dp-table input + label.next, +#Datepickk .dp-table input + label.prev { color: #ccc; } -#Datepickk .d-table input + label [data-tooltip]:after { +#Datepickk .dp-table input + label [data-tooltip]:after { content: ''; border-radius: 100%; background-color: #1B363F; @@ -460,7 +460,7 @@ top: 0; right: -10px; } -#Datepickk .d-table input + label .d-tooltip { +#Datepickk .dp-table input + label .dp-tooltip { position: absolute; background-color: #1B363F; color: #FFF; @@ -473,7 +473,7 @@ transform: translate(-50%, -5px); display: none; } -#Datepickk .d-table input + label .d-tooltip:before { +#Datepickk .dp-table input + label .dp-tooltip:before { content: ''; border-bottom: 7px solid #1B363F; border-left: 5px solid rgba(0, 0, 0, 0); @@ -483,22 +483,22 @@ position: absolute; margin-left: -5px; } -#Datepickk .d-table input + label .d-tooltip:empty { +#Datepickk .dp-table input + label .dp-tooltip:empty { display: none!important; } -#Datepickk .d-table input + label:hover .d-tooltip { +#Datepickk .dp-table input + label:hover .dp-tooltip { display: block; } -#Datepickk .d-table input:checked + label { +#Datepickk .dp-table input:checked + label { color: white; } -#Datepickk .d-table input:checked + label:before { +#Datepickk .dp-table input:checked + label:before { transform: scaleX(1); } -#Datepickk .d-table input:disabled + label { +#Datepickk .dp-table input:disabled + label { cursor: not-allowed; } -#Datepickk .d-table input:disabled + label:after { +#Datepickk .dp-table input:disabled + label:after { content: ''; position: absolute; top: 50%; @@ -510,86 +510,86 @@ transform-origin: center; transform: rotate(-25deg); } -#Datepickk .d-table input + label.d-hidden { +#Datepickk .dp-table input + label.dp-hidden { cursor: default; color: #ccc!important; background: #f0f0f0!important; text-decoration: line-through; } -#Datepickk .d-table input + label.d-hidden:after { +#Datepickk .dp-table input + label.dp-hidden:after { content: none; } -#Datepickk .d-tables { +#Datepickk .dp-tables { display: flex; flex: 1; flex-wrap: wrap; } -#Datepickk .d-tables:not(.locked) input:not(:checked) + label:not(.hidden):hover { +#Datepickk .dp-tables:not(.locked) input:not(:checked) + label:not(.hidden):hover { color: #222; background-color: #eaeaea; } -#Datepickk .d-tables.locked label { +#Datepickk .dp-tables.locked label { cursor: default; } -#Datepickk .d-tables.range:not(.before) input:not(.single):checked + label { +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked + label { color: white; } -#Datepickk .d-tables.range:not(.before) input:not(.single):checked + label ~ label:not(.hidden) { +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked + label ~ label:not(.hidden) { color: white; } -#Datepickk .d-tables.range:not(.before) input:not(.single):checked + label ~ label:not(.hidden):before { +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked + label ~ label:not(.hidden):before { transform: scaleX(1); background-color: rgba(125, 208, 118, 0.5); } -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ label:hover ~ label, -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ label:focus ~ label { +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ label:hover ~ label, +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ label:focus ~ label { color: #666; } -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ label:hover ~ label:before, -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ label:focus ~ label:before { +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ label:hover ~ label:before, +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ label:focus ~ label:before { transform: scaleX(0); } -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ label:hover ~ label.next, -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ label:focus ~ label.next, -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ label:hover ~ label.prev, -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ label:focus ~ label.prev { +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ label:hover ~ label.next, +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ label:focus ~ label.next, +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ label:hover ~ label.prev, +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ label:focus ~ label.prev { color: #ccc; } -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ input:checked + label { +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ input:checked + label { color: white; } -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ input:checked + label:before { +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ input:checked + label:before { transform: scaleX(1); background-color: #7DD076; } -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ input:checked + label ~ label { +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ input:checked + label ~ label { color: inherit; } -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ input:checked + label ~ label.next, -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ input:checked + label ~ label.prev { +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ input:checked + label ~ label.next, +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ input:checked + label ~ label.prev { color: #ccc; } -#Datepickk .d-tables.range:not(.before) input:not(.single):checked ~ input:checked + label ~ label:before { +#Datepickk .dp-tables.range:not(.before) input:not(.single):checked ~ input:checked + label ~ label:before { transform: scaleX(0); } -#Datepickk .d-tables.range.before input:not(.single):not(:checked) + label { +#Datepickk .dp-tables.range.before input:not(.single):not(:checked) + label { color: white; } -#Datepickk .d-tables.range.before input:not(.single):not(:checked) + label:before { +#Datepickk .dp-tables.range.before input:not(.single):not(:checked) + label:before { transform: scaleX(1); background-color: rgba(233, 90, 126, 0.3); } -#Datepickk .d-tables.range.before input:not(.single):checked + label ~ label { +#Datepickk .dp-tables.range.before input:not(.single):checked + label ~ label { color: inherit; } -#Datepickk .d-tables.range.before input:not(.single):checked + label ~ label.next, -#Datepickk .d-tables.range.before input:not(.single):checked + label ~ label.prev { +#Datepickk .dp-tables.range.before input:not(.single):checked + label ~ label.next, +#Datepickk .dp-tables.range.before input:not(.single):checked + label ~ label.prev { color: #ccc; } -#Datepickk .d-tables.range.before input:not(.single):checked + label ~ label:before { +#Datepickk .dp-tables.range.before input:not(.single):checked + label ~ label:before { transform: scaleX(0); } -#Datepickk .d-fadeInUp { +#Datepickk .dp-fadeInUp { backface-visibility: visible !important; animation-name: DatepickfadeInUp; animation-duration: .5s; @@ -610,10 +610,10 @@ transform: none; } } -.d-fadeInUp { +.dp-fadeInUp { animation-name: DatepickfadeInUp; } -#Datepickk.d-show > * { +#Datepickk.dp-show > * { animation-name: DatepickkShow; animation-duration: .2s; animation-timing-function: ease-out; diff --git a/dist/datepickk.js b/dist/datepickk.js index 288ad98..cf33138 100644 --- a/dist/datepickk.js +++ b/dist/datepickk.js @@ -120,6 +120,11 @@ function Datepickk(args) { monthNames: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], dayNames: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], weekStart: 1 + }, + uk: { + monthNames: ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'], + dayNames: ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'], + weekStart: 1 } }; @@ -160,7 +165,7 @@ function Datepickk(args) { if (daynames) { for (var x = 0; x < months && x < 3; x++) { var weekEl = document.createElement('div'); - weekEl.setAttribute('class', 'd-week'); + weekEl.setAttribute('class', 'dp-week'); for (var i = 0; i < 7; i++) { var dayNameIndex = i + ws > languages[lang].dayNames.length - 1 ? i + ws - languages[lang].dayNames.length : i + ws; @@ -187,7 +192,7 @@ function Datepickk(args) { that.el.tables.innerHTML = ''; for (var x = 0; x < months; x++) { var container = document.createElement('div'); - container.setAttribute('class', 'd-table'); + container.setAttribute('class', 'dp-table'); for (var i = 0; i < 42; i++) { var input = document.createElement('input'); input.type = 'checkbox'; @@ -198,7 +203,7 @@ function Datepickk(args) { var text = document.createElement('text'); var tooltip = document.createElement('span'); - tooltip.setAttribute('class', 'd-tooltip'); + tooltip.setAttribute('class', 'dp-tooltip'); container.appendChild(input); container.appendChild(label); @@ -261,10 +266,10 @@ function Datepickk(args) { var legends = []; for (var l = 0; l < _highlights.length; l++) { if ('legend' in _highlights[l] && _highlights[l].legend) { - var oldLegend = container.querySelector('.d-legend-item[data-legend="' + _highlights[l].legend + '"][data-color="' + _highlights[l].backgroundColor + '"]'); + var oldLegend = container.querySelector('.dp-legend-item[data-legend="' + _highlights[l].legend + '"][data-color="' + _highlights[l].backgroundColor + '"]'); if (oldLegend == null) { var legendItem = document.createElement('p'); - legendItem.setAttribute('class', 'd-legend-item'); + legendItem.setAttribute('class', 'dp-legend-item'); legendItem.setAttribute('data-legend', _highlights[l].legend); legendItem.setAttribute('data-legend-id', highlight.indexOf(_highlights[l])); legendItem.setAttribute('data-color', _highlights[l].backgroundColor); @@ -283,7 +288,7 @@ function Datepickk(args) { } } - [].slice.call(that.el.legend.querySelectorAll('.d-legend-item')).forEach(function (item) { + [].slice.call(that.el.legend.querySelectorAll('.dp-legend-item')).forEach(function (item) { if (legends.indexOf(item) < 0) { item.removeEventListener('mouseover', hoverLegend); item.removeEventListener('mouseout', hoverLegend); @@ -304,10 +309,10 @@ function Datepickk(args) { } function generateDates(year, month) { - var monthElements = that.el.querySelectorAll('.d-table'); + var monthElements = that.el.querySelectorAll('.dp-table'); var ws = weekStart !== null ? weekStart : languages[lang].weekStart; - [].slice.call(that.el.querySelectorAll('.d-table')).forEach(function (element, index) { + [].slice.call(that.el.querySelectorAll('.dp-table')).forEach(function (element, index) { var days = new Date(year, month + index, 0).getDate(); var daysLast = new Date(year, month + index - 1, 0).getDate(); var startDay = new Date(year, month + index - 1, 1).getDay(); @@ -321,7 +326,7 @@ function Datepickk(args) { var monthText = languages[lang].monthNames[parseMonth(month - 1 + index)]; element.setAttribute('data-month', monthText); - [].slice.call(element.querySelectorAll('.d-table input')).forEach(function (inputEl, i) { + [].slice.call(element.querySelectorAll('.dp-table input')).forEach(function (inputEl, i) { var labelEl = inputEl.nextSibling; inputEl.checked = false; @@ -338,7 +343,7 @@ function Datepickk(args) { labelEl.className = 'prev'; } else { date = ''; - labelEl.className = 'd-hidden'; + labelEl.className = 'dp-hidden'; inputEl.setAttribute('disabled', true); } } else if (i < days + startDay) { @@ -352,7 +357,7 @@ function Datepickk(args) { labelEl.className = 'next'; } else { date = ''; - labelEl.className = 'd-hidden'; + labelEl.className = 'dp-hidden'; inputEl.setAttribute('disabled', true); } } @@ -366,7 +371,7 @@ function Datepickk(args) { if (minDate && date < minDate || maxDate && date > maxDate) { inputEl.setAttribute('disabled', true); - labelEl.className = 'd-hidden'; + labelEl.className = 'dp-hidden'; } if (today && date.getTime() == new Date().setHours(0, 0, 0, 0)) { @@ -516,7 +521,7 @@ function Datepickk(args) { }; function resetCalendar() { - [].slice.call(that.el.querySelectorAll('.d-table input')).forEach(function (inputEl) { + [].slice.call(that.el.querySelectorAll('.dp-table input')).forEach(function (inputEl) { inputEl.checked = false; }); @@ -643,15 +648,15 @@ function Datepickk(args) { function show(properties) { if (!that.inline && that.container === document.body) { - document.body.classList.add('d-noscroll'); + document.body.classList.add('dp-noscroll'); } setArgs(properties); var handler = function handler() { - that.el.classList.remove('d-show'); + that.el.classList.remove('dp-show'); that.el.calendar.removeEventListener(whichAnimationEvent(), handler); }; that.el.calendar.addEventListener(whichAnimationEvent(), handler); - that.el.classList.add('d-show'); + that.el.classList.add('dp-show'); container.appendChild(that.el); opened = true; if (startDate) { @@ -662,39 +667,39 @@ function Datepickk(args) { }; function hide() { - document.body.classList.remove('d-noscroll'); + document.body.classList.remove('dp-noscroll'); var handler = function handler() { that.el.parentNode.removeChild(that.el); opened = false; - that.el.classList.remove('d-hide'); + that.el.classList.remove('dp-hide'); if (typeof onClose == 'function') { onClose.apply(that); } that.el.removeEventListener(whichAnimationEvent(), handler); }; that.el.addEventListener(whichAnimationEvent(), handler); - that.el.classList.add('d-hide'); + that.el.classList.add('dp-hide'); }; function bindEvents() { that.el.header.childNodes[0].addEventListener(eventName, prevMonth); that.el.header.childNodes[2].addEventListener(eventName, nextMonth); that.el.header.childNodes[1].childNodes[0].addEventListener(eventName, function () { - if (that.el.monthPicker.classList.contains('d-show')) { - that.el.monthPicker.classList.remove('d-show'); + if (that.el.monthPicker.classList.contains('dp-show')) { + that.el.monthPicker.classList.remove('dp-show'); } else { - that.el.monthPicker.classList.add('d-show'); + that.el.monthPicker.classList.add('dp-show'); } - that.el.yearPicker.classList.remove('d-show'); + that.el.yearPicker.classList.remove('dp-show'); }); that.el.header.childNodes[1].childNodes[1].addEventListener(eventName, function () { generateYears(); - if (that.el.yearPicker.classList.contains('d-show')) { - that.el.yearPicker.classList.remove('d-show'); + if (that.el.yearPicker.classList.contains('dp-show')) { + that.el.yearPicker.classList.remove('dp-show'); } else { - that.el.yearPicker.classList.add('d-show'); + that.el.yearPicker.classList.add('dp-show'); } - that.el.monthPicker.classList.remove('d-show'); + that.el.monthPicker.classList.remove('dp-show'); }); that.el.button.addEventListener(eventName, hide); @@ -708,7 +713,7 @@ function Datepickk(args) { monthPicker.addEventListener(eventName, function () { currentMonth = parseInt(this.getAttribute('data-month')); setDate(); - that.el.monthPicker.classList.remove('d-show'); + that.el.monthPicker.classList.remove('dp-show'); }); }); @@ -716,7 +721,7 @@ function Datepickk(args) { yearPicker.addEventListener(eventName, function () { currentYear += parseInt(this.getAttribute('data-year')); setDate(); - that.el.yearPicker.classList.remove('d-show'); + that.el.yearPicker.classList.remove('dp-show'); }); }); @@ -1259,7 +1264,7 @@ function whichAnimationEvent() { } } -var template = '
' + '
' + '
' + '' + '

' + '' + '
' + '
' + '
1
' + '
2
' + '
3
' + '
4
' + '
5
' + '
6
' + '
7
' + '
8
' + '
9
' + '
10
' + '
11
' + '
12
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '' + '
'; +var template = '
' + '
' + '
' + '' + '

' + '' + '
' + '
' + '
1
' + '
2
' + '
3
' + '
4
' + '
5
' + '
6
' + '
7
' + '
8
' + '
9
' + '
10
' + '
11
' + '
12
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + '' + '
'; var getBrowserVersion = function getBrowserVersion() { var browser = { diff --git a/dist/datepickk.min.css b/dist/datepickk.min.css index 7a26f02..590975b 100644 --- a/dist/datepickk.min.css +++ b/dist/datepickk.min.css @@ -1 +1 @@ -.d-noscroll{overflow:hidden}#Datepickk{position:fixed;top:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:6;width:100%;height:100%;font-family:inherit;color:#333;user-select:none}#Datepickk.MSIE:not(.wrapped):not(.inline) .d-calendar{height:560px}#Datepickk.d-show .d-overlay{animation-name:show;animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:both}#Datepickk.d-hide>*{animation-name:d;animation-duration:.2s;animation-timing-function:linear;animation-fill-mode:both}#Datepickk.d-hide .d-overlay{animation-name:show;animation-duration:.15s;animation-timing-function:ease-out;animation-fill-mode:both;animation-direction:reverse}#Datepickk .d-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(55,58,71,.95);z-index:1}#Datepickk .d-title{text-align:center}#Datepickk .d-confirm,#Datepickk .d-title{color:#fff;position:relative;font-size:30px;margin:25px 0;z-index:2}#Datepickk .d-confirm{border:none;background-color:transparent;outline:none;font-family:inherit;font-weight:500;cursor:pointer;padding:0}#Datepickk .d-confirm:empty,#Datepickk .d-title:empty{display:none}@media (max-height:528px){#Datepickk .d-confirm,#Datepickk .d-title{font-size:20px;margin:15px 0}#Datepickk .d-calendar{font-size:20px}}#Datepickk.multi .d-calendar,#Datepickk.multi .d-legend{max-width:800px}#Datepickk.multi .d-table{position:relative;padding-top:35px}#Datepickk.multi .d-table:before{content:attr(data-month);text-align:right;width:100%;font-size:1em;padding:5px 10px 5px 0;box-sizing:border-box;color:#ccc;position:absolute;left:0;top:0}#Datepickk.inline.d-show .d-calendar{animation:none}#Datepickk.inline,#Datepickk.wrapped{position:static;z-index:0}#Datepickk.inline .d-calendar,#Datepickk.wrapped .d-calendar{box-shadow:none;z-index:0;max-width:none;max-height:none}#Datepickk.inline .d-confirm,#Datepickk.inline .d-title,#Datepickk.wrapped .d-confirm,#Datepickk.wrapped .d-title{color:#222}#Datepickk.inline .d-overlay,#Datepickk.wrapped .d-overlay{display:none}#Datepickk.inline .d-legend,#Datepickk.wrapped .d-legend{color:#222!important;max-width:none;max-height:none}#Datepickk.fullscreen .d-calendar{max-width:none;max-height:none}#Datepickk.fullscreen .d-calendar input+label{outline:1px solid #eaeaea;box-sizing:border-box;align-items:flex-start!important;justify-content:flex-end!important}#Datepickk.fullscreen .d-calendar input+label text{padding:5px 10px 0 0}#Datepickk.fullscreen .d-legend{max-width:none}#Datepickk .d-legend{display:flex;flex-wrap:wrap;justify-content:center;width:100%;z-index:2;background-color:#f5f5f5;max-width:500px;position:relative;color:#fff}#Datepickk .d-legend:empty{height:0}#Datepickk .d-legend p{backface-visibility:visible!important;animation-name:b;animation-duration:.5s;animation-fill-mode:both;margin:0;padding:15px;transition:background-color .2s ease;cursor:pointer;color:#1b353f}#Datepickk .d-legend p:after{content:attr(data-legend)}#Datepickk .d-legend p span{width:20px;height:20px;border-radius:100%;vertical-align:bottom;display:inline-block;margin-right:10px}#Datepickk .d-calendar{margin:0;background-color:#fff;box-shadow:0 2px 10px -2px rgba(0,0,0,.6);font-size:20px;width:100%;position:relative;max-width:500px;max-height:560px;display:flex;flex-direction:column;justify-content:flex-start;flex-grow:1;z-index:2}#Datepickk .d-header{position:relative;background-color:#1b363f;color:#fff;font-size:1.5em}#Datepickk .d-header p{margin:.5em 0;text-align:center}#Datepickk .d-header i{position:absolute;top:50%;width:30px;height:30px;cursor:pointer;text-align:center;border-radius:100%;transition:background-color .2s ease;transform:translateY(-50%)}#Datepickk .d-header i:after,#Datepickk .d-header i:before{content:"";width:0;height:0;position:absolute}#Datepickk .d-header i:before{border-top:10px solid transparent;border-bottom:10px solid transparent}#Datepickk .d-header i:after{border-top:7px solid transparent;border-bottom:7px solid transparent;transition:border-color .2s ease}#Datepickk .d-header i#d-previous{left:20px}#Datepickk .d-header i#d-previous:before{border-right:10px solid #fff;top:5px;left:7px}#Datepickk .d-header i#d-previous:after{border-right:7px solid #1b363f;top:8px;left:10px}#Datepickk .d-header i#d-next{right:20px}#Datepickk .d-header i#d-next:before{border-left:10px solid #fff;top:5px;left:12px}#Datepickk .d-header i#d-next:after{border-left:7px solid #1b363f;top:8px;left:12px}#Datepickk .d-header i:hover{background-color:#5e7178}#Datepickk .d-header i:hover:after{border-left-color:#5e7178!important;border-right-color:#5e7178!important}#Datepickk .d-month{cursor:pointer;white-space:nowrap}#Datepickk .d-year{margin-left:10px;cursor:pointer}#Datepickk .d-year:before{content:""}#Datepickk .d-month-picker{display:flex;justify-content:space-between;background-color:rgba(27,54,63,.9);height:0;overflow:hidden;pointer-events:none;transition:height .2s ease}#Datepickk .d-month-picker.d-show{height:44px;pointer-events:auto}#Datepickk .d-month-picker>div{width:8.33333%;text-align:center;line-height:44px;color:#fff;cursor:pointer}#Datepickk .d-month-picker>div:focus,#Datepickk .d-month-picker>div:hover{background-color:#e32d2d;color:#fff}#Datepickk .d-month-picker>div.current{background-color:#e9965a;color:#fff}#Datepickk .d-year-picker{display:flex;justify-content:space-between;background-color:rgba(27,54,63,.9);height:0;overflow:hidden;pointer-events:none;transition:height .2s ease}#Datepickk .d-year-picker.d-show{height:44px;pointer-events:auto}#Datepickk .d-year-picker>div{width:9.09091%;text-align:center;line-height:44px;color:#fff;cursor:pointer}#Datepickk .d-year-picker>div:focus,#Datepickk .d-year-picker>div:hover{background-color:#e32d2d;color:#fff}#Datepickk .d-year-picker>div.current{background-color:#e9965a;color:#fff}#Datepickk .d-weekdays{display:flex}#Datepickk .d-week{background-color:#e95a5a;color:#fff;display:flex;width:100%}#Datepickk .d-week+.d-week{border-left:1px solid hsla(0,0%,100%,.05)}#Datepickk .d-week>div{flex-basis:14.28571%;text-align:center}#Datepickk .d-week>div p{margin:.8em 0}@media (max-height:540px){#Datepickk .d-week{display:none}}#Datepickk .d-table{width:100%;display:flex;flex-wrap:wrap;flex:1}#Datepickk .d-table:first-child:nth-last-child(n+3),#Datepickk .d-table:first-child:nth-last-child(n+3)~div{flex:0;flex-basis:calc(100% / 3 - 1px);border-bottom:1px solid rgba(0,0,0,.05)}#Datepickk .d-table label:nth-of-type(7n) .d-date-legends{padding-right:0}#Datepickk .d-table label:nth-last-of-type(-n+7) .d-date-legends{padding-bottom:0}#Datepickk .d-table input{display:none}#Datepickk .d-table input+label{flex-basis:14.28571%;-ms-flex-preferred-size:14.28%;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:background-color .2s ease,background .2s ease,color .2s ease;position:relative;-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}#Datepickk .d-table input+label text{z-index:3;pointer-events:none;position:relative}#Datepickk .d-table input+label[style*=linear-gradient] text{text-shadow:0 0 20px #000}#Datepickk .d-table input+label.today text:before{content:"";width:100%;height:2px;background-color:#e95a5a;position:absolute;bottom:-5px;left:0}#Datepickk .d-table input+label:before{content:"";position:absolute;top:12.5%;left:12.5%;width:75%;height:75%;border-radius:5px;background-color:#7dd076;transition:transform .1s ease-out;transform:scaleX(0);transform-origin:left}#Datepickk .d-table input+label.legend-hover{animation:a 1s infinite;z-index:4}@keyframes a{0%{transform:translate(0)}50%{transform:translateY(-5px)}to{transform:translate(0)}}#Datepickk .d-table input+label.next,#Datepickk .d-table input+label.prev{color:#ccc}#Datepickk .d-table input+label [data-tooltip]:after{content:"";border-radius:100%;background-color:#1b363f;width:5px;height:5px;position:absolute;top:0;right:-10px}#Datepickk .d-table input+label .d-tooltip{position:absolute;background-color:#1b363f;color:#fff;padding:7px;font-size:.7em;z-index:5;text-align:center;top:100%;left:50%;transform:translate(-50%,-5px);display:none}#Datepickk .d-table input+label .d-tooltip:before{content:"";border-bottom:7px solid #1b363f;border-left:5px solid transparent;border-right:5px solid transparent;top:-7px;left:50%;position:absolute;margin-left:-5px}#Datepickk .d-table input+label .d-tooltip:empty{display:none!important}#Datepickk .d-table input+label:hover .d-tooltip{display:block}#Datepickk .d-table input:checked+label{color:#fff}#Datepickk .d-table input:checked+label:before{transform:scaleX(1)}#Datepickk .d-table input:disabled+label{cursor:not-allowed}#Datepickk .d-table input:disabled+label:after{content:"";position:absolute;top:50%;left:20%;width:60%;height:2px;z-index:4;background-color:#c60000;transform-origin:center;transform:rotate(-25deg)}#Datepickk .d-table input+label.d-hidden{cursor:default;color:#ccc!important;background:#f0f0f0!important;text-decoration:line-through}#Datepickk .d-table input+label.d-hidden:after{content:none}#Datepickk .d-tables{display:flex;flex:1;flex-wrap:wrap}#Datepickk .d-tables:not(.locked) input:not(:checked)+label:not(.hidden):hover{color:#222;background-color:#eaeaea}#Datepickk .d-tables.locked label{cursor:default}#Datepickk .d-tables.range:not(.before) input:not(.single):checked+label,#Datepickk .d-tables.range:not(.before) input:not(.single):checked+label~label:not(.hidden){color:#fff}#Datepickk .d-tables.range:not(.before) input:not(.single):checked+label~label:not(.hidden):before{transform:scaleX(1);background-color:rgba(125,208,118,.5)}#Datepickk .d-tables.range:not(.before) input:not(.single):checked~label:focus~label,#Datepickk .d-tables.range:not(.before) input:not(.single):checked~label:hover~label{color:#666}#Datepickk .d-tables.range:not(.before) input:not(.single):checked~label:focus~label:before,#Datepickk .d-tables.range:not(.before) input:not(.single):checked~label:hover~label:before{transform:scaleX(0)}#Datepickk .d-tables.range:not(.before) input:not(.single):checked~label:focus~label.next,#Datepickk .d-tables.range:not(.before) input:not(.single):checked~label:focus~label.prev,#Datepickk .d-tables.range:not(.before) input:not(.single):checked~label:hover~label.next,#Datepickk .d-tables.range:not(.before) input:not(.single):checked~label:hover~label.prev{color:#ccc}#Datepickk .d-tables.range:not(.before) input:not(.single):checked~input:checked+label{color:#fff}#Datepickk .d-tables.range:not(.before) input:not(.single):checked~input:checked+label:before{transform:scaleX(1);background-color:#7dd076}#Datepickk .d-tables.range:not(.before) input:not(.single):checked~input:checked+label~label{color:inherit}#Datepickk .d-tables.range:not(.before) input:not(.single):checked~input:checked+label~label.next,#Datepickk .d-tables.range:not(.before) input:not(.single):checked~input:checked+label~label.prev{color:#ccc}#Datepickk .d-tables.range:not(.before) input:not(.single):checked~input:checked+label~label:before{transform:scaleX(0)}#Datepickk .d-tables.range.before input:not(.single):not(:checked)+label{color:#fff}#Datepickk .d-tables.range.before input:not(.single):not(:checked)+label:before{transform:scaleX(1);background-color:rgba(233,90,126,.3)}#Datepickk .d-tables.range.before input:not(.single):checked+label~label{color:inherit}#Datepickk .d-tables.range.before input:not(.single):checked+label~label.next,#Datepickk .d-tables.range.before input:not(.single):checked+label~label.prev{color:#ccc}#Datepickk .d-tables.range.before input:not(.single):checked+label~label:before{transform:scaleX(0)}#Datepickk .d-fadeInUp{backface-visibility:visible!important;animation-name:b;animation-duration:.5s;animation-fill-mode:both}@keyframes b{0%{opacity:0;transform:translate3d(0,100%,0)}to{opacity:1;transform:none}}.d-fadeInUp{animation-name:b}#Datepickk.d-show>*{animation-name:c;animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:both}@keyframes c{0%{opacity:0;transform:translateY(-50px)}}@keyframes d{to{opacity:0;transform:translateY(50px)}} \ No newline at end of file +.dp-noscroll{overflow:hidden}#Datepickk{position:fixed;top:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:6;width:100%;height:100%;font-family:inherit;color:#333;user-select:none}#Datepickk.MSIE:not(.wrapped):not(.inline) .dp-calendar{height:560px}#Datepickk.dp-show .dp-overlay{animation-name:show;animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:both}#Datepickk.dp-hide>*{animation-name:d;animation-duration:.2s;animation-timing-function:linear;animation-fill-mode:both}#Datepickk.dp-hide .dp-overlay{animation-name:show;animation-duration:.15s;animation-timing-function:ease-out;animation-fill-mode:both;animation-direction:reverse}#Datepickk .dp-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(55,58,71,.95);z-index:1}#Datepickk .dp-title{text-align:center}#Datepickk .dp-confirm,#Datepickk .dp-title{color:#fff;position:relative;font-size:30px;margin:25px 0;z-index:2}#Datepickk .dp-confirm{border:none;background-color:transparent;outline:none;font-family:inherit;font-weight:500;cursor:pointer;padding:0}#Datepickk .dp-confirm:empty,#Datepickk .dp-title:empty{display:none}@media (max-height:528px){#Datepickk .dp-confirm,#Datepickk .dp-title{font-size:20px;margin:15px 0}#Datepickk .dp-calendar{font-size:20px}}#Datepickk.multi .dp-calendar,#Datepickk.multi .dp-legend{max-width:800px}#Datepickk.multi .dp-table{position:relative;padding-top:35px}#Datepickk.multi .dp-table:before{content:attr(data-month);text-align:right;width:100%;font-size:1em;padding:5px 10px 5px 0;box-sizing:border-box;color:#ccc;position:absolute;left:0;top:0}#Datepickk.inline.dp-show .dp-calendar{animation:none}#Datepickk.inline,#Datepickk.wrapped{position:static;z-index:0}#Datepickk.inline .dp-calendar,#Datepickk.wrapped .dp-calendar{box-shadow:none;z-index:0;max-width:none;max-height:none}#Datepickk.inline .dp-confirm,#Datepickk.inline .dp-title,#Datepickk.wrapped .dp-confirm,#Datepickk.wrapped .dp-title{color:#222}#Datepickk.inline .dp-overlay,#Datepickk.wrapped .dp-overlay{display:none}#Datepickk.inline .dp-legend,#Datepickk.wrapped .dp-legend{color:#222!important;max-width:none;max-height:none}#Datepickk.fullscreen .dp-calendar{max-width:none;max-height:none}#Datepickk.fullscreen .dp-calendar input+label{outline:1px solid #eaeaea;box-sizing:border-box;align-items:flex-start!important;justify-content:flex-end!important}#Datepickk.fullscreen .dp-calendar input+label text{padding:5px 10px 0 0}#Datepickk.fullscreen .dp-legend{max-width:none}#Datepickk .dp-legend{display:flex;flex-wrap:wrap;justify-content:center;width:100%;z-index:2;background-color:#f5f5f5;max-width:500px;position:relative;color:#fff}#Datepickk .dp-legend:empty{height:0}#Datepickk .dp-legend p{backface-visibility:visible!important;animation-name:b;animation-duration:.5s;animation-fill-mode:both;margin:0;padding:15px;transition:background-color .2s ease;cursor:pointer;color:#1b353f}#Datepickk .dp-legend p:after{content:attr(data-legend)}#Datepickk .dp-legend p span{width:20px;height:20px;border-radius:100%;vertical-align:bottom;display:inline-block;margin-right:10px}#Datepickk .dp-calendar{margin:0;background-color:#fff;box-shadow:0 2px 10px -2px rgba(0,0,0,.6);font-size:20px;width:100%;position:relative;max-width:500px;max-height:560px;display:flex;flex-direction:column;justify-content:flex-start;flex-grow:1;z-index:2}#Datepickk .dp-header{position:relative;background-color:#1b363f;color:#fff;font-size:1.5em}#Datepickk .dp-header p{margin:.5em 0;text-align:center}#Datepickk .dp-header i{position:absolute;top:50%;width:30px;height:30px;cursor:pointer;text-align:center;border-radius:100%;transition:background-color .2s ease;transform:translateY(-50%)}#Datepickk .dp-header i:after,#Datepickk .dp-header i:before{content:"";width:0;height:0;position:absolute}#Datepickk .dp-header i:before{border-top:10px solid transparent;border-bottom:10px solid transparent}#Datepickk .dp-header i:after{border-top:7px solid transparent;border-bottom:7px solid transparent;transition:border-color .2s ease}#Datepickk .dp-header i#dp-previous{left:20px}#Datepickk .dp-header i#dp-previous:before{border-right:10px solid #fff;top:5px;left:7px}#Datepickk .dp-header i#dp-previous:after{border-right:7px solid #1b363f;top:8px;left:10px}#Datepickk .dp-header i#dp-next{right:20px}#Datepickk .dp-header i#dp-next:before{border-left:10px solid #fff;top:5px;left:12px}#Datepickk .dp-header i#dp-next:after{border-left:7px solid #1b363f;top:8px;left:12px}#Datepickk .dp-header i:hover{background-color:#5e7178}#Datepickk .dp-header i:hover:after{border-left-color:#5e7178!important;border-right-color:#5e7178!important}#Datepickk .dp-month{cursor:pointer;white-space:nowrap}#Datepickk .dp-year{margin-left:10px;cursor:pointer}#Datepickk .dp-year:before{content:""}#Datepickk .dp-month-picker{display:flex;justify-content:space-between;background-color:rgba(27,54,63,.9);height:0;overflow:hidden;pointer-events:none;transition:height .2s ease}#Datepickk .dp-month-picker.dp-show{height:44px;pointer-events:auto}#Datepickk .dp-month-picker>div{width:8.33333%;text-align:center;line-height:44px;color:#fff;cursor:pointer}#Datepickk .dp-month-picker>div:focus,#Datepickk .dp-month-picker>div:hover{background-color:#e32d2d;color:#fff}#Datepickk .dp-month-picker>div.current{background-color:#e9965a;color:#fff}#Datepickk .dp-year-picker{display:flex;justify-content:space-between;background-color:rgba(27,54,63,.9);height:0;overflow:hidden;pointer-events:none;transition:height .2s ease}#Datepickk .dp-year-picker.dp-show{height:44px;pointer-events:auto}#Datepickk .dp-year-picker>div{width:9.09091%;text-align:center;line-height:44px;color:#fff;cursor:pointer}#Datepickk .dp-year-picker>div:focus,#Datepickk .dp-year-picker>div:hover{background-color:#e32d2d;color:#fff}#Datepickk .dp-year-picker>div.current{background-color:#e9965a;color:#fff}#Datepickk .dp-weekdays{display:flex}#Datepickk .dp-week{background-color:#e95a5a;color:#fff;display:flex;width:100%}#Datepickk .dp-week+.dp-week{border-left:1px solid hsla(0,0%,100%,.05)}#Datepickk .dp-week>div{flex-basis:14.28571%;text-align:center}#Datepickk .dp-week>div p{margin:.8em 0}@media (max-height:540px){#Datepickk .dp-week{display:none}}#Datepickk .dp-table{width:100%;display:flex;flex-wrap:wrap;flex:1}#Datepickk .dp-table:first-child:nth-last-child(n+3),#Datepickk .dp-table:first-child:nth-last-child(n+3)~div{flex:0;flex-basis:calc(100% / 3 - 1px);border-bottom:1px solid rgba(0,0,0,.05)}#Datepickk .dp-table label:nth-of-type(7n) .dp-date-legends{padding-right:0}#Datepickk .dp-table label:nth-last-of-type(-n+7) .dp-date-legends{padding-bottom:0}#Datepickk .dp-table input{display:none}#Datepickk .dp-table input+label{flex-basis:14.28571%;-ms-flex-preferred-size:14.28%;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:background-color .2s ease,background .2s ease,color .2s ease;position:relative;-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}#Datepickk .dp-table input+label text{z-index:3;pointer-events:none;position:relative}#Datepickk .dp-table input+label[style*=linear-gradient] text{text-shadow:0 0 20px #000}#Datepickk .dp-table input+label.today text:before{content:"";width:100%;height:2px;background-color:#e95a5a;position:absolute;bottom:-5px;left:0}#Datepickk .dp-table input+label:before{content:"";position:absolute;top:12.5%;left:12.5%;width:75%;height:75%;border-radius:5px;background-color:#7dd076;transition:transform .1s ease-out;transform:scaleX(0);transform-origin:left}#Datepickk .dp-table input+label.legend-hover{animation:a 1s infinite;z-index:4}@keyframes a{0%{transform:translate(0)}50%{transform:translateY(-5px)}to{transform:translate(0)}}#Datepickk .dp-table input+label.next,#Datepickk .dp-table input+label.prev{color:#ccc}#Datepickk .dp-table input+label [data-tooltip]:after{content:"";border-radius:100%;background-color:#1b363f;width:5px;height:5px;position:absolute;top:0;right:-10px}#Datepickk .dp-table input+label .dp-tooltip{position:absolute;background-color:#1b363f;color:#fff;padding:7px;font-size:.7em;z-index:5;text-align:center;top:100%;left:50%;transform:translate(-50%,-5px);display:none}#Datepickk .dp-table input+label .dp-tooltip:before{content:"";border-bottom:7px solid #1b363f;border-left:5px solid transparent;border-right:5px solid transparent;top:-7px;left:50%;position:absolute;margin-left:-5px}#Datepickk .dp-table input+label .dp-tooltip:empty{display:none!important}#Datepickk .dp-table input+label:hover .dp-tooltip{display:block}#Datepickk .dp-table input:checked+label{color:#fff}#Datepickk .dp-table input:checked+label:before{transform:scaleX(1)}#Datepickk .dp-table input:disabled+label{cursor:not-allowed}#Datepickk .dp-table input:disabled+label:after{content:"";position:absolute;top:50%;left:20%;width:60%;height:2px;z-index:4;background-color:#c60000;transform-origin:center;transform:rotate(-25deg)}#Datepickk .dp-table input+label.dp-hidden{cursor:default;color:#ccc!important;background:#f0f0f0!important;text-decoration:line-through}#Datepickk .dp-table input+label.dp-hidden:after{content:none}#Datepickk .dp-tables{display:flex;flex:1;flex-wrap:wrap}#Datepickk .dp-tables:not(.locked) input:not(:checked)+label:not(.hidden):hover{color:#222;background-color:#eaeaea}#Datepickk .dp-tables.locked label{cursor:default}#Datepickk .dp-tables.range:not(.before) input:not(.single):checked+label,#Datepickk .dp-tables.range:not(.before) input:not(.single):checked+label~label:not(.hidden){color:#fff}#Datepickk .dp-tables.range:not(.before) input:not(.single):checked+label~label:not(.hidden):before{transform:scaleX(1);background-color:rgba(125,208,118,.5)}#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~label:focus~label,#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~label:hover~label{color:#666}#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~label:focus~label:before,#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~label:hover~label:before{transform:scaleX(0)}#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~label:focus~label.next,#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~label:focus~label.prev,#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~label:hover~label.next,#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~label:hover~label.prev{color:#ccc}#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~input:checked+label{color:#fff}#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~input:checked+label:before{transform:scaleX(1);background-color:#7dd076}#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~input:checked+label~label{color:inherit}#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~input:checked+label~label.next,#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~input:checked+label~label.prev{color:#ccc}#Datepickk .dp-tables.range:not(.before) input:not(.single):checked~input:checked+label~label:before{transform:scaleX(0)}#Datepickk .dp-tables.range.before input:not(.single):not(:checked)+label{color:#fff}#Datepickk .dp-tables.range.before input:not(.single):not(:checked)+label:before{transform:scaleX(1);background-color:rgba(233,90,126,.3)}#Datepickk .dp-tables.range.before input:not(.single):checked+label~label{color:inherit}#Datepickk .dp-tables.range.before input:not(.single):checked+label~label.next,#Datepickk .dp-tables.range.before input:not(.single):checked+label~label.prev{color:#ccc}#Datepickk .dp-tables.range.before input:not(.single):checked+label~label:before{transform:scaleX(0)}#Datepickk .dp-fadeInUp{backface-visibility:visible!important;animation-name:b;animation-duration:.5s;animation-fill-mode:both}@keyframes b{0%{opacity:0;transform:translate3d(0,100%,0)}to{opacity:1;transform:none}}.dp-fadeInUp{animation-name:b}#Datepickk.dp-show>*{animation-name:c;animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:both}@keyframes c{0%{opacity:0;transform:translateY(-50px)}}@keyframes d{to{opacity:0;transform:translateY(50px)}} \ No newline at end of file diff --git a/dist/datepickk.min.js b/dist/datepickk.min.js index 3402c24..35ba1ae 100644 --- a/dist/datepickk.min.js +++ b/dist/datepickk.min.js @@ -1,5 +1,5 @@ -(function(a,b){'object'==typeof exports&&'object'==typeof module?module.exports=b():'function'==typeof define&&define.amd?define([],b):'object'==typeof exports?exports.Datepickk=b():a.Datepickk=b()})(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=0)}([function(a,b,c){'use strict';function d(a){function b(){z.el.days.innerHTML='';var a=null==ba?E[S].weekStart:ba;if(Y)for(var b,c=0;cc;c++){b=document.createElement('div'),b.setAttribute('class','d-week');for(var d=0;7>d;d++){var e=d+a>E[S].dayNames.length-1?d+a-E[S].dayNames.length:d+a,f=document.createElement('div'),g=document.createElement('p');g.innerHTML=E[S].dayNames[e],f.appendChild(g),b.appendChild(f)}z.el.days.appendChild(b)}}function h(){[].slice.call(z.el.yearPicker.childNodes).forEach(function(a){a.innerHTML='\''+(C+parseInt(a.getAttribute('data-year'))).toString().substring(2,4)})}function c(){function a(a){function b(a){var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return b?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null}if('LABEL'===a.target.nodeName){var c=a.target.getAttribute('data-legend-id')?a.target.getAttribute('data-legend-id').split(' '):[];c.length&&c.forEach(function(c){var d=z.el.legend.querySelector('[data-legend-id="'+c+'"]');if('mouseover'==a.type&&d){var e=d.getAttribute('data-color')?b(d.getAttribute('data-color')):null;d.setAttribute('style','background-color:rgba('+e.r+','+e.g+','+e.b+',0.35);')}else d&&d.removeAttribute('style')})}}z.el.tables.innerHTML='';for(var b,c=0;cf;f++){e=document.createElement('input'),e.type='checkbox',e.id=d.numInstances+'-'+c+'-d-day-'+f;var g=document.createElement('label');g.setAttribute('for',d.numInstances+'-'+c+'-d-day-'+f);var h=document.createElement('text'),i=document.createElement('span');i.setAttribute('class','d-tooltip'),b.appendChild(e),b.appendChild(g),g.appendChild(h),g.appendChild(i),e.addEventListener(A,function(a){ca&&a.preventDefault()}),e.addEventListener('change',s)}z.el.tables.appendChild(b)}z.el.tables.addEventListener('mouseover',a),z.el.tables.addEventListener('mouseout',a)}function i(){function a(a){[].slice.call(z.el.tables.querySelectorAll('[data-legend-id*="'+this.getAttribute('data-legend-id')+'"]')).forEach(function(b){'mouseover'==a.type?b.classList.add('legend-hover'):b.classList.remove('legend-hover')})}for(var b=new Date(z.el.tables.childNodes[0].childNodes[0].getAttribute('data-date')),c=new Date(z.el.tables.childNodes[J-1].childNodes[82].getAttribute('data-date')),d=W.filter(function(a){for(var d=0;db)return!0;return!1}),e=[],f=0;fe.indexOf(b)&&(b.removeEventListener('mouseover',a),b.removeEventListener('mouseout',a),z.el.legend.removeChild(b))})}function j(a){return 11a&&(a+=12),a}function k(a,b){var c=z.el.querySelectorAll('.d-table'),d=null==ba?E[S].weekStart:ba;[].slice.call(z.el.querySelectorAll('.d-table')).forEach(function(e,f){var g=new Date(a,b+f,0).getDate(),h=new Date(a,b+f-1,0).getDate(),k=new Date(a,b+f-1,1).getDay();0>k-d?k=7-d:k-=d;var i=E[S].monthNames[j(b-1+f)];e.setAttribute('data-month',i),[].slice.call(e.querySelectorAll('.d-table input')).forEach(function(d,e){var i=d.nextSibling;d.checked=!1,d.removeAttribute('disabled'),i.removeAttribute('style'),i.removeAttribute('data-legend-id'),i.className='';var j=null;if(eaa)&&(d.setAttribute('disabled',!0),i.className='d-hidden'),Z&&j.getTime()==new Date().setHours(0,0,0,0)?i.classList.add('today'):i.classList.remove('today'),X[j.getTime()]?(i.childNodes[0].setAttribute('data-tooltip',!0),i.childNodes[1].innerHTML=X[j.getTime()]):(i.childNodes[0].removeAttribute('data-tooltip'),i.childNodes[1].innerHTML='');var l=W.filter(function(a){for(var b=0;b=a.dates[b].start.getTime()&&j.getTime()<=a.dates[b].end.getTime())return!0;return!1});if(0D)&&(12=new Date(aa).setDate(1)?(C=aa.getFullYear(),D=aa.getMonth()+1-J+1,z.el.header.childNodes[2].setAttribute('style','visibility:hidden')):z.el.header.childNodes[2].removeAttribute('style'),_&&new Date(C,D-1,1)<=new Date(_).setDate(1)?(C=_.getFullYear(),D=_.getMonth()+1,z.el.header.childNodes[0].setAttribute('style','visibility:hidden')):z.el.header.childNodes[0].removeAttribute('style');for(var a,b=0;ba&&(a+=12),z.el.monthPicker.childNodes[a].classList.add('current');k(C,D),h();var c=E[S].monthNames[D-1],d='';if(1e&&(e+=12),d+=E[S].monthNames[e]}var f=11=new Date(b[0].getFullYear(),b[0].getMonth(),1)&&a<=new Date(b[1].getFullYear(),b[1].getMonth(),1)&&z.el.tables.classList.add('before')}}function n(){[].slice.call(z.el.querySelectorAll('.d-table input')).forEach(function(a){a.checked=!1}),[].slice.call(z.el.monthPicker.querySelectorAll('.current')).forEach(function(a){a.classList.remove('current')}),[].slice.call(z.el.yearPicker.querySelectorAll('.current')).forEach(function(a){a.classList.remove('current')})}function o(){D+=J,l()}function p(){D-=J,l()}function q(a,b){a=new Date(a),a.setHours(0,0,0,0);var c=z.el.querySelector('[data-date="'+a.toJSON()+'"]');F&&c&&c.checked&&c.classList.add('single'),c&&!c.checked&&(c.checked=!0),B.push(a),T&&!b&&T.apply(a,[!0])}function r(a,b){a=new Date(a),a.setHours(0,0,0,0);var c=z.el.querySelector('[data-date="'+a.toJSON()+'"]');c&&(c.classList.remove('single'),c.checked&&(c.checked=!1)),B=B.filter(function(b){return b.getTime()!=a.getTime()}),T&&!b&&T.call(a,!1)}function s(){var a=this,b=new Date(a.getAttribute('data-date'));if(a.classList.remove('single'),!ca){if(F&&z.el.tables.classList.remove('before'),a.checked){if(G&&B.length>G-1){var c=B.length;for(c;c>G-1;c--)r(B[0])}if(F&&B.length){var d=z.el.querySelector('[data-date="'+B[0].toJSON()+'"]');!d&&b>B[0]&&z.el.tables.classList.add('before')}B.push(b),K&&z.hide()}else F&&1==B.length&&B[0].getTime()==b.getTime()?(q(b),a.classList.add('single')):B=B.filter(function(a){return a.getTime()!=b.getTime()});T&&T.call(b,a.checked)}}function t(a){a?(F=!0,z.el.tables.classList.add('range')):(F=!1,z.el.tables.classList.remove('range'))}function u(a){z.inline||z.container!==document.body||document.body.classList.add('d-noscroll'),x(a);z.el.calendar.addEventListener(e(),function a(){z.el.classList.remove('d-show'),z.el.calendar.removeEventListener(e(),a)}),z.el.classList.add('d-show'),H.appendChild(z.el),I=!0,$&&(D=$.getMonth()+1,C=$.getFullYear()),l()}function v(){document.body.classList.remove('d-noscroll');z.el.addEventListener(e(),function a(){z.el.parentNode.removeChild(z.el),I=!1,z.el.classList.remove('d-hide'),'function'==typeof O&&O.apply(z),z.el.removeEventListener(e(),a)}),z.el.classList.add('d-hide')}function w(){z.el.header.childNodes[0].addEventListener(A,p),z.el.header.childNodes[2].addEventListener(A,o),z.el.header.childNodes[1].childNodes[0].addEventListener(A,function(){z.el.monthPicker.classList.contains('d-show')?z.el.monthPicker.classList.remove('d-show'):z.el.monthPicker.classList.add('d-show'),z.el.yearPicker.classList.remove('d-show')}),z.el.header.childNodes[1].childNodes[1].addEventListener(A,function(){h(),z.el.yearPicker.classList.contains('d-show')?z.el.yearPicker.classList.remove('d-show'):z.el.yearPicker.classList.add('d-show'),z.el.monthPicker.classList.remove('d-show')}),z.el.button.addEventListener(A,v),z.el.overlay.addEventListener(A,function(){Q&&z.hide()}),[].slice.call(z.el.monthPicker.childNodes).forEach(function(a){a.addEventListener(A,function(){D=parseInt(this.getAttribute('data-month')),l(),z.el.monthPicker.classList.remove('d-show')})}),[].slice.call(z.el.yearPicker.childNodes).forEach(function(a){a.addEventListener(A,function(){C+=parseInt(this.getAttribute('data-year')),l(),z.el.yearPicker.classList.remove('d-show')})});var a=0,b=0;z.el.calendar.addEventListener('touchstart',function(b){a=b.changedTouches[0].clientX||b.originalEvent.changedTouches[0].clientX}),z.el.calendar.addEventListener('touchmove',function(c){b=c.changedTouches[0].clientX-a||c.originalEvent.changedTouches[0].clientX-a,c.preventDefault()}),z.el.calendar.addEventListener('touchend',function(){50b&&o(),b=0})}function x(a){for(var b in a)b in z&&(z[b]=a[b])}function y(a){a=new Date(a),D=a.getMonth()+1,C=a.getFullYear(),l()}d.numInstances=(d.numInstances||0)+1;var z=this,A='click',B=[],C=new Date().getFullYear(),D=new Date().getMonth()+1,E={no:{monthNames:['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'],dayNames:['s\xF8','ma','ti','on','to','fr','l\xF8'],weekStart:1},se:{monthNames:['januari','februari','mars','april','maj','juni','juli','augusti','september','oktober','november','december'],dayNames:['s\xF6','m\xE5','ti','on','to','fr','l\xF6'],weekStart:1},ru:{monthNames:['\u042F\u043D\u0432\u0430\u0440\u044C','\u0424\u0435\u0432\u0440\u0430\u043B\u044C','\u041C\u0430\u0440\u0442','\u0410\u043F\u0440\u0435\u043B\u044C','\u041C\u0430\u0439','\u0418\u044E\u043D\u044C','\u0418\u044E\u043B\u044C','\u0410\u0432\u0433\u0443\u0441\u0442','\u0421\u0435\u043D\u0442\u044F\u0431\u0440\u044C','\u041E\u043A\u0442\u044F\u0431\u0440\u044C','\u041D\u043E\u044F\u0431\u0440\u044C','\u0414\u0435\u043A\u0430\u0431\u0440\u044C'],dayNames:['\u0432\u0441','\u043F\u043D','\u0432\u0442','\u0441\u0440','\u0447\u0442','\u043F\u0442','\u0441\u0431'],weekStart:1},en:{monthNames:['january','february','march','april','may','june','july','august','september','october','november','december'],dayNames:['su','mo','tu','we','th','fr','sa'],weekStart:0},de:{monthNames:['Januar','Februar','M\xE4rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],dayNames:['So','Mo','Di','Mi','Do','Fr','Sa'],weekStart:1}};E.nb=E.no,E.nn=E.no;var F=!1,G=null,H=document.body,I=!1,J=1,K=!1,L=null,M=null,N=null,O=null,P=null,Q=!0,R=!1,S='en',T=null,U=[],V=[],W=[],X={},Y=!0,Z=!0,$=null,_=null,aa=null,ba=null,ca=!1;return z.show=u,z.hide=v,z.selectDate=q,z.unselectAll=function(a){B.forEach(function(b){r(b,a)})},z.unselectDate=r,Object.defineProperties(z,{selectedDates:{get:function(){return B.sort(function(c,a){return c.getTime()-a.getTime()})}},range:{get:function(){return F},set:function(a){t(a),a&&(G=2)}},button:{get:function(){return L},set:function(a){L='string'==typeof a?a:null,z.el.button.innerHTML=L?L:''}},title:{get:function(){return M},set:function(a){M='string'==typeof a?a:null,z.el.titleBox.innerText=M?M:''}},lang:{get:function(){return S},set:function(a){a in E?(S=a,b(),l()):console.error('Language not found')}},weekStart:{get:function(){return null==ba?E[S].weekStart:ba},set:function(a){'number'==typeof a&&-1a?(ba=a,b(),l()):console.error('weekStart must be a number between 0 and 6')}},months:{get:function(){return J},set:function(a){'number'==typeof a&&0 0')}},isOpen:{get:function(){return I}},closeOnSelect:{get:function(){return K},set:function(a){K=!!a}},disabledDays:{get:function(){return V},set:function(a){if(a instanceof Array)for(var b=0;bc;c++){b=document.createElement('div'),b.setAttribute('class','dp-week');for(var d=0;7>d;d++){var e=d+a>E[S].dayNames.length-1?d+a-E[S].dayNames.length:d+a,f=document.createElement('div'),g=document.createElement('p');g.innerHTML=E[S].dayNames[e],f.appendChild(g),b.appendChild(f)}z.el.days.appendChild(b)}}function h(){[].slice.call(z.el.yearPicker.childNodes).forEach(function(a){a.innerHTML='\''+(C+parseInt(a.getAttribute('data-year'))).toString().substring(2,4)})}function c(){function a(a){function b(a){var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return b?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null}if('LABEL'===a.target.nodeName){var c=a.target.getAttribute('data-legend-id')?a.target.getAttribute('data-legend-id').split(' '):[];c.length&&c.forEach(function(c){var d=z.el.legend.querySelector('[data-legend-id="'+c+'"]');if('mouseover'==a.type&&d){var e=d.getAttribute('data-color')?b(d.getAttribute('data-color')):null;d.setAttribute('style','background-color:rgba('+e.r+','+e.g+','+e.b+',0.35);')}else d&&d.removeAttribute('style')})}}z.el.tables.innerHTML='';for(var b,c=0;cf;f++){e=document.createElement('input'),e.type='checkbox',e.id=d.numInstances+'-'+c+'-d-day-'+f;var g=document.createElement('label');g.setAttribute('for',d.numInstances+'-'+c+'-d-day-'+f);var h=document.createElement('text'),i=document.createElement('span');i.setAttribute('class','dp-tooltip'),b.appendChild(e),b.appendChild(g),g.appendChild(h),g.appendChild(i),e.addEventListener(A,function(a){ca&&a.preventDefault()}),e.addEventListener('change',s)}z.el.tables.appendChild(b)}z.el.tables.addEventListener('mouseover',a),z.el.tables.addEventListener('mouseout',a)}function i(){function a(a){[].slice.call(z.el.tables.querySelectorAll('[data-legend-id*="'+this.getAttribute('data-legend-id')+'"]')).forEach(function(b){'mouseover'==a.type?b.classList.add('legend-hover'):b.classList.remove('legend-hover')})}for(var b=new Date(z.el.tables.childNodes[0].childNodes[0].getAttribute('data-date')),c=new Date(z.el.tables.childNodes[J-1].childNodes[82].getAttribute('data-date')),d=W.filter(function(a){for(var d=0;db)return!0;return!1}),e=[],f=0;fe.indexOf(b)&&(b.removeEventListener('mouseover',a),b.removeEventListener('mouseout',a),z.el.legend.removeChild(b))})}function j(a){return 11a&&(a+=12),a}function k(a,b){var c=z.el.querySelectorAll('.dp-table'),d=null==ba?E[S].weekStart:ba;[].slice.call(z.el.querySelectorAll('.dp-table')).forEach(function(e,f){var g=new Date(a,b+f,0).getDate(),h=new Date(a,b+f-1,0).getDate(),k=new Date(a,b+f-1,1).getDay();0>k-d?k=7-d:k-=d;var i=E[S].monthNames[j(b-1+f)];e.setAttribute('data-month',i),[].slice.call(e.querySelectorAll('.dp-table input')).forEach(function(d,e){var i=d.nextSibling;d.checked=!1,d.removeAttribute('disabled'),i.removeAttribute('style'),i.removeAttribute('data-legend-id'),i.className='';var j=null;if(eaa)&&(d.setAttribute('disabled',!0),i.className='dp-hidden'),Z&&j.getTime()==new Date().setHours(0,0,0,0)?i.classList.add('today'):i.classList.remove('today'),X[j.getTime()]?(i.childNodes[0].setAttribute('data-tooltip',!0),i.childNodes[1].innerHTML=X[j.getTime()]):(i.childNodes[0].removeAttribute('data-tooltip'),i.childNodes[1].innerHTML='');var l=W.filter(function(a){for(var b=0;b=a.dates[b].start.getTime()&&j.getTime()<=a.dates[b].end.getTime())return!0;return!1});if(0D)&&(12=new Date(aa).setDate(1)?(C=aa.getFullYear(),D=aa.getMonth()+1-J+1,z.el.header.childNodes[2].setAttribute('style','visibility:hidden')):z.el.header.childNodes[2].removeAttribute('style'),_&&new Date(C,D-1,1)<=new Date(_).setDate(1)?(C=_.getFullYear(),D=_.getMonth()+1,z.el.header.childNodes[0].setAttribute('style','visibility:hidden')):z.el.header.childNodes[0].removeAttribute('style');for(var a,b=0;ba&&(a+=12),z.el.monthPicker.childNodes[a].classList.add('current');k(C,D),h();var c=E[S].monthNames[D-1],d='';if(1e&&(e+=12),d+=E[S].monthNames[e]}var f=11=new Date(b[0].getFullYear(),b[0].getMonth(),1)&&a<=new Date(b[1].getFullYear(),b[1].getMonth(),1)&&z.el.tables.classList.add('before')}}function n(){[].slice.call(z.el.querySelectorAll('.dp-table input')).forEach(function(a){a.checked=!1}),[].slice.call(z.el.monthPicker.querySelectorAll('.current')).forEach(function(a){a.classList.remove('current')}),[].slice.call(z.el.yearPicker.querySelectorAll('.current')).forEach(function(a){a.classList.remove('current')})}function o(){D+=J,l()}function p(){D-=J,l()}function q(a,b){a=new Date(a),a.setHours(0,0,0,0);var c=z.el.querySelector('[data-date="'+a.toJSON()+'"]');F&&c&&c.checked&&c.classList.add('single'),c&&!c.checked&&(c.checked=!0),B.push(a),T&&!b&&T.apply(a,[!0])}function r(a,b){a=new Date(a),a.setHours(0,0,0,0);var c=z.el.querySelector('[data-date="'+a.toJSON()+'"]');c&&(c.classList.remove('single'),c.checked&&(c.checked=!1)),B=B.filter(function(b){return b.getTime()!=a.getTime()}),T&&!b&&T.call(a,!1)}function s(){var a=this,b=new Date(a.getAttribute('data-date'));if(a.classList.remove('single'),!ca){if(F&&z.el.tables.classList.remove('before'),a.checked){if(G&&B.length>G-1){var c=B.length;for(c;c>G-1;c--)r(B[0])}if(F&&B.length){var d=z.el.querySelector('[data-date="'+B[0].toJSON()+'"]');!d&&b>B[0]&&z.el.tables.classList.add('before')}B.push(b),K&&z.hide()}else F&&1==B.length&&B[0].getTime()==b.getTime()?(q(b),a.classList.add('single')):B=B.filter(function(a){return a.getTime()!=b.getTime()});T&&T.call(b,a.checked)}}function t(a){a?(F=!0,z.el.tables.classList.add('range')):(F=!1,z.el.tables.classList.remove('range'))}function u(a){z.inline||z.container!==document.body||document.body.classList.add('dp-noscroll'),x(a);z.el.calendar.addEventListener(e(),function a(){z.el.classList.remove('dp-show'),z.el.calendar.removeEventListener(e(),a)}),z.el.classList.add('dp-show'),H.appendChild(z.el),I=!0,$&&(D=$.getMonth()+1,C=$.getFullYear()),l()}function v(){document.body.classList.remove('dp-noscroll');z.el.addEventListener(e(),function a(){z.el.parentNode.removeChild(z.el),I=!1,z.el.classList.remove('dp-hide'),'function'==typeof O&&O.apply(z),z.el.removeEventListener(e(),a)}),z.el.classList.add('dp-hide')}function w(){z.el.header.childNodes[0].addEventListener(A,p),z.el.header.childNodes[2].addEventListener(A,o),z.el.header.childNodes[1].childNodes[0].addEventListener(A,function(){z.el.monthPicker.classList.contains('dp-show')?z.el.monthPicker.classList.remove('dp-show'):z.el.monthPicker.classList.add('dp-show'),z.el.yearPicker.classList.remove('dp-show')}),z.el.header.childNodes[1].childNodes[1].addEventListener(A,function(){h(),z.el.yearPicker.classList.contains('dp-show')?z.el.yearPicker.classList.remove('dp-show'):z.el.yearPicker.classList.add('dp-show'),z.el.monthPicker.classList.remove('dp-show')}),z.el.button.addEventListener(A,v),z.el.overlay.addEventListener(A,function(){Q&&z.hide()}),[].slice.call(z.el.monthPicker.childNodes).forEach(function(a){a.addEventListener(A,function(){D=parseInt(this.getAttribute('data-month')),l(),z.el.monthPicker.classList.remove('dp-show')})}),[].slice.call(z.el.yearPicker.childNodes).forEach(function(a){a.addEventListener(A,function(){C+=parseInt(this.getAttribute('data-year')),l(),z.el.yearPicker.classList.remove('dp-show')})});var a=0,b=0;z.el.calendar.addEventListener('touchstart',function(b){a=b.changedTouches[0].clientX||b.originalEvent.changedTouches[0].clientX}),z.el.calendar.addEventListener('touchmove',function(c){b=c.changedTouches[0].clientX-a||c.originalEvent.changedTouches[0].clientX-a,c.preventDefault()}),z.el.calendar.addEventListener('touchend',function(){50b&&o(),b=0})}function x(a){for(var b in a)b in z&&(z[b]=a[b])}function y(a){a=new Date(a),D=a.getMonth()+1,C=a.getFullYear(),l()}d.numInstances=(d.numInstances||0)+1;var z=this,A='click',B=[],C=new Date().getFullYear(),D=new Date().getMonth()+1,E={no:{monthNames:['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'],dayNames:['s\xF8','ma','ti','on','to','fr','l\xF8'],weekStart:1},se:{monthNames:['januari','februari','mars','april','maj','juni','juli','augusti','september','oktober','november','december'],dayNames:['s\xF6','m\xE5','ti','on','to','fr','l\xF6'],weekStart:1},ru:{monthNames:['\u042F\u043D\u0432\u0430\u0440\u044C','\u0424\u0435\u0432\u0440\u0430\u043B\u044C','\u041C\u0430\u0440\u0442','\u0410\u043F\u0440\u0435\u043B\u044C','\u041C\u0430\u0439','\u0418\u044E\u043D\u044C','\u0418\u044E\u043B\u044C','\u0410\u0432\u0433\u0443\u0441\u0442','\u0421\u0435\u043D\u0442\u044F\u0431\u0440\u044C','\u041E\u043A\u0442\u044F\u0431\u0440\u044C','\u041D\u043E\u044F\u0431\u0440\u044C','\u0414\u0435\u043A\u0430\u0431\u0440\u044C'],dayNames:['\u0432\u0441','\u043F\u043D','\u0432\u0442','\u0441\u0440','\u0447\u0442','\u043F\u0442','\u0441\u0431'],weekStart:1},en:{monthNames:['january','february','march','april','may','june','july','august','september','october','november','december'],dayNames:['su','mo','tu','we','th','fr','sa'],weekStart:0},de:{monthNames:['Januar','Februar','M\xE4rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],dayNames:['So','Mo','Di','Mi','Do','Fr','Sa'],weekStart:1},uk:{monthNames:['\u0421\u0456\u0447\u0435\u043D\u044C','\u041B\u044E\u0442\u0438\u0439','\u0411\u0435\u0440\u0435\u0437\u0435\u043D\u044C','\u041A\u0432\u0456\u0442\u0435\u043D\u044C','\u0422\u0440\u0430\u0432\u0435\u043D\u044C','\u0427\u0435\u0440\u0432\u0435\u043D\u044C','\u041B\u0438\u043F\u0435\u043D\u044C','\u0421\u0435\u0440\u043F\u0435\u043D\u044C','\u0412\u0435\u0440\u0435\u0441\u0435\u043D\u044C','\u0416\u043E\u0432\u0442\u0435\u043D\u044C','\u041B\u0438\u0441\u0442\u043E\u043F\u0430\u0434','\u0413\u0440\u0443\u0434\u0435\u043D\u044C'],dayNames:['\u043D\u0434','\u043F\u043D','\u0432\u0442','\u0441\u0440','\u0447\u0442','\u043F\u0442','\u0441\u0431'],weekStart:1}};E.nb=E.no,E.nn=E.no;var F=!1,G=null,H=document.body,I=!1,J=1,K=!1,L=null,M=null,N=null,O=null,P=null,Q=!0,R=!1,S='en',T=null,U=[],V=[],W=[],X={},Y=!0,Z=!0,$=null,_=null,aa=null,ba=null,ca=!1;return z.show=u,z.hide=v,z.selectDate=q,z.unselectAll=function(a){B.forEach(function(b){r(b,a)})},z.unselectDate=r,Object.defineProperties(z,{selectedDates:{get:function(){return B.sort(function(c,a){return c.getTime()-a.getTime()})}},range:{get:function(){return F},set:function(a){t(a),a&&(G=2)}},button:{get:function(){return L},set:function(a){L='string'==typeof a?a:null,z.el.button.innerHTML=L?L:''}},title:{get:function(){return M},set:function(a){M='string'==typeof a?a:null,z.el.titleBox.innerText=M?M:''}},lang:{get:function(){return S},set:function(a){a in E?(S=a,b(),l()):console.error('Language not found')}},weekStart:{get:function(){return null==ba?E[S].weekStart:ba},set:function(a){'number'==typeof a&&-1a?(ba=a,b(),l()):console.error('weekStart must be a number between 0 and 6')}},months:{get:function(){return J},set:function(a){'number'==typeof a&&0 0')}},isOpen:{get:function(){return I}},closeOnSelect:{get:function(){return K},set:function(a){K=!!a}},disabledDays:{get:function(){return V},set:function(a){if(a instanceof Array)for(var b=0;b *{ animation-name: DatepickkHide; @@ -49,7 +49,7 @@ animation-fill-mode: both; } - .d-overlay{ + .dp-overlay{ animation-name: show; animation-duration: .15s; animation-timing-function: ease-out; @@ -58,7 +58,7 @@ } } - .d-overlay{ + .dp-overlay{ position: absolute; top: 0; left: 0; @@ -68,7 +68,7 @@ z-index:1; } - .d-title{ + .dp-title{ color:white; text-align: center; position: relative; @@ -77,7 +77,7 @@ z-index: 2; } - .d-confirm{ + .dp-confirm{ border: none; position: relative; background-color: transparent; @@ -92,26 +92,26 @@ z-index: 2; } - .d-title:empty,.d-confirm:empty{ + .dp-title:empty,.dp-confirm:empty{ display: none; } @media(max-height:528px){ - .d-title,.d-confirm{ + .dp-title,.dp-confirm{ font-size:20px; margin:15px 0; } - .d-calendar{ + .dp-calendar{ font-size: 20px; } } &.multi{ - .d-calendar,.d-legend{ + .dp-calendar,.dp-legend{ max-width: 800px; } - .d-table{ + .dp-table{ position: relative; padding-top:35px; @@ -131,7 +131,7 @@ } &.inline{ - &.d-show .d-calendar{ + &.dp-show .dp-calendar{ animation: none; } } @@ -140,22 +140,22 @@ position: static; z-index: 0; - .d-calendar{ + .dp-calendar{ box-shadow: none; z-index: 0; max-width: none; max-height: none; } - .d-confirm,.d-title{ + .dp-confirm,.dp-title{ color:#222; } - .d-overlay{ + .dp-overlay{ display: none; } - .d-legend{ + .dp-legend{ color:#222!important; max-width: none; max-height: none; @@ -163,7 +163,7 @@ } &.fullscreen{ - .d-calendar{ + .dp-calendar{ max-width: none; max-height: none; @@ -179,12 +179,12 @@ } } - .d-legend{ + .dp-legend{ max-width: none; } } - .d-legend{ + .dp-legend{ display: flex; flex-wrap:wrap; justify-content:center; @@ -200,7 +200,7 @@ } p{ - .d-fadeInUp(); + .dp-fadeInUp(); margin:0; padding: 15px; transition: background-color .2s ease; @@ -222,7 +222,7 @@ } } - .d-calendar{ + .dp-calendar{ margin:0; background-color:white; box-shadow: 0px 2px 10px -2px rgba(0, 0, 0, 0.6); @@ -238,7 +238,7 @@ z-index: 2; } - .d-header{ + .dp-header{ position: relative; background-color: #1B363F; color: white; @@ -278,7 +278,7 @@ transition: border-color .2s ease; } - &#d-previous{ + &#dp-previous{ left:20px; &:before{ border-right: 10px solid #FFF; @@ -293,7 +293,7 @@ } } - &#d-next{ + &#dp-next{ right:20px; &:before{ border-left: 10px solid #FFF; @@ -318,12 +318,12 @@ } } - .d-month{ + .dp-month{ cursor: pointer; white-space: nowrap; } - .d-year{ + .dp-year{ margin-left:10px; cursor: pointer; @@ -332,7 +332,7 @@ } } - .d-month-picker{ + .dp-month-picker{ display: flex; justify-content:space-between; background-color: fade(#1B363F,90%); @@ -341,7 +341,7 @@ pointer-events: none; transition: height .2s ease; - &.d-show{ + &.dp-show{ height: 44px; pointer-events: auto; } @@ -365,7 +365,7 @@ } } - .d-year-picker{ + .dp-year-picker{ display: flex; justify-content:space-between; background-color: fade(#1B363F,90%); @@ -374,7 +374,7 @@ pointer-events: none; transition: height .2s ease; - &.d-show{ + &.dp-show{ height: 44px; pointer-events: auto; } @@ -398,16 +398,16 @@ } } - .d-weekdays{ + .dp-weekdays{ display: flex; } - .d-week{ + .dp-week{ background-color:@color; color:contrast(@color,black,white); display: flex; width: 100%; - & + .d-week{ + & + .dp-week{ border-left:1px solid rgba(255,255,255,0.05); } @@ -425,7 +425,7 @@ } } - .d-table{ + .dp-table{ width: 100%; display: flex; flex-wrap: wrap; @@ -438,11 +438,11 @@ border-bottom:1px solid rgba(0,0,0,0.05); } - label:nth-of-type(7n) .d-date-legends{ + label:nth-of-type(7n) .dp-date-legends{ padding-right:0; } - label:nth-last-of-type(-n + 7) .d-date-legends{ + label:nth-last-of-type(-n + 7) .dp-date-legends{ padding-bottom:0; } @@ -531,7 +531,7 @@ } - .d-tooltip{ + .dp-tooltip{ position: absolute; background-color: #1B363F; color: #FFF; @@ -561,7 +561,7 @@ } &:hover { - .d-tooltip{ + .dp-tooltip{ display: block; } } @@ -595,7 +595,7 @@ } - & + label.d-hidden{ + & + label.dp-hidden{ cursor:default; color: #ccc!important; background: #f0f0f0!important; @@ -608,7 +608,7 @@ } } - .d-tables{ + .dp-tables{ display: flex; flex:1; flex-wrap:wrap; @@ -701,7 +701,7 @@ } } - .d-fadeInUp { + .dp-fadeInUp { backface-visibility: visible !important; animation-name: DatepickfadeInUp; animation-duration: .5s; @@ -727,11 +727,11 @@ } } -.d-fadeInUp { +.dp-fadeInUp { animation-name: DatepickfadeInUp; } -#Datepickk.d-show > *{ +#Datepickk.dp-show > *{ animation-name: DatepickkShow; animation-duration: .2s; animation-timing-function: ease-out; diff --git a/src/js/datepickk.js b/src/js/datepickk.js index 34c1be3..8faa42a 100644 --- a/src/js/datepickk.js +++ b/src/js/datepickk.js @@ -40,6 +40,11 @@ function Datepickk(args){ monthNames:['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'], dayNames:['So','Mo','Di','Mi','Do','Fr','Sa'], weekStart:1 + }, + uk: { + monthNames:['Січень','Лютий','Березень','Квітень','Травень','Червень','Липень','Серпень','Вересень','Жовтень','Листопад','Грудень'], + dayNames:['нд','пн','вт','ср','чт','пт','сб'], + weekStart:1 } }; @@ -80,7 +85,7 @@ function Datepickk(args){ if(daynames){ for(var x = 0;x languages[lang].dayNames.length - 1) ? i + ws - languages[lang].dayNames.length : i + ws; @@ -107,7 +112,7 @@ function Datepickk(args){ that.el.tables.innerHTML = ''; for(var x = 0;x maxDate)){ inputEl.setAttribute('disabled',true); - labelEl.className = 'd-hidden'; + labelEl.className = 'dp-hidden'; } @@ -437,7 +442,7 @@ function Datepickk(args){ }; function resetCalendar(){ - [].slice.call(that.el.querySelectorAll('.d-table input')).forEach(function(inputEl) { + [].slice.call(that.el.querySelectorAll('.dp-table input')).forEach(function(inputEl) { inputEl.checked = false; }); @@ -557,14 +562,14 @@ function Datepickk(args){ }; function show(properties){ - if(!that.inline && that.container === document.body){document.body.classList.add('d-noscroll');} + if(!that.inline && that.container === document.body){document.body.classList.add('dp-noscroll');} setArgs(properties); var handler = function(){ - that.el.classList.remove('d-show'); + that.el.classList.remove('dp-show'); that.el.calendar.removeEventListener(whichAnimationEvent(),handler); }; that.el.calendar.addEventListener(whichAnimationEvent(),handler); - that.el.classList.add('d-show'); + that.el.classList.add('dp-show'); container.appendChild(that.el); opened = true; if(startDate){ @@ -575,39 +580,39 @@ function Datepickk(args){ }; function hide(){ - document.body.classList.remove('d-noscroll'); + document.body.classList.remove('dp-noscroll'); var handler = function(){ that.el.parentNode.removeChild(that.el); opened = false; - that.el.classList.remove('d-hide'); + that.el.classList.remove('dp-hide'); if(typeof onClose == 'function'){ onClose.apply(that); } that.el.removeEventListener(whichAnimationEvent(),handler); } that.el.addEventListener(whichAnimationEvent(),handler); - that.el.classList.add('d-hide'); + that.el.classList.add('dp-hide'); }; function bindEvents(){ that.el.header.childNodes[0].addEventListener(eventName,prevMonth); that.el.header.childNodes[2].addEventListener(eventName,nextMonth); that.el.header.childNodes[1].childNodes[0].addEventListener(eventName,function(){ - if(that.el.monthPicker.classList.contains('d-show')){ - that.el.monthPicker.classList.remove('d-show'); + if(that.el.monthPicker.classList.contains('dp-show')){ + that.el.monthPicker.classList.remove('dp-show'); }else{ - that.el.monthPicker.classList.add('d-show'); + that.el.monthPicker.classList.add('dp-show'); } - that.el.yearPicker.classList.remove('d-show'); + that.el.yearPicker.classList.remove('dp-show'); }); that.el.header.childNodes[1].childNodes[1].addEventListener(eventName,function(){ generateYears(); - if(that.el.yearPicker.classList.contains('d-show')){ - that.el.yearPicker.classList.remove('d-show'); + if(that.el.yearPicker.classList.contains('dp-show')){ + that.el.yearPicker.classList.remove('dp-show'); }else{ - that.el.yearPicker.classList.add('d-show'); + that.el.yearPicker.classList.add('dp-show'); } - that.el.monthPicker.classList.remove('d-show'); + that.el.monthPicker.classList.remove('dp-show'); }); that.el.button.addEventListener(eventName,hide); @@ -621,7 +626,7 @@ function Datepickk(args){ monthPicker.addEventListener(eventName,function(){ currentMonth = parseInt(this.getAttribute('data-month')); setDate(); - that.el.monthPicker.classList.remove('d-show'); + that.el.monthPicker.classList.remove('dp-show'); }); }); @@ -629,7 +634,7 @@ function Datepickk(args){ yearPicker.addEventListener(eventName,function(){ currentYear += parseInt(this.getAttribute('data-year')); setDate(); - that.el.yearPicker.classList.remove('d-show'); + that.el.yearPicker.classList.remove('dp-show'); }); }) @@ -1161,14 +1166,14 @@ function whichAnimationEvent(){ } } -var template = '
' + - '
' + - '
' + - '' + - '

' + - '' + +var template = '
' + + '
' + + '
' + + '' + + '

' + + '' + '
' + - '
' + + '
' + '
1
' + '
2
' + '
3
' + @@ -1182,7 +1187,7 @@ var template = '
' + '
11
' + '
12
' + '
' + - '
' + + '
' + '
' + '
' + '
' + @@ -1195,12 +1200,12 @@ var template = '
' + '
' + '
' + '
' + - '
' + - '
' + + '
' + + '
' + '
' + - '
' + - '' + - '
'; + '
' + + '' + + '
'; var getBrowserVersion = function(){ var browser = {