Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
e0d6cd4b
Commit
e0d6cd4b
authored
Jul 23, 2013
by
Rashid Khan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #262 from rashidkpc/master
Fixed timepicker
parents
42adfd75
316aa05d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1303 additions
and
881 deletions
+1303
-881
common/css/timepicker.css
+411
-78
common/lib/timepicker.js
+882
-799
panels/timepicker/module.js
+10
-4
No files found.
common/css/timepicker.css
View file @
e0d6cd4b
/*
/*!
Datepicker for Bootstrap
* Datepicker for Bootstrap
Copyright 2012 Stefan Petre
*
Licensed under the Apache License v2.0
* Copyright 2012 Stefan Petre
http://www.apache.org/licenses/LICENSE-2.0
* Improvements by Andrew Rowls
*/
* Licensed under the Apache License v2.0
input
[
type
=
"date"
]
{
-webkit-appearance
:
none
;
}
.datepicker
{
top
:
0
;
left
:
0
;
padding
:
4px
;
margin-top
:
1px
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
/*.dow { border-top: 1px solid #ddd !important; }*/
}
.datepicker
:before
{
content
:
''
;
display
:
inline-block
;
border-left
:
7px
solid
transparent
;
border-right
:
7px
solid
transparent
;
border-bottom
:
7px
solid
#ccc
;
border-bottom-color
:
rgba
(
0
,
0
,
0
,
0.2
);
position
:
absolute
;
top
:
-7px
;
left
:
6px
;
}
.datepicker
:after
{
content
:
''
;
display
:
inline-block
;
border-left
:
6px
solid
transparent
;
border-right
:
6px
solid
transparent
;
border-bottom
:
6px
solid
#ffffff
;
position
:
absolute
;
top
:
-6px
;
left
:
7px
;
}
.datepicker
>
div
{
display
:
none
;
}
.datepicker
table
{
width
:
100%
;
margin
:
0
;
}
.datepicker
td
,
.datepicker
th
{
text-align
:
center
;
width
:
20px
;
height
:
20px
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
}
.datepicker
td
.day
:hover
{
background
:
#eeeeee
;
cursor
:
pointer
;
}
.datepicker
td
.old
,
.datepicker
td
.new
{
color
:
#999999
;
}
.datepicker
td
.active
,
.datepicker
td
.active
:hover
{
background-color
:
#006dcc
;
background-image
:
-moz-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
-ms-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
100%
,
from
(
#0088cc
),
to
(
#0044cc
));
background-image
:
-webkit-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
-o-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#0088cc'
,
endColorstr
=
'#0044cc'
,
GradientType
=
0
);
border-color
:
#0044cc
#0044cc
#002a80
;
border-color
:
rgba
(
0
,
0
,
0
,
0.1
)
rgba
(
0
,
0
,
0
,
0.1
)
rgba
(
0
,
0
,
0
,
0.25
);
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
enabled
=
false
);
color
:
#fff
;
text-shadow
:
0
-1px
0
rgba
(
0
,
0
,
0
,
0.25
);
}
.datepicker
td
.active
:hover
,
.datepicker
td
.active
:hover:hover
,
.datepicker
td
.active
:active
,
.datepicker
td
.active
:hover:active
,
.datepicker
td
.active.active
,
.datepicker
td
.active
:hover
.active
,
.datepicker
td
.active.disabled
,
.datepicker
td
.active
:hover
.disabled
,
.datepicker
td
.active
[
disabled
],
.datepicker
td
.active
:hover
[
disabled
]
{
background-color
:
#0044cc
;
}
.datepicker
td
.active
:active
,
.datepicker
td
.active
:hover:active
,
.datepicker
td
.active.active
,
.datepicker
td
.active
:hover
.active
{
background-color
:
#003399
\
9
;
}
.datepicker
td
span
{
display
:
block
;
width
:
47px
;
height
:
54px
;
line-height
:
54px
;
float
:
left
;
margin
:
2px
;
cursor
:
pointer
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
}
.datepicker
td
span
:hover
{
background
:
#eeeeee
;
}
.datepicker
td
span
.active
{
background-color
:
#006dcc
;
background-image
:
-moz-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
-ms-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
100%
,
from
(
#0088cc
),
to
(
#0044cc
));
background-image
:
-webkit-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
-o-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#0088cc'
,
endColorstr
=
'#0044cc'
,
GradientType
=
0
);
border-color
:
#0044cc
#0044cc
#002a80
;
border-color
:
rgba
(
0
,
0
,
0
,
0.1
)
rgba
(
0
,
0
,
0
,
0.1
)
rgba
(
0
,
0
,
0
,
0.25
);
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
enabled
=
false
);
color
:
#fff
;
text-shadow
:
0
-1px
0
rgba
(
0
,
0
,
0
,
0.25
);
}
.datepicker
td
span
.active
:hover
,
.datepicker
td
span
.active
:active
,
.datepicker
td
span
.active.active
,
.datepicker
td
span
.active.disabled
,
.datepicker
td
span
.active
[
disabled
]
{
background-color
:
#0044cc
;
}
.datepicker
td
span
.active
:active
,
.datepicker
td
span
.active.active
{
background-color
:
#003399
\
9
;
}
.datepicker
td
span
.old
{
color
:
#999999
;
}
.datepicker
th
.switch
{
width
:
145px
;
}
.datepicker
th
.next
,
.datepicker
th
.prev
{
font-size
:
19.5px
;
}
.datepicker
thead
tr
:first-child
th
{
cursor
:
pointer
;
}
.datepicker
thead
tr
:first-child
th
:hover
{
background
:
#eeeeee
;
}
.input-append.date
.add-on
i
,
.input-prepend.date
.add-on
i
{
display
:
block
;
cursor
:
pointer
;
width
:
16px
;
height
:
16px
;
}
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
.datepicker
{
padding
:
4px
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
direction
:
ltr
;
/*.dow {
border-top: 1px solid #ddd !important;
}*/
.bootstrap-timepicker.dropdown-menu
{
border-radius
:
4px
4px
4px
4px
;
display
:
none
;
left
:
0
;
margin-top
:
1px
;
padding
:
4px
;
top
:
0
;
min-width
:
10px
;
z-index
:
99999
;
}
.bootstrap-timepicker.dropdown-menu.open
{
display
:
inline-block
;
}
.bootstrap-timepicker.dropdown-menu
:before
{
border-bottom
:
7px
solid
rgba
(
0
,
0
,
0
,
0.2
);
border-left
:
7px
solid
transparent
;
border-right
:
7px
solid
transparent
;
content
:
""
;
left
:
6px
;
position
:
absolute
;
top
:
-7px
;
}
.bootstrap-timepicker.dropdown-menu
:after
{
border-bottom
:
6px
solid
#FFFFFF
;
border-left
:
6px
solid
transparent
;
border-right
:
6px
solid
transparent
;
content
:
""
;
left
:
7px
;
position
:
absolute
;
top
:
-6px
;
}
.bootstrap-timepicker.modal
{
margin-left
:
-100px
;
margin-top
:
0
;
top
:
30%
;
width
:
200px
;
}
}
.
bootstrap-timepicker.modal
.modal-content
{
.
datepicker-inline
{
padding
:
0
;
width
:
220px
;
}
}
.bootstrap-timepicker
table
{
.datepicker.datepicker-rtl
{
margin
:
0
;
direction
:
rtl
;
width
:
100%
;
}
}
.bootstrap-timepicker
table
td
{
.datepicker.datepicker-rtl
table
tr
td
span
{
height
:
30px
;
float
:
right
;
margin
:
0
;
padding
:
2px
;
text-align
:
center
;
}
}
.bootstrap-timepicker
table
td
span
{
.datepicker-dropdown
{
width
:
100%
;
top
:
0
;
left
:
0
;
}
.datepicker-dropdown
:before
{
content
:
''
;
display
:
inline-block
;
border-left
:
7px
solid
transparent
;
border-right
:
7px
solid
transparent
;
border-bottom
:
7px
solid
#ccc
;
border-bottom-color
:
rgba
(
0
,
0
,
0
,
0.2
);
position
:
absolute
;
top
:
-7px
;
left
:
6px
;
}
.datepicker-dropdown
:after
{
content
:
''
;
display
:
inline-block
;
border-left
:
6px
solid
transparent
;
border-right
:
6px
solid
transparent
;
border-bottom
:
6px
solid
#ffffff
;
position
:
absolute
;
top
:
-6px
;
left
:
7px
;
}
.datepicker
>
div
{
display
:
none
;
}
.datepicker.days
div
.datepicker-days
{
display
:
block
;
}
.datepicker.months
div
.datepicker-months
{
display
:
block
;
}
.datepicker.years
div
.datepicker-years
{
display
:
block
;
}
.datepicker
table
{
margin
:
0
;
}
.datepicker
td
,
.datepicker
th
{
text-align
:
center
;
width
:
20px
;
height
:
20px
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
border
:
none
;
}
.table-striped
.datepicker
table
tr
td
,
.table-striped
.datepicker
table
tr
th
{
background-color
:
transparent
;
}
.datepicker
table
tr
td
.day
:hover
{
background
:
#eeeeee
;
cursor
:
pointer
;
}
.datepicker
table
tr
td
.old
,
.datepicker
table
tr
td
.new
{
color
:
#999999
;
}
.datepicker
table
tr
td
.disabled
,
.datepicker
table
tr
td
.disabled
:hover
{
background
:
none
;
color
:
#999999
;
cursor
:
default
;
}
.datepicker
table
tr
td
.today
,
.datepicker
table
tr
td
.today
:hover
,
.datepicker
table
tr
td
.today.disabled
,
.datepicker
table
tr
td
.today.disabled
:hover
{
background-color
:
#fde19a
;
background-image
:
-moz-linear-gradient
(
top
,
#fdd49a
,
#fdf59a
);
background-image
:
-ms-linear-gradient
(
top
,
#fdd49a
,
#fdf59a
);
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
100%
,
from
(
#fdd49a
),
to
(
#fdf59a
));
background-image
:
-webkit-linear-gradient
(
top
,
#fdd49a
,
#fdf59a
);
background-image
:
-o-linear-gradient
(
top
,
#fdd49a
,
#fdf59a
);
background-image
:
linear-gradient
(
top
,
#fdd49a
,
#fdf59a
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#fdd49a'
,
endColorstr
=
'#fdf59a'
,
GradientType
=
0
);
border-color
:
#fdf59a
#fdf59a
#fbed50
;
border-color
:
rgba
(
0
,
0
,
0
,
0.1
)
rgba
(
0
,
0
,
0
,
0.1
)
rgba
(
0
,
0
,
0
,
0.25
);
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
enabled
=
false
);
color
:
#000
!important
;
}
.datepicker
table
tr
td
.today
:hover
,
.datepicker
table
tr
td
.today
:hover:hover
,
.datepicker
table
tr
td
.today.disabled
:hover
,
.datepicker
table
tr
td
.today.disabled
:hover:hover
,
.datepicker
table
tr
td
.today
:active
,
.datepicker
table
tr
td
.today
:hover:active
,
.datepicker
table
tr
td
.today.disabled
:active
,
.datepicker
table
tr
td
.today.disabled
:hover:active
,
.datepicker
table
tr
td
.today.active
,
.datepicker
table
tr
td
.today
:hover
.active
,
.datepicker
table
tr
td
.today.disabled.active
,
.datepicker
table
tr
td
.today.disabled
:hover
.active
,
.datepicker
table
tr
td
.today.disabled
,
.datepicker
table
tr
td
.today
:hover
.disabled
,
.datepicker
table
tr
td
.today.disabled.disabled
,
.datepicker
table
tr
td
.today.disabled
:hover
.disabled
,
.datepicker
table
tr
td
.today
[
disabled
],
.datepicker
table
tr
td
.today
:hover
[
disabled
],
.datepicker
table
tr
td
.today.disabled
[
disabled
],
.datepicker
table
tr
td
.today.disabled
:hover
[
disabled
]
{
background-color
:
#fdf59a
;
}
.datepicker
table
tr
td
.today
:active
,
.datepicker
table
tr
td
.today
:hover:active
,
.datepicker
table
tr
td
.today.disabled
:active
,
.datepicker
table
tr
td
.today.disabled
:hover:active
,
.datepicker
table
tr
td
.today.active
,
.datepicker
table
tr
td
.today
:hover
.active
,
.datepicker
table
tr
td
.today.disabled.active
,
.datepicker
table
tr
td
.today.disabled
:hover
.active
{
background-color
:
#fbf069
\
9
;
}
.datepicker
table
tr
td
.active
,
.datepicker
table
tr
td
.active
:hover
,
.datepicker
table
tr
td
.active.disabled
,
.datepicker
table
tr
td
.active.disabled
:hover
{
background-color
:
#006dcc
;
background-image
:
-moz-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
-ms-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
100%
,
from
(
#0088cc
),
to
(
#0044cc
));
background-image
:
-webkit-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
-o-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#0088cc'
,
endColorstr
=
'#0044cc'
,
GradientType
=
0
);
border-color
:
#0044cc
#0044cc
#002a80
;
border-color
:
rgba
(
0
,
0
,
0
,
0.1
)
rgba
(
0
,
0
,
0
,
0.1
)
rgba
(
0
,
0
,
0
,
0.25
);
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
enabled
=
false
);
color
:
#fff
;
text-shadow
:
0
-1px
0
rgba
(
0
,
0
,
0
,
0.25
);
}
.datepicker
table
tr
td
.active
:hover
,
.datepicker
table
tr
td
.active
:hover:hover
,
.datepicker
table
tr
td
.active.disabled
:hover
,
.datepicker
table
tr
td
.active.disabled
:hover:hover
,
.datepicker
table
tr
td
.active
:active
,
.datepicker
table
tr
td
.active
:hover:active
,
.datepicker
table
tr
td
.active.disabled
:active
,
.datepicker
table
tr
td
.active.disabled
:hover:active
,
.datepicker
table
tr
td
.active.active
,
.datepicker
table
tr
td
.active
:hover
.active
,
.datepicker
table
tr
td
.active.disabled.active
,
.datepicker
table
tr
td
.active.disabled
:hover
.active
,
.datepicker
table
tr
td
.active.disabled
,
.datepicker
table
tr
td
.active
:hover
.disabled
,
.datepicker
table
tr
td
.active.disabled.disabled
,
.datepicker
table
tr
td
.active.disabled
:hover
.disabled
,
.datepicker
table
tr
td
.active
[
disabled
],
.datepicker
table
tr
td
.active
:hover
[
disabled
],
.datepicker
table
tr
td
.active.disabled
[
disabled
],
.datepicker
table
tr
td
.active.disabled
:hover
[
disabled
]
{
background-color
:
#0044cc
;
}
.datepicker
table
tr
td
.active
:active
,
.datepicker
table
tr
td
.active
:hover:active
,
.datepicker
table
tr
td
.active.disabled
:active
,
.datepicker
table
tr
td
.active.disabled
:hover:active
,
.datepicker
table
tr
td
.active.active
,
.datepicker
table
tr
td
.active
:hover
.active
,
.datepicker
table
tr
td
.active.disabled.active
,
.datepicker
table
tr
td
.active.disabled
:hover
.active
{
background-color
:
#003399
\
9
;
}
.datepicker
table
tr
td
span
{
display
:
block
;
width
:
23%
;
height
:
54px
;
line-height
:
54px
;
float
:
left
;
margin
:
1%
;
cursor
:
pointer
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
}
.datepicker
table
tr
td
span
:hover
{
background
:
#eeeeee
;
}
.datepicker
table
tr
td
span
.disabled
,
.datepicker
table
tr
td
span
.disabled
:hover
{
background
:
none
;
color
:
#999999
;
cursor
:
default
;
}
.datepicker
table
tr
td
span
.active
,
.datepicker
table
tr
td
span
.active
:hover
,
.datepicker
table
tr
td
span
.active.disabled
,
.datepicker
table
tr
td
span
.active.disabled
:hover
{
background-color
:
#006dcc
;
background-image
:
-moz-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
-ms-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
100%
,
from
(
#0088cc
),
to
(
#0044cc
));
background-image
:
-webkit-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
-o-linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-image
:
linear-gradient
(
top
,
#0088cc
,
#0044cc
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#0088cc'
,
endColorstr
=
'#0044cc'
,
GradientType
=
0
);
border-color
:
#0044cc
#0044cc
#002a80
;
border-color
:
rgba
(
0
,
0
,
0
,
0.1
)
rgba
(
0
,
0
,
0
,
0.1
)
rgba
(
0
,
0
,
0
,
0.25
);
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
enabled
=
false
);
color
:
#fff
;
text-shadow
:
0
-1px
0
rgba
(
0
,
0
,
0
,
0.25
);
}
.datepicker
table
tr
td
span
.active
:hover
,
.datepicker
table
tr
td
span
.active
:hover:hover
,
.datepicker
table
tr
td
span
.active.disabled
:hover
,
.datepicker
table
tr
td
span
.active.disabled
:hover:hover
,
.datepicker
table
tr
td
span
.active
:active
,
.datepicker
table
tr
td
span
.active
:hover:active
,
.datepicker
table
tr
td
span
.active.disabled
:active
,
.datepicker
table
tr
td
span
.active.disabled
:hover:active
,
.datepicker
table
tr
td
span
.active.active
,
.datepicker
table
tr
td
span
.active
:hover
.active
,
.datepicker
table
tr
td
span
.active.disabled.active
,
.datepicker
table
tr
td
span
.active.disabled
:hover
.active
,
.datepicker
table
tr
td
span
.active.disabled
,
.datepicker
table
tr
td
span
.active
:hover
.disabled
,
.datepicker
table
tr
td
span
.active.disabled.disabled
,
.datepicker
table
tr
td
span
.active.disabled
:hover
.disabled
,
.datepicker
table
tr
td
span
.active
[
disabled
],
.datepicker
table
tr
td
span
.active
:hover
[
disabled
],
.datepicker
table
tr
td
span
.active.disabled
[
disabled
],
.datepicker
table
tr
td
span
.active.disabled
:hover
[
disabled
]
{
background-color
:
#0044cc
;
}
}
.bootstrap-timepicker
table
td
a
{
.datepicker
table
tr
td
span
.active
:active
,
border
:
1px
solid
transparent
;
.datepicker
table
tr
td
span
.active
:hover:active
,
display
:
inline-block
;
.datepicker
table
tr
td
span
.active.disabled
:active
,
margin
:
0
;
.datepicker
table
tr
td
span
.active.disabled
:hover:active
,
outline
:
0
none
;
.datepicker
table
tr
td
span
.active.active
,
padding
:
8px
0
;
.datepicker
table
tr
td
span
.active
:hover
.active
,
width
:
3em
;
.datepicker
table
tr
td
span
.active.disabled.active
,
.datepicker
table
tr
td
span
.active.disabled
:hover
.active
{
background-color
:
#003399
\
9
;
}
}
.bootstrap-timepicker
table
td
a
:hover
{
.datepicker
table
tr
td
span
.old
{
background-color
:
#EEEEEE
;
color
:
#999999
;
border-color
:
#DDDDDD
;
border-radius
:
4px
4px
4px
4px
;
}
}
.
bootstrap-timepicker
table
td
a
i
{
.
datepicker
th
.switch
{
margin-top
:
2
px
;
width
:
145
px
;
}
}
.bootstrap-timepicker
table
td
input
{
.datepicker
thead
tr
:first-child
th
,
margin
:
0
;
.datepicker
tfoot
tr
:first-child
th
{
text-align
:
center
;
cursor
:
pointer
;
width
:
25px
;
}
}
.bootstrap-timepicker-component
.add-on
{
.datepicker
thead
tr
:first-child
th
:hover
,
cursor
:
pointer
;
.datepicker
tfoot
tr
:first-child
th
:hover
{
background
:
#eeeeee
;
}
}
.bootstrap-timepicker-component
.add-on
i
{
.datepicker
.cw
{
display
:
block
;
font-size
:
10px
;
height
:
16px
;
width
:
12px
;
width
:
16px
;
padding
:
0
2px
0
5px
;
vertical-align
:
middle
;
}
}
.datepicker
thead
tr
:first-child
th
.cw
{
cursor
:
default
;
background-color
:
transparent
;
}
.input-append.date
.add-on
i
,
.input-prepend.date
.add-on
i
{
display
:
block
;
cursor
:
pointer
;
width
:
16px
;
height
:
16px
;
}
/*!
* Timepicker Component for Twitter Bootstrap
*
* Copyright 2013 Joris de Wit
*
* Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
.bootstrap-timepicker
{
position
:
relative
;
}
.bootstrap-timepicker.pull-right
.bootstrap-timepicker-widget.dropdown-menu
{
left
:
auto
;
right
:
0
;
}
.bootstrap-timepicker.pull-right
.bootstrap-timepicker-widget.dropdown-menu
:before
{
left
:
auto
;
right
:
12px
;
}
.bootstrap-timepicker.pull-right
.bootstrap-timepicker-widget.dropdown-menu
:after
{
left
:
auto
;
right
:
13px
;
}
.bootstrap-timepicker
.add-on
{
cursor
:
pointer
;
}
.bootstrap-timepicker
.add-on
i
{
display
:
inline-block
;
width
:
16px
;
height
:
16px
;
}
.bootstrap-timepicker-widget.dropdown-menu
{
padding
:
2px
3px
2px
2px
;
}
.bootstrap-timepicker-widget.dropdown-menu.open
{
display
:
inline-block
;
}
.bootstrap-timepicker-widget.dropdown-menu
:before
{
border-bottom
:
7px
solid
rgba
(
0
,
0
,
0
,
0.2
);
border-left
:
7px
solid
transparent
;
border-right
:
7px
solid
transparent
;
content
:
""
;
display
:
inline-block
;
left
:
9px
;
position
:
absolute
;
top
:
-7px
;
}
.bootstrap-timepicker-widget.dropdown-menu
:after
{
border-bottom
:
6px
solid
#FFFFFF
;
border-left
:
6px
solid
transparent
;
border-right
:
6px
solid
transparent
;
content
:
""
;
display
:
inline-block
;
left
:
10px
;
position
:
absolute
;
top
:
-6px
;
}
.bootstrap-timepicker-widget
a
.btn
,
.bootstrap-timepicker-widget
input
{
border-radius
:
4px
;
}
.bootstrap-timepicker-widget
table
{
width
:
100%
;
margin
:
0
;
}
.bootstrap-timepicker-widget
table
td
{
text-align
:
center
;
height
:
30px
;
margin
:
0
;
padding
:
2px
;
}
.bootstrap-timepicker-widget
table
td
:not
(
.separator
)
{
min-width
:
30px
;
}
.bootstrap-timepicker-widget
table
td
span
{
width
:
100%
;
}
.bootstrap-timepicker-widget
table
td
a
{
border
:
1px
transparent
solid
;
width
:
100%
;
display
:
inline-block
;
margin
:
0
;
padding
:
8px
0
;
outline
:
0
;
color
:
#333
;
}
.bootstrap-timepicker-widget
table
td
a
:hover
{
text-decoration
:
none
;
background-color
:
#eee
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
border-color
:
#ddd
;
}
.bootstrap-timepicker-widget
table
td
a
i
{
margin-top
:
2px
;
}
.bootstrap-timepicker-widget
table
td
input
{
width
:
25px
;
margin
:
0
;
text-align
:
center
;
}
.bootstrap-timepicker-widget
.modal-content
{
padding
:
4px
;
}
@media
(
min-width
:
767px
)
{
.bootstrap-timepicker-widget.modal
{
width
:
200px
;
margin-left
:
-100px
;
}
}
@media
(
max-width
:
767px
)
{
.bootstrap-timepicker
{
width
:
100%
;
}
.bootstrap-timepicker
.dropdown-menu
{
width
:
100%
;
}
}
\ No newline at end of file
common/lib/timepicker.js
View file @
e0d6cd4b
/* =========================================================
/*!
* bootstrap-timepicker.js
* Timepicker Component for Twitter Bootstrap
* http://www.github.com/jdewit/bootstrap-timepicker
* =========================================================
* Copyright 2012
*
*
* Created By:
* Copyright 2013 Joris de Wit
* Joris de Wit @joris_dewit
*
*
* Contributions By:
* Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors
* Gilbert @mindeavor
* Koen Punt info@koenpunt.nl
* Nek
* Chris Martin
* Dominic Barnes contact@dominicbarnes.us
* Olivier Louvignes @olouv
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* For the full copyright and license information, please view the LICENSE
* you may not use this file except in compliance with the License.
* file that was distributed with this source code.
* You may obtain a copy of the License at
*/
*
(
function
(
$
,
window
,
document
,
undefined
)
{
* http://www.apache.org/licenses/LICENSE-2.0
'use strict'
;
*
* Unless required by applicable law or agreed to in writing, software
// TIMEPICKER PUBLIC CLASS DEFINITION
* distributed under the License is distributed on an "AS IS" BASIS,
var
Timepicker
=
function
(
element
,
options
)
{
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
this
.
widget
=
''
;
* See the License for the specific language governing permissions and
this
.
$element
=
$
(
element
);
* limitations under the License.
this
.
defaultTime
=
options
.
defaultTime
;
* ========================================================= */
this
.
disableFocus
=
options
.
disableFocus
;
this
.
isOpen
=
options
.
isOpen
;
!
function
(
$
)
{
this
.
minuteStep
=
options
.
minuteStep
;
this
.
modalBackdrop
=
options
.
modalBackdrop
;
"use strict"
;
// jshint ;_;
this
.
secondStep
=
options
.
secondStep
;
this
.
showInputs
=
options
.
showInputs
;
var
isTouch
=
'ontouchstart'
in
window
;
this
.
showMeridian
=
options
.
showMeridian
;
this
.
showSeconds
=
options
.
showSeconds
;
/* TIMEPICKER PUBLIC CLASS DEFINITION
this
.
template
=
options
.
template
;
* ================================== */
this
.
appendWidgetTo
=
options
.
appendWidgetTo
;
var
Timepicker
=
function
(
element
,
options
)
{
this
.
$element
=
$
(
element
);
this
.
_init
();
this
.
options
=
$
.
extend
({},
$
.
fn
.
timepicker
.
defaults
,
options
,
this
.
$element
.
data
());
};
this
.
minuteStep
=
this
.
options
.
minuteStep
||
this
.
minuteStep
;
this
.
secondStep
=
this
.
options
.
secondStep
||
this
.
secondStep
;
Timepicker
.
prototype
=
{
this
.
showMeridian
=
this
.
options
.
showMeridian
||
this
.
showMeridian
;
this
.
showSeconds
=
this
.
options
.
showSeconds
||
this
.
showSeconds
;
constructor
:
Timepicker
,
this
.
showInputs
=
this
.
options
.
showInputs
||
this
.
showInputs
;
this
.
disableFocus
=
this
.
options
.
disableFocus
||
this
.
disableFocus
;
_init
:
function
()
{
this
.
template
=
this
.
options
.
template
||
this
.
template
;
var
self
=
this
;
this
.
modalBackdrop
=
this
.
options
.
modalBackdrop
||
this
.
modalBackdrop
;
this
.
defaultTime
=
this
.
options
.
defaultTime
||
this
.
defaultTime
;
if
(
this
.
$element
.
parent
().
hasClass
(
'input-append'
)
||
this
.
$element
.
parent
().
hasClass
(
'input-prepend'
))
{
this
.
open
=
false
;
this
.
$element
.
parent
(
'.input-append, .input-prepend'
).
find
(
'.add-on'
).
on
({
this
.
init
();
'click.timepicker'
:
$
.
proxy
(
this
.
showWidget
,
this
)
};
});
this
.
$element
.
on
({
Timepicker
.
prototype
=
{
'focus.timepicker'
:
$
.
proxy
(
this
.
highlightUnit
,
this
),
'click.timepicker'
:
$
.
proxy
(
this
.
highlightUnit
,
this
),
constructor
:
Timepicker
'keydown.timepicker'
:
$
.
proxy
(
this
.
elementKeydown
,
this
),
'blur.timepicker'
:
$
.
proxy
(
this
.
blurElement
,
this
)
,
init
:
function
()
{
});
if
(
this
.
$element
.
parent
().
hasClass
(
'input-append'
))
{
}
else
{
this
.
$element
.
parent
(
'.input-append'
).
find
(
'.add-on'
).
on
(
'click'
,
$
.
proxy
(
this
.
showWidget
,
this
));
if
(
this
.
template
)
{
this
.
$element
.
on
({
this
.
$element
.
on
({
focus
:
$
.
proxy
(
this
.
highlightUnit
,
this
),
'focus.timepicker'
:
$
.
proxy
(
this
.
showWidget
,
this
),
click
:
$
.
proxy
(
this
.
highlightUnit
,
this
),
'click.timepicker'
:
$
.
proxy
(
this
.
showWidget
,
this
),
keydown
:
$
.
proxy
(
this
.
elementKeydown
,
this
),
'blur.timepicker'
:
$
.
proxy
(
this
.
blurElement
,
this
)
blur
:
$
.
proxy
(
this
.
blurElement
,
this
)
});
});
}
else
{
this
.
$element
.
on
({
}
else
{
'focus.timepicker'
:
$
.
proxy
(
this
.
highlightUnit
,
this
),
if
(
this
.
template
)
{
'click.timepicker'
:
$
.
proxy
(
this
.
highlightUnit
,
this
),
this
.
$element
.
on
({
'keydown.timepicker'
:
$
.
proxy
(
this
.
elementKeydown
,
this
),
focus
:
$
.
proxy
(
this
.
showWidget
,
this
),
'blur.timepicker'
:
$
.
proxy
(
this
.
blurElement
,
this
)
click
:
$
.
proxy
(
this
.
showWidget
,
this
),
});
blur
:
$
.
proxy
(
this
.
blurElement
,
this
)
}
});
}
}
else
{
this
.
$element
.
on
({
if
(
this
.
template
!==
false
)
{
focus
:
$
.
proxy
(
this
.
highlightUnit
,
this
),
this
.
$widget
=
$
(
this
.
getTemplate
()).
prependTo
(
this
.
$element
.
parents
(
this
.
appendWidgetTo
)).
on
(
'click'
,
$
.
proxy
(
this
.
widgetClick
,
this
));
click
:
$
.
proxy
(
this
.
highlightUnit
,
this
),
}
else
{
keydown
:
$
.
proxy
(
this
.
elementKeydown
,
this
),
this
.
$widget
=
false
;
blur
:
$
.
proxy
(
this
.
blurElement
,
this
)
}
});
}
if
(
this
.
showInputs
&&
this
.
$widget
!==
false
)
{
}
this
.
$widget
.
find
(
'input'
).
each
(
function
()
{
$
(
this
).
on
({
'click.timepicker'
:
function
()
{
$
(
this
).
select
();
},
this
.
$widget
=
$
(
this
.
getTemplate
()).
appendTo
(
'body'
);
'keydown.timepicker'
:
$
.
proxy
(
self
.
widgetKeydown
,
self
)
});
this
.
$widget
.
on
(
'click'
,
$
.
proxy
(
this
.
widgetClick
,
this
));
});
}
if
(
this
.
showInputs
)
{
this
.
$widget
.
find
(
'input'
).
on
({
this
.
setDefaultTime
(
this
.
defaultTime
);
click
:
function
()
{
this
.
select
();
},
},
keydown
:
$
.
proxy
(
this
.
widgetKeydown
,
this
),
change
:
$
.
proxy
(
this
.
updateFromWidgetInputs
,
this
)
blurElement
:
function
()
{
});
this
.
highlightedUnit
=
undefined
;
}
this
.
updateFromElementVal
();
},
this
.
setDefaultTime
(
this
.
defaultTime
);
}
decrementHour
:
function
()
{
if
(
this
.
showMeridian
)
{
,
showWidget
:
function
(
e
)
{
if
(
this
.
hour
===
1
)
{
e
.
stopPropagation
();
this
.
hour
=
12
;
}
else
if
(
this
.
hour
===
12
)
{
this
.
hour
--
;
return
this
.
toggleMeridian
();
}
else
if
(
this
.
hour
===
0
)
{
this
.
hour
=
11
;
return
this
.
toggleMeridian
();
}
else
{
this
.
hour
--
;
}
}
else
{
if
(
this
.
hour
===
0
)
{
this
.
hour
=
23
;
}
else
{
this
.
hour
--
;
}
}
this
.
update
();
},
decrementMinute
:
function
(
step
)
{
var
newVal
;
if
(
step
)
{
newVal
=
this
.
minute
-
step
;
}
else
{
newVal
=
this
.
minute
-
this
.
minuteStep
;
}
if
(
newVal
<
0
)
{
this
.
decrementHour
();
this
.
minute
=
newVal
+
60
;
}
else
{
this
.
minute
=
newVal
;
}
this
.
update
();
},
decrementSecond
:
function
()
{
var
newVal
=
this
.
second
-
this
.
secondStep
;
if
(
newVal
<
0
)
{
this
.
decrementMinute
(
true
);
this
.
second
=
newVal
+
60
;
}
else
{
this
.
second
=
newVal
;
}
this
.
update
();
},
elementKeydown
:
function
(
e
)
{
switch
(
e
.
keyCode
)
{
case
9
:
//tab
this
.
updateFromElementVal
();
switch
(
this
.
highlightedUnit
)
{
case
'hour'
:
e
.
preventDefault
();
this
.
highlightNextUnit
();
break
;
case
'minute'
:
if
(
this
.
showMeridian
||
this
.
showSeconds
)
{
e
.
preventDefault
();
e
.
preventDefault
();
this
.
highlightNextUnit
();
if
(
this
.
open
)
{
}
return
;
break
;
}
case
'second'
:
if
(
this
.
showMeridian
)
{
this
.
$element
.
trigger
(
'show'
);
if
(
isTouch
||
this
.
disableFocus
)
{
this
.
$element
.
blur
();
}
var
pos
=
$
.
extend
({},
this
.
$element
.
offset
(),
{
height
:
this
.
$element
[
0
].
offsetHeight
});
this
.
updateFromElementVal
();
$
(
'html'
)
.
one
(
isTouch
?
'touchstart.timepicker.data-api'
:
'click.timepicker.data-api'
,
$
.
proxy
(
this
.
hideWidget
,
this
))
.
on
(
isTouch
?
'touchstart.timepicker.data-api'
:
'click.timepicker.data-api'
,
'.bootstrap-timepicker'
,
function
(
e
)
{
e
.
stopPropagation
()
});
if
(
this
.
template
===
'modal'
)
{
this
.
$widget
.
modal
(
'show'
).
on
(
'hidden'
,
$
.
proxy
(
this
.
hideWidget
,
this
));
}
else
{
this
.
$widget
.
css
({
top
:
pos
.
top
+
pos
.
height
,
left
:
pos
.
left
})
if
(
!
this
.
open
)
{
this
.
$widget
.
addClass
(
'open'
);
}
}
this
.
open
=
true
;
this
.
$element
.
trigger
(
'shown'
);
}
,
hideWidget
:
function
(){
this
.
$element
.
trigger
(
'hide'
);
if
(
this
.
template
===
'modal'
)
{
this
.
$widget
.
modal
(
'hide'
);
}
else
{
this
.
$widget
.
removeClass
(
'open'
);
}
this
.
open
=
false
;
this
.
$element
.
trigger
(
'hidden'
);
}
,
widgetClick
:
function
(
e
)
{
e
.
stopPropagation
();
e
.
preventDefault
();
e
.
preventDefault
();
this
.
highlightNextUnit
();
var
action
=
$
(
e
.
target
).
closest
(
'a'
).
data
(
'action'
);
}
if
(
action
)
{
break
;
this
[
action
]();
}
this
.
update
();
break
;
}
case
27
:
// escape
}
this
.
updateFromElementVal
();
break
;
,
widgetKeydown
:
function
(
e
)
{
case
37
:
// left arrow
var
input
=
$
(
e
.
target
).
closest
(
'input'
).
attr
(
'name'
);
e
.
preventDefault
();
this
.
highlightPrevUnit
();
switch
(
e
.
keyCode
)
{
this
.
updateFromElementVal
();
case
9
:
//tab
break
;
if
(
this
.
showMeridian
)
{
case
38
:
// up arrow
if
(
input
==
'meridian'
)
{
e
.
preventDefault
();
this
.
hideWidget
();
switch
(
this
.
highlightedUnit
)
{
}
case
'hour'
:
}
else
{
this
.
incrementHour
();
if
(
this
.
showSeconds
)
{
this
.
highlightHour
();
if
(
input
==
'second'
)
{
break
;
this
.
hideWidget
();
case
'minute'
:
}
this
.
incrementMinute
();
}
else
{
this
.
highlightMinute
();
if
(
input
==
'minute'
)
{
break
;
this
.
hideWidget
();
case
'second'
:
}
this
.
incrementSecond
();
}
this
.
highlightSecond
();
}
break
;
break
;
case
'meridian'
:
case
27
:
// escape
this
.
toggleMeridian
();
this
.
hideWidget
();
this
.
highlightMeridian
();
break
;
break
;
case
38
:
// up arrow
}
switch
(
input
)
{
break
;
case
'hour'
:
case
39
:
// right arrow
this
.
incrementHour
();
e
.
preventDefault
();
break
;
this
.
updateFromElementVal
();
case
'minute'
:
this
.
highlightNextUnit
();
this
.
incrementMinute
();
break
;
break
;
case
40
:
// down arrow
case
'second'
:
e
.
preventDefault
();
this
.
incrementSecond
();
switch
(
this
.
highlightedUnit
)
{
break
;
case
'hour'
:
case
'meridian'
:
this
.
decrementHour
();
this
.
toggleMeridian
();
this
.
highlightHour
();
break
;
break
;
}
case
'minute'
:
this
.
update
();
this
.
decrementMinute
();
break
;
this
.
highlightMinute
();
case
40
:
// down arrow
break
;
switch
(
input
)
{
case
'second'
:
case
'hour'
:
this
.
decrementSecond
();
this
.
decrementHour
();
this
.
highlightSecond
();
break
;
break
;
case
'minute'
:
case
'meridian'
:
this
.
decrementMinute
();
this
.
toggleMeridian
();
break
;
this
.
highlightMeridian
();
case
'second'
:
break
;
this
.
decrementSecond
();
}
break
;
break
;
case
'meridian'
:
}
this
.
toggleMeridian
();
},
break
;
}
formatTime
:
function
(
hour
,
minute
,
second
,
meridian
)
{
this
.
update
();
hour
=
hour
<
10
?
'0'
+
hour
:
hour
;
break
;
minute
=
minute
<
10
?
'0'
+
minute
:
minute
;
}
second
=
second
<
10
?
'0'
+
second
:
second
;
}
return
hour
+
':'
+
minute
+
(
this
.
showSeconds
?
':'
+
second
:
''
)
+
(
this
.
showMeridian
?
' '
+
meridian
:
''
);
,
elementKeydown
:
function
(
e
)
{
},
var
input
=
this
.
$element
.
get
(
0
);
switch
(
e
.
keyCode
)
{
getCursorPosition
:
function
()
{
case
0
:
//input
var
input
=
this
.
$element
.
get
(
0
);
break
;
case
9
:
//tab
if
(
'selectionStart'
in
input
)
{
// Standard-compliant browsers
this
.
updateFromElementVal
();
if
(
this
.
showMeridian
)
{
return
input
.
selectionStart
;
if
(
this
.
highlightedUnit
!=
'meridian'
)
{
}
else
if
(
document
.
selection
)
{
// IE fix
e
.
preventDefault
();
input
.
focus
();
this
.
highlightNextUnit
();
var
sel
=
document
.
selection
.
createRange
(),
}
selLen
=
document
.
selection
.
createRange
().
text
.
length
;
}
else
{
if
(
this
.
showSeconds
)
{
sel
.
moveStart
(
'character'
,
-
input
.
value
.
length
);
if
(
this
.
highlightedUnit
!=
'second'
)
{
e
.
preventDefault
();
return
sel
.
text
.
length
-
selLen
;
this
.
highlightNextUnit
();
}
}
},
}
else
{
if
(
this
.
highlightedUnit
!=
'minute'
)
{
getTemplate
:
function
()
{
e
.
preventDefault
();
var
template
,
this
.
highlightNextUnit
();
hourTemplate
,
}
minuteTemplate
,
}
secondTemplate
,
}
meridianTemplate
,
break
;
templateContent
;
case
27
:
// escape
this
.
updateFromElementVal
();
if
(
this
.
showInputs
)
{
break
;
hourTemplate
=
'<input type="text" name="hour" class="bootstrap-timepicker-hour" maxlength="2"/>'
;
case
37
:
// left arrow
minuteTemplate
=
'<input type="text" name="minute" class="bootstrap-timepicker-minute" maxlength="2"/>'
;
this
.
updateFromElementVal
();
secondTemplate
=
'<input type="text" name="second" class="bootstrap-timepicker-second" maxlength="2"/>'
;
this
.
highlightPrevUnit
();
meridianTemplate
=
'<input type="text" name="meridian" class="bootstrap-timepicker-meridian" maxlength="2"/>'
;
break
;
}
else
{
case
38
:
// up arrow
hourTemplate
=
'<span class="bootstrap-timepicker-hour"></span>'
;
switch
(
this
.
highlightedUnit
)
{
minuteTemplate
=
'<span class="bootstrap-timepicker-minute"></span>'
;
case
'hour'
:
secondTemplate
=
'<span class="bootstrap-timepicker-second"></span>'
;
this
.
incrementHour
();
meridianTemplate
=
'<span class="bootstrap-timepicker-meridian"></span>'
;
break
;
}
case
'minute'
:
this
.
incrementMinute
();
templateContent
=
'<table>'
+
break
;
'<tr>'
+
case
'second'
:
'<td><a href="#" data-action="incrementHour"><i class="icon-chevron-up"></i></a></td>'
+
this
.
incrementSecond
();
'<td class="separator"> </td>'
+
break
;
'<td><a href="#" data-action="incrementMinute"><i class="icon-chevron-up"></i></a></td>'
+
case
'meridian'
:
(
this
.
showSeconds
?
this
.
toggleMeridian
();
'<td class="separator"> </td>'
+
break
;
'<td><a href="#" data-action="incrementSecond"><i class="icon-chevron-up"></i></a></td>'
}
:
''
)
+
this
.
updateElement
();
(
this
.
showMeridian
?
break
;
'<td class="separator"> </td>'
+
case
39
:
// right arrow
'<td class="meridian-column"><a href="#" data-action="toggleMeridian"><i class="icon-chevron-up"></i></a></td>'
this
.
updateFromElementVal
();
:
''
)
+
this
.
highlightNextUnit
();
'</tr>'
+
break
;
'<tr>'
+
case
40
:
// down arrow
'<td>'
+
hourTemplate
+
'</td> '
+
switch
(
this
.
highlightedUnit
)
{
'<td class="separator">:</td>'
+
case
'hour'
:
'<td>'
+
minuteTemplate
+
'</td> '
+
this
.
decrementHour
();
(
this
.
showSeconds
?
break
;
'<td class="separator">:</td>'
+
case
'minute'
:
'<td>'
+
secondTemplate
+
'</td>'
this
.
decrementMinute
();
:
''
)
+
break
;
(
this
.
showMeridian
?
case
'second'
:
'<td class="separator"> </td>'
+
this
.
decrementSecond
();
'<td>'
+
meridianTemplate
+
'</td>'
break
;
:
''
)
+
case
'meridian'
:
'</tr>'
+
this
.
toggleMeridian
();
'<tr>'
+
break
;
'<td><a href="#" data-action="decrementHour"><i class="icon-chevron-down"></i></a></td>'
+
}
'<td class="separator"></td>'
+
this
.
updateElement
();
'<td><a href="#" data-action="decrementMinute"><i class="icon-chevron-down"></i></a></td>'
+
break
;
(
this
.
showSeconds
?
}
'<td class="separator"> </td>'
+
'<td><a href="#" data-action="decrementSecond"><i class="icon-chevron-down"></i></a></td>'
if
(
e
.
keyCode
!==
0
&&
e
.
keyCode
!==
8
&&
e
.
keyCode
!==
9
&&
e
.
keyCode
!==
46
)
{
:
''
)
+
e
.
preventDefault
();
(
this
.
showMeridian
?
}
'<td class="separator"> </td>'
+
}
'<td><a href="#" data-action="toggleMeridian"><i class="icon-chevron-down"></i></a></td>'
:
''
)
+
,
setValues
:
function
(
time
)
{
'</tr>'
+
if
(
this
.
showMeridian
)
{
'</table>'
;
var
arr
=
time
.
split
(
' '
);
var
timeArray
=
arr
[
0
].
split
(
':'
);
switch
(
this
.
template
)
{
this
.
meridian
=
arr
[
1
];
case
'modal'
:
}
else
{
template
=
'<div class="bootstrap-timepicker-widget modal hide fade in" data-backdrop="'
+
(
this
.
modalBackdrop
?
'true'
:
'false'
)
+
'">'
+
var
timeArray
=
time
.
split
(
':'
);
'<div class="modal-header">'
+
}
'<a href="#" class="close" data-dismiss="modal">×</a>'
+
'<h3>Pick a Time</h3>'
+
this
.
hour
=
parseInt
(
timeArray
[
0
],
10
);
'</div>'
+
this
.
minute
=
parseInt
(
timeArray
[
1
],
10
);
'<div class="modal-content">'
+
this
.
second
=
parseInt
(
timeArray
[
2
],
10
);
templateContent
+
'</div>'
+
if
(
isNaN
(
this
.
hour
))
{
'<div class="modal-footer">'
+
this
.
hour
=
0
;
'<a href="#" class="btn btn-primary" data-dismiss="modal">OK</a>'
+
}
'</div>'
+
if
(
isNaN
(
this
.
minute
))
{
'</div>'
;
this
.
minute
=
0
;
break
;
}
case
'dropdown'
:
template
=
'<div class="bootstrap-timepicker-widget dropdown-menu">'
+
templateContent
+
'</div>'
;
if
(
this
.
showMeridian
)
{
break
;
if
(
this
.
hour
>
12
)
{
}
this
.
hour
=
12
;
}
else
if
(
this
.
hour
<
1
)
{
return
template
;
this
.
hour
=
1
;
},
}
getTime
:
function
()
{
if
(
this
.
meridian
==
'am'
||
this
.
meridian
==
'a'
)
{
return
this
.
formatTime
(
this
.
hour
,
this
.
minute
,
this
.
second
,
this
.
meridian
);
this
.
meridian
=
'AM'
;
},
}
else
if
(
this
.
meridian
==
'pm'
||
this
.
meridian
==
'p'
)
{
this
.
meridian
=
'PM'
;
hideWidget
:
function
()
{
}
if
(
this
.
isOpen
===
false
)
{
return
;
if
(
this
.
meridian
!=
'AM'
&&
this
.
meridian
!=
'PM'
)
{
}
this
.
meridian
=
'AM'
;
}
if
(
this
.
showInputs
)
{
}
else
{
this
.
updateFromWidgetInputs
();
if
(
this
.
hour
>=
24
)
{
}
this
.
hour
=
23
;
}
else
if
(
this
.
hour
<
0
)
{
this
.
$element
.
trigger
({
this
.
hour
=
0
;
'type'
:
'hide.timepicker'
,
}
'time'
:
{
}
'value'
:
this
.
getTime
(),
'hours'
:
this
.
hour
,
if
(
this
.
minute
<
0
)
{
'minutes'
:
this
.
minute
,
this
.
minute
=
0
;
'seconds'
:
this
.
second
,
}
else
if
(
this
.
minute
>=
60
)
{
'meridian'
:
this
.
meridian
this
.
minute
=
59
;
}
}
});
if
(
this
.
showSeconds
)
{
if
(
this
.
template
===
'modal'
)
{
if
(
isNaN
(
this
.
second
))
{
this
.
$widget
.
modal
(
'hide'
);
this
.
second
=
0
;
}
else
{
}
else
if
(
this
.
second
<
0
)
{
this
.
$widget
.
removeClass
(
'open'
);
this
.
second
=
0
;
}
}
else
if
(
this
.
second
>=
60
)
{
this
.
second
=
59
;
$
(
document
).
off
(
'mousedown.timepicker'
);
}
}
this
.
isOpen
=
false
;
},
if
(
this
.
$element
.
val
()
!=
''
)
this
.
updateElement
();
highlightUnit
:
function
()
{
this
.
updateWidget
();
this
.
position
=
this
.
getCursorPosition
();
}
if
(
this
.
position
>=
0
&&
this
.
position
<=
2
)
{
this
.
highlightHour
();
,
setMeridian
:
function
(
meridian
)
{
}
else
if
(
this
.
position
>=
3
&&
this
.
position
<=
5
)
{
if
(
meridian
==
'a'
||
meridian
==
'am'
||
meridian
==
'AM'
)
{
this
.
highlightMinute
();
this
.
meridian
=
'AM'
;
}
else
if
(
this
.
position
>=
6
&&
this
.
position
<=
8
)
{
}
else
if
(
meridian
==
'p'
||
meridian
==
'pm'
||
meridian
==
'PM'
)
{
if
(
this
.
showSeconds
)
{
this
.
meridian
=
'PM'
;
this
.
highlightSecond
();
}
else
{
}
else
{
this
.
updateWidget
();
this
.
highlightMeridian
();
}
}
}
else
if
(
this
.
position
>=
9
&&
this
.
position
<=
11
)
{
this
.
updateElement
();
this
.
highlightMeridian
();
}
}
},
,
setDefaultTime
:
function
(
defaultTime
){
if
(
defaultTime
)
{
highlightNextUnit
:
function
()
{
if
(
defaultTime
===
'current'
)
{
switch
(
this
.
highlightedUnit
)
{
var
dTime
=
new
Date
();
case
'hour'
:
var
hours
=
dTime
.
getHours
();
this
.
highlightMinute
();
var
minutes
=
Math
.
floor
(
dTime
.
getMinutes
()
/
this
.
minuteStep
)
*
this
.
minuteStep
;
break
;
var
seconds
=
Math
.
floor
(
dTime
.
getSeconds
()
/
this
.
secondStep
)
*
this
.
secondStep
;
case
'minute'
:
var
meridian
=
"AM"
;
if
(
this
.
showSeconds
)
{
if
(
this
.
showMeridian
)
{
this
.
highlightSecond
();
if
(
hours
===
0
)
{
}
else
if
(
this
.
showMeridian
){
hours
=
12
;
this
.
highlightMeridian
();
}
else
if
(
hours
>=
12
)
{
}
else
{
if
(
hours
>
12
)
{
this
.
highlightHour
();
hours
=
hours
-
12
;
}
}
break
;
meridian
=
"PM"
;
case
'second'
:
}
else
{
if
(
this
.
showMeridian
)
{
meridian
=
"AM"
;
this
.
highlightMeridian
();
}
}
else
{
}
this
.
highlightHour
();
this
.
hour
=
hours
;
}
this
.
minute
=
minutes
;
break
;
this
.
second
=
seconds
;
case
'meridian'
:
this
.
meridian
=
meridian
;
this
.
highlightHour
();
}
else
if
(
defaultTime
===
'value'
)
{
break
;
this
.
setValues
(
this
.
$element
.
val
());
}
}
else
{
},
this
.
setValues
(
defaultTime
);
}
highlightPrevUnit
:
function
()
{
if
(
this
.
$element
.
val
()
!=
''
)
switch
(
this
.
highlightedUnit
)
{
this
.
updateElement
();
case
'hour'
:
this
.
updateWidget
();
this
.
highlightMeridian
();
}
else
{
break
;
this
.
hour
=
0
;
case
'minute'
:
this
.
minute
=
0
;
this
.
highlightHour
();
this
.
second
=
0
;
break
;
}
case
'second'
:
}
this
.
highlightMinute
();
break
;
,
formatTime
:
function
(
hour
,
minute
,
second
,
meridian
)
{
case
'meridian'
:
hour
=
hour
<
10
?
'0'
+
hour
:
hour
;
if
(
this
.
showSeconds
)
{
minute
=
minute
<
10
?
'0'
+
minute
:
minute
;
this
.
highlightSecond
();
second
=
second
<
10
?
'0'
+
second
:
second
;
}
else
{
this
.
highlightMinute
();
return
hour
+
':'
+
minute
+
(
this
.
showSeconds
?
':'
+
second
:
''
)
+
(
this
.
showMeridian
?
' '
+
meridian
:
''
);
}
}
break
;
}
,
getTime
:
function
()
{
},
return
this
.
formatTime
(
this
.
hour
,
this
.
minute
,
this
.
second
,
this
.
meridian
);
}
highlightHour
:
function
()
{
var
$element
=
this
.
$element
.
get
(
0
);
,
setTime
:
function
(
time
)
{
this
.
setValues
(
time
);
this
.
highlightedUnit
=
'hour'
;
this
.
update
();
}
if
(
$element
.
setSelectionRange
)
{
setTimeout
(
function
()
{
,
update
:
function
()
{
$element
.
setSelectionRange
(
0
,
2
);
this
.
updateElement
();
},
0
);
this
.
updateWidget
();
}
}
},
,
blurElement
:
function
()
{
highlightMinute
:
function
()
{
this
.
highlightedUnit
=
undefined
;
var
$element
=
this
.
$element
.
get
(
0
);
this
.
updateFromElementVal
();
}
this
.
highlightedUnit
=
'minute'
;
,
updateElement
:
function
()
{
if
(
$element
.
setSelectionRange
)
{
var
time
=
this
.
getTime
();
setTimeout
(
function
()
{
$element
.
setSelectionRange
(
3
,
5
);
this
.
$element
.
val
(
time
).
change
();
},
0
);
}
switch
(
this
.
highlightedUnit
)
{
},
case
'hour'
:
this
.
highlightHour
();
highlightSecond
:
function
()
{
break
;
var
$element
=
this
.
$element
.
get
(
0
);
case
'minute'
:
this
.
highlightMinute
();
this
.
highlightedUnit
=
'second'
;
break
;
case
'second'
:
if
(
$element
.
setSelectionRange
)
{
this
.
highlightSecond
();
setTimeout
(
function
()
{
break
;
$element
.
setSelectionRange
(
6
,
8
);
case
'meridian'
:
},
0
);
this
.
highlightMeridian
();
}
break
;
},
}
}
highlightMeridian
:
function
()
{
var
$element
=
this
.
$element
.
get
(
0
);
,
updateWidget
:
function
()
{
if
(
this
.
showInputs
)
{
this
.
highlightedUnit
=
'meridian'
;
this
.
$widget
.
find
(
'input.bootstrap-timepicker-hour'
).
val
(
this
.
hour
<
10
?
'0'
+
this
.
hour
:
this
.
hour
);
this
.
$widget
.
find
(
'input.bootstrap-timepicker-minute'
).
val
(
this
.
minute
<
10
?
'0'
+
this
.
minute
:
this
.
minute
);
if
(
$element
.
setSelectionRange
)
{
if
(
this
.
showSeconds
)
{
if
(
this
.
showSeconds
)
{
this
.
$widget
.
find
(
'input.bootstrap-timepicker-second'
).
val
(
this
.
second
<
10
?
'0'
+
this
.
second
:
this
.
second
);
setTimeout
(
function
()
{
}
$element
.
setSelectionRange
(
9
,
11
);
if
(
this
.
showMeridian
)
{
},
0
);
this
.
$widget
.
find
(
'input.bootstrap-timepicker-meridian'
).
val
(
this
.
meridian
);
}
else
{
}
setTimeout
(
function
()
{
}
else
{
$element
.
setSelectionRange
(
6
,
8
);
this
.
$widget
.
find
(
'span.bootstrap-timepicker-hour'
).
text
(
this
.
hour
);
},
0
);
this
.
$widget
.
find
(
'span.bootstrap-timepicker-minute'
).
text
(
this
.
minute
<
10
?
'0'
+
this
.
minute
:
this
.
minute
);
}
if
(
this
.
showSeconds
)
{
}
this
.
$widget
.
find
(
'span.bootstrap-timepicker-second'
).
text
(
this
.
second
<
10
?
'0'
+
this
.
second
:
this
.
second
);
},
}
if
(
this
.
showMeridian
)
{
incrementHour
:
function
()
{
this
.
$widget
.
find
(
'span.bootstrap-timepicker-meridian'
).
text
(
this
.
meridian
);
if
(
this
.
showMeridian
)
{
}
if
(
this
.
hour
===
11
)
{
}
this
.
hour
++
;
}
return
this
.
toggleMeridian
();
}
else
if
(
this
.
hour
===
12
)
{
,
updateFromElementVal
:
function
(
e
)
{
this
.
hour
=
0
;
var
time
=
this
.
$element
.
val
();
}
if
(
time
)
{
}
this
.
setValues
(
time
);
if
(
this
.
hour
===
23
)
{
this
.
updateWidget
();
this
.
hour
=
0
;
}
}
return
;
}
,
updateFromWidgetInputs
:
function
()
{
this
.
hour
++
;
var
time
=
$
(
'input.bootstrap-timepicker-hour'
,
this
.
$widget
).
val
()
+
':'
+
this
.
update
();
$
(
'input.bootstrap-timepicker-minute'
,
this
.
$widget
).
val
()
+
},
(
this
.
showSeconds
?
':'
+
$
(
'input.bootstrap-timepicker-second'
,
this
.
$widget
).
val
()
incrementMinute
:
function
(
step
)
{
:
''
)
+
var
newVal
;
(
this
.
showMeridian
?
' '
+
$
(
'input.bootstrap-timepicker-meridian'
,
this
.
$widget
).
val
()
if
(
step
)
{
:
''
);
newVal
=
this
.
minute
+
step
;
}
else
{
this
.
setValues
(
time
);
newVal
=
this
.
minute
+
this
.
minuteStep
-
(
this
.
minute
%
this
.
minuteStep
);
}
}
,
getCursorPosition
:
function
()
{
if
(
newVal
>
59
)
{
var
input
=
this
.
$element
.
get
(
0
);
this
.
incrementHour
();
this
.
minute
=
newVal
-
60
;
if
(
'selectionStart'
in
input
)
{
}
else
{
// Standard-compliant browsers
this
.
minute
=
newVal
;
return
input
.
selectionStart
;
}
}
else
if
(
document
.
selection
)
{
this
.
update
();
// IE fix
},
input
.
focus
();
var
sel
=
document
.
selection
.
createRange
();
incrementSecond
:
function
()
{
var
selLen
=
document
.
selection
.
createRange
().
text
.
length
;
var
newVal
=
this
.
second
+
this
.
secondStep
-
(
this
.
second
%
this
.
secondStep
);
sel
.
moveStart
(
'character'
,
-
input
.
value
.
length
);
if
(
newVal
>
59
)
{
return
sel
.
text
.
length
-
selLen
;
this
.
incrementMinute
(
true
);
}
this
.
second
=
newVal
-
60
;
}
}
else
{
this
.
second
=
newVal
;
,
highlightUnit
:
function
()
{
}
var
input
=
this
.
$element
.
get
(
0
);
this
.
update
();
},
this
.
position
=
this
.
getCursorPosition
();
if
(
this
.
position
>=
0
&&
this
.
position
<=
2
)
{
remove
:
function
()
{
this
.
highlightHour
();
$
(
'document'
).
off
(
'.timepicker'
);
}
else
if
(
this
.
position
>=
3
&&
this
.
position
<=
5
)
{
if
(
this
.
$widget
)
{
this
.
highlightMinute
();
this
.
$widget
.
remove
();
}
else
if
(
this
.
position
>=
6
&&
this
.
position
<=
8
)
{
}
if
(
this
.
showSeconds
)
{
delete
this
.
$element
.
data
().
timepicker
;
this
.
highlightSecond
();
},
}
else
{
this
.
highlightMeridian
();
setDefaultTime
:
function
(
defaultTime
){
}
if
(
!
this
.
$element
.
val
())
{
}
else
if
(
this
.
position
>=
9
&&
this
.
position
<=
11
)
{
if
(
defaultTime
===
'current'
)
{
this
.
highlightMeridian
();
var
dTime
=
new
Date
(),
}
hours
=
dTime
.
getHours
(),
}
minutes
=
Math
.
floor
(
dTime
.
getMinutes
()
/
this
.
minuteStep
)
*
this
.
minuteStep
,
seconds
=
Math
.
floor
(
dTime
.
getSeconds
()
/
this
.
secondStep
)
*
this
.
secondStep
,
,
highlightNextUnit
:
function
()
{
meridian
=
'AM'
;
switch
(
this
.
highlightedUnit
)
{
case
'hour'
:
if
(
this
.
showMeridian
)
{
this
.
highlightMinute
();
if
(
hours
===
0
)
{
break
;
hours
=
12
;
case
'minute'
:
}
else
if
(
hours
>=
12
)
{
if
(
this
.
showSeconds
)
{
if
(
hours
>
12
)
{
this
.
highlightSecond
();
hours
=
hours
-
12
;
}
else
{
}
this
.
highlightMeridian
();
meridian
=
'PM'
;
}
break
;
case
'second'
:
this
.
highlightMeridian
();
break
;
case
'meridian'
:
this
.
highlightHour
();
break
;
}
}
,
highlightPrevUnit
:
function
()
{
switch
(
this
.
highlightedUnit
)
{
case
'hour'
:
this
.
highlightMeridian
();
break
;
case
'minute'
:
this
.
highlightHour
();
break
;
case
'second'
:
this
.
highlightMinute
();
break
;
case
'meridian'
:
if
(
this
.
showSeconds
)
{
this
.
highlightSecond
();
}
else
{
this
.
highlightMinute
();
}
break
;
}
}
,
highlightHour
:
function
()
{
this
.
highlightedUnit
=
'hour'
;
this
.
$element
.
get
(
0
).
setSelectionRange
(
0
,
2
);
}
,
highlightMinute
:
function
()
{
this
.
highlightedUnit
=
'minute'
;
this
.
$element
.
get
(
0
).
setSelectionRange
(
3
,
5
);
}
,
highlightSecond
:
function
()
{
this
.
highlightedUnit
=
'second'
;
this
.
$element
.
get
(
0
).
setSelectionRange
(
6
,
8
);
}
,
highlightMeridian
:
function
()
{
this
.
highlightedUnit
=
'meridian'
;
if
(
this
.
showSeconds
)
{
this
.
$element
.
get
(
0
).
setSelectionRange
(
9
,
11
);
}
else
{
this
.
$element
.
get
(
0
).
setSelectionRange
(
6
,
8
);
}
}
,
incrementHour
:
function
()
{
if
(
this
.
showMeridian
)
{
if
(
this
.
hour
===
11
)
{
this
.
toggleMeridian
();
}
else
if
(
this
.
hour
===
12
)
{
return
this
.
hour
=
1
;
}
}
if
(
this
.
hour
===
23
)
{
return
this
.
hour
=
0
;
}
this
.
hour
=
this
.
hour
+
1
;
}
,
decrementHour
:
function
()
{
if
(
this
.
showMeridian
)
{
if
(
this
.
hour
===
1
)
{
return
this
.
hour
=
12
;
}
else
if
(
this
.
hour
===
12
)
{
this
.
toggleMeridian
();
}
}
if
(
this
.
hour
===
0
)
{
return
this
.
hour
=
23
;
}
this
.
hour
=
this
.
hour
-
1
;
}
,
incrementMinute
:
function
()
{
var
newVal
=
this
.
minute
+
this
.
minuteStep
-
(
this
.
minute
%
this
.
minuteStep
);
if
(
newVal
>
59
)
{
this
.
incrementHour
();
this
.
minute
=
newVal
-
60
;
}
else
{
this
.
minute
=
newVal
;
}
}
,
decrementMinute
:
function
()
{
var
newVal
=
this
.
minute
-
this
.
minuteStep
;
if
(
newVal
<
0
)
{
this
.
decrementHour
();
this
.
minute
=
newVal
+
60
;
}
else
{
this
.
minute
=
newVal
;
}
}
,
incrementSecond
:
function
()
{
var
newVal
=
this
.
second
+
this
.
secondStep
-
(
this
.
second
%
this
.
secondStep
);
if
(
newVal
>
59
)
{
this
.
incrementMinute
();
this
.
second
=
newVal
-
60
;
}
else
{
}
else
{
this
.
second
=
newVal
;
meridian
=
'AM'
;
}
}
}
}
,
decrementSecond
:
function
()
{
this
.
hour
=
hours
;
var
newVal
=
this
.
second
-
this
.
secondStep
;
this
.
minute
=
minutes
;
if
(
newVal
<
0
)
{
this
.
second
=
seconds
;
this
.
decrementMinute
();
this
.
meridian
=
meridian
;
this
.
second
=
newVal
+
60
;
}
else
{
this
.
update
();
this
.
second
=
newVal
;
}
}
else
if
(
defaultTime
===
false
)
{
}
this
.
hour
=
0
;
this
.
minute
=
0
;
,
toggleMeridian
:
function
()
{
this
.
second
=
0
;
this
.
meridian
=
this
.
meridian
===
'AM'
?
'PM'
:
'AM'
;
this
.
meridian
=
'AM'
;
}
else
{
this
.
update
();
this
.
setTime
(
defaultTime
);
}
}
}
else
{
,
getTemplate
:
function
()
{
this
.
updateFromElementVal
();
if
(
this
.
options
.
templates
[
this
.
options
.
template
])
{
}
return
this
.
options
.
templates
[
this
.
options
.
template
];
},
}
if
(
this
.
showInputs
)
{
setTime
:
function
(
time
)
{
var
hourTemplate
=
'<input type="text" name="hour" class="bootstrap-timepicker-hour" maxlength="2"/>'
;
var
arr
,
var
minuteTemplate
=
'<input type="text" name="minute" class="bootstrap-timepicker-minute" maxlength="2"/>'
;
timeArray
;
var
secondTemplate
=
'<input type="text" name="second" class="bootstrap-timepicker-second" maxlength="2"/>'
;
var
meridianTemplate
=
'<input type="text" name="meridian" class="bootstrap-timepicker-meridian" maxlength="2"/>'
;
if
(
this
.
showMeridian
)
{
}
else
{
arr
=
time
.
split
(
' '
);
var
hourTemplate
=
'<span class="bootstrap-timepicker-hour"></span>'
;
timeArray
=
arr
[
0
].
split
(
':'
);
var
minuteTemplate
=
'<span class="bootstrap-timepicker-minute"></span>'
;
this
.
meridian
=
arr
[
1
];
var
secondTemplate
=
'<span class="bootstrap-timepicker-second"></span>'
;
}
else
{
var
meridianTemplate
=
'<span class="bootstrap-timepicker-meridian"></span>'
;
timeArray
=
time
.
split
(
':'
);
}
}
var
templateContent
=
'<table class="'
+
(
this
.
showSeconds
?
'show-seconds'
:
''
)
+
' '
+
(
this
.
showMeridian
?
'show-meridian'
:
''
)
+
'">'
+
'<tr>'
+
this
.
hour
=
parseInt
(
timeArray
[
0
],
10
);
'<td><a href="#" data-action="incrementHour"><i class="icon-chevron-up"></i></a></td>'
+
this
.
minute
=
parseInt
(
timeArray
[
1
],
10
);
'<td class="separator"> </td>'
+
this
.
second
=
parseInt
(
timeArray
[
2
],
10
);
'<td><a href="#" data-action="incrementMinute"><i class="icon-chevron-up"></i></a></td>'
+
(
this
.
showSeconds
?
if
(
isNaN
(
this
.
hour
))
{
'<td class="separator"> </td>'
+
this
.
hour
=
0
;
'<td><a href="#" data-action="incrementSecond"><i class="icon-chevron-up"></i></a></td>'
}
:
''
)
+
if
(
isNaN
(
this
.
minute
))
{
(
this
.
showMeridian
?
this
.
minute
=
0
;
'<td class="separator"> </td>'
+
}
'<td class="meridian-column"><a href="#" data-action="toggleMeridian"><i class="icon-chevron-up"></i></a></td>'
:
''
)
+
if
(
this
.
showMeridian
)
{
'</tr>'
+
if
(
this
.
hour
>
12
)
{
'<tr>'
+
this
.
hour
=
12
;
'<td>'
+
hourTemplate
+
'</td> '
+
}
else
if
(
this
.
hour
<
1
)
{
'<td class="separator">:</td>'
+
this
.
hour
=
12
;
'<td>'
+
minuteTemplate
+
'</td> '
+
}
(
this
.
showSeconds
?
'<td class="separator">:</td>'
+
if
(
this
.
meridian
===
'am'
||
this
.
meridian
===
'a'
)
{
'<td>'
+
secondTemplate
+
'</td>'
this
.
meridian
=
'AM'
;
:
''
)
+
}
else
if
(
this
.
meridian
===
'pm'
||
this
.
meridian
===
'p'
)
{
(
this
.
showMeridian
?
this
.
meridian
=
'PM'
;
'<td class="separator"> </td>'
+
}
'<td>'
+
meridianTemplate
+
'</td>'
:
''
)
+
if
(
this
.
meridian
!==
'AM'
&&
this
.
meridian
!==
'PM'
)
{
'</tr>'
+
this
.
meridian
=
'AM'
;
'<tr>'
+
}
'<td><a href="#" data-action="decrementHour"><i class="icon-chevron-down"></i></a></td>'
+
}
else
{
'<td class="separator"></td>'
+
if
(
this
.
hour
>=
24
)
{
'<td><a href="#" data-action="decrementMinute"><i class="icon-chevron-down"></i></a></td>'
+
this
.
hour
=
23
;
(
this
.
showSeconds
?
}
else
if
(
this
.
hour
<
0
)
{
'<td class="separator"> </td>'
+
this
.
hour
=
0
;
'<td><a href="#" data-action="decrementSecond"><i class="icon-chevron-down"></i></a></td>'
}
:
''
)
+
}
(
this
.
showMeridian
?
'<td class="separator"> </td>'
+
if
(
this
.
minute
<
0
)
{
'<td><a href="#" data-action="toggleMeridian"><i class="icon-chevron-down"></i></a></td>'
this
.
minute
=
0
;
:
''
)
+
}
else
if
(
this
.
minute
>=
60
)
{
'</tr>'
+
this
.
minute
=
59
;
'</table>'
;
}
var
template
;
if
(
this
.
showSeconds
)
{
switch
(
this
.
options
.
template
)
{
if
(
isNaN
(
this
.
second
))
{
case
'modal'
:
this
.
second
=
0
;
template
=
'<div class="bootstrap-timepicker modal hide fade in" style="top: 30%; margin-top: 0; width: 200px; margin-left: -100px;" data-backdrop="'
+
(
this
.
modalBackdrop
?
'true'
:
'false'
)
+
'">'
+
}
else
if
(
this
.
second
<
0
)
{
'<div class="modal-header">'
+
this
.
second
=
0
;
'<a href="#" class="close" data-dismiss="modal">×</a>'
+
}
else
if
(
this
.
second
>=
60
)
{
'<h3>Pick a Time</h3>'
+
this
.
second
=
59
;
'</div>'
+
}
'<div class="modal-content">'
+
}
templateContent
+
'</div>'
+
this
.
update
();
'<div class="modal-footer">'
+
},
'<a href="#" class="btn btn-primary" data-dismiss="modal">Ok</a>'
+
'</div>'
+
showWidget
:
function
()
{
'</div>'
;
if
(
this
.
isOpen
)
{
return
;
break
;
}
case
'dropdown'
:
template
=
'<div class="bootstrap-timepicker dropdown-menu">'
+
if
(
this
.
$element
.
is
(
':disabled'
))
{
templateContent
+
return
;
'</div>'
;
}
break
;
var
self
=
this
;
}
$
(
document
).
on
(
'mousedown.timepicker'
,
function
(
e
)
{
return
template
;
// Clicked outside the timepicker, hide it
}
if
(
$
(
e
.
target
).
closest
(
'.bootstrap-timepicker-widget'
).
length
===
0
)
{
};
self
.
hideWidget
();
}
});
/* TIMEPICKER PLUGIN DEFINITION
* =========================== */
this
.
$element
.
trigger
({
'type'
:
'show.timepicker'
,
$
.
fn
.
timepicker
=
function
(
option
)
{
'time'
:
{
return
this
.
each
(
function
()
{
'value'
:
this
.
getTime
(),
var
$this
=
$
(
this
)
'hours'
:
this
.
hour
,
,
data
=
$this
.
data
(
'timepicker'
)
'minutes'
:
this
.
minute
,
,
options
=
typeof
option
==
'object'
&&
option
;
'seconds'
:
this
.
second
,
if
(
!
data
)
{
'meridian'
:
this
.
meridian
$this
.
data
(
'timepicker'
,
(
data
=
new
Timepicker
(
this
,
options
)));
}
}
});
if
(
typeof
option
==
'string'
)
{
data
[
option
]();
if
(
this
.
disableFocus
)
{
}
this
.
$element
.
blur
();
})
}
}
this
.
updateFromElementVal
();
$
.
fn
.
timepicker
.
defaults
=
{
minuteStep
:
15
if
(
this
.
template
===
'modal'
)
{
,
secondStep
:
15
this
.
$widget
.
modal
(
'show'
).
on
(
'hidden'
,
$
.
proxy
(
this
.
hideWidget
,
this
));
,
disableFocus
:
false
}
else
{
,
defaultTime
:
'current'
if
(
this
.
isOpen
===
false
)
{
,
showSeconds
:
false
this
.
$widget
.
addClass
(
'open'
);
,
showInputs
:
true
}
,
showMeridian
:
true
}
,
template
:
'dropdown'
,
modalBackdrop
:
false
this
.
isOpen
=
true
;
,
templates
:
{}
// set custom templates
},
toggleMeridian
:
function
()
{
this
.
meridian
=
this
.
meridian
===
'AM'
?
'PM'
:
'AM'
;
this
.
update
();
},
update
:
function
()
{
this
.
$element
.
trigger
({
'type'
:
'changeTime.timepicker'
,
'time'
:
{
'value'
:
this
.
getTime
(),
'hours'
:
this
.
hour
,
'minutes'
:
this
.
minute
,
'seconds'
:
this
.
second
,
'meridian'
:
this
.
meridian
}
});
this
.
updateElement
();
this
.
updateWidget
();
},
updateElement
:
function
()
{
this
.
$element
.
val
(
this
.
getTime
()).
change
();
},
updateFromElementVal
:
function
()
{
var
val
=
this
.
$element
.
val
();
if
(
val
)
{
this
.
setTime
(
val
);
}
},
updateWidget
:
function
()
{
if
(
this
.
$widget
===
false
)
{
return
;
}
var
hour
=
this
.
hour
<
10
?
'0'
+
this
.
hour
:
this
.
hour
,
minute
=
this
.
minute
<
10
?
'0'
+
this
.
minute
:
this
.
minute
,
second
=
this
.
second
<
10
?
'0'
+
this
.
second
:
this
.
second
;
if
(
this
.
showInputs
)
{
this
.
$widget
.
find
(
'input.bootstrap-timepicker-hour'
).
val
(
hour
);
this
.
$widget
.
find
(
'input.bootstrap-timepicker-minute'
).
val
(
minute
);
if
(
this
.
showSeconds
)
{
this
.
$widget
.
find
(
'input.bootstrap-timepicker-second'
).
val
(
second
);
}
if
(
this
.
showMeridian
)
{
this
.
$widget
.
find
(
'input.bootstrap-timepicker-meridian'
).
val
(
this
.
meridian
);
}
}
else
{
this
.
$widget
.
find
(
'span.bootstrap-timepicker-hour'
).
text
(
hour
);
this
.
$widget
.
find
(
'span.bootstrap-timepicker-minute'
).
text
(
minute
);
if
(
this
.
showSeconds
)
{
this
.
$widget
.
find
(
'span.bootstrap-timepicker-second'
).
text
(
second
);
}
if
(
this
.
showMeridian
)
{
this
.
$widget
.
find
(
'span.bootstrap-timepicker-meridian'
).
text
(
this
.
meridian
);
}
}
},
updateFromWidgetInputs
:
function
()
{
if
(
this
.
$widget
===
false
)
{
return
;
}
var
time
=
$
(
'input.bootstrap-timepicker-hour'
,
this
.
$widget
).
val
()
+
':'
+
$
(
'input.bootstrap-timepicker-minute'
,
this
.
$widget
).
val
()
+
(
this
.
showSeconds
?
':'
+
$
(
'input.bootstrap-timepicker-second'
,
this
.
$widget
).
val
()
:
''
)
+
(
this
.
showMeridian
?
' '
+
$
(
'input.bootstrap-timepicker-meridian'
,
this
.
$widget
).
val
()
:
''
);
this
.
setTime
(
time
);
},
widgetClick
:
function
(
e
)
{
e
.
stopPropagation
();
e
.
preventDefault
();
var
action
=
$
(
e
.
target
).
closest
(
'a'
).
data
(
'action'
);
if
(
action
)
{
this
[
action
]();
}
},
widgetKeydown
:
function
(
e
)
{
var
$input
=
$
(
e
.
target
).
closest
(
'input'
),
name
=
$input
.
attr
(
'name'
);
switch
(
e
.
keyCode
)
{
case
9
:
//tab
if
(
this
.
showMeridian
)
{
if
(
name
===
'meridian'
)
{
return
this
.
hideWidget
();
}
}
else
{
if
(
this
.
showSeconds
)
{
if
(
name
===
'second'
)
{
return
this
.
hideWidget
();
}
}
else
{
if
(
name
===
'minute'
)
{
return
this
.
hideWidget
();
}
}
}
this
.
updateFromWidgetInputs
();
break
;
case
27
:
// escape
this
.
hideWidget
();
break
;
case
38
:
// up arrow
e
.
preventDefault
();
switch
(
name
)
{
case
'hour'
:
this
.
incrementHour
();
break
;
case
'minute'
:
this
.
incrementMinute
();
break
;
case
'second'
:
this
.
incrementSecond
();
break
;
case
'meridian'
:
this
.
toggleMeridian
();
break
;
}
break
;
case
40
:
// down arrow
e
.
preventDefault
();
switch
(
name
)
{
case
'hour'
:
this
.
decrementHour
();
break
;
case
'minute'
:
this
.
decrementMinute
();
break
;
case
'second'
:
this
.
decrementSecond
();
break
;
case
'meridian'
:
this
.
toggleMeridian
();
break
;
}
break
;
}
}
}
};
$
.
fn
.
timepicker
.
Constructor
=
Timepicker
}(
window
.
jQuery
);
//TIMEPICKER PLUGIN DEFINITION
$
.
fn
.
timepicker
=
function
(
option
)
{
var
args
=
Array
.
apply
(
null
,
arguments
);
args
.
shift
();
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
),
data
=
$this
.
data
(
'timepicker'
),
options
=
typeof
option
===
'object'
&&
option
;
if
(
!
data
)
{
$this
.
data
(
'timepicker'
,
(
data
=
new
Timepicker
(
this
,
$
.
extend
({},
$
.
fn
.
timepicker
.
defaults
,
options
,
$
(
this
).
data
()))));
}
if
(
typeof
option
===
'string'
)
{
data
[
option
].
apply
(
data
,
args
);
}
});
};
$
.
fn
.
timepicker
.
defaults
=
{
defaultTime
:
'current'
,
disableFocus
:
false
,
isOpen
:
false
,
minuteStep
:
15
,
modalBackdrop
:
false
,
secondStep
:
15
,
showSeconds
:
false
,
showInputs
:
true
,
showMeridian
:
true
,
template
:
'dropdown'
,
appendWidgetTo
:
'.bootstrap-timepicker'
};
$
.
fn
.
timepicker
.
Constructor
=
Timepicker
;
})(
jQuery
,
window
,
document
);
\ No newline at end of file
panels/timepicker/module.js
View file @
e0d6cd4b
...
@@ -86,6 +86,7 @@ angular.module('kibana.timepicker', [])
...
@@ -86,6 +86,7 @@ angular.module('kibana.timepicker', [])
// In case some other panel broadcasts a time, set us to an absolute range
// In case some other panel broadcasts a time, set us to an absolute range
$scope
.
$on
(
'refresh'
,
function
()
{
$scope
.
$on
(
'refresh'
,
function
()
{
/*
if(filterSrv.idsByType('time').length > 0) {
if(filterSrv.idsByType('time').length > 0) {
var time = filterSrv.timeRange('min');
var time = filterSrv.timeRange('min');
...
@@ -93,6 +94,8 @@ angular.module('kibana.timepicker', [])
...
@@ -93,6 +94,8 @@ angular.module('kibana.timepicker', [])
$scope.time.to.diff(moment.utc(time.to),'seconds') !== 0)
$scope.time.to.diff(moment.utc(time.to),'seconds') !== 0)
{
{
console.log('time mismatch!')
return;
$scope.set_mode('absolute');
$scope.set_mode('absolute');
// These 3 statements basicly do everything time_apply() does
// These 3 statements basicly do everything time_apply() does
...
@@ -101,6 +104,7 @@ angular.module('kibana.timepicker', [])
...
@@ -101,6 +104,7 @@ angular.module('kibana.timepicker', [])
update_panel();
update_panel();
}
}
}
}
*/
});
});
};
};
...
@@ -176,12 +180,12 @@ angular.module('kibana.timepicker', [])
...
@@ -176,12 +180,12 @@ angular.module('kibana.timepicker', [])
//
//
$scope
.
time_calc
=
function
(){
$scope
.
time_calc
=
function
(){
var
from
,
to
;
var
from
,
to
;
// If time picker is defined (usually is)
// If time picker is defined (usually is)
TOFIX: Horrible parsing
if
(
!
(
_
.
isUndefined
(
$scope
.
timepicker
)))
{
if
(
!
(
_
.
isUndefined
(
$scope
.
timepicker
)))
{
from
=
$scope
.
panel
.
mode
===
'relative'
?
moment
(
kbn
.
time_ago
(
$scope
.
panel
.
timespan
))
:
from
=
$scope
.
panel
.
mode
===
'relative'
?
moment
(
kbn
.
time_ago
(
$scope
.
panel
.
timespan
))
:
moment
(
$scope
.
timepicker
.
from
.
date
+
" "
+
$scope
.
timepicker
.
from
.
time
,
'MM/DD/YYYY HH:mm:ss'
);
moment
(
moment
.
utc
(
$scope
.
timepicker
.
from
.
date
).
format
(
'MM/DD/YYYY'
)
+
" "
+
$scope
.
timepicker
.
from
.
time
,
'MM/DD/YYYY HH:mm:ss'
);
to
=
$scope
.
panel
.
mode
!==
'absolute'
?
moment
()
:
to
=
$scope
.
panel
.
mode
!==
'absolute'
?
moment
()
:
moment
(
$scope
.
timepicker
.
to
.
date
+
" "
+
$scope
.
timepicker
.
to
.
time
,
'MM/DD/YYYY HH:mm:ss'
);
moment
(
moment
.
utc
(
$scope
.
timepicker
.
to
.
date
).
format
(
'MM/DD/YYYY'
)
+
" "
+
$scope
.
timepicker
.
to
.
time
,
'MM/DD/YYYY HH:mm:ss'
);
// Otherwise (probably initialization)
// Otherwise (probably initialization)
}
else
{
}
else
{
from
=
$scope
.
panel
.
mode
===
'relative'
?
moment
(
kbn
.
time_ago
(
$scope
.
panel
.
timespan
))
:
from
=
$scope
.
panel
.
mode
===
'relative'
?
moment
(
kbn
.
time_ago
(
$scope
.
panel
.
timespan
))
:
...
@@ -211,11 +215,13 @@ angular.module('kibana.timepicker', [])
...
@@ -211,11 +215,13 @@ angular.module('kibana.timepicker', [])
// Remove all other time filters
// Remove all other time filters
filterSrv
.
removeByType
(
'time'
);
filterSrv
.
removeByType
(
'time'
);
$scope
.
time
=
$scope
.
time_calc
();
$scope
.
time
=
$scope
.
time_calc
();
$scope
.
time
.
field
=
$scope
.
panel
.
timefield
;
$scope
.
time
.
field
=
$scope
.
panel
.
timefield
;
update_panel
();
update_panel
();
set_time_filter
(
$scope
.
time
);
set_time_filter
(
$scope
.
time
);
dashboard
.
refresh
();
dashboard
.
refresh
();
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment