@ -0,0 +1,23 @@ |
||||
.autocomplete-suggestions { |
||||
-webkit-box-sizing: border-box; |
||||
-moz-box-sizing: border-box; |
||||
box-sizing: border-box; |
||||
border: 1px solid #999; |
||||
background: #FFF; |
||||
cursor: default; |
||||
overflow: auto; |
||||
-webkit-box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64); |
||||
-moz-box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64); |
||||
box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64); } |
||||
|
||||
.autocomplete-suggestion { padding: 2px 5px; white-space: nowrap; overflow: hidden; } |
||||
|
||||
.autocomplete-no-suggestion { padding: 2px 5px;} |
||||
|
||||
.autocomplete-selected { background: #F0F0F0; } |
||||
|
||||
.autocomplete-suggestions strong { font-weight: bold; color: #000; } |
||||
|
||||
.autocomplete-group { padding: 2px 5px; } |
||||
|
||||
.autocomplete-group strong { font-weight: bold; font-size: 16px; color: #000; display: block; border-bottom: 1px solid #000; } |
||||
@ -0,0 +1,40 @@ |
||||
html, body{ |
||||
height: 100%; |
||||
max-height: 100%; |
||||
font-family: 'Roboto', sans-serif; |
||||
} |
||||
|
||||
.top-container{ |
||||
padding-top: 10%; |
||||
} |
||||
|
||||
.general-container{ |
||||
background: url("../img/bg_image.ffeef71cd10d.jpg"); |
||||
height: 100%; |
||||
} |
||||
|
||||
.general-container form{ |
||||
margin-top: 30px; |
||||
} |
||||
|
||||
.general-container form label{ |
||||
color: white; |
||||
font-weight: 100; |
||||
} |
||||
|
||||
.btn-orange{ |
||||
background-color: #e8643e; |
||||
border: none; |
||||
} |
||||
|
||||
.btn-orange:hover{ |
||||
background-color: #dc5129; |
||||
border: none; |
||||
} |
||||
|
||||
.title{ |
||||
text-align: center; |
||||
color: white; |
||||
font-weight: 100; |
||||
line-height: 50px; |
||||
} |
||||
@ -0,0 +1,40 @@ |
||||
html, body{ |
||||
height: 100%; |
||||
max-height: 100%; |
||||
font-family: 'Roboto', sans-serif; |
||||
} |
||||
|
||||
.top-container{ |
||||
padding-top: 10%; |
||||
} |
||||
|
||||
.general-container{ |
||||
background: url('../img/bg_image.jpg'); |
||||
height: 100%; |
||||
} |
||||
|
||||
.general-container form{ |
||||
margin-top: 30px; |
||||
} |
||||
|
||||
.general-container form label{ |
||||
color: white; |
||||
font-weight: 100; |
||||
} |
||||
|
||||
.btn-orange{ |
||||
background-color: #e8643e; |
||||
border: none; |
||||
} |
||||
|
||||
.btn-orange:hover{ |
||||
background-color: #dc5129; |
||||
border: none; |
||||
} |
||||
|
||||
.title{ |
||||
text-align: center; |
||||
color: white; |
||||
font-weight: 100; |
||||
line-height: 50px; |
||||
} |
||||
@ -0,0 +1,5 @@ |
||||
.discount_code{ |
||||
display: inline; |
||||
width: 150px; |
||||
height: 75px; |
||||
} |
||||
@ -0,0 +1,43 @@ |
||||
html, body, div, span, applet, object, iframe, |
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre, |
||||
a, abbr, acronym, address, big, cite, code, |
||||
del, dfn, em, img, ins, kbd, q, s, samp, |
||||
small, strike, strong, sub, sup, tt, var, |
||||
b, u, i, center, |
||||
dl, dt, dd, ol, ul, li, |
||||
fieldset, form, label, legend, |
||||
table, caption, tbody, tfoot, thead, tr, th, td, |
||||
article, aside, canvas, details, embed, |
||||
figure, figcaption, footer, header, hgroup, |
||||
menu, nav, output, ruby, section, summary, |
||||
time, mark, audio, video { |
||||
margin: 0; |
||||
padding: 0; |
||||
border: 0; |
||||
font-size: 100%; |
||||
font: inherit; |
||||
vertical-align: baseline; |
||||
} |
||||
/* HTML5 display-role reset for older browsers */ |
||||
article, aside, details, figcaption, figure, |
||||
footer, header, hgroup, menu, nav, section { |
||||
display: block; |
||||
} |
||||
body { |
||||
line-height: 1; |
||||
} |
||||
ol, ul { |
||||
list-style: none; |
||||
} |
||||
blockquote, q { |
||||
quotes: none; |
||||
} |
||||
blockquote:before, blockquote:after, |
||||
q:before, q:after { |
||||
content: ''; |
||||
content: none; |
||||
} |
||||
table { |
||||
border-collapse: collapse; |
||||
border-spacing: 0; |
||||
} |
||||
@ -0,0 +1,105 @@ |
||||
html, body{ |
||||
height: 100%; |
||||
max-height: 100%; |
||||
font-family: 'Roboto', sans-serif; |
||||
background-color: #edeef0; |
||||
} |
||||
|
||||
.navbar{ |
||||
margin-bottom: 0; |
||||
} |
||||
|
||||
.wrapper{ |
||||
min-height: 100%; |
||||
} |
||||
|
||||
.wrapper-content{ |
||||
overflow: auto; |
||||
padding-bottom: 180px; /* must be same height as the footer */ |
||||
} |
||||
|
||||
.section-top{ |
||||
margin-bottom: 20px |
||||
} |
||||
|
||||
.footer{ |
||||
position: relative; |
||||
margin-top: -180px; /* negative value of footer height */ |
||||
height: 180px; |
||||
clear: both; |
||||
background-color: white; |
||||
} |
||||
|
||||
.product-item{ |
||||
height: 360px; |
||||
background-color: white; |
||||
border: 1px solid lightgrey; |
||||
position: relative; |
||||
padding: 10px 0 10px 0; |
||||
text-align: center; |
||||
margin-bottom: 10px; |
||||
} |
||||
|
||||
.discount-container{ |
||||
position: absolute; |
||||
top: 30%; |
||||
background: #fb4545; |
||||
width: 30%; |
||||
color: white; |
||||
font-weight: 700; |
||||
padding: 3px; |
||||
} |
||||
|
||||
.add-to-card-btn{ |
||||
position: absolute; |
||||
bottom: 15px; |
||||
left: 50%; |
||||
} |
||||
|
||||
.section-delivery{ |
||||
height: 300px; |
||||
background-color: #2A3342; |
||||
text-align: center; |
||||
color: white; |
||||
} |
||||
|
||||
.product-description-tabs{ |
||||
padding: 10px; |
||||
} |
||||
|
||||
.product-image-item{ |
||||
padding: 5px; |
||||
margin-bottom: 5px; |
||||
} |
||||
|
||||
.navbar-top{ |
||||
min-height: 10px; |
||||
height: 20px; |
||||
background-color: green; |
||||
border: none; |
||||
border-radius: 0; |
||||
} |
||||
.navbar-main{ |
||||
background-color: #c7db03; |
||||
border: none; |
||||
border-radius: 0; |
||||
} |
||||
|
||||
.basket-container{ |
||||
position: relative; |
||||
width: 400px; |
||||
padding: 15px 10px; |
||||
} |
||||
|
||||
.basket-items{ |
||||
position: absolute; |
||||
top: 50px; |
||||
width: 100%; |
||||
background-color: #edfc05; |
||||
z-index: 10; |
||||
padding: 10px; |
||||
} |
||||
|
||||
.product-price{ |
||||
text-align: right; |
||||
} |
||||
@ -0,0 +1,986 @@ |
||||
html, body{ |
||||
height: 100%; |
||||
max-height: 100%; |
||||
font-family: 'Roboto', sans-serif; |
||||
background-color: #edeef0; |
||||
} |
||||
|
||||
.navbar{ |
||||
margin-bottom: 0; |
||||
} |
||||
|
||||
.wrapper{ |
||||
min-height: 100%; |
||||
} |
||||
|
||||
.wrapper-content{ |
||||
overflow: auto; |
||||
padding-bottom: 180px; /* must be same height as the footer */ |
||||
} |
||||
|
||||
.section-top{ |
||||
margin-bottom: 20px |
||||
} |
||||
|
||||
.footer{ |
||||
position: relative; |
||||
margin-top: -180px; /* negative value of footer height */ |
||||
height: 180px; |
||||
clear: both; |
||||
background-color: white; |
||||
} |
||||
|
||||
.product-item{ |
||||
height: 360px; |
||||
background-color: white; |
||||
border: 1px solid lightgrey; |
||||
position: relative; |
||||
padding: 10px 0 10px 0; |
||||
text-align: center; |
||||
margin-bottom: 10px; |
||||
} |
||||
|
||||
.discount-container{ |
||||
position: absolute; |
||||
top: 30%; |
||||
background: #fb4545; |
||||
width: 30%; |
||||
color: white; |
||||
font-weight: 700; |
||||
padding: 3px; |
||||
} |
||||
|
||||
.add-to-card-btn{ |
||||
position: absolute; |
||||
bottom: 15px; |
||||
left: 50%; |
||||
} |
||||
|
||||
.section-delivery{ |
||||
height: 300px; |
||||
background-color: #2A3342; |
||||
text-align: center; |
||||
color: white; |
||||
} |
||||
|
||||
.product-description-tabs{ |
||||
padding: 10px; |
||||
} |
||||
|
||||
.product-image-item{ |
||||
padding: 5px; |
||||
margin-bottom: 5px; |
||||
} |
||||
|
||||
.navbar-top{ |
||||
min-height: 10px; |
||||
height: 20px; |
||||
background-color: green; |
||||
border: none; |
||||
border-radius: 0; |
||||
} |
||||
.navbar-main{ |
||||
background-color: #c7db03; |
||||
border: none; |
||||
border-radius: 0; |
||||
} |
||||
|
||||
.basket-container{ |
||||
position: relative; |
||||
width: 400px; |
||||
padding: 15px 10px; |
||||
} |
||||
|
||||
.basket-items{ |
||||
position: absolute; |
||||
top: 50px; |
||||
width: 100%; |
||||
background-color: #edfc05; |
||||
z-index: 10; |
||||
padding: 10px; |
||||
} |
||||
|
||||
.product-price{ |
||||
text-align: right; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.main { |
||||
|
||||
width: 1000px; |
||||
height: 150px; |
||||
margin: 0 auto; |
||||
|
||||
} |
||||
|
||||
.top-header { |
||||
max-width: 100%; |
||||
min-width: 1000px; |
||||
height: 50px; |
||||
background-color: #f1f1f1; |
||||
margin-bottom: 15px; |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
.russia-icon { |
||||
width: 95px; |
||||
height: 25px; |
||||
margin-top: 11px; |
||||
margin-left: 59px; |
||||
float: left; |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
.russia-icon p { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 14px; |
||||
text-decoration: underline; |
||||
margin-left: 11px; |
||||
margin-top: 5px; |
||||
cursor: pointer; |
||||
float: left; |
||||
} |
||||
|
||||
.rusio { |
||||
width: 32px; |
||||
height: 25px; |
||||
float: left; |
||||
background: url(../img/russia.jpg) no-repeat; |
||||
float: left; |
||||
} |
||||
|
||||
.contact-header { |
||||
width: auto; |
||||
height: 25px; |
||||
margin-top: 11px; |
||||
float: left; |
||||
} |
||||
|
||||
.contact-header a { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 14px; |
||||
text-decoration: underline; |
||||
margin-top: 5px; |
||||
|
||||
} |
||||
|
||||
.menu-sp { |
||||
width: 578px; |
||||
height: 28px; |
||||
float: right; |
||||
margin-top: 5px; |
||||
margin-right: 56px; |
||||
|
||||
} |
||||
|
||||
.shop-header { |
||||
width: auto; |
||||
height: 25px; |
||||
margin-top: 11px; |
||||
|
||||
float: left; |
||||
} |
||||
|
||||
.shop-header a { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 14px; |
||||
text-decoration: underline; |
||||
margin-left: 38px; |
||||
} |
||||
|
||||
.auth-header a { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 14px; |
||||
text-decoration: underline; |
||||
} |
||||
|
||||
.reg-header a { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 14px; |
||||
text-decoration: underline; |
||||
margin-right: 53px; |
||||
} |
||||
|
||||
.bonus-text p { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 14px; |
||||
text-decoration: underline; |
||||
|
||||
} |
||||
|
||||
.about-header { |
||||
width: auto; |
||||
height: 25px; |
||||
margin-top: 11px; |
||||
|
||||
float: left; |
||||
} |
||||
|
||||
.about-header a { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 14px; |
||||
text-decoration: underline; |
||||
margin-left: 38px; |
||||
} |
||||
|
||||
.menu-in ul li a { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 17px; |
||||
color: #ffffff; |
||||
text-decoration: none; |
||||
} |
||||
|
||||
.tel p { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 16px; |
||||
color: #000; |
||||
float: right; |
||||
margin-top: 8px; |
||||
} |
||||
|
||||
.telico { |
||||
width: 20px; |
||||
height: 32px; |
||||
background: url(../img/phone.jpg) no-repeat; |
||||
float: left; |
||||
} |
||||
|
||||
.reg-header{ |
||||
width: auto; |
||||
height: 25px; |
||||
margin-top: 11px; |
||||
|
||||
float: right; |
||||
} |
||||
|
||||
.auth-header { |
||||
width: auto; |
||||
height: 25px; |
||||
margin-top: 11px; |
||||
|
||||
float: right; |
||||
} |
||||
|
||||
|
||||
.main-header { |
||||
width: 1000px; |
||||
height: 123px; |
||||
margin: 0 auto; |
||||
|
||||
} |
||||
|
||||
.logo { |
||||
width: 163px; |
||||
height: 123px; |
||||
background: url(../img/logo.jpg) no-repeat; |
||||
float: left; |
||||
} |
||||
|
||||
|
||||
.bonus { |
||||
width: 205px; |
||||
height: 60px; |
||||
|
||||
|
||||
float: left; |
||||
margin-left: 100px; |
||||
margin-top: 40px; |
||||
|
||||
} |
||||
|
||||
.pod { |
||||
width: 67px; |
||||
height: 47px; |
||||
background: url(../img/pod.jpg) no-repeat; |
||||
float: right; |
||||
} |
||||
|
||||
.bonus-text { |
||||
width: auto; |
||||
height: 40px; |
||||
float: left; |
||||
margin-top: 12px; |
||||
|
||||
} |
||||
|
||||
.elem { |
||||
width: 447px; |
||||
height: 123px; |
||||
|
||||
float: right; |
||||
|
||||
} |
||||
|
||||
.elem2 { |
||||
width: 447px; |
||||
height: 87px; |
||||
|
||||
float: right; |
||||
} |
||||
|
||||
.search { |
||||
width: 446px; |
||||
height: 44px; |
||||
float: right; |
||||
|
||||
} |
||||
|
||||
.searchloop { |
||||
width: 23px; |
||||
height: 23px; |
||||
background: url(../img/searchloop.jpg) no-repeat; |
||||
cursor: pointer; |
||||
position: absolute; |
||||
|
||||
} |
||||
|
||||
.ssslll { |
||||
width: 23px; |
||||
height: 23px; |
||||
float: right; |
||||
margin-top: -32px; |
||||
margin-right: 15px; |
||||
} |
||||
|
||||
.search input { |
||||
width: 446px; |
||||
height: 35px; |
||||
float: right; |
||||
border: 2px solid #00695a; |
||||
outline: none; |
||||
border-radius: 5px; |
||||
} |
||||
|
||||
.search input[type="text"] { |
||||
padding-left: 15px; |
||||
padding-right: 41px; |
||||
color: #000; |
||||
} |
||||
|
||||
.tel { |
||||
width: 151px; |
||||
height: 33px; |
||||
|
||||
float: right; |
||||
margin-top: 42px; |
||||
margin-right: 22px; |
||||
} |
||||
|
||||
.basket { |
||||
width: 117px; |
||||
height: 63px; |
||||
|
||||
float: right; |
||||
margin-top: 24px; |
||||
} |
||||
|
||||
.marr { |
||||
width: 58px; |
||||
height: 20px; |
||||
float: right; |
||||
} |
||||
|
||||
|
||||
.menu { |
||||
width: 100%; |
||||
height: 43px; |
||||
background-color: #cc0000; |
||||
} |
||||
|
||||
.menu-in { |
||||
width: 1000px; |
||||
height: 63px; |
||||
|
||||
margin: 0 auto; |
||||
} |
||||
|
||||
.menu ul li { |
||||
margin-left: 66px; |
||||
margin-top: 12px; |
||||
padding-left: 15px; |
||||
float: left; |
||||
} |
||||
|
||||
.main-down { |
||||
width: 1000px; |
||||
height: 790px; |
||||
margin: 0 auto; |
||||
|
||||
} |
||||
|
||||
.gallery { |
||||
width: 1000px; |
||||
height: 410px; |
||||
|
||||
|
||||
margin-top: 50px; |
||||
|
||||
} |
||||
|
||||
.programms { |
||||
width: 1000px; |
||||
height: 380px; |
||||
|
||||
position: relative; |
||||
} |
||||
|
||||
.iconss { |
||||
width: 1000px; |
||||
height: 149px; |
||||
|
||||
|
||||
} |
||||
|
||||
.iconss2 { |
||||
width: 1000px; |
||||
height: 100px; |
||||
|
||||
|
||||
} |
||||
|
||||
.matr { |
||||
width: 34px; |
||||
height: 59px; |
||||
background: url(../img/matr.jpg) no-repeat; |
||||
float: left; |
||||
} |
||||
|
||||
.basket p { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 18px; |
||||
color: #000000; |
||||
margin-top: 25px; |
||||
float: right; |
||||
|
||||
} |
||||
|
||||
.programms h1 { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 48px; |
||||
color: #006d55; |
||||
text-align: center; |
||||
margin-bottom: 41px; |
||||
} |
||||
|
||||
.ico1 { |
||||
width: 198px; |
||||
height: 42px; |
||||
background: url(../img/ico1.jpg) no-repeat; |
||||
float: left; |
||||
margin-left: 15px; |
||||
} |
||||
|
||||
.ico2 { |
||||
width: 185px; |
||||
height: 73px; |
||||
background: url(../img/ico2.jpg) no-repeat; |
||||
float: left; |
||||
margin-left: 15px; |
||||
} |
||||
|
||||
.ico3 { |
||||
width: 149px; |
||||
height: 126px; |
||||
background: url(../img/ico3.jpg) no-repeat; |
||||
float: left; |
||||
margin-left: 15px; |
||||
} |
||||
|
||||
.ico4 { |
||||
width: 185px; |
||||
height: 49px; |
||||
background: url(../img/ico4.jpg) no-repeat; |
||||
float: left; |
||||
margin-left: 15px; |
||||
} |
||||
|
||||
.ico5 { |
||||
width: 189px; |
||||
height: 66px; |
||||
background: url(../img/ico5.jpg) no-repeat; |
||||
float: left; |
||||
margin-left: 15px; |
||||
} |
||||
|
||||
|
||||
|
||||
.ico6 { |
||||
width: 187px; |
||||
height: 68px; |
||||
background: url(../img/ico6.jpg) no-repeat; |
||||
margin-left: 15px; |
||||
float: left; |
||||
} |
||||
|
||||
.ico7 { |
||||
width: 175px; |
||||
height: 73px; |
||||
background: url(../img/ico7.jpg) no-repeat; |
||||
float: left; |
||||
margin-left: 15px; |
||||
} |
||||
|
||||
.ico8 { |
||||
width: 194px; |
||||
height: 67px; |
||||
background: url(../img/ico8.jpg) no-repeat; |
||||
float: left; |
||||
margin-left: 15px; |
||||
} |
||||
|
||||
.ico9 { |
||||
width: 175px; |
||||
height: 49px; |
||||
background: url(../img/ico9.jpg) no-repeat; |
||||
float: left; |
||||
margin-left: 15px; |
||||
} |
||||
|
||||
.ico10 { |
||||
width: 189px; |
||||
height: 52px; |
||||
background: url(../img/ico10.jpg) no-repeat; |
||||
float: left; |
||||
margin-left: 15px; |
||||
} |
||||
|
||||
|
||||
.boxlink { |
||||
width: 1000px; |
||||
height: 555px; |
||||
margin: 0 auto; |
||||
} |
||||
|
||||
.link150 { |
||||
width: 700px; |
||||
height: 26px; |
||||
|
||||
float: left; |
||||
margin-top: 25px; |
||||
} |
||||
|
||||
.link150 p a { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 14px; |
||||
color: #9e9e9e; |
||||
text-decoration: none; |
||||
} |
||||
|
||||
.kasico { |
||||
width: 328px; |
||||
height: 76px; |
||||
background: url(../img/kasp.jpg) no-repeat; |
||||
margin-top: 53px; |
||||
float: left; |
||||
position: relative; |
||||
} |
||||
|
||||
.link150 h1 { |
||||
width: 369px; |
||||
height: 30px; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
float: right; |
||||
position: relative; |
||||
} |
||||
|
||||
.uuu { |
||||
width: 1000px; |
||||
height: 185px; |
||||
|
||||
} |
||||
|
||||
.khome { |
||||
width: 1000px; |
||||
height: 59px; |
||||
background-color: #f1f1f1; |
||||
} |
||||
|
||||
.khome p { |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 18px; |
||||
color: #006e53; |
||||
text-align: center; |
||||
padding-top: 24px; |
||||
} |
||||
|
||||
.linest { |
||||
width: 1000px; |
||||
height: 316px; |
||||
|
||||
margin: 0 auto; |
||||
} |
||||
|
||||
.product1 { |
||||
width: 223px; |
||||
height: 307px; |
||||
margin-left: 17px; |
||||
float: left; |
||||
border: 3px solid #006e53; |
||||
} |
||||
|
||||
.product1 p { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 20px; |
||||
position: relative; |
||||
margin-top: 19px; |
||||
} |
||||
|
||||
.khome a { |
||||
color: #006e53; |
||||
} |
||||
|
||||
.pr1kas { |
||||
width: 122px; |
||||
height: 166px; |
||||
background: url(../img/pr1.jpg) no-repeat; |
||||
margin: 0 auto; |
||||
margin-top: 27px; |
||||
} |
||||
|
||||
.zks p { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 20px; |
||||
margin-top: 30px; |
||||
color: red; |
||||
} |
||||
|
||||
.blocktov { |
||||
width: 1000px; |
||||
height: 510px; |
||||
|
||||
margin-top: 20px; |
||||
} |
||||
|
||||
.blocktovleft img { |
||||
padding: 20px 40px; |
||||
float: left; |
||||
border: 3px solid #006e53; |
||||
} |
||||
|
||||
.greenline { |
||||
width: 555px; |
||||
height: 114px; |
||||
background-color: #00695a; |
||||
float: right; |
||||
} |
||||
|
||||
.greenline p { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 36px; |
||||
color: #fff; |
||||
margin-top: 20px; |
||||
margin-left: -5px; |
||||
} |
||||
|
||||
.textproduct { |
||||
width: 555px; |
||||
height: 195px; |
||||
|
||||
float: right; |
||||
margin-top: 25px; |
||||
} |
||||
|
||||
.textproduct p { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 18px; |
||||
color: #000; |
||||
} |
||||
|
||||
.bonusblock { |
||||
width: 332px; |
||||
height: 100px; |
||||
|
||||
position: absolute; |
||||
border: 3px solid #00695a; |
||||
margin-top: 400px; |
||||
} |
||||
|
||||
|
||||
.bonusblock p { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 48px; |
||||
color: #298a12; |
||||
margin-top: 12px; |
||||
} |
||||
|
||||
.bonusblock h3 { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normaL; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
} |
||||
|
||||
|
||||
|
||||
.bonusblock h3 { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normaL; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.buy { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
|
||||
|
||||
width: 185px; |
||||
height: 200px; |
||||
|
||||
float: left; |
||||
margin-top: -20px; |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
#cat1 input{ |
||||
|
||||
width: 65px; |
||||
height: 30px; |
||||
margin-top: 8px; |
||||
} |
||||
|
||||
#cat2 input{ |
||||
|
||||
width: 65px; |
||||
height: 30px; |
||||
margin-top: 8px; |
||||
} |
||||
|
||||
#cat3 input{ |
||||
|
||||
width: 65px; |
||||
height: 30px; |
||||
margin-top: 8px; |
||||
} |
||||
|
||||
#sdgsdgsdweg { |
||||
color: red; |
||||
} |
||||
|
||||
input[type="checkbox"] { |
||||
display:inline-block; |
||||
width:40px; |
||||
|
||||
height:40px; |
||||
vertical-align:middle; |
||||
|
||||
cursor:pointer; |
||||
border-radius: 5px; |
||||
} |
||||
|
||||
|
||||
#cat1 input[type="text"] { |
||||
|
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
} |
||||
|
||||
#cat1 button { |
||||
margin-top: 8px; |
||||
} |
||||
|
||||
#cat2 input[type="text"] { |
||||
|
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
} |
||||
|
||||
#cat2 button { |
||||
margin-top: 8px; |
||||
} |
||||
|
||||
#cat3 input[type="text"] { |
||||
|
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
} |
||||
|
||||
#cat3 button { |
||||
margin-top: 8px; |
||||
} |
||||
|
||||
|
||||
|
||||
.buy #cat1 { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
margin-top: 8px; |
||||
} |
||||
|
||||
.buy #cat2 { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
margin-top: 8px; |
||||
} |
||||
.buy #cat3 { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
margin-top: 8px; |
||||
} |
||||
|
||||
.buy .onever { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
margin-top: 8px; |
||||
} |
||||
|
||||
#erw { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
} |
||||
|
||||
#erw2 { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
} |
||||
.buy .itog { |
||||
text-align: center; |
||||
font-family: 'Myriad Pro'; |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
font-size: 24px; |
||||
color: #000; |
||||
margin-top: 8px; |
||||
} |
||||
|
||||
.calcblock { |
||||
width: 555px; |
||||
height: 200px; |
||||
|
||||
position: relative; |
||||
margin-top: 200px; |
||||
} |
||||
|
||||
.ItemsRow { border-collapse: separate; border-spacing: 10px; width: 100%; } |
||||
.ItemsRow tr {vertical-align: middle; } |
||||
.ItemsRow td { |
||||
position: relative; |
||||
border: 1px solid #DFDFDF; |
||||
background: #F8F8F8; |
||||
padding: 7px; |
||||
text-align: center; |
||||
vertical-align: middle; |
||||
-moz-border-radius: 7px; |
||||
-webkit-border-radius: 7px; |
||||
-khtml-border-radius: 7px; |
||||
border-radius: 7px; |
||||
-webkit-box-shadow: inset 0px 0px 0px 1px #fff, 0 2px 8px -5px black; |
||||
-moz-box-shadow: inset 0px 0px 0px 1px #fff, 0 2px 8px -5px black; |
||||
box-shadow: inset 0px 0px 0px 1px #fff, 0 2px 8px -5px black; |
||||
} |
||||
.ishopBrandsShowBlockWrap td:hover { background: #FAFAFA; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } |
||||
.ishopBrandsShowBlockWrap td a { display: inline-block; width: 115px; padding: 0; margin: 0; line-height: 1; } |
||||
.ishopBrandsShowBlockWrap td:hover a { opacity: 0.75; filter: alpha(opacity=75); /* For IE8 and earlier */ } |
||||
.ishopBrandsShowBlockWrap td img { width: 100%; } |
||||
@ -0,0 +1,439 @@ |
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BoldCondIt.eot'); |
||||
src: local('Myriad Pro Bold Condensed Italic'), local('MyriadPro-BoldCondIt'), |
||||
url('MyriadPro-BoldCondIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BoldCondIt.woff') format('woff'), |
||||
url('MyriadPro-BoldCondIt.ttf') format('truetype'); |
||||
font-weight: bold; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BlackIt.eot'); |
||||
src: local('Myriad Pro Black Italic'), local('MyriadPro-BlackIt'), |
||||
url('MyriadPro-BlackIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BlackIt.woff') format('woff'), |
||||
url('MyriadPro-BlackIt.ttf') format('truetype'); |
||||
font-weight: 900; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-LightIt.eot'); |
||||
src: local('Myriad Pro Light Italic'), local('MyriadPro-LightIt'), |
||||
url('MyriadPro-LightIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-LightIt.woff') format('woff'), |
||||
url('MyriadPro-LightIt.ttf') format('truetype'); |
||||
font-weight: 300; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BlackCond.eot'); |
||||
src: local('Myriad Pro Black Condensed'), local('MyriadPro-BlackCond'), |
||||
url('MyriadPro-BlackCond.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BlackCond.woff') format('woff'), |
||||
url('MyriadPro-BlackCond.ttf') format('truetype'); |
||||
font-weight: 900; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-Cond.eot'); |
||||
src: local('Myriad Pro Condensed'), local('MyriadPro-Cond'), |
||||
url('MyriadPro-Cond.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-Cond.woff') format('woff'), |
||||
url('MyriadPro-Cond.ttf') format('truetype'); |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-Bold.eot'); |
||||
src: local('Myriad Pro Bold'), local('MyriadPro-Bold'), |
||||
url('MyriadPro-Bold.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-Bold.woff') format('woff'), |
||||
url('MyriadPro-Bold.ttf') format('truetype'); |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BoldIt.eot'); |
||||
src: local('Myriad Pro Bold Italic'), local('MyriadPro-BoldIt'), |
||||
url('MyriadPro-BoldIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BoldIt.woff') format('woff'), |
||||
url('MyriadPro-BoldIt.ttf') format('truetype'); |
||||
font-weight: bold; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BoldSemiCnIt.eot'); |
||||
src: local('Myriad Pro Bold SemiCondensed Italic'), local('MyriadPro-BoldSemiCnIt'), |
||||
url('MyriadPro-BoldSemiCnIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BoldSemiCnIt.woff') format('woff'), |
||||
url('MyriadPro-BoldSemiCnIt.ttf') format('truetype'); |
||||
font-weight: bold; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-CondIt.eot'); |
||||
src: local('Myriad Pro Condensed Italic'), local('MyriadPro-CondIt'), |
||||
url('MyriadPro-CondIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-CondIt.woff') format('woff'), |
||||
url('MyriadPro-CondIt.ttf') format('truetype'); |
||||
font-weight: normal; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-LightCond.eot'); |
||||
src: local('Myriad Pro Light Condensed'), local('MyriadPro-LightCond'), |
||||
url('MyriadPro-LightCond.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-LightCond.woff') format('woff'), |
||||
url('MyriadPro-LightCond.ttf') format('truetype'); |
||||
font-weight: 300; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-SemiCn.eot'); |
||||
src: local('Myriad Pro SemiCondensed'), local('MyriadPro-SemiCn'), |
||||
url('MyriadPro-SemiCn.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-SemiCn.woff') format('woff'), |
||||
url('MyriadPro-SemiCn.ttf') format('truetype'); |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-SemiCnIt.eot'); |
||||
src: local('Myriad Pro SemiCondensed Italic'), local('MyriadPro-SemiCnIt'), |
||||
url('MyriadPro-SemiCnIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-SemiCnIt.woff') format('woff'), |
||||
url('MyriadPro-SemiCnIt.ttf') format('truetype'); |
||||
font-weight: normal; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BoldCond.eot'); |
||||
src: local('Myriad Pro Bold Condensed'), local('MyriadPro-BoldCond'), |
||||
url('MyriadPro-BoldCond.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BoldCond.woff') format('woff'), |
||||
url('MyriadPro-BoldCond.ttf') format('truetype'); |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-LightSemiExtIt.eot'); |
||||
src: local('Myriad Pro Light SemiExtended Italic'), local('MyriadPro-LightSemiExtIt'), |
||||
url('MyriadPro-LightSemiExtIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-LightSemiExtIt.woff') format('woff'), |
||||
url('MyriadPro-LightSemiExtIt.ttf') format('truetype'); |
||||
font-weight: 300; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-Semibold.eot'); |
||||
src: local('Myriad Pro Semibold'), local('MyriadPro-Semibold'), |
||||
url('MyriadPro-Semibold.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-Semibold.woff') format('woff'), |
||||
url('MyriadPro-Semibold.ttf') format('truetype'); |
||||
font-weight: 600; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-Black.eot'); |
||||
src: local('Myriad Pro Black'), local('MyriadPro-Black'), |
||||
url('MyriadPro-Black.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-Black.woff') format('woff'), |
||||
url('MyriadPro-Black.ttf') format('truetype'); |
||||
font-weight: 900; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-Regular.eot'); |
||||
src: local('Myriad Pro Regular'), local('MyriadPro-Regular'), |
||||
url('MyriadPro-Regular.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-Regular.woff') format('woff'), |
||||
url('MyriadPro-Regular.ttf') format('truetype'); |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-LightSemiCn.eot'); |
||||
src: local('Myriad Pro Light SemiCondensed'), local('MyriadPro-LightSemiCn'), |
||||
url('MyriadPro-LightSemiCn.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-LightSemiCn.woff') format('woff'), |
||||
url('MyriadPro-LightSemiCn.ttf') format('truetype'); |
||||
font-weight: 300; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BlackCondIt.eot'); |
||||
src: local('Myriad Pro Black Condensed Italic'), local('MyriadPro-BlackCondIt'), |
||||
url('MyriadPro-BlackCondIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BlackCondIt.woff') format('woff'), |
||||
url('MyriadPro-BlackCondIt.ttf') format('truetype'); |
||||
font-weight: 900; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-LightCondIt.eot'); |
||||
src: local('Myriad Pro Light Condensed Italic'), local('MyriadPro-LightCondIt'), |
||||
url('MyriadPro-LightCondIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-LightCondIt.woff') format('woff'), |
||||
url('MyriadPro-LightCondIt.ttf') format('truetype'); |
||||
font-weight: 300; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-LightSemiExt.eot'); |
||||
src: local('Myriad Pro Light SemiExtended'), local('MyriadPro-LightSemiExt'), |
||||
url('MyriadPro-LightSemiExt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-LightSemiExt.woff') format('woff'), |
||||
url('MyriadPro-LightSemiExt.ttf') format('truetype'); |
||||
font-weight: 300; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BlackSemiCnIt.eot'); |
||||
src: local('Myriad Pro Black SemiCondensed Italic'), local('MyriadPro-BlackSemiCnIt'), |
||||
url('MyriadPro-BlackSemiCnIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BlackSemiCnIt.woff') format('woff'), |
||||
url('MyriadPro-BlackSemiCnIt.ttf') format('truetype'); |
||||
font-weight: bold; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-SemiboldCondIt.eot'); |
||||
src: local('Myriad Pro Semibold Condensed Italic'), local('MyriadPro-SemiboldCondIt'), |
||||
url('MyriadPro-SemiboldCondIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-SemiboldCondIt.woff') format('woff'), |
||||
url('MyriadPro-SemiboldCondIt.ttf') format('truetype'); |
||||
font-weight: 600; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-SemiboldCond.eot'); |
||||
src: local('Myriad Pro Semibold Condensed'), local('MyriadPro-SemiboldCond'), |
||||
url('MyriadPro-SemiboldCond.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-SemiboldCond.woff') format('woff'), |
||||
url('MyriadPro-SemiboldCond.ttf') format('truetype'); |
||||
font-weight: 600; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BoldSemiExtIt.eot'); |
||||
src: local('Myriad Pro Bold SemiExtended Italic'), local('MyriadPro-BoldSemiExtIt'), |
||||
url('MyriadPro-BoldSemiExtIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BoldSemiExtIt.woff') format('woff'), |
||||
url('MyriadPro-BoldSemiExtIt.ttf') format('truetype'); |
||||
font-weight: bold; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-SemiboldSemiCn.eot'); |
||||
src: local('Myriad Pro Semibold SemiCondensed'), local('MyriadPro-SemiboldSemiCn'), |
||||
url('MyriadPro-SemiboldSemiCn.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-SemiboldSemiCn.woff') format('woff'), |
||||
url('MyriadPro-SemiboldSemiCn.ttf') format('truetype'); |
||||
font-weight: 600; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BlackSemiExtIt.eot'); |
||||
src: local('Myriad Pro Black SemiExtended Italic'), local('MyriadPro-BlackSemiExtIt'), |
||||
url('MyriadPro-BlackSemiExtIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BlackSemiExtIt.woff') format('woff'), |
||||
url('MyriadPro-BlackSemiExtIt.ttf') format('truetype'); |
||||
font-weight: 900; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-SemiboldSemiExtIt.eot'); |
||||
src: local('Myriad Pro Semibold SemiExtended Italic'), local('MyriadPro-SemiboldSemiExtIt'), |
||||
url('MyriadPro-SemiboldSemiExtIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-SemiboldSemiExtIt.woff') format('woff'), |
||||
url('MyriadPro-SemiboldSemiExtIt.ttf') format('truetype'); |
||||
font-weight: 600; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-LightSemiCnIt.eot'); |
||||
src: local('Myriad Pro Light SemiCondensed Italic'), local('MyriadPro-LightSemiCnIt'), |
||||
url('MyriadPro-LightSemiCnIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-LightSemiCnIt.woff') format('woff'), |
||||
url('MyriadPro-LightSemiCnIt.ttf') format('truetype'); |
||||
font-weight: 300; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BoldSemiCn.eot'); |
||||
src: local('Myriad Pro Bold SemiCondensed'), local('MyriadPro-BoldSemiCn'), |
||||
url('MyriadPro-BoldSemiCn.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BoldSemiCn.woff') format('woff'), |
||||
url('MyriadPro-BoldSemiCn.ttf') format('truetype'); |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-SemiboldSemiCnIt.eot'); |
||||
src: local('Myriad Pro Semibold SemiCondensed Italic'), local('MyriadPro-SemiboldSemiCnIt'), |
||||
url('MyriadPro-SemiboldSemiCnIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-SemiboldSemiCnIt.woff') format('woff'), |
||||
url('MyriadPro-SemiboldSemiCnIt.ttf') format('truetype'); |
||||
font-weight: 600; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-SemiboldIt.eot'); |
||||
src: local('Myriad Pro Semibold Italic'), local('MyriadPro-SemiboldIt'), |
||||
url('MyriadPro-SemiboldIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-SemiboldIt.woff') format('woff'), |
||||
url('MyriadPro-SemiboldIt.ttf') format('truetype'); |
||||
font-weight: 600; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-It.eot'); |
||||
src: local('Myriad Pro Italic'), local('MyriadPro-It'), |
||||
url('MyriadPro-It.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-It.woff') format('woff'), |
||||
url('MyriadPro-It.ttf') format('truetype'); |
||||
font-weight: normal; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BoldSemiExt.eot'); |
||||
src: local('Myriad Pro Bold SemiExtended'), local('MyriadPro-BoldSemiExt'), |
||||
url('MyriadPro-BoldSemiExt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BoldSemiExt.woff') format('woff'), |
||||
url('MyriadPro-BoldSemiExt.ttf') format('truetype'); |
||||
font-weight: bold; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-Light.eot'); |
||||
src: local('Myriad Pro Light'), local('MyriadPro-Light'), |
||||
url('MyriadPro-Light.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-Light.woff') format('woff'), |
||||
url('MyriadPro-Light.ttf') format('truetype'); |
||||
font-weight: 300; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-SemiboldSemiExt.eot'); |
||||
src: local('Myriad Pro Semibold SemiExtended'), local('MyriadPro-SemiboldSemiExt'), |
||||
url('MyriadPro-SemiboldSemiExt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-SemiboldSemiExt.woff') format('woff'), |
||||
url('MyriadPro-SemiboldSemiExt.ttf') format('truetype'); |
||||
font-weight: 600; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-SemiExtIt.eot'); |
||||
src: local('Myriad Pro SemiExtended Italic'), local('MyriadPro-SemiExtIt'), |
||||
url('MyriadPro-SemiExtIt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-SemiExtIt.woff') format('woff'), |
||||
url('MyriadPro-SemiExtIt.ttf') format('truetype'); |
||||
font-weight: normal; |
||||
font-style: italic; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BlackSemiCn.eot'); |
||||
src: local('Myriad Pro Black SemiCondensed'), local('MyriadPro-BlackSemiCn'), |
||||
url('MyriadPro-BlackSemiCn.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BlackSemiCn.woff') format('woff'), |
||||
url('MyriadPro-BlackSemiCn.ttf') format('truetype'); |
||||
font-weight: 900; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-BlackSemiExt.eot'); |
||||
src: local('Myriad Pro Black SemiExtended'), local('MyriadPro-BlackSemiExt'), |
||||
url('MyriadPro-BlackSemiExt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-BlackSemiExt.woff') format('woff'), |
||||
url('MyriadPro-BlackSemiExt.ttf') format('truetype'); |
||||
font-weight: 900; |
||||
font-style: normal; |
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'Myriad Pro'; |
||||
src: url('MyriadPro-SemiExt.eot'); |
||||
src: local('Myriad Pro SemiExtended'), local('MyriadPro-SemiExt'), |
||||
url('MyriadPro-SemiExt.eot?#iefix') format('embedded-opentype'), |
||||
url('MyriadPro-SemiExt.woff') format('woff'), |
||||
url('MyriadPro-SemiExt.ttf') format('truetype'); |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
} |
||||
|
After Width: | Height: | Size: 564 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 418 KiB |
|
After Width: | Height: | Size: 418 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 266 KiB |
|
After Width: | Height: | Size: 254 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 926 B |
|
After Width: | Height: | Size: 156 KiB |
|
After Width: | Height: | Size: 156 KiB |
|
After Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 148 KiB |
@ -0,0 +1,12 @@ |
||||
(function($) { |
||||
$(document).on('ready', function() { |
||||
$('select[name="action"]', '#changelist-form').on('change', function() { |
||||
if ($(this).val() == 'export_admin_action') { |
||||
$('select[name="file_format"]', '#changelist-form').parent().show(); |
||||
} else { |
||||
$('select[name="file_format"]', '#changelist-form').parent().hide(); |
||||
} |
||||
}); |
||||
$('select[name="action"]', '#changelist-form').change(); |
||||
}); |
||||
})(django.jQuery); |
||||
@ -0,0 +1,18 @@ |
||||
$(function(){ |
||||
$('#search').keyup(function(){ |
||||
$.ajax({ |
||||
type: "POST", |
||||
url: "/search/", |
||||
data: { |
||||
'search_text': $('#search').val(), |
||||
'csrfmiddlewaretoken': $("input[name=csrfmiddlewaretoken]").val() |
||||
}, |
||||
success: searchSuccess, |
||||
dataType: 'html' |
||||
}); |
||||
}); |
||||
}); |
||||
|
||||
function searchSuccess(data, textStatus, jqXHR){ |
||||
$('#search-results').html(data); |
||||
} |
||||
@ -0,0 +1,18 @@ |
||||
$(function(){ |
||||
$('#search').keyup(function(){ |
||||
$.ajax({ |
||||
type: "POST", |
||||
url: "/search/", |
||||
data: { |
||||
'search_text': $('#search').val(), |
||||
'csrfmiddlewaretoken': $("input[name=csrfmiddlewaretoken]").val() |
||||
}, |
||||
success: searchSuccess, |
||||
dataType: 'html' |
||||
}); |
||||
}); |
||||
}); |
||||
|
||||
function searchSuccess(data, textStatus, jqXHR){ |
||||
$('#search-results').html(data); |
||||
} |
||||
@ -0,0 +1,78 @@ |
||||
$(function () { |
||||
|
||||
// Фильтер в левом меню
|
||||
var range = $("#range"); |
||||
var minRange = range.attr('data-min'); |
||||
var maxRange = range.attr('data-max'); |
||||
var filter__min = $(".filter__min"); |
||||
var filter__max = $(".filter__max"); |
||||
filter__min.val(minRange); |
||||
filter__max.val(maxRange); |
||||
if (filter__min < 0) { |
||||
filter__min = 0; |
||||
} |
||||
if (filter__max < 0) { |
||||
filter__max = 0; |
||||
} |
||||
|
||||
range.slider({ |
||||
range: true, |
||||
max: maxRange, |
||||
values: [minRange, maxRange], |
||||
change: function (event, ui) { |
||||
var first = range.slider("values", 0); |
||||
var second = range.slider("values", 1); |
||||
console.log(first, second); |
||||
filter__min.val(first); |
||||
filter__max.val(second); |
||||
} |
||||
}); |
||||
|
||||
// // Аккордеон в левом меню
|
||||
$('.filter__category .filter__category-item ul').toggle(); |
||||
$('.filter__category .filter__category-item .category__title').click(function () { |
||||
$(this).parent().find('ul').slideToggle(); |
||||
}); |
||||
|
||||
// $('.mobail-menu').toggle();
|
||||
|
||||
$('#menu_active').click(function () { |
||||
$('.mobail-menu').slideToggle(); |
||||
}); |
||||
$('#content__category-btn').click(function () { |
||||
$('.content__category').slideToggle(); |
||||
}); |
||||
|
||||
$('.banner__close').click(function () { |
||||
$('.banner__close').parent().hide(); |
||||
}); |
||||
|
||||
|
||||
|
||||
// Magnific popup
|
||||
$('.certificate__item').magnificPopup({ |
||||
type: 'image' |
||||
// other options
|
||||
}); |
||||
|
||||
|
||||
// звезды
|
||||
var stars = $('.stars'); |
||||
stars.barrating({ |
||||
theme: 'fontawesome-stars' |
||||
}); |
||||
var starsCol = stars.attr('data-rating'); |
||||
stars.barrating('set', starsCol); |
||||
|
||||
// Goods slider
|
||||
|
||||
var main_image = $('.slider__main-image img'); |
||||
var slidelist = $('.slider__list li'); |
||||
main_image.attr("src", slidelist.find('img').attr("src")); |
||||
slidelist.click(function () { |
||||
var clickSRC = ($(this).find('img').attr("src")); |
||||
main_image.attr("src", clickSRC); |
||||
}) |
||||
|
||||
}); |
||||
|
||||
@ -0,0 +1,992 @@ |
||||
/** |
||||
* Ajax Autocomplete for jQuery, version %version% |
||||
* (c) 2015 Tomas Kirda |
||||
* |
||||
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. |
||||
* For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
|
||||
*/ |
||||
|
||||
/*jslint browser: true, white: true, single: true, this: true, multivar: true */ |
||||
/*global define, window, document, jQuery, exports, require */ |
||||
|
||||
// Expose plugin as an AMD module if AMD loader is present:
|
||||
(function (factory) { |
||||
"use strict"; |
||||
if (typeof define === 'function' && define.amd) { |
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory); |
||||
} else if (typeof exports === 'object' && typeof require === 'function') { |
||||
// Browserify
|
||||
factory(require('jquery')); |
||||
} else { |
||||
// Browser globals
|
||||
factory(jQuery); |
||||
} |
||||
}(function ($) { |
||||
'use strict'; |
||||
|
||||
var |
||||
utils = (function () { |
||||
return { |
||||
escapeRegExChars: function (value) { |
||||
return value.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"); |
||||
}, |
||||
createNode: function (containerClass) { |
||||
var div = document.createElement('div'); |
||||
div.className = containerClass; |
||||
div.style.position = 'absolute'; |
||||
div.style.display = 'none'; |
||||
return div; |
||||
} |
||||
}; |
||||
}()), |
||||
|
||||
keys = { |
||||
ESC: 27, |
||||
TAB: 9, |
||||
RETURN: 13, |
||||
LEFT: 37, |
||||
UP: 38, |
||||
RIGHT: 39, |
||||
DOWN: 40 |
||||
}; |
||||
|
||||
function Autocomplete(el, options) { |
||||
var noop = $.noop, |
||||
that = this, |
||||
defaults = { |
||||
ajaxSettings: {}, |
||||
autoSelectFirst: false, |
||||
appendTo: document.body, |
||||
serviceUrl: null, |
||||
lookup: null, |
||||
onSelect: null, |
||||
width: 'auto', |
||||
minChars: 1, |
||||
maxHeight: 300, |
||||
deferRequestBy: 0, |
||||
params: {}, |
||||
formatResult: Autocomplete.formatResult, |
||||
delimiter: null, |
||||
zIndex: 9999, |
||||
type: 'GET', |
||||
noCache: false, |
||||
onSearchStart: noop, |
||||
onSearchComplete: noop, |
||||
onSearchError: noop, |
||||
preserveInput: false, |
||||
containerClass: 'autocomplete-suggestions', |
||||
tabDisabled: false, |
||||
dataType: 'text', |
||||
currentRequest: null, |
||||
triggerSelectOnValidInput: true, |
||||
preventBadQueries: true, |
||||
lookupFilter: function (suggestion, originalQuery, queryLowerCase) { |
||||
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1; |
||||
}, |
||||
paramName: 'query', |
||||
transformResult: function (response) { |
||||
return typeof response === 'string' ? $.parseJSON(response) : response; |
||||
}, |
||||
showNoSuggestionNotice: false, |
||||
noSuggestionNotice: 'No results', |
||||
orientation: 'bottom', |
||||
forceFixPosition: false |
||||
}; |
||||
|
||||
// Shared variables:
|
||||
that.element = el; |
||||
that.el = $(el); |
||||
that.suggestions = []; |
||||
that.badQueries = []; |
||||
that.selectedIndex = -1; |
||||
that.currentValue = that.element.value; |
||||
that.intervalId = 0; |
||||
that.cachedResponse = {}; |
||||
that.onChangeInterval = null; |
||||
that.onChange = null; |
||||
that.isLocal = false; |
||||
that.suggestionsContainer = null; |
||||
that.noSuggestionsContainer = null; |
||||
that.options = $.extend({}, defaults, options); |
||||
that.classes = { |
||||
selected: 'autocomplete-selected', |
||||
suggestion: 'autocomplete-suggestion' |
||||
}; |
||||
that.hint = null; |
||||
that.hintValue = ''; |
||||
that.selection = null; |
||||
|
||||
// Initialize and set options:
|
||||
that.initialize(); |
||||
that.setOptions(options); |
||||
} |
||||
|
||||
Autocomplete.utils = utils; |
||||
|
||||
$.Autocomplete = Autocomplete; |
||||
|
||||
Autocomplete.formatResult = function (suggestion, currentValue) { |
||||
// Do not replace anything if there current value is empty
|
||||
if (!currentValue) { |
||||
return suggestion.value; |
||||
} |
||||
|
||||
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')'; |
||||
|
||||
return suggestion.value |
||||
.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>') |
||||
.replace(/&/g, '&') |
||||
.replace(/</g, '<') |
||||
.replace(/>/g, '>') |
||||
.replace(/"/g, '"') |
||||
.replace(/<(\/?strong)>/g, '<$1>'); |
||||
}; |
||||
|
||||
Autocomplete.prototype = { |
||||
|
||||
killerFn: null, |
||||
|
||||
initialize: function () { |
||||
var that = this, |
||||
suggestionSelector = '.' + that.classes.suggestion, |
||||
selected = that.classes.selected, |
||||
options = that.options, |
||||
container; |
||||
|
||||
// Remove autocomplete attribute to prevent native suggestions:
|
||||
that.element.setAttribute('autocomplete', 'off'); |
||||
|
||||
that.killerFn = function (e) { |
||||
if (!$(e.target).closest('.' + that.options.containerClass).length) { |
||||
that.killSuggestions(); |
||||
that.disableKillerFn(); |
||||
} |
||||
}; |
||||
|
||||
// html() deals with many types: htmlString or Element or Array or jQuery
|
||||
that.noSuggestionsContainer = $('<div class="autocomplete-no-suggestion"></div>') |
||||
.html(this.options.noSuggestionNotice).get(0); |
||||
|
||||
that.suggestionsContainer = Autocomplete.utils.createNode(options.containerClass); |
||||
|
||||
container = $(that.suggestionsContainer); |
||||
|
||||
container.appendTo(options.appendTo); |
||||
|
||||
// Only set width if it was provided:
|
||||
if (options.width !== 'auto') { |
||||
container.css('width', options.width); |
||||
} |
||||
|
||||
// Listen for mouse over event on suggestions list:
|
||||
container.on('mouseover.autocomplete', suggestionSelector, function () { |
||||
that.activate($(this).data('index')); |
||||
}); |
||||
|
||||
// Deselect active element when mouse leaves suggestions container:
|
||||
container.on('mouseout.autocomplete', function () { |
||||
that.selectedIndex = -1; |
||||
container.children('.' + selected).removeClass(selected); |
||||
}); |
||||
|
||||
// Listen for click event on suggestions list:
|
||||
container.on('click.autocomplete', suggestionSelector, function () { |
||||
that.select($(this).data('index')); |
||||
return false; |
||||
}); |
||||
|
||||
that.fixPositionCapture = function () { |
||||
if (that.visible) { |
||||
that.fixPosition(); |
||||
} |
||||
}; |
||||
|
||||
$(window).on('resize.autocomplete', that.fixPositionCapture); |
||||
|
||||
that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); }); |
||||
that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); }); |
||||
that.el.on('blur.autocomplete', function () { that.onBlur(); }); |
||||
that.el.on('focus.autocomplete', function () { that.onFocus(); }); |
||||
that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); }); |
||||
that.el.on('input.autocomplete', function (e) { that.onKeyUp(e); }); |
||||
}, |
||||
|
||||
onFocus: function () { |
||||
var that = this; |
||||
|
||||
that.fixPosition(); |
||||
|
||||
if (that.el.val().length >= that.options.minChars) { |
||||
that.onValueChange(); |
||||
} |
||||
}, |
||||
|
||||
onBlur: function () { |
||||
this.enableKillerFn(); |
||||
}, |
||||
|
||||
abortAjax: function () { |
||||
var that = this; |
||||
if (that.currentRequest) { |
||||
that.currentRequest.abort(); |
||||
that.currentRequest = null; |
||||
} |
||||
}, |
||||
|
||||
setOptions: function (suppliedOptions) { |
||||
var that = this, |
||||
options = that.options; |
||||
|
||||
$.extend(options, suppliedOptions); |
||||
|
||||
that.isLocal = $.isArray(options.lookup); |
||||
|
||||
if (that.isLocal) { |
||||
options.lookup = that.verifySuggestionsFormat(options.lookup); |
||||
} |
||||
|
||||
options.orientation = that.validateOrientation(options.orientation, 'bottom'); |
||||
|
||||
// Adjust height, width and z-index:
|
||||
$(that.suggestionsContainer).css({ |
||||
'max-height': options.maxHeight + 'px', |
||||
'width': options.width + 'px', |
||||
'z-index': options.zIndex |
||||
}); |
||||
}, |
||||
|
||||
|
||||
clearCache: function () { |
||||
this.cachedResponse = {}; |
||||
this.badQueries = []; |
||||
}, |
||||
|
||||
clear: function () { |
||||
this.clearCache(); |
||||
this.currentValue = ''; |
||||
this.suggestions = []; |
||||
}, |
||||
|
||||
disable: function () { |
||||
var that = this; |
||||
that.disabled = true; |
||||
clearInterval(that.onChangeInterval); |
||||
that.abortAjax(); |
||||
}, |
||||
|
||||
enable: function () { |
||||
this.disabled = false; |
||||
}, |
||||
|
||||
fixPosition: function () { |
||||
// Use only when container has already its content
|
||||
|
||||
var that = this, |
||||
$container = $(that.suggestionsContainer), |
||||
containerParent = $container.parent().get(0); |
||||
// Fix position automatically when appended to body.
|
||||
// In other cases force parameter must be given.
|
||||
if (containerParent !== document.body && !that.options.forceFixPosition) { |
||||
return; |
||||
} |
||||
|
||||
// Choose orientation
|
||||
var orientation = that.options.orientation, |
||||
containerHeight = $container.outerHeight(), |
||||
height = that.el.outerHeight(), |
||||
offset = that.el.offset(), |
||||
styles = { 'top': offset.top, 'left': offset.left }; |
||||
|
||||
if (orientation === 'auto') { |
||||
var viewPortHeight = $(window).height(), |
||||
scrollTop = $(window).scrollTop(), |
||||
topOverflow = -scrollTop + offset.top - containerHeight, |
||||
bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight); |
||||
|
||||
orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom'; |
||||
} |
||||
|
||||
if (orientation === 'top') { |
||||
styles.top += -containerHeight; |
||||
} else { |
||||
styles.top += height; |
||||
} |
||||
|
||||
// If container is not positioned to body,
|
||||
// correct its position using offset parent offset
|
||||
if(containerParent !== document.body) { |
||||
var opacity = $container.css('opacity'), |
||||
parentOffsetDiff; |
||||
|
||||
if (!that.visible){ |
||||
$container.css('opacity', 0).show(); |
||||
} |
||||
|
||||
parentOffsetDiff = $container.offsetParent().offset(); |
||||
styles.top -= parentOffsetDiff.top; |
||||
styles.left -= parentOffsetDiff.left; |
||||
|
||||
if (!that.visible){ |
||||
$container.css('opacity', opacity).hide(); |
||||
} |
||||
} |
||||
|
||||
if (that.options.width === 'auto') { |
||||
styles.width = that.el.outerWidth() + 'px'; |
||||
} |
||||
|
||||
$container.css(styles); |
||||
}, |
||||
|
||||
enableKillerFn: function () { |
||||
var that = this; |
||||
$(document).on('click.autocomplete', that.killerFn); |
||||
}, |
||||
|
||||
disableKillerFn: function () { |
||||
var that = this; |
||||
$(document).off('click.autocomplete', that.killerFn); |
||||
}, |
||||
|
||||
killSuggestions: function () { |
||||
var that = this; |
||||
that.stopKillSuggestions(); |
||||
that.intervalId = window.setInterval(function () { |
||||
if (that.visible) { |
||||
// No need to restore value when
|
||||
// preserveInput === true,
|
||||
// because we did not change it
|
||||
if (!that.options.preserveInput) { |
||||
that.el.val(that.currentValue); |
||||
} |
||||
|
||||
that.hide(); |
||||
} |
||||
|
||||
that.stopKillSuggestions(); |
||||
}, 50); |
||||
}, |
||||
|
||||
stopKillSuggestions: function () { |
||||
window.clearInterval(this.intervalId); |
||||
}, |
||||
|
||||
isCursorAtEnd: function () { |
||||
var that = this, |
||||
valLength = that.el.val().length, |
||||
selectionStart = that.element.selectionStart, |
||||
range; |
||||
|
||||
if (typeof selectionStart === 'number') { |
||||
return selectionStart === valLength; |
||||
} |
||||
if (document.selection) { |
||||
range = document.selection.createRange(); |
||||
range.moveStart('character', -valLength); |
||||
return valLength === range.text.length; |
||||
} |
||||
return true; |
||||
}, |
||||
|
||||
onKeyPress: function (e) { |
||||
var that = this; |
||||
|
||||
// If suggestions are hidden and user presses arrow down, display suggestions:
|
||||
if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) { |
||||
that.suggest(); |
||||
return; |
||||
} |
||||
|
||||
if (that.disabled || !that.visible) { |
||||
return; |
||||
} |
||||
|
||||
switch (e.which) { |
||||
case keys.ESC: |
||||
that.el.val(that.currentValue); |
||||
that.hide(); |
||||
break; |
||||
case keys.RIGHT: |
||||
if (that.hint && that.options.onHint && that.isCursorAtEnd()) { |
||||
that.selectHint(); |
||||
break; |
||||
} |
||||
return; |
||||
case keys.TAB: |
||||
if (that.hint && that.options.onHint) { |
||||
that.selectHint(); |
||||
return; |
||||
} |
||||
if (that.selectedIndex === -1) { |
||||
that.hide(); |
||||
return; |
||||
} |
||||
that.select(that.selectedIndex); |
||||
if (that.options.tabDisabled === false) { |
||||
return; |
||||
} |
||||
break; |
||||
case keys.RETURN: |
||||
if (that.selectedIndex === -1) { |
||||
that.hide(); |
||||
return; |
||||
} |
||||
that.select(that.selectedIndex); |
||||
break; |
||||
case keys.UP: |
||||
that.moveUp(); |
||||
break; |
||||
case keys.DOWN: |
||||
that.moveDown(); |
||||
break; |
||||
default: |
||||
return; |
||||
} |
||||
|
||||
// Cancel event if function did not return:
|
||||
e.stopImmediatePropagation(); |
||||
e.preventDefault(); |
||||
}, |
||||
|
||||
onKeyUp: function (e) { |
||||
var that = this; |
||||
|
||||
if (that.disabled) { |
||||
return; |
||||
} |
||||
|
||||
switch (e.which) { |
||||
case keys.UP: |
||||
case keys.DOWN: |
||||
return; |
||||
} |
||||
|
||||
clearInterval(that.onChangeInterval); |
||||
|
||||
if (that.currentValue !== that.el.val()) { |
||||
that.findBestHint(); |
||||
if (that.options.deferRequestBy > 0) { |
||||
// Defer lookup in case when value changes very quickly:
|
||||
that.onChangeInterval = setInterval(function () { |
||||
that.onValueChange(); |
||||
}, that.options.deferRequestBy); |
||||
} else { |
||||
that.onValueChange(); |
||||
} |
||||
} |
||||
}, |
||||
|
||||
onValueChange: function () { |
||||
var that = this, |
||||
options = that.options, |
||||
value = that.el.val(), |
||||
query = that.getQuery(value); |
||||
|
||||
if (that.selection && that.currentValue !== query) { |
||||
that.selection = null; |
||||
(options.onInvalidateSelection || $.noop).call(that.element); |
||||
} |
||||
|
||||
clearInterval(that.onChangeInterval); |
||||
that.currentValue = value; |
||||
that.selectedIndex = -1; |
||||
|
||||
// Check existing suggestion for the match before proceeding:
|
||||
if (options.triggerSelectOnValidInput && that.isExactMatch(query)) { |
||||
that.select(0); |
||||
return; |
||||
} |
||||
|
||||
if (query.length < options.minChars) { |
||||
that.hide(); |
||||
} else { |
||||
that.getSuggestions(query); |
||||
} |
||||
}, |
||||
|
||||
isExactMatch: function (query) { |
||||
var suggestions = this.suggestions; |
||||
|
||||
return (suggestions.length === 1 && suggestions[0].value.toLowerCase() === query.toLowerCase()); |
||||
}, |
||||
|
||||
getQuery: function (value) { |
||||
var delimiter = this.options.delimiter, |
||||
parts; |
||||
|
||||
if (!delimiter) { |
||||
return value; |
||||
} |
||||
parts = value.split(delimiter); |
||||
return $.trim(parts[parts.length - 1]); |
||||
}, |
||||
|
||||
getSuggestionsLocal: function (query) { |
||||
var that = this, |
||||
options = that.options, |
||||
queryLowerCase = query.toLowerCase(), |
||||
filter = options.lookupFilter, |
||||
limit = parseInt(options.lookupLimit, 10), |
||||
data; |
||||
|
||||
data = { |
||||
suggestions: $.grep(options.lookup, function (suggestion) { |
||||
return filter(suggestion, query, queryLowerCase); |
||||
}) |
||||
}; |
||||
|
||||
if (limit && data.suggestions.length > limit) { |
||||
data.suggestions = data.suggestions.slice(0, limit); |
||||
} |
||||
|
||||
return data; |
||||
}, |
||||
|
||||
getSuggestions: function (q) { |
||||
var response, |
||||
that = this, |
||||
options = that.options, |
||||
serviceUrl = options.serviceUrl, |
||||
params, |
||||
cacheKey, |
||||
ajaxSettings; |
||||
|
||||
options.params[options.paramName] = q; |
||||
params = options.ignoreParams ? null : options.params; |
||||
|
||||
if (options.onSearchStart.call(that.element, options.params) === false) { |
||||
return; |
||||
} |
||||
|
||||
if ($.isFunction(options.lookup)){ |
||||
options.lookup(q, function (data) { |
||||
that.suggestions = data.suggestions; |
||||
that.suggest(); |
||||
options.onSearchComplete.call(that.element, q, data.suggestions); |
||||
}); |
||||
return; |
||||
} |
||||
|
||||
if (that.isLocal) { |
||||
response = that.getSuggestionsLocal(q); |
||||
} else { |
||||
if ($.isFunction(serviceUrl)) { |
||||
serviceUrl = serviceUrl.call(that.element, q); |
||||
} |
||||
cacheKey = serviceUrl + '?' + $.param(params || {}); |
||||
response = that.cachedResponse[cacheKey]; |
||||
} |
||||
|
||||
if (response && $.isArray(response.suggestions)) { |
||||
that.suggestions = response.suggestions; |
||||
that.suggest(); |
||||
options.onSearchComplete.call(that.element, q, response.suggestions); |
||||
} else if (!that.isBadQuery(q)) { |
||||
that.abortAjax(); |
||||
|
||||
ajaxSettings = { |
||||
url: serviceUrl, |
||||
data: params, |
||||
type: options.type, |
||||
dataType: options.dataType |
||||
}; |
||||
|
||||
$.extend(ajaxSettings, options.ajaxSettings); |
||||
|
||||
that.currentRequest = $.ajax(ajaxSettings).done(function (data) { |
||||
var result; |
||||
that.currentRequest = null; |
||||
result = options.transformResult(data, q); |
||||
that.processResponse(result, q, cacheKey); |
||||
options.onSearchComplete.call(that.element, q, result.suggestions); |
||||
}).fail(function (jqXHR, textStatus, errorThrown) { |
||||
options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown); |
||||
}); |
||||
} else { |
||||
options.onSearchComplete.call(that.element, q, []); |
||||
} |
||||
}, |
||||
|
||||
isBadQuery: function (q) { |
||||
if (!this.options.preventBadQueries){ |
||||
return false; |
||||
} |
||||
|
||||
var badQueries = this.badQueries, |
||||
i = badQueries.length; |
||||
|
||||
while (i--) { |
||||
if (q.indexOf(badQueries[i]) === 0) { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
return false; |
||||
}, |
||||
|
||||
hide: function () { |
||||
var that = this, |
||||
container = $(that.suggestionsContainer); |
||||
|
||||
if ($.isFunction(that.options.onHide) && that.visible) { |
||||
that.options.onHide.call(that.element, container); |
||||
} |
||||
|
||||
that.visible = false; |
||||
that.selectedIndex = -1; |
||||
clearInterval(that.onChangeInterval); |
||||
$(that.suggestionsContainer).hide(); |
||||
that.signalHint(null); |
||||
}, |
||||
|
||||
suggest: function () { |
||||
if (!this.suggestions.length) { |
||||
if (this.options.showNoSuggestionNotice) { |
||||
this.noSuggestions(); |
||||
} else { |
||||
this.hide(); |
||||
} |
||||
return; |
||||
} |
||||
|
||||
var that = this, |
||||
options = that.options, |
||||
groupBy = options.groupBy, |
||||
formatResult = options.formatResult, |
||||
value = that.getQuery(that.currentValue), |
||||
className = that.classes.suggestion, |
||||
classSelected = that.classes.selected, |
||||
container = $(that.suggestionsContainer), |
||||
noSuggestionsContainer = $(that.noSuggestionsContainer), |
||||
beforeRender = options.beforeRender, |
||||
html = '', |
||||
category, |
||||
formatGroup = function (suggestion, index) { |
||||
var currentCategory = suggestion.data[groupBy]; |
||||
|
||||
if (category === currentCategory){ |
||||
return ''; |
||||
} |
||||
|
||||
category = currentCategory; |
||||
|
||||
return '<div class="autocomplete-group"><strong>' + category + '</strong></div>'; |
||||
}; |
||||
|
||||
if (options.triggerSelectOnValidInput && that.isExactMatch(value)) { |
||||
that.select(0); |
||||
return; |
||||
} |
||||
|
||||
// Build suggestions inner HTML:
|
||||
$.each(that.suggestions, function (i, suggestion) { |
||||
if (groupBy){ |
||||
html += formatGroup(suggestion, value, i); |
||||
} |
||||
|
||||
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value, i) + '</div>'; |
||||
}); |
||||
|
||||
this.adjustContainerWidth(); |
||||
|
||||
noSuggestionsContainer.detach(); |
||||
container.html(html); |
||||
|
||||
if ($.isFunction(beforeRender)) { |
||||
beforeRender.call(that.element, container, that.suggestions); |
||||
} |
||||
|
||||
that.fixPosition(); |
||||
container.show(); |
||||
|
||||
// Select first value by default:
|
||||
if (options.autoSelectFirst) { |
||||
that.selectedIndex = 0; |
||||
container.scrollTop(0); |
||||
container.children('.' + className).first().addClass(classSelected); |
||||
} |
||||
|
||||
that.visible = true; |
||||
that.findBestHint(); |
||||
}, |
||||
|
||||
noSuggestions: function() { |
||||
var that = this, |
||||
container = $(that.suggestionsContainer), |
||||
noSuggestionsContainer = $(that.noSuggestionsContainer); |
||||
|
||||
this.adjustContainerWidth(); |
||||
|
||||
// Some explicit steps. Be careful here as it easy to get
|
||||
// noSuggestionsContainer removed from DOM if not detached properly.
|
||||
noSuggestionsContainer.detach(); |
||||
container.empty(); // clean suggestions if any
|
||||
container.append(noSuggestionsContainer); |
||||
|
||||
that.fixPosition(); |
||||
|
||||
container.show(); |
||||
that.visible = true; |
||||
}, |
||||
|
||||
adjustContainerWidth: function() { |
||||
var that = this, |
||||
options = that.options, |
||||
width, |
||||
container = $(that.suggestionsContainer); |
||||
|
||||
// If width is auto, adjust width before displaying suggestions,
|
||||
// because if instance was created before input had width, it will be zero.
|
||||
// Also it adjusts if input width has changed.
|
||||
if (options.width === 'auto') { |
||||
width = that.el.outerWidth(); |
||||
container.css('width', width > 0 ? width : 300); |
||||
} |
||||
}, |
||||
|
||||
findBestHint: function () { |
||||
var that = this, |
||||
value = that.el.val().toLowerCase(), |
||||
bestMatch = null; |
||||
|
||||
if (!value) { |
||||
return; |
||||
} |
||||
|
||||
$.each(that.suggestions, function (i, suggestion) { |
||||
var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0; |
||||
if (foundMatch) { |
||||
bestMatch = suggestion; |
||||
} |
||||
return !foundMatch; |
||||
}); |
||||
|
||||
that.signalHint(bestMatch); |
||||
}, |
||||
|
||||
signalHint: function (suggestion) { |
||||
var hintValue = '', |
||||
that = this; |
||||
if (suggestion) { |
||||
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length); |
||||
} |
||||
if (that.hintValue !== hintValue) { |
||||
that.hintValue = hintValue; |
||||
that.hint = suggestion; |
||||
(this.options.onHint || $.noop)(hintValue); |
||||
} |
||||
}, |
||||
|
||||
verifySuggestionsFormat: function (suggestions) { |
||||
// If suggestions is string array, convert them to supported format:
|
||||
if (suggestions.length && typeof suggestions[0] === 'string') { |
||||
return $.map(suggestions, function (value) { |
||||
return { value: value, data: null }; |
||||
}); |
||||
} |
||||
|
||||
return suggestions; |
||||
}, |
||||
|
||||
validateOrientation: function(orientation, fallback) { |
||||
orientation = $.trim(orientation || '').toLowerCase(); |
||||
|
||||
if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){ |
||||
orientation = fallback; |
||||
} |
||||
|
||||
return orientation; |
||||
}, |
||||
|
||||
processResponse: function (result, originalQuery, cacheKey) { |
||||
var that = this, |
||||
options = that.options; |
||||
|
||||
result.suggestions = that.verifySuggestionsFormat(result.suggestions); |
||||
|
||||
// Cache results if cache is not disabled:
|
||||
if (!options.noCache) { |
||||
that.cachedResponse[cacheKey] = result; |
||||
if (options.preventBadQueries && !result.suggestions.length) { |
||||
that.badQueries.push(originalQuery); |
||||
} |
||||
} |
||||
|
||||
// Return if originalQuery is not matching current query:
|
||||
if (originalQuery !== that.getQuery(that.currentValue)) { |
||||
return; |
||||
} |
||||
|
||||
that.suggestions = result.suggestions; |
||||
that.suggest(); |
||||
}, |
||||
|
||||
activate: function (index) { |
||||
var that = this, |
||||
activeItem, |
||||
selected = that.classes.selected, |
||||
container = $(that.suggestionsContainer), |
||||
children = container.find('.' + that.classes.suggestion); |
||||
|
||||
container.find('.' + selected).removeClass(selected); |
||||
|
||||
that.selectedIndex = index; |
||||
|
||||
if (that.selectedIndex !== -1 && children.length > that.selectedIndex) { |
||||
activeItem = children.get(that.selectedIndex); |
||||
$(activeItem).addClass(selected); |
||||
return activeItem; |
||||
} |
||||
|
||||
return null; |
||||
}, |
||||
|
||||
selectHint: function () { |
||||
var that = this, |
||||
i = $.inArray(that.hint, that.suggestions); |
||||
|
||||
that.select(i); |
||||
}, |
||||
|
||||
select: function (i) { |
||||
var that = this; |
||||
that.hide(); |
||||
that.onSelect(i); |
||||
that.disableKillerFn(); |
||||
}, |
||||
|
||||
moveUp: function () { |
||||
var that = this; |
||||
|
||||
if (that.selectedIndex === -1) { |
||||
return; |
||||
} |
||||
|
||||
if (that.selectedIndex === 0) { |
||||
$(that.suggestionsContainer).children().first().removeClass(that.classes.selected); |
||||
that.selectedIndex = -1; |
||||
that.el.val(that.currentValue); |
||||
that.findBestHint(); |
||||
return; |
||||
} |
||||
|
||||
that.adjustScroll(that.selectedIndex - 1); |
||||
}, |
||||
|
||||
moveDown: function () { |
||||
var that = this; |
||||
|
||||
if (that.selectedIndex === (that.suggestions.length - 1)) { |
||||
return; |
||||
} |
||||
|
||||
that.adjustScroll(that.selectedIndex + 1); |
||||
}, |
||||
|
||||
adjustScroll: function (index) { |
||||
var that = this, |
||||
activeItem = that.activate(index); |
||||
|
||||
if (!activeItem) { |
||||
return; |
||||
} |
||||
|
||||
var offsetTop, |
||||
upperBound, |
||||
lowerBound, |
||||
heightDelta = $(activeItem).outerHeight(); |
||||
|
||||
offsetTop = activeItem.offsetTop; |
||||
upperBound = $(that.suggestionsContainer).scrollTop(); |
||||
lowerBound = upperBound + that.options.maxHeight - heightDelta; |
||||
|
||||
if (offsetTop < upperBound) { |
||||
$(that.suggestionsContainer).scrollTop(offsetTop); |
||||
} else if (offsetTop > lowerBound) { |
||||
$(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta); |
||||
} |
||||
|
||||
if (!that.options.preserveInput) { |
||||
that.el.val(that.getValue(that.suggestions[index].value)); |
||||
} |
||||
that.signalHint(null); |
||||
}, |
||||
|
||||
onSelect: function (index) { |
||||
var that = this, |
||||
onSelectCallback = that.options.onSelect, |
||||
suggestion = that.suggestions[index]; |
||||
|
||||
that.currentValue = that.getValue(suggestion.value); |
||||
|
||||
if (that.currentValue !== that.el.val() && !that.options.preserveInput) { |
||||
that.el.val(that.currentValue); |
||||
} |
||||
|
||||
that.signalHint(null); |
||||
that.suggestions = []; |
||||
that.selection = suggestion; |
||||
|
||||
if ($.isFunction(onSelectCallback)) { |
||||
onSelectCallback.call(that.element, suggestion); |
||||
} |
||||
}, |
||||
|
||||
getValue: function (value) { |
||||
var that = this, |
||||
delimiter = that.options.delimiter, |
||||
currentValue, |
||||
parts; |
||||
|
||||
if (!delimiter) { |
||||
return value; |
||||
} |
||||
|
||||
currentValue = that.currentValue; |
||||
parts = currentValue.split(delimiter); |
||||
|
||||
if (parts.length === 1) { |
||||
return value; |
||||
} |
||||
|
||||
return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value; |
||||
}, |
||||
|
||||
dispose: function () { |
||||
var that = this; |
||||
that.el.off('.autocomplete').removeData('autocomplete'); |
||||
that.disableKillerFn(); |
||||
$(window).off('resize.autocomplete', that.fixPositionCapture); |
||||
$(that.suggestionsContainer).remove(); |
||||
} |
||||
}; |
||||
|
||||
// Create chainable jQuery plugin:
|
||||
$.fn.autocomplete = $.fn.devbridgeAutocomplete = function (options, args) { |
||||
var dataKey = 'autocomplete'; |
||||
// If function invoked without argument return
|
||||
// instance of the first matched element:
|
||||
if (!arguments.length) { |
||||
return this.first().data(dataKey); |
||||
} |
||||
|
||||
return this.each(function () { |
||||
var inputElement = $(this), |
||||
instance = inputElement.data(dataKey); |
||||
|
||||
if (typeof options === 'string') { |
||||
if (instance && typeof instance[options] === 'function') { |
||||
instance[options](args); |
||||
} |
||||
} else { |
||||
// If instance already exists, destroy it:
|
||||
if (instance && instance.dispose) { |
||||
instance.dispose(); |
||||
} |
||||
instance = new Autocomplete(this, options); |
||||
inputElement.data(dataKey, instance); |
||||
} |
||||
}); |
||||
}; |
||||
})); |
||||
@ -0,0 +1,992 @@ |
||||
/** |
||||
* Ajax Autocomplete for jQuery, version %version% |
||||
* (c) 2015 Tomas Kirda |
||||
* |
||||
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. |
||||
* For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
|
||||
*/ |
||||
|
||||
/*jslint browser: true, white: true, single: true, this: true, multivar: true */ |
||||
/*global define, window, document, jQuery, exports, require */ |
||||
|
||||
// Expose plugin as an AMD module if AMD loader is present:
|
||||
(function (factory) { |
||||
"use strict"; |
||||
if (typeof define === 'function' && define.amd) { |
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory); |
||||
} else if (typeof exports === 'object' && typeof require === 'function') { |
||||
// Browserify
|
||||
factory(require('jquery')); |
||||
} else { |
||||
// Browser globals
|
||||
factory(jQuery); |
||||
} |
||||
}(function ($) { |
||||
'use strict'; |
||||
|
||||
var |
||||
utils = (function () { |
||||
return { |
||||
escapeRegExChars: function (value) { |
||||
return value.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"); |
||||
}, |
||||
createNode: function (containerClass) { |
||||
var div = document.createElement('div'); |
||||
div.className = containerClass; |
||||
div.style.position = 'absolute'; |
||||
div.style.display = 'none'; |
||||
return div; |
||||
} |
||||
}; |
||||
}()), |
||||
|
||||
keys = { |
||||
ESC: 27, |
||||
TAB: 9, |
||||
RETURN: 13, |
||||
LEFT: 37, |
||||
UP: 38, |
||||
RIGHT: 39, |
||||
DOWN: 40 |
||||
}; |
||||
|
||||
function Autocomplete(el, options) { |
||||
var noop = $.noop, |
||||
that = this, |
||||
defaults = { |
||||
ajaxSettings: {}, |
||||
autoSelectFirst: false, |
||||
appendTo: document.body, |
||||
serviceUrl: null, |
||||
lookup: null, |
||||
onSelect: null, |
||||
width: 'auto', |
||||
minChars: 1, |
||||
maxHeight: 300, |
||||
deferRequestBy: 0, |
||||
params: {}, |
||||
formatResult: Autocomplete.formatResult, |
||||
delimiter: null, |
||||
zIndex: 9999, |
||||
type: 'GET', |
||||
noCache: false, |
||||
onSearchStart: noop, |
||||
onSearchComplete: noop, |
||||
onSearchError: noop, |
||||
preserveInput: false, |
||||
containerClass: 'autocomplete-suggestions', |
||||
tabDisabled: false, |
||||
dataType: 'text', |
||||
currentRequest: null, |
||||
triggerSelectOnValidInput: true, |
||||
preventBadQueries: true, |
||||
lookupFilter: function (suggestion, originalQuery, queryLowerCase) { |
||||
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1; |
||||
}, |
||||
paramName: 'query', |
||||
transformResult: function (response) { |
||||
return typeof response === 'string' ? $.parseJSON(response) : response; |
||||
}, |
||||
showNoSuggestionNotice: false, |
||||
noSuggestionNotice: 'No results', |
||||
orientation: 'bottom', |
||||
forceFixPosition: false |
||||
}; |
||||
|
||||
// Shared variables:
|
||||
that.element = el; |
||||
that.el = $(el); |
||||
that.suggestions = []; |
||||
that.badQueries = []; |
||||
that.selectedIndex = -1; |
||||
that.currentValue = that.element.value; |
||||
that.intervalId = 0; |
||||
that.cachedResponse = {}; |
||||
that.onChangeInterval = null; |
||||
that.onChange = null; |
||||
that.isLocal = false; |
||||
that.suggestionsContainer = null; |
||||
that.noSuggestionsContainer = null; |
||||
that.options = $.extend({}, defaults, options); |
||||
that.classes = { |
||||
selected: 'autocomplete-selected', |
||||
suggestion: 'autocomplete-suggestion' |
||||
}; |
||||
that.hint = null; |
||||
that.hintValue = ''; |
||||
that.selection = null; |
||||
|
||||
// Initialize and set options:
|
||||
that.initialize(); |
||||
that.setOptions(options); |
||||
} |
||||
|
||||
Autocomplete.utils = utils; |
||||
|
||||
$.Autocomplete = Autocomplete; |
||||
|
||||
Autocomplete.formatResult = function (suggestion, currentValue) { |
||||
// Do not replace anything if there current value is empty
|
||||
if (!currentValue) { |
||||
return suggestion.value; |
||||
} |
||||
|
||||
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')'; |
||||
|
||||
return suggestion.value |
||||
.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>') |
||||
.replace(/&/g, '&') |
||||
.replace(/</g, '<') |
||||
.replace(/>/g, '>') |
||||
.replace(/"/g, '"') |
||||
.replace(/<(\/?strong)>/g, '<$1>'); |
||||
}; |
||||
|
||||
Autocomplete.prototype = { |
||||
|
||||
killerFn: null, |
||||
|
||||
initialize: function () { |
||||
var that = this, |
||||
suggestionSelector = '.' + that.classes.suggestion, |
||||
selected = that.classes.selected, |
||||
options = that.options, |
||||
container; |
||||
|
||||
// Remove autocomplete attribute to prevent native suggestions:
|
||||
that.element.setAttribute('autocomplete', 'off'); |
||||
|
||||
that.killerFn = function (e) { |
||||
if (!$(e.target).closest('.' + that.options.containerClass).length) { |
||||
that.killSuggestions(); |
||||
that.disableKillerFn(); |
||||
} |
||||
}; |
||||
|
||||
// html() deals with many types: htmlString or Element or Array or jQuery
|
||||
that.noSuggestionsContainer = $('<div class="autocomplete-no-suggestion"></div>') |
||||
.html(this.options.noSuggestionNotice).get(0); |
||||
|
||||
that.suggestionsContainer = Autocomplete.utils.createNode(options.containerClass); |
||||
|
||||
container = $(that.suggestionsContainer); |
||||
|
||||
container.appendTo(options.appendTo); |
||||
|
||||
// Only set width if it was provided:
|
||||
if (options.width !== 'auto') { |
||||
container.css('width', options.width); |
||||
} |
||||
|
||||
// Listen for mouse over event on suggestions list:
|
||||
container.on('mouseover.autocomplete', suggestionSelector, function () { |
||||
that.activate($(this).data('index')); |
||||
}); |
||||
|
||||
// Deselect active element when mouse leaves suggestions container:
|
||||
container.on('mouseout.autocomplete', function () { |
||||
that.selectedIndex = -1; |
||||
container.children('.' + selected).removeClass(selected); |
||||
}); |
||||
|
||||
// Listen for click event on suggestions list:
|
||||
container.on('click.autocomplete', suggestionSelector, function () { |
||||
that.select($(this).data('index')); |
||||
return false; |
||||
}); |
||||
|
||||
that.fixPositionCapture = function () { |
||||
if (that.visible) { |
||||
that.fixPosition(); |
||||
} |
||||
}; |
||||
|
||||
$(window).on('resize.autocomplete', that.fixPositionCapture); |
||||
|
||||
that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); }); |
||||
that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); }); |
||||
that.el.on('blur.autocomplete', function () { that.onBlur(); }); |
||||
that.el.on('focus.autocomplete', function () { that.onFocus(); }); |
||||
that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); }); |
||||
that.el.on('input.autocomplete', function (e) { that.onKeyUp(e); }); |
||||
}, |
||||
|
||||
onFocus: function () { |
||||
var that = this; |
||||
|
||||
that.fixPosition(); |
||||
|
||||
if (that.el.val().length >= that.options.minChars) { |
||||
that.onValueChange(); |
||||
} |
||||
}, |
||||
|
||||
onBlur: function () { |
||||
this.enableKillerFn(); |
||||
}, |
||||
|
||||
abortAjax: function () { |
||||
var that = this; |
||||
if (that.currentRequest) { |
||||
that.currentRequest.abort(); |
||||
that.currentRequest = null; |
||||
} |
||||
}, |
||||
|
||||
setOptions: function (suppliedOptions) { |
||||
var that = this, |
||||
options = that.options; |
||||
|
||||
$.extend(options, suppliedOptions); |
||||
|
||||
that.isLocal = $.isArray(options.lookup); |
||||
|
||||
if (that.isLocal) { |
||||
options.lookup = that.verifySuggestionsFormat(options.lookup); |
||||
} |
||||
|
||||
options.orientation = that.validateOrientation(options.orientation, 'bottom'); |
||||
|
||||
// Adjust height, width and z-index:
|
||||
$(that.suggestionsContainer).css({ |
||||
'max-height': options.maxHeight + 'px', |
||||
'width': options.width + 'px', |
||||
'z-index': options.zIndex |
||||
}); |
||||
}, |
||||
|
||||
|
||||
clearCache: function () { |
||||
this.cachedResponse = {}; |
||||
this.badQueries = []; |
||||
}, |
||||
|
||||
clear: function () { |
||||
this.clearCache(); |
||||
this.currentValue = ''; |
||||
this.suggestions = []; |
||||
}, |
||||
|
||||
disable: function () { |
||||
var that = this; |
||||
that.disabled = true; |
||||
clearInterval(that.onChangeInterval); |
||||
that.abortAjax(); |
||||
}, |
||||
|
||||
enable: function () { |
||||
this.disabled = false; |
||||
}, |
||||
|
||||
fixPosition: function () { |
||||
// Use only when container has already its content
|
||||
|
||||
var that = this, |
||||
$container = $(that.suggestionsContainer), |
||||
containerParent = $container.parent().get(0); |
||||
// Fix position automatically when appended to body.
|
||||
// In other cases force parameter must be given.
|
||||
if (containerParent !== document.body && !that.options.forceFixPosition) { |
||||
return; |
||||
} |
||||
|
||||
// Choose orientation
|
||||
var orientation = that.options.orientation, |
||||
containerHeight = $container.outerHeight(), |
||||
height = that.el.outerHeight(), |
||||
offset = that.el.offset(), |
||||
styles = { 'top': offset.top, 'left': offset.left }; |
||||
|
||||
if (orientation === 'auto') { |
||||
var viewPortHeight = $(window).height(), |
||||
scrollTop = $(window).scrollTop(), |
||||
topOverflow = -scrollTop + offset.top - containerHeight, |
||||
bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight); |
||||
|
||||
orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom'; |
||||
} |
||||
|
||||
if (orientation === 'top') { |
||||
styles.top += -containerHeight; |
||||
} else { |
||||
styles.top += height; |
||||
} |
||||
|
||||
// If container is not positioned to body,
|
||||
// correct its position using offset parent offset
|
||||
if(containerParent !== document.body) { |
||||
var opacity = $container.css('opacity'), |
||||
parentOffsetDiff; |
||||
|
||||
if (!that.visible){ |
||||
$container.css('opacity', 0).show(); |
||||
} |
||||
|
||||
parentOffsetDiff = $container.offsetParent().offset(); |
||||
styles.top -= parentOffsetDiff.top; |
||||
styles.left -= parentOffsetDiff.left; |
||||
|
||||
if (!that.visible){ |
||||
$container.css('opacity', opacity).hide(); |
||||
} |
||||
} |
||||
|
||||
if (that.options.width === 'auto') { |
||||
styles.width = that.el.outerWidth() + 'px'; |
||||
} |
||||
|
||||
$container.css(styles); |
||||
}, |
||||
|
||||
enableKillerFn: function () { |
||||
var that = this; |
||||
$(document).on('click.autocomplete', that.killerFn); |
||||
}, |
||||
|
||||
disableKillerFn: function () { |
||||
var that = this; |
||||
$(document).off('click.autocomplete', that.killerFn); |
||||
}, |
||||
|
||||
killSuggestions: function () { |
||||
var that = this; |
||||
that.stopKillSuggestions(); |
||||
that.intervalId = window.setInterval(function () { |
||||
if (that.visible) { |
||||
// No need to restore value when
|
||||
// preserveInput === true,
|
||||
// because we did not change it
|
||||
if (!that.options.preserveInput) { |
||||
that.el.val(that.currentValue); |
||||
} |
||||
|
||||
that.hide(); |
||||
} |
||||
|
||||
that.stopKillSuggestions(); |
||||
}, 50); |
||||
}, |
||||
|
||||
stopKillSuggestions: function () { |
||||
window.clearInterval(this.intervalId); |
||||
}, |
||||
|
||||
isCursorAtEnd: function () { |
||||
var that = this, |
||||
valLength = that.el.val().length, |
||||
selectionStart = that.element.selectionStart, |
||||
range; |
||||
|
||||
if (typeof selectionStart === 'number') { |
||||
return selectionStart === valLength; |
||||
} |
||||
if (document.selection) { |
||||
range = document.selection.createRange(); |
||||
range.moveStart('character', -valLength); |
||||
return valLength === range.text.length; |
||||
} |
||||
return true; |
||||
}, |
||||
|
||||
onKeyPress: function (e) { |
||||
var that = this; |
||||
|
||||
// If suggestions are hidden and user presses arrow down, display suggestions:
|
||||
if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) { |
||||
that.suggest(); |
||||
return; |
||||
} |
||||
|
||||
if (that.disabled || !that.visible) { |
||||
return; |
||||
} |
||||
|
||||
switch (e.which) { |
||||
case keys.ESC: |
||||
that.el.val(that.currentValue); |
||||
that.hide(); |
||||
break; |
||||
case keys.RIGHT: |
||||
if (that.hint && that.options.onHint && that.isCursorAtEnd()) { |
||||
that.selectHint(); |
||||
break; |
||||
} |
||||
return; |
||||
case keys.TAB: |
||||
if (that.hint && that.options.onHint) { |
||||
that.selectHint(); |
||||
return; |
||||
} |
||||
if (that.selectedIndex === -1) { |
||||
that.hide(); |
||||
return; |
||||
} |
||||
that.select(that.selectedIndex); |
||||
if (that.options.tabDisabled === false) { |
||||
return; |
||||
} |
||||
break; |
||||
case keys.RETURN: |
||||
if (that.selectedIndex === -1) { |
||||
that.hide(); |
||||
return; |
||||
} |
||||
that.select(that.selectedIndex); |
||||
break; |
||||
case keys.UP: |
||||
that.moveUp(); |
||||
break; |
||||
case keys.DOWN: |
||||
that.moveDown(); |
||||
break; |
||||
default: |
||||
return; |
||||
} |
||||
|
||||
// Cancel event if function did not return:
|
||||
e.stopImmediatePropagation(); |
||||
e.preventDefault(); |
||||
}, |
||||
|
||||
onKeyUp: function (e) { |
||||
var that = this; |
||||
|
||||
if (that.disabled) { |
||||
return; |
||||
} |
||||
|
||||
switch (e.which) { |
||||
case keys.UP: |
||||
case keys.DOWN: |
||||
return; |
||||
} |
||||
|
||||
clearInterval(that.onChangeInterval); |
||||
|
||||
if (that.currentValue !== that.el.val()) { |
||||
that.findBestHint(); |
||||
if (that.options.deferRequestBy > 0) { |
||||
// Defer lookup in case when value changes very quickly:
|
||||
that.onChangeInterval = setInterval(function () { |
||||
that.onValueChange(); |
||||
}, that.options.deferRequestBy); |
||||
} else { |
||||
that.onValueChange(); |
||||
} |
||||
} |
||||
}, |
||||
|
||||
onValueChange: function () { |
||||
var that = this, |
||||
options = that.options, |
||||
value = that.el.val(), |
||||
query = that.getQuery(value); |
||||
|
||||
if (that.selection && that.currentValue !== query) { |
||||
that.selection = null; |
||||
(options.onInvalidateSelection || $.noop).call(that.element); |
||||
} |
||||
|
||||
clearInterval(that.onChangeInterval); |
||||
that.currentValue = value; |
||||
that.selectedIndex = -1; |
||||
|
||||
// Check existing suggestion for the match before proceeding:
|
||||
if (options.triggerSelectOnValidInput && that.isExactMatch(query)) { |
||||
that.select(0); |
||||
return; |
||||
} |
||||
|
||||
if (query.length < options.minChars) { |
||||
that.hide(); |
||||
} else { |
||||
that.getSuggestions(query); |
||||
} |
||||
}, |
||||
|
||||
isExactMatch: function (query) { |
||||
var suggestions = this.suggestions; |
||||
|
||||
return (suggestions.length === 1 && suggestions[0].value.toLowerCase() === query.toLowerCase()); |
||||
}, |
||||
|
||||
getQuery: function (value) { |
||||
var delimiter = this.options.delimiter, |
||||
parts; |
||||
|
||||
if (!delimiter) { |
||||
return value; |
||||
} |
||||
parts = value.split(delimiter); |
||||
return $.trim(parts[parts.length - 1]); |
||||
}, |
||||
|
||||
getSuggestionsLocal: function (query) { |
||||
var that = this, |
||||
options = that.options, |
||||
queryLowerCase = query.toLowerCase(), |
||||
filter = options.lookupFilter, |
||||
limit = parseInt(options.lookupLimit, 10), |
||||
data; |
||||
|
||||
data = { |
||||
suggestions: $.grep(options.lookup, function (suggestion) { |
||||
return filter(suggestion, query, queryLowerCase); |
||||
}) |
||||
}; |
||||
|
||||
if (limit && data.suggestions.length > limit) { |
||||
data.suggestions = data.suggestions.slice(0, limit); |
||||
} |
||||
|
||||
return data; |
||||
}, |
||||
|
||||
getSuggestions: function (q) { |
||||
var response, |
||||
that = this, |
||||
options = that.options, |
||||
serviceUrl = options.serviceUrl, |
||||
params, |
||||
cacheKey, |
||||
ajaxSettings; |
||||
|
||||
options.params[options.paramName] = q; |
||||
params = options.ignoreParams ? null : options.params; |
||||
|
||||
if (options.onSearchStart.call(that.element, options.params) === false) { |
||||
return; |
||||
} |
||||
|
||||
if ($.isFunction(options.lookup)){ |
||||
options.lookup(q, function (data) { |
||||
that.suggestions = data.suggestions; |
||||
that.suggest(); |
||||
options.onSearchComplete.call(that.element, q, data.suggestions); |
||||
}); |
||||
return; |
||||
} |
||||
|
||||
if (that.isLocal) { |
||||
response = that.getSuggestionsLocal(q); |
||||
} else { |
||||
if ($.isFunction(serviceUrl)) { |
||||
serviceUrl = serviceUrl.call(that.element, q); |
||||
} |
||||
cacheKey = serviceUrl + '?' + $.param(params || {}); |
||||
response = that.cachedResponse[cacheKey]; |
||||
} |
||||
|
||||
if (response && $.isArray(response.suggestions)) { |
||||
that.suggestions = response.suggestions; |
||||
that.suggest(); |
||||
options.onSearchComplete.call(that.element, q, response.suggestions); |
||||
} else if (!that.isBadQuery(q)) { |
||||
that.abortAjax(); |
||||
|
||||
ajaxSettings = { |
||||
url: serviceUrl, |
||||
data: params, |
||||
type: options.type, |
||||
dataType: options.dataType |
||||
}; |
||||
|
||||
$.extend(ajaxSettings, options.ajaxSettings); |
||||
|
||||
that.currentRequest = $.ajax(ajaxSettings).done(function (data) { |
||||
var result; |
||||
that.currentRequest = null; |
||||
result = options.transformResult(data, q); |
||||
that.processResponse(result, q, cacheKey); |
||||
options.onSearchComplete.call(that.element, q, result.suggestions); |
||||
}).fail(function (jqXHR, textStatus, errorThrown) { |
||||
options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown); |
||||
}); |
||||
} else { |
||||
options.onSearchComplete.call(that.element, q, []); |
||||
} |
||||
}, |
||||
|
||||
isBadQuery: function (q) { |
||||
if (!this.options.preventBadQueries){ |
||||
return false; |
||||
} |
||||
|
||||
var badQueries = this.badQueries, |
||||
i = badQueries.length; |
||||
|
||||
while (i--) { |
||||
if (q.indexOf(badQueries[i]) === 0) { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
return false; |
||||
}, |
||||
|
||||
hide: function () { |
||||
var that = this, |
||||
container = $(that.suggestionsContainer); |
||||
|
||||
if ($.isFunction(that.options.onHide) && that.visible) { |
||||
that.options.onHide.call(that.element, container); |
||||
} |
||||
|
||||
that.visible = false; |
||||
that.selectedIndex = -1; |
||||
clearInterval(that.onChangeInterval); |
||||
$(that.suggestionsContainer).hide(); |
||||
that.signalHint(null); |
||||
}, |
||||
|
||||
suggest: function () { |
||||
if (!this.suggestions.length) { |
||||
if (this.options.showNoSuggestionNotice) { |
||||
this.noSuggestions(); |
||||
} else { |
||||
this.hide(); |
||||
} |
||||
return; |
||||
} |
||||
|
||||
var that = this, |
||||
options = that.options, |
||||
groupBy = options.groupBy, |
||||
formatResult = options.formatResult, |
||||
value = that.getQuery(that.currentValue), |
||||
className = that.classes.suggestion, |
||||
classSelected = that.classes.selected, |
||||
container = $(that.suggestionsContainer), |
||||
noSuggestionsContainer = $(that.noSuggestionsContainer), |
||||
beforeRender = options.beforeRender, |
||||
html = '', |
||||
category, |
||||
formatGroup = function (suggestion, index) { |
||||
var currentCategory = suggestion.data[groupBy]; |
||||
|
||||
if (category === currentCategory){ |
||||
return ''; |
||||
} |
||||
|
||||
category = currentCategory; |
||||
|
||||
return '<div class="autocomplete-group"><strong>' + category + '</strong></div>'; |
||||
}; |
||||
|
||||
if (options.triggerSelectOnValidInput && that.isExactMatch(value)) { |
||||
that.select(0); |
||||
return; |
||||
} |
||||
|
||||
// Build suggestions inner HTML:
|
||||
$.each(that.suggestions, function (i, suggestion) { |
||||
if (groupBy){ |
||||
html += formatGroup(suggestion, value, i); |
||||
} |
||||
|
||||
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value, i) + '</div>'; |
||||
}); |
||||
|
||||
this.adjustContainerWidth(); |
||||
|
||||
noSuggestionsContainer.detach(); |
||||
container.html(html); |
||||
|
||||
if ($.isFunction(beforeRender)) { |
||||
beforeRender.call(that.element, container, that.suggestions); |
||||
} |
||||
|
||||
that.fixPosition(); |
||||
container.show(); |
||||
|
||||
// Select first value by default:
|
||||
if (options.autoSelectFirst) { |
||||
that.selectedIndex = 0; |
||||
container.scrollTop(0); |
||||
container.children('.' + className).first().addClass(classSelected); |
||||
} |
||||
|
||||
that.visible = true; |
||||
that.findBestHint(); |
||||
}, |
||||
|
||||
noSuggestions: function() { |
||||
var that = this, |
||||
container = $(that.suggestionsContainer), |
||||
noSuggestionsContainer = $(that.noSuggestionsContainer); |
||||
|
||||
this.adjustContainerWidth(); |
||||
|
||||
// Some explicit steps. Be careful here as it easy to get
|
||||
// noSuggestionsContainer removed from DOM if not detached properly.
|
||||
noSuggestionsContainer.detach(); |
||||
container.empty(); // clean suggestions if any
|
||||
container.append(noSuggestionsContainer); |
||||
|
||||
that.fixPosition(); |
||||
|
||||
container.show(); |
||||
that.visible = true; |
||||
}, |
||||
|
||||
adjustContainerWidth: function() { |
||||
var that = this, |
||||
options = that.options, |
||||
width, |
||||
container = $(that.suggestionsContainer); |
||||
|
||||
// If width is auto, adjust width before displaying suggestions,
|
||||
// because if instance was created before input had width, it will be zero.
|
||||
// Also it adjusts if input width has changed.
|
||||
if (options.width === 'auto') { |
||||
width = that.el.outerWidth(); |
||||
container.css('width', width > 0 ? width : 300); |
||||
} |
||||
}, |
||||
|
||||
findBestHint: function () { |
||||
var that = this, |
||||
value = that.el.val().toLowerCase(), |
||||
bestMatch = null; |
||||
|
||||
if (!value) { |
||||
return; |
||||
} |
||||
|
||||
$.each(that.suggestions, function (i, suggestion) { |
||||
var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0; |
||||
if (foundMatch) { |
||||
bestMatch = suggestion; |
||||
} |
||||
return !foundMatch; |
||||
}); |
||||
|
||||
that.signalHint(bestMatch); |
||||
}, |
||||
|
||||
signalHint: function (suggestion) { |
||||
var hintValue = '', |
||||
that = this; |
||||
if (suggestion) { |
||||
hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length); |
||||
} |
||||
if (that.hintValue !== hintValue) { |
||||
that.hintValue = hintValue; |
||||
that.hint = suggestion; |
||||
(this.options.onHint || $.noop)(hintValue); |
||||
} |
||||
}, |
||||
|
||||
verifySuggestionsFormat: function (suggestions) { |
||||
// If suggestions is string array, convert them to supported format:
|
||||
if (suggestions.length && typeof suggestions[0] === 'string') { |
||||
return $.map(suggestions, function (value) { |
||||
return { value: value, data: null }; |
||||
}); |
||||
} |
||||
|
||||
return suggestions; |
||||
}, |
||||
|
||||
validateOrientation: function(orientation, fallback) { |
||||
orientation = $.trim(orientation || '').toLowerCase(); |
||||
|
||||
if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){ |
||||
orientation = fallback; |
||||
} |
||||
|
||||
return orientation; |
||||
}, |
||||
|
||||
processResponse: function (result, originalQuery, cacheKey) { |
||||
var that = this, |
||||
options = that.options; |
||||
|
||||
result.suggestions = that.verifySuggestionsFormat(result.suggestions); |
||||
|
||||
// Cache results if cache is not disabled:
|
||||
if (!options.noCache) { |
||||
that.cachedResponse[cacheKey] = result; |
||||
if (options.preventBadQueries && !result.suggestions.length) { |
||||
that.badQueries.push(originalQuery); |
||||
} |
||||
} |
||||
|
||||
// Return if originalQuery is not matching current query:
|
||||
if (originalQuery !== that.getQuery(that.currentValue)) { |
||||
return; |
||||
} |
||||
|
||||
that.suggestions = result.suggestions; |
||||
that.suggest(); |
||||
}, |
||||
|
||||
activate: function (index) { |
||||
var that = this, |
||||
activeItem, |
||||
selected = that.classes.selected, |
||||
container = $(that.suggestionsContainer), |
||||
children = container.find('.' + that.classes.suggestion); |
||||
|
||||
container.find('.' + selected).removeClass(selected); |
||||
|
||||
that.selectedIndex = index; |
||||
|
||||
if (that.selectedIndex !== -1 && children.length > that.selectedIndex) { |
||||
activeItem = children.get(that.selectedIndex); |
||||
$(activeItem).addClass(selected); |
||||
return activeItem; |
||||
} |
||||
|
||||
return null; |
||||
}, |
||||
|
||||
selectHint: function () { |
||||
var that = this, |
||||
i = $.inArray(that.hint, that.suggestions); |
||||
|
||||
that.select(i); |
||||
}, |
||||
|
||||
select: function (i) { |
||||
var that = this; |
||||
that.hide(); |
||||
that.onSelect(i); |
||||
that.disableKillerFn(); |
||||
}, |
||||
|
||||
moveUp: function () { |
||||
var that = this; |
||||
|
||||
if (that.selectedIndex === -1) { |
||||
return; |
||||
} |
||||
|
||||
if (that.selectedIndex === 0) { |
||||
$(that.suggestionsContainer).children().first().removeClass(that.classes.selected); |
||||
that.selectedIndex = -1; |
||||
that.el.val(that.currentValue); |
||||
that.findBestHint(); |
||||
return; |
||||
} |
||||
|
||||
that.adjustScroll(that.selectedIndex - 1); |
||||
}, |
||||
|
||||
moveDown: function () { |
||||
var that = this; |
||||
|
||||
if (that.selectedIndex === (that.suggestions.length - 1)) { |
||||
return; |
||||
} |
||||
|
||||
that.adjustScroll(that.selectedIndex + 1); |
||||
}, |
||||
|
||||
adjustScroll: function (index) { |
||||
var that = this, |
||||
activeItem = that.activate(index); |
||||
|
||||
if (!activeItem) { |
||||
return; |
||||
} |
||||
|
||||
var offsetTop, |
||||
upperBound, |
||||
lowerBound, |
||||
heightDelta = $(activeItem).outerHeight(); |
||||
|
||||
offsetTop = activeItem.offsetTop; |
||||
upperBound = $(that.suggestionsContainer).scrollTop(); |
||||
lowerBound = upperBound + that.options.maxHeight - heightDelta; |
||||
|
||||
if (offsetTop < upperBound) { |
||||
$(that.suggestionsContainer).scrollTop(offsetTop); |
||||
} else if (offsetTop > lowerBound) { |
||||
$(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta); |
||||
} |
||||
|
||||
if (!that.options.preserveInput) { |
||||
that.el.val(that.getValue(that.suggestions[index].value)); |
||||
} |
||||
that.signalHint(null); |
||||
}, |
||||
|
||||
onSelect: function (index) { |
||||
var that = this, |
||||
onSelectCallback = that.options.onSelect, |
||||
suggestion = that.suggestions[index]; |
||||
|
||||
that.currentValue = that.getValue(suggestion.value); |
||||
|
||||
if (that.currentValue !== that.el.val() && !that.options.preserveInput) { |
||||
that.el.val(that.currentValue); |
||||
} |
||||
|
||||
that.signalHint(null); |
||||
that.suggestions = []; |
||||
that.selection = suggestion; |
||||
|
||||
if ($.isFunction(onSelectCallback)) { |
||||
onSelectCallback.call(that.element, suggestion); |
||||
} |
||||
}, |
||||
|
||||
getValue: function (value) { |
||||
var that = this, |
||||
delimiter = that.options.delimiter, |
||||
currentValue, |
||||
parts; |
||||
|
||||
if (!delimiter) { |
||||
return value; |
||||
} |
||||
|
||||
currentValue = that.currentValue; |
||||
parts = currentValue.split(delimiter); |
||||
|
||||
if (parts.length === 1) { |
||||
return value; |
||||
} |
||||
|
||||
return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value; |
||||
}, |
||||
|
||||
dispose: function () { |
||||
var that = this; |
||||
that.el.off('.autocomplete').removeData('autocomplete'); |
||||
that.disableKillerFn(); |
||||
$(window).off('resize.autocomplete', that.fixPositionCapture); |
||||
$(that.suggestionsContainer).remove(); |
||||
} |
||||
}; |
||||
|
||||
// Create chainable jQuery plugin:
|
||||
$.fn.autocomplete = $.fn.devbridgeAutocomplete = function (options, args) { |
||||
var dataKey = 'autocomplete'; |
||||
// If function invoked without argument return
|
||||
// instance of the first matched element:
|
||||
if (!arguments.length) { |
||||
return this.first().data(dataKey); |
||||
} |
||||
|
||||
return this.each(function () { |
||||
var inputElement = $(this), |
||||
instance = inputElement.data(dataKey); |
||||
|
||||
if (typeof options === 'string') { |
||||
if (instance && typeof instance[options] === 'function') { |
||||
instance[options](args); |
||||
} |
||||
} else { |
||||
// If instance already exists, destroy it:
|
||||
if (instance && instance.dispose) { |
||||
instance.dispose(); |
||||
} |
||||
instance = new Autocomplete(this, options); |
||||
inputElement.data(dataKey, instance); |
||||
} |
||||
}); |
||||
}; |
||||
})); |
||||
@ -0,0 +1,68 @@ |
||||
$(function () { |
||||
'use strict'; |
||||
|
||||
$('#q').autocomplete({ |
||||
serviceUrl: "http://127.0.0.1:8000/search/autocomplete/", |
||||
minChars: 2, |
||||
dataType: 'json', |
||||
type: 'GET', |
||||
onSelect: function (suggestion) { |
||||
console.log( suggestion.value + ', data :' + suggestion.data); |
||||
} |
||||
}); |
||||
|
||||
}); |
||||
|
||||
|
||||
function getParameterByName(name, url) { |
||||
if (!url) { |
||||
url = window.location.href; |
||||
} |
||||
name = name.replace(/[\[\]]/g, "\\$&"); |
||||
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), |
||||
results = regex.exec(url); |
||||
if (!results) return null; |
||||
if (!results[2]) return ''; |
||||
return decodeURIComponent(results[2].replace(/\+/g, " ")); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
function onFacetChangeApplied(){ |
||||
var url = window.location.href.split("?")[0]; |
||||
var search_query = getParameterByName('q'); |
||||
var url_with_search_query = url + '?q=' + search_query |
||||
$('input:checkbox.facet').each(function () { |
||||
var sThisVal = (this.checked ? $(this).val() : null); |
||||
var sThisName = (this.checked ? $(this).attr('name') : null); |
||||
if(sThisVal !== null){ |
||||
url_with_search_query += '&'+encodeURIComponent(sThisName)+'='+encodeURIComponent(sThisVal); |
||||
} |
||||
}); |
||||
location.href = url_with_search_query; |
||||
return true; |
||||
} |
||||
|
||||
|
||||
function getQueryParams(){ |
||||
var vars = {}, hash; |
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); |
||||
for(var i = 0; i < hashes.length; i++) |
||||
{ |
||||
hash = hashes[i].split('='); |
||||
vars[hash[1]] = hash[0] ; |
||||
} |
||||
return vars; |
||||
} |
||||
|
||||
|
||||
$( document ).ready(function() { |
||||
var all_params = getQueryParams(); |
||||
console.log(); |
||||
$.each( all_params, function( key, value ) { |
||||
id = decodeURIComponent(key).replace(/\s/g,''); |
||||
$('#'+id).attr('checked', 'checked'); |
||||
}); |
||||
|
||||
}); |
||||
@ -0,0 +1,68 @@ |
||||
$(function () { |
||||
'use strict'; |
||||
|
||||
$('#q').autocomplete({ |
||||
serviceUrl: "http://127.0.0.1:8001/search/autocomplete/", |
||||
minChars: 2, |
||||
dataType: 'json', |
||||
type: 'GET', |
||||
onSelect: function (suggestion) { |
||||
console.log( suggestion.value + ', data :' + suggestion.data); |
||||
} |
||||
}); |
||||
|
||||
}); |
||||
|
||||
|
||||
function getParameterByName(name, url) { |
||||
if (!url) { |
||||
url = window.location.href; |
||||
} |
||||
name = name.replace(/[\[\]]/g, "\\$&"); |
||||
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), |
||||
results = regex.exec(url); |
||||
if (!results) return null; |
||||
if (!results[2]) return ''; |
||||
return decodeURIComponent(results[2].replace(/\+/g, " ")); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
function onFacetChangeApplied(){ |
||||
var url = window.location.href.split("?")[0]; |
||||
var search_query = getParameterByName('q'); |
||||
var url_with_search_query = url + '?q=' + search_query |
||||
$('input:checkbox.facet').each(function () { |
||||
var sThisVal = (this.checked ? $(this).val() : null); |
||||
var sThisName = (this.checked ? $(this).attr('name') : null); |
||||
if(sThisVal !== null){ |
||||
url_with_search_query += '&'+encodeURIComponent(sThisName)+'='+encodeURIComponent(sThisVal); |
||||
} |
||||
}); |
||||
location.href = url_with_search_query; |
||||
return true; |
||||
} |
||||
|
||||
|
||||
function getQueryParams(){ |
||||
var vars = {}, hash; |
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); |
||||
for(var i = 0; i < hashes.length; i++) |
||||
{ |
||||
hash = hashes[i].split('='); |
||||
vars[hash[1]] = hash[0] ; |
||||
} |
||||
return vars; |
||||
} |
||||
|
||||
|
||||
$( document ).ready(function() { |
||||
var all_params = getQueryParams(); |
||||
console.log(); |
||||
$.each( all_params, function( key, value ) { |
||||
id = decodeURIComponent(key).replace(/\s/g,''); |
||||
$('#'+id).attr('checked', 'checked'); |
||||
}); |
||||
|
||||
}); |
||||
@ -0,0 +1,66 @@ |
||||
$(document).ready(function(){ |
||||
var form = $('#form-buying-products'); |
||||
console.log(form); |
||||
form.on('submit', function(e){ |
||||
e.preventDefault(); |
||||
$('#number').val(); |
||||
var nmb = $('#number').val(); |
||||
var submit_btn = $('#submit-btn'); |
||||
var product_id = submit_btn.data('products-id'); |
||||
var product_name = submit_btn.data('products-name'); |
||||
var product_price = submit_btn.data('products-price'); |
||||
console.log(product_id, product_name); |
||||
|
||||
var data = {}; |
||||
data.product_id = product_id; |
||||
data.nmb = nmb; |
||||
var csrf_token = $('#form-buying-products [name="csrfmiddlewaretoken"]').val(); |
||||
data["csrfmiddlewaretoken"] = csrf_token; |
||||
var url = form.attr('action'); |
||||
|
||||
$.ajax({ |
||||
url: url, |
||||
type: 'POST', |
||||
data: data, |
||||
cache: true, |
||||
success: function (data) { |
||||
console.log("OK"); |
||||
console.log(data.products_total_nmb); |
||||
if (data.products_total_nmb){ |
||||
$('#basket_total_nmb').text('('+data.products_total_nmb+')'); |
||||
$('.basket-items ul').html(""); |
||||
$.each(data.products, function(k, v){ |
||||
$('.basket-items ul').append('<li>'+v.name+', ' + v.nmb + 'pc. ' + 'for ' + v.price_per_item + 'rub. ' + |
||||
//'<a class="delete-item" href="">x</a>'+
|
||||
'</li>'); |
||||
}); |
||||
} |
||||
}, |
||||
error: function(){ |
||||
console.log("error") |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
function showingBasket(){ |
||||
$('.basket-items').removeClass('hidden'); |
||||
}; |
||||
|
||||
//$('.basket-container').on('click', function(e){
|
||||
// e.preventDefault();
|
||||
// showingBasket();
|
||||
//});
|
||||
|
||||
$('.basket-container').mouseover(function(){ |
||||
showingBasket(); |
||||
}); |
||||
|
||||
//$('.basket-container').mouseout(function(){
|
||||
// showingBasket();
|
||||
//});
|
||||
|
||||
$(document).on('click', '.delete-item', function(e){ |
||||
e.preventDefault(); |
||||
$(this).closest('li').remove(); |
||||
}) |
||||
}); |
||||
@ -0,0 +1,145 @@ |
||||
$(document).ready(function(){ |
||||
var form = $('#form-buying-products'); |
||||
form.on('submit', function(e){ |
||||
e.preventDefault(); |
||||
$('#number').val(); |
||||
var nmb = $('#number').val(); |
||||
var submit_btn = $('#submit-btn'); |
||||
var product_id = submit_btn.data('products-id'); |
||||
var product_name = submit_btn.data('products-name'); |
||||
var product_price = submit_btn.data('products-price'); |
||||
|
||||
var data = {}; |
||||
data.product_id = product_id; |
||||
data.nmb = nmb; |
||||
var csrf_token = $('#form-buying-products [name="csrfmiddlewaretoken"]').val(); |
||||
data["csrfmiddlewaretoken"] = csrf_token; |
||||
var url = form.attr('action'); |
||||
|
||||
$.ajax({ |
||||
url: url, |
||||
type: 'POST', |
||||
data: data, |
||||
cache: true, |
||||
success: function (data) { |
||||
if (data.products_total_nmb){ |
||||
$('#basket_total_nmb').text('('+data.products_total_nmb+')'); |
||||
$('.basket-items ul').html(""); |
||||
$.each(data.products, function(k, v){ |
||||
$('.basket-items ul').append('<li>'+v.name+', ' + v.nmb + 'pc. ' + 'for ' + v.price_per_item + 'rub. ' + |
||||
//'<a class="delete-item" href="">x</a>'+
|
||||
'</li>'); |
||||
}); |
||||
} |
||||
}, |
||||
error: function(){ |
||||
console.log("error") |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
calculate(); |
||||
|
||||
function showingBasket(){ |
||||
$('.basket-items').removeClass('hidden'); |
||||
}; |
||||
|
||||
//$('.basket-container').on('click', function(e){
|
||||
// e.preventDefault();
|
||||
// showingBasket();
|
||||
//});
|
||||
|
||||
$('.basket-container').mouseover(function(){ |
||||
showingBasket(); |
||||
}); |
||||
|
||||
$('.basket-container').mouseout(function(){ |
||||
showingBasket(); |
||||
}); |
||||
|
||||
$(document).on('click', '.delete-item', function(e){ |
||||
e.preventDefault(); |
||||
$(this).closest('li').remove(); |
||||
}) |
||||
}); |
||||
|
||||
function showOrHide(cb, cat) { |
||||
cb = document.getElementById(cb); |
||||
cat = document.getElementById(cat); |
||||
if (cb.checked) cat.style.display = "block"; |
||||
else cat.style.display = "none"; |
||||
} |
||||
|
||||
function _discount(quantity, discount_policy){ |
||||
if (JSON.stringify(discount_policy) == '{}') { |
||||
return 1 |
||||
} |
||||
else { |
||||
var keys = Object.keys(discount_policy); |
||||
for (var i = 0, len = keys.length; i < len; i++) { |
||||
var split_entry = keys[i].split('-'); |
||||
if (parseInt(split_entry[0]) <= quantity && quantity < parseFloat(split_entry[1])){ |
||||
return parseFloat(discount_policy[keys[i]]); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
function calculate(){ |
||||
var count = document.getElementById("variant_length").value; |
||||
var quantity = document.getElementById("quantity").value; |
||||
var result = document.getElementById("result"); |
||||
var price_per_itom = document.getElementById("price_per_itom"); |
||||
var erw = document.getElementById("erw"); |
||||
var variants = JSON.parse(document.getElementById("variants").value.replace(/'/g, '"')); |
||||
var discount_policy = JSON.parse(document.getElementById("discount_policy").value.replace(/'/g, '"')); |
||||
var product_slug = document.getElementById("product_slug"); |
||||
var result_itog = document.getElementById("result_itog"); |
||||
var tmp_price = 0; |
||||
|
||||
|
||||
if (count == 0) { |
||||
tmp_price = Math.round(variants[0]['price'] * _discount(quantity, discount_policy)); |
||||
result.innerHTML = tmp_price; |
||||
price_per_itom.value = tmp_price; |
||||
tmp_price = tmp_price * quantity; |
||||
result_itog.innerHTML = tmp_price; |
||||
erw.innerHTML = Math.round(tmp_price * 0.05); |
||||
product_slug.value = variants[0].slug; |
||||
} |
||||
|
||||
if (count > 1) { |
||||
var quant0 = document.getElementById("id_0"); |
||||
var quant1 = document.getElementById("id_1"); |
||||
var quant0_val = JSON.parse(quant0.value.replace(/'/g, '"')); |
||||
var quant1_val = JSON.parse(quant1.value.replace(/'/g, '"')); |
||||
for (var i = 0, len = variants.length; i < len; i++) { |
||||
if (variants[i]['attributes'][quant0.name] == quant0_val['name'] && |
||||
variants[i]['attributes'][quant1.name] == quant1_val['name']) { |
||||
tmp_price = Math.round(variants[i]['price'] * _discount(quantity, discount_policy)); |
||||
result.innerHTML = tmp_price; |
||||
price_per_itom.value = tmp_price; |
||||
tmp_price = tmp_price * quantity; |
||||
result_itog.innerHTML = tmp_price; |
||||
erw.innerHTML = Math.round(tmp_price * 0.05); |
||||
product_slug.value = variants[i].slug; |
||||
} |
||||
} |
||||
} |
||||
else { |
||||
var quant0 = document.getElementById("id_0"); |
||||
var quant0_val = JSON.parse(quant0.value.replace(/'/g, '"')); |
||||
for (var i = 0, len = variants.length; i < len; i++) { |
||||
if (variants[i]['attributes'][quant0.name] == quant0_val['name']) { |
||||
tmp_price = Math.round(variants[i]['price'] * _discount(quantity, discount_policy)); |
||||
result.innerHTML = tmp_price; |
||||
price_per_itom.value = tmp_price; |
||||
tmp_price = tmp_price * quantity; |
||||
result_itog.innerHTML = tmp_price; |
||||
erw.innerHTML = Math.round(tmp_price * 0.05); |
||||
product_slug.value = variants[i].slug; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 10 KiB |