Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
53e4dc7a
Commit
53e4dc7a
authored
Oct 28, 2015
by
ibuler@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
search detail
parent
76ad6730
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
4331 additions
and
23 deletions
+4331
-23
models.py
jlog/models.py
+10
-0
urls.py
jlog/urls.py
+3
-3
views.py
jlog/views.py
+9
-8
api.py
jumpserver/api.py
+4
-6
chosen-sprite.png
static/css/plugins/chosen/chosen-sprite.png
+0
-0
chosen-sprite@2x.png
static/css/plugins/chosen/chosen-sprite@2x.png
+0
-0
chosen.css
static/css/plugins/chosen/chosen.css
+429
-0
datepicker3.css
static/css/plugins/datapicker/datepicker3.css
+789
-0
cropper.min.js
static/js/cropper/cropper.min.js
+10
-0
bootstrap-datepicker.js
static/js/datapicker/bootstrap-datepicker.js
+1671
-0
chosen.jquery.js
static/js/plugins/chosen/chosen.jquery.js
+1211
-0
log_filter.html
templates/jlog/log_filter.html
+140
-0
log_offline.html
templates/jlog/log_offline.html
+54
-6
log_online.html
templates/jlog/log_online.html
+1
-0
No files found.
jlog/models.py
View file @
53e4dc7a
...
@@ -19,3 +19,13 @@ class Alert(models.Model):
...
@@ -19,3 +19,13 @@ class Alert(models.Model):
msg
=
models
.
CharField
(
max_length
=
20
)
msg
=
models
.
CharField
(
max_length
=
20
)
time
=
models
.
DateTimeField
(
null
=
True
)
time
=
models
.
DateTimeField
(
null
=
True
)
is_finished
=
models
.
BigIntegerField
(
default
=
False
)
is_finished
=
models
.
BigIntegerField
(
default
=
False
)
class
TtyLog
(
models
.
Model
):
log_id
=
models
.
IntegerField
(
max_length
=
50
)
username
=
models
.
CharField
(
max_length
=
100
)
host
=
models
.
CharField
(
max_length
=
100
)
remote_ip
=
models
.
CharField
(
max_length
=
100
)
datetime
=
models
.
DateTimeField
()
cmd
=
models
.
CharField
(
max_length
=
200
)
jlog/urls.py
View file @
53e4dc7a
...
@@ -8,5 +8,5 @@ urlpatterns = patterns('',
...
@@ -8,5 +8,5 @@ urlpatterns = patterns('',
# url(r'^log_kill/', log_kill),
# url(r'^log_kill/', log_kill),
url
(
r'^history/$'
,
log_history
),
url
(
r'^history/$'
,
log_history
),
url
(
r'^record/$'
,
log_record
),
url
(
r'^record/$'
,
log_record
),
# url(r'^search/$', log_search),
url
(
r'^search/$'
,
log_search
),
)
)
\ No newline at end of file
\ No newline at end of file
jlog/views.py
View file @
53e4dc7a
...
@@ -92,14 +92,11 @@ def log_list(request, offset):
...
@@ -92,14 +92,11 @@ def log_list(request, offset):
def
log_history
(
request
):
def
log_history
(
request
):
""" 命令历史记录 """
""" 命令历史记录 """
log_id
=
request
.
GET
.
get
(
'id'
,
0
)
log_id
=
request
.
GET
.
get
(
'id'
,
0
)
log
=
Log
.
objects
.
filter
(
id
=
int
(
log_id
))
tty_logs
=
TtyLog
.
objects
.
filter
(
log_id
=
int
(
log_id
))
.
order_by
(
'datetime'
)
if
log
:
if
tty_logs
:
log
=
log
[
0
]
content
=
''
log_his
=
"
%
s.his"
%
log
.
log_path
for
tty_log
in
tty_logs
:
print
log_his
content
+=
'
%
s:
%
s
\n
'
%
(
tty_log
.
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
),
tty_log
.
cmd
)
if
os
.
path
.
isfile
(
log_his
):
f
=
open
(
log_his
)
content
=
f
.
read
()
return
HttpResponse
(
content
)
return
HttpResponse
(
content
)
else
:
else
:
return
HttpResponse
(
'无日志记录, 请查看日志处理脚本是否开启!'
)
return
HttpResponse
(
'无日志记录, 请查看日志处理脚本是否开启!'
)
...
@@ -119,6 +116,10 @@ def log_record(request):
...
@@ -119,6 +116,10 @@ def log_record(request):
return
HttpResponse
(
'无日志记录, 请查看日志处理脚本是否开启!'
)
return
HttpResponse
(
'无日志记录, 请查看日志处理脚本是否开启!'
)
def
log_search
(
request
):
print
request
.
GET
return
render_to_response
(
'jlog/log_filter.html'
,
locals
())
# def log_search(request):
# def log_search(request):
# """ 日志搜索 """
# """ 日志搜索 """
# offset = request.GET.get('env', '')
# offset = request.GET.get('env', '')
...
...
jumpserver/api.py
View file @
53e4dc7a
...
@@ -20,7 +20,7 @@ from django.template import RequestContext
...
@@ -20,7 +20,7 @@ from django.template import RequestContext
from
juser.models
import
User
,
UserGroup
from
juser.models
import
User
,
UserGroup
from
jasset.models
import
Asset
,
AssetGroup
from
jasset.models
import
Asset
,
AssetGroup
from
jasset.models
import
AssetAlias
from
jasset.models
import
AssetAlias
from
jlog.models
import
Log
from
jlog.models
import
Log
,
TtyLog
from
django.core.exceptions
import
ObjectDoesNotExist
,
MultipleObjectsReturned
from
django.core.exceptions
import
ObjectDoesNotExist
,
MultipleObjectsReturned
from
django.http
import
HttpResponseRedirect
from
django.http
import
HttpResponseRedirect
from
django.shortcuts
import
render_to_response
from
django.shortcuts
import
render_to_response
...
@@ -202,7 +202,6 @@ class Jtty(object):
...
@@ -202,7 +202,6 @@ class Jtty(object):
try
:
try
:
log_file_f
=
open
(
log_file_path
+
'.log'
,
'a'
)
log_file_f
=
open
(
log_file_path
+
'.log'
,
'a'
)
log_time_f
=
open
(
log_file_path
+
'.time'
,
'a'
)
log_time_f
=
open
(
log_file_path
+
'.time'
,
'a'
)
log_res_f
=
open
(
log_file_path
+
'.his'
,
'a'
)
except
IOError
:
except
IOError
:
raise
ServerError
(
'Create logfile failed, Please modify
%
s permission.'
%
today_connect_log_dir
)
raise
ServerError
(
'Create logfile failed, Please modify
%
s permission.'
%
today_connect_log_dir
)
...
@@ -210,14 +209,14 @@ class Jtty(object):
...
@@ -210,14 +209,14 @@ class Jtty(object):
log_path
=
log_file_path
,
start_time
=
datetime
.
datetime
.
now
(),
pid
=
pid
)
log_path
=
log_file_path
,
start_time
=
datetime
.
datetime
.
now
(),
pid
=
pid
)
log_file_f
.
write
(
'Start time is
%
s
\n
'
%
datetime
.
datetime
.
now
())
log_file_f
.
write
(
'Start time is
%
s
\n
'
%
datetime
.
datetime
.
now
())
log
.
save
()
log
.
save
()
return
log_file_f
,
log_time_f
,
log_res_f
,
log
return
log_file_f
,
log_time_f
,
ip_list
,
log
def
posix_shell
(
self
):
def
posix_shell
(
self
):
"""
"""
Use paramiko channel connect server interactive.
Use paramiko channel connect server interactive.
使用paramiko模块的channel,连接后端,进入交互式
使用paramiko模块的channel,连接后端,进入交互式
"""
"""
log_file_f
,
log_time_f
,
log_res_f
,
log
=
self
.
log_record
()
log_file_f
,
log_time_f
,
ip_list
,
log
=
self
.
log_record
()
old_tty
=
termios
.
tcgetattr
(
sys
.
stdin
)
old_tty
=
termios
.
tcgetattr
(
sys
.
stdin
)
pre_timestamp
=
time
.
time
()
pre_timestamp
=
time
.
time
()
input_r
=
''
input_r
=
''
...
@@ -261,8 +260,7 @@ class Jtty(object):
...
@@ -261,8 +260,7 @@ class Jtty(object):
if
str
(
x
)
in
[
'
\r
'
,
'
\n
'
,
'
\r\n
'
]:
if
str
(
x
)
in
[
'
\r
'
,
'
\n
'
,
'
\r\n
'
]:
input_r
=
remove_control_char
(
input_r
)
input_r
=
remove_control_char
(
input_r
)
log_res_f
.
write
(
'
%
s:
%
s
\n
'
%
(
datetime
.
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
),
input_r
))
TtyLog
(
log_id
=
log
.
id
,
username
=
self
.
username
,
host
=
self
.
ip
,
remote_ip
=
ip_list
,
datetime
=
datetime
.
datetime
.
now
(),
cmd
=
input_r
)
.
save
()
log_res_f
.
flush
()
input_r
=
''
input_r
=
''
input_mode
=
False
input_mode
=
False
...
...
static/css/plugins/chosen/chosen-sprite.png
0 → 100755
View file @
53e4dc7a
646 Bytes
static/css/plugins/chosen/chosen-sprite@2x.png
0 → 100755
View file @
53e4dc7a
872 Bytes
static/css/plugins/chosen/chosen.css
0 → 100755
View file @
53e4dc7a
/*!
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.1.0
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
*/
/* @group Base */
.chosen-container
{
position
:
relative
;
display
:
inline-block
;
vertical-align
:
middle
;
font-size
:
13px
;
zoom
:
1
;
*
display
:
inline
;
-webkit-user-select
:
none
;
-moz-user-select
:
none
;
user-select
:
none
;
}
.chosen-container
.chosen-drop
{
position
:
absolute
;
top
:
100%
;
left
:
-9999px
;
z-index
:
1010
;
-webkit-box-sizing
:
border-box
;
-moz-box-sizing
:
border-box
;
box-sizing
:
border-box
;
width
:
100%
;
border
:
1px
solid
#aaa
;
border-top
:
0
;
background
:
#fff
;
box-shadow
:
0
4px
5px
rgba
(
0
,
0
,
0
,
0.15
);
}
.chosen-container.chosen-with-drop
.chosen-drop
{
left
:
0
;
}
.chosen-container
a
{
cursor
:
pointer
;
}
/* @end */
/* @group Single Chosen */
.chosen-container-single
.chosen-single
{
position
:
relative
;
display
:
block
;
overflow
:
hidden
;
padding
:
0
0
0
8px
;
height
:
23px
;
border
:
1px
solid
#aaa
;
border-radius
:
5px
;
background-color
:
#fff
;
background
:
-webkit-gradient
(
linear
,
50%
0%
,
50%
100%
,
color-stop
(
20%
,
#ffffff
),
color-stop
(
50%
,
#f6f6f6
),
color-stop
(
52%
,
#eeeeee
),
color-stop
(
100%
,
#f4f4f4
));
background
:
-webkit-linear-gradient
(
top
,
#ffffff
20%
,
#f6f6f6
50%
,
#eeeeee
52%
,
#f4f4f4
100%
);
background
:
-moz-linear-gradient
(
top
,
#ffffff
20%
,
#f6f6f6
50%
,
#eeeeee
52%
,
#f4f4f4
100%
);
background
:
-o-linear-gradient
(
top
,
#ffffff
20%
,
#f6f6f6
50%
,
#eeeeee
52%
,
#f4f4f4
100%
);
background
:
linear-gradient
(
top
,
#ffffff
20%
,
#f6f6f6
50%
,
#eeeeee
52%
,
#f4f4f4
100%
);
background-clip
:
padding-box
;
box-shadow
:
0
0
3px
white
inset
,
0
1px
1px
rgba
(
0
,
0
,
0
,
0.1
);
color
:
#444
;
text-decoration
:
none
;
white-space
:
nowrap
;
line-height
:
24px
;
}
.chosen-container-single
.chosen-default
{
color
:
#999
;
}
.chosen-container-single
.chosen-single
span
{
display
:
block
;
overflow
:
hidden
;
margin-right
:
26px
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
.chosen-container-single
.chosen-single-with-deselect
span
{
margin-right
:
38px
;
}
.chosen-container-single
.chosen-single
abbr
{
position
:
absolute
;
top
:
6px
;
right
:
26px
;
display
:
block
;
width
:
12px
;
height
:
12px
;
background
:
url('chosen-sprite.png')
-42px
1px
no-repeat
;
font-size
:
1px
;
}
.chosen-container-single
.chosen-single
abbr
:hover
{
background-position
:
-42px
-10px
;
}
.chosen-container-single.chosen-disabled
.chosen-single
abbr
:hover
{
background-position
:
-42px
-10px
;
}
.chosen-container-single
.chosen-single
div
{
position
:
absolute
;
top
:
0
;
right
:
0
;
display
:
block
;
width
:
18px
;
height
:
100%
;
}
.chosen-container-single
.chosen-single
div
b
{
display
:
block
;
width
:
100%
;
height
:
100%
;
background
:
url('chosen-sprite.png')
no-repeat
0px
2px
;
}
.chosen-container-single
.chosen-search
{
position
:
relative
;
z-index
:
1010
;
margin
:
0
;
padding
:
3px
4px
;
white-space
:
nowrap
;
}
.chosen-container-single
.chosen-search
input
[
type
=
"text"
]
{
-webkit-box-sizing
:
border-box
;
-moz-box-sizing
:
border-box
;
box-sizing
:
border-box
;
margin
:
1px
0
;
padding
:
4px
20px
4px
5px
;
width
:
100%
;
height
:
auto
;
outline
:
0
;
border
:
1px
solid
#aaa
;
background
:
white
url('chosen-sprite.png')
no-repeat
100%
-20px
;
background
:
url('chosen-sprite.png')
no-repeat
100%
-20px
;
font-size
:
1em
;
font-family
:
sans-serif
;
line-height
:
normal
;
border-radius
:
0
;
}
.chosen-container-single
.chosen-drop
{
margin-top
:
-1px
;
border-radius
:
0
0
4px
4px
;
background-clip
:
padding-box
;
}
.chosen-container-single.chosen-container-single-nosearch
.chosen-search
{
position
:
absolute
;
left
:
-9999px
;
}
/* @end */
/* @group Results */
.chosen-container
.chosen-results
{
position
:
relative
;
overflow-x
:
hidden
;
overflow-y
:
auto
;
margin
:
0
4px
4px
0
;
padding
:
0
0
0
4px
;
max-height
:
240px
;
-webkit-overflow-scrolling
:
touch
;
}
.chosen-container
.chosen-results
li
{
display
:
none
;
margin
:
0
;
padding
:
5px
6px
;
list-style
:
none
;
line-height
:
15px
;
-webkit-touch-callout
:
none
;
}
.chosen-container
.chosen-results
li
.active-result
{
display
:
list-item
;
cursor
:
pointer
;
}
.chosen-container
.chosen-results
li
.disabled-result
{
display
:
list-item
;
color
:
#ccc
;
cursor
:
default
;
}
.chosen-container
.chosen-results
li
.highlighted
{
background-color
:
#3875d7
;
background-image
:
-webkit-gradient
(
linear
,
50%
0%
,
50%
100%
,
color-stop
(
20%
,
#3875d7
),
color-stop
(
90%
,
#2a62bc
));
background-image
:
-webkit-linear-gradient
(
#3875d7
20%
,
#2a62bc
90%
);
background-image
:
-moz-linear-gradient
(
#3875d7
20%
,
#2a62bc
90%
);
background-image
:
-o-linear-gradient
(
#3875d7
20%
,
#2a62bc
90%
);
background-image
:
linear-gradient
(
#3875d7
20%
,
#2a62bc
90%
);
color
:
#fff
;
}
.chosen-container
.chosen-results
li
.no-results
{
display
:
list-item
;
background
:
#f4f4f4
;
}
.chosen-container
.chosen-results
li
.group-result
{
display
:
list-item
;
font-weight
:
bold
;
cursor
:
default
;
}
.chosen-container
.chosen-results
li
.group-option
{
padding-left
:
15px
;
}
.chosen-container
.chosen-results
li
em
{
font-style
:
normal
;
text-decoration
:
underline
;
}
/* @end */
/* @group Multi Chosen */
.chosen-container-multi
.chosen-choices
{
-moz-box-sizing
:
border-box
;
background-color
:
#FFFFFF
;
border
:
1px
solid
#CBD5DD
;
border-radius
:
2px
;
cursor
:
text
;
height
:
auto
!important
;
margin
:
0
;
min-height
:
30px
;
overflow
:
hidden
;
padding
:
2px
;
position
:
relative
;
width
:
100%
;
}
.chosen-container-multi
.chosen-choices
li
{
float
:
left
;
list-style
:
none
;
}
.chosen-container-multi
.chosen-choices
li
.search-field
{
margin
:
0
;
padding
:
0
;
white-space
:
nowrap
;
}
.chosen-container-multi
.chosen-choices
li
.search-field
input
[
type
=
"text"
]
{
margin
:
1px
0
;
padding
:
5px
;
height
:
25px
;
outline
:
0
;
border
:
0
!important
;
background
:
transparent
!important
;
box-shadow
:
none
;
color
:
#666
;
font-size
:
100%
;
font-family
:
sans-serif
;
line-height
:
normal
;
border-radius
:
0
;
}
.chosen-container-multi
.chosen-choices
li
.search-field
.default
{
color
:
#999
;
}
.chosen-container-multi
.chosen-choices
li
.search-choice
{
position
:
relative
;
margin
:
3px
0
3px
5px
;
padding
:
3px
20px
3px
5px
;
border
:
1px
solid
#aaa
;
border-radius
:
3px
;
background-color
:
#e4e4e4
;
background-image
:
-webkit-gradient
(
linear
,
50%
0%
,
50%
100%
,
color-stop
(
20%
,
#f4f4f4
),
color-stop
(
50%
,
#f0f0f0
),
color-stop
(
52%
,
#e8e8e8
),
color-stop
(
100%
,
#eeeeee
));
background-image
:
-webkit-linear-gradient
(
#f4f4f4
20%
,
#f0f0f0
50%
,
#e8e8e8
52%
,
#eeeeee
100%
);
background-image
:
-moz-linear-gradient
(
#f4f4f4
20%
,
#f0f0f0
50%
,
#e8e8e8
52%
,
#eeeeee
100%
);
background-image
:
-o-linear-gradient
(
#f4f4f4
20%
,
#f0f0f0
50%
,
#e8e8e8
52%
,
#eeeeee
100%
);
background-image
:
linear-gradient
(
#f4f4f4
20%
,
#f0f0f0
50%
,
#e8e8e8
52%
,
#eeeeee
100%
);
background-clip
:
padding-box
;
box-shadow
:
0
0
2px
white
inset
,
0
1px
0
rgba
(
0
,
0
,
0
,
0.05
);
color
:
#333
;
line-height
:
13px
;
cursor
:
default
;
}
.chosen-container-multi
.chosen-choices
li
.search-choice
.search-choice-close
{
position
:
absolute
;
top
:
4px
;
right
:
3px
;
display
:
block
;
width
:
12px
;
height
:
12px
;
background
:
url('chosen-sprite.png')
-42px
1px
no-repeat
;
font-size
:
1px
;
}
.chosen-container-multi
.chosen-choices
li
.search-choice
.search-choice-close
:hover
{
background-position
:
-42px
-10px
;
}
.chosen-container-multi
.chosen-choices
li
.search-choice-disabled
{
padding-right
:
5px
;
border
:
1px
solid
#ccc
;
background-color
:
#e4e4e4
;
background-image
:
-webkit-gradient
(
linear
,
50%
0%
,
50%
100%
,
color-stop
(
20%
,
#f4f4f4
),
color-stop
(
50%
,
#f0f0f0
),
color-stop
(
52%
,
#e8e8e8
),
color-stop
(
100%
,
#eeeeee
));
background-image
:
-webkit-linear-gradient
(
top
,
#f4f4f4
20%
,
#f0f0f0
50%
,
#e8e8e8
52%
,
#eeeeee
100%
);
background-image
:
-moz-linear-gradient
(
top
,
#f4f4f4
20%
,
#f0f0f0
50%
,
#e8e8e8
52%
,
#eeeeee
100%
);
background-image
:
-o-linear-gradient
(
top
,
#f4f4f4
20%
,
#f0f0f0
50%
,
#e8e8e8
52%
,
#eeeeee
100%
);
background-image
:
linear-gradient
(
top
,
#f4f4f4
20%
,
#f0f0f0
50%
,
#e8e8e8
52%
,
#eeeeee
100%
);
color
:
#666
;
}
.chosen-container-multi
.chosen-choices
li
.search-choice-focus
{
background
:
#d4d4d4
;
}
.chosen-container-multi
.chosen-choices
li
.search-choice-focus
.search-choice-close
{
background-position
:
-42px
-10px
;
}
.chosen-container-multi
.chosen-results
{
margin
:
0
;
padding
:
0
;
}
.chosen-container-multi
.chosen-drop
.result-selected
{
display
:
list-item
;
color
:
#ccc
;
cursor
:
default
;
}
/* @end */
/* @group Active */
.chosen-container-active
.chosen-single
{
border
:
1px
solid
#5897fb
;
box-shadow
:
0
0
5px
rgba
(
0
,
0
,
0
,
0.3
);
}
.chosen-container-active.chosen-with-drop
.chosen-single
{
border
:
1px
solid
#aaa
;
-moz-border-radius-bottomright
:
0
;
border-bottom-right-radius
:
0
;
-moz-border-radius-bottomleft
:
0
;
border-bottom-left-radius
:
0
;
background-image
:
-webkit-gradient
(
linear
,
50%
0%
,
50%
100%
,
color-stop
(
20%
,
#eeeeee
),
color-stop
(
80%
,
#ffffff
));
background-image
:
-webkit-linear-gradient
(
#eeeeee
20%
,
#ffffff
80%
);
background-image
:
-moz-linear-gradient
(
#eeeeee
20%
,
#ffffff
80%
);
background-image
:
-o-linear-gradient
(
#eeeeee
20%
,
#ffffff
80%
);
background-image
:
linear-gradient
(
#eeeeee
20%
,
#ffffff
80%
);
box-shadow
:
0
1px
0
#fff
inset
;
}
.chosen-container-active.chosen-with-drop
.chosen-single
div
{
border-left
:
none
;
background
:
transparent
;
}
.chosen-container-active.chosen-with-drop
.chosen-single
div
b
{
background-position
:
-18px
2px
;
}
.chosen-container-active
.chosen-choices
{
border
:
1px
solid
#5897fb
;
box-shadow
:
0
0
5px
rgba
(
0
,
0
,
0
,
0.3
);
}
.chosen-container-active
.chosen-choices
li
.search-field
input
[
type
=
"text"
]
{
color
:
#111
!important
;
}
/* @end */
/* @group Disabled Support */
.chosen-disabled
{
opacity
:
0.5
!important
;
cursor
:
default
;
}
.chosen-disabled
.chosen-single
{
cursor
:
default
;
}
.chosen-disabled
.chosen-choices
.search-choice
.search-choice-close
{
cursor
:
default
;
}
/* @end */
/* @group Right to Left */
.chosen-rtl
{
text-align
:
right
;
}
.chosen-rtl
.chosen-single
{
overflow
:
visible
;
padding
:
0
8px
0
0
;
}
.chosen-rtl
.chosen-single
span
{
margin-right
:
0
;
margin-left
:
26px
;
direction
:
rtl
;
}
.chosen-rtl
.chosen-single-with-deselect
span
{
margin-left
:
38px
;
}
.chosen-rtl
.chosen-single
div
{
right
:
auto
;
left
:
3px
;
}
.chosen-rtl
.chosen-single
abbr
{
right
:
auto
;
left
:
26px
;
}
.chosen-rtl
.chosen-choices
li
{
float
:
right
;
}
.chosen-rtl
.chosen-choices
li
.search-field
input
[
type
=
"text"
]
{
direction
:
rtl
;
}
.chosen-rtl
.chosen-choices
li
.search-choice
{
margin
:
3px
5px
3px
0
;
padding
:
3px
5px
3px
19px
;
}
.chosen-rtl
.chosen-choices
li
.search-choice
.search-choice-close
{
right
:
auto
;
left
:
4px
;
}
.chosen-rtl.chosen-container-single-nosearch
.chosen-search
,
.chosen-rtl
.chosen-drop
{
left
:
9999px
;
}
.chosen-rtl.chosen-container-single
.chosen-results
{
margin
:
0
0
4px
4px
;
padding
:
0
4px
0
0
;
}
.chosen-rtl
.chosen-results
li
.group-option
{
padding-right
:
15px
;
padding-left
:
0
;
}
.chosen-rtl.chosen-container-active.chosen-with-drop
.chosen-single
div
{
border-right
:
none
;
}
.chosen-rtl
.chosen-search
input
[
type
=
"text"
]
{
padding
:
4px
5px
4px
20px
;
background
:
white
url('chosen-sprite.png')
no-repeat
-30px
-20px
;
background
:
url('chosen-sprite.png')
no-repeat
-30px
-20px
;
direction
:
rtl
;
}
.chosen-rtl.chosen-container-single
.chosen-single
div
b
{
background-position
:
6px
2px
;
}
.chosen-rtl.chosen-container-single.chosen-with-drop
.chosen-single
div
b
{
background-position
:
-12px
2px
;
}
/* @end */
/* @group Retina compatibility */
@media
only
screen
and
(
-webkit-min-device-pixel-ratio
:
2
),
only
screen
and
(
min-resolution
:
144dpi
)
{
.chosen-rtl
.chosen-search
input
[
type
=
"text"
],
.chosen-container-single
.chosen-single
abbr
,
.chosen-container-single
.chosen-single
div
b
,
.chosen-container-single
.chosen-search
input
[
type
=
"text"
],
.chosen-container-multi
.chosen-choices
.search-choice
.search-choice-close
,
.chosen-container
.chosen-results-scroll-down
span
,
.chosen-container
.chosen-results-scroll-up
span
{
background-image
:
url('chosen-sprite@2x.png')
!important
;
background-size
:
52px
37px
!important
;
background-repeat
:
no-repeat
!important
;
}
}
/* @end */
static/css/plugins/datapicker/datepicker3.css
0 → 100755
View file @
53e4dc7a
/*!
* Datepicker for Bootstrap
*
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
.datepicker
{
padding
:
4px
;
border-radius
:
4px
;
direction
:
ltr
;
/*.dow {
border-top: 1px solid #ddd !important;
}*/
}
.datepicker-inline
{
width
:
220px
;
}
.datepicker.datepicker-rtl
{
direction
:
rtl
;
}
.datepicker.datepicker-rtl
table
tr
td
span
{
float
:
right
;
}
.datepicker-dropdown
{
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-top
:
0
;
border-bottom-color
:
rgba
(
0
,
0
,
0
,
0.2
);
position
:
absolute
;
}
.datepicker-dropdown
:after
{
content
:
''
;
display
:
inline-block
;
border-left
:
6px
solid
transparent
;
border-right
:
6px
solid
transparent
;
border-bottom
:
6px
solid
#fff
;
border-top
:
0
;
position
:
absolute
;
}
.datepicker-dropdown.datepicker-orient-left
:before
{
left
:
6px
;
}
.datepicker-dropdown.datepicker-orient-left
:after
{
left
:
7px
;
}
.datepicker-dropdown.datepicker-orient-right
:before
{
right
:
6px
;
}
.datepicker-dropdown.datepicker-orient-right
:after
{
right
:
7px
;
}
.datepicker-dropdown.datepicker-orient-top
:before
{
top
:
-7px
;
}
.datepicker-dropdown.datepicker-orient-top
:after
{
top
:
-6px
;
}
.datepicker-dropdown.datepicker-orient-bottom
:before
{
bottom
:
-7px
;
border-bottom
:
0
;
border-top
:
7px
solid
#999
;
}
.datepicker-dropdown.datepicker-orient-bottom
:after
{
bottom
:
-6px
;
border-bottom
:
0
;
border-top
:
6px
solid
#fff
;
}
.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
;
-webkit-touch-callout
:
none
;
-webkit-user-select
:
none
;
-khtml-user-select
:
none
;
-moz-user-select
:
none
;
-ms-user-select
:
none
;
user-select
:
none
;
}
.datepicker
table
tr
td
,
.datepicker
table
tr
th
{
text-align
:
center
;
width
:
30px
;
height
:
30px
;
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
,
.datepicker
table
tr
td
.day.focused
{
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
{
color
:
#000000
;
background-color
:
#ffdb99
;
border-color
:
#ffb733
;
}
.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
:focus
,
.datepicker
table
tr
td
.today
:hover:focus
,
.datepicker
table
tr
td
.today.disabled
:focus
,
.datepicker
table
tr
td
.today.disabled
:hover:focus
,
.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
,
.open
.dropdown-toggle.datepicker
table
tr
td
.today
,
.open
.dropdown-toggle.datepicker
table
tr
td
.today
:hover
,
.open
.dropdown-toggle.datepicker
table
tr
td
.today.disabled
,
.open
.dropdown-toggle.datepicker
table
tr
td
.today.disabled
:hover
{
color
:
#000000
;
background-color
:
#ffcd70
;
border-color
:
#f59e00
;
}
.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
,
.open
.dropdown-toggle.datepicker
table
tr
td
.today
,
.open
.dropdown-toggle.datepicker
table
tr
td
.today
:hover
,
.open
.dropdown-toggle.datepicker
table
tr
td
.today.disabled
,
.open
.dropdown-toggle.datepicker
table
tr
td
.today.disabled
:hover
{
background-image
:
none
;
}
.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
],
fieldset
[
disabled
]
.datepicker
table
tr
td
.today
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today.disabled
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today.disabled
:hover
,
.datepicker
table
tr
td
.today.disabled
:hover
,
.datepicker
table
tr
td
.today
:hover
.disabled
:hover
,
.datepicker
table
tr
td
.today.disabled.disabled
:hover
,
.datepicker
table
tr
td
.today.disabled
:hover
.disabled
:hover
,
.datepicker
table
tr
td
.today
[
disabled
]
:hover
,
.datepicker
table
tr
td
.today
:hover
[
disabled
]
:hover
,
.datepicker
table
tr
td
.today.disabled
[
disabled
]
:hover
,
.datepicker
table
tr
td
.today.disabled
:hover
[
disabled
]
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today
:hover:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today.disabled
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today.disabled
:hover:hover
,
.datepicker
table
tr
td
.today.disabled
:focus
,
.datepicker
table
tr
td
.today
:hover
.disabled
:focus
,
.datepicker
table
tr
td
.today.disabled.disabled
:focus
,
.datepicker
table
tr
td
.today.disabled
:hover
.disabled
:focus
,
.datepicker
table
tr
td
.today
[
disabled
]
:focus
,
.datepicker
table
tr
td
.today
:hover
[
disabled
]
:focus
,
.datepicker
table
tr
td
.today.disabled
[
disabled
]
:focus
,
.datepicker
table
tr
td
.today.disabled
:hover
[
disabled
]
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today
:hover:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today.disabled
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today.disabled
:hover:focus
,
.datepicker
table
tr
td
.today.disabled
:active
,
.datepicker
table
tr
td
.today
:hover
.disabled
:active
,
.datepicker
table
tr
td
.today.disabled.disabled
:active
,
.datepicker
table
tr
td
.today.disabled
:hover
.disabled
:active
,
.datepicker
table
tr
td
.today
[
disabled
]
:active
,
.datepicker
table
tr
td
.today
:hover
[
disabled
]
:active
,
.datepicker
table
tr
td
.today.disabled
[
disabled
]
:active
,
.datepicker
table
tr
td
.today.disabled
:hover
[
disabled
]
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today
:hover:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today.disabled
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today.disabled
:hover:active
,
.datepicker
table
tr
td
.today.disabled.active
,
.datepicker
table
tr
td
.today
:hover
.disabled.active
,
.datepicker
table
tr
td
.today.disabled.disabled.active
,
.datepicker
table
tr
td
.today.disabled
:hover
.disabled.active
,
.datepicker
table
tr
td
.today
[
disabled
]
.active
,
.datepicker
table
tr
td
.today
:hover
[
disabled
]
.active
,
.datepicker
table
tr
td
.today.disabled
[
disabled
]
.active
,
.datepicker
table
tr
td
.today.disabled
:hover
[
disabled
]
.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today
:hover
.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today.disabled.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.today.disabled
:hover
.active
{
background-color
:
#ffdb99
;
border-color
:
#ffb733
;
}
.datepicker
table
tr
td
.today
:hover:hover
{
color
:
#000
;
}
.datepicker
table
tr
td
.today.active
:hover
{
color
:
#fff
;
}
.datepicker
table
tr
td
.range
,
.datepicker
table
tr
td
.range
:hover
,
.datepicker
table
tr
td
.range.disabled
,
.datepicker
table
tr
td
.range.disabled
:hover
{
background
:
#eeeeee
;
border-radius
:
0
;
}
.datepicker
table
tr
td
.range.today
,
.datepicker
table
tr
td
.range.today
:hover
,
.datepicker
table
tr
td
.range.today.disabled
,
.datepicker
table
tr
td
.range.today.disabled
:hover
{
color
:
#000000
;
background-color
:
#f7ca77
;
border-color
:
#f1a417
;
border-radius
:
0
;
}
.datepicker
table
tr
td
.range.today
:hover
,
.datepicker
table
tr
td
.range.today
:hover:hover
,
.datepicker
table
tr
td
.range.today.disabled
:hover
,
.datepicker
table
tr
td
.range.today.disabled
:hover:hover
,
.datepicker
table
tr
td
.range.today
:focus
,
.datepicker
table
tr
td
.range.today
:hover:focus
,
.datepicker
table
tr
td
.range.today.disabled
:focus
,
.datepicker
table
tr
td
.range.today.disabled
:hover:focus
,
.datepicker
table
tr
td
.range.today
:active
,
.datepicker
table
tr
td
.range.today
:hover:active
,
.datepicker
table
tr
td
.range.today.disabled
:active
,
.datepicker
table
tr
td
.range.today.disabled
:hover:active
,
.datepicker
table
tr
td
.range.today.active
,
.datepicker
table
tr
td
.range.today
:hover
.active
,
.datepicker
table
tr
td
.range.today.disabled.active
,
.datepicker
table
tr
td
.range.today.disabled
:hover
.active
,
.open
.dropdown-toggle.datepicker
table
tr
td
.range.today
,
.open
.dropdown-toggle.datepicker
table
tr
td
.range.today
:hover
,
.open
.dropdown-toggle.datepicker
table
tr
td
.range.today.disabled
,
.open
.dropdown-toggle.datepicker
table
tr
td
.range.today.disabled
:hover
{
color
:
#000000
;
background-color
:
#f4bb51
;
border-color
:
#bf800c
;
}
.datepicker
table
tr
td
.range.today
:active
,
.datepicker
table
tr
td
.range.today
:hover:active
,
.datepicker
table
tr
td
.range.today.disabled
:active
,
.datepicker
table
tr
td
.range.today.disabled
:hover:active
,
.datepicker
table
tr
td
.range.today.active
,
.datepicker
table
tr
td
.range.today
:hover
.active
,
.datepicker
table
tr
td
.range.today.disabled.active
,
.datepicker
table
tr
td
.range.today.disabled
:hover
.active
,
.open
.dropdown-toggle.datepicker
table
tr
td
.range.today
,
.open
.dropdown-toggle.datepicker
table
tr
td
.range.today
:hover
,
.open
.dropdown-toggle.datepicker
table
tr
td
.range.today.disabled
,
.open
.dropdown-toggle.datepicker
table
tr
td
.range.today.disabled
:hover
{
background-image
:
none
;
}
.datepicker
table
tr
td
.range.today.disabled
,
.datepicker
table
tr
td
.range.today
:hover
.disabled
,
.datepicker
table
tr
td
.range.today.disabled.disabled
,
.datepicker
table
tr
td
.range.today.disabled
:hover
.disabled
,
.datepicker
table
tr
td
.range.today
[
disabled
],
.datepicker
table
tr
td
.range.today
:hover
[
disabled
],
.datepicker
table
tr
td
.range.today.disabled
[
disabled
],
.datepicker
table
tr
td
.range.today.disabled
:hover
[
disabled
],
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today.disabled
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today.disabled
:hover
,
.datepicker
table
tr
td
.range.today.disabled
:hover
,
.datepicker
table
tr
td
.range.today
:hover
.disabled
:hover
,
.datepicker
table
tr
td
.range.today.disabled.disabled
:hover
,
.datepicker
table
tr
td
.range.today.disabled
:hover
.disabled
:hover
,
.datepicker
table
tr
td
.range.today
[
disabled
]
:hover
,
.datepicker
table
tr
td
.range.today
:hover
[
disabled
]
:hover
,
.datepicker
table
tr
td
.range.today.disabled
[
disabled
]
:hover
,
.datepicker
table
tr
td
.range.today.disabled
:hover
[
disabled
]
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today
:hover:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today.disabled
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today.disabled
:hover:hover
,
.datepicker
table
tr
td
.range.today.disabled
:focus
,
.datepicker
table
tr
td
.range.today
:hover
.disabled
:focus
,
.datepicker
table
tr
td
.range.today.disabled.disabled
:focus
,
.datepicker
table
tr
td
.range.today.disabled
:hover
.disabled
:focus
,
.datepicker
table
tr
td
.range.today
[
disabled
]
:focus
,
.datepicker
table
tr
td
.range.today
:hover
[
disabled
]
:focus
,
.datepicker
table
tr
td
.range.today.disabled
[
disabled
]
:focus
,
.datepicker
table
tr
td
.range.today.disabled
:hover
[
disabled
]
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today
:hover:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today.disabled
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today.disabled
:hover:focus
,
.datepicker
table
tr
td
.range.today.disabled
:active
,
.datepicker
table
tr
td
.range.today
:hover
.disabled
:active
,
.datepicker
table
tr
td
.range.today.disabled.disabled
:active
,
.datepicker
table
tr
td
.range.today.disabled
:hover
.disabled
:active
,
.datepicker
table
tr
td
.range.today
[
disabled
]
:active
,
.datepicker
table
tr
td
.range.today
:hover
[
disabled
]
:active
,
.datepicker
table
tr
td
.range.today.disabled
[
disabled
]
:active
,
.datepicker
table
tr
td
.range.today.disabled
:hover
[
disabled
]
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today
:hover:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today.disabled
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today.disabled
:hover:active
,
.datepicker
table
tr
td
.range.today.disabled.active
,
.datepicker
table
tr
td
.range.today
:hover
.disabled.active
,
.datepicker
table
tr
td
.range.today.disabled.disabled.active
,
.datepicker
table
tr
td
.range.today.disabled
:hover
.disabled.active
,
.datepicker
table
tr
td
.range.today
[
disabled
]
.active
,
.datepicker
table
tr
td
.range.today
:hover
[
disabled
]
.active
,
.datepicker
table
tr
td
.range.today.disabled
[
disabled
]
.active
,
.datepicker
table
tr
td
.range.today.disabled
:hover
[
disabled
]
.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today
:hover
.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today.disabled.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.range.today.disabled
:hover
.active
{
background-color
:
#f7ca77
;
border-color
:
#f1a417
;
}
.datepicker
table
tr
td
.selected
,
.datepicker
table
tr
td
.selected
:hover
,
.datepicker
table
tr
td
.selected.disabled
,
.datepicker
table
tr
td
.selected.disabled
:hover
{
color
:
#ffffff
;
background-color
:
#999999
;
border-color
:
#555555
;
text-shadow
:
0
-1px
0
rgba
(
0
,
0
,
0
,
0.25
);
}
.datepicker
table
tr
td
.selected
:hover
,
.datepicker
table
tr
td
.selected
:hover:hover
,
.datepicker
table
tr
td
.selected.disabled
:hover
,
.datepicker
table
tr
td
.selected.disabled
:hover:hover
,
.datepicker
table
tr
td
.selected
:focus
,
.datepicker
table
tr
td
.selected
:hover:focus
,
.datepicker
table
tr
td
.selected.disabled
:focus
,
.datepicker
table
tr
td
.selected.disabled
:hover:focus
,
.datepicker
table
tr
td
.selected
:active
,
.datepicker
table
tr
td
.selected
:hover:active
,
.datepicker
table
tr
td
.selected.disabled
:active
,
.datepicker
table
tr
td
.selected.disabled
:hover:active
,
.datepicker
table
tr
td
.selected.active
,
.datepicker
table
tr
td
.selected
:hover
.active
,
.datepicker
table
tr
td
.selected.disabled.active
,
.datepicker
table
tr
td
.selected.disabled
:hover
.active
,
.open
.dropdown-toggle.datepicker
table
tr
td
.selected
,
.open
.dropdown-toggle.datepicker
table
tr
td
.selected
:hover
,
.open
.dropdown-toggle.datepicker
table
tr
td
.selected.disabled
,
.open
.dropdown-toggle.datepicker
table
tr
td
.selected.disabled
:hover
{
color
:
#ffffff
;
background-color
:
#858585
;
border-color
:
#373737
;
}
.datepicker
table
tr
td
.selected
:active
,
.datepicker
table
tr
td
.selected
:hover:active
,
.datepicker
table
tr
td
.selected.disabled
:active
,
.datepicker
table
tr
td
.selected.disabled
:hover:active
,
.datepicker
table
tr
td
.selected.active
,
.datepicker
table
tr
td
.selected
:hover
.active
,
.datepicker
table
tr
td
.selected.disabled.active
,
.datepicker
table
tr
td
.selected.disabled
:hover
.active
,
.open
.dropdown-toggle.datepicker
table
tr
td
.selected
,
.open
.dropdown-toggle.datepicker
table
tr
td
.selected
:hover
,
.open
.dropdown-toggle.datepicker
table
tr
td
.selected.disabled
,
.open
.dropdown-toggle.datepicker
table
tr
td
.selected.disabled
:hover
{
background-image
:
none
;
}
.datepicker
table
tr
td
.selected.disabled
,
.datepicker
table
tr
td
.selected
:hover
.disabled
,
.datepicker
table
tr
td
.selected.disabled.disabled
,
.datepicker
table
tr
td
.selected.disabled
:hover
.disabled
,
.datepicker
table
tr
td
.selected
[
disabled
],
.datepicker
table
tr
td
.selected
:hover
[
disabled
],
.datepicker
table
tr
td
.selected.disabled
[
disabled
],
.datepicker
table
tr
td
.selected.disabled
:hover
[
disabled
],
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected.disabled
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected.disabled
:hover
,
.datepicker
table
tr
td
.selected.disabled
:hover
,
.datepicker
table
tr
td
.selected
:hover
.disabled
:hover
,
.datepicker
table
tr
td
.selected.disabled.disabled
:hover
,
.datepicker
table
tr
td
.selected.disabled
:hover
.disabled
:hover
,
.datepicker
table
tr
td
.selected
[
disabled
]
:hover
,
.datepicker
table
tr
td
.selected
:hover
[
disabled
]
:hover
,
.datepicker
table
tr
td
.selected.disabled
[
disabled
]
:hover
,
.datepicker
table
tr
td
.selected.disabled
:hover
[
disabled
]
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected
:hover:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected.disabled
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected.disabled
:hover:hover
,
.datepicker
table
tr
td
.selected.disabled
:focus
,
.datepicker
table
tr
td
.selected
:hover
.disabled
:focus
,
.datepicker
table
tr
td
.selected.disabled.disabled
:focus
,
.datepicker
table
tr
td
.selected.disabled
:hover
.disabled
:focus
,
.datepicker
table
tr
td
.selected
[
disabled
]
:focus
,
.datepicker
table
tr
td
.selected
:hover
[
disabled
]
:focus
,
.datepicker
table
tr
td
.selected.disabled
[
disabled
]
:focus
,
.datepicker
table
tr
td
.selected.disabled
:hover
[
disabled
]
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected
:hover:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected.disabled
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected.disabled
:hover:focus
,
.datepicker
table
tr
td
.selected.disabled
:active
,
.datepicker
table
tr
td
.selected
:hover
.disabled
:active
,
.datepicker
table
tr
td
.selected.disabled.disabled
:active
,
.datepicker
table
tr
td
.selected.disabled
:hover
.disabled
:active
,
.datepicker
table
tr
td
.selected
[
disabled
]
:active
,
.datepicker
table
tr
td
.selected
:hover
[
disabled
]
:active
,
.datepicker
table
tr
td
.selected.disabled
[
disabled
]
:active
,
.datepicker
table
tr
td
.selected.disabled
:hover
[
disabled
]
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected
:hover:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected.disabled
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected.disabled
:hover:active
,
.datepicker
table
tr
td
.selected.disabled.active
,
.datepicker
table
tr
td
.selected
:hover
.disabled.active
,
.datepicker
table
tr
td
.selected.disabled.disabled.active
,
.datepicker
table
tr
td
.selected.disabled
:hover
.disabled.active
,
.datepicker
table
tr
td
.selected
[
disabled
]
.active
,
.datepicker
table
tr
td
.selected
:hover
[
disabled
]
.active
,
.datepicker
table
tr
td
.selected.disabled
[
disabled
]
.active
,
.datepicker
table
tr
td
.selected.disabled
:hover
[
disabled
]
.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected
:hover
.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected.disabled.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.selected.disabled
:hover
.active
{
background-color
:
#999999
;
border-color
:
#555555
;
}
.datepicker
table
tr
td
.active
,
.datepicker
table
tr
td
.active
:hover
,
.datepicker
table
tr
td
.active.disabled
,
.datepicker
table
tr
td
.active.disabled
:hover
{
color
:
#ffffff
;
background-color
:
#428bca
;
border-color
:
#357ebd
;
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
:focus
,
.datepicker
table
tr
td
.active
:hover:focus
,
.datepicker
table
tr
td
.active.disabled
:focus
,
.datepicker
table
tr
td
.active.disabled
:hover:focus
,
.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
,
.open
.dropdown-toggle.datepicker
table
tr
td
.active
,
.open
.dropdown-toggle.datepicker
table
tr
td
.active
:hover
,
.open
.dropdown-toggle.datepicker
table
tr
td
.active.disabled
,
.open
.dropdown-toggle.datepicker
table
tr
td
.active.disabled
:hover
{
color
:
#ffffff
;
background-color
:
#3276b1
;
border-color
:
#285e8e
;
}
.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
,
.open
.dropdown-toggle.datepicker
table
tr
td
.active
,
.open
.dropdown-toggle.datepicker
table
tr
td
.active
:hover
,
.open
.dropdown-toggle.datepicker
table
tr
td
.active.disabled
,
.open
.dropdown-toggle.datepicker
table
tr
td
.active.disabled
:hover
{
background-image
:
none
;
}
.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
],
fieldset
[
disabled
]
.datepicker
table
tr
td
.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active.disabled
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active.disabled
:hover
,
.datepicker
table
tr
td
.active.disabled
:hover
,
.datepicker
table
tr
td
.active
:hover
.disabled
:hover
,
.datepicker
table
tr
td
.active.disabled.disabled
:hover
,
.datepicker
table
tr
td
.active.disabled
:hover
.disabled
:hover
,
.datepicker
table
tr
td
.active
[
disabled
]
:hover
,
.datepicker
table
tr
td
.active
:hover
[
disabled
]
:hover
,
.datepicker
table
tr
td
.active.disabled
[
disabled
]
:hover
,
.datepicker
table
tr
td
.active.disabled
:hover
[
disabled
]
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active
:hover:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active.disabled
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active.disabled
:hover:hover
,
.datepicker
table
tr
td
.active.disabled
:focus
,
.datepicker
table
tr
td
.active
:hover
.disabled
:focus
,
.datepicker
table
tr
td
.active.disabled.disabled
:focus
,
.datepicker
table
tr
td
.active.disabled
:hover
.disabled
:focus
,
.datepicker
table
tr
td
.active
[
disabled
]
:focus
,
.datepicker
table
tr
td
.active
:hover
[
disabled
]
:focus
,
.datepicker
table
tr
td
.active.disabled
[
disabled
]
:focus
,
.datepicker
table
tr
td
.active.disabled
:hover
[
disabled
]
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active
:hover:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active.disabled
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active.disabled
:hover:focus
,
.datepicker
table
tr
td
.active.disabled
:active
,
.datepicker
table
tr
td
.active
:hover
.disabled
:active
,
.datepicker
table
tr
td
.active.disabled.disabled
:active
,
.datepicker
table
tr
td
.active.disabled
:hover
.disabled
:active
,
.datepicker
table
tr
td
.active
[
disabled
]
:active
,
.datepicker
table
tr
td
.active
:hover
[
disabled
]
:active
,
.datepicker
table
tr
td
.active.disabled
[
disabled
]
:active
,
.datepicker
table
tr
td
.active.disabled
:hover
[
disabled
]
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active
:hover:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active.disabled
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active.disabled
:hover:active
,
.datepicker
table
tr
td
.active.disabled.active
,
.datepicker
table
tr
td
.active
:hover
.disabled.active
,
.datepicker
table
tr
td
.active.disabled.disabled.active
,
.datepicker
table
tr
td
.active.disabled
:hover
.disabled.active
,
.datepicker
table
tr
td
.active
[
disabled
]
.active
,
.datepicker
table
tr
td
.active
:hover
[
disabled
]
.active
,
.datepicker
table
tr
td
.active.disabled
[
disabled
]
.active
,
.datepicker
table
tr
td
.active.disabled
:hover
[
disabled
]
.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active
:hover
.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active.disabled.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
.active.disabled
:hover
.active
{
background-color
:
#428bca
;
border-color
:
#357ebd
;
}
.datepicker
table
tr
td
span
{
display
:
block
;
width
:
23%
;
height
:
54px
;
line-height
:
54px
;
float
:
left
;
margin
:
1%
;
cursor
:
pointer
;
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
{
color
:
#ffffff
;
background-color
:
#428bca
;
border-color
:
#357ebd
;
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
:focus
,
.datepicker
table
tr
td
span
.active
:hover:focus
,
.datepicker
table
tr
td
span
.active.disabled
:focus
,
.datepicker
table
tr
td
span
.active.disabled
:hover:focus
,
.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
,
.open
.dropdown-toggle.datepicker
table
tr
td
span
.active
,
.open
.dropdown-toggle.datepicker
table
tr
td
span
.active
:hover
,
.open
.dropdown-toggle.datepicker
table
tr
td
span
.active.disabled
,
.open
.dropdown-toggle.datepicker
table
tr
td
span
.active.disabled
:hover
{
color
:
#ffffff
;
background-color
:
#3276b1
;
border-color
:
#285e8e
;
}
.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
,
.open
.dropdown-toggle.datepicker
table
tr
td
span
.active
,
.open
.dropdown-toggle.datepicker
table
tr
td
span
.active
:hover
,
.open
.dropdown-toggle.datepicker
table
tr
td
span
.active.disabled
,
.open
.dropdown-toggle.datepicker
table
tr
td
span
.active.disabled
:hover
{
background-image
:
none
;
}
.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
],
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active.disabled
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active.disabled
:hover
,
.datepicker
table
tr
td
span
.active.disabled
:hover
,
.datepicker
table
tr
td
span
.active
:hover
.disabled
:hover
,
.datepicker
table
tr
td
span
.active.disabled.disabled
:hover
,
.datepicker
table
tr
td
span
.active.disabled
:hover
.disabled
:hover
,
.datepicker
table
tr
td
span
.active
[
disabled
]
:hover
,
.datepicker
table
tr
td
span
.active
:hover
[
disabled
]
:hover
,
.datepicker
table
tr
td
span
.active.disabled
[
disabled
]
:hover
,
.datepicker
table
tr
td
span
.active.disabled
:hover
[
disabled
]
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active
:hover:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active.disabled
:hover
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active.disabled
:hover:hover
,
.datepicker
table
tr
td
span
.active.disabled
:focus
,
.datepicker
table
tr
td
span
.active
:hover
.disabled
:focus
,
.datepicker
table
tr
td
span
.active.disabled.disabled
:focus
,
.datepicker
table
tr
td
span
.active.disabled
:hover
.disabled
:focus
,
.datepicker
table
tr
td
span
.active
[
disabled
]
:focus
,
.datepicker
table
tr
td
span
.active
:hover
[
disabled
]
:focus
,
.datepicker
table
tr
td
span
.active.disabled
[
disabled
]
:focus
,
.datepicker
table
tr
td
span
.active.disabled
:hover
[
disabled
]
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active
:hover:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active.disabled
:focus
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active.disabled
:hover:focus
,
.datepicker
table
tr
td
span
.active.disabled
:active
,
.datepicker
table
tr
td
span
.active
:hover
.disabled
:active
,
.datepicker
table
tr
td
span
.active.disabled.disabled
:active
,
.datepicker
table
tr
td
span
.active.disabled
:hover
.disabled
:active
,
.datepicker
table
tr
td
span
.active
[
disabled
]
:active
,
.datepicker
table
tr
td
span
.active
:hover
[
disabled
]
:active
,
.datepicker
table
tr
td
span
.active.disabled
[
disabled
]
:active
,
.datepicker
table
tr
td
span
.active.disabled
:hover
[
disabled
]
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active
:hover:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active.disabled
:active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active.disabled
:hover:active
,
.datepicker
table
tr
td
span
.active.disabled.active
,
.datepicker
table
tr
td
span
.active
:hover
.disabled.active
,
.datepicker
table
tr
td
span
.active.disabled.disabled.active
,
.datepicker
table
tr
td
span
.active.disabled
:hover
.disabled.active
,
.datepicker
table
tr
td
span
.active
[
disabled
]
.active
,
.datepicker
table
tr
td
span
.active
:hover
[
disabled
]
.active
,
.datepicker
table
tr
td
span
.active.disabled
[
disabled
]
.active
,
.datepicker
table
tr
td
span
.active.disabled
:hover
[
disabled
]
.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active
:hover
.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active.disabled.active
,
fieldset
[
disabled
]
.datepicker
table
tr
td
span
.active.disabled
:hover
.active
{
background-color
:
#428bca
;
border-color
:
#357ebd
;
}
.datepicker
table
tr
td
span
.old
,
.datepicker
table
tr
td
span
.new
{
color
:
#999999
;
}
.datepicker
th
.datepicker-switch
{
width
:
145px
;
}
.datepicker
thead
tr
:first-child
th
,
.datepicker
tfoot
tr
th
{
cursor
:
pointer
;
}
.datepicker
thead
tr
:first-child
th
:hover
,
.datepicker
tfoot
tr
th
:hover
{
background
:
#eeeeee
;
}
.datepicker
.cw
{
font-size
:
10px
;
width
:
12px
;
padding
:
0
2px
0
5px
;
vertical-align
:
middle
;
}
.datepicker
thead
tr
:first-child
th
.cw
{
cursor
:
default
;
background-color
:
transparent
;
}
.input-group.date
.input-group-addon
i
{
cursor
:
pointer
;
width
:
16px
;
height
:
16px
;
}
.input-daterange
input
{
text-align
:
center
;
}
.input-daterange
input
:first-child
{
border-radius
:
3px
0
0
3px
;
}
.input-daterange
input
:last-child
{
border-radius
:
0
3px
3px
0
;
}
.input-daterange
.input-group-addon
{
width
:
auto
;
min-width
:
16px
;
padding
:
4px
5px
;
font-weight
:
normal
;
line-height
:
1.428571429
;
text-align
:
center
;
text-shadow
:
0
1px
0
#fff
;
vertical-align
:
middle
;
background-color
:
#eeeeee
;
border-width
:
1px
0
;
margin-left
:
-5px
;
margin-right
:
-5px
;
}
.datepicker.dropdown-menu
{
position
:
absolute
;
top
:
100%
;
left
:
0
;
z-index
:
1000
;
float
:
left
;
display
:
none
;
min-width
:
160px
;
list-style
:
none
;
background-color
:
#ffffff
;
border
:
1px
solid
#ccc
;
border
:
1px
solid
rgba
(
0
,
0
,
0
,
0.2
);
border-radius
:
5px
;
-webkit-box-shadow
:
0
5px
10px
rgba
(
0
,
0
,
0
,
0.2
);
-moz-box-shadow
:
0
5px
10px
rgba
(
0
,
0
,
0
,
0.2
);
box-shadow
:
0
5px
10px
rgba
(
0
,
0
,
0
,
0.2
);
-webkit-background-clip
:
padding-box
;
-moz-background-clip
:
padding
;
background-clip
:
padding-box
;
*
border-right-width
:
2px
;
*
border-bottom-width
:
2px
;
color
:
#333333
;
font-family
:
"Helvetica Neue"
,
Helvetica
,
Arial
,
sans-serif
;
font-size
:
13px
;
line-height
:
1.428571429
;
}
.datepicker.dropdown-menu
th
,
.datepicker.dropdown-menu
td
{
padding
:
4px
5px
;
}
static/js/cropper/cropper.min.js
0 → 100755
View file @
53e4dc7a
/*!
* Cropper v0.7.6-beta
* https://github.com/fengyuanchen/cropper
*
* Copyright 2014 Fengyuan Chen
* Released under the MIT license
*/
!
function
(
a
){
"function"
==
typeof
define
&&
define
.
amd
?
define
([
"jquery"
],
a
):
a
(
"object"
==
typeof
exports
?
require
(
"jquery"
):
jQuery
)}(
function
(
a
){
"use strict"
;
var
b
=
a
(
window
),
c
=
a
(
document
),
d
=
window
.
location
,
e
=!
0
,
f
=!
1
,
g
=
null
,
h
=
0
/
0
,
i
=
1
/
0
,
j
=
"undefined"
,
k
=
"directive"
,
l
=
".cropper"
,
m
=
/^
(
e|n|w|s|ne|nw|sw|se|all|crop|move|zoom
)
$/
,
n
=
/^
(
x|y|width|height
)
$/
,
o
=
/^
(
naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate
)
$/
,
p
=
"cropper-modal"
,
q
=
"cropper-hidden"
,
r
=
"cropper-invisible"
,
s
=
"cropper-move"
,
t
=
"cropper-crop"
,
u
=
"cropper-disabled"
,
v
=
"mousedown touchstart"
,
w
=
"mousemove touchmove"
,
x
=
"mouseup mouseleave touchend touchleave touchcancel"
,
y
=
"wheel mousewheel DOMMouseScroll"
,
z
=
"resize"
+
l
,
A
=
"dblclick"
,
B
=
"build"
+
l
,
C
=
"built"
+
l
,
D
=
"dragstart"
+
l
,
E
=
"dragmove"
+
l
,
F
=
"dragend"
+
l
,
G
=
function
(
a
){
return
"number"
==
typeof
a
},
H
=
function
(
b
,
c
){
this
.
element
=
b
,
this
.
$element
=
a
(
b
),
this
.
defaults
=
a
.
extend
({},
H
.
DEFAULTS
,
a
.
isPlainObject
(
c
)?
c
:{}),
this
.
$original
=
g
,
this
.
ready
=
f
,
this
.
built
=
f
,
this
.
cropped
=
f
,
this
.
rotated
=
f
,
this
.
disabled
=
f
,
this
.
replaced
=
f
,
this
.
init
()},
I
=
Math
.
round
,
J
=
Math
.
sqrt
,
K
=
Math
.
min
,
L
=
Math
.
max
,
M
=
Math
.
abs
,
N
=
Math
.
sin
,
O
=
Math
.
cos
,
P
=
parseFloat
;
H
.
prototype
=
{
constructor
:
H
,
support
:{
canvas
:
a
.
isFunction
(
a
(
"<canvas>"
)[
0
].
getContext
)},
init
:
function
(){
var
b
=
this
.
defaults
;
a
.
each
(
b
,
function
(
a
,
c
){
switch
(
a
){
case
"aspectRatio"
:
b
[
a
]
=
M
(
P
(
c
))
||
h
;
break
;
case
"autoCropArea"
:
b
[
a
]
=
M
(
P
(
c
))
||
.
8
;
break
;
case
"minWidth"
:
case
"minHeight"
:
b
[
a
]
=
M
(
P
(
c
))
||
0
;
break
;
case
"maxWidth"
:
case
"maxHeight"
:
b
[
a
]
=
M
(
P
(
c
))
||
i
}}),
this
.
image
=
{
rotate
:
0
},
this
.
load
()},
load
:
function
(){
var
b
,
c
,
d
=
this
,
f
=
this
.
$element
,
g
=
this
.
element
,
h
=
this
.
image
,
i
=
""
;
f
.
is
(
"img"
)?
c
=
f
.
prop
(
"src"
):
f
.
is
(
"canvas"
)
&&
this
.
support
.
canvas
&&
(
c
=
g
.
toDataURL
()),
c
&&
(
this
.
replaced
&&
(
h
.
rotate
=
0
),
this
.
defaults
.
checkImageOrigin
&&
(
f
.
prop
(
"crossOrigin"
)
||
this
.
isCrossOriginURL
(
c
))
&&
(
i
=
" crossOrigin"
),
this
.
$clone
=
b
=
a
(
"<img"
+
i
+
' src="'
+
c
+
'">'
),
b
.
one
(
"load"
,
function
(){
h
.
naturalWidth
=
this
.
naturalWidth
||
b
.
width
(),
h
.
naturalHeight
=
this
.
naturalHeight
||
b
.
height
(),
h
.
aspectRatio
=
h
.
naturalWidth
/
h
.
naturalHeight
,
d
.
url
=
c
,
d
.
ready
=
e
,
d
.
build
()}),
b
.
addClass
(
r
).
prependTo
(
"body"
))},
isCrossOriginURL
:
function
(
a
){
var
b
=
a
.
match
(
/^
(
https
?
:
)\/\/([^\:\/\?
#
]
+
)
:
?(\d
*
)
/i
);
return
!
b
||
b
[
1
]
===
d
.
protocol
&&
b
[
2
]
===
d
.
hostname
&&
b
[
3
]
===
d
.
port
?
f
:
e
},
build
:
function
(){
var
b
,
d
,
f
=
this
.
$element
,
g
=
this
.
defaults
;
this
.
ready
&&
(
this
.
built
&&
this
.
unbuild
(),
f
.
one
(
B
,
g
.
build
),
b
=
a
.
Event
(
B
),
f
.
trigger
(
b
),
b
.
isDefaultPrevented
()
||
(
this
.
$cropper
=
d
=
a
(
H
.
TEMPLATE
),
f
.
addClass
(
q
),
this
.
$clone
.
removeClass
(
r
).
prependTo
(
d
),
this
.
rotated
||
(
this
.
$original
=
this
.
$clone
.
clone
(),
this
.
$original
.
addClass
(
q
).
prependTo
(
this
.
$cropper
),
this
.
originalImage
=
a
.
extend
({},
this
.
image
)),
this
.
$container
=
f
.
parent
(),
this
.
$container
.
append
(
d
),
this
.
$canvas
=
d
.
find
(
".cropper-canvas"
),
this
.
$dragger
=
d
.
find
(
".cropper-dragger"
),
this
.
$viewer
=
d
.
find
(
".cropper-viewer"
),
g
.
autoCrop
?
this
.
cropped
=
e
:
this
.
$dragger
.
addClass
(
q
),
g
.
dragCrop
&&
this
.
setDragMode
(
"crop"
),
g
.
modal
&&
this
.
$canvas
.
addClass
(
p
),
!
g
.
dashed
&&
this
.
$dragger
.
find
(
".cropper-dashed"
).
addClass
(
q
),
!
g
.
movable
&&
this
.
$dragger
.
find
(
".cropper-face"
).
data
(
k
,
"move"
),
!
g
.
resizable
&&
this
.
$dragger
.
find
(
".cropper-line, .cropper-point"
).
addClass
(
q
),
this
.
$scope
=
g
.
multiple
?
this
.
$cropper
:
c
,
this
.
addListeners
(),
this
.
initPreview
(),
this
.
built
=
e
,
this
.
update
(),
f
.
one
(
C
,
g
.
built
),
f
.
trigger
(
C
)))},
unbuild
:
function
(){
this
.
built
&&
(
this
.
built
=
f
,
this
.
removeListeners
(),
this
.
$preview
.
empty
(),
this
.
$preview
=
g
,
this
.
$dragger
=
g
,
this
.
$canvas
=
g
,
this
.
$container
=
g
,
this
.
$cropper
.
remove
(),
this
.
$cropper
=
g
)},
update
:
function
(
a
){
this
.
initContainer
(),
this
.
initCropper
(),
this
.
initImage
(),
this
.
initDragger
(),
a
?(
this
.
setData
(
a
,
e
),
this
.
setDragMode
(
"crop"
)):
this
.
setData
(
this
.
defaults
.
data
)},
resize
:
function
(){
clearTimeout
(
this
.
resizing
),
this
.
resizing
=
setTimeout
(
a
.
proxy
(
this
.
update
,
this
,
this
.
getData
()),
200
)},
preview
:
function
(){
var
b
=
this
.
image
,
c
=
this
.
dragger
,
d
=
b
.
width
,
e
=
b
.
height
,
f
=
c
.
left
-
b
.
left
,
g
=
c
.
top
-
b
.
top
;
this
.
$viewer
.
find
(
"img"
).
css
({
width
:
I
(
d
),
height
:
I
(
e
),
marginLeft
:
-
I
(
f
),
marginTop
:
-
I
(
g
)}),
this
.
$preview
.
each
(
function
(){
var
b
=
a
(
this
),
h
=
b
.
width
()
/
c
.
width
;
b
.
find
(
"img"
).
css
({
width
:
I
(
d
*
h
),
height
:
I
(
e
*
h
),
marginLeft
:
-
I
(
f
*
h
),
marginTop
:
-
I
(
g
*
h
)})})},
addListeners
:
function
(){
var
c
=
this
.
defaults
;
this
.
$element
.
on
(
D
,
c
.
dragstart
).
on
(
E
,
c
.
dragmove
).
on
(
F
,
c
.
dragend
),
this
.
$cropper
.
on
(
v
,
this
.
_dragstart
=
a
.
proxy
(
this
.
dragstart
,
this
)).
on
(
A
,
this
.
_dblclick
=
a
.
proxy
(
this
.
dblclick
,
this
)),
c
.
zoomable
&&
this
.
$cropper
.
on
(
y
,
this
.
_wheel
=
a
.
proxy
(
this
.
wheel
,
this
)),
this
.
$scope
.
on
(
w
,
this
.
_dragmove
=
a
.
proxy
(
this
.
dragmove
,
this
)).
on
(
x
,
this
.
_dragend
=
a
.
proxy
(
this
.
dragend
,
this
)),
b
.
on
(
z
,
this
.
_resize
=
a
.
proxy
(
this
.
resize
,
this
))},
removeListeners
:
function
(){
var
a
=
this
.
defaults
;
this
.
$element
.
off
(
D
,
a
.
dragstart
).
off
(
E
,
a
.
dragmove
).
off
(
F
,
a
.
dragend
),
this
.
$cropper
.
off
(
v
,
this
.
_dragstart
).
off
(
A
,
this
.
_dblclick
),
a
.
zoomable
&&
this
.
$cropper
.
off
(
y
,
this
.
_wheel
),
this
.
$scope
.
off
(
w
,
this
.
_dragmove
).
off
(
x
,
this
.
_dragend
),
b
.
off
(
z
,
this
.
_resize
)},
initPreview
:
function
(){
var
b
=
'<img src="'
+
this
.
url
+
'">'
;
this
.
$preview
=
a
(
this
.
defaults
.
preview
),
this
.
$viewer
.
html
(
b
),
this
.
$preview
.
html
(
b
).
find
(
"img"
).
css
(
"cssText"
,
"min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;"
)},
initContainer
:
function
(){
var
a
=
this
.
$container
;
this
.
container
=
{
width
:
L
(
a
.
width
(),
300
),
height
:
L
(
a
.
height
(),
150
)}},
initCropper
:
function
(){
var
a
,
b
=
this
.
container
,
c
=
this
.
image
;
c
.
naturalWidth
*
b
.
height
/
c
.
naturalHeight
-
b
.
width
>=
0
?(
a
=
{
width
:
b
.
width
,
height
:
b
.
width
/
c
.
aspectRatio
,
left
:
0
},
a
.
top
=
(
b
.
height
-
a
.
height
)
/
2
):(
a
=
{
width
:
b
.
height
*
c
.
aspectRatio
,
height
:
b
.
height
,
top
:
0
},
a
.
left
=
(
b
.
width
-
a
.
width
)
/
2
),
this
.
$cropper
.
css
({
width
:
I
(
a
.
width
),
height
:
I
(
a
.
height
),
left
:
I
(
a
.
left
),
top
:
I
(
a
.
top
)}),
this
.
cropper
=
a
},
initImage
:
function
(){
var
b
=
this
.
image
,
c
=
this
.
cropper
,
d
=
{
_width
:
c
.
width
,
_height
:
c
.
height
,
width
:
c
.
width
,
height
:
c
.
height
,
left
:
0
,
top
:
0
,
ratio
:
c
.
width
/
b
.
naturalWidth
};
this
.
defaultImage
=
a
.
extend
({},
b
,
d
),
b
.
_width
!==
c
.
width
||
b
.
_height
!==
c
.
height
?
a
.
extend
(
b
,
d
):(
b
=
a
.
extend
({},
d
,
b
),
this
.
replaced
&&
(
this
.
replaced
=
f
,
b
.
ratio
=
d
.
ratio
)),
this
.
image
=
b
,
this
.
renderImage
()},
renderImage
:
function
(
a
){
var
b
=
this
.
image
;
"zoom"
===
a
&&
(
b
.
left
-=
(
b
.
width
-
b
.
oldWidth
)
/
2
,
b
.
top
-=
(
b
.
height
-
b
.
oldHeight
)
/
2
),
b
.
left
=
K
(
L
(
b
.
left
,
b
.
_width
-
b
.
width
),
0
),
b
.
top
=
K
(
L
(
b
.
top
,
b
.
_height
-
b
.
height
),
0
),
this
.
$clone
.
css
({
width
:
I
(
b
.
width
),
height
:
I
(
b
.
height
),
marginLeft
:
I
(
b
.
left
),
marginTop
:
I
(
b
.
top
)}),
a
&&
(
this
.
defaults
.
done
(
this
.
getData
()),
this
.
preview
())},
initDragger
:
function
(){
var
b
,
c
=
this
.
defaults
,
d
=
this
.
cropper
,
e
=
c
.
aspectRatio
||
this
.
image
.
aspectRatio
,
f
=
this
.
image
.
ratio
;
b
=
d
.
height
*
e
-
d
.
width
>=
0
?{
height
:
d
.
width
/
e
,
width
:
d
.
width
,
left
:
0
,
top
:(
d
.
height
-
d
.
width
/
e
)
/
2
,
maxWidth
:
d
.
width
,
maxHeight
:
d
.
width
/
e
}:{
height
:
d
.
height
,
width
:
d
.
height
*
e
,
left
:(
d
.
width
-
d
.
height
*
e
)
/
2
,
top
:
0
,
maxWidth
:
d
.
height
*
e
,
maxHeight
:
d
.
height
},
b
.
minWidth
=
0
,
b
.
minHeight
=
0
,
c
.
aspectRatio
?(
isFinite
(
c
.
maxWidth
)?(
b
.
maxWidth
=
K
(
b
.
maxWidth
,
c
.
maxWidth
*
f
),
b
.
maxHeight
=
b
.
maxWidth
/
e
):
isFinite
(
c
.
maxHeight
)
&&
(
b
.
maxHeight
=
K
(
b
.
maxHeight
,
c
.
maxHeight
*
f
),
b
.
maxWidth
=
b
.
maxHeight
*
e
),
c
.
minWidth
>
0
?(
b
.
minWidth
=
L
(
0
,
c
.
minWidth
*
f
),
b
.
minHeight
=
b
.
minWidth
/
e
):
c
.
minHeight
>
0
&&
(
b
.
minHeight
=
L
(
0
,
c
.
minHeight
*
f
),
b
.
minWidth
=
b
.
minHeight
*
e
)):(
b
.
maxWidth
=
K
(
b
.
maxWidth
,
c
.
maxWidth
*
f
),
b
.
maxHeight
=
K
(
b
.
maxHeight
,
c
.
maxHeight
*
f
),
b
.
minWidth
=
L
(
0
,
c
.
minWidth
*
f
),
b
.
minHeight
=
L
(
0
,
c
.
minHeight
*
f
)),
b
.
minWidth
=
K
(
b
.
maxWidth
,
b
.
minWidth
),
b
.
minHeight
=
K
(
b
.
maxHeight
,
b
.
minHeight
),
b
.
height
*=
c
.
autoCropArea
,
b
.
width
*=
c
.
autoCropArea
,
b
.
left
=
(
d
.
width
-
b
.
width
)
/
2
,
b
.
top
=
(
d
.
height
-
b
.
height
)
/
2
,
b
.
oldLeft
=
b
.
left
,
b
.
oldTop
=
b
.
top
,
this
.
defaultDragger
=
b
,
this
.
dragger
=
a
.
extend
({},
b
)},
renderDragger
:
function
(){
var
a
=
this
.
dragger
,
b
=
this
.
cropper
;
a
.
width
>
a
.
maxWidth
?(
a
.
width
=
a
.
maxWidth
,
a
.
left
=
a
.
oldLeft
):
a
.
width
<
a
.
minWidth
&&
(
a
.
width
=
a
.
minWidth
,
a
.
left
=
a
.
oldLeft
),
a
.
height
>
a
.
maxHeight
?(
a
.
height
=
a
.
maxHeight
,
a
.
top
=
a
.
oldTop
):
a
.
height
<
a
.
minHeight
&&
(
a
.
height
=
a
.
minHeight
,
a
.
top
=
a
.
oldTop
),
a
.
left
=
K
(
L
(
a
.
left
,
0
),
b
.
width
-
a
.
width
),
a
.
top
=
K
(
L
(
a
.
top
,
0
),
b
.
height
-
a
.
height
),
a
.
oldLeft
=
a
.
left
,
a
.
oldTop
=
a
.
top
,
this
.
dragger
=
a
,
this
.
disabled
||
this
.
defaults
.
done
(
this
.
getData
()),
this
.
$dragger
.
css
({
width
:
I
(
a
.
width
),
height
:
I
(
a
.
height
),
left
:
I
(
a
.
left
),
top
:
I
(
a
.
top
)}),
this
.
preview
()},
reset
:
function
(
b
){
this
.
cropped
&&
(
b
&&
(
this
.
defaults
.
data
=
{}),
this
.
image
=
a
.
extend
({},
this
.
defaultImage
),
this
.
renderImage
(),
this
.
dragger
=
a
.
extend
({},
this
.
defaultDragger
),
this
.
setData
(
this
.
defaults
.
data
))},
clear
:
function
(){
this
.
cropped
&&
(
this
.
cropped
=
f
,
this
.
setData
({
x
:
0
,
y
:
0
,
width
:
0
,
height
:
0
}),
this
.
$canvas
.
removeClass
(
p
),
this
.
$dragger
.
addClass
(
q
))},
destroy
:
function
(){
var
a
=
this
.
$element
;
this
.
ready
&&
(
this
.
unbuild
(),
a
.
removeClass
(
q
).
removeData
(
"cropper"
),
this
.
rotated
&&
a
.
attr
(
"src"
,
this
.
$original
.
attr
(
"src"
)))},
replace
:
function
(
b
,
c
){
var
d
,
g
=
this
,
h
=
this
.
$element
,
i
=
this
.
element
;
b
&&
b
!==
this
.
url
&&
b
!==
h
.
attr
(
"src"
)
&&
(
c
||
(
this
.
rotated
=
f
,
this
.
replaced
=
e
),
h
.
is
(
"img"
)?(
h
.
attr
(
"src"
,
b
),
this
.
load
()):
h
.
is
(
"canvas"
)
&&
this
.
support
.
canvas
&&
(
d
=
i
.
getContext
(
"2d"
),
a
(
'<img src="'
+
b
+
'">'
).
one
(
"load"
,
function
(){
i
.
width
=
this
.
width
,
i
.
height
=
this
.
height
,
d
.
clearRect
(
0
,
0
,
i
.
width
,
i
.
height
),
d
.
drawImage
(
this
,
0
,
0
),
g
.
load
()})))},
setData
:
function
(
b
,
c
){
var
d
=
this
.
cropper
,
e
=
this
.
dragger
,
f
=
this
.
image
,
h
=
this
.
defaults
.
aspectRatio
;
this
.
built
&&
typeof
b
!==
j
&&
((
b
===
g
||
a
.
isEmptyObject
(
b
))
&&
(
e
=
a
.
extend
({},
this
.
defaultDragger
)),
a
.
isPlainObject
(
b
)
&&!
a
.
isEmptyObject
(
b
)
&&
(
c
||
(
this
.
defaults
.
data
=
b
),
b
=
this
.
transformData
(
b
),
G
(
b
.
x
)
&&
b
.
x
<=
d
.
width
-
f
.
left
&&
(
e
.
left
=
b
.
x
+
f
.
left
),
G
(
b
.
y
)
&&
b
.
y
<=
d
.
height
-
f
.
top
&&
(
e
.
top
=
b
.
y
+
f
.
top
),
h
?
G
(
b
.
width
)
&&
b
.
width
<=
e
.
maxWidth
&&
b
.
width
>=
e
.
minWidth
?(
e
.
width
=
b
.
width
,
e
.
height
=
e
.
width
/
h
):
G
(
b
.
height
)
&&
b
.
height
<=
e
.
maxHeight
&&
b
.
height
>=
e
.
minHeight
&&
(
e
.
height
=
b
.
height
,
e
.
width
=
e
.
height
*
h
):(
G
(
b
.
width
)
&&
b
.
width
<=
e
.
maxWidth
&&
b
.
width
>=
e
.
minWidth
&&
(
e
.
width
=
b
.
width
),
G
(
b
.
height
)
&&
b
.
height
<=
e
.
maxHeight
&&
b
.
height
>=
e
.
minHeight
&&
(
e
.
height
=
b
.
height
))),
this
.
dragger
=
e
,
this
.
renderDragger
())},
getData
:
function
(
a
){
var
b
=
this
.
dragger
,
c
=
this
.
image
,
d
=
{};
return
this
.
built
&&
(
d
=
{
x
:
b
.
left
-
c
.
left
,
y
:
b
.
top
-
c
.
top
,
width
:
b
.
width
,
height
:
b
.
height
},
d
=
this
.
transformData
(
d
,
e
,
a
)),
d
},
transformData
:
function
(
b
,
c
,
d
){
var
e
=
this
.
image
.
ratio
,
f
=
{};
return
a
.
each
(
b
,
function
(
a
,
b
){
b
=
P
(
b
),
n
.
test
(
a
)
&&!
isNaN
(
b
)
&&
(
f
[
a
]
=
c
?
d
?
I
(
b
/
e
):
b
/
e
:
b
*
e
)}),
f
},
setAspectRatio
:
function
(
a
){
var
b
=
"auto"
===
a
;
a
=
P
(
a
),(
b
||!
isNaN
(
a
)
&&
a
>
0
)
&&
(
this
.
defaults
.
aspectRatio
=
b
?
h
:
a
,
this
.
built
&&
(
this
.
initDragger
(),
this
.
renderDragger
()))},
getImageData
:
function
(){
var
b
=
{};
return
this
.
ready
&&
a
.
each
(
this
.
image
,
function
(
a
,
c
){
o
.
test
(
a
)
&&
(
b
[
a
]
=
c
)}),
b
},
getDataURL
:
function
(
b
,
c
,
d
){
var
e
,
f
=
a
(
"<canvas>"
)[
0
],
g
=
this
.
getData
(),
h
=
""
;
return
a
.
isPlainObject
(
b
)
||
(
d
=
c
,
c
=
b
,
b
=
{}),
b
=
a
.
extend
({
width
:
g
.
width
,
height
:
g
.
height
},
b
),
this
.
cropped
&&
this
.
support
.
canvas
&&
(
f
.
width
=
b
.
width
,
f
.
height
=
b
.
height
,
e
=
f
.
getContext
(
"2d"
),
"image/jpeg"
===
c
&&
(
e
.
fillStyle
=
"#fff"
,
e
.
fillRect
(
0
,
0
,
b
.
width
,
b
.
height
)),
e
.
drawImage
(
this
.
$clone
[
0
],
g
.
x
,
g
.
y
,
g
.
width
,
g
.
height
,
0
,
0
,
b
.
width
,
b
.
height
),
h
=
f
.
toDataURL
(
c
,
d
)),
h
},
setDragMode
:
function
(
a
){
var
b
=
this
.
$canvas
,
c
=
this
.
defaults
,
d
=
f
,
g
=
f
;
if
(
this
.
built
&&!
this
.
disabled
){
switch
(
a
){
case
"crop"
:
c
.
dragCrop
&&
(
d
=
e
,
b
.
data
(
k
,
a
));
break
;
case
"move"
:
g
=
e
,
b
.
data
(
k
,
a
);
break
;
default
:
b
.
removeData
(
k
)}
b
.
toggleClass
(
t
,
d
).
toggleClass
(
s
,
g
)}},
enable
:
function
(){
this
.
built
&&
(
this
.
disabled
=
f
,
this
.
$cropper
.
removeClass
(
u
))},
disable
:
function
(){
this
.
built
&&
(
this
.
disabled
=
e
,
this
.
$cropper
.
addClass
(
u
))},
rotate
:
function
(
a
){
var
b
=
this
.
image
;
a
=
P
(
a
)
||
0
,
this
.
built
&&
0
!==
a
&&!
this
.
disabled
&&
this
.
defaults
.
rotatable
&&
this
.
support
.
canvas
&&
(
this
.
rotated
=
e
,
a
=
b
.
rotate
=
(
b
.
rotate
+
a
)
%
360
,
this
.
replace
(
this
.
getRotatedDataURL
(
a
),
!
0
))},
getRotatedDataURL
:
function
(
b
){
var
c
=
a
(
"<canvas>"
)[
0
],
d
=
c
.
getContext
(
"2d"
),
e
=
b
*
Math
.
PI
/
180
,
f
=
M
(
b
)
%
180
,
g
=
f
>
90
?
180
-
f
:
f
,
h
=
g
*
Math
.
PI
/
180
,
i
=
this
.
originalImage
,
j
=
i
.
naturalWidth
,
k
=
i
.
naturalHeight
,
l
=
M
(
j
*
O
(
h
)
+
k
*
N
(
h
)),
m
=
M
(
j
*
N
(
h
)
+
k
*
O
(
h
));
return
c
.
width
=
l
,
c
.
height
=
m
,
d
.
save
(),
d
.
translate
(
l
/
2
,
m
/
2
),
d
.
rotate
(
e
),
d
.
drawImage
(
this
.
$original
[
0
],
-
j
/
2
,
-
k
/
2
,
j
,
k
),
d
.
restore
(),
c
.
toDataURL
()},
zoom
:
function
(
a
){
var
b
,
c
,
d
,
e
=
this
.
image
;
a
=
P
(
a
),
this
.
built
&&
a
&&!
this
.
disabled
&&
this
.
defaults
.
zoomable
&&
(
b
=
e
.
width
*
(
1
+
a
),
c
=
e
.
height
*
(
1
+
a
),
d
=
b
/
e
.
_width
,
d
>
10
||
(
1
>
d
&&
(
b
=
e
.
_width
,
c
=
e
.
_height
),
this
.
setDragMode
(
1
>=
d
?
"crop"
:
"move"
),
e
.
oldWidth
=
e
.
width
,
e
.
oldHeight
=
e
.
height
,
e
.
width
=
b
,
e
.
height
=
c
,
e
.
ratio
=
e
.
width
/
e
.
naturalWidth
,
this
.
renderImage
(
"zoom"
)))},
dblclick
:
function
(){
this
.
disabled
||
this
.
setDragMode
(
this
.
$canvas
.
hasClass
(
t
)?
"move"
:
"crop"
)},
wheel
:
function
(
a
){
var
b
,
c
=
a
.
originalEvent
,
d
=
117.25
,
e
=
5
,
f
=
166.66665649414062
,
g
=
.
1
;
this
.
disabled
||
(
a
.
preventDefault
(),
c
.
deltaY
?(
b
=
c
.
deltaY
,
b
=
b
%
e
===
0
?
b
/
e
:
b
%
d
===
0
?
b
/
d
:
b
/
f
):
b
=
c
.
wheelDelta
?
-
c
.
wheelDelta
/
120
:
c
.
detail
?
c
.
detail
/
3
:
0
,
this
.
zoom
(
b
*
g
))},
dragstart
:
function
(
b
){
var
c
,
d
,
g
,
h
=
b
.
originalEvent
.
touches
,
i
=
b
;
if
(
!
this
.
disabled
){
if
(
h
){
if
(
g
=
h
.
length
,
g
>
1
){
if
(
!
this
.
defaults
.
zoomable
||
2
!==
g
)
return
;
i
=
h
[
1
],
this
.
startX2
=
i
.
pageX
,
this
.
startY2
=
i
.
pageY
,
c
=
"zoom"
}
i
=
h
[
0
]}
if
(
c
=
c
||
a
(
i
.
target
).
data
(
k
),
m
.
test
(
c
)){
if
(
b
.
preventDefault
(),
d
=
a
.
Event
(
D
),
this
.
$element
.
trigger
(
d
),
d
.
isDefaultPrevented
())
return
;
this
.
directive
=
c
,
this
.
cropping
=
f
,
this
.
startX
=
i
.
pageX
,
this
.
startY
=
i
.
pageY
,
"crop"
===
c
&&
(
this
.
cropping
=
e
,
this
.
$canvas
.
addClass
(
p
))}}},
dragmove
:
function
(
b
){
var
c
,
d
,
e
=
b
.
originalEvent
.
touches
,
f
=
b
;
if
(
!
this
.
disabled
){
if
(
e
){
if
(
d
=
e
.
length
,
d
>
1
){
if
(
!
this
.
defaults
.
zoomable
||
2
!==
d
)
return
;
f
=
e
[
1
],
this
.
endX2
=
f
.
pageX
,
this
.
endY2
=
f
.
pageY
}
f
=
e
[
0
]}
if
(
this
.
directive
){
if
(
b
.
preventDefault
(),
c
=
a
.
Event
(
E
),
this
.
$element
.
trigger
(
c
),
c
.
isDefaultPrevented
())
return
;
this
.
endX
=
f
.
pageX
,
this
.
endY
=
f
.
pageY
,
this
.
dragging
()}}},
dragend
:
function
(
b
){
var
c
;
if
(
!
this
.
disabled
&&
this
.
directive
){
if
(
b
.
preventDefault
(),
c
=
a
.
Event
(
F
),
this
.
$element
.
trigger
(
c
),
c
.
isDefaultPrevented
())
return
;
this
.
cropping
&&
(
this
.
cropping
=
f
,
this
.
$canvas
.
toggleClass
(
p
,
this
.
cropped
&&
this
.
defaults
.
modal
)),
this
.
directive
=
""
}},
dragging
:
function
(){
var
a
,
b
=
this
.
directive
,
c
=
this
.
image
,
d
=
this
.
cropper
,
g
=
d
.
width
,
h
=
d
.
height
,
i
=
this
.
dragger
,
j
=
i
.
width
,
k
=
i
.
height
,
l
=
i
.
left
,
m
=
i
.
top
,
n
=
l
+
j
,
o
=
m
+
k
,
p
=
e
,
r
=
this
.
defaults
,
s
=
r
.
aspectRatio
,
t
=
{
x
:
this
.
endX
-
this
.
startX
,
y
:
this
.
endY
-
this
.
startY
};
switch
(
s
&&
(
t
.
X
=
t
.
y
*
s
,
t
.
Y
=
t
.
x
/
s
),
b
){
case
"all"
:
l
+=
t
.
x
,
m
+=
t
.
y
;
break
;
case
"e"
:
if
(
t
.
x
>=
0
&&
(
n
>=
g
||
s
&&
(
0
>=
m
||
o
>=
h
))){
p
=
f
;
break
}
j
+=
t
.
x
,
s
&&
(
k
=
j
/
s
,
m
-=
t
.
Y
/
2
),
0
>
j
&&
(
b
=
"w"
,
j
=
0
);
break
;
case
"n"
:
if
(
t
.
y
<=
0
&&
(
0
>=
m
||
s
&&
(
0
>=
l
||
n
>=
g
))){
p
=
f
;
break
}
k
-=
t
.
y
,
m
+=
t
.
y
,
s
&&
(
j
=
k
*
s
,
l
+=
t
.
X
/
2
),
0
>
k
&&
(
b
=
"s"
,
k
=
0
);
break
;
case
"w"
:
if
(
t
.
x
<=
0
&&
(
0
>=
l
||
s
&&
(
0
>=
m
||
o
>=
h
))){
p
=
f
;
break
}
j
-=
t
.
x
,
l
+=
t
.
x
,
s
&&
(
k
=
j
/
s
,
m
+=
t
.
Y
/
2
),
0
>
j
&&
(
b
=
"e"
,
j
=
0
);
break
;
case
"s"
:
if
(
t
.
y
>=
0
&&
(
o
>=
h
||
s
&&
(
0
>=
l
||
n
>=
g
))){
p
=
f
;
break
}
k
+=
t
.
y
,
s
&&
(
j
=
k
*
s
,
l
-=
t
.
X
/
2
),
0
>
k
&&
(
b
=
"n"
,
k
=
0
);
break
;
case
"ne"
:
if
(
s
){
if
(
t
.
y
<=
0
&&
(
0
>=
m
||
n
>=
g
)){
p
=
f
;
break
}
k
-=
t
.
y
,
m
+=
t
.
y
,
j
=
k
*
s
}
else
t
.
x
>=
0
?
g
>
n
?
j
+=
t
.
x
:
t
.
y
<=
0
&&
0
>=
m
&&
(
p
=
f
):
j
+=
t
.
x
,
t
.
y
<=
0
?
m
>
0
&&
(
k
-=
t
.
y
,
m
+=
t
.
y
):(
k
-=
t
.
y
,
m
+=
t
.
y
);
0
>
k
&&
(
b
=
"sw"
,
k
=
0
,
j
=
0
);
break
;
case
"nw"
:
if
(
s
){
if
(
t
.
y
<=
0
&&
(
0
>=
m
||
0
>=
l
)){
p
=
f
;
break
}
k
-=
t
.
y
,
m
+=
t
.
y
,
j
=
k
*
s
,
l
+=
t
.
X
}
else
t
.
x
<=
0
?
l
>
0
?(
j
-=
t
.
x
,
l
+=
t
.
x
):
t
.
y
<=
0
&&
0
>=
m
&&
(
p
=
f
):(
j
-=
t
.
x
,
l
+=
t
.
x
),
t
.
y
<=
0
?
m
>
0
&&
(
k
-=
t
.
y
,
m
+=
t
.
y
):(
k
-=
t
.
y
,
m
+=
t
.
y
);
0
>
k
&&
(
b
=
"se"
,
k
=
0
,
j
=
0
);
break
;
case
"sw"
:
if
(
s
){
if
(
t
.
x
<=
0
&&
(
0
>=
l
||
o
>=
h
)){
p
=
f
;
break
}
j
-=
t
.
x
,
l
+=
t
.
x
,
k
=
j
/
s
}
else
t
.
x
<=
0
?
l
>
0
?(
j
-=
t
.
x
,
l
+=
t
.
x
):
t
.
y
>=
0
&&
o
>=
h
&&
(
p
=
f
):(
j
-=
t
.
x
,
l
+=
t
.
x
),
t
.
y
>=
0
?
h
>
o
&&
(
k
+=
t
.
y
):
k
+=
t
.
y
;
0
>
j
&&
(
b
=
"ne"
,
k
=
0
,
j
=
0
);
break
;
case
"se"
:
if
(
s
){
if
(
t
.
x
>=
0
&&
(
n
>=
g
||
o
>=
h
)){
p
=
f
;
break
}
j
+=
t
.
x
,
k
=
j
/
s
}
else
t
.
x
>=
0
?
g
>
n
?
j
+=
t
.
x
:
t
.
y
>=
0
&&
o
>=
h
&&
(
p
=
f
):
j
+=
t
.
x
,
t
.
y
>=
0
?
h
>
o
&&
(
k
+=
t
.
y
):
k
+=
t
.
y
;
0
>
j
&&
(
b
=
"nw"
,
k
=
0
,
j
=
0
);
break
;
case
"move"
:
c
.
left
+=
t
.
x
,
c
.
top
+=
t
.
y
,
this
.
renderImage
(
"move"
),
p
=
f
;
break
;
case
"zoom"
:
r
.
zoomable
&&
(
this
.
zoom
(
function
(
a
,
b
,
c
,
d
,
e
,
f
){
return
(
J
(
e
*
e
+
f
*
f
)
-
J
(
c
*
c
+
d
*
d
))
/
J
(
a
*
a
+
b
*
b
)}(
c
.
width
,
c
.
height
,
M
(
this
.
startX
-
this
.
startX2
),
M
(
this
.
startY
-
this
.
startY2
),
M
(
this
.
endX
-
this
.
endX2
),
M
(
this
.
endY
-
this
.
endY2
))),
this
.
endX2
=
this
.
startX2
,
this
.
endY2
=
this
.
startY2
);
break
;
case
"crop"
:
t
.
x
&&
t
.
y
&&
(
a
=
this
.
$cropper
.
offset
(),
l
=
this
.
startX
-
a
.
left
,
m
=
this
.
startY
-
a
.
top
,
j
=
i
.
minWidth
,
k
=
i
.
minHeight
,
t
.
x
>
0
?
t
.
y
>
0
?
b
=
"se"
:(
b
=
"ne"
,
m
-=
k
):
t
.
y
>
0
?(
b
=
"sw"
,
l
-=
j
):(
b
=
"nw"
,
l
-=
j
,
m
-=
k
),
this
.
cropped
||
(
this
.
cropped
=
e
,
this
.
$dragger
.
removeClass
(
q
)))}
p
&&
(
i
.
width
=
j
,
i
.
height
=
k
,
i
.
left
=
l
,
i
.
top
=
m
,
this
.
directive
=
b
,
this
.
renderDragger
()),
this
.
startX
=
this
.
endX
,
this
.
startY
=
this
.
endY
}},
H
.
TEMPLATE
=
function
(
a
,
b
){
return
b
=
b
.
split
(
","
),
a
.
replace
(
/
\d
+/g
,
function
(
a
){
return
b
[
a
]})}(
'<0 6="5-container"><0 6="5-canvas"></0><0 6="5-dragger"><1 6="5-viewer"></1><1 6="5-8 8-h"></1><1 6="5-8 8-v"></1><1 6="5-face" 3-2="all"></1><1 6="5-7 7-e" 3-2="e"></1><1 6="5-7 7-n" 3-2="n"></1><1 6="5-7 7-w" 3-2="w"></1><1 6="5-7 7-s" 3-2="s"></1><1 6="5-4 4-e" 3-2="e"></1><1 6="5-4 4-n" 3-2="n"></1><1 6="5-4 4-w" 3-2="w"></1><1 6="5-4 4-s" 3-2="s"></1><1 6="5-4 4-ne" 3-2="ne"></1><1 6="5-4 4-nw" 3-2="nw"></1><1 6="5-4 4-sw" 3-2="sw"></1><1 6="5-4 4-se" 3-2="se"></1></0></0>'
,
"div,span,directive,data,point,cropper,class,line,dashed"
),
H
.
DEFAULTS
=
{
aspectRatio
:
"auto"
,
autoCropArea
:.
8
,
data
:{},
done
:
a
.
noop
,
preview
:
""
,
multiple
:
f
,
autoCrop
:
e
,
dragCrop
:
e
,
dashed
:
e
,
modal
:
e
,
movable
:
e
,
resizable
:
e
,
zoomable
:
e
,
rotatable
:
e
,
checkImageOrigin
:
e
,
minWidth
:
0
,
minHeight
:
0
,
maxWidth
:
i
,
maxHeight
:
i
,
build
:
g
,
built
:
g
,
dragstart
:
g
,
dragmove
:
g
,
dragend
:
g
},
H
.
setDefaults
=
function
(
b
){
a
.
extend
(
H
.
DEFAULTS
,
b
)},
H
.
other
=
a
.
fn
.
cropper
,
a
.
fn
.
cropper
=
function
(
b
){
var
c
,
d
=
[].
slice
.
call
(
arguments
,
1
);
return
this
.
each
(
function
(){
var
e
,
f
=
a
(
this
),
g
=
f
.
data
(
"cropper"
);
g
||
f
.
data
(
"cropper"
,
g
=
new
H
(
this
,
b
)),
"string"
==
typeof
b
&&
a
.
isFunction
(
e
=
g
[
b
])
&&
(
c
=
e
.
apply
(
g
,
d
))}),
typeof
c
!==
j
?
c
:
this
},
a
.
fn
.
cropper
.
Constructor
=
H
,
a
.
fn
.
cropper
.
setDefaults
=
H
.
setDefaults
,
a
.
fn
.
cropper
.
noConflict
=
function
(){
return
a
.
fn
.
cropper
=
H
.
other
,
this
}});
\ No newline at end of file
static/js/datapicker/bootstrap-datepicker.js
0 → 100755
View file @
53e4dc7a
/* =========================================================
* bootstrap-datepicker.js
* Repo: https://github.com/eternicode/bootstrap-datepicker/
* Demo: http://eternicode.github.io/bootstrap-datepicker/
* Docs: http://bootstrap-datepicker.readthedocs.org/
* Forked from http://www.eyecon.ro/bootstrap-datepicker
* =========================================================
* Started by Stefan Petre; improvements by Andrew Rowls + contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */
(
function
(
$
,
undefined
){
var
$window
=
$
(
window
);
function
UTCDate
(){
return
new
Date
(
Date
.
UTC
.
apply
(
Date
,
arguments
));
}
function
UTCToday
(){
var
today
=
new
Date
();
return
UTCDate
(
today
.
getFullYear
(),
today
.
getMonth
(),
today
.
getDate
());
}
function
alias
(
method
){
return
function
(){
return
this
[
method
].
apply
(
this
,
arguments
);
};
}
var
DateArray
=
(
function
(){
var
extras
=
{
get
:
function
(
i
){
return
this
.
slice
(
i
)[
0
];
},
contains
:
function
(
d
){
// Array.indexOf is not cross-browser;
// $.inArray doesn't work with Dates
var
val
=
d
&&
d
.
valueOf
();
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
if
(
this
[
i
].
valueOf
()
===
val
)
return
i
;
return
-
1
;
},
remove
:
function
(
i
){
this
.
splice
(
i
,
1
);
},
replace
:
function
(
new_array
){
if
(
!
new_array
)
return
;
if
(
!
$
.
isArray
(
new_array
))
new_array
=
[
new_array
];
this
.
clear
();
this
.
push
.
apply
(
this
,
new_array
);
},
clear
:
function
(){
this
.
splice
(
0
);
},
copy
:
function
(){
var
a
=
new
DateArray
();
a
.
replace
(
this
);
return
a
;
}
};
return
function
(){
var
a
=
[];
a
.
push
.
apply
(
a
,
arguments
);
$
.
extend
(
a
,
extras
);
return
a
;
};
})();
// Picker object
var
Datepicker
=
function
(
element
,
options
){
this
.
dates
=
new
DateArray
();
this
.
viewDate
=
UTCToday
();
this
.
focusDate
=
null
;
this
.
_process_options
(
options
);
this
.
element
=
$
(
element
);
this
.
isInline
=
false
;
this
.
isInput
=
this
.
element
.
is
(
'input'
);
this
.
component
=
this
.
element
.
is
(
'.date'
)
?
this
.
element
.
find
(
'.add-on, .input-group-addon, .btn'
)
:
false
;
this
.
hasInput
=
this
.
component
&&
this
.
element
.
find
(
'input'
).
length
;
if
(
this
.
component
&&
this
.
component
.
length
===
0
)
this
.
component
=
false
;
this
.
picker
=
$
(
DPGlobal
.
template
);
this
.
_buildEvents
();
this
.
_attachEvents
();
if
(
this
.
isInline
){
this
.
picker
.
addClass
(
'datepicker-inline'
).
appendTo
(
this
.
element
);
}
else
{
this
.
picker
.
addClass
(
'datepicker-dropdown dropdown-menu'
);
}
if
(
this
.
o
.
rtl
){
this
.
picker
.
addClass
(
'datepicker-rtl'
);
}
this
.
viewMode
=
this
.
o
.
startView
;
if
(
this
.
o
.
calendarWeeks
)
this
.
picker
.
find
(
'tfoot th.today'
)
.
attr
(
'colspan'
,
function
(
i
,
val
){
return
parseInt
(
val
)
+
1
;
});
this
.
_allow_update
=
false
;
this
.
setStartDate
(
this
.
_o
.
startDate
);
this
.
setEndDate
(
this
.
_o
.
endDate
);
this
.
setDaysOfWeekDisabled
(
this
.
o
.
daysOfWeekDisabled
);
this
.
fillDow
();
this
.
fillMonths
();
this
.
_allow_update
=
true
;
this
.
update
();
this
.
showMode
();
if
(
this
.
isInline
){
this
.
show
();
}
};
Datepicker
.
prototype
=
{
constructor
:
Datepicker
,
_process_options
:
function
(
opts
){
// Store raw options for reference
this
.
_o
=
$
.
extend
({},
this
.
_o
,
opts
);
// Processed options
var
o
=
this
.
o
=
$
.
extend
({},
this
.
_o
);
// Check if "de-DE" style date is available, if not language should
// fallback to 2 letter code eg "de"
var
lang
=
o
.
language
;
if
(
!
dates
[
lang
]){
lang
=
lang
.
split
(
'-'
)[
0
];
if
(
!
dates
[
lang
])
lang
=
defaults
.
language
;
}
o
.
language
=
lang
;
switch
(
o
.
startView
){
case
2
:
case
'decade'
:
o
.
startView
=
2
;
break
;
case
1
:
case
'year'
:
o
.
startView
=
1
;
break
;
default
:
o
.
startView
=
0
;
}
switch
(
o
.
minViewMode
){
case
1
:
case
'months'
:
o
.
minViewMode
=
1
;
break
;
case
2
:
case
'years'
:
o
.
minViewMode
=
2
;
break
;
default
:
o
.
minViewMode
=
0
;
}
o
.
startView
=
Math
.
max
(
o
.
startView
,
o
.
minViewMode
);
// true, false, or Number > 0
if
(
o
.
multidate
!==
true
){
o
.
multidate
=
Number
(
o
.
multidate
)
||
false
;
if
(
o
.
multidate
!==
false
)
o
.
multidate
=
Math
.
max
(
0
,
o
.
multidate
);
else
o
.
multidate
=
1
;
}
o
.
multidateSeparator
=
String
(
o
.
multidateSeparator
);
o
.
weekStart
%=
7
;
o
.
weekEnd
=
((
o
.
weekStart
+
6
)
%
7
);
var
format
=
DPGlobal
.
parseFormat
(
o
.
format
);
if
(
o
.
startDate
!==
-
Infinity
){
if
(
!!
o
.
startDate
){
if
(
o
.
startDate
instanceof
Date
)
o
.
startDate
=
this
.
_local_to_utc
(
this
.
_zero_time
(
o
.
startDate
));
else
o
.
startDate
=
DPGlobal
.
parseDate
(
o
.
startDate
,
format
,
o
.
language
);
}
else
{
o
.
startDate
=
-
Infinity
;
}
}
if
(
o
.
endDate
!==
Infinity
){
if
(
!!
o
.
endDate
){
if
(
o
.
endDate
instanceof
Date
)
o
.
endDate
=
this
.
_local_to_utc
(
this
.
_zero_time
(
o
.
endDate
));
else
o
.
endDate
=
DPGlobal
.
parseDate
(
o
.
endDate
,
format
,
o
.
language
);
}
else
{
o
.
endDate
=
Infinity
;
}
}
o
.
daysOfWeekDisabled
=
o
.
daysOfWeekDisabled
||
[];
if
(
!
$
.
isArray
(
o
.
daysOfWeekDisabled
))
o
.
daysOfWeekDisabled
=
o
.
daysOfWeekDisabled
.
split
(
/
[
,
\s]
*/
);
o
.
daysOfWeekDisabled
=
$
.
map
(
o
.
daysOfWeekDisabled
,
function
(
d
){
return
parseInt
(
d
,
10
);
});
var
plc
=
String
(
o
.
orientation
).
toLowerCase
().
split
(
/
\s
+/g
),
_plc
=
o
.
orientation
.
toLowerCase
();
plc
=
$
.
grep
(
plc
,
function
(
word
){
return
(
/^auto|left|right|top|bottom$/
).
test
(
word
);
});
o
.
orientation
=
{
x
:
'auto'
,
y
:
'auto'
};
if
(
!
_plc
||
_plc
===
'auto'
)
;
// no action
else
if
(
plc
.
length
===
1
){
switch
(
plc
[
0
]){
case
'top'
:
case
'bottom'
:
o
.
orientation
.
y
=
plc
[
0
];
break
;
case
'left'
:
case
'right'
:
o
.
orientation
.
x
=
plc
[
0
];
break
;
}
}
else
{
_plc
=
$
.
grep
(
plc
,
function
(
word
){
return
(
/^left|right$/
).
test
(
word
);
});
o
.
orientation
.
x
=
_plc
[
0
]
||
'auto'
;
_plc
=
$
.
grep
(
plc
,
function
(
word
){
return
(
/^top|bottom$/
).
test
(
word
);
});
o
.
orientation
.
y
=
_plc
[
0
]
||
'auto'
;
}
},
_events
:
[],
_secondaryEvents
:
[],
_applyEvents
:
function
(
evs
){
for
(
var
i
=
0
,
el
,
ch
,
ev
;
i
<
evs
.
length
;
i
++
){
el
=
evs
[
i
][
0
];
if
(
evs
[
i
].
length
===
2
){
ch
=
undefined
;
ev
=
evs
[
i
][
1
];
}
else
if
(
evs
[
i
].
length
===
3
){
ch
=
evs
[
i
][
1
];
ev
=
evs
[
i
][
2
];
}
el
.
on
(
ev
,
ch
);
}
},
_unapplyEvents
:
function
(
evs
){
for
(
var
i
=
0
,
el
,
ev
,
ch
;
i
<
evs
.
length
;
i
++
){
el
=
evs
[
i
][
0
];
if
(
evs
[
i
].
length
===
2
){
ch
=
undefined
;
ev
=
evs
[
i
][
1
];
}
else
if
(
evs
[
i
].
length
===
3
){
ch
=
evs
[
i
][
1
];
ev
=
evs
[
i
][
2
];
}
el
.
off
(
ev
,
ch
);
}
},
_buildEvents
:
function
(){
if
(
this
.
isInput
){
// single input
this
.
_events
=
[
[
this
.
element
,
{
focus
:
$
.
proxy
(
this
.
show
,
this
),
keyup
:
$
.
proxy
(
function
(
e
){
if
(
$
.
inArray
(
e
.
keyCode
,
[
27
,
37
,
39
,
38
,
40
,
32
,
13
,
9
])
===
-
1
)
this
.
update
();
},
this
),
keydown
:
$
.
proxy
(
this
.
keydown
,
this
)
}]
];
}
else
if
(
this
.
component
&&
this
.
hasInput
){
// component: input + button
this
.
_events
=
[
// For components that are not readonly, allow keyboard nav
[
this
.
element
.
find
(
'input'
),
{
focus
:
$
.
proxy
(
this
.
show
,
this
),
keyup
:
$
.
proxy
(
function
(
e
){
if
(
$
.
inArray
(
e
.
keyCode
,
[
27
,
37
,
39
,
38
,
40
,
32
,
13
,
9
])
===
-
1
)
this
.
update
();
},
this
),
keydown
:
$
.
proxy
(
this
.
keydown
,
this
)
}],
[
this
.
component
,
{
click
:
$
.
proxy
(
this
.
show
,
this
)
}]
];
}
else
if
(
this
.
element
.
is
(
'div'
)){
// inline datepicker
this
.
isInline
=
true
;
}
else
{
this
.
_events
=
[
[
this
.
element
,
{
click
:
$
.
proxy
(
this
.
show
,
this
)
}]
];
}
this
.
_events
.
push
(
// Component: listen for blur on element descendants
[
this
.
element
,
'*'
,
{
blur
:
$
.
proxy
(
function
(
e
){
this
.
_focused_from
=
e
.
target
;
},
this
)
}],
// Input: listen for blur on element
[
this
.
element
,
{
blur
:
$
.
proxy
(
function
(
e
){
this
.
_focused_from
=
e
.
target
;
},
this
)
}]
);
this
.
_secondaryEvents
=
[
[
this
.
picker
,
{
click
:
$
.
proxy
(
this
.
click
,
this
)
}],
[
$
(
window
),
{
resize
:
$
.
proxy
(
this
.
place
,
this
)
}],
[
$
(
document
),
{
'mousedown touchstart'
:
$
.
proxy
(
function
(
e
){
// Clicked outside the datepicker, hide it
if
(
!
(
this
.
element
.
is
(
e
.
target
)
||
this
.
element
.
find
(
e
.
target
).
length
||
this
.
picker
.
is
(
e
.
target
)
||
this
.
picker
.
find
(
e
.
target
).
length
)){
this
.
hide
();
}
},
this
)
}]
];
},
_attachEvents
:
function
(){
this
.
_detachEvents
();
this
.
_applyEvents
(
this
.
_events
);
},
_detachEvents
:
function
(){
this
.
_unapplyEvents
(
this
.
_events
);
},
_attachSecondaryEvents
:
function
(){
this
.
_detachSecondaryEvents
();
this
.
_applyEvents
(
this
.
_secondaryEvents
);
},
_detachSecondaryEvents
:
function
(){
this
.
_unapplyEvents
(
this
.
_secondaryEvents
);
},
_trigger
:
function
(
event
,
altdate
){
var
date
=
altdate
||
this
.
dates
.
get
(
-
1
),
local_date
=
this
.
_utc_to_local
(
date
);
this
.
element
.
trigger
({
type
:
event
,
date
:
local_date
,
dates
:
$
.
map
(
this
.
dates
,
this
.
_utc_to_local
),
format
:
$
.
proxy
(
function
(
ix
,
format
){
if
(
arguments
.
length
===
0
){
ix
=
this
.
dates
.
length
-
1
;
format
=
this
.
o
.
format
;
}
else
if
(
typeof
ix
===
'string'
){
format
=
ix
;
ix
=
this
.
dates
.
length
-
1
;
}
format
=
format
||
this
.
o
.
format
;
var
date
=
this
.
dates
.
get
(
ix
);
return
DPGlobal
.
formatDate
(
date
,
format
,
this
.
o
.
language
);
},
this
)
});
},
show
:
function
(){
if
(
!
this
.
isInline
)
this
.
picker
.
appendTo
(
'body'
);
this
.
picker
.
show
();
this
.
place
();
this
.
_attachSecondaryEvents
();
this
.
_trigger
(
'show'
);
},
hide
:
function
(){
if
(
this
.
isInline
)
return
;
if
(
!
this
.
picker
.
is
(
':visible'
))
return
;
this
.
focusDate
=
null
;
this
.
picker
.
hide
().
detach
();
this
.
_detachSecondaryEvents
();
this
.
viewMode
=
this
.
o
.
startView
;
this
.
showMode
();
if
(
this
.
o
.
forceParse
&&
(
this
.
isInput
&&
this
.
element
.
val
()
||
this
.
hasInput
&&
this
.
element
.
find
(
'input'
).
val
()
)
)
this
.
setValue
();
this
.
_trigger
(
'hide'
);
},
remove
:
function
(){
this
.
hide
();
this
.
_detachEvents
();
this
.
_detachSecondaryEvents
();
this
.
picker
.
remove
();
delete
this
.
element
.
data
().
datepicker
;
if
(
!
this
.
isInput
){
delete
this
.
element
.
data
().
date
;
}
},
_utc_to_local
:
function
(
utc
){
return
utc
&&
new
Date
(
utc
.
getTime
()
+
(
utc
.
getTimezoneOffset
()
*
60000
));
},
_local_to_utc
:
function
(
local
){
return
local
&&
new
Date
(
local
.
getTime
()
-
(
local
.
getTimezoneOffset
()
*
60000
));
},
_zero_time
:
function
(
local
){
return
local
&&
new
Date
(
local
.
getFullYear
(),
local
.
getMonth
(),
local
.
getDate
());
},
_zero_utc_time
:
function
(
utc
){
return
utc
&&
new
Date
(
Date
.
UTC
(
utc
.
getUTCFullYear
(),
utc
.
getUTCMonth
(),
utc
.
getUTCDate
()));
},
getDates
:
function
(){
return
$
.
map
(
this
.
dates
,
this
.
_utc_to_local
);
},
getUTCDates
:
function
(){
return
$
.
map
(
this
.
dates
,
function
(
d
){
return
new
Date
(
d
);
});
},
getDate
:
function
(){
return
this
.
_utc_to_local
(
this
.
getUTCDate
());
},
getUTCDate
:
function
(){
return
new
Date
(
this
.
dates
.
get
(
-
1
));
},
setDates
:
function
(){
var
args
=
$
.
isArray
(
arguments
[
0
])
?
arguments
[
0
]
:
arguments
;
this
.
update
.
apply
(
this
,
args
);
this
.
_trigger
(
'changeDate'
);
this
.
setValue
();
},
setUTCDates
:
function
(){
var
args
=
$
.
isArray
(
arguments
[
0
])
?
arguments
[
0
]
:
arguments
;
this
.
update
.
apply
(
this
,
$
.
map
(
args
,
this
.
_utc_to_local
));
this
.
_trigger
(
'changeDate'
);
this
.
setValue
();
},
setDate
:
alias
(
'setDates'
),
setUTCDate
:
alias
(
'setUTCDates'
),
setValue
:
function
(){
var
formatted
=
this
.
getFormattedDate
();
if
(
!
this
.
isInput
){
if
(
this
.
component
){
this
.
element
.
find
(
'input'
).
val
(
formatted
).
change
();
}
}
else
{
this
.
element
.
val
(
formatted
).
change
();
}
},
getFormattedDate
:
function
(
format
){
if
(
format
===
undefined
)
format
=
this
.
o
.
format
;
var
lang
=
this
.
o
.
language
;
return
$
.
map
(
this
.
dates
,
function
(
d
){
return
DPGlobal
.
formatDate
(
d
,
format
,
lang
);
}).
join
(
this
.
o
.
multidateSeparator
);
},
setStartDate
:
function
(
startDate
){
this
.
_process_options
({
startDate
:
startDate
});
this
.
update
();
this
.
updateNavArrows
();
},
setEndDate
:
function
(
endDate
){
this
.
_process_options
({
endDate
:
endDate
});
this
.
update
();
this
.
updateNavArrows
();
},
setDaysOfWeekDisabled
:
function
(
daysOfWeekDisabled
){
this
.
_process_options
({
daysOfWeekDisabled
:
daysOfWeekDisabled
});
this
.
update
();
this
.
updateNavArrows
();
},
place
:
function
(){
if
(
this
.
isInline
)
return
;
var
calendarWidth
=
this
.
picker
.
outerWidth
(),
calendarHeight
=
this
.
picker
.
outerHeight
(),
visualPadding
=
10
,
windowWidth
=
$window
.
width
(),
windowHeight
=
$window
.
height
(),
scrollTop
=
$window
.
scrollTop
();
var
zIndex
=
parseInt
(
this
.
element
.
parents
().
filter
(
function
(){
return
$
(
this
).
css
(
'z-index'
)
!==
'auto'
;
}).
first
().
css
(
'z-index'
))
+
10
;
var
offset
=
this
.
component
?
this
.
component
.
parent
().
offset
()
:
this
.
element
.
offset
();
var
height
=
this
.
component
?
this
.
component
.
outerHeight
(
true
)
:
this
.
element
.
outerHeight
(
false
);
var
width
=
this
.
component
?
this
.
component
.
outerWidth
(
true
)
:
this
.
element
.
outerWidth
(
false
);
var
left
=
offset
.
left
,
top
=
offset
.
top
;
this
.
picker
.
removeClass
(
'datepicker-orient-top datepicker-orient-bottom '
+
'datepicker-orient-right datepicker-orient-left'
);
if
(
this
.
o
.
orientation
.
x
!==
'auto'
){
this
.
picker
.
addClass
(
'datepicker-orient-'
+
this
.
o
.
orientation
.
x
);
if
(
this
.
o
.
orientation
.
x
===
'right'
)
left
-=
calendarWidth
-
width
;
}
// auto x orientation is best-placement: if it crosses a window
// edge, fudge it sideways
else
{
// Default to left
this
.
picker
.
addClass
(
'datepicker-orient-left'
);
if
(
offset
.
left
<
0
)
left
-=
offset
.
left
-
visualPadding
;
else
if
(
offset
.
left
+
calendarWidth
>
windowWidth
)
left
=
windowWidth
-
calendarWidth
-
visualPadding
;
}
// auto y orientation is best-situation: top or bottom, no fudging,
// decision based on which shows more of the calendar
var
yorient
=
this
.
o
.
orientation
.
y
,
top_overflow
,
bottom_overflow
;
if
(
yorient
===
'auto'
){
top_overflow
=
-
scrollTop
+
offset
.
top
-
calendarHeight
;
bottom_overflow
=
scrollTop
+
windowHeight
-
(
offset
.
top
+
height
+
calendarHeight
);
if
(
Math
.
max
(
top_overflow
,
bottom_overflow
)
===
bottom_overflow
)
yorient
=
'top'
;
else
yorient
=
'bottom'
;
}
this
.
picker
.
addClass
(
'datepicker-orient-'
+
yorient
);
if
(
yorient
===
'top'
)
top
+=
height
;
else
top
-=
calendarHeight
+
parseInt
(
this
.
picker
.
css
(
'padding-top'
));
this
.
picker
.
css
({
top
:
top
,
left
:
left
,
zIndex
:
zIndex
});
},
_allow_update
:
true
,
update
:
function
(){
if
(
!
this
.
_allow_update
)
return
;
var
oldDates
=
this
.
dates
.
copy
(),
dates
=
[],
fromArgs
=
false
;
if
(
arguments
.
length
){
$
.
each
(
arguments
,
$
.
proxy
(
function
(
i
,
date
){
if
(
date
instanceof
Date
)
date
=
this
.
_local_to_utc
(
date
);
dates
.
push
(
date
);
},
this
));
fromArgs
=
true
;
}
else
{
dates
=
this
.
isInput
?
this
.
element
.
val
()
:
this
.
element
.
data
(
'date'
)
||
this
.
element
.
find
(
'input'
).
val
();
if
(
dates
&&
this
.
o
.
multidate
)
dates
=
dates
.
split
(
this
.
o
.
multidateSeparator
);
else
dates
=
[
dates
];
delete
this
.
element
.
data
().
date
;
}
dates
=
$
.
map
(
dates
,
$
.
proxy
(
function
(
date
){
return
DPGlobal
.
parseDate
(
date
,
this
.
o
.
format
,
this
.
o
.
language
);
},
this
));
dates
=
$
.
grep
(
dates
,
$
.
proxy
(
function
(
date
){
return
(
date
<
this
.
o
.
startDate
||
date
>
this
.
o
.
endDate
||
!
date
);
},
this
),
true
);
this
.
dates
.
replace
(
dates
);
if
(
this
.
dates
.
length
)
this
.
viewDate
=
new
Date
(
this
.
dates
.
get
(
-
1
));
else
if
(
this
.
viewDate
<
this
.
o
.
startDate
)
this
.
viewDate
=
new
Date
(
this
.
o
.
startDate
);
else
if
(
this
.
viewDate
>
this
.
o
.
endDate
)
this
.
viewDate
=
new
Date
(
this
.
o
.
endDate
);
if
(
fromArgs
){
// setting date by clicking
this
.
setValue
();
}
else
if
(
dates
.
length
){
// setting date by typing
if
(
String
(
oldDates
)
!==
String
(
this
.
dates
))
this
.
_trigger
(
'changeDate'
);
}
if
(
!
this
.
dates
.
length
&&
oldDates
.
length
)
this
.
_trigger
(
'clearDate'
);
this
.
fill
();
},
fillDow
:
function
(){
var
dowCnt
=
this
.
o
.
weekStart
,
html
=
'<tr>'
;
if
(
this
.
o
.
calendarWeeks
){
var
cell
=
'<th class="cw"> </th>'
;
html
+=
cell
;
this
.
picker
.
find
(
'.datepicker-days thead tr:first-child'
).
prepend
(
cell
);
}
while
(
dowCnt
<
this
.
o
.
weekStart
+
7
){
html
+=
'<th class="dow">'
+
dates
[
this
.
o
.
language
].
daysMin
[(
dowCnt
++
)
%
7
]
+
'</th>'
;
}
html
+=
'</tr>'
;
this
.
picker
.
find
(
'.datepicker-days thead'
).
append
(
html
);
},
fillMonths
:
function
(){
var
html
=
''
,
i
=
0
;
while
(
i
<
12
){
html
+=
'<span class="month">'
+
dates
[
this
.
o
.
language
].
monthsShort
[
i
++
]
+
'</span>'
;
}
this
.
picker
.
find
(
'.datepicker-months td'
).
html
(
html
);
},
setRange
:
function
(
range
){
if
(
!
range
||
!
range
.
length
)
delete
this
.
range
;
else
this
.
range
=
$
.
map
(
range
,
function
(
d
){
return
d
.
valueOf
();
});
this
.
fill
();
},
getClassNames
:
function
(
date
){
var
cls
=
[],
year
=
this
.
viewDate
.
getUTCFullYear
(),
month
=
this
.
viewDate
.
getUTCMonth
(),
today
=
new
Date
();
if
(
date
.
getUTCFullYear
()
<
year
||
(
date
.
getUTCFullYear
()
===
year
&&
date
.
getUTCMonth
()
<
month
)){
cls
.
push
(
'old'
);
}
else
if
(
date
.
getUTCFullYear
()
>
year
||
(
date
.
getUTCFullYear
()
===
year
&&
date
.
getUTCMonth
()
>
month
)){
cls
.
push
(
'new'
);
}
if
(
this
.
focusDate
&&
date
.
valueOf
()
===
this
.
focusDate
.
valueOf
())
cls
.
push
(
'focused'
);
// Compare internal UTC date with local today, not UTC today
if
(
this
.
o
.
todayHighlight
&&
date
.
getUTCFullYear
()
===
today
.
getFullYear
()
&&
date
.
getUTCMonth
()
===
today
.
getMonth
()
&&
date
.
getUTCDate
()
===
today
.
getDate
()){
cls
.
push
(
'today'
);
}
if
(
this
.
dates
.
contains
(
date
)
!==
-
1
)
cls
.
push
(
'active'
);
if
(
date
.
valueOf
()
<
this
.
o
.
startDate
||
date
.
valueOf
()
>
this
.
o
.
endDate
||
$
.
inArray
(
date
.
getUTCDay
(),
this
.
o
.
daysOfWeekDisabled
)
!==
-
1
){
cls
.
push
(
'disabled'
);
}
if
(
this
.
range
){
if
(
date
>
this
.
range
[
0
]
&&
date
<
this
.
range
[
this
.
range
.
length
-
1
]){
cls
.
push
(
'range'
);
}
if
(
$
.
inArray
(
date
.
valueOf
(),
this
.
range
)
!==
-
1
){
cls
.
push
(
'selected'
);
}
}
return
cls
;
},
fill
:
function
(){
var
d
=
new
Date
(
this
.
viewDate
),
year
=
d
.
getUTCFullYear
(),
month
=
d
.
getUTCMonth
(),
startYear
=
this
.
o
.
startDate
!==
-
Infinity
?
this
.
o
.
startDate
.
getUTCFullYear
()
:
-
Infinity
,
startMonth
=
this
.
o
.
startDate
!==
-
Infinity
?
this
.
o
.
startDate
.
getUTCMonth
()
:
-
Infinity
,
endYear
=
this
.
o
.
endDate
!==
Infinity
?
this
.
o
.
endDate
.
getUTCFullYear
()
:
Infinity
,
endMonth
=
this
.
o
.
endDate
!==
Infinity
?
this
.
o
.
endDate
.
getUTCMonth
()
:
Infinity
,
todaytxt
=
dates
[
this
.
o
.
language
].
today
||
dates
[
'en'
].
today
||
''
,
cleartxt
=
dates
[
this
.
o
.
language
].
clear
||
dates
[
'en'
].
clear
||
''
,
tooltip
;
this
.
picker
.
find
(
'.datepicker-days thead th.datepicker-switch'
)
.
text
(
dates
[
this
.
o
.
language
].
months
[
month
]
+
' '
+
year
);
this
.
picker
.
find
(
'tfoot th.today'
)
.
text
(
todaytxt
)
.
toggle
(
this
.
o
.
todayBtn
!==
false
);
this
.
picker
.
find
(
'tfoot th.clear'
)
.
text
(
cleartxt
)
.
toggle
(
this
.
o
.
clearBtn
!==
false
);
this
.
updateNavArrows
();
this
.
fillMonths
();
var
prevMonth
=
UTCDate
(
year
,
month
-
1
,
28
),
day
=
DPGlobal
.
getDaysInMonth
(
prevMonth
.
getUTCFullYear
(),
prevMonth
.
getUTCMonth
());
prevMonth
.
setUTCDate
(
day
);
prevMonth
.
setUTCDate
(
day
-
(
prevMonth
.
getUTCDay
()
-
this
.
o
.
weekStart
+
7
)
%
7
);
var
nextMonth
=
new
Date
(
prevMonth
);
nextMonth
.
setUTCDate
(
nextMonth
.
getUTCDate
()
+
42
);
nextMonth
=
nextMonth
.
valueOf
();
var
html
=
[];
var
clsName
;
while
(
prevMonth
.
valueOf
()
<
nextMonth
){
if
(
prevMonth
.
getUTCDay
()
===
this
.
o
.
weekStart
){
html
.
push
(
'<tr>'
);
if
(
this
.
o
.
calendarWeeks
){
// ISO 8601: First week contains first thursday.
// ISO also states week starts on Monday, but we can be more abstract here.
var
// Start of current week: based on weekstart/current date
ws
=
new
Date
(
+
prevMonth
+
(
this
.
o
.
weekStart
-
prevMonth
.
getUTCDay
()
-
7
)
%
7
*
864
e5
),
// Thursday of this week
th
=
new
Date
(
Number
(
ws
)
+
(
7
+
4
-
ws
.
getUTCDay
())
%
7
*
864
e5
),
// First Thursday of year, year from thursday
yth
=
new
Date
(
Number
(
yth
=
UTCDate
(
th
.
getUTCFullYear
(),
0
,
1
))
+
(
7
+
4
-
yth
.
getUTCDay
())
%
7
*
864
e5
),
// Calendar week: ms between thursdays, div ms per day, div 7 days
calWeek
=
(
th
-
yth
)
/
864
e5
/
7
+
1
;
html
.
push
(
'<td class="cw">'
+
calWeek
+
'</td>'
);
}
}
clsName
=
this
.
getClassNames
(
prevMonth
);
clsName
.
push
(
'day'
);
if
(
this
.
o
.
beforeShowDay
!==
$
.
noop
){
var
before
=
this
.
o
.
beforeShowDay
(
this
.
_utc_to_local
(
prevMonth
));
if
(
before
===
undefined
)
before
=
{};
else
if
(
typeof
(
before
)
===
'boolean'
)
before
=
{
enabled
:
before
};
else
if
(
typeof
(
before
)
===
'string'
)
before
=
{
classes
:
before
};
if
(
before
.
enabled
===
false
)
clsName
.
push
(
'disabled'
);
if
(
before
.
classes
)
clsName
=
clsName
.
concat
(
before
.
classes
.
split
(
/
\s
+/
));
if
(
before
.
tooltip
)
tooltip
=
before
.
tooltip
;
}
clsName
=
$
.
unique
(
clsName
);
html
.
push
(
'<td class="'
+
clsName
.
join
(
' '
)
+
'"'
+
(
tooltip
?
' title="'
+
tooltip
+
'"'
:
''
)
+
'>'
+
prevMonth
.
getUTCDate
()
+
'</td>'
);
if
(
prevMonth
.
getUTCDay
()
===
this
.
o
.
weekEnd
){
html
.
push
(
'</tr>'
);
}
prevMonth
.
setUTCDate
(
prevMonth
.
getUTCDate
()
+
1
);
}
this
.
picker
.
find
(
'.datepicker-days tbody'
).
empty
().
append
(
html
.
join
(
''
));
var
months
=
this
.
picker
.
find
(
'.datepicker-months'
)
.
find
(
'th:eq(1)'
)
.
text
(
year
)
.
end
()
.
find
(
'span'
).
removeClass
(
'active'
);
$
.
each
(
this
.
dates
,
function
(
i
,
d
){
if
(
d
.
getUTCFullYear
()
===
year
)
months
.
eq
(
d
.
getUTCMonth
()).
addClass
(
'active'
);
});
if
(
year
<
startYear
||
year
>
endYear
){
months
.
addClass
(
'disabled'
);
}
if
(
year
===
startYear
){
months
.
slice
(
0
,
startMonth
).
addClass
(
'disabled'
);
}
if
(
year
===
endYear
){
months
.
slice
(
endMonth
+
1
).
addClass
(
'disabled'
);
}
html
=
''
;
year
=
parseInt
(
year
/
10
,
10
)
*
10
;
var
yearCont
=
this
.
picker
.
find
(
'.datepicker-years'
)
.
find
(
'th:eq(1)'
)
.
text
(
year
+
'-'
+
(
year
+
9
))
.
end
()
.
find
(
'td'
);
year
-=
1
;
var
years
=
$
.
map
(
this
.
dates
,
function
(
d
){
return
d
.
getUTCFullYear
();
}),
classes
;
for
(
var
i
=
-
1
;
i
<
11
;
i
++
){
classes
=
[
'year'
];
if
(
i
===
-
1
)
classes
.
push
(
'old'
);
else
if
(
i
===
10
)
classes
.
push
(
'new'
);
if
(
$
.
inArray
(
year
,
years
)
!==
-
1
)
classes
.
push
(
'active'
);
if
(
year
<
startYear
||
year
>
endYear
)
classes
.
push
(
'disabled'
);
html
+=
'<span class="'
+
classes
.
join
(
' '
)
+
'">'
+
year
+
'</span>'
;
year
+=
1
;
}
yearCont
.
html
(
html
);
},
updateNavArrows
:
function
(){
if
(
!
this
.
_allow_update
)
return
;
var
d
=
new
Date
(
this
.
viewDate
),
year
=
d
.
getUTCFullYear
(),
month
=
d
.
getUTCMonth
();
switch
(
this
.
viewMode
){
case
0
:
if
(
this
.
o
.
startDate
!==
-
Infinity
&&
year
<=
this
.
o
.
startDate
.
getUTCFullYear
()
&&
month
<=
this
.
o
.
startDate
.
getUTCMonth
()){
this
.
picker
.
find
(
'.prev'
).
css
({
visibility
:
'hidden'
});
}
else
{
this
.
picker
.
find
(
'.prev'
).
css
({
visibility
:
'visible'
});
}
if
(
this
.
o
.
endDate
!==
Infinity
&&
year
>=
this
.
o
.
endDate
.
getUTCFullYear
()
&&
month
>=
this
.
o
.
endDate
.
getUTCMonth
()){
this
.
picker
.
find
(
'.next'
).
css
({
visibility
:
'hidden'
});
}
else
{
this
.
picker
.
find
(
'.next'
).
css
({
visibility
:
'visible'
});
}
break
;
case
1
:
case
2
:
if
(
this
.
o
.
startDate
!==
-
Infinity
&&
year
<=
this
.
o
.
startDate
.
getUTCFullYear
()){
this
.
picker
.
find
(
'.prev'
).
css
({
visibility
:
'hidden'
});
}
else
{
this
.
picker
.
find
(
'.prev'
).
css
({
visibility
:
'visible'
});
}
if
(
this
.
o
.
endDate
!==
Infinity
&&
year
>=
this
.
o
.
endDate
.
getUTCFullYear
()){
this
.
picker
.
find
(
'.next'
).
css
({
visibility
:
'hidden'
});
}
else
{
this
.
picker
.
find
(
'.next'
).
css
({
visibility
:
'visible'
});
}
break
;
}
},
click
:
function
(
e
){
e
.
preventDefault
();
var
target
=
$
(
e
.
target
).
closest
(
'span, td, th'
),
year
,
month
,
day
;
if
(
target
.
length
===
1
){
switch
(
target
[
0
].
nodeName
.
toLowerCase
()){
case
'th'
:
switch
(
target
[
0
].
className
){
case
'datepicker-switch'
:
this
.
showMode
(
1
);
break
;
case
'prev'
:
case
'next'
:
var
dir
=
DPGlobal
.
modes
[
this
.
viewMode
].
navStep
*
(
target
[
0
].
className
===
'prev'
?
-
1
:
1
);
switch
(
this
.
viewMode
){
case
0
:
this
.
viewDate
=
this
.
moveMonth
(
this
.
viewDate
,
dir
);
this
.
_trigger
(
'changeMonth'
,
this
.
viewDate
);
break
;
case
1
:
case
2
:
this
.
viewDate
=
this
.
moveYear
(
this
.
viewDate
,
dir
);
if
(
this
.
viewMode
===
1
)
this
.
_trigger
(
'changeYear'
,
this
.
viewDate
);
break
;
}
this
.
fill
();
break
;
case
'today'
:
var
date
=
new
Date
();
date
=
UTCDate
(
date
.
getFullYear
(),
date
.
getMonth
(),
date
.
getDate
(),
0
,
0
,
0
);
this
.
showMode
(
-
2
);
var
which
=
this
.
o
.
todayBtn
===
'linked'
?
null
:
'view'
;
this
.
_setDate
(
date
,
which
);
break
;
case
'clear'
:
var
element
;
if
(
this
.
isInput
)
element
=
this
.
element
;
else
if
(
this
.
component
)
element
=
this
.
element
.
find
(
'input'
);
if
(
element
)
element
.
val
(
""
).
change
();
this
.
update
();
this
.
_trigger
(
'changeDate'
);
if
(
this
.
o
.
autoclose
)
this
.
hide
();
break
;
}
break
;
case
'span'
:
if
(
!
target
.
is
(
'.disabled'
)){
this
.
viewDate
.
setUTCDate
(
1
);
if
(
target
.
is
(
'.month'
)){
day
=
1
;
month
=
target
.
parent
().
find
(
'span'
).
index
(
target
);
year
=
this
.
viewDate
.
getUTCFullYear
();
this
.
viewDate
.
setUTCMonth
(
month
);
this
.
_trigger
(
'changeMonth'
,
this
.
viewDate
);
if
(
this
.
o
.
minViewMode
===
1
){
this
.
_setDate
(
UTCDate
(
year
,
month
,
day
));
}
}
else
{
day
=
1
;
month
=
0
;
year
=
parseInt
(
target
.
text
(),
10
)
||
0
;
this
.
viewDate
.
setUTCFullYear
(
year
);
this
.
_trigger
(
'changeYear'
,
this
.
viewDate
);
if
(
this
.
o
.
minViewMode
===
2
){
this
.
_setDate
(
UTCDate
(
year
,
month
,
day
));
}
}
this
.
showMode
(
-
1
);
this
.
fill
();
}
break
;
case
'td'
:
if
(
target
.
is
(
'.day'
)
&&
!
target
.
is
(
'.disabled'
)){
day
=
parseInt
(
target
.
text
(),
10
)
||
1
;
year
=
this
.
viewDate
.
getUTCFullYear
();
month
=
this
.
viewDate
.
getUTCMonth
();
if
(
target
.
is
(
'.old'
)){
if
(
month
===
0
){
month
=
11
;
year
-=
1
;
}
else
{
month
-=
1
;
}
}
else
if
(
target
.
is
(
'.new'
)){
if
(
month
===
11
){
month
=
0
;
year
+=
1
;
}
else
{
month
+=
1
;
}
}
this
.
_setDate
(
UTCDate
(
year
,
month
,
day
));
}
break
;
}
}
if
(
this
.
picker
.
is
(
':visible'
)
&&
this
.
_focused_from
){
$
(
this
.
_focused_from
).
focus
();
}
delete
this
.
_focused_from
;
},
_toggle_multidate
:
function
(
date
){
var
ix
=
this
.
dates
.
contains
(
date
);
if
(
!
date
){
this
.
dates
.
clear
();
}
else
if
(
ix
!==
-
1
){
this
.
dates
.
remove
(
ix
);
}
else
{
this
.
dates
.
push
(
date
);
}
if
(
typeof
this
.
o
.
multidate
===
'number'
)
while
(
this
.
dates
.
length
>
this
.
o
.
multidate
)
this
.
dates
.
remove
(
0
);
},
_setDate
:
function
(
date
,
which
){
if
(
!
which
||
which
===
'date'
)
this
.
_toggle_multidate
(
date
&&
new
Date
(
date
));
if
(
!
which
||
which
===
'view'
)
this
.
viewDate
=
date
&&
new
Date
(
date
);
this
.
fill
();
this
.
setValue
();
this
.
_trigger
(
'changeDate'
);
var
element
;
if
(
this
.
isInput
){
element
=
this
.
element
;
}
else
if
(
this
.
component
){
element
=
this
.
element
.
find
(
'input'
);
}
if
(
element
){
element
.
change
();
}
if
(
this
.
o
.
autoclose
&&
(
!
which
||
which
===
'date'
)){
this
.
hide
();
}
},
moveMonth
:
function
(
date
,
dir
){
if
(
!
date
)
return
undefined
;
if
(
!
dir
)
return
date
;
var
new_date
=
new
Date
(
date
.
valueOf
()),
day
=
new_date
.
getUTCDate
(),
month
=
new_date
.
getUTCMonth
(),
mag
=
Math
.
abs
(
dir
),
new_month
,
test
;
dir
=
dir
>
0
?
1
:
-
1
;
if
(
mag
===
1
){
test
=
dir
===
-
1
// If going back one month, make sure month is not current month
// (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
?
function
(){
return
new_date
.
getUTCMonth
()
===
month
;
}
// If going forward one month, make sure month is as expected
// (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
:
function
(){
return
new_date
.
getUTCMonth
()
!==
new_month
;
};
new_month
=
month
+
dir
;
new_date
.
setUTCMonth
(
new_month
);
// Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
if
(
new_month
<
0
||
new_month
>
11
)
new_month
=
(
new_month
+
12
)
%
12
;
}
else
{
// For magnitudes >1, move one month at a time...
for
(
var
i
=
0
;
i
<
mag
;
i
++
)
// ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
new_date
=
this
.
moveMonth
(
new_date
,
dir
);
// ...then reset the day, keeping it in the new month
new_month
=
new_date
.
getUTCMonth
();
new_date
.
setUTCDate
(
day
);
test
=
function
(){
return
new_month
!==
new_date
.
getUTCMonth
();
};
}
// Common date-resetting loop -- if date is beyond end of month, make it
// end of month
while
(
test
()){
new_date
.
setUTCDate
(
--
day
);
new_date
.
setUTCMonth
(
new_month
);
}
return
new_date
;
},
moveYear
:
function
(
date
,
dir
){
return
this
.
moveMonth
(
date
,
dir
*
12
);
},
dateWithinRange
:
function
(
date
){
return
date
>=
this
.
o
.
startDate
&&
date
<=
this
.
o
.
endDate
;
},
keydown
:
function
(
e
){
if
(
this
.
picker
.
is
(
':not(:visible)'
)){
if
(
e
.
keyCode
===
27
)
// allow escape to hide and re-show picker
this
.
show
();
return
;
}
var
dateChanged
=
false
,
dir
,
newDate
,
newViewDate
,
focusDate
=
this
.
focusDate
||
this
.
viewDate
;
switch
(
e
.
keyCode
){
case
27
:
// escape
if
(
this
.
focusDate
){
this
.
focusDate
=
null
;
this
.
viewDate
=
this
.
dates
.
get
(
-
1
)
||
this
.
viewDate
;
this
.
fill
();
}
else
this
.
hide
();
e
.
preventDefault
();
break
;
case
37
:
// left
case
39
:
// right
if
(
!
this
.
o
.
keyboardNavigation
)
break
;
dir
=
e
.
keyCode
===
37
?
-
1
:
1
;
if
(
e
.
ctrlKey
){
newDate
=
this
.
moveYear
(
this
.
dates
.
get
(
-
1
)
||
UTCToday
(),
dir
);
newViewDate
=
this
.
moveYear
(
focusDate
,
dir
);
this
.
_trigger
(
'changeYear'
,
this
.
viewDate
);
}
else
if
(
e
.
shiftKey
){
newDate
=
this
.
moveMonth
(
this
.
dates
.
get
(
-
1
)
||
UTCToday
(),
dir
);
newViewDate
=
this
.
moveMonth
(
focusDate
,
dir
);
this
.
_trigger
(
'changeMonth'
,
this
.
viewDate
);
}
else
{
newDate
=
new
Date
(
this
.
dates
.
get
(
-
1
)
||
UTCToday
());
newDate
.
setUTCDate
(
newDate
.
getUTCDate
()
+
dir
);
newViewDate
=
new
Date
(
focusDate
);
newViewDate
.
setUTCDate
(
focusDate
.
getUTCDate
()
+
dir
);
}
if
(
this
.
dateWithinRange
(
newDate
)){
this
.
focusDate
=
this
.
viewDate
=
newViewDate
;
this
.
setValue
();
this
.
fill
();
e
.
preventDefault
();
}
break
;
case
38
:
// up
case
40
:
// down
if
(
!
this
.
o
.
keyboardNavigation
)
break
;
dir
=
e
.
keyCode
===
38
?
-
1
:
1
;
if
(
e
.
ctrlKey
){
newDate
=
this
.
moveYear
(
this
.
dates
.
get
(
-
1
)
||
UTCToday
(),
dir
);
newViewDate
=
this
.
moveYear
(
focusDate
,
dir
);
this
.
_trigger
(
'changeYear'
,
this
.
viewDate
);
}
else
if
(
e
.
shiftKey
){
newDate
=
this
.
moveMonth
(
this
.
dates
.
get
(
-
1
)
||
UTCToday
(),
dir
);
newViewDate
=
this
.
moveMonth
(
focusDate
,
dir
);
this
.
_trigger
(
'changeMonth'
,
this
.
viewDate
);
}
else
{
newDate
=
new
Date
(
this
.
dates
.
get
(
-
1
)
||
UTCToday
());
newDate
.
setUTCDate
(
newDate
.
getUTCDate
()
+
dir
*
7
);
newViewDate
=
new
Date
(
focusDate
);
newViewDate
.
setUTCDate
(
focusDate
.
getUTCDate
()
+
dir
*
7
);
}
if
(
this
.
dateWithinRange
(
newDate
)){
this
.
focusDate
=
this
.
viewDate
=
newViewDate
;
this
.
setValue
();
this
.
fill
();
e
.
preventDefault
();
}
break
;
case
32
:
// spacebar
// Spacebar is used in manually typing dates in some formats.
// As such, its behavior should not be hijacked.
break
;
case
13
:
// enter
focusDate
=
this
.
focusDate
||
this
.
dates
.
get
(
-
1
)
||
this
.
viewDate
;
this
.
_toggle_multidate
(
focusDate
);
dateChanged
=
true
;
this
.
focusDate
=
null
;
this
.
viewDate
=
this
.
dates
.
get
(
-
1
)
||
this
.
viewDate
;
this
.
setValue
();
this
.
fill
();
if
(
this
.
picker
.
is
(
':visible'
)){
e
.
preventDefault
();
if
(
this
.
o
.
autoclose
)
this
.
hide
();
}
break
;
case
9
:
// tab
this
.
focusDate
=
null
;
this
.
viewDate
=
this
.
dates
.
get
(
-
1
)
||
this
.
viewDate
;
this
.
fill
();
this
.
hide
();
break
;
}
if
(
dateChanged
){
if
(
this
.
dates
.
length
)
this
.
_trigger
(
'changeDate'
);
else
this
.
_trigger
(
'clearDate'
);
var
element
;
if
(
this
.
isInput
){
element
=
this
.
element
;
}
else
if
(
this
.
component
){
element
=
this
.
element
.
find
(
'input'
);
}
if
(
element
){
element
.
change
();
}
}
},
showMode
:
function
(
dir
){
if
(
dir
){
this
.
viewMode
=
Math
.
max
(
this
.
o
.
minViewMode
,
Math
.
min
(
2
,
this
.
viewMode
+
dir
));
}
this
.
picker
.
find
(
'>div'
)
.
hide
()
.
filter
(
'.datepicker-'
+
DPGlobal
.
modes
[
this
.
viewMode
].
clsName
)
.
css
(
'display'
,
'block'
);
this
.
updateNavArrows
();
}
};
var
DateRangePicker
=
function
(
element
,
options
){
this
.
element
=
$
(
element
);
this
.
inputs
=
$
.
map
(
options
.
inputs
,
function
(
i
){
return
i
.
jquery
?
i
[
0
]
:
i
;
});
delete
options
.
inputs
;
$
(
this
.
inputs
)
.
datepicker
(
options
)
.
bind
(
'changeDate'
,
$
.
proxy
(
this
.
dateUpdated
,
this
));
this
.
pickers
=
$
.
map
(
this
.
inputs
,
function
(
i
){
return
$
(
i
).
data
(
'datepicker'
);
});
this
.
updateDates
();
};
DateRangePicker
.
prototype
=
{
updateDates
:
function
(){
this
.
dates
=
$
.
map
(
this
.
pickers
,
function
(
i
){
return
i
.
getUTCDate
();
});
this
.
updateRanges
();
},
updateRanges
:
function
(){
var
range
=
$
.
map
(
this
.
dates
,
function
(
d
){
return
d
.
valueOf
();
});
$
.
each
(
this
.
pickers
,
function
(
i
,
p
){
p
.
setRange
(
range
);
});
},
dateUpdated
:
function
(
e
){
// `this.updating` is a workaround for preventing infinite recursion
// between `changeDate` triggering and `setUTCDate` calling. Until
// there is a better mechanism.
if
(
this
.
updating
)
return
;
this
.
updating
=
true
;
var
dp
=
$
(
e
.
target
).
data
(
'datepicker'
),
new_date
=
dp
.
getUTCDate
(),
i
=
$
.
inArray
(
e
.
target
,
this
.
inputs
),
l
=
this
.
inputs
.
length
;
if
(
i
===
-
1
)
return
;
$
.
each
(
this
.
pickers
,
function
(
i
,
p
){
if
(
!
p
.
getUTCDate
())
p
.
setUTCDate
(
new_date
);
});
if
(
new_date
<
this
.
dates
[
i
]){
// Date being moved earlier/left
while
(
i
>=
0
&&
new_date
<
this
.
dates
[
i
]){
this
.
pickers
[
i
--
].
setUTCDate
(
new_date
);
}
}
else
if
(
new_date
>
this
.
dates
[
i
]){
// Date being moved later/right
while
(
i
<
l
&&
new_date
>
this
.
dates
[
i
]){
this
.
pickers
[
i
++
].
setUTCDate
(
new_date
);
}
}
this
.
updateDates
();
delete
this
.
updating
;
},
remove
:
function
(){
$
.
map
(
this
.
pickers
,
function
(
p
){
p
.
remove
();
});
delete
this
.
element
.
data
().
datepicker
;
}
};
function
opts_from_el
(
el
,
prefix
){
// Derive options from element data-attrs
var
data
=
$
(
el
).
data
(),
out
=
{},
inkey
,
replace
=
new
RegExp
(
'^'
+
prefix
.
toLowerCase
()
+
'([A-Z])'
);
prefix
=
new
RegExp
(
'^'
+
prefix
.
toLowerCase
());
function
re_lower
(
_
,
a
){
return
a
.
toLowerCase
();
}
for
(
var
key
in
data
)
if
(
prefix
.
test
(
key
)){
inkey
=
key
.
replace
(
replace
,
re_lower
);
out
[
inkey
]
=
data
[
key
];
}
return
out
;
}
function
opts_from_locale
(
lang
){
// Derive options from locale plugins
var
out
=
{};
// Check if "de-DE" style date is available, if not language should
// fallback to 2 letter code eg "de"
if
(
!
dates
[
lang
]){
lang
=
lang
.
split
(
'-'
)[
0
];
if
(
!
dates
[
lang
])
return
;
}
var
d
=
dates
[
lang
];
$
.
each
(
locale_opts
,
function
(
i
,
k
){
if
(
k
in
d
)
out
[
k
]
=
d
[
k
];
});
return
out
;
}
var
old
=
$
.
fn
.
datepicker
;
$
.
fn
.
datepicker
=
function
(
option
){
var
args
=
Array
.
apply
(
null
,
arguments
);
args
.
shift
();
var
internal_return
;
this
.
each
(
function
(){
var
$this
=
$
(
this
),
data
=
$this
.
data
(
'datepicker'
),
options
=
typeof
option
===
'object'
&&
option
;
if
(
!
data
){
var
elopts
=
opts_from_el
(
this
,
'date'
),
// Preliminary otions
xopts
=
$
.
extend
({},
defaults
,
elopts
,
options
),
locopts
=
opts_from_locale
(
xopts
.
language
),
// Options priority: js args, data-attrs, locales, defaults
opts
=
$
.
extend
({},
defaults
,
locopts
,
elopts
,
options
);
if
(
$this
.
is
(
'.input-daterange'
)
||
opts
.
inputs
){
var
ropts
=
{
inputs
:
opts
.
inputs
||
$this
.
find
(
'input'
).
toArray
()
};
$this
.
data
(
'datepicker'
,
(
data
=
new
DateRangePicker
(
this
,
$
.
extend
(
opts
,
ropts
))));
}
else
{
$this
.
data
(
'datepicker'
,
(
data
=
new
Datepicker
(
this
,
opts
)));
}
}
if
(
typeof
option
===
'string'
&&
typeof
data
[
option
]
===
'function'
){
internal_return
=
data
[
option
].
apply
(
data
,
args
);
if
(
internal_return
!==
undefined
)
return
false
;
}
});
if
(
internal_return
!==
undefined
)
return
internal_return
;
else
return
this
;
};
var
defaults
=
$
.
fn
.
datepicker
.
defaults
=
{
autoclose
:
false
,
beforeShowDay
:
$
.
noop
,
calendarWeeks
:
false
,
clearBtn
:
false
,
daysOfWeekDisabled
:
[],
endDate
:
Infinity
,
forceParse
:
true
,
format
:
'mm/dd/yyyy'
,
keyboardNavigation
:
true
,
language
:
'en'
,
minViewMode
:
0
,
multidate
:
false
,
multidateSeparator
:
','
,
orientation
:
"auto"
,
rtl
:
false
,
startDate
:
-
Infinity
,
startView
:
0
,
todayBtn
:
false
,
todayHighlight
:
false
,
weekStart
:
0
};
var
locale_opts
=
$
.
fn
.
datepicker
.
locale_opts
=
[
'format'
,
'rtl'
,
'weekStart'
];
$
.
fn
.
datepicker
.
Constructor
=
Datepicker
;
var
dates
=
$
.
fn
.
datepicker
.
dates
=
{
en
:
{
days
:
[
"Sunday"
,
"Monday"
,
"Tuesday"
,
"Wednesday"
,
"Thursday"
,
"Friday"
,
"Saturday"
,
"Sunday"
],
daysShort
:
[
"Sun"
,
"Mon"
,
"Tue"
,
"Wed"
,
"Thu"
,
"Fri"
,
"Sat"
,
"Sun"
],
daysMin
:
[
"Su"
,
"Mo"
,
"Tu"
,
"We"
,
"Th"
,
"Fr"
,
"Sa"
,
"Su"
],
months
:
[
"January"
,
"February"
,
"March"
,
"April"
,
"May"
,
"June"
,
"July"
,
"August"
,
"September"
,
"October"
,
"November"
,
"December"
],
monthsShort
:
[
"Jan"
,
"Feb"
,
"Mar"
,
"Apr"
,
"May"
,
"Jun"
,
"Jul"
,
"Aug"
,
"Sep"
,
"Oct"
,
"Nov"
,
"Dec"
],
today
:
"Today"
,
clear
:
"Clear"
}
};
var
DPGlobal
=
{
modes
:
[
{
clsName
:
'days'
,
navFnc
:
'Month'
,
navStep
:
1
},
{
clsName
:
'months'
,
navFnc
:
'FullYear'
,
navStep
:
1
},
{
clsName
:
'years'
,
navFnc
:
'FullYear'
,
navStep
:
10
}],
isLeapYear
:
function
(
year
){
return
(((
year
%
4
===
0
)
&&
(
year
%
100
!==
0
))
||
(
year
%
400
===
0
));
},
getDaysInMonth
:
function
(
year
,
month
){
return
[
31
,
(
DPGlobal
.
isLeapYear
(
year
)
?
29
:
28
),
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
][
month
];
},
validParts
:
/dd
?
|DD
?
|mm
?
|MM
?
|yy
(?:
yy
)?
/g
,
nonpunctuation
:
/
[^
-
\/
:-@
\[\u
3400-
\u
9fff-`{-~
\t\n\r]
+/g
,
parseFormat
:
function
(
format
){
// IE treats \0 as a string end in inputs (truncating the value),
// so it's a bad format delimiter, anyway
var
separators
=
format
.
replace
(
this
.
validParts
,
'
\
0'
).
split
(
'
\
0'
),
parts
=
format
.
match
(
this
.
validParts
);
if
(
!
separators
||
!
separators
.
length
||
!
parts
||
parts
.
length
===
0
){
throw
new
Error
(
"Invalid date format."
);
}
return
{
separators
:
separators
,
parts
:
parts
};
},
parseDate
:
function
(
date
,
format
,
language
){
if
(
!
date
)
return
undefined
;
if
(
date
instanceof
Date
)
return
date
;
if
(
typeof
format
===
'string'
)
format
=
DPGlobal
.
parseFormat
(
format
);
var
part_re
=
/
([\-
+
]\d
+
)([
dmwy
])
/
,
parts
=
date
.
match
(
/
([\-
+
]\d
+
)([
dmwy
])
/g
),
part
,
dir
,
i
;
if
(
/^
[\-
+
]\d
+
[
dmwy
]([\s
,
]
+
[\-
+
]\d
+
[
dmwy
])
*$/
.
test
(
date
)){
date
=
new
Date
();
for
(
i
=
0
;
i
<
parts
.
length
;
i
++
){
part
=
part_re
.
exec
(
parts
[
i
]);
dir
=
parseInt
(
part
[
1
]);
switch
(
part
[
2
]){
case
'd'
:
date
.
setUTCDate
(
date
.
getUTCDate
()
+
dir
);
break
;
case
'm'
:
date
=
Datepicker
.
prototype
.
moveMonth
.
call
(
Datepicker
.
prototype
,
date
,
dir
);
break
;
case
'w'
:
date
.
setUTCDate
(
date
.
getUTCDate
()
+
dir
*
7
);
break
;
case
'y'
:
date
=
Datepicker
.
prototype
.
moveYear
.
call
(
Datepicker
.
prototype
,
date
,
dir
);
break
;
}
}
return
UTCDate
(
date
.
getUTCFullYear
(),
date
.
getUTCMonth
(),
date
.
getUTCDate
(),
0
,
0
,
0
);
}
parts
=
date
&&
date
.
match
(
this
.
nonpunctuation
)
||
[];
date
=
new
Date
();
var
parsed
=
{},
setters_order
=
[
'yyyy'
,
'yy'
,
'M'
,
'MM'
,
'm'
,
'mm'
,
'd'
,
'dd'
],
setters_map
=
{
yyyy
:
function
(
d
,
v
){
return
d
.
setUTCFullYear
(
v
);
},
yy
:
function
(
d
,
v
){
return
d
.
setUTCFullYear
(
2000
+
v
);
},
m
:
function
(
d
,
v
){
if
(
isNaN
(
d
))
return
d
;
v
-=
1
;
while
(
v
<
0
)
v
+=
12
;
v
%=
12
;
d
.
setUTCMonth
(
v
);
while
(
d
.
getUTCMonth
()
!==
v
)
d
.
setUTCDate
(
d
.
getUTCDate
()
-
1
);
return
d
;
},
d
:
function
(
d
,
v
){
return
d
.
setUTCDate
(
v
);
}
},
val
,
filtered
;
setters_map
[
'M'
]
=
setters_map
[
'MM'
]
=
setters_map
[
'mm'
]
=
setters_map
[
'm'
];
setters_map
[
'dd'
]
=
setters_map
[
'd'
];
date
=
UTCDate
(
date
.
getFullYear
(),
date
.
getMonth
(),
date
.
getDate
(),
0
,
0
,
0
);
var
fparts
=
format
.
parts
.
slice
();
// Remove noop parts
if
(
parts
.
length
!==
fparts
.
length
){
fparts
=
$
(
fparts
).
filter
(
function
(
i
,
p
){
return
$
.
inArray
(
p
,
setters_order
)
!==
-
1
;
}).
toArray
();
}
// Process remainder
function
match_part
(){
var
m
=
this
.
slice
(
0
,
parts
[
i
].
length
),
p
=
parts
[
i
].
slice
(
0
,
m
.
length
);
return
m
===
p
;
}
if
(
parts
.
length
===
fparts
.
length
){
var
cnt
;
for
(
i
=
0
,
cnt
=
fparts
.
length
;
i
<
cnt
;
i
++
){
val
=
parseInt
(
parts
[
i
],
10
);
part
=
fparts
[
i
];
if
(
isNaN
(
val
)){
switch
(
part
){
case
'MM'
:
filtered
=
$
(
dates
[
language
].
months
).
filter
(
match_part
);
val
=
$
.
inArray
(
filtered
[
0
],
dates
[
language
].
months
)
+
1
;
break
;
case
'M'
:
filtered
=
$
(
dates
[
language
].
monthsShort
).
filter
(
match_part
);
val
=
$
.
inArray
(
filtered
[
0
],
dates
[
language
].
monthsShort
)
+
1
;
break
;
}
}
parsed
[
part
]
=
val
;
}
var
_date
,
s
;
for
(
i
=
0
;
i
<
setters_order
.
length
;
i
++
){
s
=
setters_order
[
i
];
if
(
s
in
parsed
&&
!
isNaN
(
parsed
[
s
])){
_date
=
new
Date
(
date
);
setters_map
[
s
](
_date
,
parsed
[
s
]);
if
(
!
isNaN
(
_date
))
date
=
_date
;
}
}
}
return
date
;
},
formatDate
:
function
(
date
,
format
,
language
){
if
(
!
date
)
return
''
;
if
(
typeof
format
===
'string'
)
format
=
DPGlobal
.
parseFormat
(
format
);
var
val
=
{
d
:
date
.
getUTCDate
(),
D
:
dates
[
language
].
daysShort
[
date
.
getUTCDay
()],
DD
:
dates
[
language
].
days
[
date
.
getUTCDay
()],
m
:
date
.
getUTCMonth
()
+
1
,
M
:
dates
[
language
].
monthsShort
[
date
.
getUTCMonth
()],
MM
:
dates
[
language
].
months
[
date
.
getUTCMonth
()],
yy
:
date
.
getUTCFullYear
().
toString
().
substring
(
2
),
yyyy
:
date
.
getUTCFullYear
()
};
val
.
dd
=
(
val
.
d
<
10
?
'0'
:
''
)
+
val
.
d
;
val
.
mm
=
(
val
.
m
<
10
?
'0'
:
''
)
+
val
.
m
;
date
=
[];
var
seps
=
$
.
extend
([],
format
.
separators
);
for
(
var
i
=
0
,
cnt
=
format
.
parts
.
length
;
i
<=
cnt
;
i
++
){
if
(
seps
.
length
)
date
.
push
(
seps
.
shift
());
date
.
push
(
val
[
format
.
parts
[
i
]]);
}
return
date
.
join
(
''
);
},
headTemplate
:
'<thead>'
+
'<tr>'
+
'<th class="prev">«</th>'
+
'<th colspan="5" class="datepicker-switch"></th>'
+
'<th class="next">»</th>'
+
'</tr>'
+
'</thead>'
,
contTemplate
:
'<tbody><tr><td colspan="7"></td></tr></tbody>'
,
footTemplate
:
'<tfoot>'
+
'<tr>'
+
'<th colspan="7" class="today"></th>'
+
'</tr>'
+
'<tr>'
+
'<th colspan="7" class="clear"></th>'
+
'</tr>'
+
'</tfoot>'
};
DPGlobal
.
template
=
'<div class="datepicker">'
+
'<div class="datepicker-days">'
+
'<table class=" table-condensed">'
+
DPGlobal
.
headTemplate
+
'<tbody></tbody>'
+
DPGlobal
.
footTemplate
+
'</table>'
+
'</div>'
+
'<div class="datepicker-months">'
+
'<table class="table-condensed">'
+
DPGlobal
.
headTemplate
+
DPGlobal
.
contTemplate
+
DPGlobal
.
footTemplate
+
'</table>'
+
'</div>'
+
'<div class="datepicker-years">'
+
'<table class="table-condensed">'
+
DPGlobal
.
headTemplate
+
DPGlobal
.
contTemplate
+
DPGlobal
.
footTemplate
+
'</table>'
+
'</div>'
+
'</div>'
;
$
.
fn
.
datepicker
.
DPGlobal
=
DPGlobal
;
/* DATEPICKER NO CONFLICT
* =================== */
$
.
fn
.
datepicker
.
noConflict
=
function
(){
$
.
fn
.
datepicker
=
old
;
return
this
;
};
/* DATEPICKER DATA-API
* ================== */
$
(
document
).
on
(
'focus.datepicker.data-api click.datepicker.data-api'
,
'[data-provide="datepicker"]'
,
function
(
e
){
var
$this
=
$
(
this
);
if
(
$this
.
data
(
'datepicker'
))
return
;
e
.
preventDefault
();
// component click requires us to explicitly show it
$this
.
datepicker
(
'show'
);
}
);
$
(
function
(){
$
(
'[data-provide="datepicker-inline"]'
).
datepicker
();
});
}(
window
.
jQuery
));
static/js/plugins/chosen/chosen.jquery.js
0 → 100755
View file @
53e4dc7a
/*!
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.1.0
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
*/
(
function
()
{
var
$
,
AbstractChosen
,
Chosen
,
SelectParser
,
_ref
,
__hasProp
=
{}.
hasOwnProperty
,
__extends
=
function
(
child
,
parent
)
{
for
(
var
key
in
parent
)
{
if
(
__hasProp
.
call
(
parent
,
key
))
child
[
key
]
=
parent
[
key
];
}
function
ctor
()
{
this
.
constructor
=
child
;
}
ctor
.
prototype
=
parent
.
prototype
;
child
.
prototype
=
new
ctor
();
child
.
__super__
=
parent
.
prototype
;
return
child
;
};
SelectParser
=
(
function
()
{
function
SelectParser
()
{
this
.
options_index
=
0
;
this
.
parsed
=
[];
}
SelectParser
.
prototype
.
add_node
=
function
(
child
)
{
if
(
child
.
nodeName
.
toUpperCase
()
===
"OPTGROUP"
)
{
return
this
.
add_group
(
child
);
}
else
{
return
this
.
add_option
(
child
);
}
};
SelectParser
.
prototype
.
add_group
=
function
(
group
)
{
var
group_position
,
option
,
_i
,
_len
,
_ref
,
_results
;
group_position
=
this
.
parsed
.
length
;
this
.
parsed
.
push
({
array_index
:
group_position
,
group
:
true
,
label
:
this
.
escapeExpression
(
group
.
label
),
children
:
0
,
disabled
:
group
.
disabled
});
_ref
=
group
.
childNodes
;
_results
=
[];
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
option
=
_ref
[
_i
];
_results
.
push
(
this
.
add_option
(
option
,
group_position
,
group
.
disabled
));
}
return
_results
;
};
SelectParser
.
prototype
.
add_option
=
function
(
option
,
group_position
,
group_disabled
)
{
if
(
option
.
nodeName
.
toUpperCase
()
===
"OPTION"
)
{
if
(
option
.
text
!==
""
)
{
if
(
group_position
!=
null
)
{
this
.
parsed
[
group_position
].
children
+=
1
;
}
this
.
parsed
.
push
({
array_index
:
this
.
parsed
.
length
,
options_index
:
this
.
options_index
,
value
:
option
.
value
,
text
:
option
.
text
,
html
:
option
.
innerHTML
,
selected
:
option
.
selected
,
disabled
:
group_disabled
===
true
?
group_disabled
:
option
.
disabled
,
group_array_index
:
group_position
,
classes
:
option
.
className
,
style
:
option
.
style
.
cssText
});
}
else
{
this
.
parsed
.
push
({
array_index
:
this
.
parsed
.
length
,
options_index
:
this
.
options_index
,
empty
:
true
});
}
return
this
.
options_index
+=
1
;
}
};
SelectParser
.
prototype
.
escapeExpression
=
function
(
text
)
{
var
map
,
unsafe_chars
;
if
((
text
==
null
)
||
text
===
false
)
{
return
""
;
}
if
(
!
/
[\&\<\>\"\'\`]
/
.
test
(
text
))
{
return
text
;
}
map
=
{
"<"
:
"<"
,
">"
:
">"
,
'"'
:
"""
,
"'"
:
"'"
,
"`"
:
"`"
};
unsafe_chars
=
/&
(?!\w
+;
)
|
[\<\>\"\'\`]
/g
;
return
text
.
replace
(
unsafe_chars
,
function
(
chr
)
{
return
map
[
chr
]
||
"&"
;
});
};
return
SelectParser
;
})();
SelectParser
.
select_to_array
=
function
(
select
)
{
var
child
,
parser
,
_i
,
_len
,
_ref
;
parser
=
new
SelectParser
();
_ref
=
select
.
childNodes
;
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
child
=
_ref
[
_i
];
parser
.
add_node
(
child
);
}
return
parser
.
parsed
;
};
AbstractChosen
=
(
function
()
{
function
AbstractChosen
(
form_field
,
options
)
{
this
.
form_field
=
form_field
;
this
.
options
=
options
!=
null
?
options
:
{};
if
(
!
AbstractChosen
.
browser_is_supported
())
{
return
;
}
this
.
is_multiple
=
this
.
form_field
.
multiple
;
this
.
set_default_text
();
this
.
set_default_values
();
this
.
setup
();
this
.
set_up_html
();
this
.
register_observers
();
}
AbstractChosen
.
prototype
.
set_default_values
=
function
()
{
var
_this
=
this
;
this
.
click_test_action
=
function
(
evt
)
{
return
_this
.
test_active_click
(
evt
);
};
this
.
activate_action
=
function
(
evt
)
{
return
_this
.
activate_field
(
evt
);
};
this
.
active_field
=
false
;
this
.
mouse_on_container
=
false
;
this
.
results_showing
=
false
;
this
.
result_highlighted
=
null
;
this
.
allow_single_deselect
=
(
this
.
options
.
allow_single_deselect
!=
null
)
&&
(
this
.
form_field
.
options
[
0
]
!=
null
)
&&
this
.
form_field
.
options
[
0
].
text
===
""
?
this
.
options
.
allow_single_deselect
:
false
;
this
.
disable_search_threshold
=
this
.
options
.
disable_search_threshold
||
0
;
this
.
disable_search
=
this
.
options
.
disable_search
||
false
;
this
.
enable_split_word_search
=
this
.
options
.
enable_split_word_search
!=
null
?
this
.
options
.
enable_split_word_search
:
true
;
this
.
group_search
=
this
.
options
.
group_search
!=
null
?
this
.
options
.
group_search
:
true
;
this
.
search_contains
=
this
.
options
.
search_contains
||
false
;
this
.
single_backstroke_delete
=
this
.
options
.
single_backstroke_delete
!=
null
?
this
.
options
.
single_backstroke_delete
:
true
;
this
.
max_selected_options
=
this
.
options
.
max_selected_options
||
Infinity
;
this
.
inherit_select_classes
=
this
.
options
.
inherit_select_classes
||
false
;
this
.
display_selected_options
=
this
.
options
.
display_selected_options
!=
null
?
this
.
options
.
display_selected_options
:
true
;
return
this
.
display_disabled_options
=
this
.
options
.
display_disabled_options
!=
null
?
this
.
options
.
display_disabled_options
:
true
;
};
AbstractChosen
.
prototype
.
set_default_text
=
function
()
{
if
(
this
.
form_field
.
getAttribute
(
"data-placeholder"
))
{
this
.
default_text
=
this
.
form_field
.
getAttribute
(
"data-placeholder"
);
}
else
if
(
this
.
is_multiple
)
{
this
.
default_text
=
this
.
options
.
placeholder_text_multiple
||
this
.
options
.
placeholder_text
||
AbstractChosen
.
default_multiple_text
;
}
else
{
this
.
default_text
=
this
.
options
.
placeholder_text_single
||
this
.
options
.
placeholder_text
||
AbstractChosen
.
default_single_text
;
}
return
this
.
results_none_found
=
this
.
form_field
.
getAttribute
(
"data-no_results_text"
)
||
this
.
options
.
no_results_text
||
AbstractChosen
.
default_no_result_text
;
};
AbstractChosen
.
prototype
.
mouse_enter
=
function
()
{
return
this
.
mouse_on_container
=
true
;
};
AbstractChosen
.
prototype
.
mouse_leave
=
function
()
{
return
this
.
mouse_on_container
=
false
;
};
AbstractChosen
.
prototype
.
input_focus
=
function
(
evt
)
{
var
_this
=
this
;
if
(
this
.
is_multiple
)
{
if
(
!
this
.
active_field
)
{
return
setTimeout
((
function
()
{
return
_this
.
container_mousedown
();
}),
50
);
}
}
else
{
if
(
!
this
.
active_field
)
{
return
this
.
activate_field
();
}
}
};
AbstractChosen
.
prototype
.
input_blur
=
function
(
evt
)
{
var
_this
=
this
;
if
(
!
this
.
mouse_on_container
)
{
this
.
active_field
=
false
;
return
setTimeout
((
function
()
{
return
_this
.
blur_test
();
}),
100
);
}
};
AbstractChosen
.
prototype
.
results_option_build
=
function
(
options
)
{
var
content
,
data
,
_i
,
_len
,
_ref
;
content
=
''
;
_ref
=
this
.
results_data
;
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
data
=
_ref
[
_i
];
if
(
data
.
group
)
{
content
+=
this
.
result_add_group
(
data
);
}
else
{
content
+=
this
.
result_add_option
(
data
);
}
if
(
options
!=
null
?
options
.
first
:
void
0
)
{
if
(
data
.
selected
&&
this
.
is_multiple
)
{
this
.
choice_build
(
data
);
}
else
if
(
data
.
selected
&&
!
this
.
is_multiple
)
{
this
.
single_set_selected_text
(
data
.
text
);
}
}
}
return
content
;
};
AbstractChosen
.
prototype
.
result_add_option
=
function
(
option
)
{
var
classes
,
option_el
;
if
(
!
option
.
search_match
)
{
return
''
;
}
if
(
!
this
.
include_option_in_results
(
option
))
{
return
''
;
}
classes
=
[];
if
(
!
option
.
disabled
&&
!
(
option
.
selected
&&
this
.
is_multiple
))
{
classes
.
push
(
"active-result"
);
}
if
(
option
.
disabled
&&
!
(
option
.
selected
&&
this
.
is_multiple
))
{
classes
.
push
(
"disabled-result"
);
}
if
(
option
.
selected
)
{
classes
.
push
(
"result-selected"
);
}
if
(
option
.
group_array_index
!=
null
)
{
classes
.
push
(
"group-option"
);
}
if
(
option
.
classes
!==
""
)
{
classes
.
push
(
option
.
classes
);
}
option_el
=
document
.
createElement
(
"li"
);
option_el
.
className
=
classes
.
join
(
" "
);
option_el
.
style
.
cssText
=
option
.
style
;
option_el
.
setAttribute
(
"data-option-array-index"
,
option
.
array_index
);
option_el
.
innerHTML
=
option
.
search_text
;
return
this
.
outerHTML
(
option_el
);
};
AbstractChosen
.
prototype
.
result_add_group
=
function
(
group
)
{
var
group_el
;
if
(
!
(
group
.
search_match
||
group
.
group_match
))
{
return
''
;
}
if
(
!
(
group
.
active_options
>
0
))
{
return
''
;
}
group_el
=
document
.
createElement
(
"li"
);
group_el
.
className
=
"group-result"
;
group_el
.
innerHTML
=
group
.
search_text
;
return
this
.
outerHTML
(
group_el
);
};
AbstractChosen
.
prototype
.
results_update_field
=
function
()
{
this
.
set_default_text
();
if
(
!
this
.
is_multiple
)
{
this
.
results_reset_cleanup
();
}
this
.
result_clear_highlight
();
this
.
results_build
();
if
(
this
.
results_showing
)
{
return
this
.
winnow_results
();
}
};
AbstractChosen
.
prototype
.
reset_single_select_options
=
function
()
{
var
result
,
_i
,
_len
,
_ref
,
_results
;
_ref
=
this
.
results_data
;
_results
=
[];
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
result
=
_ref
[
_i
];
if
(
result
.
selected
)
{
_results
.
push
(
result
.
selected
=
false
);
}
else
{
_results
.
push
(
void
0
);
}
}
return
_results
;
};
AbstractChosen
.
prototype
.
results_toggle
=
function
()
{
if
(
this
.
results_showing
)
{
return
this
.
results_hide
();
}
else
{
return
this
.
results_show
();
}
};
AbstractChosen
.
prototype
.
results_search
=
function
(
evt
)
{
if
(
this
.
results_showing
)
{
return
this
.
winnow_results
();
}
else
{
return
this
.
results_show
();
}
};
AbstractChosen
.
prototype
.
winnow_results
=
function
()
{
var
escapedSearchText
,
option
,
regex
,
regexAnchor
,
results
,
results_group
,
searchText
,
startpos
,
text
,
zregex
,
_i
,
_len
,
_ref
;
this
.
no_results_clear
();
results
=
0
;
searchText
=
this
.
get_search_text
();
escapedSearchText
=
searchText
.
replace
(
/
[
-[
\]
{}()*+?.,
\\
^$|#
\s]
/g
,
"
\\
$&"
);
regexAnchor
=
this
.
search_contains
?
""
:
"^"
;
regex
=
new
RegExp
(
regexAnchor
+
escapedSearchText
,
'i'
);
zregex
=
new
RegExp
(
escapedSearchText
,
'i'
);
_ref
=
this
.
results_data
;
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
option
=
_ref
[
_i
];
option
.
search_match
=
false
;
results_group
=
null
;
if
(
this
.
include_option_in_results
(
option
))
{
if
(
option
.
group
)
{
option
.
group_match
=
false
;
option
.
active_options
=
0
;
}
if
((
option
.
group_array_index
!=
null
)
&&
this
.
results_data
[
option
.
group_array_index
])
{
results_group
=
this
.
results_data
[
option
.
group_array_index
];
if
(
results_group
.
active_options
===
0
&&
results_group
.
search_match
)
{
results
+=
1
;
}
results_group
.
active_options
+=
1
;
}
if
(
!
(
option
.
group
&&
!
this
.
group_search
))
{
option
.
search_text
=
option
.
group
?
option
.
label
:
option
.
html
;
option
.
search_match
=
this
.
search_string_match
(
option
.
search_text
,
regex
);
if
(
option
.
search_match
&&
!
option
.
group
)
{
results
+=
1
;
}
if
(
option
.
search_match
)
{
if
(
searchText
.
length
)
{
startpos
=
option
.
search_text
.
search
(
zregex
);
text
=
option
.
search_text
.
substr
(
0
,
startpos
+
searchText
.
length
)
+
'</em>'
+
option
.
search_text
.
substr
(
startpos
+
searchText
.
length
);
option
.
search_text
=
text
.
substr
(
0
,
startpos
)
+
'<em>'
+
text
.
substr
(
startpos
);
}
if
(
results_group
!=
null
)
{
results_group
.
group_match
=
true
;
}
}
else
if
((
option
.
group_array_index
!=
null
)
&&
this
.
results_data
[
option
.
group_array_index
].
search_match
)
{
option
.
search_match
=
true
;
}
}
}
}
this
.
result_clear_highlight
();
if
(
results
<
1
&&
searchText
.
length
)
{
this
.
update_results_content
(
""
);
return
this
.
no_results
(
searchText
);
}
else
{
this
.
update_results_content
(
this
.
results_option_build
());
return
this
.
winnow_results_set_highlight
();
}
};
AbstractChosen
.
prototype
.
search_string_match
=
function
(
search_string
,
regex
)
{
var
part
,
parts
,
_i
,
_len
;
if
(
regex
.
test
(
search_string
))
{
return
true
;
}
else
if
(
this
.
enable_split_word_search
&&
(
search_string
.
indexOf
(
" "
)
>=
0
||
search_string
.
indexOf
(
"["
)
===
0
))
{
parts
=
search_string
.
replace
(
/
\[
|
\]
/g
,
""
).
split
(
" "
);
if
(
parts
.
length
)
{
for
(
_i
=
0
,
_len
=
parts
.
length
;
_i
<
_len
;
_i
++
)
{
part
=
parts
[
_i
];
if
(
regex
.
test
(
part
))
{
return
true
;
}
}
}
}
};
AbstractChosen
.
prototype
.
choices_count
=
function
()
{
var
option
,
_i
,
_len
,
_ref
;
if
(
this
.
selected_option_count
!=
null
)
{
return
this
.
selected_option_count
;
}
this
.
selected_option_count
=
0
;
_ref
=
this
.
form_field
.
options
;
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
option
=
_ref
[
_i
];
if
(
option
.
selected
)
{
this
.
selected_option_count
+=
1
;
}
}
return
this
.
selected_option_count
;
};
AbstractChosen
.
prototype
.
choices_click
=
function
(
evt
)
{
evt
.
preventDefault
();
if
(
!
(
this
.
results_showing
||
this
.
is_disabled
))
{
return
this
.
results_show
();
}
};
AbstractChosen
.
prototype
.
keyup_checker
=
function
(
evt
)
{
var
stroke
,
_ref
;
stroke
=
(
_ref
=
evt
.
which
)
!=
null
?
_ref
:
evt
.
keyCode
;
this
.
search_field_scale
();
switch
(
stroke
)
{
case
8
:
if
(
this
.
is_multiple
&&
this
.
backstroke_length
<
1
&&
this
.
choices_count
()
>
0
)
{
return
this
.
keydown_backstroke
();
}
else
if
(
!
this
.
pending_backstroke
)
{
this
.
result_clear_highlight
();
return
this
.
results_search
();
}
break
;
case
13
:
evt
.
preventDefault
();
if
(
this
.
results_showing
)
{
return
this
.
result_select
(
evt
);
}
break
;
case
27
:
if
(
this
.
results_showing
)
{
this
.
results_hide
();
}
return
true
;
case
9
:
case
38
:
case
40
:
case
16
:
case
91
:
case
17
:
break
;
default
:
return
this
.
results_search
();
}
};
AbstractChosen
.
prototype
.
clipboard_event_checker
=
function
(
evt
)
{
var
_this
=
this
;
return
setTimeout
((
function
()
{
return
_this
.
results_search
();
}),
50
);
};
AbstractChosen
.
prototype
.
container_width
=
function
()
{
if
(
this
.
options
.
width
!=
null
)
{
return
this
.
options
.
width
;
}
else
{
return
""
+
this
.
form_field
.
offsetWidth
+
"px"
;
}
};
AbstractChosen
.
prototype
.
include_option_in_results
=
function
(
option
)
{
if
(
this
.
is_multiple
&&
(
!
this
.
display_selected_options
&&
option
.
selected
))
{
return
false
;
}
if
(
!
this
.
display_disabled_options
&&
option
.
disabled
)
{
return
false
;
}
if
(
option
.
empty
)
{
return
false
;
}
return
true
;
};
AbstractChosen
.
prototype
.
search_results_touchstart
=
function
(
evt
)
{
this
.
touch_started
=
true
;
return
this
.
search_results_mouseover
(
evt
);
};
AbstractChosen
.
prototype
.
search_results_touchmove
=
function
(
evt
)
{
this
.
touch_started
=
false
;
return
this
.
search_results_mouseout
(
evt
);
};
AbstractChosen
.
prototype
.
search_results_touchend
=
function
(
evt
)
{
if
(
this
.
touch_started
)
{
return
this
.
search_results_mouseup
(
evt
);
}
};
AbstractChosen
.
prototype
.
outerHTML
=
function
(
element
)
{
var
tmp
;
if
(
element
.
outerHTML
)
{
return
element
.
outerHTML
;
}
tmp
=
document
.
createElement
(
"div"
);
tmp
.
appendChild
(
element
);
return
tmp
.
innerHTML
;
};
AbstractChosen
.
browser_is_supported
=
function
()
{
if
(
window
.
navigator
.
appName
===
"Microsoft Internet Explorer"
)
{
return
document
.
documentMode
>=
8
;
}
if
(
/iP
(
od|hone
)
/i
.
test
(
window
.
navigator
.
userAgent
))
{
return
false
;
}
if
(
/Android/i
.
test
(
window
.
navigator
.
userAgent
))
{
if
(
/Mobile/i
.
test
(
window
.
navigator
.
userAgent
))
{
return
false
;
}
}
return
true
;
};
AbstractChosen
.
default_multiple_text
=
"Select Some Options"
;
AbstractChosen
.
default_single_text
=
"Select an Option"
;
AbstractChosen
.
default_no_result_text
=
"No results match"
;
return
AbstractChosen
;
})();
$
=
jQuery
;
$
.
fn
.
extend
({
chosen
:
function
(
options
)
{
if
(
!
AbstractChosen
.
browser_is_supported
())
{
return
this
;
}
return
this
.
each
(
function
(
input_field
)
{
var
$this
,
chosen
;
$this
=
$
(
this
);
chosen
=
$this
.
data
(
'chosen'
);
if
(
options
===
'destroy'
&&
chosen
)
{
chosen
.
destroy
();
}
else
if
(
!
chosen
)
{
$this
.
data
(
'chosen'
,
new
Chosen
(
this
,
options
));
}
});
}
});
Chosen
=
(
function
(
_super
)
{
__extends
(
Chosen
,
_super
);
function
Chosen
()
{
_ref
=
Chosen
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref
;
}
Chosen
.
prototype
.
setup
=
function
()
{
this
.
form_field_jq
=
$
(
this
.
form_field
);
this
.
current_selectedIndex
=
this
.
form_field
.
selectedIndex
;
return
this
.
is_rtl
=
this
.
form_field_jq
.
hasClass
(
"chosen-rtl"
);
};
Chosen
.
prototype
.
set_up_html
=
function
()
{
var
container_classes
,
container_props
;
container_classes
=
[
"chosen-container"
];
container_classes
.
push
(
"chosen-container-"
+
(
this
.
is_multiple
?
"multi"
:
"single"
));
if
(
this
.
inherit_select_classes
&&
this
.
form_field
.
className
)
{
container_classes
.
push
(
this
.
form_field
.
className
);
}
if
(
this
.
is_rtl
)
{
container_classes
.
push
(
"chosen-rtl"
);
}
container_props
=
{
'class'
:
container_classes
.
join
(
' '
),
'style'
:
"width: "
+
(
this
.
container_width
())
+
";"
,
'title'
:
this
.
form_field
.
title
};
if
(
this
.
form_field
.
id
.
length
)
{
container_props
.
id
=
this
.
form_field
.
id
.
replace
(
/
[^\w]
/g
,
'_'
)
+
"_chosen"
;
}
this
.
container
=
$
(
"<div />"
,
container_props
);
if
(
this
.
is_multiple
)
{
this
.
container
.
html
(
'<ul class="chosen-choices"><li class="search-field"><input type="text" value="'
+
this
.
default_text
+
'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'
);
}
else
{
this
.
container
.
html
(
'<a class="chosen-single chosen-default" tabindex="-1"><span>'
+
this
.
default_text
+
'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'
);
}
this
.
form_field_jq
.
hide
().
after
(
this
.
container
);
this
.
dropdown
=
this
.
container
.
find
(
'div.chosen-drop'
).
first
();
this
.
search_field
=
this
.
container
.
find
(
'input'
).
first
();
this
.
search_results
=
this
.
container
.
find
(
'ul.chosen-results'
).
first
();
this
.
search_field_scale
();
this
.
search_no_results
=
this
.
container
.
find
(
'li.no-results'
).
first
();
if
(
this
.
is_multiple
)
{
this
.
search_choices
=
this
.
container
.
find
(
'ul.chosen-choices'
).
first
();
this
.
search_container
=
this
.
container
.
find
(
'li.search-field'
).
first
();
}
else
{
this
.
search_container
=
this
.
container
.
find
(
'div.chosen-search'
).
first
();
this
.
selected_item
=
this
.
container
.
find
(
'.chosen-single'
).
first
();
}
this
.
results_build
();
this
.
set_tab_index
();
this
.
set_label_behavior
();
return
this
.
form_field_jq
.
trigger
(
"chosen:ready"
,
{
chosen
:
this
});
};
Chosen
.
prototype
.
register_observers
=
function
()
{
var
_this
=
this
;
this
.
container
.
bind
(
'mousedown.chosen'
,
function
(
evt
)
{
_this
.
container_mousedown
(
evt
);
});
this
.
container
.
bind
(
'mouseup.chosen'
,
function
(
evt
)
{
_this
.
container_mouseup
(
evt
);
});
this
.
container
.
bind
(
'mouseenter.chosen'
,
function
(
evt
)
{
_this
.
mouse_enter
(
evt
);
});
this
.
container
.
bind
(
'mouseleave.chosen'
,
function
(
evt
)
{
_this
.
mouse_leave
(
evt
);
});
this
.
search_results
.
bind
(
'mouseup.chosen'
,
function
(
evt
)
{
_this
.
search_results_mouseup
(
evt
);
});
this
.
search_results
.
bind
(
'mouseover.chosen'
,
function
(
evt
)
{
_this
.
search_results_mouseover
(
evt
);
});
this
.
search_results
.
bind
(
'mouseout.chosen'
,
function
(
evt
)
{
_this
.
search_results_mouseout
(
evt
);
});
this
.
search_results
.
bind
(
'mousewheel.chosen DOMMouseScroll.chosen'
,
function
(
evt
)
{
_this
.
search_results_mousewheel
(
evt
);
});
this
.
search_results
.
bind
(
'touchstart.chosen'
,
function
(
evt
)
{
_this
.
search_results_touchstart
(
evt
);
});
this
.
search_results
.
bind
(
'touchmove.chosen'
,
function
(
evt
)
{
_this
.
search_results_touchmove
(
evt
);
});
this
.
search_results
.
bind
(
'touchend.chosen'
,
function
(
evt
)
{
_this
.
search_results_touchend
(
evt
);
});
this
.
form_field_jq
.
bind
(
"chosen:updated.chosen"
,
function
(
evt
)
{
_this
.
results_update_field
(
evt
);
});
this
.
form_field_jq
.
bind
(
"chosen:activate.chosen"
,
function
(
evt
)
{
_this
.
activate_field
(
evt
);
});
this
.
form_field_jq
.
bind
(
"chosen:open.chosen"
,
function
(
evt
)
{
_this
.
container_mousedown
(
evt
);
});
this
.
form_field_jq
.
bind
(
"chosen:close.chosen"
,
function
(
evt
)
{
_this
.
input_blur
(
evt
);
});
this
.
search_field
.
bind
(
'blur.chosen'
,
function
(
evt
)
{
_this
.
input_blur
(
evt
);
});
this
.
search_field
.
bind
(
'keyup.chosen'
,
function
(
evt
)
{
_this
.
keyup_checker
(
evt
);
});
this
.
search_field
.
bind
(
'keydown.chosen'
,
function
(
evt
)
{
_this
.
keydown_checker
(
evt
);
});
this
.
search_field
.
bind
(
'focus.chosen'
,
function
(
evt
)
{
_this
.
input_focus
(
evt
);
});
this
.
search_field
.
bind
(
'cut.chosen'
,
function
(
evt
)
{
_this
.
clipboard_event_checker
(
evt
);
});
this
.
search_field
.
bind
(
'paste.chosen'
,
function
(
evt
)
{
_this
.
clipboard_event_checker
(
evt
);
});
if
(
this
.
is_multiple
)
{
return
this
.
search_choices
.
bind
(
'click.chosen'
,
function
(
evt
)
{
_this
.
choices_click
(
evt
);
});
}
else
{
return
this
.
container
.
bind
(
'click.chosen'
,
function
(
evt
)
{
evt
.
preventDefault
();
});
}
};
Chosen
.
prototype
.
destroy
=
function
()
{
$
(
this
.
container
[
0
].
ownerDocument
).
unbind
(
"click.chosen"
,
this
.
click_test_action
);
if
(
this
.
search_field
[
0
].
tabIndex
)
{
this
.
form_field_jq
[
0
].
tabIndex
=
this
.
search_field
[
0
].
tabIndex
;
}
this
.
container
.
remove
();
this
.
form_field_jq
.
removeData
(
'chosen'
);
return
this
.
form_field_jq
.
show
();
};
Chosen
.
prototype
.
search_field_disabled
=
function
()
{
this
.
is_disabled
=
this
.
form_field_jq
[
0
].
disabled
;
if
(
this
.
is_disabled
)
{
this
.
container
.
addClass
(
'chosen-disabled'
);
this
.
search_field
[
0
].
disabled
=
true
;
if
(
!
this
.
is_multiple
)
{
this
.
selected_item
.
unbind
(
"focus.chosen"
,
this
.
activate_action
);
}
return
this
.
close_field
();
}
else
{
this
.
container
.
removeClass
(
'chosen-disabled'
);
this
.
search_field
[
0
].
disabled
=
false
;
if
(
!
this
.
is_multiple
)
{
return
this
.
selected_item
.
bind
(
"focus.chosen"
,
this
.
activate_action
);
}
}
};
Chosen
.
prototype
.
container_mousedown
=
function
(
evt
)
{
if
(
!
this
.
is_disabled
)
{
if
(
evt
&&
evt
.
type
===
"mousedown"
&&
!
this
.
results_showing
)
{
evt
.
preventDefault
();
}
if
(
!
((
evt
!=
null
)
&&
(
$
(
evt
.
target
)).
hasClass
(
"search-choice-close"
)))
{
if
(
!
this
.
active_field
)
{
if
(
this
.
is_multiple
)
{
this
.
search_field
.
val
(
""
);
}
$
(
this
.
container
[
0
].
ownerDocument
).
bind
(
'click.chosen'
,
this
.
click_test_action
);
this
.
results_show
();
}
else
if
(
!
this
.
is_multiple
&&
evt
&&
((
$
(
evt
.
target
)[
0
]
===
this
.
selected_item
[
0
])
||
$
(
evt
.
target
).
parents
(
"a.chosen-single"
).
length
))
{
evt
.
preventDefault
();
this
.
results_toggle
();
}
return
this
.
activate_field
();
}
}
};
Chosen
.
prototype
.
container_mouseup
=
function
(
evt
)
{
if
(
evt
.
target
.
nodeName
===
"ABBR"
&&
!
this
.
is_disabled
)
{
return
this
.
results_reset
(
evt
);
}
};
Chosen
.
prototype
.
search_results_mousewheel
=
function
(
evt
)
{
var
delta
;
if
(
evt
.
originalEvent
)
{
delta
=
-
evt
.
originalEvent
.
wheelDelta
||
evt
.
originalEvent
.
detail
;
}
if
(
delta
!=
null
)
{
evt
.
preventDefault
();
if
(
evt
.
type
===
'DOMMouseScroll'
)
{
delta
=
delta
*
40
;
}
return
this
.
search_results
.
scrollTop
(
delta
+
this
.
search_results
.
scrollTop
());
}
};
Chosen
.
prototype
.
blur_test
=
function
(
evt
)
{
if
(
!
this
.
active_field
&&
this
.
container
.
hasClass
(
"chosen-container-active"
))
{
return
this
.
close_field
();
}
};
Chosen
.
prototype
.
close_field
=
function
()
{
$
(
this
.
container
[
0
].
ownerDocument
).
unbind
(
"click.chosen"
,
this
.
click_test_action
);
this
.
active_field
=
false
;
this
.
results_hide
();
this
.
container
.
removeClass
(
"chosen-container-active"
);
this
.
clear_backstroke
();
this
.
show_search_field_default
();
return
this
.
search_field_scale
();
};
Chosen
.
prototype
.
activate_field
=
function
()
{
this
.
container
.
addClass
(
"chosen-container-active"
);
this
.
active_field
=
true
;
this
.
search_field
.
val
(
this
.
search_field
.
val
());
return
this
.
search_field
.
focus
();
};
Chosen
.
prototype
.
test_active_click
=
function
(
evt
)
{
var
active_container
;
active_container
=
$
(
evt
.
target
).
closest
(
'.chosen-container'
);
if
(
active_container
.
length
&&
this
.
container
[
0
]
===
active_container
[
0
])
{
return
this
.
active_field
=
true
;
}
else
{
return
this
.
close_field
();
}
};
Chosen
.
prototype
.
results_build
=
function
()
{
this
.
parsing
=
true
;
this
.
selected_option_count
=
null
;
this
.
results_data
=
SelectParser
.
select_to_array
(
this
.
form_field
);
if
(
this
.
is_multiple
)
{
this
.
search_choices
.
find
(
"li.search-choice"
).
remove
();
}
else
if
(
!
this
.
is_multiple
)
{
this
.
single_set_selected_text
();
if
(
this
.
disable_search
||
this
.
form_field
.
options
.
length
<=
this
.
disable_search_threshold
)
{
this
.
search_field
[
0
].
readOnly
=
true
;
this
.
container
.
addClass
(
"chosen-container-single-nosearch"
);
}
else
{
this
.
search_field
[
0
].
readOnly
=
false
;
this
.
container
.
removeClass
(
"chosen-container-single-nosearch"
);
}
}
this
.
update_results_content
(
this
.
results_option_build
({
first
:
true
}));
this
.
search_field_disabled
();
this
.
show_search_field_default
();
this
.
search_field_scale
();
return
this
.
parsing
=
false
;
};
Chosen
.
prototype
.
result_do_highlight
=
function
(
el
)
{
var
high_bottom
,
high_top
,
maxHeight
,
visible_bottom
,
visible_top
;
if
(
el
.
length
)
{
this
.
result_clear_highlight
();
this
.
result_highlight
=
el
;
this
.
result_highlight
.
addClass
(
"highlighted"
);
maxHeight
=
parseInt
(
this
.
search_results
.
css
(
"maxHeight"
),
10
);
visible_top
=
this
.
search_results
.
scrollTop
();
visible_bottom
=
maxHeight
+
visible_top
;
high_top
=
this
.
result_highlight
.
position
().
top
+
this
.
search_results
.
scrollTop
();
high_bottom
=
high_top
+
this
.
result_highlight
.
outerHeight
();
if
(
high_bottom
>=
visible_bottom
)
{
return
this
.
search_results
.
scrollTop
((
high_bottom
-
maxHeight
)
>
0
?
high_bottom
-
maxHeight
:
0
);
}
else
if
(
high_top
<
visible_top
)
{
return
this
.
search_results
.
scrollTop
(
high_top
);
}
}
};
Chosen
.
prototype
.
result_clear_highlight
=
function
()
{
if
(
this
.
result_highlight
)
{
this
.
result_highlight
.
removeClass
(
"highlighted"
);
}
return
this
.
result_highlight
=
null
;
};
Chosen
.
prototype
.
results_show
=
function
()
{
if
(
this
.
is_multiple
&&
this
.
max_selected_options
<=
this
.
choices_count
())
{
this
.
form_field_jq
.
trigger
(
"chosen:maxselected"
,
{
chosen
:
this
});
return
false
;
}
this
.
container
.
addClass
(
"chosen-with-drop"
);
this
.
results_showing
=
true
;
this
.
search_field
.
focus
();
this
.
search_field
.
val
(
this
.
search_field
.
val
());
this
.
winnow_results
();
return
this
.
form_field_jq
.
trigger
(
"chosen:showing_dropdown"
,
{
chosen
:
this
});
};
Chosen
.
prototype
.
update_results_content
=
function
(
content
)
{
return
this
.
search_results
.
html
(
content
);
};
Chosen
.
prototype
.
results_hide
=
function
()
{
if
(
this
.
results_showing
)
{
this
.
result_clear_highlight
();
this
.
container
.
removeClass
(
"chosen-with-drop"
);
this
.
form_field_jq
.
trigger
(
"chosen:hiding_dropdown"
,
{
chosen
:
this
});
}
return
this
.
results_showing
=
false
;
};
Chosen
.
prototype
.
set_tab_index
=
function
(
el
)
{
var
ti
;
if
(
this
.
form_field
.
tabIndex
)
{
ti
=
this
.
form_field
.
tabIndex
;
this
.
form_field
.
tabIndex
=
-
1
;
return
this
.
search_field
[
0
].
tabIndex
=
ti
;
}
};
Chosen
.
prototype
.
set_label_behavior
=
function
()
{
var
_this
=
this
;
this
.
form_field_label
=
this
.
form_field_jq
.
parents
(
"label"
);
if
(
!
this
.
form_field_label
.
length
&&
this
.
form_field
.
id
.
length
)
{
this
.
form_field_label
=
$
(
"label[for='"
+
this
.
form_field
.
id
+
"']"
);
}
if
(
this
.
form_field_label
.
length
>
0
)
{
return
this
.
form_field_label
.
bind
(
'click.chosen'
,
function
(
evt
)
{
if
(
_this
.
is_multiple
)
{
return
_this
.
container_mousedown
(
evt
);
}
else
{
return
_this
.
activate_field
();
}
});
}
};
Chosen
.
prototype
.
show_search_field_default
=
function
()
{
if
(
this
.
is_multiple
&&
this
.
choices_count
()
<
1
&&
!
this
.
active_field
)
{
this
.
search_field
.
val
(
this
.
default_text
);
return
this
.
search_field
.
addClass
(
"default"
);
}
else
{
this
.
search_field
.
val
(
""
);
return
this
.
search_field
.
removeClass
(
"default"
);
}
};
Chosen
.
prototype
.
search_results_mouseup
=
function
(
evt
)
{
var
target
;
target
=
$
(
evt
.
target
).
hasClass
(
"active-result"
)
?
$
(
evt
.
target
)
:
$
(
evt
.
target
).
parents
(
".active-result"
).
first
();
if
(
target
.
length
)
{
this
.
result_highlight
=
target
;
this
.
result_select
(
evt
);
return
this
.
search_field
.
focus
();
}
};
Chosen
.
prototype
.
search_results_mouseover
=
function
(
evt
)
{
var
target
;
target
=
$
(
evt
.
target
).
hasClass
(
"active-result"
)
?
$
(
evt
.
target
)
:
$
(
evt
.
target
).
parents
(
".active-result"
).
first
();
if
(
target
)
{
return
this
.
result_do_highlight
(
target
);
}
};
Chosen
.
prototype
.
search_results_mouseout
=
function
(
evt
)
{
if
(
$
(
evt
.
target
).
hasClass
(
"active-result"
||
$
(
evt
.
target
).
parents
(
'.active-result'
).
first
()))
{
return
this
.
result_clear_highlight
();
}
};
Chosen
.
prototype
.
choice_build
=
function
(
item
)
{
var
choice
,
close_link
,
_this
=
this
;
choice
=
$
(
'<li />'
,
{
"class"
:
"search-choice"
}).
html
(
"<span>"
+
item
.
html
+
"</span>"
);
if
(
item
.
disabled
)
{
choice
.
addClass
(
'search-choice-disabled'
);
}
else
{
close_link
=
$
(
'<a />'
,
{
"class"
:
'search-choice-close'
,
'data-option-array-index'
:
item
.
array_index
});
close_link
.
bind
(
'click.chosen'
,
function
(
evt
)
{
return
_this
.
choice_destroy_link_click
(
evt
);
});
choice
.
append
(
close_link
);
}
return
this
.
search_container
.
before
(
choice
);
};
Chosen
.
prototype
.
choice_destroy_link_click
=
function
(
evt
)
{
evt
.
preventDefault
();
evt
.
stopPropagation
();
if
(
!
this
.
is_disabled
)
{
return
this
.
choice_destroy
(
$
(
evt
.
target
));
}
};
Chosen
.
prototype
.
choice_destroy
=
function
(
link
)
{
if
(
this
.
result_deselect
(
link
[
0
].
getAttribute
(
"data-option-array-index"
)))
{
this
.
show_search_field_default
();
if
(
this
.
is_multiple
&&
this
.
choices_count
()
>
0
&&
this
.
search_field
.
val
().
length
<
1
)
{
this
.
results_hide
();
}
link
.
parents
(
'li'
).
first
().
remove
();
return
this
.
search_field_scale
();
}
};
Chosen
.
prototype
.
results_reset
=
function
()
{
this
.
reset_single_select_options
();
this
.
form_field
.
options
[
0
].
selected
=
true
;
this
.
single_set_selected_text
();
this
.
show_search_field_default
();
this
.
results_reset_cleanup
();
this
.
form_field_jq
.
trigger
(
"change"
);
if
(
this
.
active_field
)
{
return
this
.
results_hide
();
}
};
Chosen
.
prototype
.
results_reset_cleanup
=
function
()
{
this
.
current_selectedIndex
=
this
.
form_field
.
selectedIndex
;
return
this
.
selected_item
.
find
(
"abbr"
).
remove
();
};
Chosen
.
prototype
.
result_select
=
function
(
evt
)
{
var
high
,
item
;
if
(
this
.
result_highlight
)
{
high
=
this
.
result_highlight
;
this
.
result_clear_highlight
();
if
(
this
.
is_multiple
&&
this
.
max_selected_options
<=
this
.
choices_count
())
{
this
.
form_field_jq
.
trigger
(
"chosen:maxselected"
,
{
chosen
:
this
});
return
false
;
}
if
(
this
.
is_multiple
)
{
high
.
removeClass
(
"active-result"
);
}
else
{
this
.
reset_single_select_options
();
}
item
=
this
.
results_data
[
high
[
0
].
getAttribute
(
"data-option-array-index"
)];
item
.
selected
=
true
;
this
.
form_field
.
options
[
item
.
options_index
].
selected
=
true
;
this
.
selected_option_count
=
null
;
if
(
this
.
is_multiple
)
{
this
.
choice_build
(
item
);
}
else
{
this
.
single_set_selected_text
(
item
.
text
);
}
if
(
!
((
evt
.
metaKey
||
evt
.
ctrlKey
)
&&
this
.
is_multiple
))
{
this
.
results_hide
();
}
this
.
search_field
.
val
(
""
);
if
(
this
.
is_multiple
||
this
.
form_field
.
selectedIndex
!==
this
.
current_selectedIndex
)
{
this
.
form_field_jq
.
trigger
(
"change"
,
{
'selected'
:
this
.
form_field
.
options
[
item
.
options_index
].
value
});
}
this
.
current_selectedIndex
=
this
.
form_field
.
selectedIndex
;
return
this
.
search_field_scale
();
}
};
Chosen
.
prototype
.
single_set_selected_text
=
function
(
text
)
{
if
(
text
==
null
)
{
text
=
this
.
default_text
;
}
if
(
text
===
this
.
default_text
)
{
this
.
selected_item
.
addClass
(
"chosen-default"
);
}
else
{
this
.
single_deselect_control_build
();
this
.
selected_item
.
removeClass
(
"chosen-default"
);
}
return
this
.
selected_item
.
find
(
"span"
).
text
(
text
);
};
Chosen
.
prototype
.
result_deselect
=
function
(
pos
)
{
var
result_data
;
result_data
=
this
.
results_data
[
pos
];
if
(
!
this
.
form_field
.
options
[
result_data
.
options_index
].
disabled
)
{
result_data
.
selected
=
false
;
this
.
form_field
.
options
[
result_data
.
options_index
].
selected
=
false
;
this
.
selected_option_count
=
null
;
this
.
result_clear_highlight
();
if
(
this
.
results_showing
)
{
this
.
winnow_results
();
}
this
.
form_field_jq
.
trigger
(
"change"
,
{
deselected
:
this
.
form_field
.
options
[
result_data
.
options_index
].
value
});
this
.
search_field_scale
();
return
true
;
}
else
{
return
false
;
}
};
Chosen
.
prototype
.
single_deselect_control_build
=
function
()
{
if
(
!
this
.
allow_single_deselect
)
{
return
;
}
if
(
!
this
.
selected_item
.
find
(
"abbr"
).
length
)
{
this
.
selected_item
.
find
(
"span"
).
first
().
after
(
"<abbr class=
\"
search-choice-close
\"
></abbr>"
);
}
return
this
.
selected_item
.
addClass
(
"chosen-single-with-deselect"
);
};
Chosen
.
prototype
.
get_search_text
=
function
()
{
if
(
this
.
search_field
.
val
()
===
this
.
default_text
)
{
return
""
;
}
else
{
return
$
(
'<div/>'
).
text
(
$
.
trim
(
this
.
search_field
.
val
())).
html
();
}
};
Chosen
.
prototype
.
winnow_results_set_highlight
=
function
()
{
var
do_high
,
selected_results
;
selected_results
=
!
this
.
is_multiple
?
this
.
search_results
.
find
(
".result-selected.active-result"
)
:
[];
do_high
=
selected_results
.
length
?
selected_results
.
first
()
:
this
.
search_results
.
find
(
".active-result"
).
first
();
if
(
do_high
!=
null
)
{
return
this
.
result_do_highlight
(
do_high
);
}
};
Chosen
.
prototype
.
no_results
=
function
(
terms
)
{
var
no_results_html
;
no_results_html
=
$
(
'<li class="no-results">'
+
this
.
results_none_found
+
' "<span></span>"</li>'
);
no_results_html
.
find
(
"span"
).
first
().
html
(
terms
);
this
.
search_results
.
append
(
no_results_html
);
return
this
.
form_field_jq
.
trigger
(
"chosen:no_results"
,
{
chosen
:
this
});
};
Chosen
.
prototype
.
no_results_clear
=
function
()
{
return
this
.
search_results
.
find
(
".no-results"
).
remove
();
};
Chosen
.
prototype
.
keydown_arrow
=
function
()
{
var
next_sib
;
if
(
this
.
results_showing
&&
this
.
result_highlight
)
{
next_sib
=
this
.
result_highlight
.
nextAll
(
"li.active-result"
).
first
();
if
(
next_sib
)
{
return
this
.
result_do_highlight
(
next_sib
);
}
}
else
{
return
this
.
results_show
();
}
};
Chosen
.
prototype
.
keyup_arrow
=
function
()
{
var
prev_sibs
;
if
(
!
this
.
results_showing
&&
!
this
.
is_multiple
)
{
return
this
.
results_show
();
}
else
if
(
this
.
result_highlight
)
{
prev_sibs
=
this
.
result_highlight
.
prevAll
(
"li.active-result"
);
if
(
prev_sibs
.
length
)
{
return
this
.
result_do_highlight
(
prev_sibs
.
first
());
}
else
{
if
(
this
.
choices_count
()
>
0
)
{
this
.
results_hide
();
}
return
this
.
result_clear_highlight
();
}
}
};
Chosen
.
prototype
.
keydown_backstroke
=
function
()
{
var
next_available_destroy
;
if
(
this
.
pending_backstroke
)
{
this
.
choice_destroy
(
this
.
pending_backstroke
.
find
(
"a"
).
first
());
return
this
.
clear_backstroke
();
}
else
{
next_available_destroy
=
this
.
search_container
.
siblings
(
"li.search-choice"
).
last
();
if
(
next_available_destroy
.
length
&&
!
next_available_destroy
.
hasClass
(
"search-choice-disabled"
))
{
this
.
pending_backstroke
=
next_available_destroy
;
if
(
this
.
single_backstroke_delete
)
{
return
this
.
keydown_backstroke
();
}
else
{
return
this
.
pending_backstroke
.
addClass
(
"search-choice-focus"
);
}
}
}
};
Chosen
.
prototype
.
clear_backstroke
=
function
()
{
if
(
this
.
pending_backstroke
)
{
this
.
pending_backstroke
.
removeClass
(
"search-choice-focus"
);
}
return
this
.
pending_backstroke
=
null
;
};
Chosen
.
prototype
.
keydown_checker
=
function
(
evt
)
{
var
stroke
,
_ref1
;
stroke
=
(
_ref1
=
evt
.
which
)
!=
null
?
_ref1
:
evt
.
keyCode
;
this
.
search_field_scale
();
if
(
stroke
!==
8
&&
this
.
pending_backstroke
)
{
this
.
clear_backstroke
();
}
switch
(
stroke
)
{
case
8
:
this
.
backstroke_length
=
this
.
search_field
.
val
().
length
;
break
;
case
9
:
if
(
this
.
results_showing
&&
!
this
.
is_multiple
)
{
this
.
result_select
(
evt
);
}
this
.
mouse_on_container
=
false
;
break
;
case
13
:
evt
.
preventDefault
();
break
;
case
38
:
evt
.
preventDefault
();
this
.
keyup_arrow
();
break
;
case
40
:
evt
.
preventDefault
();
this
.
keydown_arrow
();
break
;
}
};
Chosen
.
prototype
.
search_field_scale
=
function
()
{
var
div
,
f_width
,
h
,
style
,
style_block
,
styles
,
w
,
_i
,
_len
;
if
(
this
.
is_multiple
)
{
h
=
0
;
w
=
0
;
style_block
=
"position:absolute; left: -1000px; top: -1000px; display:none;"
;
styles
=
[
'font-size'
,
'font-style'
,
'font-weight'
,
'font-family'
,
'line-height'
,
'text-transform'
,
'letter-spacing'
];
for
(
_i
=
0
,
_len
=
styles
.
length
;
_i
<
_len
;
_i
++
)
{
style
=
styles
[
_i
];
style_block
+=
style
+
":"
+
this
.
search_field
.
css
(
style
)
+
";"
;
}
div
=
$
(
'<div />'
,
{
'style'
:
style_block
});
div
.
text
(
this
.
search_field
.
val
());
$
(
'body'
).
append
(
div
);
w
=
div
.
width
()
+
25
;
div
.
remove
();
f_width
=
this
.
container
.
outerWidth
();
if
(
w
>
f_width
-
10
)
{
w
=
f_width
-
10
;
}
return
this
.
search_field
.
css
({
'width'
:
w
+
'px'
});
}
};
return
Chosen
;
})(
AbstractChosen
);
}).
call
(
this
);
templates/jlog/log_filter.html
0 → 100644
View file @
53e4dc7a
{% extends 'base.html' %}
{% block self_head_css_js %}
<link
href=
"/static/css/plugins/datapicker/datepicker3.css"
rel=
"stylesheet"
>
<link
href=
"/static/css/plugins/chosen/chosen.css"
rel=
"stylesheet"
>
<script
src=
"/static/js/plugins/chosen/chosen.jquery.js"
></script>
{% endblock %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<div
class=
"ibox float-e-margins"
>
<div
id=
"ibox-content"
class=
"ibox-title"
>
<h5>
用户日志详细信息列表
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
"panel-options"
>
<ul
class=
"nav nav-tabs"
>
<li><a
href=
"/jlog/log_list/online/"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
在线
</a></li>
<li><a
href=
"/jlog/log_list/offline/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
历史记录
</a></li>
<li
class=
"active"
><a
href=
"/jlog/search/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
详细搜索
</a></li>
</ul>
</div>
<br/>
<div
class=
"tab-content"
>
<form
method=
"get"
action=
""
role=
"form"
class=
"form-inline"
>
<p>
选择相应条件进行搜索
</p>
<div
class=
"form-group"
id=
"data_5"
>
<div
class=
"input-daterange input-group"
id=
"datepicker"
>
<input
type=
"text"
class=
"input-sm form-control"
style=
"width: 100px;"
name=
"start"
value=
"{{ date_seven_day }}"
>
<span
class=
"input-group-addon"
>
to
</span>
<input
type=
"text"
class=
"input-sm form-control"
style=
"width: 100px;"
name=
"end"
value=
"{{ date_now_str }}"
>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"input-group"
>
<select
name=
"single"
data-placeholder=
"用户名"
class=
"chosen-select"
multiple
style=
"width:300px;"
tabindex=
"2"
>
<option
value=
"用户"
>
用户名
</option>
<option
value=
"Bolivia, Plurinational State of"
>
hongweiguang
</option>
<option
value=
"Bonaire, Sint Eustatius and Saba"
>
wangyong
</option>
<option
value=
"Bosnia and Herzegovina"
>
hehe
</option>
<option
value=
"Botswana"
>
wangyong
</option>
<option
value=
"Bouvet Island"
>
wangyongd
</option>
<option
value=
"Romania"
>
Romania
</option>
<option
value=
"Zambia"
>
Zambia
</option>
<option
value=
"Zimbabwe"
>
Zimbabwe
</option>
</select>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"input-group"
>
<select
name=
"multi"
data-placeholder=
"主机"
class=
"chosen-select"
multiple
style=
"width:200px;"
tabindex=
"4"
>
<option
value=
"主机"
>
主机
</option>
<option
value=
"United States"
>
172.16.1.1
</option>
<option
value=
"Afghanistan"
>
172.16.1.1
</option>
<option
value=
"Aland Islands"
>
172.16.1.1
</option>
<option
value=
"Albania"
>
172.16.1.1
</option>
<option
value=
"Algeria"
>
172.16.1.1
</option>
<option
value=
"American Samoa"
>
172.16.1.1
</option>
<option
value=
"Andorra"
>
172.16.1.1
</option>
<option
value=
"Angola"
>
172.16.1.1
</option>
<option
value=
"Anguilla"
>
172.16.1.1
</option>
<option
value=
"Antarctica"
>
172.16.1.1
</option>
</select>
</div>
</div>
<div
class=
"form-group"
>
<input
id=
"cmd"
name=
"cmd"
placeholder=
"命令"
type=
"text"
class=
"form-control"
style=
"width: 200px;"
>
</div>
<div
class=
"form-group"
>
<button
id=
"submit_button"
class=
"btn btn-primary"
type=
"submit"
>
搜索
</button>
</div>
</form>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
</div>
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function
log_search
(){
$
.
ajax
({
type
:
"GET"
,
url
:
"/jlog/search/?env=offline"
,
data
:
$
(
"#search_form"
).
serialize
(),
success
:
function
(
data
)
{
$
(
".tab-content"
).
html
(
data
);
}
});
}
$
(
document
).
ready
(
function
(){
$
(
'#data_5 .input-daterange'
).
datepicker
({
dateFormat
:
'yy-mm-dd'
,
keyboardNavigation
:
false
,
forceParse
:
false
,
autoclose
:
true
});
});
var
config
=
{
'.chosen-select'
:
{},
'.chosen-select-deselect'
:
{
allow_single_deselect
:
true
},
'.chosen-select-no-single'
:
{
disable_search_threshold
:
10
},
'.chosen-select-no-results'
:
{
no_results_text
:
'Oops, nothing found!'
},
'.chosen-select-width'
:
{
width
:
"95%"
}
};
for
(
var
selector
in
config
)
{
$
(
selector
).
chosen
(
config
[
selector
]);
}
</script>
{% endblock %}
{% block self_footer_js %}
<script
src=
"/static/js/cropper/cropper.min.js"
></script>
<script
src=
"/static/js/datapicker/bootstrap-datepicker.js"
></script>
<script
src=
"/static/js/plugins/chosen/chosen.jquery.js"
></script>
{% endblock %}
\ No newline at end of file
templates/jlog/log_offline.html
View file @
53e4dc7a
{% extends 'base.html' %}
{% extends 'base.html' %}
{% block self_head_css_js %}
{% block self_head_css_js %}
<link
href=
"/static/css/plugins/datapicker/datepicker3.css"
rel=
"stylesheet"
>
<link
href=
"/static/css/plugins/datapicker/datepicker3.css"
rel=
"stylesheet"
>
<link
href=
"/static/css/plugins/chosen/chosen.css"
rel=
"stylesheet"
>
<script
src=
"/static/js/plugins/chosen/chosen.jquery.js"
></script>
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
{% include 'nav_cat_bar.html' %}
{% include 'nav_cat_bar.html' %}
...
@@ -54,8 +56,13 @@
...
@@ -54,8 +56,13 @@
<ul
class=
"nav nav-tabs"
>
<ul
class=
"nav nav-tabs"
>
<li><a
href=
"/jlog/log_list/online/"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
在线
</a></li>
<li><a
href=
"/jlog/log_list/online/"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
在线
</a></li>
<li
class=
"active"
><a
href=
"/jlog/log_list/offline/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
历史记录
</a></li>
<li
class=
"active"
><a
href=
"/jlog/log_list/offline/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
历史记录
</a></li>
<li
style=
"float: right"
>
{#
<li><a
href=
"/jlog/search/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
详细搜索
</a></li>
#}
</ul>
</div>
<br/>
<form
class=
"form-inline"
action=
""
method=
"get"
>
<form
class=
"form-inline"
action=
""
method=
"get"
>
<div
class=
"form-group"
id=
"data_5"
>
<div
class=
"form-group"
id=
"data_5"
>
<div
class=
"form-group"
id=
"data_5"
>
<div
class=
"input-daterange input-group"
id=
"datepicker"
>
<div
class=
"input-daterange input-group"
id=
"datepicker"
>
<input
type=
"text"
class=
"input-sm form-control"
style=
"width: 100px;"
name=
"start"
value=
"{{ date_seven_day }}"
>
<input
type=
"text"
class=
"input-sm form-control"
style=
"width: 100px;"
name=
"start"
value=
"{{ date_seven_day }}"
>
...
@@ -64,16 +71,45 @@
...
@@ -64,16 +71,45 @@
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"keyword"
placeholder=
"Search"
>
<div
class=
"input-group"
>
<select
name=
"single"
data-placeholder=
"用户名"
class=
"chosen-select"
multiple
style=
"width:200px;"
tabindex=
"2"
>
<option
value=
"用户"
>
用户名
</option>
<option
value=
"Bolivia, Plurinational State of"
>
hongweiguang
</option>
<option
value=
"Bonaire, Sint Eustatius and Saba"
>
wangyong
</option>
<option
value=
"Bosnia and Herzegovina"
>
hehe
</option>
<option
value=
"Botswana"
>
wangyong
</option>
<option
value=
"Bouvet Island"
>
wangyongd
</option>
<option
value=
"Romania"
>
Romania
</option>
<option
value=
"Zambia"
>
Zambia
</option>
<option
value=
"Zimbabwe"
>
Zimbabwe
</option>
</select>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"input-group"
>
<select
name=
"multi"
data-placeholder=
"主机"
class=
"chosen-select"
multiple
style=
"width:200px;"
tabindex=
"4"
>
<option
value=
"主机"
>
主机
</option>
<option
value=
"United States"
>
172.16.1.1
</option>
<option
value=
"Afghanistan"
>
172.16.1.1
</option>
<option
value=
"Aland Islands"
>
172.16.1.1
</option>
<option
value=
"Albania"
>
172.16.1.1
</option>
<option
value=
"Algeria"
>
172.16.1.1
</option>
<option
value=
"American Samoa"
>
172.16.1.1
</option>
<option
value=
"Andorra"
>
172.16.1.1
</option>
<option
value=
"Angola"
>
172.16.1.1
</option>
<option
value=
"Anguilla"
>
172.16.1.1
</option>
<option
value=
"Antarctica"
>
172.16.1.1
</option>
</select>
</div>
</div>
<div
class=
"form-group"
>
<input
id=
"cmd"
name=
"cmd"
placeholder=
"命令"
type=
"text"
class=
"form-control"
style=
"width: 200px;"
>
</div>
</div>
</div>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
Search
Search
</button>
</button>
</form>
</form>
</li>
</ul>
</div>
<br/>
<div
class=
"tab-content"
>
<div
class=
"tab-content"
>
<table
class=
"table table-striped table-bordered table-hover "
>
<table
class=
"table table-striped table-bordered table-hover "
>
<thead>
<thead>
...
@@ -91,6 +127,7 @@
...
@@ -91,6 +127,7 @@
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
{% for post in contacts.object_list %}
{% for post in contacts.object_list %}
<tr
class=
"gradeX"
>
<tr
class=
"gradeX"
>
<td
class=
"text-center"
id=
"username"
>
{{ post.user }}
</td>
<td
class=
"text-center"
id=
"username"
>
{{ post.user }}
</td>
...
@@ -167,6 +204,17 @@
...
@@ -167,6 +204,17 @@
autoclose
:
true
autoclose
:
true
});
});
var
config
=
{
'.chosen-select'
:
{},
'.chosen-select-deselect'
:
{
allow_single_deselect
:
true
},
'.chosen-select-no-single'
:
{
disable_search_threshold
:
10
},
'.chosen-select-no-results'
:
{
no_results_text
:
'Oops, nothing found!'
},
'.chosen-select-width'
:
{
width
:
"95%"
}
};
for
(
var
selector
in
config
)
{
$
(
selector
).
chosen
(
config
[
selector
]);
}
</script>
</script>
{% endblock %}
{% endblock %}
{% block self_footer_js %}
{% block self_footer_js %}
...
...
templates/jlog/log_online.html
View file @
53e4dc7a
...
@@ -50,6 +50,7 @@
...
@@ -50,6 +50,7 @@
<ul
class=
"nav nav-tabs"
>
<ul
class=
"nav nav-tabs"
>
<li
class=
"active"
><a
href=
"/jlog/log_list/online/"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
在线
</a></li>
<li
class=
"active"
><a
href=
"/jlog/log_list/online/"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
在线
</a></li>
<li><a
href=
"/jlog/log_list/offline/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
历史记录
</a></li>
<li><a
href=
"/jlog/log_list/offline/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
历史记录
</a></li>
<li><a
href=
"/jlog/search/"
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
详细搜索
</a></li>
</ul>
</ul>
</div>
</div>
<br/>
<br/>
...
...
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