Commit c34b3aa04c75598515de2e318e351917915b885c

Authored by Karnovsky A
1 parent 90a6ed1a

-

.htaccess
... ... @@ -53,13 +53,14 @@ AddDefaultCharset utf-8
53 53  
54 54 RewriteRule ^images/(.*)$ frontend/web/images/$1 [L]
55 55  
  56 + RewriteRule ^libraries/(.*)$ frontend/web/libraries/$1 [L]
  57 +
56 58 RewriteRule ^img/(.*)$ frontend/web/img/$1 [L]
57 59  
58 60 RewriteRule ^files/(.*)$ frontend/web/files/$1 [L]
59 61  
60 62 RewriteRule ^fonts/(.*)$ frontend/web/fonts/$1 [L]
61 63  
62   -
63 64 RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|js|images|fonts|img|files)/
64 65  
65 66 RewriteCond %{REQUEST_URI} !index.php
... ...
common/modules/product/CatalogUrlManager.php
... ... @@ -105,12 +105,13 @@ class CatalogUrlManager implements UrlRuleInterface {
105 105 } else {
106 106 $url = 'catalog/';
107 107 }
108   -
109 108 if (!empty($params['word'])) {
110 109 if (!is_array($params['word'])) {
111 110 $params['word'] = [$params['word']];
112 111 }
113 112 $url .= 'word:'. implode(';', $params['word']);
  113 + }
  114 + if (isset($params['word'])) {
114 115 unset($params['word']);
115 116 }
116 117  
... ... @@ -146,6 +147,7 @@ class CatalogUrlManager implements UrlRuleInterface {
146 147 }
147 148 }
148 149 $url .= 'filter:'. implode(';', $filter);
  150 + unset($params['filter']);
