PageSourceSearch

https://www.jhrl.com/sites/all/modules/rescms/rc_riot/tags/rc_riot…/build/rc_riot_solr_price_slider.js?tlse4v

js jhrl.com collected 2026-10-06 13:19:21 UTC 6,798 bytes, 173 lines download raw bytes

1riot.tag2('rc-riot-solr-price-slider', '<h5>{opts.txt.label}</h5> <div class="ranges-canvas"></div>', '@-webkit-keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } } @-moz-keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } } @-o-keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } } @keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } } rc-riot-solr-price-slider,[riot-tag="rc-riot-solr-price-slider"],[data-is="rc-riot-solr-price-slider"]{ display: block; } rc-riot-solr-price-slider,[riot-tag="rc-riot-solr-price-slider"],[data-is="rc-riot-solr-price-slider"]{ display: none; } rc-riot-solr-price-slider.has-prices,[riot-tag="rc-riot-solr-price-slider"].has-prices,[data-is="rc-riot-solr-price-slider"].has-prices{ display: block; }', 'class="{\'has-prices\': slider !=null}"', function(opts) {
2    this.mixin('RCRiotAvailPricing');
3    this.slider = null;
4    this.pmin = 0;
5    this.pmax = 9999;
6    this.pminfilt = 0;
7    this.pmaxfilt = 0;
8    (function ($, tag) {
9      tag.instance = new AjaxSolr.RCRiotSolrPriceSlider({
10        id: 'RCRiotSolrPriceSlider',
11        observable: tag
12      });
13      tag.RCRiotAvailPricing.on('PricingChanged', function (obj) {
14        tag.pmin = null
15        tag.pmax = null
16
17        var ap = obj.pricing
18        for (ind in ap) {
19          if (ap[ind].prices.length > 0) {
20            var priceRange = tag.getPriceRange(ap[ind]);
21            if (tag.pmin == null || tag.pmin > Number(priceRange[0])) {
22              tag.pmin = Number(priceRange[0])
23            }
24            if (tag.pmax == null || tag.pmax < Number(priceRange[1])) {
25              tag.pmax = Number(priceRange[1])
26            }
27          }
28        }
29        if ((tag.pmin == null && tag.pmax == null) || tag.pmin == tag.pmax) {
30          tag.resetFilter()
31        }
32        else {
33          tag.applySolrFilter()
34        }
35        tag.updateRangeSlider()
36      });
37
38      tag.getPriceRange = function(price) {
39        var range;
40        switch(tag.opts.display_type) {
41          case "8":
42            range = tag.getItemPriceRangePerNight(price.eid);
43            return [Math.floor(range[0].ppn), Math.ceil(range[1].ppn)];
44          case "16":
45            range = tag.getItemPriceRangePerWeek(price.eid);
46            return [Math.floor(range[0].ppw), Math.ceil(range[1].ppw)];
47          case "64":
48            range = tag.getItemPriceRangePerPerson(price.eid);
49            return [Math.floor(range[0].ppp), Math.ceil(range[1].ppp)];
50          case "72":
51            range = tag.getItemPriceRangePerPersonPerNight(price.eid);
52            return [Math.floor(range[0].pppn), Math.ceil(range[1].pppn)];
53          default:
54            return [Math.floor(price.range[0]), Math.ceil(price.range[1])];
55        }
56      };
57
58      tag.getSlider = function () {
59        var promise = $.Deferred(function () {
60          if (tag.slider == null && tag.pmin && tag.pmax && tag.pmax > tag.pmin) {
61            tag.slider = tag.root.querySelector('.ranges-canvas');
62            var decodeFilterVal = function (value) {
63              return parseFloat(value.toString().replace(/[^0-9.]/g, ''));
64            };
65            noUiSlider.create(tag.slider, {
66              start: [tag.pmin, tag.pmax],
67              tooltips: true,
68              connect: true,
69              step: 50,
70              range: {
71                min: tag.pmin,
72                max: tag.pmax
73              },
74              format: {
75                to: function (value) {
76                  return tag.formatAvailPrice(value, 0);
77                },
78                from: decodeFilterVal
79              }
80            });
81
82            tag.slider.noUiSlider.on('set', function (data) {
83              tag.pminfilt = decodeFilterVal(data[0]);
84              tag.pmaxfilt = decodeFilterVal(data[1]);
85              tag.applySolrFilter()
86
87              if (RiotSolrAppTracker) {
88                RiotSolrAppTracker.trackEvent({
89                  category: 'Search - ' + opts.txt.label || 'Price',
90                  action: 'Facet Set',
91                  label: data[0] + ' to ' + data[1],
92                  entityInfo: tag.instance.manager.bundles
93                    ? tag.instance.manager.entityType + ' - ' + tag.instance.manager.bundles.join(', ')
94                    : tag.instance.manager.entityType,
95                });
96              }
97            });
98
99            this.resolve(tag.slider)
100          }
101          else {
102            this.resolve(tag.slider)
103          }
104        })
105        return promise
106      }
107
108      tag.on('RCRiotSolrPriceSliderAfterRequest', function (data) {
109        if (!tag.opts.manager.store.find('fq', tag.instance.lookupRegex) && !tag.opts.manager.store.find('fq', new RegExp('{!tag=RCRiotAvailFilter.*}item_id:*'))) {
110          tag.resetFilter()
111        }
112        if (!tag.opts.manager.store.find('fq', tag.instance.lookupRegex)) {
113          tag.getSlider().done(function (slider) {
114            if (slider != null) {
115              slider.noUiSlider.set([tag.pmin, tag.pmax])
116            }
117          })
118        }
119      })
120      tag.applySolrFilter = function () {
121        var ap = tag.getAvailPricing(), eids = [], filterval
122        if (tag.pminfilt || tag.pmaxfilt) {
123          label = ' from ' + tag.formatAvailPrice(tag.pminfilt, 0) + " to " + tag.formatAvailPrice(tag.pmaxfilt, 0)
124          for (ind in ap) {
125            if (ap[ind].prices.length > 0) {
126              var priceRange = tag.getPriceRange(ap[ind]);
127              if ((!tag.pminfilt || tag.pminfilt <= priceRange[1]) && (!tag.pmaxfilt || tag.pmaxfilt >= priceRange[0])) {
128                eids.push(ap[ind].eid)
129              }
130            }
131          }
132          if (eids.length) {
133            filterval = tag.instance.getTag() + "item_id:(" + eids.join(" OR ") + ")"
134          }
135          else {
136
137            filterval = tag.instance.getTag() + "item_id:(0)"
138          }
139
140          tag.opts.manager.store.removeByValue('fq', tag.instance.lookupRegex)
141          tag.opts.manager.store.add('fq', new AjaxSolr.Parameter({
142            name: 'fq',
143            value: filterval,
144            value_label: label,
145            private: true,
146          }))
147          tag.instance.doRequest()
148        }
149      }
150      tag.resetFilter = function () {
151        return $.Deferred(function () {
152          var p = this
153          tag.getSlider().done(function (slider) {
154
155            tag.slider = null
156            if (slider != null) {
157              slider.noUiSlider.destroy()
158            }
159            p.resolve()
160          })
161        })
162      }
163      tag.updateRangeSlider = function () {
164        tag.getSlider().done(function () {
165          tag.update()
166        })
167      }
168
169      tag.opts.manager.observable.on('RiotSolrAddWidgets', function (manager) {
170        manager.addWidget(tag.instance);
171      });
172    })(jQuery, this);
173});

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.