From 776f0a5781abd682e5427709b6b6a24ef16cc3de Mon Sep 17 00:00:00 2001
From: t1m0n
Date: Thu, 10 Dec 2015 15:21:45 +0300
Subject: [PATCH] update docs
---
docs/css/style.css | 2 +-
docs/index-ru.html | 116 ++++++++++++++++++------
docs/index.html | 124 +++++++++++++++++++------
docs/jade/pages/index-ru.jade | 166 +++++++++++++++++++++++++++-------
docs/jade/pages/index.jade | 166 +++++++++++++++++++++++++++-------
docs/sass/_docs.scss | 29 ++++++
6 files changed, 485 insertions(+), 118 deletions(-)
diff --git a/docs/css/style.css b/docs/css/style.css
index 9ef2107..14ea939 100644
--- a/docs/css/style.css
+++ b/docs/css/style.css
@@ -1 +1 @@
-.-text-center-,.datepicker-promo,.promo-header{text-align:center}a,abbr,acronym,address,applet,article,aside,audio,big,blockquote,canvas,caption,center,cite,code,dd,del,details,dfn,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,header,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,strike,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font:inherit;vertical-align:baseline}body{margin:0}body,html{width:100%;height:100%}*,:after,:before{box-sizing:border-box}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}b,strong{font-weight:700}i{font-style:italic}a{outline:0;color:#47A6EC}textarea{overflow:auto}html{color:#333;font-family:Tahoma,sans-serif;font-size:14px;min-width:320px}p{line-height:1.3;margin-bottom:14px}h1,h2,h3,h4{font-family:'Fira Sans',sans-serif;line-height:1}h2{font-weight:100;font-size:32px;margin:48px 0 8px}h3{font-weight:500;font-size:18px;margin:24px 0 8px}h4{font-weight:400;color:#939393;font-size:16px;margin:24px 0 0}article h2,article h3{position:relative;z-index:1}article h2:after,article h3:after{content:'';background:rgba(67,156,255,.2);border-radius:4px;opacity:0;left:-8px;right:-8px;top:-10px;bottom:-4px;position:absolute;z-index:-1;transition:all .4s .3s linear}.nav,.nav-wrap{bottom:0;top:0}article h2.-hilited-:after,article h3.-hilited-:after{opacity:1;transition:all .4s .7s linear}.container{max-width:960px;margin:0 auto;padding:1px 0;position:relative}.buttons,.example--label,.lang-link{position:absolute}.container article{margin:60px 0 30px}@media all and (max-width:1525px){.container{margin-left:270px}}@media all and (max-width:1280px){.container{margin-right:20px}}@media all and (max-width:650px){.container{margin-right:20px;margin-left:20px}}.buttons{top:19px}.lang-link{display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;right:0;top:15px}.lang-link img{margin-right:5px}@media all and (max-width:650px){.lang-link span{display:none}}input[type=text]{outline:0;height:32px;border:1px solid #b5b5b5;padding:0 8px;margin:0 0 14px;color:#444;font-family:Tahoma,sans-serif;transition:all .2s;width:250px}.hljs,.param-inline{font-family:Consolas,monospace}input[type=text]:focus{border-color:#ffd75c}ul{margin:0 0 16px}ul li{list-style:none;margin-bottom:8px}.example--label{background:#ececec;border-radius:0 0 4px 4px;padding:4px 12px;right:8px;top:0}.hljs{line-height:1.2;-moz-tab-size:4;tab-size:4}.example{border:1px solid #ececec;border-radius:4px;position:relative;margin:16px 0}.example .example-code{border:none;border-radius:0 0 4px 4px;border-top:1px solid #ececec;margin:0}.example-inline{background:red;display:inline-block;vertical-align:middle;margin:0 4px}.example-inline .hljs{padding:0 4px}.example-content{padding:32px}@media all and (max-width:650px){.example-content{padding-left:4%;padding-right:4%}}.example-content h1:first-child,.example-content h2:first-child,.example-content h3:first-child{margin-top:0}.example-content>:last-child{margin-bottom:0!important}a:hover{color:#ff767e}.example-code{border:1px solid #ddd;border-radius:4px;overflow:hidden;margin:16px 0;font-size:13px}.param-inline i,.param-inline strong{display:inline-block;margin-right:4px;vertical-align:middle}.example-code code{padding:16px 32px}.param-inline strong{background:#efefef;color:#333;border-radius:4px;font-weight:400;padding:3px 6px 4px}.param-inline i{color:#838383;font-size:.95em;font-style:normal;font-weight:100;font-family:'Fira Sans',sans-serif}.promo-header{font-size:48px;font-weight:100;margin-top:54px}.promo-header span{display:block;font-size:.5em}.datepicker-promo .datepicker-inline,.param-header--label,.range-example span{display:inline-block}.range-example input[type=text]{width:150px}.range-example span{margin:0 8px}.param-header{margin-bottom:8px}.param-header h3{margin-bottom:2px}.param-header p{margin:0;font-size:13px}.param{margin-bottom:32px}.param-header--label{color:#707070;vertical-align:middle}.nav-wrap{background:#fff;position:fixed;overflow:hidden;width:250px;left:0;box-shadow:0 0 4px rgba(0,0,0,.3)}@media all and (max-width:650px){.nav-wrap{display:none}}.nav-wrap:after,.nav-wrap:before{content:'';pointer-events:none;position:absolute;left:0;right:0;height:28px}.nav-wrap:after{background:linear-gradient(to top,#fff,rgba(255,255,255,0));bottom:0}.nav{position:absolute;padding:18px;right:0;left:0;overflow-y:scroll;-webkit-overflow-scrolling:touch}.nav--section{margin-bottom:20px}.nav--section-title{line-height:1;font-size:22px;margin:0 0 8px}.nav--section-title a{color:#000;text-decoration:none}.nav--section-title a:hover{color:#ff767e}.nav--subsection{margin-left:2px}.nav--subsection-title{font-size:13px;margin:0 0 8px;font-weight:400;font-family:Tahoma,sans-serif}.nav--subsection-title a{color:#787878;text-decoration:none}.nav--subsection-title a:hover{color:#ff767e}
\ No newline at end of file
+.-text-center-,.datepicker-promo,.promo-header{text-align:center}a,abbr,acronym,address,applet,article,aside,audio,big,blockquote,canvas,caption,center,cite,code,dd,del,details,dfn,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,header,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,strike,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font:inherit;vertical-align:baseline}body{margin:0}body,html{width:100%;height:100%}*,:after,:before{box-sizing:border-box}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}b,strong{font-weight:700}i{font-style:italic}a{outline:0;color:#47A6EC}textarea{overflow:auto}html{color:#333;font-family:Tahoma,sans-serif;font-size:14px;min-width:320px}p{line-height:1.3;margin-bottom:14px}h1,h2,h3,h4{font-family:'Fira Sans',sans-serif;line-height:1}h2{font-weight:100;font-size:32px;margin:48px 0 8px}h3{font-weight:500;font-size:18px;margin:24px 0 8px}h4{font-weight:400;color:#939393;font-size:16px;margin:24px 0 0}article h2,article h3{position:relative;z-index:1}article h2:after,article h3:after{content:'';background:rgba(67,156,255,.2);border-radius:4px;opacity:0;left:-8px;right:-8px;top:-10px;bottom:-4px;position:absolute;z-index:-1;transition:all .4s .3s linear}.nav,.nav-wrap{bottom:0;top:0}article h2.-hilited-:after,article h3.-hilited-:after{opacity:1;transition:all .4s .7s linear}.container{max-width:960px;margin:0 auto;padding:1px 0;position:relative}.buttons,.example--label,.lang-link{position:absolute}.container article{margin:60px 0 30px}@media all and (max-width:1525px){.container{margin-left:270px}}@media all and (max-width:1280px){.container{margin-right:20px}}@media all and (max-width:650px){.container{margin-right:20px;margin-left:20px}}.list-inline{display:-webkit-flex;display:-ms-flexbox;display:flex;margin:-8px -8px 0}.list-inline>*{margin:8px 8px 0}.buttons{top:19px}.lang-link{display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;right:0;top:15px}.lang-link img{margin-right:5px}@media all and (max-width:650px){.lang-link span{display:none}}input[type=text]{outline:0;height:32px;border:1px solid #b5b5b5;padding:0 8px;margin:0 0 14px;color:#444;font-family:Tahoma,sans-serif;transition:all .2s;width:250px}.hljs,.param-inline{font-family:Consolas,monospace}input[type=text]:focus{border-color:#ffd75c}ul{margin:0 0 16px}ul li{list-style:none;margin-bottom:8px}.example--label{background:#ececec;border-radius:0 0 4px 4px;padding:4px 12px;right:8px;top:0}.hljs{line-height:1.2;-moz-tab-size:4;tab-size:4}.example{border:1px solid #ececec;border-radius:4px;position:relative;margin:16px 0}.example .example-code{border:none;border-radius:0 0 4px 4px;border-top:1px solid #ececec;margin:0}.example-inline{background:red;display:inline-block;vertical-align:middle;margin:0 4px}.example-inline .hljs{padding:0 4px}.example-content{padding:32px}@media all and (max-width:650px){.example-content{padding-left:4%;padding-right:4%}}.example-content h1:first-child,.example-content h2:first-child,.example-content h3:first-child{margin-top:0}.example-content>:last-child{margin-bottom:0!important}a:hover{color:#ff767e}.example-code{border:1px solid #ddd;border-radius:4px;overflow:hidden;margin:16px 0;font-size:13px}.param-inline i,.param-inline strong{display:inline-block;margin-right:4px;vertical-align:middle}.example-code code{padding:16px 32px}.param-inline strong{background:#efefef;color:#333;border-radius:4px;font-weight:400;padding:3px 6px 4px}.param-inline i{color:#838383;font-size:.95em;font-style:normal;font-weight:100;font-family:'Fira Sans',sans-serif}.promo-header{font-size:48px;font-weight:100;margin-top:54px}.promo-header span{display:block;font-size:.5em}.datepicker-promo .datepicker-inline,.param-header--label,.range-example span{display:inline-block}.range-example input[type=text]{width:150px}.range-example span{margin:0 8px}.param-header{margin-bottom:8px}.param-header h3{margin-bottom:2px}.param-header p{margin:0;font-size:13px}.param{margin-bottom:32px}.param-header--label{color:#707070;vertical-align:middle}.nav-wrap{background:#fff;position:fixed;overflow:hidden;width:250px;left:0;box-shadow:0 0 4px rgba(0,0,0,.3)}.dp-note,.nav{position:absolute}@media all and (max-width:650px){.nav-wrap{display:none}}.nav-wrap:after,.nav-wrap:before{content:'';pointer-events:none;position:absolute;left:0;right:0;height:28px}.nav-wrap:after{background:linear-gradient(to top,#fff,rgba(255,255,255,0));bottom:0}.nav{padding:18px;right:0;left:0;overflow-y:scroll;-webkit-overflow-scrolling:touch}.nav--section{margin-bottom:20px}.nav--section-title{line-height:1;font-size:22px;margin:0 0 8px}.nav--section-title a{color:#000;text-decoration:none}.nav--section-title a:hover{color:#ff767e}.nav--subsection{margin-left:2px}.nav--subsection-title{font-size:13px;margin:0 0 8px;font-weight:400;font-family:Tahoma,sans-serif}.nav--subsection-title a{color:#787878;text-decoration:none}.nav--subsection-title a:hover{color:#ff767e}.dp-note{background:#ccc;width:4px;height:4px;border-radius:50%;left:50%;bottom:1px;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.-selected- .dp-note{bottom:2px;background:#fff;opacity:.5}
\ No newline at end of file
diff --git a/docs/index-ru.html b/docs/index-ru.html
index 62425a7..6e96067 100644
--- a/docs/index-ru.html
+++ b/docs/index-ru.html
@@ -29,39 +29,103 @@ $('#my-element').data('datepicker')
// Можно выбрать тольо даты, идущие за сегодняшним днем, включая сегодня
minDate: new Date()
})
-Диапозон дат
По умолчанию в плагине нет встроенного механизма выбора диапозона дат.
-Тем не менее это можно с легкостью сделать вручную.
Пример
// Сделаем неактивными воскресенье и субботу
+var disabledDays = [0, 6];
+
+$('#disabled-days').datepicker({
+ onRenderCell: function (date, cellType) {
+ if (cellType == 'day') {
+ var day = date.getDay(),
+ isDisabled = disabledDays.indexOf(day) != -1;
+
+ return {
+ disabled: isDisabled
+ }
+ }
+ }
+})
+
Кастомное содержимое ячеек
Air Datepicker позволяет менять содержимое ячеек как угодно. Для этого можно также воспользоваться методомonRenderCell.
+Давайте добавим вспомогательные элементы к нескольким датам и покажем случайный текст при выборе этих дат:
Пример
var eventDates = [1, 10, 12, 22],
+ $picker = $('#custom-cells'),
+ $content = $('#custom-cells-events'),
+ sentences = [ … ];
+
+$picker.datepicker({
+ onRenderCell: function (date, cellType) {
+ var currentDate = date.getDate();
+
+ // Добавляем вспомогательный элемент, если число содержится в `eventDates`
+ if (cellType == 'day' && eventDates.indexOf(currentDate) != -1) {
+ return {
+ html: currentDate + '<span class="dp-note"></span>'
+ }
+ }
+ },
+ onSelect: function onSelect(fd, date) {
+ var title = '', content = ''
+
+ // Если выбрана дата с событием, то отображаем его
+ if (date && eventDates.indexOf(date.getDate()) != -1) {
+ title = fd;
+ content = sentences[Math.floor(Math.random() * eventDates.length)];
+ }
+
+ $('strong', $content).html(title)
+ $('p', $content).html(content)
}
})
-
var $start = $('#start'),
- $end = $('#end');
- $start.datepicker({
- onSelect: function (fd, date) {
- $end.data('datepicker')
- .update('minDate', date)
- }
- })
+// Сразу выберем какую-ниудь дату из `eventDates`
+var currentDate = currentDate = new Date();
+$picker.data('datepicker').selectDate(new Date(currentDate.getFullYear(), currentDate.getMonth(), 10))
- $end.datepicker({
- onSelect: function (fd, date) {
- $start.data('datepicker')
- .update('maxDate', date)
- }
- })
Локализация
Вы можете добавить свою локализацию в объектDatepicker.language["my-lang"]и при вызове календаря передать название языка в параметрlanguage
Datepicker.language['my-lang'] = {...}
$('.my-datepicker').datepicker({
@@ -88,7 +152,7 @@ $('.my-datepicker').datepicker({
По умолчанию берется из локализации, если значение передать сюда, то оно будет иметь больший приоритет.
Массив индексов дней, которые будут считаться выходными днями. Им будет добавлен класс.-weekend-. По умолчанию это суббота и воскресенье.
Желаемый формат даты, кобминация из d, m, yyyy, D, M, и т.д. По умолчанию берется из локализации, если передать значение сюда, то оно будет иметь больший приоритет.
- @- время в миллесекундах
- d- дата
- dd- дата с лидирующем нулем
- D- сокращенное наименование дня
- DD- полное наименование дня
- m- номер мясяца
- mm- номер месяца с лидирующем нулем
- M- сокращенное наименовение месяца
- MM- полное наименовение месяца
- yy- сокращенный номер года
- yyyy- полный номер года
- yyyy1- первый год декады, в которую входит текущий год
- yyyy2- последний год декады, в которую входит текущий год
Альтернативное поле воода в значение которого будут попадать выбранные даты с форматомaltFieldDateFormat.
Формат даты для альтернативного поля.
Если true, то клик на выделенной дате снимет выделение.
Если true, то по календарю можно будет осуществлять навигацию с помощью клавиатуры.
Сочетания клавиш:
- Ctrl + → | ↑- переход на месяц вперед
- Ctrl + ← | ↓- переход на месяц назад
- Shift + → | ↑- переход на год вперед
- Shift + ← | ↓- переход на год назад
- Alt + → | ↑- переход на 10 лет вперед
- Alt + ← | ↓- переход на 10 лет назад
- Ctrl + Shift + ↑ | ↓- переход на следующий вид
- Esc- закрывает календарь
Позиционирование календаря отностиельно текстового поля. Первым значением задается основная ось позиционирования,
воторым - положение на этой оси. Например{position: "right top"}- утсановит позицию клаендаря справа вверху от текстового поля.
Отступ от основной оси позиционирования.
Начальный вид календаря. Возможноые значения:
days- отображение дней месяцаmonths- отображение месяцев одного годаyears- отображение годов одной декады
Минимальное представление календаря, по наступлению которого, выбор ячейки приведет к ее активации, а не переходу к следующему виду.
-Возможные значения такие же как и у параметраview.
Если true, то будут отображаться дни других месяцев.
Если true, то можно будет выбрать дни из других месяцев.
Если true, то при выборе дней из других месяца, будет осуществялться переход к этому месяцу.
Если true, то при отображении декады, будут показаны годы из других декад.
Если true, то можно будет выбрать года из других декад
Если true, то при выборе года из другой декады, будет осуществлен переход к этой декаде.
Минимальная дата для возможности выбора. Все даты, идущее до нее нельзя будет активировать.
Максимальная дата для возможности выбора. Все даты, идущее после нее нельзя будет выбрать.
Если true, то при наступлении даты, которая была бы меньше минимально возможной или больше максимально возможной, деактвировались бы кнопки навигации 'вперед', 'назад'
Если true, то можно будет выбрать неограниченное количество дат. Если передать число, то количество выбираемых дат будет ограниченно этим числом.
Разделитель дат, который будет использован при объеденения нескольких дат в одну строку.
Если true, то будет отображена кнопка "Сегодня".
Если true, то будет отображена кнопка "Очистить".
Тип события, по наступлению которого будет показан календарь.
Если true, то при активации даты, календарь закроется.
Контент кнопки 'предыдущий месяц|год|декада'.
Контент кнопки 'следующий месяц|год|декада'.
Если true, то будут отображаться дни других месяцев.
Если true, то можно будет выбрать дни из других месяцев.
Если true, то при выборе дней из других месяца, будет осуществялться переход к этому месяцу.
Если true, то при отображении декады, будут показаны годы из других декад.
Если true, то можно будет выбрать года из других декад
Если true, то при выборе года из другой декады, будет осуществлен переход к этой декаде.
Минимальная дата для возможности выбора. Все даты, идущее до нее нельзя будет активировать.
Максимальная дата для возможности выбора. Все даты, идущее после нее нельзя будет выбрать.
Если true, то при наступлении даты, которая была бы меньше минимально возможной или больше максимально возможной, деактвировались бы кнопки навигации 'вперед', 'назад'
Если true, то можно будет выбрать неограниченное количество дат. Если передать число, то количество выбираемых дат будет ограниченно этим числом.
Разделитель дат, который будет использован при объеденения нескольких дат в одну строку.
Если true, то будет включен режим выбора диапазона дат. В качестве разделителя будет использованmultipleDatesSeparator
Если true, то будет отображена кнопка "Сегодня".
Если true, то будет отображена кнопка "Очистить".
Тип события, по наступлению которого будет показан календарь.
Если true, то при активации даты, календарь закроется.
Контент кнопки 'предыдущий месяц|год|декада'.
Контент кнопки 'следующий месяц|год|декада'.
Localization
You can add your localization to objectDatepicker.language["my-lang"]and pass it name to parameterlanguage
// Add custom localization
Datepicker.language['my-lang'] = {...}
// Initialize datepicker with it
@@ -82,7 +154,7 @@ If object is passed, then data will be taken from this object directly.If
By default value is taken from current localization, but if it passed here then it will have higher priority.
Array of day's indexes which will be considered as weekends. Class.-weekend-will be added to relevant cells.
. By default its Saturday and Sunday.
Desirable date format. It's combination of d, m, yyyy, D, M, etc. By default value is taken from current localization, but if it passed here, then it will have higher priority.
- @- time in milliseconds
- d- date number
- dd- date with leading zero
- D- short day name
- DD- full day name
- m- month number
- mm- month number with leading zero
- M- short month name
- MM- full month name
- yy- two digit year number
- yyyy- four digit year number
- yyyy1- first year of decade, which included current year
- yyyy2- last year of decade, which included current year
Alternative text input. UsealtFieldDateFormatfor date formatting.
Date format for alternative field.
If true, then clicking on selected cell will remove selection.
If true, then one can navigate through calendar by keyboard.
Hot keys:
- Ctrl + → | ↑- move one month forwards
- Ctrl + ← | ↓- move one month backwards
- Shift + → | ↑- move one year forwards
- Shift + ← | ↓- move one year backwards
- Alt + → | ↑- move 10 years forwards
- Alt + ← | ↓- move 10 years backwards
- Ctrl + Shift + ↑ | ↓- move to next view
- Esc- hides datepicker
Position of datepicker relative to text input. First value is name of main axis, and second is position on that axis.
For example{position: "right top"}- will set datepicker's position from right side on top of text input.
Offset from the main positioning axes.
Start datepicker view. Possible values are:
days- display days of one monthmonths- display months of one yearyears- display years of one decade
Minimal datepicker's view, on that view selecting cells will not trigger rendering next view, instead it will activate it.
-Possible values are the same as inview.
If true, then days from other months will be visible.
If true, then one can select days form other months.
If true, then selecting days from other month, will cause transition to that month.
If true, then years from other decades will be visible.
If true, then on can select years from other decades
If true, then selecting year from other decade, will cause transition to that decade.
The minimum date for selection. All dates, running before it can't be activated.
The maximum date for selection. All dates which comes after it cannot be selected.
If true, then at the date, which would be less than minimum possible or more then maximum possible, navigation buttons ('forward', 'back') will be deactivated.
If true, then one can select unlimited dates. If number is passed, then amount of selected dates will be limited by it.
Dates separator, which will be used when concatenating dates to string.
If true, then button "Today" will be visible.
If true, then button "Clear" will be visible.
Event type, on which datepicker should be shown.
If true, then after date selection, datepicker will be closed.
Contents of 'next' button.
Contents of 'prev' button.
If true, then days from other months will be visible.
If true, then one can select days form other months.
If true, then selecting days from other month, will cause transition to that month.
If true, then years from other decades will be visible.
If true, then on can select years from other decades
If true, then selecting year from other decade, will cause transition to that decade.
The minimum date for selection. All dates, running before it can't be activated.
The maximum date for selection. All dates which comes after it cannot be selected.
If true, then at the date, which would be less than minimum possible or more then maximum possible, navigation buttons ('forward', 'back') will be deactivated.
If true, then one can select unlimited dates. If number is passed, then amount of selected dates will be limited by it.
Dates separator, which will be used when concatenating dates to string.
For selecting dates range, turn this option to true.multipleDatesSeparatorwill be used as dates separator.
If true, then button "Today" will be visible.
If true, then button "Clear" will be visible.
Event type, on which datepicker should be shown.
If true, then after date selection, datepicker will be closed.
Contents of 'next' button.
Contents of 'prev' button.