149 151 }
150 152  
151 153 if (!empty($params) && ($query = http_build_query($params)) !== '') {
... ...
common/modules/product/models/ProductVariant.php
... ... @@ -24,19 +24,8 @@ use Yii;
24 24 */
25 25 class ProductVariant extends \yii\db\ActiveRecord
26 26 {
27   -
28   - /**just for rukzachok**/
29   - public $count;
30   - public $sum_cost;
31   - public $product_name;
32   - //public $image;
33   - public $translit;
34   - public $translit_rubric;
35   - private $data;
36   -
37   -
38 27 /** @var array $_images */
39   - public $imagesUpload = [];
  28 +// public $imagesUpload = [];
40 29 /**
41 30 * @inheritdoc
42 31 */
... ... @@ -51,13 +40,13 @@ class ProductVariant extends \yii\db\ActiveRecord
51 40 public function rules()
52 41 {
53 42 return [
54   - [['product_id', 'sku', 'product_unit_id'], 'required'],
  43 + [['product_id', 'product_unit_id'], 'required'],
55 44 [['product_id', 'product_unit_id', 'product_variant_type_id'], 'integer'],
56 45 [['price', 'price_old', 'stock'], 'number'],
57 46 [['name', 'sku'], 'string', 'max' => 255],
58 47 [['remote_id'], 'string', 'max' => 20],
59   - [['imagesUpload'], 'safe'],
60   - [['imagesUpload'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg, gif', 'maxFiles' => 50],
  48 +// [['imagesUpload'], 'safe'],
  49 +// [['imagesUpload'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg, gif', 'maxFiles' => 50],
61 50 [['product_unit_id'], 'exist', 'skipOnError' => true, 'targetClass' => ProductUnit::className(), 'targetAttribute' => ['product_unit_id' => 'product_unit_id']],
62 51 ];
63 52 }
... ...
console/config/bootstrap.php
... ... @@ -2,4 +2,4 @@
2 2 Yii::setAlias('@uploadDir', dirname(dirname(__DIR__)) . '/storage/sync');
3 3 Yii::setAlias('@uploadFileProducts', 'products.csv');
4 4  
5   -Yii::setAlias('@productsDir', '/images/products');
  5 +Yii::setAlias('@productsDir', '@frontend/web/images/products');
... ...
console/controllers/ImportController.php
... ... @@ -98,10 +98,10 @@ class ImportController extends Controller {
98 98 $years = explode (',', $data[8]);
99 99  
100 100 // 10 ะฆะตะฝะฐ ัั‚ะฐั€ะฐั
101   - $product_cost_old = $data[9];
  101 + $product_cost_old = $data[10];
102 102  
103 103 // 11 ะฆะตะฝะฐ
104   - $product_cost = $data[10];
  104 + $product_cost = $data[9];
105 105  
106 106 // 12 ะะบั†ะธั
107 107 $product_akciya = (bool)$data[11];
... ... @@ -198,8 +198,8 @@ class ImportController extends Controller {
198 198 $mod_size = $mod_arr[1];
199 199 $mod_color = $mod_arr[2];
200 200 $mod_image = $mod_arr[3];
201   - $mod_cost = $product_cost;
202   - $mod_old_cost = $product_cost_old;
  201 + $mod_cost = floatval($product_cost);
  202 + $mod_old_cost = floatval($product_cost_old);
203 203  
204 204 // Check product variant
205 205 if ( ($_productVariant = ProductVariant::find()->andFilterWhere(['ilike', 'sku', $mod_art])->andFilterWhere(['product_id' => $_product->product_id])->one()) === null ) {
... ... @@ -234,14 +234,23 @@ class ImportController extends Controller {
234 234 $_productVariant->product_variant_type_id = $product_variant_type->product_variant_type_id;
235 235 }
236 236 }
237   -
238   - $_productVariant->save();
  237 + $_productVariant->save(false);
  238 +// if (!$_productVariant->save(false)) {
  239 +//// $this->stdout("$j: Product {$_product->name} #{$_product->product_id} NOT saved (". ($is_new_product ? 'new product' : 'exists product') .")\n");
  240 +//// var_dump($_productVariant);exit;
  241 +// continue;
  242 +// }
  243 +
  244 +// if ($mod_art == '610934725148') {
  245 +// var_dump($_productVariant);
  246 +// exit;
  247 +// }
239 248  
240 249 $MOD_ARRAY[] = $_productVariant->product_variant_id;
241 250  
242 251 if ($mod_image) {
243   - $url = 'http://rukzachok.com.ua/upload/mod/' . $mod_image;
244   - $image = file_get_contents($url);
  252 + $url = 'http://rukzachok.com.ua/upload/mod/' . urlencode($mod_image);
  253 + $image = @file_get_contents($url);
245 254 if ($image) {
246 255 if (($variantImage = ProductImage::find()->andFilterWhere(['ilike', 'image', $mod_image])->andFilterWhere(['product_variant_id' => $_productVariant->product_variant_id])->one()) === null) {
247 256 file_put_contents(Yii::getAlias('@productsDir') . "/" . $mod_image, $image);
... ...
frontend/models/ProductFrontendSearch.php
... ... @@ -51,10 +51,11 @@ class ProductFrontendSearch extends Product {
51 51 } else {
52 52 $query = Product::find();
53 53 }
54   -// $query->joinWith('variant');
  54 + $query->joinWith('variant');
55 55 $query->joinWith('brand');
56   -// $query->joinWith('image');
  56 + $query->joinWith('image');
57 57 $query->joinWith('categories');
  58 + $query->groupBy('product.product_id');
58 59  
59 60 $dataProvider = new ActiveDataProvider([
60 61 'query' => $query,
... ... @@ -89,10 +90,11 @@ class ProductFrontendSearch extends Product {
89 90 }
90 91  
91 92 public function optionsForCategory($category = null, $params = []) {
  93 +// ,
  94 +// 'COUNT('. ProductOption::tableName() .'.product_id) AS _items_count'
92 95 $query = TaxOption::find()
93 96 ->select([
94   - TaxOption::tableName() .'.*',
95   - 'COUNT('. ProductOption::tableName() .'.product_id) AS _items_count'
  97 + TaxOption::tableName() .'.*'
96 98 ])
97 99 ->innerJoin(ProductOption::tableName(), ProductOption::tableName() .'.option_id='. TaxOption::tableName() .'.tax_option_id')
98 100 ->innerJoin(ProductCategory::tableName(), ProductCategory::tableName() .'.product_id='. ProductOption::tableName() .'.product_id')
... ... @@ -102,7 +104,7 @@ class ProductFrontendSearch extends Product {
102 104 $query->andWhere([ProductCategory::tableName() .'.category_id' => $category->category_id]);
103 105 }
104 106 $query->groupBy(TaxOption::tableName() .'.tax_option_id');
105   -
  107 + $query->limit(null);
106 108 if (!empty($params['prices'])) {
107 109 if ($params['prices']['min'] > 0 || $params['prices']['max'] > 0) {
108 110 $query->innerJoin(ProductVariant::tableName(), ProductVariant::tableName() .'.product_id='. ProductCategory::tableName() .'.product_id');
... ...
frontend/views/catalog/products.php
... ... @@ -21,11 +21,39 @@ $this->params['seo']['description'] = 'TEST DESCRIPTION';
21 21 $this->params['seo']['fields']['name'] = 'TEST NAME FROM FIELD';
22 22 $this->params['seo']['key']= 'product_list';
23 23  
24   -$this->registerCssFile (Yii::$app->request->BaseUrl . '/css/begunok.css');
25   -$this->registerJsFile (Yii::$app->request->baseUrl . '/js/jquery.ui-slider.js', ['position' => View::POS_HEAD, 'depends' => ['yii\web\JqueryAsset']]);
26   -$this->registerJsFile (Yii::$app->request->baseUrl . '/js/begunok.js', ['position' => View::POS_HEAD, 'depends' => ['yii\web\JqueryAsset']]);
  24 +$this->registerCssFile (Yii::getAlias('@web/css/ion.rangeSlider.css'));
  25 +$this->registerCssFile (Yii::getAlias('@web/css/ion.rangeSlider.skinHTML5.css'));
  26 +$this->registerJsFile (Yii::getAlias('@web/js/ion.rangeSlider.js'));
27 27 ?>
28 28  
  29 +<script type="text/javascript">
  30 + <?php if ($priceLimits['min'] < $priceLimits['max']) :?>
  31 + $(document).ready(function() {
  32 + // price rangeslider (filter price slider)
  33 + $("#price_interval").ionRangeSlider({
  34 + type: "double",
  35 + min: <?= $priceLimits['min']?>,
  36 + max: <?= $priceLimits['max']?>,
  37 + from: <?= empty($filter['prices']['min']) ? $priceLimits['min'] : $filter['prices']['min']?>,
  38 + to: <?= empty($filter['prices']['max']) ? $priceLimits['max'] : $filter['prices']['max']?>,
  39 + grid: false,
  40 + onFinish: function(e) {
  41 + <?php
  42 + $filterWhitoutPrice = $filter;
  43 + $filterWhitoutPrice['prices'] = [
  44 + 'min' => '{from}',
  45 + 'max' => '{to}',
  46 + ];
  47 + ?>
  48 + var url = "<?= Url::to(['catalog/category', 'category' => $category, 'filter' => $filterWhitoutPrice])?>";
  49 + var from = e.from;
  50 + var to = e.to;
  51 + document.location = url.replace('{from}', from).replace('{to}', to);
  52 + }
  53 + });
  54 + });
  55 + <?php endif?>
  56 +</script>
29 57  
30 58 <nav class="bread-crumbs">
31 59 <?= Breadcrumbs::widget ([
... ... @@ -43,23 +71,12 @@ $this-&gt;registerJsFile (Yii::$app-&gt;request-&gt;baseUrl . &#39;/js/begunok.js&#39;, [&#39;positio
43 71 <img src="<?= Yii::$app->request->baseUrl ?>/img/pro.png" width="42" height="22"/>
44 72  
45 73 <form action="#" name="filter_catalog_page_form" class="filter-catalog-form">
46   - <?php if (FALSE && !empty($filter)) :?>
  74 + <?php if (!empty($filter)) :?>
47 75 <div class="filter_accept_bloc">
48 76 <!-- <button type="submit" class="filter_accept_btn">ะฟั€ะธะผะตะฝะธั‚ัŒ</button>-->
49 77 <a href="<?= Url::to(['catalog/category', 'category' => $category])?>" class="_form_checkbox_reset">ัะฑั€ะพัะธั‚ัŒ ั„ะธะปัŒั‚ั€ั‹</a>
50 78 </div>
51 79 <?php endif?>
52   -
53   - <?php if (FALSE && $priceLimits['min'] < $priceLimits['max']) :?>
54   - <li>ะฆะตะฝะฐ:
55   - <div class="arrow"><img src="/images/head_up.png" alt=""></i></div>
56   - <div class="price_filter first_price_li">
57   - <div class="price_slider">
58   - <input type="text" id="price_interval" name="price_interval" value="" />
59   - </div>
60   - </div>
61   - </li>
62   - <?php endif?>
63 80 <?php if ($brandProvider->totalCount > 0) :?>
64 81 <div class="filters">
65 82 <div class="begin">ะ‘ั€ะตะฝะดั‹</div>
... ... @@ -70,7 +87,7 @@ $this-&gt;registerJsFile (Yii::$app-&gt;request-&gt;baseUrl . &#39;/js/begunok.js&#39;, [&#39;positio
70 87 ?>
71 88 <li>
72 89 <input type="checkbox" class="brands-option" <?= $checked ? ' checked' : ''?> onchange="document.location='<?= $option_url?>'" />
73   - <a href="<?= $option_url?>"><?= $brand->name?> (<?= $brand->getProducts()->count()?>)</a>
  90 + <a href="<?= $option_url?>"><?= $brand->name?><?php /* (<?= $brand->getProducts()->count()?>)*/?></a>
74 91 </li>
75 92 <?php endforeach?>
76 93 </ul>
... ... @@ -88,13 +105,24 @@ $this-&gt;registerJsFile (Yii::$app-&gt;request-&gt;baseUrl . &#39;/js/begunok.js&#39;, [&#39;positio
88 105 ?>
89 106 <li>
90 107 <input type="checkbox" class="features-option" onchange="document.location='<?= $option_url?>'" <?php /* name="option[<?= $group->alias?>][]"value="<?= $option->alias?>"*/?><?= $checked ? ' checked' : ''?> />
91   - <a href="<?= $option_url?>"><?= $option->ValueRenderHTML?>&nbsp;(<?= $option->_items_count?>)</a>
  108 + <a href="<?= $option_url?>"><?= $option->ValueRenderHTML?><?php /*&nbsp;(<?= $option->_items_count?>)*/?></a>
92 109 </li>
93 110 <?php endforeach?>
94 111 </ul>
95 112 </div>
96 113 <?php endforeach?>
97 114 <?php endif?>
  115 +
  116 + <?php if ($priceLimits['min'] < $priceLimits['max']) :?>
  117 + <div class="cost_box filters">
  118 + <div class="begin">ะฆะตะฝะฐ</div>
  119 + <div class="price_filter first_price_li">
  120 + <div class="price_slider">
  121 + <input type="text" id="price_interval" name="price_interval" value="" />
  122 + </div>
  123 + </div>
  124 + </div>
  125 + <?php endif?>
98 126 </form>
99 127 </div>
100 128  
... ...
frontend/views/layouts/main.php
... ... @@ -97,9 +97,8 @@
97 97 <div class="both"></div>
98 98 </div>
99 99 <div class="search">
100   - <form method="get" action="<?= Url::to (['products/search']) ?>">
101   - <input type="text" name="search_str"
102   - value='<?= ! empty($_GET['search_str']) ? Html::encode ($_GET['search_str']) : '' ?>'/><input
  100 + <form method="get" action="/catalog">
  101 + <input type="text" name="word" value='<?= ! empty($_GET['word']) ? Html::encode ($_GET['word']) : '' ?>'/><input
103 102 type="submit" value=" "/>
104 103 </form>
105 104 </div>
... ...
frontend/web/css/ion.rangeSlider.css 0 โ†’ 100644
  1 +/* Ion.RangeSlider
  2 +// css version 2.0.3
  3 +// ยฉ 2013-2014 Denis Ineshin | IonDen.com
  4 +// ===================================================================================================================*/
  5 +
  6 +/* =====================================================================================================================
  7 +// RangeSlider */
  8 +
  9 +.irs {
  10 + position: relative; display: block;
  11 + -webkit-touch-callout: none;
  12 + -webkit-user-select: none;
  13 + -khtml-user-select: none;
  14 + -moz-user-select: none;
  15 + -ms-user-select: none;
  16 + user-select: none;
  17 +}
  18 + .irs-line {
  19 + position: relative; display: block;
  20 + overflow: hidden;
  21 + outline: none !important;
  22 + }
  23 + .irs-line-left, .irs-line-mid, .irs-line-right {
  24 + position: absolute; display: block;
  25 + top: 0;
  26 + }
  27 + .irs-line-left {
  28 + left: 0; width: 11%;
  29 + }
  30 + .irs-line-mid {
  31 + left: 9%; width: 82%;
  32 + }
  33 + .irs-line-right {
  34 + right: 0; width: 11%;
  35 + }
  36 +
  37 + .irs-bar {
  38 + position: absolute; display: block;
  39 + left: 0; width: 0;
  40 + }
  41 + .irs-bar-edge {
  42 + position: absolute; display: block;
  43 + top: 0; left: 0;
  44 + }
  45 +
  46 + .irs-shadow {
  47 + position: absolute; display: none;
  48 + left: 0; width: 0;
  49 + }
  50 +
  51 + .irs-slider {
  52 + position: absolute; display: block;
  53 + cursor: default;
  54 + z-index: 1;
  55 + }
  56 + .irs-slider.single {
  57 +
  58 + }
  59 + .irs-slider.from {
  60 +
  61 + }
  62 + .irs-slider.to {
  63 +
  64 + }
  65 + .irs-slider.type_last {
  66 + z-index: 2;
  67 + }
  68 +
  69 + .irs-min {
  70 + position: absolute; display: block;
  71 + left: 0;
  72 + cursor: default;
  73 + }
  74 + .irs-max {
  75 + position: absolute; display: block;
  76 + right: 0;
  77 + cursor: default;
  78 + }
  79 +
  80 + .irs-from, .irs-to, .irs-single {
  81 + position: absolute; display: block;
  82 + top: 0; left: 0;
  83 + cursor: default;
  84 + white-space: nowrap;
  85 + }
  86 +
  87 +.irs-grid {
  88 + position: absolute; display: none;
  89 + bottom: 0; left: 0;
  90 + width: 100%; height: 20px;
  91 +}
  92 +.irs-with-grid .irs-grid {
  93 + display: block;
  94 +}
  95 + .irs-grid-pol {
  96 + position: absolute;
  97 + top: 0; left: 0;
  98 + width: 1px; height: 8px;
  99 + background: #000;
  100 + }
  101 + .irs-grid-pol.small {
  102 + height: 4px;
  103 + }
  104 + .irs-grid-text {
  105 + position: absolute;
  106 + bottom: 0; left: 0;
  107 + white-space: nowrap;
  108 + text-align: center;
  109 + font-size: 9px; line-height: 9px;
  110 + padding: 0 3px;
  111 + color: #000;
  112 + }
  113 +
  114 +.irs-disable-mask {
  115 + position: absolute; display: block;
  116 + top: 0; left: -1%;
  117 + width: 102%; height: 100%;
  118 + cursor: default;
  119 + background: rgba(0,0,0,0.0);
  120 + z-index: 2;
  121 +}
  122 +.lt-ie9 .irs-disable-mask {
  123 + background: #000;
  124 + filter: alpha(opacity=0);
  125 + cursor: not-allowed;
  126 +}
  127 +
  128 +.irs-disabled {
  129 + opacity: 0.4;
  130 +}
  131 +
  132 +
  133 +.irs-hidden-input {
  134 + position: absolute !important;
  135 + display: block !important;
  136 + top: 0 !important;
  137 + left: 0 !important;
  138 + width: 0 !important;
  139 + height: 0 !important;
  140 + font-size: 0 !important;
  141 + line-height: 0 !important;
  142 + padding: 0 !important;
  143 + margin: 0 !important;
  144 + overflow: hidden;
  145 + outline: none !important;
  146 + z-index: -9999 !important;
  147 + background: none !important;
  148 + border-style: solid !important;
  149 + border-color: transparent !important;
  150 +}
... ...
frontend/web/css/ion.rangeSlider.skinHTML5.css 0 โ†’ 100644
  1 +/* Ion.RangeSlider, Simple Skin
  2 +// css version 2.0.3
  3 +// ยฉ Denis Ineshin, 2014 https://github.com/IonDen
  4 +// ยฉ guybowden, 2014 https://github.com/guybowden
  5 +// ===================================================================================================================*/
  6 +
  7 +/* =====================================================================================================================
  8 +// Skin details */
  9 +
  10 +.irs {
  11 + height: 55px;
  12 +}
  13 +.irs-with-grid {
  14 + height: 75px;
  15 +}
  16 +.irs-line {
  17 + height: 10px; top: 33px;
  18 + background: #EEE;
  19 + /*background: linear-gradient(to bottom, #DDD -50%, #FFF 150%); !* W3C *!*/
  20 + border: 1px solid #CCC;
  21 + border-radius: 16px;
  22 + -moz-border-radius: 16px;
  23 +}
  24 + .irs-line-left {
  25 + height: 8px;
  26 + }
  27 + .irs-line-mid {
  28 + height: 8px;
  29 + }
  30 + .irs-line-right {
  31 + height: 8px;
  32 + }
  33 +
  34 +.irs-bar {
  35 + height: 10px; top: 33px;
  36 + border-top: 1px solid #F75D50;
  37 + border-bottom: 1px solid #F75D50;
  38 + background: #F75D50;
  39 + /*background: linear-gradient(to top, rgba(66,139,202,1) 0%,rgba(127,195,232,1) 100%); !* W3C *!*/
  40 +}
  41 + .irs-bar-edge {
  42 + height: 10px; top: 33px;
  43 + width: 14px;
  44 + border: 1px solid #F75D50;
  45 + border-right: 0;
  46 + background: #F75D50;
  47 + background: linear-gradient(to top, rgba(66,139,202,1) 0%,rgba(127,195,232,1) 100%); /* W3C */
  48 + border-radius: 16px 0 0 16px;
  49 + -moz-border-radius: 16px 0 0 16px;
  50 + }
  51 +
  52 +.irs-shadow {
  53 + height: 2px; top: 38px;
  54 + background: #000;
  55 + opacity: 0.3;
  56 + border-radius: 5px;
  57 + -moz-border-radius: 5px;
  58 +}
  59 +.lt-ie9 .irs-shadow {
  60 + filter: alpha(opacity=30);
  61 +}
  62 +
  63 +.irs-slider {
  64 + top: 25px;
  65 + width: 27px; height: 27px;
  66 + border: 1px solid #AAA;
  67 + background: #DDD;
  68 + background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(220,220,220,1) 20%,rgba(255,255,255,1) 100%); /* W3C */
  69 + border-radius: 27px;
  70 + -moz-border-radius: 27px;
  71 + box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
  72 + cursor: pointer;
  73 +}
  74 +
  75 +.irs-slider.state_hover, .irs-slider:hover {
  76 + background: #FFF;
  77 +}
  78 +
  79 +.irs-min, .irs-max {
  80 + color: #333;
  81 + font-size: 12px; line-height: 1.333;
  82 + text-shadow: none;
  83 + top: 0;
  84 + padding: 1px 5px;
  85 + background: rgba(0,0,0,0.1);
  86 + border-radius: 3px;
  87 + -moz-border-radius: 3px;
  88 +}
  89 +
  90 +.lt-ie9 .irs-min, .lt-ie9 .irs-max {
  91 + background: #ccc;
  92 +}
  93 +
  94 +.irs-from, .irs-to, .irs-single {
  95 + color: #fff;
  96 + font-size: 14px; line-height: 1.333;
  97 + text-shadow: none;
  98 + padding: 1px 5px;
  99 + background: #F75D50;
  100 + border-radius: 3px;
  101 + -moz-border-radius: 3px;
  102 +}
  103 +.lt-ie9 .irs-from, .lt-ie9 .irs-to, .lt-ie9 .irs-single {
  104 + background: #999;
  105 +}
  106 +
  107 +.irs-grid {
  108 + height: 27px;
  109 +}
  110 +.irs-grid-pol {
  111 + opacity: 0.5;
  112 + background: #F75D50;
  113 +}
  114 +.irs-grid-pol.small {
  115 + background: #999;
  116 +}
  117 +
  118 +.irs-grid-text {
  119 + bottom: 5px;
  120 + color: #99a4ac;
  121 +}
  122 +
  123 +.irs-disabled {
  124 +}
  125 +
  126 +
  127 +.irs-slider {
  128 + top: 27px;
  129 + width: 20px; height: 20px;
  130 + background: #6BA034;
  131 + border-radius: 4px;
  132 + -moz-border-radius: 27px;
  133 + box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
  134 + cursor: pointer;
  135 +}
  136 +.irs-slider:after {
  137 + content: "";
  138 + position: absolute;
  139 + width: 6px;
  140 + height: 6px;
  141 + z-index: 2;
  142 + bottom: 7px;
  143 + right: 7px;
  144 + background: white;
  145 +}
  146 +.irs-slider.state_hover, .irs-slider:hover {
  147 + background: #8ECC4E;
  148 +}
  149 +
  150 +.irs-min, .irs-max {
  151 + color: #333;
  152 + font-size: 12px; line-height: 1.333;
  153 + text-shadow: none;
  154 + top: 0;
  155 + padding: 1px 5px;
  156 + background: rgba(0,0,0,0.1);
  157 + border-radius: 3px;
  158 + -moz-border-radius: 3px;
  159 +}
... ...
frontend/web/js/ion.rangeSlider.js 0 โ†’ 100644
  1 +// Ion.RangeSlider
  2 +// version 2.1.4 Build: 355
  3 +// ยฉ Denis Ineshin, 2016
  4 +// https://github.com/IonDen
  5 +//
  6 +// Project page: http://ionden.com/a/plugins/ion.rangeSlider/en.html
  7 +// GitHub page: https://github.com/IonDen/ion.rangeSlider
  8 +//
  9 +// Released under MIT licence:
  10 +// http://ionden.com/a/plugins/licence-en.html
  11 +// =====================================================================================================================
  12 +
  13 +(function (factory) {
  14 + if (typeof define === 'function' && define.amd) {
  15 + define(['jquery'], function ($) {
  16 + factory($, document, window, navigator);
  17 + });
  18 + } else {
  19 + factory(jQuery, document, window, navigator);
  20 + }
  21 +} (function ($, document, window, navigator, undefined) {
  22 + "use strict";
  23 +
  24 + // =================================================================================================================
  25 + // Service
  26 +
  27 + var plugin_count = 0;
  28 +
  29 + // IE8 fix
  30 + var is_old_ie = (function () {
  31 + var n = navigator.userAgent,
  32 + r = /msie\s\d+/i,
  33 + v;
  34 + if (n.search(r) > 0) {
  35 + v = r.exec(n).toString();
  36 + v = v.split(" ")[1];
  37 + if (v < 9) {
  38 + $("html").addClass("lt-ie9");
  39 + return true;
  40 + }
  41 + }
  42 + return false;
  43 + } ());
  44 + if (!Function.prototype.bind) {
  45 + Function.prototype.bind = function bind(that) {
  46 +
  47 + var target = this;
  48 + var slice = [].slice;
  49 +
  50 + if (typeof target != "function") {
  51 + throw new TypeError();
  52 + }
  53 +
  54 + var args = slice.call(arguments, 1),
  55 + bound = function () {
  56 +
  57 + if (this instanceof bound) {
  58 +
  59 + var F = function(){};
  60 + F.prototype = target.prototype;
  61 + var self = new F();
  62 +
  63 + var result = target.apply(
  64 + self,
  65 + args.concat(slice.call(arguments))
  66 + );
  67 + if (Object(result) === result) {
  68 + return result;
  69 + }
  70 + return self;
  71 +
  72 + } else {
  73 +
  74 + return target.apply(
  75 + that,
  76 + args.concat(slice.call(arguments))
  77 + );
  78 +
  79 + }
  80 +
  81 + };
  82 +
  83 + return bound;
  84 + };
  85 + }
  86 + if (!Array.prototype.indexOf) {
  87 + Array.prototype.indexOf = function(searchElement, fromIndex) {
  88 + var k;
  89 + if (this == null) {
  90 + throw new TypeError('"this" is null or not defined');
  91 + }
  92 + var O = Object(this);
  93 + var len = O.length >>> 0;
  94 + if (len === 0) {
  95 + return -1;
  96 + }
  97 + var n = +fromIndex || 0;
  98 + if (Math.abs(n) === Infinity) {
  99 + n = 0;
  100 + }
  101 + if (n >= len) {
  102 + return -1;
  103 + }
  104 + k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
  105 + while (k < len) {
  106 + if (k in O && O[k] === searchElement) {
  107 + return k;
  108 + }
  109 + k++;
  110 + }
  111 + return -1;
  112 + };
  113 + }
  114 +
  115 +
  116 +
  117 + // =================================================================================================================
  118 + // Template
  119 +
  120 + var base_html =
  121 + '<span class="irs">' +
  122 + '<span class="irs-line" tabindex="-1"><span class="irs-line-left"></span><span class="irs-line-mid"></span><span class="irs-line-right"></span></span>' +
  123 + '<span class="irs-min">0</span><span class="irs-max">1</span>' +
  124 + '<span class="irs-from">0</span><span class="irs-to">0</span><span class="irs-single">0</span>' +
  125 + '</span>' +
  126 + '<span class="irs-grid"></span>' +
  127 + '<span class="irs-bar"></span>';
  128 +
  129 + var single_html =
  130 + '<span class="irs-bar-edge"></span>' +
  131 + '<span class="irs-shadow shadow-single"></span>' +
  132 + '<span class="irs-slider single"></span>';
  133 +
  134 + var double_html =
  135 + '<span class="irs-shadow shadow-from"></span>' +
  136 + '<span class="irs-shadow shadow-to"></span>' +
  137 + '<span class="irs-slider from"></span>' +
  138 + '<span class="irs-slider to"></span>';
  139 +
  140 + var disable_html =
  141 + '<span class="irs-disable-mask"></span>';
  142 +
  143 +
  144 +
  145 + // =================================================================================================================
  146 + // Core
  147 +
  148 + /**
  149 + * Main plugin constructor
  150 + *
  151 + * @param input {Object} link to base input element
  152 + * @param options {Object} slider config
  153 + * @param plugin_count {Number}
  154 + * @constructor
  155 + */
  156 + var IonRangeSlider = function (input, options, plugin_count) {
  157 + this.VERSION = "2.1.4";
  158 + this.input = input;
  159 + this.plugin_count = plugin_count;
  160 + this.current_plugin = 0;
  161 + this.calc_count = 0;
  162 + this.update_tm = 0;
  163 + this.old_from = 0;
  164 + this.old_to = 0;
  165 + this.old_min_interval = null;
  166 + this.raf_id = null;
  167 + this.dragging = false;
  168 + this.force_redraw = false;
  169 + this.no_diapason = false;
  170 + this.is_key = false;
  171 + this.is_update = false;
  172 + this.is_start = true;
  173 + this.is_finish = false;
  174 + this.is_active = false;
  175 + this.is_resize = false;
  176 + this.is_click = false;
  177 +
  178 + // cache for links to all DOM elements
  179 + this.$cache = {
  180 + win: $(window),
  181 + body: $(document.body),
  182 + input: $(input),
  183 + cont: null,
  184 + rs: null,
  185 + min: null,
  186 + max: null,
  187 + from: null,
  188 + to: null,
  189 + single: null,
  190 + bar: null,
  191 + line: null,
  192 + s_single: null,
  193 + s_from: null,
  194 + s_to: null,
  195 + shad_single: null,
  196 + shad_from: null,
  197 + shad_to: null,
  198 + edge: null,
  199 + grid: null,
  200 + grid_labels: []
  201 + };
  202 +
  203 + // storage for measure variables
  204 + this.coords = {
  205 + // left
  206 + x_gap: 0,
  207 + x_pointer: 0,
  208 +
  209 + // width
  210 + w_rs: 0,
  211 + w_rs_old: 0,
  212 + w_handle: 0,
  213 +
  214 + // percents
  215 + p_gap: 0,
  216 + p_gap_left: 0,
  217 + p_gap_right: 0,
  218 + p_step: 0,
  219 + p_pointer: 0,
  220 + p_handle: 0,
  221 + p_single_fake: 0,
  222 + p_single_real: 0,
  223 + p_from_fake: 0,
  224 + p_from_real: 0,
  225 + p_to_fake: 0,
  226 + p_to_real: 0,
  227 + p_bar_x: 0,
  228 + p_bar_w: 0,
  229 +
  230 + // grid
  231 + grid_gap: 0,
  232 + big_num: 0,
  233 + big: [],
  234 + big_w: [],
  235 + big_p: [],
  236 + big_x: []
  237 + };
  238 +
  239 + // storage for labels measure variables
  240 + this.labels = {
  241 + // width
  242 + w_min: 0,
  243 + w_max: 0,
  244 + w_from: 0,
  245 + w_to: 0,
  246 + w_single: 0,
  247 +
  248 + // percents
  249 + p_min: 0,
  250 + p_max: 0,
  251 + p_from_fake: 0,
  252 + p_from_left: 0,
  253 + p_to_fake: 0,
  254 + p_to_left: 0,
  255 + p_single_fake: 0,
  256 + p_single_left: 0
  257 + };
  258 +
  259 +
  260 +
  261 + /**
  262 + * get and validate config
  263 + */
  264 + var $inp = this.$cache.input,
  265 + val = $inp.prop("value"),
  266 + config, config_from_data, prop;
  267 +
  268 + // default config
  269 + config = {
  270 + type: "single",
  271 +
  272 + min: 10,
  273 + max: 100,
  274 + from: null,
  275 + to: null,
  276 + step: 1,
  277 +
  278 + min_interval: 0,
  279 + max_interval: 0,
  280 + drag_interval: false,
  281 +
  282 + values: [],
  283 + p_values: [],
  284 +
  285 + from_fixed: false,
  286 + from_min: null,
  287 + from_max: null,
  288 + from_shadow: false,
  289 +
  290 + to_fixed: false,
  291 + to_min: null,
  292 + to_max: null,
  293 + to_shadow: false,
  294 +
  295 + prettify_enabled: true,
  296 + prettify_separator: " ",
  297 + prettify: null,
  298 +
  299 + force_edges: false,
  300 +
  301 + keyboard: false,
  302 + keyboard_step: 5,
  303 +
  304 + grid: false,
  305 + grid_margin: true,
  306 + grid_num: 4,
  307 + grid_snap: false,
  308 +
  309 + hide_min_max: false,
  310 + hide_from_to: false,
  311 +
  312 + prefix: "",
  313 + postfix: "",
  314 + max_postfix: "",
  315 + decorate_both: true,
  316 + values_separator: " โ€” ",
  317 +
  318 + input_values_separator: ";",
  319 +
  320 + disable: false,
  321 +
  322 + onStart: null,
  323 + onChange: null,
  324 + onFinish: null,
  325 + onUpdate: null
  326 + };
  327 +
  328 +
  329 +
  330 + // config from data-attributes extends js config
  331 + config_from_data = {
  332 + type: $inp.data("type"),
  333 +
  334 + min: $inp.data("min"),
  335 + max: $inp.data("max"),
  336 + from: $inp.data("from"),
  337 + to: $inp.data("to"),
  338 + step: $inp.data("step"),
  339 +
  340 + min_interval: $inp.data("minInterval"),
  341 + max_interval: $inp.data("maxInterval"),
  342 + drag_interval: $inp.data("dragInterval"),
  343 +
  344 + values: $inp.data("values"),
  345 +
  346 + from_fixed: $inp.data("fromFixed"),
  347 + from_min: $inp.data("fromMin"),
  348 + from_max: $inp.data("fromMax"),
  349 + from_shadow: $inp.data("fromShadow"),
  350 +
  351 + to_fixed: $inp.data("toFixed"),
  352 + to_min: $inp.data("toMin"),
  353 + to_max: $inp.data("toMax"),
  354 + to_shadow: $inp.data("toShadow"),
  355 +
  356 + prettify_enabled: $inp.data("prettifyEnabled"),
  357 + prettify_separator: $inp.data("prettifySeparator"),
  358 +
  359 + force_edges: $inp.data("forceEdges"),
  360 +
  361 + keyboard: $inp.data("keyboard"),
  362 + keyboard_step: $inp.data("keyboardStep"),
  363 +
  364 + grid: $inp.data("grid"),
  365 + grid_margin: $inp.data("gridMargin"),
  366 + grid_num: $inp.data("gridNum"),
  367 + grid_snap: $inp.data("gridSnap"),
  368 +
  369 + hide_min_max: $inp.data("hideMinMax"),
  370 + hide_from_to: $inp.data("hideFromTo"),
  371 +
  372 + prefix: $inp.data("prefix"),
  373 + postfix: $inp.data("postfix"),
  374 + max_postfix: $inp.data("maxPostfix"),
  375 + decorate_both: $inp.data("decorateBoth"),
  376 + values_separator: $inp.data("valuesSeparator"),
  377 +
  378 + input_values_separator: $inp.data("inputValuesSeparator"),
  379 +
  380 + disable: $inp.data("disable")
  381 + };
  382 + config_from_data.values = config_from_data.values && config_from_data.values.split(",");
  383 +
  384 + for (prop in config_from_data) {
  385 + if (config_from_data.hasOwnProperty(prop)) {
  386 + if (!config_from_data[prop] && config_from_data[prop] !== 0) {
  387 + delete config_from_data[prop];
  388 + }
  389 + }
  390 + }
  391 +
  392 +
  393 +
  394 + // input value extends default config
  395 + if (val) {
  396 + val = val.split(config_from_data.input_values_separator || options.input_values_separator || ";");
  397 +
  398 + if (val[0] && val[0] == +val[0]) {
  399 + val[0] = +val[0];
  400 + }
  401 + if (val[1] && val[1] == +val[1]) {
  402 + val[1] = +val[1];
  403 + }
  404 +
  405 + if (options && options.values && options.values.length) {
  406 + config.from = val[0] && options.values.indexOf(val[0]);
  407 + config.to = val[1] && options.values.indexOf(val[1]);
  408 + } else {
  409 + config.from = val[0] && +val[0];
  410 + config.to = val[1] && +val[1];
  411 + }
  412 + }
  413 +
  414 +
  415 +
  416 + // js config extends default config
  417 + $.extend(config, options);
  418 +
  419 +
  420 + // data config extends config
  421 + $.extend(config, config_from_data);
  422 + this.options = config;
  423 +
  424 +
  425 +
  426 + // validate config, to be sure that all data types are correct
  427 + this.validate();
  428 +
  429 +
  430 +
  431 + // default result object, returned to callbacks
  432 + this.result = {
  433 + input: this.$cache.input,
  434 + slider: null,
  435 +
  436 + min: this.options.min,
  437 + max: this.options.max,
  438 +
  439 + from: this.options.from,
  440 + from_percent: 0,
  441 + from_value: null,
  442 +
  443 + to: this.options.to,
  444 + to_percent: 0,
  445 + to_value: null
  446 + };
  447 +
  448 +
  449 +
  450 + this.init();
  451 + };
  452 +
  453 + IonRangeSlider.prototype = {
  454 +
  455 + /**
  456 + * Starts or updates the plugin instance
  457 + *
  458 + * @param is_update {boolean}
  459 + */
  460 + init: function (is_update) {
  461 + this.no_diapason = false;
  462 + this.coords.p_step = this.convertToPercent(this.options.step, true);
  463 +
  464 + this.target = "base";
  465 +
  466 + this.toggleInput();
  467 + this.append();
  468 + this.setMinMax();
  469 +
  470 + if (is_update) {
  471 + this.force_redraw = true;
  472 + this.calc(true);
  473 +
  474 + // callbacks called
  475 + this.callOnUpdate();
  476 + } else {
  477 + this.force_redraw = true;
  478 + this.calc(true);
  479 +
  480 + // callbacks called
  481 + this.callOnStart();
  482 + }
  483 +
  484 + this.updateScene();
  485 + },
  486 +
  487 + /**
  488 + * Appends slider template to a DOM
  489 + */
  490 + append: function () {
  491 + var container_html = '<span class="irs js-irs-' + this.plugin_count + '"></span>';
  492 + this.$cache.input.before(container_html);
  493 + this.$cache.input.prop("readonly", true);
  494 + this.$cache.cont = this.$cache.input.prev();
  495 + this.result.slider = this.$cache.cont;
  496 +
  497 + this.$cache.cont.html(base_html);
  498 + this.$cache.rs = this.$cache.cont.find(".irs");
  499 + this.$cache.min = this.$cache.cont.find(".irs-min");
  500 + this.$cache.max = this.$cache.cont.find(".irs-max");
  501 + this.$cache.from = this.$cache.cont.find(".irs-from");
  502 + this.$cache.to = this.$cache.cont.find(".irs-to");
  503 + this.$cache.single = this.$cache.cont.find(".irs-single");
  504 + this.$cache.bar = this.$cache.cont.find(".irs-bar");
  505 + this.$cache.line = this.$cache.cont.find(".irs-line");
  506 + this.$cache.grid = this.$cache.cont.find(".irs-grid");
  507 +
  508 + if (this.options.type === "single") {
  509 + this.$cache.cont.append(single_html);
  510 + this.$cache.edge = this.$cache.cont.find(".irs-bar-edge");
  511 + this.$cache.s_single = this.$cache.cont.find(".single");
  512 + this.$cache.from[0].style.visibility = "hidden";
  513 + this.$cache.to[0].style.visibility = "hidden";
  514 + this.$cache.shad_single = this.$cache.cont.find(".shadow-single");
  515 + } else {
  516 + this.$cache.cont.append(double_html);
  517 + this.$cache.s_from = this.$cache.cont.find(".from");
  518 + this.$cache.s_to = this.$cache.cont.find(".to");
  519 + this.$cache.shad_from = this.$cache.cont.find(".shadow-from");
  520 + this.$cache.shad_to = this.$cache.cont.find(".shadow-to");
  521 +
  522 + this.setTopHandler();
  523 + }
  524 +
  525 + if (this.options.hide_from_to) {
  526 + this.$cache.from[0].style.display = "none";
  527 + this.$cache.to[0].style.display = "none";
  528 + this.$cache.single[0].style.display = "none";
  529 + }
  530 +
  531 + this.appendGrid();
  532 +
  533 + if (this.options.disable) {
  534 + this.appendDisableMask();
  535 + this.$cache.input[0].disabled = true;
  536 + } else {
  537 + this.$cache.cont.removeClass("irs-disabled");
  538 + this.$cache.input[0].disabled = false;
  539 + this.bindEvents();
  540 + }
  541 +
  542 + if (this.options.drag_interval) {
  543 + this.$cache.bar[0].style.cursor = "ew-resize";
  544 + }
  545 + },
  546 +
  547 + /**
  548 + * Determine which handler has a priority
  549 + * works only for double slider type
  550 + */
  551 + setTopHandler: function () {
  552 + var min = this.options.min,
  553 + max = this.options.max,
  554 + from = this.options.from,
  555 + to = this.options.to;
  556 +
  557 + if (from > min && to === max) {
  558 + this.$cache.s_from.addClass("type_last");
  559 + } else if (to < max) {
  560 + this.$cache.s_to.addClass("type_last");
  561 + }
  562 + },
  563 +
  564 + /**
  565 + * Determine which handles was clicked last
  566 + * and which handler should have hover effect
  567 + *
  568 + * @param target {String}
  569 + */
  570 + changeLevel: function (target) {
  571 + switch (target) {
  572 + case "single":
  573 + this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_single_fake);
  574 + break;
  575 + case "from":
  576 + this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_from_fake);
  577 + this.$cache.s_from.addClass("state_hover");
  578 + this.$cache.s_from.addClass("type_last");
  579 + this.$cache.s_to.removeClass("type_last");
  580 + break;
  581 + case "to":
  582 + this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_to_fake);
  583 + this.$cache.s_to.addClass("state_hover");
  584 + this.$cache.s_to.addClass("type_last");
  585 + this.$cache.s_from.removeClass("type_last");
  586 + break;
  587 + case "both":
  588 + this.coords.p_gap_left = this.toFixed(this.coords.p_pointer - this.coords.p_from_fake);
  589 + this.coords.p_gap_right = this.toFixed(this.coords.p_to_fake - this.coords.p_pointer);
  590 + this.$cache.s_to.removeClass("type_last");
  591 + this.$cache.s_from.removeClass("type_last");
  592 + break;
  593 + }
  594 + },
  595 +
  596 + /**
  597 + * Then slider is disabled
  598 + * appends extra layer with opacity
  599 + */
  600 + appendDisableMask: function () {
  601 + this.$cache.cont.append(disable_html);
  602 + this.$cache.cont.addClass("irs-disabled");
  603 + },
  604 +
  605 + /**
  606 + * Remove slider instance
  607 + * and ubind all events
  608 + */
  609 + remove: function () {
  610 + this.$cache.cont.remove();
  611 + this.$cache.cont = null;
  612 +
  613 + this.$cache.line.off("keydown.irs_" + this.plugin_count);
  614 +
  615 + this.$cache.body.off("touchmove.irs_" + this.plugin_count);
  616 + this.$cache.body.off("mousemove.irs_" + this.plugin_count);
  617 +
  618 + this.$cache.win.off("touchend.irs_" + this.plugin_count);
  619 + this.$cache.win.off("mouseup.irs_" + this.plugin_count);
  620 +
  621 + if (is_old_ie) {
  622 + this.$cache.body.off("mouseup.irs_" + this.plugin_count);
  623 + this.$cache.body.off("mouseleave.irs_" + this.plugin_count);
  624 + }
  625 +
  626 + this.$cache.grid_labels = [];
  627 + this.coords.big = [];
  628 + this.coords.big_w = [];
  629 + this.coords.big_p = [];
  630 + this.coords.big_x = [];
  631 +
  632 + cancelAnimationFrame(this.raf_id);
  633 + },
  634 +
  635 + /**
  636 + * bind all slider events
  637 + */
  638 + bindEvents: function () {
  639 + if (this.no_diapason) {
  640 + return;
  641 + }
  642 +
  643 + this.$cache.body.on("touchmove.irs_" + this.plugin_count, this.pointerMove.bind(this));
  644 + this.$cache.body.on("mousemove.irs_" + this.plugin_count, this.pointerMove.bind(this));
  645 +
  646 + this.$cache.win.on("touchend.irs_" + this.plugin_count, this.pointerUp.bind(this));
  647 + this.$cache.win.on("mouseup.irs_" + this.plugin_count, this.pointerUp.bind(this));
  648 +
  649 + this.$cache.line.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
  650 + this.$cache.line.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
  651 +
  652 + if (this.options.drag_interval && this.options.type === "double") {
  653 + this.$cache.bar.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "both"));
  654 + this.$cache.bar.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "both"));
  655 + } else {
  656 + this.$cache.bar.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
  657 + this.$cache.bar.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
  658 + }
  659 +
  660 + if (this.options.type === "single") {
  661 + this.$cache.single.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "single"));
  662 + this.$cache.s_single.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "single"));
  663 + this.$cache.shad_single.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
  664 +
  665 + this.$cache.single.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "single"));
  666 + this.$cache.s_single.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "single"));
  667 + this.$cache.edge.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
  668 + this.$cache.shad_single.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
  669 + } else {
  670 + this.$cache.single.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, null));
  671 + this.$cache.single.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, null));
  672 +
  673 + this.$cache.from.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "from"));
  674 + this.$cache.s_from.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "from"));
  675 + this.$cache.to.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "to"));
  676 + this.$cache.s_to.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "to"));
  677 + this.$cache.shad_from.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
  678 + this.$cache.shad_to.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
  679 +
  680 + this.$cache.from.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "from"));
  681 + this.$cache.s_from.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "from"));
  682 + this.$cache.to.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "to"));
  683 + this.$cache.s_to.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "to"));
  684 + this.$cache.shad_from.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
  685 + this.$cache.shad_to.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
  686 + }
  687 +
  688 + if (this.options.keyboard) {
  689 + this.$cache.line.on("keydown.irs_" + this.plugin_count, this.key.bind(this, "keyboard"));
  690 + }
  691 +
  692 + if (is_old_ie) {
  693 + this.$cache.body.on("mouseup.irs_" + this.plugin_count, this.pointerUp.bind(this));
  694 + this.$cache.body.on("mouseleave.irs_" + this.plugin_count, this.pointerUp.bind(this));
  695 + }
  696 + },
  697 +
  698 + /**
  699 + * Mousemove or touchmove
  700 + * only for handlers
  701 + *
  702 + * @param e {Object} event object
  703 + */
  704 + pointerMove: function (e) {
  705 + if (!this.dragging) {
  706 + return;
  707 + }
  708 +
  709 + var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
  710 + this.coords.x_pointer = x - this.coords.x_gap;
  711 +
  712 + this.calc();
  713 + },
  714 +
  715 + /**
  716 + * Mouseup or touchend
  717 + * only for handlers
  718 + *
  719 + * @param e {Object} event object
  720 + */
  721 + pointerUp: function (e) {
  722 + if (this.current_plugin !== this.plugin_count) {
  723 + return;
  724 + }
  725 +
  726 + if (this.is_active) {
  727 + this.is_active = false;
  728 + } else {
  729 + return;
  730 + }
  731 +
  732 + this.$cache.cont.find(".state_hover").removeClass("state_hover");
  733 +
  734 + this.force_redraw = true;
  735 +
  736 + if (is_old_ie) {
  737 + $("*").prop("unselectable", false);
  738 + }
  739 +
  740 + this.updateScene();
  741 + this.restoreOriginalMinInterval();
  742 +
  743 + // callbacks call
  744 + if ($.contains(this.$cache.cont[0], e.target) || this.dragging) {
  745 + this.is_finish = true;
  746 + this.callOnFinish();
  747 + }
  748 +
  749 + this.dragging = false;
  750 + },
  751 +
  752 + /**
  753 + * Mousedown or touchstart
  754 + * only for handlers
  755 + *
  756 + * @param target {String|null}
  757 + * @param e {Object} event object
  758 + */
  759 + pointerDown: function (target, e) {
  760 + e.preventDefault();
  761 + var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
  762 + if (e.button === 2) {
  763 + return;
  764 + }
  765 +
  766 + if (target === "both") {
  767 + this.setTempMinInterval();
  768 + }
  769 +
  770 + if (!target) {
  771 + target = this.target;
  772 + }
  773 +
  774 + this.current_plugin = this.plugin_count;
  775 + this.target = target;
  776 +
  777 + this.is_active = true;
  778 + this.dragging = true;
  779 +
  780 + this.coords.x_gap = this.$cache.rs.offset().left;
  781 + this.coords.x_pointer = x - this.coords.x_gap;
  782 +
  783 + this.calcPointerPercent();
  784 + this.changeLevel(target);
  785 +
  786 + if (is_old_ie) {
  787 + $("*").prop("unselectable", true);
  788 + }
  789 +
  790 + this.$cache.line.trigger("focus");
  791 +
  792 + this.updateScene();
  793 + },
  794 +
  795 + /**
  796 + * Mousedown or touchstart
  797 + * for other slider elements, like diapason line
  798 + *
  799 + * @param target {String}
  800 + * @param e {Object} event object
  801 + */
  802 + pointerClick: function (target, e) {
  803 + e.preventDefault();
  804 + var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
  805 + if (e.button === 2) {
  806 + return;
  807 + }
  808 +
  809 + this.current_plugin = this.plugin_count;
  810 + this.target = target;
  811 +
  812 + this.is_click = true;
  813 + this.coords.x_gap = this.$cache.rs.offset().left;
  814 + this.coords.x_pointer = +(x - this.coords.x_gap).toFixed();
  815 +
  816 + this.force_redraw = true;
  817 + this.calc();
  818 +
  819 + this.$cache.line.trigger("focus");
  820 + },
  821 +
  822 + /**
  823 + * Keyborard controls for focused slider
  824 + *
  825 + * @param target {String}
  826 + * @param e {Object} event object
  827 + * @returns {boolean|undefined}
  828 + */
  829 + key: function (target, e) {
  830 + if (this.current_plugin !== this.plugin_count || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
  831 + return;
  832 + }
  833 +
  834 + switch (e.which) {
  835 + case 83: // W
  836 + case 65: // A
  837 + case 40: // DOWN
  838 + case 37: // LEFT
  839 + e.preventDefault();
  840 + this.moveByKey(false);
  841 + break;
  842 +
  843 + case 87: // S
  844 + case 68: // D
  845 + case 38: // UP
  846 + case 39: // RIGHT
  847 + e.preventDefault();
  848 + this.moveByKey(true);
  849 + break;
  850 + }
  851 +
  852 + return true;
  853 + },
  854 +
  855 + /**
  856 + * Move by key. Beta
  857 + * @todo refactor than have plenty of time
  858 + *
  859 + * @param right {boolean} direction to move
  860 + */
  861 + moveByKey: function (right) {
  862 + var p = this.coords.p_pointer;
  863 +
  864 + if (right) {
  865 + p += this.options.keyboard_step;
  866 + } else {
  867 + p -= this.options.keyboard_step;
  868 + }
  869 +
  870 + this.coords.x_pointer = this.toFixed(this.coords.w_rs / 100 * p);
  871 + this.is_key = true;
  872 + this.calc();
  873 + },
  874 +
  875 + /**
  876 + * Set visibility and content
  877 + * of Min and Max labels
  878 + */
  879 + setMinMax: function () {
  880 + if (!this.options) {
  881 + return;
  882 + }
  883 +
  884 + if (this.options.hide_min_max) {
  885 + this.$cache.min[0].style.display = "none";
  886 + this.$cache.max[0].style.display = "none";
  887 + return;
  888 + }
  889 +
  890 + if (this.options.values.length) {
  891 + this.$cache.min.html(this.decorate(this.options.p_values[this.options.min]));
  892 + this.$cache.max.html(this.decorate(this.options.p_values[this.options.max]));
  893 + } else {
  894 + this.$cache.min.html(this.decorate(this._prettify(this.options.min), this.options.min));
  895 + this.$cache.max.html(this.decorate(this._prettify(this.options.max), this.options.max));
  896 + }
  897 +
  898 + this.labels.w_min = this.$cache.min.outerWidth(false);
  899 + this.labels.w_max = this.$cache.max.outerWidth(false);
  900 + },
  901 +
  902 + /**
  903 + * Then dragging interval, prevent interval collapsing
  904 + * using min_interval option
  905 + */
  906 + setTempMinInterval: function () {
  907 + var interval = this.result.to - this.result.from;
  908 +
  909 + if (this.old_min_interval === null) {
  910 + this.old_min_interval = this.options.min_interval;
  911 + }
  912 +
  913 + this.options.min_interval = interval;
  914 + },
  915 +
  916 + /**
  917 + * Restore min_interval option to original
  918 + */
  919 + restoreOriginalMinInterval: function () {
  920 + if (this.old_min_interval !== null) {
  921 + this.options.min_interval = this.old_min_interval;
  922 + this.old_min_interval = null;
  923 + }
  924 + },
  925 +
  926 +
  927 +
  928 + // =============================================================================================================
  929 + // Calculations
  930 +
  931 + /**
  932 + * All calculations and measures start here
  933 + *
  934 + * @param update {boolean=}
  935 + */
  936 + calc: function (update) {
  937 + if (!this.options) {
  938 + return;
  939 + }
  940 +
  941 + this.calc_count++;
  942 +
  943 + if (this.calc_count === 10 || update) {
  944 + this.calc_count = 0;
  945 + this.coords.w_rs = this.$cache.rs.outerWidth(false);
  946 +
  947 + this.calcHandlePercent();
  948 + }
  949 +
  950 + if (!this.coords.w_rs) {
  951 + return;
  952 + }
  953 +
  954 + this.calcPointerPercent();
  955 + var handle_x = this.getHandleX();
  956 +
  957 + if (this.target === "click") {
  958 + this.coords.p_gap = this.coords.p_handle / 2;
  959 + handle_x = this.getHandleX();
  960 +
  961 + if (this.options.drag_interval) {
  962 + this.target = "both_one";
  963 + } else {
  964 + this.target = this.chooseHandle(handle_x);
  965 + }
  966 + }
  967 +
  968 + switch (this.target) {
  969 + case "base":
  970 + var w = (this.options.max - this.options.min) / 100,
  971 + f = (this.result.from - this.options.min) / w,
  972 + t = (this.result.to - this.options.min) / w;
  973 +
  974 + this.coords.p_single_real = this.toFixed(f);
  975 + this.coords.p_from_real = this.toFixed(f);
  976 + this.coords.p_to_real = this.toFixed(t);
  977 +
  978 + this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max);
  979 + this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
  980 + this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
  981 +
  982 + this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real);
  983 + this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
  984 + this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
  985 +
  986 + this.target = null;
  987 +
  988 + break;
  989 +
  990 + case "single":
  991 + if (this.options.from_fixed) {
  992 + break;
  993 + }
  994 +
  995 + this.coords.p_single_real = this.convertToRealPercent(handle_x);
  996 + this.coords.p_single_real = this.calcWithStep(this.coords.p_single_real);
  997 + this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max);
  998 +
  999 + this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real);
  1000 +
  1001 + break;
  1002 +
  1003 + case "from":
  1004 + if (this.options.from_fixed) {
  1005 + break;
  1006 + }
  1007 +
  1008 + this.coords.p_from_real = this.convertToRealPercent(handle_x);
  1009 + this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real);
  1010 + if (this.coords.p_from_real > this.coords.p_to_real) {
  1011 + this.coords.p_from_real = this.coords.p_to_real;
  1012 + }
  1013 + this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
  1014 + this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from");
  1015 + this.coords.p_from_real = this.checkMaxInterval(this.coords.p_from_real, this.coords.p_to_real, "from");
  1016 +
  1017 + this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
  1018 +
  1019 + break;
  1020 +
  1021 + case "to":
  1022 + if (this.options.to_fixed) {
  1023 + break;
  1024 + }
  1025 +
  1026 + this.coords.p_to_real = this.convertToRealPercent(handle_x);
  1027 + this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real);
  1028 + if (this.coords.p_to_real < this.coords.p_from_real) {
  1029 + this.coords.p_to_real = this.coords.p_from_real;
  1030 + }
  1031 + this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
  1032 + this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to");
  1033 + this.coords.p_to_real = this.checkMaxInterval(this.coords.p_to_real, this.coords.p_from_real, "to");
  1034 +
  1035 + this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
  1036 +
  1037 + break;
  1038 +
  1039 + case "both":
  1040 + if (this.options.from_fixed || this.options.to_fixed) {
  1041 + break;
  1042 + }
  1043 +
  1044 + handle_x = this.toFixed(handle_x + (this.coords.p_handle * 0.1));
  1045 +
  1046 + this.coords.p_from_real = this.convertToRealPercent(handle_x) - this.coords.p_gap_left;
  1047 + this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real);
  1048 + this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
  1049 + this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from");
  1050 + this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
  1051 +
  1052 + this.coords.p_to_real = this.convertToRealPercent(handle_x) + this.coords.p_gap_right;
  1053 + this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real);
  1054 + this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
  1055 + this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to");
  1056 + this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
  1057 +
  1058 + break;
  1059 +
  1060 + case "both_one":
  1061 + if (this.options.from_fixed || this.options.to_fixed) {
  1062 + break;
  1063 + }
  1064 +
  1065 + var real_x = this.convertToRealPercent(handle_x),
  1066 + from = this.result.from_percent,
  1067 + to = this.result.to_percent,
  1068 + full = to - from,
  1069 + half = full / 2,
  1070 + new_from = real_x - half,
  1071 + new_to = real_x + half;
  1072 +
  1073 + if (new_from < 0) {
  1074 + new_from = 0;
  1075 + new_to = new_from + full;
  1076 + }
  1077 +
  1078 + if (new_to > 100) {
  1079 + new_to = 100;
  1080 + new_from = new_to - full;
  1081 + }
  1082 +
  1083 + this.coords.p_from_real = this.calcWithStep(new_from);
  1084 + this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
  1085 + this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
  1086 +
  1087 + this.coords.p_to_real = this.calcWithStep(new_to);
  1088 + this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
  1089 + this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
  1090 +
  1091 + break;
  1092 + }
  1093 +
  1094 + if (this.options.type === "single") {
  1095 + this.coords.p_bar_x = (this.coords.p_handle / 2);
  1096 + this.coords.p_bar_w = this.coords.p_single_fake;
  1097 +
  1098 + this.result.from_percent = this.coords.p_single_real;
  1099 + this.result.from = this.convertToValue(this.coords.p_single_real);
  1100 +
  1101 + if (this.options.values.length) {
  1102 + this.result.from_value = this.options.values[this.result.from];
  1103 + }
  1104 + } else {
  1105 + this.coords.p_bar_x = this.toFixed(this.coords.p_from_fake + (this.coords.p_handle / 2));
  1106 + this.coords.p_bar_w = this.toFixed(this.coords.p_to_fake - this.coords.p_from_fake);
  1107 +
  1108 + this.result.from_percent = this.coords.p_from_real;
  1109 + this.result.from = this.convertToValue(this.coords.p_from_real);
  1110 + this.result.to_percent = this.coords.p_to_real;
  1111 + this.result.to = this.convertToValue(this.coords.p_to_real);
  1112 +
  1113 + if (this.options.values.length) {
  1114 + this.result.from_value = this.options.values[this.result.from];
  1115 + this.result.to_value = this.options.values[this.result.to];
  1116 + }
  1117 + }
  1118 +
  1119 + this.calcMinMax();
  1120 + this.calcLabels();
  1121 + },
  1122 +
  1123 +
  1124 + /**
  1125 + * calculates pointer X in percent
  1126 + */
  1127 + calcPointerPercent: function () {
  1128 + if (!this.coords.w_rs) {
  1129 + this.coords.p_pointer = 0;
  1130 + return;
  1131 + }
  1132 +
  1133 + if (this.coords.x_pointer < 0 || isNaN(this.coords.x_pointer) ) {
  1134 + this.coords.x_pointer = 0;
  1135 + } else if (this.coords.x_pointer > this.coords.w_rs) {
  1136 + this.coords.x_pointer = this.coords.w_rs;
  1137 + }
  1138 +
  1139 + this.coords.p_pointer = this.toFixed(this.coords.x_pointer / this.coords.w_rs * 100);
  1140 + },
  1141 +
  1142 + convertToRealPercent: function (fake) {
  1143 + var full = 100 - this.coords.p_handle;
  1144 + return fake / full * 100;
  1145 + },
  1146 +
  1147 + convertToFakePercent: function (real) {
  1148 + var full = 100 - this.coords.p_handle;
  1149 + return real / 100 * full;
  1150 + },
  1151 +
  1152 + getHandleX: function () {
  1153 + var max = 100 - this.coords.p_handle,
  1154 + x = this.toFixed(this.coords.p_pointer - this.coords.p_gap);
  1155 +
  1156 + if (x < 0) {
  1157 + x = 0;
  1158 + } else if (x > max) {
  1159 + x = max;
  1160 + }
  1161 +
  1162 + return x;
  1163 + },
  1164 +
  1165 + calcHandlePercent: function () {
  1166 + if (this.options.type === "single") {
  1167 + this.coords.w_handle = this.$cache.s_single.outerWidth(false);
  1168 + } else {
  1169 + this.coords.w_handle = this.$cache.s_from.outerWidth(false);
  1170 + }
  1171 +
  1172 + this.coords.p_handle = this.toFixed(this.coords.w_handle / this.coords.w_rs * 100);
  1173 + },
  1174 +
  1175 + /**
  1176 + * Find closest handle to pointer click
  1177 + *
  1178 + * @param real_x {Number}
  1179 + * @returns {String}
  1180 + */
  1181 + chooseHandle: function (real_x) {
  1182 + if (this.options.type === "single") {
  1183 + return "single";
  1184 + } else {
  1185 + var m_point = this.coords.p_from_real + ((this.coords.p_to_real - this.coords.p_from_real) / 2);
  1186 + if (real_x >= m_point) {
  1187 + return this.options.to_fixed ? "from" : "to";
  1188 + } else {
  1189 + return this.options.from_fixed ? "to" : "from";
  1190 + }
  1191 + }
  1192 + },
  1193 +
  1194 + /**
  1195 + * Measure Min and Max labels width in percent
  1196 + */
  1197 + calcMinMax: function () {
  1198 + if (!this.coords.w_rs) {
  1199 + return;
  1200 + }
  1201 +
  1202 + this.labels.p_min = this.labels.w_min / this.coords.w_rs * 100;
  1203 + this.labels.p_max = this.labels.w_max / this.coords.w_rs * 100;
  1204 + },
  1205 +
  1206 + /**
  1207 + * Measure labels width and X in percent
  1208 + */
  1209 + calcLabels: function () {
  1210 + if (!this.coords.w_rs || this.options.hide_from_to) {
  1211 + return;
  1212 + }
  1213 +
  1214 + if (this.options.type === "single") {
  1215 +
  1216 + this.labels.w_single = this.$cache.single.outerWidth(false);
  1217 + this.labels.p_single_fake = this.labels.w_single / this.coords.w_rs * 100;
  1218 + this.labels.p_single_left = this.coords.p_single_fake + (this.coords.p_handle / 2) - (this.labels.p_single_fake / 2);
  1219 + this.labels.p_single_left = this.checkEdges(this.labels.p_single_left, this.labels.p_single_fake);
  1220 +
  1221 + } else {
  1222 +
  1223 + this.labels.w_from = this.$cache.from.outerWidth(false);
  1224 + this.labels.p_from_fake = this.labels.w_from / this.coords.w_rs * 100;
  1225 + this.labels.p_from_left = this.coords.p_from_fake + (this.coords.p_handle / 2) - (this.labels.p_from_fake / 2);
  1226 + this.labels.p_from_left = this.toFixed(this.labels.p_from_left);
  1227 + this.labels.p_from_left = this.checkEdges(this.labels.p_from_left, this.labels.p_from_fake);
  1228 +
  1229 + this.labels.w_to = this.$cache.to.outerWidth(false);
  1230 + this.labels.p_to_fake = this.labels.w_to / this.coords.w_rs * 100;
  1231 + this.labels.p_to_left = this.coords.p_to_fake + (this.coords.p_handle / 2) - (this.labels.p_to_fake / 2);
  1232 + this.labels.p_to_left = this.toFixed(this.labels.p_to_left);
  1233 + this.labels.p_to_left = this.checkEdges(this.labels.p_to_left, this.labels.p_to_fake);
  1234 +
  1235 + this.labels.w_single = this.$cache.single.outerWidth(false);
  1236 + this.labels.p_single_fake = this.labels.w_single / this.coords.w_rs * 100;
  1237 + this.labels.p_single_left = ((this.labels.p_from_left + this.labels.p_to_left + this.labels.p_to_fake) / 2) - (this.labels.p_single_fake / 2);
  1238 + this.labels.p_single_left = this.toFixed(this.labels.p_single_left);
  1239 + this.labels.p_single_left = this.checkEdges(this.labels.p_single_left, this.labels.p_single_fake);
  1240 +
  1241 + }
  1242 + },
  1243 +
  1244 +
  1245 +
  1246 + // =============================================================================================================
  1247 + // Drawings
  1248 +
  1249 + /**
  1250 + * Main function called in request animation frame
  1251 + * to update everything
  1252 + */
  1253 + updateScene: function () {
  1254 + if (this.raf_id) {
  1255 + cancelAnimationFrame(this.raf_id);
  1256 + this.raf_id = null;
  1257 + }
  1258 +
  1259 + clearTimeout(this.update_tm);
  1260 + this.update_tm = null;
  1261 +
  1262 + if (!this.options) {
  1263 + return;
  1264 + }
  1265 +
  1266 + this.drawHandles();
  1267 +
  1268 + if (this.is_active) {
  1269 + this.raf_id = requestAnimationFrame(this.updateScene.bind(this));
  1270 + } else {
  1271 + this.update_tm = setTimeout(this.updateScene.bind(this), 300);
  1272 + }
  1273 + },
  1274 +
  1275 + /**
  1276 + * Draw handles
  1277 + */
  1278 + drawHandles: function () {
  1279 + this.coords.w_rs = this.$cache.rs.outerWidth(false);
  1280 +
  1281 + if (!this.coords.w_rs) {
  1282 + return;
  1283 + }
  1284 +
  1285 + if (this.coords.w_rs !== this.coords.w_rs_old) {
  1286 + this.target = "base";
  1287 + this.is_resize = true;
  1288 + }
  1289 +
  1290 + if (this.coords.w_rs !== this.coords.w_rs_old || this.force_redraw) {
  1291 + this.setMinMax();
  1292 + this.calc(true);
  1293 + this.drawLabels();
  1294 + if (this.options.grid) {
  1295 + this.calcGridMargin();
  1296 + this.calcGridLabels();
  1297 + }
  1298 + this.force_redraw = true;
  1299 + this.coords.w_rs_old = this.coords.w_rs;
  1300 + this.drawShadow();
  1301 + }
  1302 +
  1303 + if (!this.coords.w_rs) {
  1304 + return;
  1305 + }
  1306 +
  1307 + if (!this.dragging && !this.force_redraw && !this.is_key) {
  1308 + return;
  1309 + }
  1310 +
  1311 + if (this.old_from !== this.result.from || this.old_to !== this.result.to || this.force_redraw || this.is_key) {
  1312 +
  1313 + this.drawLabels();
  1314 +
  1315 + this.$cache.bar[0].style.left = this.coords.p_bar_x + "%";
  1316 + this.$cache.bar[0].style.width = this.coords.p_bar_w + "%";
  1317 +
  1318 + if (this.options.type === "single") {
  1319 + this.$cache.s_single[0].style.left = this.coords.p_single_fake + "%";
  1320 +
  1321 + this.$cache.single[0].style.left = this.labels.p_single_left + "%";
  1322 +
  1323 + if (this.options.values.length) {
  1324 + this.$cache.input.prop("value", this.result.from_value);
  1325 + } else {
  1326 + this.$cache.input.prop("value", this.result.from);
  1327 + }
  1328 + this.$cache.input.data("from", this.result.from);
  1329 + } else {
  1330 + this.$cache.s_from[0].style.left = this.coords.p_from_fake + "%";
  1331 + this.$cache.s_to[0].style.left = this.coords.p_to_fake + "%";
  1332 +
  1333 + if (this.old_from !== this.result.from || this.force_redraw) {
  1334 + this.$cache.from[0].style.left = this.labels.p_from_left + "%";
  1335 + }
  1336 + if (this.old_to !== this.result.to || this.force_redraw) {
  1337 + this.$cache.to[0].style.left = this.labels.p_to_left + "%";
  1338 + }
  1339 +
  1340 + this.$cache.single[0].style.left = this.labels.p_single_left + "%";
  1341 +
  1342 + if (this.options.values.length) {
  1343 + this.$cache.input.prop("value", this.result.from_value + this.options.input_values_separator + this.result.to_value);
  1344 + } else {
  1345 + this.$cache.input.prop("value", this.result.from + this.options.input_values_separator + this.result.to);
  1346 + }
  1347 + this.$cache.input.data("from", this.result.from);
  1348 + this.$cache.input.data("to", this.result.to);
  1349 + }
  1350 +
  1351 + if ((this.old_from !== this.result.from || this.old_to !== this.result.to) && !this.is_start) {
  1352 + this.$cache.input.trigger("change");
  1353 + }
  1354 +
  1355 + this.old_from = this.result.from;
  1356 + this.old_to = this.result.to;
  1357 +
  1358 + // callbacks call
  1359 + if (!this.is_resize && !this.is_update && !this.is_start && !this.is_finish) {
  1360 + this.callOnChange();
  1361 + }
  1362 + if (this.is_key || this.is_click) {
  1363 + this.is_key = false;
  1364 + this.is_click = false;
  1365 + this.callOnFinish();
  1366 + }
  1367 +
  1368 + this.is_update = false;
  1369 + this.is_resize = false;
  1370 + this.is_finish = false;
  1371 + }
  1372 +
  1373 + this.is_start = false;
  1374 + this.is_key = false;
  1375 + this.is_click = false;
  1376 + this.force_redraw = false;
  1377 + },
  1378 +
  1379 + /**
  1380 + * Draw labels
  1381 + * measure labels collisions
  1382 + * collapse close labels
  1383 + */
  1384 + drawLabels: function () {
  1385 + if (!this.options) {
  1386 + return;
  1387 + }
  1388 +
  1389 + var values_num = this.options.values.length,
  1390 + p_values = this.options.p_values,
  1391 + text_single,
  1392 + text_from,
  1393 + text_to;
  1394 +
  1395 + if (this.options.hide_from_to) {
  1396 + return;
  1397 + }
  1398 +
  1399 + if (this.options.type === "single") {
  1400 +
  1401 + if (values_num) {
  1402 + text_single = this.decorate(p_values[this.result.from]);
  1403 + this.$cache.single.html(text_single);
  1404 + } else {
  1405 + text_single = this.decorate(this._prettify(this.result.from), this.result.from);
  1406 + this.$cache.single.html(text_single);
  1407 + }
  1408 +
  1409 + this.calcLabels();
  1410 +
  1411 + if (this.labels.p_single_left < this.labels.p_min + 1) {
  1412 + this.$cache.min[0].style.visibility = "hidden";
  1413 + } else {
  1414 + this.$cache.min[0].style.visibility = "visible";
  1415 + }
  1416 +
  1417 + if (this.labels.p_single_left + this.labels.p_single_fake > 100 - this.labels.p_max - 1) {
  1418 + this.$cache.max[0].style.visibility = "hidden";
  1419 + } else {
  1420 + this.$cache.max[0].style.visibility = "visible";
  1421 + }
  1422 +
  1423 + } else {
  1424 +
  1425 + if (values_num) {
  1426 +
  1427 + if (this.options.decorate_both) {
  1428 + text_single = this.decorate(p_values[this.result.from]);
  1429 + text_single += this.options.values_separator;
  1430 + text_single += this.decorate(p_values[this.result.to]);
  1431 + } else {
  1432 + text_single = this.decorate(p_values[this.result.from] + this.options.values_separator + p_values[this.result.to]);
  1433 + }
  1434 + text_from = this.decorate(p_values[this.result.from]);
  1435 + text_to = this.decorate(p_values[this.result.to]);
  1436 +
  1437 + this.$cache.single.html(text_single);
  1438 + this.$cache.from.html(text_from);
  1439 + this.$cache.to.html(text_to);
  1440 +
  1441 + } else {
  1442 +
  1443 + if (this.options.decorate_both) {
  1444 + text_single = this.decorate(this._prettify(this.result.from), this.result.from);
  1445 + text_single += this.options.values_separator;
  1446 + text_single += this.decorate(this._prettify(this.result.to), this.result.to);
  1447 + } else {
  1448 + text_single = this.decorate(this._prettify(this.result.from) + this.options.values_separator + this._prettify(this.result.to), this.result.to);
  1449 + }
  1450 + text_from = this.decorate(this._prettify(this.result.from), this.result.from);
  1451 + text_to = this.decorate(this._prettify(this.result.to), this.result.to);
  1452 +
  1453 + this.$cache.single.html(text_single);
  1454 + this.$cache.from.html(text_from);
  1455 + this.$cache.to.html(text_to);
  1456 +
  1457 + }
  1458 +
  1459 + this.calcLabels();
  1460 +
  1461 + var min = Math.min(this.labels.p_single_left, this.labels.p_from_left),
  1462 + single_left = this.labels.p_single_left + this.labels.p_single_fake,
  1463 + to_left = this.labels.p_to_left + this.labels.p_to_fake,
  1464 + max = Math.max(single_left, to_left);
  1465 +
  1466 + if (this.labels.p_from_left + this.labels.p_from_fake >= this.labels.p_to_left) {
  1467 + this.$cache.from[0].style.visibility = "hidden";
  1468 + this.$cache.to[0].style.visibility = "hidden";
  1469 + this.$cache.single[0].style.visibility = "visible";
  1470 +
  1471 + if (this.result.from === this.result.to) {
  1472 + if (this.target === "from") {
  1473 + this.$cache.from[0].style.visibility = "visible";
  1474 + } else if (this.target === "to") {
  1475 + this.$cache.to[0].style.visibility = "visible";
  1476 + } else if (!this.target) {
  1477 + this.$cache.from[0].style.visibility = "visible";
  1478 + }
  1479 + this.$cache.single[0].style.visibility = "hidden";
  1480 + max = to_left;
  1481 + } else {
  1482 + this.$cache.from[0].style.visibility = "hidden";
  1483 + this.$cache.to[0].style.visibility = "hidden";
  1484 + this.$cache.single[0].style.visibility = "visible";
  1485 + max = Math.max(single_left, to_left);
  1486 + }
  1487 + } else {
  1488 + this.$cache.from[0].style.visibility = "visible";
  1489 + this.$cache.to[0].style.visibility = "visible";
  1490 + this.$cache.single[0].style.visibility = "hidden";
  1491 + }
  1492 +
  1493 + if (min < this.labels.p_min + 1) {
  1494 + this.$cache.min[0].style.visibility = "hidden";
  1495 + } else {
  1496 + this.$cache.min[0].style.visibility = "visible";
  1497 + }
  1498 +
  1499 + if (max > 100 - this.labels.p_max - 1) {
  1500 + this.$cache.max[0].style.visibility = "hidden";
  1501 + } else {
  1502 + this.$cache.max[0].style.visibility = "visible";
  1503 + }
  1504 +
  1505 + }
  1506 + },
  1507 +
  1508 + /**
  1509 + * Draw shadow intervals
  1510 + */
  1511 + drawShadow: function () {
  1512 + var o = this.options,
  1513 + c = this.$cache,
  1514 +
  1515 + is_from_min = typeof o.from_min === "number" && !isNaN(o.from_min),
  1516 + is_from_max = typeof o.from_max === "number" && !isNaN(o.from_max),
  1517 + is_to_min = typeof o.to_min === "number" && !isNaN(o.to_min),
  1518 + is_to_max = typeof o.to_max === "number" && !isNaN(o.to_max),
  1519 +
  1520 + from_min,
  1521 + from_max,
  1522 + to_min,
  1523 + to_max;
  1524 +
  1525 + if (o.type === "single") {
  1526 + if (o.from_shadow && (is_from_min || is_from_max)) {
  1527 + from_min = this.convertToPercent(is_from_min ? o.from_min : o.min);
  1528 + from_max = this.convertToPercent(is_from_max ? o.from_max : o.max) - from_min;
  1529 + from_min = this.toFixed(from_min - (this.coords.p_handle / 100 * from_min));
  1530 + from_max = this.toFixed(from_max - (this.coords.p_handle / 100 * from_max));
  1531 + from_min = from_min + (this.coords.p_handle / 2);
  1532 +
  1533 + c.shad_single[0].style.display = "block";
  1534 + c.shad_single[0].style.left = from_min + "%";
  1535 + c.shad_single[0].style.width = from_max + "%";
  1536 + } else {
  1537 + c.shad_single[0].style.display = "none";
  1538 + }
  1539 + } else {
  1540 + if (o.from_shadow && (is_from_min || is_from_max)) {
  1541 + from_min = this.convertToPercent(is_from_min ? o.from_min : o.min);
  1542 + from_max = this.convertToPercent(is_from_max ? o.from_max : o.max) - from_min;
  1543 + from_min = this.toFixed(from_min - (this.coords.p_handle / 100 * from_min));
  1544 + from_max = this.toFixed(from_max - (this.coords.p_handle / 100 * from_max));
  1545 + from_min = from_min + (this.coords.p_handle / 2);
  1546 +
  1547 + c.shad_from[0].style.display = "block";
  1548 + c.shad_from[0].style.left = from_min + "%";
  1549 + c.shad_from[0].style.width = from_max + "%";
  1550 + } else {
  1551 + c.shad_from[0].style.display = "none";
  1552 + }
  1553 +
  1554 + if (o.to_shadow && (is_to_min || is_to_max)) {
  1555 + to_min = this.convertToPercent(is_to_min ? o.to_min : o.min);
  1556 + to_max = this.convertToPercent(is_to_max ? o.to_max : o.max) - to_min;
  1557 + to_min = this.toFixed(to_min - (this.coords.p_handle / 100 * to_min));
  1558 + to_max = this.toFixed(to_max - (this.coords.p_handle / 100 * to_max));
  1559 + to_min = to_min + (this.coords.p_handle / 2);
  1560 +
  1561 + c.shad_to[0].style.display = "block";
  1562 + c.shad_to[0].style.left = to_min + "%";
  1563 + c.shad_to[0].style.width = to_max + "%";
  1564 + } else {
  1565 + c.shad_to[0].style.display = "none";
  1566 + }
  1567 + }
  1568 + },
  1569 +
  1570 +
  1571 +
  1572 + // =============================================================================================================
  1573 + // Callbacks
  1574 +
  1575 + callOnStart: function () {
  1576 + if (this.options.onStart && typeof this.options.onStart === "function") {
  1577 + this.options.onStart(this.result);
  1578 + }
  1579 + },
  1580 + callOnChange: function () {
  1581 + if (this.options.onChange && typeof this.options.onChange === "function") {
  1582 + this.options.onChange(this.result);
  1583 + }
  1584 + },
  1585 + callOnFinish: function () {
  1586 + if (this.options.onFinish && typeof this.options.onFinish === "function") {
  1587 + this.options.onFinish(this.result);
  1588 + }
  1589 + },
  1590 + callOnUpdate: function () {
  1591 + if (this.options.onUpdate && typeof this.options.onUpdate === "function") {
  1592 + this.options.onUpdate(this.result);
  1593 + }
  1594 + },
  1595 +
  1596 +
  1597 +
  1598 + // =============================================================================================================
  1599 + // Service methods
  1600 +
  1601 + toggleInput: function () {
  1602 + this.$cache.input.toggleClass("irs-hidden-input");
  1603 + },
  1604 +
  1605 + /**
  1606 + * Convert real value to percent
  1607 + *
  1608 + * @param value {Number} X in real
  1609 + * @param no_min {boolean=} don't use min value
  1610 + * @returns {Number} X in percent
  1611 + */
  1612 + convertToPercent: function (value, no_min) {
  1613 + var diapason = this.options.max - this.options.min,
  1614 + one_percent = diapason / 100,
  1615 + val, percent;
  1616 +
  1617 + if (!diapason) {
  1618 + this.no_diapason = true;
  1619 + return 0;
  1620 + }
  1621 +
  1622 + if (no_min) {
  1623 + val = value;
  1624 + } else {
  1625 + val = value - this.options.min;
  1626 + }
  1627 +
  1628 + percent = val / one_percent;
  1629 +
  1630 + return this.toFixed(percent);
  1631 + },
  1632 +
  1633 + /**
  1634 + * Convert percent to real values
  1635 + *
  1636 + * @param percent {Number} X in percent
  1637 + * @returns {Number} X in real
  1638 + */
  1639 + convertToValue: function (percent) {
  1640 + var min = this.options.min,
  1641 + max = this.options.max,
  1642 + min_decimals = min.toString().split(".")[1],
  1643 + max_decimals = max.toString().split(".")[1],
  1644 + min_length, max_length,
  1645 + avg_decimals = 0,
  1646 + abs = 0;
  1647 +
  1648 + if (percent === 0) {
  1649 + return this.options.min;
  1650 + }
  1651 + if (percent === 100) {
  1652 + return this.options.max;
  1653 + }
  1654 +
  1655 +
  1656 + if (min_decimals) {
  1657 + min_length = min_decimals.length;
  1658 + avg_decimals = min_length;
  1659 + }
  1660 + if (max_decimals) {
  1661 + max_length = max_decimals.length;
  1662 + avg_decimals = max_length;
  1663 + }
  1664 + if (min_length && max_length) {
  1665 + avg_decimals = (min_length >= max_length) ? min_length : max_length;
  1666 + }
  1667 +
  1668 + if (min < 0) {
  1669 + abs = Math.abs(min);
  1670 + min = +(min + abs).toFixed(avg_decimals);
  1671 + max = +(max + abs).toFixed(avg_decimals);
  1672 + }
  1673 +
  1674 + var number = ((max - min) / 100 * percent) + min,
  1675 + string = this.options.step.toString().split(".")[1],
  1676 + result;
  1677 +
  1678 + if (string) {
  1679 + number = +number.toFixed(string.length);
  1680 + } else {
  1681 + number = number / this.options.step;
  1682 + number = number * this.options.step;
  1683 +
  1684 + number = +number.toFixed(0);
  1685 + }
  1686 +
  1687 + if (abs) {
  1688 + number -= abs;
  1689 + }
  1690 +
  1691 + if (string) {
  1692 + result = +number.toFixed(string.length);
  1693 + } else {
  1694 + result = this.toFixed(number);
  1695 + }
  1696 +
  1697 + if (result < this.options.min) {
  1698 + result = this.options.min;
  1699 + } else if (result > this.options.max) {
  1700 + result = this.options.max;
  1701 + }
  1702 +
  1703 + return result;
  1704 + },
  1705 +
  1706 + /**
  1707 + * Round percent value with step
  1708 + *
  1709 + * @param percent {Number}
  1710 + * @returns percent {Number} rounded
  1711 + */
  1712 + calcWithStep: function (percent) {
  1713 + var rounded = Math.round(percent / this.coords.p_step) * this.coords.p_step;
  1714 +
  1715 + if (rounded > 100) {
  1716 + rounded = 100;
  1717 + }
  1718 + if (percent === 100) {
  1719 + rounded = 100;
  1720 + }
  1721 +
  1722 + return this.toFixed(rounded);
  1723 + },
  1724 +
  1725 + checkMinInterval: function (p_current, p_next, type) {
  1726 + var o = this.options,
  1727 + current,
  1728 + next;
  1729 +
  1730 + if (!o.min_interval) {
  1731 + return p_current;
  1732 + }
  1733 +
  1734 + current = this.convertToValue(p_current);
  1735 + next = this.convertToValue(p_next);
  1736 +
  1737 + if (type === "from") {
  1738 +
  1739 + if (next - current < o.min_interval) {
  1740 + current = next - o.min_interval;
  1741 + }
  1742 +
  1743 + } else {
  1744 +
  1745 + if (current - next < o.min_interval) {
  1746 + current = next + o.min_interval;
  1747 + }
  1748 +
  1749 + }
  1750 +
  1751 + return this.convertToPercent(current);
  1752 + },
  1753 +
  1754 + checkMaxInterval: function (p_current, p_next, type) {
  1755 + var o = this.options,
  1756 + current,
  1757 + next;
  1758 +
  1759 + if (!o.max_interval) {
  1760 + return p_current;
  1761 + }
  1762 +
  1763 + current = this.convertToValue(p_current);
  1764 + next = this.convertToValue(p_next);
  1765 +
  1766 + if (type === "from") {
  1767 +
  1768 + if (next - current > o.max_interval) {
  1769 + current = next - o.max_interval;
  1770 + }
  1771 +
  1772 + } else {
  1773 +
  1774 + if (current - next > o.max_interval) {
  1775 + current = next + o.max_interval;
  1776 + }
  1777 +
  1778 + }
  1779 +
  1780 + return this.convertToPercent(current);
  1781 + },
  1782 +
  1783 + checkDiapason: function (p_num, min, max) {
  1784 + var num = this.convertToValue(p_num),
  1785 + o = this.options;
  1786 +
  1787 + if (typeof min !== "number") {
  1788 + min = o.min;
  1789 + }
  1790 +
  1791 + if (typeof max !== "number") {
  1792 + max = o.max;
  1793 + }
  1794 +
  1795 + if (num < min) {
  1796 + num = min;
  1797 + }
  1798 +
  1799 + if (num > max) {
  1800 + num = max;
  1801 + }
  1802 +
  1803 + return this.convertToPercent(num);
  1804 + },
  1805 +
  1806 + toFixed: function (num) {
  1807 + num = num.toFixed(9);
  1808 + return +num;
  1809 + },
  1810 +
  1811 + _prettify: function (num) {
  1812 + if (!this.options.prettify_enabled) {
  1813 + return num;
  1814 + }
  1815 +
  1816 + if (this.options.prettify && typeof this.options.prettify === "function") {
  1817 + return this.options.prettify(num);
  1818 + } else {
  1819 + return this.prettify(num);
  1820 + }
  1821 + },
  1822 +
  1823 + prettify: function (num) {
  1824 + var n = num.toString();
  1825 + return n.replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g, "$1" + this.options.prettify_separator);
  1826 + },
  1827 +
  1828 + checkEdges: function (left, width) {
  1829 + if (!this.options.force_edges) {
  1830 + return this.toFixed(left);
  1831 + }
  1832 +
  1833 + if (left < 0) {
  1834 + left = 0;
  1835 + } else if (left > 100 - width) {
  1836 + left = 100 - width;
  1837 + }
  1838 +
  1839 + return this.toFixed(left);
  1840 + },
  1841 +
  1842 + validate: function () {
  1843 + var o = this.options,
  1844 + r = this.result,
  1845 + v = o.values,
  1846 + vl = v.length,
  1847 + value,
  1848 + i;
  1849 +
  1850 + if (typeof o.min === "string") o.min = +o.min;
  1851 + if (typeof o.max === "string") o.max = +o.max;
  1852 + if (typeof o.from === "string") o.from = +o.from;
  1853 + if (typeof o.to === "string") o.to = +o.to;
  1854 + if (typeof o.step === "string") o.step = +o.step;
  1855 +
  1856 + if (typeof o.from_min === "string") o.from_min = +o.from_min;
  1857 + if (typeof o.from_max === "string") o.from_max = +o.from_max;
  1858 + if (typeof o.to_min === "string") o.to_min = +o.to_min;
  1859 + if (typeof o.to_max === "string") o.to_max = +o.to_max;
  1860 +
  1861 + if (typeof o.keyboard_step === "string") o.keyboard_step = +o.keyboard_step;
  1862 + if (typeof o.grid_num === "string") o.grid_num = +o.grid_num;
  1863 +
  1864 + if (o.max < o.min) {
  1865 + o.max = o.min;
  1866 + }
  1867 +
  1868 + if (vl) {
  1869 + o.p_values = [];
  1870 + o.min = 0;
  1871 + o.max = vl - 1;
  1872 + o.step = 1;
  1873 + o.grid_num = o.max;
  1874 + o.grid_snap = true;
  1875 +
  1876 +
  1877 + for (i = 0; i < vl; i++) {
  1878 + value = +v[i];
  1879 +
  1880 + if (!isNaN(value)) {
  1881 + v[i] = value;
  1882 + value = this._prettify(value);
  1883 + } else {
  1884 + value = v[i];
  1885 + }
  1886 +
  1887 + o.p_values.push(value);
  1888 + }
  1889 + }
  1890 +
  1891 + if (typeof o.from !== "number" || isNaN(o.from)) {
  1892 + o.from = o.min;
  1893 + }
  1894 +
  1895 + if (typeof o.to !== "number" || isNaN(o.from)) {
  1896 + o.to = o.max;
  1897 + }
  1898 +
  1899 + if (o.type === "single") {
  1900 +
  1901 + if (o.from < o.min) {
  1902 + o.from = o.min;
  1903 + }
  1904 +
  1905 + if (o.from > o.max) {
  1906 + o.from = o.max;
  1907 + }
  1908 +
  1909 + } else {
  1910 +
  1911 + if (o.from < o.min || o.from > o.max) {
  1912 + o.from = o.min;
  1913 + }
  1914 + if (o.to > o.max || o.to < o.min) {
  1915 + o.to = o.max;
  1916 + }
  1917 + if (o.from > o.to) {
  1918 + o.from = o.to;
  1919 + }
  1920 +
  1921 + }
  1922 +
  1923 + if (typeof o.step !== "number" || isNaN(o.step) || !o.step || o.step < 0) {
  1924 + o.step = 1;
  1925 + }
  1926 +
  1927 + if (typeof o.keyboard_step !== "number" || isNaN(o.keyboard_step) || !o.keyboard_step || o.keyboard_step < 0) {
  1928 + o.keyboard_step = 5;
  1929 + }
  1930 +
  1931 + if (typeof o.from_min === "number" && o.from < o.from_min) {
  1932 + o.from = o.from_min;
  1933 + }
  1934 +
  1935 + if (typeof o.from_max === "number" && o.from > o.from_max) {
  1936 + o.from = o.from_max;
  1937 + }
  1938 +
  1939 + if (typeof o.to_min === "number" && o.to < o.to_min) {
  1940 + o.to = o.to_min;
  1941 + }
  1942 +
  1943 + if (typeof o.to_max === "number" && o.from > o.to_max) {
  1944 + o.to = o.to_max;
  1945 + }
  1946 +
  1947 + if (r) {
  1948 + if (r.min !== o.min) {
  1949 + r.min = o.min;
  1950 + }
  1951 +
  1952 + if (r.max !== o.max) {
  1953 + r.max = o.max;
  1954 + }
  1955 +
  1956 + if (r.from < r.min || r.from > r.max) {
  1957 + r.from = o.from;
  1958 + }
  1959 +
  1960 + if (r.to < r.min || r.to > r.max) {
  1961 + r.to = o.to;
  1962 + }
  1963 + }
  1964 +
  1965 + if (typeof o.min_interval !== "number" || isNaN(o.min_interval) || !o.min_interval || o.min_interval < 0) {
  1966 + o.min_interval = 0;
  1967 + }
  1968 +
  1969 + if (typeof o.max_interval !== "number" || isNaN(o.max_interval) || !o.max_interval || o.max_interval < 0) {
  1970 + o.max_interval = 0;
  1971 + }
  1972 +
  1973 + if (o.min_interval && o.min_interval > o.max - o.min) {
  1974 + o.min_interval = o.max - o.min;
  1975 + }
  1976 +
  1977 + if (o.max_interval && o.max_interval > o.max - o.min) {
  1978 + o.max_interval = o.max - o.min;
  1979 + }
  1980 + },
  1981 +
  1982 + decorate: function (num, original) {
  1983 + var decorated = "",
  1984 + o = this.options;
  1985 +
  1986 + if (o.prefix) {
  1987 + decorated += o.prefix;
  1988 + }
  1989 +
  1990 + decorated += num;
  1991 +
  1992 + if (o.max_postfix) {
  1993 + if (o.values.length && num === o.p_values[o.max]) {
  1994 + decorated += o.max_postfix;
  1995 + if (o.postfix) {
  1996 + decorated += " ";
  1997 + }
  1998 + } else if (original === o.max) {
  1999 + decorated += o.max_postfix;
  2000 + if (o.postfix) {
  2001 + decorated += " ";
  2002 + }
  2003 + }
  2004 + }
  2005 +
  2006 + if (o.postfix) {
  2007 + decorated += o.postfix;
  2008 + }
  2009 +
  2010 + return decorated;
  2011 + },
  2012 +
  2013 + updateFrom: function () {
  2014 + this.result.from = this.options.from;
  2015 + this.result.from_percent = this.convertToPercent(this.result.from);
  2016 + if (this.options.values) {
  2017 + this.result.from_value = this.options.values[this.result.from];
  2018 + }
  2019 + },
  2020 +
  2021 + updateTo: function () {
  2022 + this.result.to = this.options.to;
  2023 + this.result.to_percent = this.convertToPercent(this.result.to);
  2024 + if (this.options.values) {
  2025 + this.result.to_value = this.options.values[this.result.to];
  2026 + }
  2027 + },
  2028 +
  2029 + updateResult: function () {
  2030 + this.result.min = this.options.min;
  2031 + this.result.max = this.options.max;
  2032 + this.updateFrom();
  2033 + this.updateTo();
  2034 + },
  2035 +
  2036 +
  2037 + // =============================================================================================================
  2038 + // Grid
  2039 +
  2040 + appendGrid: function () {
  2041 + if (!this.options.grid) {
  2042 + return;
  2043 + }
  2044 +
  2045 + var o = this.options,
  2046 + i, z,
  2047 +
  2048 + total = o.max - o.min,
  2049 + big_num = o.grid_num,
  2050 + big_p = 0,
  2051 + big_w = 0,
  2052 +
  2053 + small_max = 4,
  2054 + local_small_max,
  2055 + small_p,
  2056 + small_w = 0,
  2057 +
  2058 + result,
  2059 + html = '';
  2060 +
  2061 +
  2062 +
  2063 + this.calcGridMargin();
  2064 +
  2065 + if (o.grid_snap) {
  2066 + big_num = total / o.step;
  2067 + big_p = this.toFixed(o.step / (total / 100));
  2068 + } else {
  2069 + big_p = this.toFixed(100 / big_num);
  2070 + }
  2071 +
  2072 + if (big_num > 4) {
  2073 + small_max = 3;
  2074 + }
  2075 + if (big_num > 7) {
  2076 + small_max = 2;
  2077 + }
  2078 + if (big_num > 14) {
  2079 + small_max = 1;
  2080 + }
  2081 + if (big_num > 28) {
  2082 + small_max = 0;
  2083 + }
  2084 +
  2085 + for (i = 0; i < big_num + 1; i++) {
  2086 + local_small_max = small_max;
  2087 +
  2088 + big_w = this.toFixed(big_p * i);
  2089 +
  2090 + if (big_w > 100) {
  2091 + big_w = 100;
  2092 +
  2093 + local_small_max -= 2;
  2094 + if (local_small_max < 0) {
  2095 + local_small_max = 0;
  2096 + }
  2097 + }
  2098 + this.coords.big[i] = big_w;
  2099 +
  2100 + small_p = (big_w - (big_p * (i - 1))) / (local_small_max + 1);
  2101 +
  2102 + for (z = 1; z <= local_small_max; z++) {
  2103 + if (big_w === 0) {
  2104 + break;
  2105 + }
  2106 +
  2107 + small_w = this.toFixed(big_w - (small_p * z));
  2108 +
  2109 + html += '<span class="irs-grid-pol small" style="left: ' + small_w + '%"></span>';
  2110 + }
  2111 +
  2112 + html += '<span class="irs-grid-pol" style="left: ' + big_w + '%"></span>';
  2113 +
  2114 + result = this.convertToValue(big_w);
  2115 + if (o.values.length) {
  2116 + result = o.p_values[result];
  2117 + } else {
  2118 + result = this._prettify(result);
  2119 + }
  2120 +
  2121 + html += '<span class="irs-grid-text js-grid-text-' + i + '" style="left: ' + big_w + '%">' + result + '</span>';
  2122 + }
  2123 + this.coords.big_num = Math.ceil(big_num + 1);
  2124 +
  2125 +
  2126 +
  2127 + this.$cache.cont.addClass("irs-with-grid");
  2128 + this.$cache.grid.html(html);
  2129 + this.cacheGridLabels();
  2130 + },
  2131 +
  2132 + cacheGridLabels: function () {
  2133 + var $label, i,
  2134 + num = this.coords.big_num;
  2135 +
  2136 + for (i = 0; i < num; i++) {
  2137 + $label = this.$cache.grid.find(".js-grid-text-" + i);
  2138 + this.$cache.grid_labels.push($label);
  2139 + }
  2140 +
  2141 + this.calcGridLabels();
  2142 + },
  2143 +
  2144 + calcGridLabels: function () {
  2145 + var i, label, start = [], finish = [],
  2146 + num = this.coords.big_num;
  2147 +
  2148 + for (i = 0; i < num; i++) {
  2149 + this.coords.big_w[i] = this.$cache.grid_labels[i].outerWidth(false);
  2150 + this.coords.big_p[i] = this.toFixed(this.coords.big_w[i] / this.coords.w_rs * 100);
  2151 + this.coords.big_x[i] = this.toFixed(this.coords.big_p[i] / 2);
  2152 +
  2153 + start[i] = this.toFixed(this.coords.big[i] - this.coords.big_x[i]);
  2154 + finish[i] = this.toFixed(start[i] + this.coords.big_p[i]);
  2155 + }
  2156 +
  2157 + if (this.options.force_edges) {
  2158 + if (start[0] < -this.coords.grid_gap) {
  2159 + start[0] = -this.coords.grid_gap;
  2160 + finish[0] = this.toFixed(start[0] + this.coords.big_p[0]);
  2161 +
  2162 + this.coords.big_x[0] = this.coords.grid_gap;
  2163 + }
  2164 +
  2165 + if (finish[num - 1] > 100 + this.coords.grid_gap) {
  2166 + finish[num - 1] = 100 + this.coords.grid_gap;
  2167 + start[num - 1] = this.toFixed(finish[num - 1] - this.coords.big_p[num - 1]);
  2168 +
  2169 + this.coords.big_x[num - 1] = this.toFixed(this.coords.big_p[num - 1] - this.coords.grid_gap);
  2170 + }
  2171 + }
  2172 +
  2173 + this.calcGridCollision(2, start, finish);
  2174 + this.calcGridCollision(4, start, finish);
  2175 +
  2176 + for (i = 0; i < num; i++) {
  2177 + label = this.$cache.grid_labels[i][0];
  2178 + label.style.marginLeft = -this.coords.big_x[i] + "%";
  2179 + }
  2180 + },
  2181 +
  2182 + // Collisions Calc Beta
  2183 + // TODO: Refactor then have plenty of time
  2184 + calcGridCollision: function (step, start, finish) {
  2185 + var i, next_i, label,
  2186 + num = this.coords.big_num;
  2187 +
  2188 + for (i = 0; i < num; i += step) {
  2189 + next_i = i + (step / 2);
  2190 + if (next_i >= num) {
  2191 + break;
  2192 + }
  2193 +
  2194 + label = this.$cache.grid_labels[next_i][0];
  2195 +
  2196 + if (finish[i] <= start[next_i]) {
  2197 + label.style.visibility = "visible";
  2198 + } else {
  2199 + label.style.visibility = "hidden";
  2200 + }
  2201 + }
  2202 + },
  2203 +
  2204 + calcGridMargin: function () {
  2205 + if (!this.options.grid_margin) {
  2206 + return;
  2207 + }
  2208 +
  2209 + this.coords.w_rs = this.$cache.rs.outerWidth(false);
  2210 + if (!this.coords.w_rs) {
  2211 + return;
  2212 + }
  2213 +
  2214 + if (this.options.type === "single") {
  2215 + this.coords.w_handle = this.$cache.s_single.outerWidth(false);
  2216 + } else {
  2217 + this.coords.w_handle = this.$cache.s_from.outerWidth(false);
  2218 + }
  2219 + this.coords.p_handle = this.toFixed(this.coords.w_handle / this.coords.w_rs * 100);
  2220 + this.coords.grid_gap = this.toFixed((this.coords.p_handle / 2) - 0.1);
  2221 +
  2222 + this.$cache.grid[0].style.width = this.toFixed(100 - this.coords.p_handle) + "%";
  2223 + this.$cache.grid[0].style.left = this.coords.grid_gap + "%";
  2224 + },
  2225 +
  2226 +
  2227 +
  2228 + // =============================================================================================================
  2229 + // Public methods
  2230 +
  2231 + update: function (options) {
  2232 + if (!this.input) {
  2233 + return;
  2234 + }
  2235 +
  2236 + this.is_update = true;
  2237 +
  2238 + this.options.from = this.result.from;
  2239 + this.options.to = this.result.to;
  2240 +
  2241 + this.options = $.extend(this.options, options);
  2242 + this.validate();
  2243 + this.updateResult(options);
  2244 +
  2245 + this.toggleInput();
  2246 + this.remove();
  2247 + this.init(true);
  2248 + },
  2249 +
  2250 + reset: function () {
  2251 + if (!this.input) {
  2252 + return;
  2253 + }
  2254 +
  2255 + this.updateResult();
  2256 + this.update();
  2257 + },
  2258 +
  2259 + destroy: function () {
  2260 + if (!this.input) {
  2261 + return;
  2262 + }
  2263 +
  2264 + this.toggleInput();
  2265 + this.$cache.input.prop("readonly", false);
  2266 + $.data(this.input, "ionRangeSlider", null);
  2267 +
  2268 + this.remove();
  2269 + this.input = null;
  2270 + this.options = null;
  2271 + }
  2272 + };
  2273 +
  2274 + $.fn.ionRangeSlider = function (options) {
  2275 + return this.each(function() {
  2276 + if (!$.data(this, "ionRangeSlider")) {
  2277 + $.data(this, "ionRangeSlider", new IonRangeSlider(this, options, plugin_count++));
  2278 + }
  2279 + });
  2280 + };
  2281 +
  2282 +
  2283 +
  2284 + // =================================================================================================================
  2285 + // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
  2286 + // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
  2287 +
  2288 + // requestAnimationFrame polyfill by Erik Mรถller. fixes from Paul Irish and Tino Zijdel
  2289 +
  2290 + // MIT license
  2291 +
  2292 + (function() {
  2293 + var lastTime = 0;
  2294 + var vendors = ['ms', 'moz', 'webkit', 'o'];
  2295 + for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
  2296 + window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
  2297 + window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
  2298 + || window[vendors[x]+'CancelRequestAnimationFrame'];
  2299 + }
  2300 +
  2301 + if (!window.requestAnimationFrame)
  2302 + window.requestAnimationFrame = function(callback, element) {
  2303 + var currTime = new Date().getTime();
  2304 + var timeToCall = Math.max(0, 16 - (currTime - lastTime));
  2305 + var id = window.setTimeout(function() { callback(currTime + timeToCall); },
  2306 + timeToCall);
  2307 + lastTime = currTime + timeToCall;
  2308 + return id;
  2309 + };
  2310 +
  2311 + if (!window.cancelAnimationFrame)
  2312 + window.cancelAnimationFrame = function(id) {
  2313 + clearTimeout(id);
  2314 + };
  2315 + }());
  2316 +
  2317 +}));
... ...
frontend/web/libraries/aaa.php 0 โ†’ 100644
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: starosta
  5 + * Date: 17.05.2016
  6 + * Time: 9:26
  7 + */
0 8 \ No newline at end of file
... ...
frontend/web/libraries/ion/css/ion.rangeSlider.skinFlat.css 0 โ†’ 100644
  1 +/* Ion.RangeSlider, Flat UI Skin
  2 +// css version 2.0.3
  3 +// ยฉ Denis Ineshin, 2014 https://github.com/IonDen
  4 +// ===================================================================================================================*/
  5 +
  6 +/* =====================================================================================================================
  7 +// Skin details */
  8 +
  9 +.irs-line-mid,
  10 +.irs-line-left,
  11 +.irs-line-right,
  12 +.irs-bar,
  13 +.irs-bar-edge,
  14 +.irs-slider {
  15 + background: url(../img/sprite-skin-flat.png) repeat-x;
  16 +}
  17 +
  18 +.irs {
  19 + height: 40px;
  20 +}
  21 +.irs-with-grid {
  22 + height: 60px;
  23 +}
  24 +.irs-line {
  25 + height: 12px; top: 25px;
  26 +}
  27 + .irs-line-left {
  28 + height: 12px;
  29 + background-position: 0 -30px;
  30 + }
  31 + .irs-line-mid {
  32 + height: 12px;
  33 + background-position: 0 0;
  34 + }
  35 + .irs-line-right {
  36 + height: 12px;
  37 + background-position: 100% -30px;
  38 + }
  39 +
  40 +.irs-bar {
  41 + height: 12px; top: 25px;
  42 + background-position: 0 -60px;
  43 +}
  44 + .irs-bar-edge {
  45 + top: 25px;
  46 + height: 12px; width: 9px;
  47 + background-position: 0 -90px;
  48 + }
  49 +
  50 +.irs-shadow {
  51 + height: 3px; top: 34px;
  52 + background: #000;
  53 + opacity: 0.25;
  54 +}
  55 +.lt-ie9 .irs-shadow {
  56 + filter: alpha(opacity=25);
  57 +}
  58 +
  59 +.irs-slider {
  60 + width: 16px; height: 18px;
  61 + top: 22px;
  62 + background-position: 0 -120px;
  63 +}
  64 +.irs-slider.state_hover, .irs-slider:hover {
  65 + background-position: 0 -150px;
  66 +}
  67 +
  68 +.irs-min, .irs-max {
  69 + color: #999;
  70 + font-size: 10px; line-height: 1.333;
  71 + text-shadow: none;
  72 + top: 0; padding: 1px 3px;
  73 + background: #e1e4e9;
  74 + -moz-border-radius: 4px;
  75 + border-radius: 4px;
  76 +}
  77 +
  78 +.irs-from, .irs-to, .irs-single {
  79 + color: #fff;
  80 + font-size: 10px; line-height: 1.333;
  81 + text-shadow: none;
  82 + padding: 1px 5px;
  83 + background: #ed5565;
  84 + -moz-border-radius: 4px;
  85 + border-radius: 4px;
  86 +}
  87 +.irs-from:after, .irs-to:after, .irs-single:after {
  88 + position: absolute; display: block; content: "";
  89 + bottom: -6px; left: 50%;
  90 + width: 0; height: 0;
  91 + margin-left: -3px;
  92 + overflow: hidden;
  93 + border: 3px solid transparent;
  94 + border-top-color: #ed5565;
  95 +}
  96 +
  97 +
  98 +.irs-grid-pol {
  99 + background: #e1e4e9;
  100 +}
  101 +.irs-grid-text {
  102 + color: #999;
  103 +}
  104 +
  105 +.irs-disabled {
  106 +}
... ...
frontend/web/libraries/ion/css/ion.rangeSlider.skinModern.css 0 โ†’ 100644
  1 +/* Ion.RangeSlider, Modern Skin
  2 +// css version 2.0.3
  3 +// ยฉ Denis Ineshin, 2014 https://github.com/IonDen
  4 +// ===================================================================================================================*/
  5 +
  6 +/* =====================================================================================================================
  7 +// Skin details */
  8 +
  9 +.irs-line-mid,
  10 +.irs-line-left,
  11 +.irs-line-right,
  12 +.irs-bar,
  13 +.irs-bar-edge,
  14 +.irs-slider {
  15 + background: url(../img/sprite-skin-modern.png) repeat-x;
  16 +}
  17 +
  18 +.irs {
  19 + height: 50px;
  20 +}
  21 +.irs-with-grid {
  22 + height: 70px;
  23 +}
  24 +.irs-line {
  25 + height: 6px; top: 25px;
  26 +}
  27 + .irs-line-left {
  28 + height: 6px;
  29 + background-position: 0 -30px;
  30 + }
  31 + .irs-line-mid {
  32 + height: 6px;
  33 + background-position: 0 0;
  34 + }
  35 + .irs-line-right {
  36 + height: 6px;
  37 + background-position: 100% -30px;
  38 + }
  39 +
  40 +.irs-bar {
  41 + height: 6px; top: 25px;
  42 + background-position: 0 -60px;
  43 +}
  44 + .irs-bar-edge {
  45 + top: 25px;
  46 + height: 6px; width: 6px;
  47 + background-position: 0 -90px;
  48 + }
  49 +
  50 +.irs-shadow {
  51 + height: 5px; top: 25px;
  52 + background: #000;
  53 + opacity: 0.25;
  54 +}
  55 +.lt-ie9 .irs-shadow {
  56 + filter: alpha(opacity=25);
  57 +}
  58 +
  59 +.irs-slider {
  60 + width: 11px; height: 18px;
  61 + top: 31px;
  62 + background-position: 0 -120px;
  63 +}
  64 +.irs-slider.state_hover, .irs-slider:hover {
  65 + background-position: 0 -150px;
  66 +}
  67 +
  68 +.irs-min, .irs-max {
  69 + color: #999;
  70 + font-size: 10px; line-height: 1.333;
  71 + text-shadow: none;
  72 + top: 0; padding: 1px 3px;
  73 + background: #e1e4e9;
  74 + -moz-border-radius: 4px;
  75 + border-radius: 4px;
  76 +}
  77 +
  78 +.irs-from, .irs-to, .irs-single {
  79 + color: #fff;
  80 + font-size: 10px; line-height: 1.333;
  81 + text-shadow: none;
  82 + padding: 1px 5px;
  83 + background: #20b426;
  84 + -moz-border-radius: 4px;
  85 + border-radius: 4px;
  86 +}
  87 +.irs-from:after, .irs-to:after, .irs-single:after {
  88 + position: absolute; display: block; content: "";
  89 + bottom: -6px; left: 50%;
  90 + width: 0; height: 0;
  91 + margin-left: -3px;
  92 + overflow: hidden;
  93 + border: 3px solid transparent;
  94 + border-top-color: #20b426;
  95 +}
  96 +
  97 +.irs-grid {
  98 + height: 34px;
  99 +}
  100 +.irs-grid-pol {
  101 + background: #c0c0c0;
  102 +}
  103 +.irs-grid-text {
  104 + bottom: 12px;
  105 + color: #c0c0c0;
  106 +}
  107 +
  108 +.irs-disable-mask {
  109 +
  110 +}
  111 +.irs-disabled {
  112 +
  113 +}
  114 +.lt-ie9 .irs-disabled {
  115 +
  116 +}
... ...
frontend/web/libraries/ion/css/ion.rangeSlider.skinNice.css 0 โ†’ 100644
  1 +/* Ion.RangeSlider, Nice Skin
  2 +// css version 2.0.3
  3 +// ยฉ Denis Ineshin, 2014 https://github.com/IonDen
  4 +// ===================================================================================================================*/
  5 +
  6 +/* =====================================================================================================================
  7 +// Skin details */
  8 +
  9 +.irs-line-mid,
  10 +.irs-line-left,
  11 +.irs-line-right,
  12 +.irs-bar,
  13 +.irs-bar-edge,
  14 +.irs-slider {
  15 + background: url(../img/sprite-skin-nice.png) repeat-x;
  16 +}
  17 +
  18 +.irs {
  19 + height: 40px;
  20 +}
  21 +.irs-with-grid {
  22 + height: 60px;
  23 +}
  24 +.irs-line {
  25 + height: 8px; top: 25px;
  26 +}
  27 + .irs-line-left {
  28 + height: 8px;
  29 + background-position: 0 -30px;
  30 + }
  31 + .irs-line-mid {
  32 + height: 8px;
  33 + background-position: 0 0;
  34 + }
  35 + .irs-line-right {
  36 + height: 8px;
  37 + background-position: 100% -30px;
  38 + }
  39 +
  40 +.irs-bar {
  41 + height: 8px; top: 25px;
  42 + background-position: 0 -60px;
  43 +}
  44 + .irs-bar-edge {
  45 + top: 25px;
  46 + height: 8px; width: 11px;
  47 + background-position: 0 -90px;
  48 + }
  49 +
  50 +.irs-shadow {
  51 + height: 1px; top: 34px;
  52 + background: #000;
  53 + opacity: 0.15;
  54 +}
  55 +.lt-ie9 .irs-shadow {
  56 + filter: alpha(opacity=15);
  57 +}
  58 +
  59 +.irs-slider {
  60 + width: 22px; height: 22px;
  61 + top: 17px;
  62 + background-position: 0 -120px;
  63 +}
  64 +.irs-slider.state_hover, .irs-slider:hover {
  65 + background-position: 0 -150px;
  66 +}
  67 +
  68 +.irs-min, .irs-max {
  69 + color: #999;
  70 + font-size: 10px; line-height: 1.333;
  71 + text-shadow: none;
  72 + top: 0; padding: 1px 3px;
  73 + background: rgba(0,0,0,0.1);
  74 + -moz-border-radius: 3px;
  75 + border-radius: 3px;
  76 +}
  77 +.lt-ie9 .irs-min, .lt-ie9 .irs-max {
  78 + background: #ccc;
  79 +}
  80 +
  81 +.irs-from, .irs-to, .irs-single {
  82 + color: #fff;
  83 + font-size: 10px; line-height: 1.333;
  84 + text-shadow: none;
  85 + padding: 1px 5px;
  86 + background: rgba(0,0,0,0.3);
  87 + -moz-border-radius: 3px;
  88 + border-radius: 3px;
  89 +}
  90 +.lt-ie9 .irs-from, .lt-ie9 .irs-to, .lt-ie9 .irs-single {
  91 + background: #999;
  92 +}
  93 +
  94 +.irs-grid-pol {
  95 + background: #99a4ac;
  96 +}
  97 +.irs-grid-text {
  98 + color: #99a4ac;
  99 +}
  100 +
  101 +.irs-disabled {
  102 +}
... ...
frontend/web/libraries/ion/css/ion.rangeSlider.skinSimple.css 0 โ†’ 100644
  1 +/* Ion.RangeSlider, Simple Skin
  2 +// css version 2.0.3
  3 +// ยฉ Denis Ineshin, 2014 https://github.com/IonDen
  4 +// ===================================================================================================================*/
  5 +
  6 +/* =====================================================================================================================
  7 +// Skin details */
  8 +
  9 +.irs-line-mid,
  10 +.irs-line-left,
  11 +.irs-line-right,
  12 +.irs-bar,
  13 +.irs-bar-edge,
  14 +.irs-slider {
  15 + background: url(../img/sprite-skin-simple.png) repeat-x;
  16 +}
  17 +
  18 +.irs {
  19 + height: 40px;
  20 +}
  21 +.irs-with-grid {
  22 + height: 60px;
  23 +}
  24 +.irs-line {
  25 + height: 6px; top: 25px;
  26 +}
  27 + .irs-line-left {
  28 + height: 6px;
  29 + background-position: 0 -30px;
  30 + }
  31 + .irs-line-mid {
  32 + height: 6px;
  33 + background-position: 0 0;
  34 + }
  35 + .irs-line-right {
  36 + height: 6px;
  37 + background-position: 100% -30px;
  38 + }
  39 +
  40 +.irs-bar {
  41 + height: 6px; top: 25px;
  42 + background-position: 0 -60px;
  43 +}
  44 + .irs-bar-edge {
  45 + top: 25px;
  46 + height: 6px; width: 7px;
  47 + background-position: 0 -90px;
  48 + }
  49 +
  50 +.irs-shadow {
  51 + height: 1px; top: 34px;
  52 + background: #000;
  53 + opacity: 0.75;
  54 +}
  55 +.lt-ie9 .irs-shadow {
  56 + filter: alpha(opacity=75);
  57 +}
  58 +
  59 +.irs-slider {
  60 + width: 8px; height: 15px;
  61 + top: 21px;
  62 + background-position: 0 -120px;
  63 +}
  64 +.irs-slider.state_hover, .irs-slider:hover {
  65 + background-position: 0 -150px;
  66 +}
  67 +
  68 +.irs-min, .irs-max {
  69 + color: #c0c0c0;
  70 + font-size: 10px; line-height: 1.333;
  71 + text-shadow: none;
  72 + top: 0; padding: 1px 3px;
  73 + background: rgba(0,0,0,0.1);
  74 + -moz-border-radius: 3px;
  75 + border-radius: 3px;
  76 +}
  77 +.lt-ie9 .irs-min, .lt-ie9 .irs-max {
  78 + background: #3654b0;
  79 +}
  80 +
  81 +.irs-from, .irs-to, .irs-single {
  82 + color: #000;
  83 + font-size: 10px; line-height: 1.333;
  84 + text-shadow: none;
  85 + padding: 1px 5px;
  86 + background: rgba(255,255,255,0.8);
  87 + -moz-border-radius: 3px;
  88 + border-radius: 3px;
  89 +}
  90 +.lt-ie9 .irs-from, .lt-ie9 .irs-to, .lt-ie9 .irs-single {
  91 + background: #d8dff3;
  92 +}
  93 +
  94 +.irs-grid-pol {
  95 + background: #777;
  96 +}
  97 +.irs-grid-text {
  98 + color: #e0e0e0;
  99 +}
  100 +
  101 +.irs-disabled {
  102 +}
... ...
frontend/web/libraries/ion/css/normalize.css 0 โ†’ 100644
  1 +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
  2 +
  3 +/**
  4 + * 1. Set default font family to sans-serif.
  5 + * 2. Prevent iOS text size adjust after orientation change, without disabling
  6 + * user zoom.
  7 + */
  8 +
  9 +html {
  10 + font-family: sans-serif; /* 1 */
  11 + -ms-text-size-adjust: 100%; /* 2 */
  12 + -webkit-text-size-adjust: 100%; /* 2 */
  13 +}
  14 +
  15 +/**
  16 + * Remove default margin.
  17 + */
  18 +
  19 +body {
  20 + margin: 0;
  21 +}
  22 +
  23 +/* HTML5 display definitions
  24 + ========================================================================== */
  25 +
  26 +/**
  27 + * Correct `block` display not defined for any HTML5 element in IE 8/9.
  28 + * Correct `block` display not defined for `details` or `summary` in IE 10/11
  29 + * and Firefox.
  30 + * Correct `block` display not defined for `main` in IE 11.
  31 + */
  32 +
  33 +article,
  34 +aside,
  35 +details,
  36 +figcaption,
  37 +figure,
  38 +footer,
  39 +header,
  40 +hgroup,
  41 +main,
  42 +menu,
  43 +nav,
  44 +section,
  45 +summary {
  46 + display: block;
  47 +}
  48 +
  49 +/**
  50 + * 1. Correct `inline-block` display not defined in IE 8/9.
  51 + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
  52 + */
  53 +
  54 +audio,
  55 +canvas,
  56 +progress,
  57 +video {
  58 + display: inline-block; /* 1 */
  59 + vertical-align: baseline; /* 2 */
  60 +}
  61 +
  62 +/**
  63 + * Prevent modern browsers from displaying `audio` without controls.
  64 + * Remove excess height in iOS 5 devices.
  65 + */
  66 +
  67 +audio:not([controls]) {
  68 + display: none;
  69 + height: 0;
  70 +}
  71 +
  72 +/**
  73 + * Address `[hidden]` styling not present in IE 8/9/10.
  74 + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
  75 + */
  76 +
  77 +[hidden],
  78 +template {
  79 + display: none;
  80 +}
  81 +
  82 +/* Links
  83 + ========================================================================== */
  84 +
  85 +/**
  86 + * Remove the gray background color from active links in IE 10.
  87 + */
  88 +
  89 +a {
  90 + background-color: transparent;
  91 +}
  92 +
  93 +/**
  94 + * Improve readability when focused and also mouse hovered in all browsers.
  95 + */
  96 +
  97 +a:active,
  98 +a:hover {
  99 + outline: 0;
  100 +}
  101 +
  102 +/* Text-level semantics
  103 + ========================================================================== */
  104 +
  105 +/**
  106 + * Address styling not present in IE 8/9/10/11, Safari, and Chrome.
  107 + */
  108 +
  109 +abbr[title] {
  110 + border-bottom: 1px dotted;
  111 +}
  112 +
  113 +/**
  114 + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
  115 + */
  116 +
  117 +b,
  118 +strong {
  119 + font-weight: bold;
  120 +}
  121 +
  122 +/**
  123 + * Address styling not present in Safari and Chrome.
  124 + */
  125 +
  126 +dfn {
  127 + font-style: italic;
  128 +}
  129 +
  130 +/**
  131 + * Address variable `h1` font-size and margin within `section` and `article`
  132 + * contexts in Firefox 4+, Safari, and Chrome.
  133 + */
  134 +
  135 +h1 {
  136 + font-size: 2em;
  137 + margin: 0.67em 0;
  138 +}
  139 +
  140 +/**
  141 + * Address styling not present in IE 8/9.
  142 + */
  143 +
  144 +mark {
  145 + background: #ff0;
  146 + color: #000;
  147 +}
  148 +
  149 +/**
  150 + * Address inconsistent and variable font size in all browsers.
  151 + */
  152 +
  153 +small {
  154 + font-size: 80%;
  155 +}
  156 +
  157 +/**
  158 + * Prevent `sub` and `sup` affecting `line-height` in all browsers.
  159 + */
  160 +
  161 +sub,
  162 +sup {
  163 + font-size: 75%;
  164 + line-height: 0;
  165 + position: relative;
  166 + vertical-align: baseline;
  167 +}
  168 +
  169 +sup {
  170 + top: -0.5em;
  171 +}
  172 +
  173 +sub {
  174 + bottom: -0.25em;
  175 +}
  176 +
  177 +/* Embedded content
  178 + ========================================================================== */
  179 +
  180 +/**
  181 + * Remove border when inside `a` element in IE 8/9/10.
  182 + */
  183 +
  184 +img {
  185 + border: 0;
  186 +}
  187 +
  188 +/**
  189 + * Correct overflow not hidden in IE 9/10/11.
  190 + */
  191 +
  192 +svg:not(:root) {
  193 + overflow: hidden;
  194 +}
  195 +
  196 +/* Grouping content
  197 + ========================================================================== */
  198 +
  199 +/**
  200 + * Address margin not present in IE 8/9 and Safari.
  201 + */
  202 +
  203 +figure {
  204 + margin: 1em 40px;
  205 +}
  206 +
  207 +/**
  208 + * Address differences between Firefox and other browsers.
  209 + */
  210 +
  211 +hr {
  212 + -moz-box-sizing: content-box;
  213 + box-sizing: content-box;
  214 + height: 0;
  215 +}
  216 +
  217 +/**
  218 + * Contain overflow in all browsers.
  219 + */
  220 +
  221 +pre {
  222 + overflow: auto;
  223 +}
  224 +
  225 +/**
  226 + * Address odd `em`-unit font size rendering in all browsers.
  227 + */
  228 +
  229 +code,
  230 +kbd,
  231 +pre,
  232 +samp {
  233 + font-family: monospace, monospace;
  234 + font-size: 1em;
  235 +}
  236 +
  237 +/* Forms
  238 + ========================================================================== */
  239 +
  240 +/**
  241 + * Known limitation: by default, Chrome and Safari on OS X allow very limited
  242 + * styling of `select`, unless a `border` property is set.
  243 + */
  244 +
  245 +/**
  246 + * 1. Correct color not being inherited.
  247 + * Known issue: affects color of disabled elements.
  248 + * 2. Correct font properties not being inherited.
  249 + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
  250 + */
  251 +
  252 +button,
  253 +input,
  254 +optgroup,
  255 +select,
  256 +textarea {
  257 + color: inherit; /* 1 */
  258 + font: inherit; /* 2 */
  259 + margin: 0; /* 3 */
  260 +}
  261 +
  262 +/**
  263 + * Address `overflow` set to `hidden` in IE 8/9/10/11.
  264 + */
  265 +
  266 +button {
  267 + overflow: visible;
  268 +}
  269 +
  270 +/**
  271 + * Address inconsistent `text-transform` inheritance for `button` and `select`.
  272 + * All other form control elements do not inherit `text-transform` values.
  273 + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
  274 + * Correct `select` style inheritance in Firefox.
  275 + */
  276 +
  277 +button,
  278 +select {
  279 + text-transform: none;
  280 +}
  281 +
  282 +/**
  283 + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
  284 + * and `video` controls.
  285 + * 2. Correct inability to style clickable `input` types in iOS.
  286 + * 3. Improve usability and consistency of cursor style between image-type
  287 + * `input` and others.
  288 + */
  289 +
  290 +button,
  291 +html input[type="button"], /* 1 */
  292 +input[type="reset"],
  293 +input[type="submit"] {
  294 + -webkit-appearance: button; /* 2 */
  295 + cursor: pointer; /* 3 */
  296 +}
  297 +
  298 +/**
  299 + * Re-set default cursor for disabled elements.
  300 + */
  301 +
  302 +button[disabled],
  303 +html input[disabled] {
  304 + cursor: default;
  305 +}
  306 +
  307 +/**
  308 + * Remove inner padding and border in Firefox 4+.
  309 + */
  310 +
  311 +button::-moz-focus-inner,
  312 +input::-moz-focus-inner {
  313 + border: 0;
  314 + padding: 0;
  315 +}
  316 +
  317 +/**
  318 + * Address Firefox 4+ setting `line-height` on `input` using `!important` in
  319 + * the UA stylesheet.
  320 + */
  321 +
  322 +input {
  323 + line-height: normal;
  324 +}
  325 +
  326 +/**
  327 + * It's recommended that you don't attempt to style these elements.
  328 + * Firefox's implementation doesn't respect box-sizing, padding, or width.
  329 + *
  330 + * 1. Address box sizing set to `content-box` in IE 8/9/10.
  331 + * 2. Remove excess padding in IE 8/9/10.
  332 + */
  333 +
  334 +input[type="checkbox"],
  335 +input[type="radio"] {
  336 + box-sizing: border-box; /* 1 */
  337 + padding: 0; /* 2 */
  338 +}
  339 +
  340 +/**
  341 + * Fix the cursor style for Chrome's increment/decrement buttons. For certain
  342 + * `font-size` values of the `input`, it causes the cursor style of the
  343 + * decrement button to change from `default` to `text`.
  344 + */
  345 +
  346 +input[type="number"]::-webkit-inner-spin-button,
  347 +input[type="number"]::-webkit-outer-spin-button {
  348 + height: auto;
  349 +}
  350 +
  351 +/**
  352 + * 1. Address `appearance` set to `searchfield` in Safari and Chrome.
  353 + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome
  354 + * (include `-moz` to future-proof).
  355 + */
  356 +
  357 +input[type="search"] {
  358 + -webkit-appearance: textfield; /* 1 */
  359 + -moz-box-sizing: content-box;
  360 + -webkit-box-sizing: content-box; /* 2 */
  361 + box-sizing: content-box;
  362 +}
  363 +
  364 +/**
  365 + * Remove inner padding and search cancel button in Safari and Chrome on OS X.
  366 + * Safari (but not Chrome) clips the cancel button when the search input has
  367 + * padding (and `textfield` appearance).
  368 + */
  369 +
  370 +input[type="search"]::-webkit-search-cancel-button,
  371 +input[type="search"]::-webkit-search-decoration {
  372 + -webkit-appearance: none;
  373 +}
  374 +
  375 +/**
  376 + * Define consistent border, margin, and padding.
  377 + */
  378 +
  379 +fieldset {
  380 + border: 1px solid #c0c0c0;
  381 + margin: 0 2px;
  382 + padding: 0.35em 0.625em 0.75em;
  383 +}
  384 +
  385 +/**
  386 + * 1. Correct `color` not being inherited in IE 8/9/10/11.
  387 + * 2. Remove padding so people aren't caught out if they zero out fieldsets.
  388 + */
  389 +
  390 +legend {
  391 + border: 0; /* 1 */
  392 + padding: 0; /* 2 */
  393 +}
  394 +
  395 +/**
  396 + * Remove default vertical scrollbar in IE 8/9/10/11.
  397 + */
  398 +
  399 +textarea {
  400 + overflow: auto;
  401 +}
  402 +
  403 +/**
  404 + * Don't inherit the `font-weight` (applied by a rule above).
  405 + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
  406 + */
  407 +
  408 +optgroup {
  409 + font-weight: bold;
  410 +}
  411 +
  412 +/* Tables
  413 + ========================================================================== */
  414 +
  415 +/**
  416 + * Remove most spacing between table cells.
  417 + */
  418 +
  419 +table {
  420 + border-collapse: collapse;
  421 + border-spacing: 0;
  422 +}
  423 +
  424 +td,
  425 +th {
  426 + padding: 0;
  427 +}
... ...
frontend/web/libraries/ion/img/sprite-skin-flat.png 0 โ†’ 100644

304 Bytes

frontend/web/libraries/ion/img/sprite-skin-modern.png 0 โ†’ 100644

505 Bytes

frontend/web/libraries/ion/img/sprite-skin-nice.png 0 โ†’ 100644

694 Bytes

frontend/web/libraries/ion/img/sprite-skin-simple.png 0 โ†’ 100644

358 Bytes

frontend/web/libraries/ion/js/ion.rangeSlider.min.js 0 โ†’ 100644
  1 +๏ปฟ// Ion.RangeSlider | version 2.1.4 | https://github.com/IonDen/ion.rangeSlider
  2 +;(function(g){"function"===typeof define&&define.amd?define(["jquery"],function(q){g(q,document,window,navigator)}):g(jQuery,document,window,navigator)})(function(g,q,h,t,v){var u=0,p=function(){var a=t.userAgent,b=/msie\s\d+/i;return 0<a.search(b)&&(a=b.exec(a).toString(),a=a.split(" ")[1],9>a)?(g("html").addClass("lt-ie9"),!0):!1}();Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,d=[].slice;if("function"!=typeof b)throw new TypeError;var c=d.call(arguments,1),e=function(){if(this instanceof
  3 +e){var f=function(){};f.prototype=b.prototype;var f=new f,l=b.apply(f,c.concat(d.call(arguments)));return Object(l)===l?l:f}return b.apply(a,c.concat(d.call(arguments)))};return e});Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var d;if(null==this)throw new TypeError('"this" is null or not defined');var c=Object(this),e=c.length>>>0;if(0===e)return-1;d=+b||0;Infinity===Math.abs(d)&&(d=0);if(d>=e)return-1;for(d=Math.max(0<=d?d:e-Math.abs(d),0);d<e;){if(d in c&&c[d]===a)return d;d++}return-1});
  4 +var r=function(a,b,d){this.VERSION="2.1.4";this.input=a;this.plugin_count=d;this.old_to=this.old_from=this.update_tm=this.calc_count=this.current_plugin=0;this.raf_id=this.old_min_interval=null;this.is_update=this.is_key=this.no_diapason=this.force_redraw=this.dragging=!1;this.is_start=!0;this.is_click=this.is_resize=this.is_active=this.is_finish=!1;this.$cache={win:g(h),body:g(q.body),input:g(a),cont:null,rs:null,min:null,max:null,from:null,to:null,single:null,bar:null,line:null,s_single:null,s_from:null,
  5 +s_to:null,shad_single:null,shad_from:null,shad_to:null,edge:null,grid:null,grid_labels:[]};this.coords={x_gap:0,x_pointer:0,w_rs:0,w_rs_old:0,w_handle:0,p_gap:0,p_gap_left:0,p_gap_right:0,p_step:0,p_pointer:0,p_handle:0,p_single_fake:0,p_single_real:0,p_from_fake:0,p_from_real:0,p_to_fake:0,p_to_real:0,p_bar_x:0,p_bar_w:0,grid_gap:0,big_num:0,big:[],big_w:[],big_p:[],big_x:[]};this.labels={w_min:0,w_max:0,w_from:0,w_to:0,w_single:0,p_min:0,p_max:0,p_from_fake:0,p_from_left:0,p_to_fake:0,p_to_left:0,
  6 +p_single_fake:0,p_single_left:0};var c=this.$cache.input;a=c.prop("value");var e;d={type:"single",min:10,max:100,from:null,to:null,step:1,min_interval:0,max_interval:0,drag_interval:!1,values:[],p_values:[],from_fixed:!1,from_min:null,from_max:null,from_shadow:!1,to_fixed:!1,to_min:null,to_max:null,to_shadow:!1,prettify_enabled:!0,prettify_separator:" ",prettify:null,force_edges:!1,keyboard:!1,keyboard_step:5,grid:!1,grid_margin:!0,grid_num:4,grid_snap:!1,hide_min_max:!1,hide_from_to:!1,prefix:"",
  7 +postfix:"",max_postfix:"",decorate_both:!0,values_separator:" \u2014 ",input_values_separator:";",disable:!1,onStart:null,onChange:null,onFinish:null,onUpdate:null};c={type:c.data("type"),min:c.data("min"),max:c.data("max"),from:c.data("from"),to:c.data("to"),step:c.data("step"),min_interval:c.data("minInterval"),max_interval:c.data("maxInterval"),drag_interval:c.data("dragInterval"),values:c.data("values"),from_fixed:c.data("fromFixed"),from_min:c.data("fromMin"),from_max:c.data("fromMax"),from_shadow:c.data("fromShadow"),
  8 +to_fixed:c.data("toFixed"),to_min:c.data("toMin"),to_max:c.data("toMax"),to_shadow:c.data("toShadow"),prettify_enabled:c.data("prettifyEnabled"),prettify_separator:c.data("prettifySeparator"),force_edges:c.data("forceEdges"),keyboard:c.data("keyboard"),keyboard_step:c.data("keyboardStep"),grid:c.data("grid"),grid_margin:c.data("gridMargin"),grid_num:c.data("gridNum"),grid_snap:c.data("gridSnap"),hide_min_max:c.data("hideMinMax"),hide_from_to:c.data("hideFromTo"),prefix:c.data("prefix"),postfix:c.data("postfix"),
  9 +max_postfix:c.data("maxPostfix"),decorate_both:c.data("decorateBoth"),values_separator:c.data("valuesSeparator"),input_values_separator:c.data("inputValuesSeparator"),disable:c.data("disable")};c.values=c.values&&c.values.split(",");for(e in c)c.hasOwnProperty(e)&&(c[e]||0===c[e]||delete c[e]);a&&(a=a.split(c.input_values_separator||b.input_values_separator||";"),a[0]&&a[0]==+a[0]&&(a[0]=+a[0]),a[1]&&a[1]==+a[1]&&(a[1]=+a[1]),b&&b.values&&b.values.length?(d.from=a[0]&&b.values.indexOf(a[0]),d.to=
  10 +a[1]&&b.values.indexOf(a[1])):(d.from=a[0]&&+a[0],d.to=a[1]&&+a[1]));g.extend(d,b);g.extend(d,c);this.options=d;this.validate();this.result={input:this.$cache.input,slider:null,min:this.options.min,max:this.options.max,from:this.options.from,from_percent:0,from_value:null,to:this.options.to,to_percent:0,to_value:null};this.init()};r.prototype={init:function(a){this.no_diapason=!1;this.coords.p_step=this.convertToPercent(this.options.step,!0);this.target="base";this.toggleInput();this.append();this.setMinMax();
  11 +a?(this.force_redraw=!0,this.calc(!0),this.callOnUpdate()):(this.force_redraw=!0,this.calc(!0),this.callOnStart());this.updateScene()},append:function(){this.$cache.input.before('<span class="irs js-irs-'+this.plugin_count+'"></span>');this.$cache.input.prop("readonly",!0);this.$cache.cont=this.$cache.input.prev();this.result.slider=this.$cache.cont;this.$cache.cont.html('<span class="irs"><span class="irs-line" tabindex="-1"><span class="irs-line-left"></span><span class="irs-line-mid"></span><span class="irs-line-right"></span></span><span class="irs-min">0</span><span class="irs-max">1</span><span class="irs-from">0</span><span class="irs-to">0</span><span class="irs-single">0</span></span><span class="irs-grid"></span><span class="irs-bar"></span>');
  12 +this.$cache.rs=this.$cache.cont.find(".irs");this.$cache.min=this.$cache.cont.find(".irs-min");this.$cache.max=this.$cache.cont.find(".irs-max");this.$cache.from=this.$cache.cont.find(".irs-from");this.$cache.to=this.$cache.cont.find(".irs-to");this.$cache.single=this.$cache.cont.find(".irs-single");this.$cache.bar=this.$cache.cont.find(".irs-bar");this.$cache.line=this.$cache.cont.find(".irs-line");this.$cache.grid=this.$cache.cont.find(".irs-grid");"single"===this.options.type?(this.$cache.cont.append('<span class="irs-bar-edge"></span><span class="irs-shadow shadow-single"></span><span class="irs-slider single"></span>'),
  13 +this.$cache.edge=this.$cache.cont.find(".irs-bar-edge"),this.$cache.s_single=this.$cache.cont.find(".single"),this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.shad_single=this.$cache.cont.find(".shadow-single")):(this.$cache.cont.append('<span class="irs-shadow shadow-from"></span><span class="irs-shadow shadow-to"></span><span class="irs-slider from"></span><span class="irs-slider to"></span>'),this.$cache.s_from=this.$cache.cont.find(".from"),
  14 +this.$cache.s_to=this.$cache.cont.find(".to"),this.$cache.shad_from=this.$cache.cont.find(".shadow-from"),this.$cache.shad_to=this.$cache.cont.find(".shadow-to"),this.setTopHandler());this.options.hide_from_to&&(this.$cache.from[0].style.display="none",this.$cache.to[0].style.display="none",this.$cache.single[0].style.display="none");this.appendGrid();this.options.disable?(this.appendDisableMask(),this.$cache.input[0].disabled=!0):(this.$cache.cont.removeClass("irs-disabled"),this.$cache.input[0].disabled=
  15 +!1,this.bindEvents());this.options.drag_interval&&(this.$cache.bar[0].style.cursor="ew-resize")},setTopHandler:function(){var a=this.options.max,b=this.options.to;this.options.from>this.options.min&&b===a?this.$cache.s_from.addClass("type_last"):b<a&&this.$cache.s_to.addClass("type_last")},changeLevel:function(a){switch(a){case "single":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_single_fake);break;case "from":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake);
  16 +this.$cache.s_from.addClass("state_hover");this.$cache.s_from.addClass("type_last");this.$cache.s_to.removeClass("type_last");break;case "to":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_to_fake);this.$cache.s_to.addClass("state_hover");this.$cache.s_to.addClass("type_last");this.$cache.s_from.removeClass("type_last");break;case "both":this.coords.p_gap_left=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake),this.coords.p_gap_right=this.toFixed(this.coords.p_to_fake-
  17 +this.coords.p_pointer),this.$cache.s_to.removeClass("type_last"),this.$cache.s_from.removeClass("type_last")}},appendDisableMask:function(){this.$cache.cont.append('<span class="irs-disable-mask"></span>');this.$cache.cont.addClass("irs-disabled")},remove:function(){this.$cache.cont.remove();this.$cache.cont=null;this.$cache.line.off("keydown.irs_"+this.plugin_count);this.$cache.body.off("touchmove.irs_"+this.plugin_count);this.$cache.body.off("mousemove.irs_"+this.plugin_count);this.$cache.win.off("touchend.irs_"+
  18 +this.plugin_count);this.$cache.win.off("mouseup.irs_"+this.plugin_count);p&&(this.$cache.body.off("mouseup.irs_"+this.plugin_count),this.$cache.body.off("mouseleave.irs_"+this.plugin_count));this.$cache.grid_labels=[];this.coords.big=[];this.coords.big_w=[];this.coords.big_p=[];this.coords.big_x=[];cancelAnimationFrame(this.raf_id)},bindEvents:function(){if(!this.no_diapason){this.$cache.body.on("touchmove.irs_"+this.plugin_count,this.pointerMove.bind(this));this.$cache.body.on("mousemove.irs_"+this.plugin_count,
  19 +this.pointerMove.bind(this));this.$cache.win.on("touchend.irs_"+this.plugin_count,this.pointerUp.bind(this));this.$cache.win.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this));this.$cache.line.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));this.$cache.line.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"));this.options.drag_interval&&"double"===this.options.type?(this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,
  20 +"both")),this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"both"))):(this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")));"single"===this.options.type?(this.$cache.single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.s_single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),
  21 +this.$cache.shad_single.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.s_single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.edge.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_single.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"))):(this.$cache.single.on("touchstart.irs_"+
  22 +this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.from.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_from.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.to.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.s_to.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),
  23 +this.$cache.shad_from.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.to.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.s_to.on("mousedown.irs_"+
  24 +this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.shad_from.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")));if(this.options.keyboard)this.$cache.line.on("keydown.irs_"+this.plugin_count,this.key.bind(this,"keyboard"));p&&(this.$cache.body.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this)),this.$cache.body.on("mouseleave.irs_"+this.plugin_count,this.pointerUp.bind(this)))}},
  25 +pointerMove:function(a){this.dragging&&(this.coords.x_pointer=(a.pageX||a.originalEvent.touches&&a.originalEvent.touches[0].pageX)-this.coords.x_gap,this.calc())},pointerUp:function(a){if(this.current_plugin===this.plugin_count&&this.is_active){this.is_active=!1;this.$cache.cont.find(".state_hover").removeClass("state_hover");this.force_redraw=!0;p&&g("*").prop("unselectable",!1);this.updateScene();this.restoreOriginalMinInterval();if(g.contains(this.$cache.cont[0],a.target)||this.dragging)this.is_finish=
  26 +!0,this.callOnFinish();this.dragging=!1}},pointerDown:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&("both"===a&&this.setTempMinInterval(),a||(a=this.target),this.current_plugin=this.plugin_count,this.target=a,this.dragging=this.is_active=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=d-this.coords.x_gap,this.calcPointerPercent(),this.changeLevel(a),p&&g("*").prop("unselectable",!0),this.$cache.line.trigger("focus"),
  27 +this.updateScene())},pointerClick:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&(this.current_plugin=this.plugin_count,this.target=a,this.is_click=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=+(d-this.coords.x_gap).toFixed(),this.force_redraw=!0,this.calc(),this.$cache.line.trigger("focus"))},key:function(a,b){if(!(this.current_plugin!==this.plugin_count||b.altKey||b.ctrlKey||b.shiftKey||b.metaKey)){switch(b.which){case 83:case 65:case 40:case 37:b.preventDefault();
  28 +this.moveByKey(!1);break;case 87:case 68:case 38:case 39:b.preventDefault(),this.moveByKey(!0)}return!0}},moveByKey:function(a){var b=this.coords.p_pointer,b=a?b+this.options.keyboard_step:b-this.options.keyboard_step;this.coords.x_pointer=this.toFixed(this.coords.w_rs/100*b);this.is_key=!0;this.calc()},setMinMax:function(){this.options&&(this.options.hide_min_max?(this.$cache.min[0].style.display="none",this.$cache.max[0].style.display="none"):(this.options.values.length?(this.$cache.min.html(this.decorate(this.options.p_values[this.options.min])),
  29 +this.$cache.max.html(this.decorate(this.options.p_values[this.options.max]))):(this.$cache.min.html(this.decorate(this._prettify(this.options.min),this.options.min)),this.$cache.max.html(this.decorate(this._prettify(this.options.max),this.options.max))),this.labels.w_min=this.$cache.min.outerWidth(!1),this.labels.w_max=this.$cache.max.outerWidth(!1)))},setTempMinInterval:function(){var a=this.result.to-this.result.from;null===this.old_min_interval&&(this.old_min_interval=this.options.min_interval);
  30 +this.options.min_interval=a},restoreOriginalMinInterval:function(){null!==this.old_min_interval&&(this.options.min_interval=this.old_min_interval,this.old_min_interval=null)},calc:function(a){if(this.options){this.calc_count++;if(10===this.calc_count||a)this.calc_count=0,this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.calcHandlePercent();if(this.coords.w_rs){this.calcPointerPercent();a=this.getHandleX();"click"===this.target&&(this.coords.p_gap=this.coords.p_handle/2,a=this.getHandleX(),this.target=
  31 +this.options.drag_interval?"both_one":this.chooseHandle(a));switch(this.target){case "base":var b=(this.options.max-this.options.min)/100;a=(this.result.from-this.options.min)/b;b=(this.result.to-this.options.min)/b;this.coords.p_single_real=this.toFixed(a);this.coords.p_from_real=this.toFixed(a);this.coords.p_to_real=this.toFixed(b);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,
  32 +this.options.from_min,this.options.from_max);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);this.target=null;break;case "single":if(this.options.from_fixed)break;this.coords.p_single_real=this.convertToRealPercent(a);this.coords.p_single_real=
  33 +this.calcWithStep(this.coords.p_single_real);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);break;case "from":if(this.options.from_fixed)break;this.coords.p_from_real=this.convertToRealPercent(a);this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real>this.coords.p_to_real&&(this.coords.p_from_real=this.coords.p_to_real);
  34 +this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_real=this.checkMaxInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);break;case "to":if(this.options.to_fixed)break;this.coords.p_to_real=this.convertToRealPercent(a);this.coords.p_to_real=
  35 +this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real<this.coords.p_from_real&&(this.coords.p_to_real=this.coords.p_from_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_real=this.checkMaxInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);
  36 +break;case "both":if(this.options.from_fixed||this.options.to_fixed)break;a=this.toFixed(a+.1*this.coords.p_handle);this.coords.p_from_real=this.convertToRealPercent(a)-this.coords.p_gap_left;this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,"from");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);
  37 +this.coords.p_to_real=this.convertToRealPercent(a)+this.coords.p_gap_right;this.coords.p_to_real=this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);break;case "both_one":if(!this.options.from_fixed&&!this.options.to_fixed){var d=this.convertToRealPercent(a);
  38 +a=this.result.to_percent-this.result.from_percent;var c=a/2,b=d-c,d=d+c;0>b&&(b=0,d=b+a);100<d&&(d=100,b=d-a);this.coords.p_from_real=this.calcWithStep(b);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_real=this.calcWithStep(d);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_fake=
  39 +this.convertToFakePercent(this.coords.p_to_real)}}"single"===this.options.type?(this.coords.p_bar_x=this.coords.p_handle/2,this.coords.p_bar_w=this.coords.p_single_fake,this.result.from_percent=this.coords.p_single_real,this.result.from=this.convertToValue(this.coords.p_single_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from])):(this.coords.p_bar_x=this.toFixed(this.coords.p_from_fake+this.coords.p_handle/2),this.coords.p_bar_w=this.toFixed(this.coords.p_to_fake-
  40 +this.coords.p_from_fake),this.result.from_percent=this.coords.p_from_real,this.result.from=this.convertToValue(this.coords.p_from_real),this.result.to_percent=this.coords.p_to_real,this.result.to=this.convertToValue(this.coords.p_to_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from],this.result.to_value=this.options.values[this.result.to]));this.calcMinMax();this.calcLabels()}}},calcPointerPercent:function(){this.coords.w_rs?(0>this.coords.x_pointer||isNaN(this.coords.x_pointer)?
  41 +this.coords.x_pointer=0:this.coords.x_pointer>this.coords.w_rs&&(this.coords.x_pointer=this.coords.w_rs),this.coords.p_pointer=this.toFixed(this.coords.x_pointer/this.coords.w_rs*100)):this.coords.p_pointer=0},convertToRealPercent:function(a){return a/(100-this.coords.p_handle)*100},convertToFakePercent:function(a){return a/100*(100-this.coords.p_handle)},getHandleX:function(){var a=100-this.coords.p_handle,b=this.toFixed(this.coords.p_pointer-this.coords.p_gap);0>b?b=0:b>a&&(b=a);return b},calcHandlePercent:function(){this.coords.w_handle=
  42 +"single"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1);this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100)},chooseHandle:function(a){return"single"===this.options.type?"single":a>=this.coords.p_from_real+(this.coords.p_to_real-this.coords.p_from_real)/2?this.options.to_fixed?"from":"to":this.options.from_fixed?"to":"from"},calcMinMax:function(){this.coords.w_rs&&(this.labels.p_min=this.labels.w_min/this.coords.w_rs*100,this.labels.p_max=
  43 +this.labels.w_max/this.coords.w_rs*100)},calcLabels:function(){this.coords.w_rs&&!this.options.hide_from_to&&("single"===this.options.type?(this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=this.coords.p_single_fake+this.coords.p_handle/2-this.labels.p_single_fake/2):(this.labels.w_from=this.$cache.from.outerWidth(!1),this.labels.p_from_fake=this.labels.w_from/this.coords.w_rs*100,this.labels.p_from_left=
  44 +this.coords.p_from_fake+this.coords.p_handle/2-this.labels.p_from_fake/2,this.labels.p_from_left=this.toFixed(this.labels.p_from_left),this.labels.p_from_left=this.checkEdges(this.labels.p_from_left,this.labels.p_from_fake),this.labels.w_to=this.$cache.to.outerWidth(!1),this.labels.p_to_fake=this.labels.w_to/this.coords.w_rs*100,this.labels.p_to_left=this.coords.p_to_fake+this.coords.p_handle/2-this.labels.p_to_fake/2,this.labels.p_to_left=this.toFixed(this.labels.p_to_left),this.labels.p_to_left=
  45 +this.checkEdges(this.labels.p_to_left,this.labels.p_to_fake),this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=(this.labels.p_from_left+this.labels.p_to_left+this.labels.p_to_fake)/2-this.labels.p_single_fake/2,this.labels.p_single_left=this.toFixed(this.labels.p_single_left)),this.labels.p_single_left=this.checkEdges(this.labels.p_single_left,this.labels.p_single_fake))},updateScene:function(){this.raf_id&&
  46 +(cancelAnimationFrame(this.raf_id),this.raf_id=null);clearTimeout(this.update_tm);this.update_tm=null;this.options&&(this.drawHandles(),this.is_active?this.raf_id=requestAnimationFrame(this.updateScene.bind(this)):this.update_tm=setTimeout(this.updateScene.bind(this),300))},drawHandles:function(){this.coords.w_rs=this.$cache.rs.outerWidth(!1);if(this.coords.w_rs){this.coords.w_rs!==this.coords.w_rs_old&&(this.target="base",this.is_resize=!0);if(this.coords.w_rs!==this.coords.w_rs_old||this.force_redraw)this.setMinMax(),
  47 +this.calc(!0),this.drawLabels(),this.options.grid&&(this.calcGridMargin(),this.calcGridLabels()),this.force_redraw=!0,this.coords.w_rs_old=this.coords.w_rs,this.drawShadow();if(this.coords.w_rs&&(this.dragging||this.force_redraw||this.is_key)){if(this.old_from!==this.result.from||this.old_to!==this.result.to||this.force_redraw||this.is_key){this.drawLabels();this.$cache.bar[0].style.left=this.coords.p_bar_x+"%";this.$cache.bar[0].style.width=this.coords.p_bar_w+"%";if("single"===this.options.type)this.$cache.s_single[0].style.left=
  48 +this.coords.p_single_fake+"%",this.$cache.single[0].style.left=this.labels.p_single_left+"%",this.options.values.length?this.$cache.input.prop("value",this.result.from_value):this.$cache.input.prop("value",this.result.from),this.$cache.input.data("from",this.result.from);else{this.$cache.s_from[0].style.left=this.coords.p_from_fake+"%";this.$cache.s_to[0].style.left=this.coords.p_to_fake+"%";if(this.old_from!==this.result.from||this.force_redraw)this.$cache.from[0].style.left=this.labels.p_from_left+
  49 +"%";if(this.old_to!==this.result.to||this.force_redraw)this.$cache.to[0].style.left=this.labels.p_to_left+"%";this.$cache.single[0].style.left=this.labels.p_single_left+"%";this.options.values.length?this.$cache.input.prop("value",this.result.from_value+this.options.input_values_separator+this.result.to_value):this.$cache.input.prop("value",this.result.from+this.options.input_values_separator+this.result.to);this.$cache.input.data("from",this.result.from);this.$cache.input.data("to",this.result.to)}this.old_from===
  50 +this.result.from&&this.old_to===this.result.to||this.is_start||this.$cache.input.trigger("change");this.old_from=this.result.from;this.old_to=this.result.to;this.is_resize||this.is_update||this.is_start||this.is_finish||this.callOnChange();if(this.is_key||this.is_click)this.is_click=this.is_key=!1,this.callOnFinish();this.is_finish=this.is_resize=this.is_update=!1}this.force_redraw=this.is_click=this.is_key=this.is_start=!1}}},drawLabels:function(){if(this.options){var a=this.options.values.length,
  51 +b=this.options.p_values,d;if(!this.options.hide_from_to)if("single"===this.options.type)a=a?this.decorate(b[this.result.from]):this.decorate(this._prettify(this.result.from),this.result.from),this.$cache.single.html(a),this.calcLabels(),this.$cache.min[0].style.visibility=this.labels.p_single_left<this.labels.p_min+1?"hidden":"visible",this.$cache.max[0].style.visibility=this.labels.p_single_left+this.labels.p_single_fake>100-this.labels.p_max-1?"hidden":"visible";else{a?(this.options.decorate_both?
  52 +(a=this.decorate(b[this.result.from]),a+=this.options.values_separator,a+=this.decorate(b[this.result.to])):a=this.decorate(b[this.result.from]+this.options.values_separator+b[this.result.to]),d=this.decorate(b[this.result.from]),b=this.decorate(b[this.result.to])):(this.options.decorate_both?(a=this.decorate(this._prettify(this.result.from),this.result.from),a+=this.options.values_separator,a+=this.decorate(this._prettify(this.result.to),this.result.to)):a=this.decorate(this._prettify(this.result.from)+
  53 +this.options.values_separator+this._prettify(this.result.to),this.result.to),d=this.decorate(this._prettify(this.result.from),this.result.from),b=this.decorate(this._prettify(this.result.to),this.result.to));this.$cache.single.html(a);this.$cache.from.html(d);this.$cache.to.html(b);this.calcLabels();b=Math.min(this.labels.p_single_left,this.labels.p_from_left);a=this.labels.p_single_left+this.labels.p_single_fake;d=this.labels.p_to_left+this.labels.p_to_fake;var c=Math.max(a,d);this.labels.p_from_left+
  54 +this.labels.p_from_fake>=this.labels.p_to_left?(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.single[0].style.visibility="visible",this.result.from===this.result.to?("from"===this.target?this.$cache.from[0].style.visibility="visible":"to"===this.target?this.$cache.to[0].style.visibility="visible":this.target||(this.$cache.from[0].style.visibility="visible"),this.$cache.single[0].style.visibility="hidden",c=d):(this.$cache.from[0].style.visibility=
  55 +"hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.single[0].style.visibility="visible",c=Math.max(a,d))):(this.$cache.from[0].style.visibility="visible",this.$cache.to[0].style.visibility="visible",this.$cache.single[0].style.visibility="hidden");this.$cache.min[0].style.visibility=b<this.labels.p_min+1?"hidden":"visible";this.$cache.max[0].style.visibility=c>100-this.labels.p_max-1?"hidden":"visible"}}},drawShadow:function(){var a=this.options,b=this.$cache,d="number"===typeof a.from_min&&
  56 +!isNaN(a.from_min),c="number"===typeof a.from_max&&!isNaN(a.from_max),e="number"===typeof a.to_min&&!isNaN(a.to_min),f="number"===typeof a.to_max&&!isNaN(a.to_max);"single"===a.type?a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_single[0].style.display="block",b.shad_single[0].style.left=d+"%",b.shad_single[0].style.width=
  57 +c+"%"):b.shad_single[0].style.display="none":(a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_from[0].style.display="block",b.shad_from[0].style.left=d+"%",b.shad_from[0].style.width=c+"%"):b.shad_from[0].style.display="none",a.to_shadow&&(e||f)?(e=this.convertToPercent(e?a.to_min:a.min),a=this.convertToPercent(f?
  58 +a.to_max:a.max)-e,e=this.toFixed(e-this.coords.p_handle/100*e),a=this.toFixed(a-this.coords.p_handle/100*a),e+=this.coords.p_handle/2,b.shad_to[0].style.display="block",b.shad_to[0].style.left=e+"%",b.shad_to[0].style.width=a+"%"):b.shad_to[0].style.display="none")},callOnStart:function(){if(this.options.onStart&&"function"===typeof this.options.onStart)this.options.onStart(this.result)},callOnChange:function(){if(this.options.onChange&&"function"===typeof this.options.onChange)this.options.onChange(this.result)},
  59 +callOnFinish:function(){if(this.options.onFinish&&"function"===typeof this.options.onFinish)this.options.onFinish(this.result)},callOnUpdate:function(){if(this.options.onUpdate&&"function"===typeof this.options.onUpdate)this.options.onUpdate(this.result)},toggleInput:function(){this.$cache.input.toggleClass("irs-hidden-input")},convertToPercent:function(a,b){var d=this.options.max-this.options.min;return d?this.toFixed((b?a:a-this.options.min)/(d/100)):(this.no_diapason=!0,0)},convertToValue:function(a){var b=
  60 +this.options.min,d=this.options.max,c=b.toString().split(".")[1],e=d.toString().split(".")[1],f,l,g=0,k=0;if(0===a)return this.options.min;if(100===a)return this.options.max;c&&(g=f=c.length);e&&(g=l=e.length);f&&l&&(g=f>=l?f:l);0>b&&(k=Math.abs(b),b=+(b+k).toFixed(g),d=+(d+k).toFixed(g));a=(d-b)/100*a+b;(b=this.options.step.toString().split(".")[1])?a=+a.toFixed(b.length):(a/=this.options.step,a*=this.options.step,a=+a.toFixed(0));k&&(a-=k);k=b?+a.toFixed(b.length):this.toFixed(a);k<this.options.min?
  61 +k=this.options.min:k>this.options.max&&(k=this.options.max);return k},calcWithStep:function(a){var b=Math.round(a/this.coords.p_step)*this.coords.p_step;100<b&&(b=100);100===a&&(b=100);return this.toFixed(b)},checkMinInterval:function(a,b,d){var c=this.options;if(!c.min_interval)return a;a=this.convertToValue(a);b=this.convertToValue(b);"from"===d?b-a<c.min_interval&&(a=b-c.min_interval):a-b<c.min_interval&&(a=b+c.min_interval);return this.convertToPercent(a)},checkMaxInterval:function(a,b,d){var c=
  62 +this.options;if(!c.max_interval)return a;a=this.convertToValue(a);b=this.convertToValue(b);"from"===d?b-a>c.max_interval&&(a=b-c.max_interval):a-b>c.max_interval&&(a=b+c.max_interval);return this.convertToPercent(a)},checkDiapason:function(a,b,d){a=this.convertToValue(a);var c=this.options;"number"!==typeof b&&(b=c.min);"number"!==typeof d&&(d=c.max);a<b&&(a=b);a>d&&(a=d);return this.convertToPercent(a)},toFixed:function(a){a=a.toFixed(9);return+a},_prettify:function(a){return this.options.prettify_enabled?
  63 +this.options.prettify&&"function"===typeof this.options.prettify?this.options.prettify(a):this.prettify(a):a},prettify:function(a){return a.toString().replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g,"$1"+this.options.prettify_separator)},checkEdges:function(a,b){if(!this.options.force_edges)return this.toFixed(a);0>a?a=0:a>100-b&&(a=100-b);return this.toFixed(a)},validate:function(){var a=this.options,b=this.result,d=a.values,c=d.length,e,f;"string"===typeof a.min&&(a.min=+a.min);"string"===typeof a.max&&
  64 +(a.max=+a.max);"string"===typeof a.from&&(a.from=+a.from);"string"===typeof a.to&&(a.to=+a.to);"string"===typeof a.step&&(a.step=+a.step);"string"===typeof a.from_min&&(a.from_min=+a.from_min);"string"===typeof a.from_max&&(a.from_max=+a.from_max);"string"===typeof a.to_min&&(a.to_min=+a.to_min);"string"===typeof a.to_max&&(a.to_max=+a.to_max);"string"===typeof a.keyboard_step&&(a.keyboard_step=+a.keyboard_step);"string"===typeof a.grid_num&&(a.grid_num=+a.grid_num);a.max<a.min&&(a.max=a.min);if(c)for(a.p_values=
  65 +[],a.min=0,a.max=c-1,a.step=1,a.grid_num=a.max,a.grid_snap=!0,f=0;f<c;f++)e=+d[f],isNaN(e)?e=d[f]:(d[f]=e,e=this._prettify(e)),a.p_values.push(e);if("number"!==typeof a.from||isNaN(a.from))a.from=a.min;if("number"!==typeof a.to||isNaN(a.from))a.to=a.max;if("single"===a.type)a.from<a.min&&(a.from=a.min),a.from>a.max&&(a.from=a.max);else{if(a.from<a.min||a.from>a.max)a.from=a.min;if(a.to>a.max||a.to<a.min)a.to=a.max;a.from>a.to&&(a.from=a.to)}if("number"!==typeof a.step||isNaN(a.step)||!a.step||0>a.step)a.step=
  66 +1;if("number"!==typeof a.keyboard_step||isNaN(a.keyboard_step)||!a.keyboard_step||0>a.keyboard_step)a.keyboard_step=5;"number"===typeof a.from_min&&a.from<a.from_min&&(a.from=a.from_min);"number"===typeof a.from_max&&a.from>a.from_max&&(a.from=a.from_max);"number"===typeof a.to_min&&a.to<a.to_min&&(a.to=a.to_min);"number"===typeof a.to_max&&a.from>a.to_max&&(a.to=a.to_max);if(b){b.min!==a.min&&(b.min=a.min);b.max!==a.max&&(b.max=a.max);if(b.from<b.min||b.from>b.max)b.from=a.from;if(b.to<b.min||b.to>
  67 +b.max)b.to=a.to}if("number"!==typeof a.min_interval||isNaN(a.min_interval)||!a.min_interval||0>a.min_interval)a.min_interval=0;if("number"!==typeof a.max_interval||isNaN(a.max_interval)||!a.max_interval||0>a.max_interval)a.max_interval=0;a.min_interval&&a.min_interval>a.max-a.min&&(a.min_interval=a.max-a.min);a.max_interval&&a.max_interval>a.max-a.min&&(a.max_interval=a.max-a.min)},decorate:function(a,b){var d="",c=this.options;c.prefix&&(d+=c.prefix);d+=a;c.max_postfix&&(c.values.length&&a===c.p_values[c.max]?
  68 +(d+=c.max_postfix,c.postfix&&(d+=" ")):b===c.max&&(d+=c.max_postfix,c.postfix&&(d+=" ")));c.postfix&&(d+=c.postfix);return d},updateFrom:function(){this.result.from=this.options.from;this.result.from_percent=this.convertToPercent(this.result.from);this.options.values&&(this.result.from_value=this.options.values[this.result.from])},updateTo:function(){this.result.to=this.options.to;this.result.to_percent=this.convertToPercent(this.result.to);this.options.values&&(this.result.to_value=this.options.values[this.result.to])},
  69 +updateResult:function(){this.result.min=this.options.min;this.result.max=this.options.max;this.updateFrom();this.updateTo()},appendGrid:function(){if(this.options.grid){var a=this.options,b,d;b=a.max-a.min;var c=a.grid_num,e=0,f=0,g=4,h,k,m=0,n="";this.calcGridMargin();a.grid_snap?(c=b/a.step,e=this.toFixed(a.step/(b/100))):e=this.toFixed(100/c);4<c&&(g=3);7<c&&(g=2);14<c&&(g=1);28<c&&(g=0);for(b=0;b<c+1;b++){h=g;f=this.toFixed(e*b);100<f&&(f=100,h-=2,0>h&&(h=0));this.coords.big[b]=f;k=(f-e*(b-1))/
  70 +(h+1);for(d=1;d<=h&&0!==f;d++)m=this.toFixed(f-k*d),n+='<span class="irs-grid-pol small" style="left: '+m+'%"></span>';n+='<span class="irs-grid-pol" style="left: '+f+'%"></span>';m=this.convertToValue(f);m=a.values.length?a.p_values[m]:this._prettify(m);n+='<span class="irs-grid-text js-grid-text-'+b+'" style="left: '+f+'%">'+m+"</span>"}this.coords.big_num=Math.ceil(c+1);this.$cache.cont.addClass("irs-with-grid");this.$cache.grid.html(n);this.cacheGridLabels()}},cacheGridLabels:function(){var a,
  71 +b,d=this.coords.big_num;for(b=0;b<d;b++)a=this.$cache.grid.find(".js-grid-text-"+b),this.$cache.grid_labels.push(a);this.calcGridLabels()},calcGridLabels:function(){var a,b;b=[];var d=[],c=this.coords.big_num;for(a=0;a<c;a++)this.coords.big_w[a]=this.$cache.grid_labels[a].outerWidth(!1),this.coords.big_p[a]=this.toFixed(this.coords.big_w[a]/this.coords.w_rs*100),this.coords.big_x[a]=this.toFixed(this.coords.big_p[a]/2),b[a]=this.toFixed(this.coords.big[a]-this.coords.big_x[a]),d[a]=this.toFixed(b[a]+
  72 +this.coords.big_p[a]);this.options.force_edges&&(b[0]<-this.coords.grid_gap&&(b[0]=-this.coords.grid_gap,d[0]=this.toFixed(b[0]+this.coords.big_p[0]),this.coords.big_x[0]=this.coords.grid_gap),d[c-1]>100+this.coords.grid_gap&&(d[c-1]=100+this.coords.grid_gap,b[c-1]=this.toFixed(d[c-1]-this.coords.big_p[c-1]),this.coords.big_x[c-1]=this.toFixed(this.coords.big_p[c-1]-this.coords.grid_gap)));this.calcGridCollision(2,b,d);this.calcGridCollision(4,b,d);for(a=0;a<c;a++)b=this.$cache.grid_labels[a][0],
  73 +b.style.marginLeft=-this.coords.big_x[a]+"%"},calcGridCollision:function(a,b,d){var c,e,f,g=this.coords.big_num;for(c=0;c<g;c+=a){e=c+a/2;if(e>=g)break;f=this.$cache.grid_labels[e][0];f.style.visibility=d[c]<=b[e]?"visible":"hidden"}},calcGridMargin:function(){this.options.grid_margin&&(this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.coords.w_rs&&(this.coords.w_handle="single"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1),this.coords.p_handle=this.toFixed(this.coords.w_handle/
  74 +this.coords.w_rs*100),this.coords.grid_gap=this.toFixed(this.coords.p_handle/2-.1),this.$cache.grid[0].style.width=this.toFixed(100-this.coords.p_handle)+"%",this.$cache.grid[0].style.left=this.coords.grid_gap+"%"))},update:function(a){this.input&&(this.is_update=!0,this.options.from=this.result.from,this.options.to=this.result.to,this.options=g.extend(this.options,a),this.validate(),this.updateResult(a),this.toggleInput(),this.remove(),this.init(!0))},reset:function(){this.input&&(this.updateResult(),
  75 +this.update())},destroy:function(){this.input&&(this.toggleInput(),this.$cache.input.prop("readonly",!1),g.data(this.input,"ionRangeSlider",null),this.remove(),this.options=this.input=null)}};g.fn.ionRangeSlider=function(a){return this.each(function(){g.data(this,"ionRangeSlider")||g.data(this,"ionRangeSlider",new r(this,a,u++))})};(function(){for(var a=0,b=["ms","moz","webkit","o"],d=0;d<b.length&&!h.requestAnimationFrame;++d)h.requestAnimationFrame=h[b[d]+"RequestAnimationFrame"],h.cancelAnimationFrame=
  76 +h[b[d]+"CancelAnimationFrame"]||h[b[d]+"CancelRequestAnimationFrame"];h.requestAnimationFrame||(h.requestAnimationFrame=function(b,d){var f=(new Date).getTime(),g=Math.max(0,16-(f-a)),p=h.setTimeout(function(){b(f+g)},g);a=f+g;return p});h.cancelAnimationFrame||(h.cancelAnimationFrame=function(a){clearTimeout(a)})})()});
... ...