PageSourceSearch

https://fraxscan.com/assets/js/components/hs.range-slider.js?v=26.9.3.0

js fraxscan.com collected 2026-09-25 19:05:37 UTC 7,991 bytes, 247 lines download raw bytes

1/**
2 * Range Slider wrapper.
3 *
4 * @author Htmlstream
5 * @version 1.0
6 *
7 */
8var isEmpty = function isEmpty(f) {
9    return (/^function[^{]+\{\s*\}/m.test(f.toString())
10    );
11  }
12
13;(function ($) {
14  'use strict';
15
16  $.HSCore.components.HSRangeSlider = {
17    /**
18     *
19     *
20     * @var Object _baseConfig
21     */
22    _baseConfig: {
23      hide_min_max: true,
24      hide_from_to: true,
25      onStart: function () {},
26      onChange: function () {},
27      onFinish: function () {},
28      onUpdate: function () {}
29    },
30
31    /**
32     *
33     *
34     * @var jQuery pageCollection
35     */
36    pageCollection: $(),
37
38    /**
39     * Initialization of Range Slider wrapper.
40     *
41     * @param String selector (optional)
42     * @param Object config (optional)
43     *
44     * @return jQuery pageCollection - collection of initialized items.
45     */
46
47    init: function (selector, config) {
48
49      this.collection = selector && $(selector).length ? $(selector) : $();
50      if (!$(selector).length) return;
51
52      this.config = config && $.isPlainObject(config) ?
53        $.extend({}, this._baseConfig, config) : this._baseConfig;
54
55      this.config.itemSelector = selector;
56
57      this.initRangeSlider();
58
59      return this.pageCollection;
60
61    },
62
63    initRangeSlider: function () {
64      //Variables
65      var $self = this,
66        config = $self.config,
67        collection = $self.pageCollection;
68
69      //Actions
70      this.collection.each(function (i, el) {
71        //Variables
72        var $this = $(el),
73          type = $this.data('type'),
74          minResult = $this.data('result-min'),
75          maxResult = $this.data('result-max'),
76          secondaryResult = $this.data('result-secondary'),
77          secondaryValue = $this.data('secondary-value'),
78          hasGrid = Boolean($this.data('grid')),
79          graphForegroundTarget = $this.data('foreground-target');
80
81        $this.ionRangeSlider({
82          hide_min_max: config.hide_min_max,
83          hide_from_to: config.hide_from_to,
84          onStart: isEmpty(config.onStart) === true ? function (data) {
85            if (graphForegroundTarget) {
86              var w = (100 - (data.from_percent + (100 - data.to_percent)));
87
88              $(graphForegroundTarget).css({
89                left: data.from_percent + '%',
90                width: w + '%'
91              });
92
93              $(graphForegroundTarget + '> *').css({
94                width: $(graphForegroundTarget).parent().width(),
95                'transform': 'translateX(-' + data.from_percent + '%)'
96              });
97            }
98
99            if (minResult && type === 'single') {
100              if ($(minResult).is('input')) {
101                $(minResult).val(data.from);
102              } else {
103                $(minResult).text(data.from);
104              }
105            } else if (minResult || maxResult && type === 'double') {
106              if ($(minResult).is('input')) {
107                $(minResult).val(data.from);
108              } else {
109                $(minResult).text(data.from);
110              }
111
112              if ($(minResult).is('input')) {
113                $(maxResult).val(data.to);
114              } else {
115                $(maxResult).text(data.to);
116              }
117            }
118
119            if (hasGrid && type === 'single') {
120              $(data.slider).find('.irs-grid-text').each(function (i) {
121                var current = $(this);
122
123                if ($(current).text() === data.from) {
124                  $(data.slider).find('.irs-grid-text').removeClass('current');
125                  $(current).addClass('current');
126                }
127              });
128            }
129
130            if (secondaryResult) {
131              secondaryValue.steps.push(data.max + 1);
132              secondaryValue.values.push(secondaryValue.values[secondaryValue.values.length - 1] + 1);
133
134              for (var i = 0; i < secondaryValue.steps.length; i++) {
135                if (data.from >= secondaryValue.steps[i] && data.from < secondaryValue.steps[i + 1]) {
136                  if ($(secondaryResult).is('input')) {
137                    $(secondaryResult).val(secondaryValue.values[i]);
138                  } else {
139                    $(secondaryResult).text(secondaryValue.values[i]);
140                  }
141                }
142              }
143            }
144          } : config.onStart,
145          onChange: isEmpty(config.onChange) === true ? function (data) {
146            if (graphForegroundTarget) {
147              var w = (100 - (data.from_percent + (100 - data.to_percent)));
148
149              $(graphForegroundTarget).css({
150                left: data.from_percent + '%',
151                width: w + '%'
152              });
153
154              $(graphForegroundTarget + '> *').css({
155                width: $(graphForegroundTarget).parent().width(),
156                'transform': 'translateX(-' + data.from_percent + '%)'
157              });
158            }
159
160            if (minResult && type === 'single') {
161              if ($(minResult).is('input')) {
162                $(minResult).val(data.from);
163              } else {
164                $(minResult).text(data.from);
165              }
166            } else if (minResult || maxResult && type === 'double') {
167              if ($(minResult).is('input')) {
168                $(minResult).val(data.from);
169              } else {
170                $(minResult).text(data.from);
171              }
172
173              if ($(minResult).is('input')) {
174                $(maxResult).val(data.to);
175              } else {
176                $(maxResult).text(data.to);
177              }
178            }
179
180            if (hasGrid && type === 'single') {
181              $(data.slider).find('.irs-grid-text').each(function (i) {
182                var current = $(this);
183
184                if ($(current).text() === data.from) {
185                  $(data.slider).find('.irs-grid-text').removeClass('current');
186                  $(current).addClass('current');
187                }
188              });
189            }
190
191            if (secondaryResult) {
192              for (var i = 0; i < secondaryValue.steps.length; i++) {
193                if (data.from >= secondaryValue.steps[i] && data.from < secondaryValue.steps[i + 1]) {
194                  if ($(secondaryResult).is('input')) {
195                    $(secondaryResult).val(secondaryValue.values[i]);
196                  } else {
197                    $(secondaryResult).text(secondaryValue.values[i]);
198                  }
199                }
200              }
201            }
202          } : config.onChange,
203          onFinish: isEmpty(config.onFinish) === true ? function (data) {} : config.onFinish,
204          onUpdate: isEmpty(config.onUpdate) === true ? function (data) {} : config.onUpdate
205        });
206
207        var slider = $this.data('ionRangeSlider');
208
209        if (minResult && type === 'single' && $(minResult).is('input')) {
210          $(minResult).on('change', function () {
211            slider.update({
212              from: $(this).val()
213            });
214          });
215        } else if (minResult || maxResult && type === 'double' && $(minResult).is('input') || $(maxResult).is('input')) {
216          $(minResult).on('change', function () {
217            slider.update({
218              from: $(this).val()
219            });
220          });
221          $(maxResult).on('change', function () {
222            slider.update({
223              to: $(this).val()
224            });
225          });
226        }
227
228        $(window).on('resize', function () {
229          $(graphForegroundTarget + '> *').css({
230            width: ''
231          });
232
233          setTimeout(function () {
234            $(graphForegroundTarget + '> *').css({
235              width: $(graphForegroundTarget).parent().width()
236            });
237          }, 800);
238        });
239
240        //Actions
241        collection = collection.add($this);
242      });
243    }
244
245  };
246
247})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.