PageSourceSearch

https://www.jhrl.com/sites/all/modules/rescms/rc_riot/js/mixins/RCRiotAvailPricingTokenizer.js?tlse4v

js jhrl.com collected 2026-10-06 13:19:13 UTC 1,903 bytes, 58 lines download raw bytes

1/**
2 * RCRiotAvailPricingTokenizer RiotJS Mixin
3 */
4(function($) {
5  var RCRiotAvailPricingTokenizer = {
6    /**
7     * Replace tokens in text with some values from our pricing info.
8     */
9    tokenize: function(text) {
10      return text
11        .replace(
12          '@alternate_price_count',
13          this.nonFeaturedOfferGroups().reduce(function(carry, group) {
14            return carry + group.offers.length;
15          }, 0) || 99999
16        )
17        .replace(
18          '@alternate_price_high',
19          this.RCRiotUtils.formatCurrency(this.getHighAlternatePrice() || 99999, 'USD', this.precision)
20        )
21        .replace(
22          '@alternate_price_low',
23          this.RCRiotUtils.formatCurrency(this.getLowAlternatePrice() || 99999, 'USD', this.precision)
24        );
25    },
26
27    /**
28     * Get the lowest non-featured price.
29     *
30     * @return {number}
31     */
32    getLowAlternatePrice: function() {
33      return this.nonFeaturedOfferGroups().reduce(function(groupCarry, group) {
34        var lowGroupPrice = group.offers.reduce(function(priceCarry, price) {
35          return priceCarry !== null && priceCarry < price.p ? priceCarry : price.p;
36        }, null);
37
38        return groupCarry !== null && groupCarry < lowGroupPrice ? groupCarry : lowGroupPrice;
39      }, null);
40    },
41
42    /**
43     * Get the highest non-featured price.
44     *
45     * @return {number}
46     */
47    getHighAlternatePrice: function() {
48      return this.nonFeaturedOfferGroups().reduce(function(groupCarry, group) {
49        var highGroupPrice = group.offers.reduce(function(priceCarry, price) {
50          return priceCarry !== null && priceCarry > price.p ? priceCarry : price.p;
51        }, null);
52
53        return groupCarry !== null && groupCarry > highGroupPrice ? groupCarry : highGroupPrice;
54      }, null);
55    },
56  };
57  riot.mixin('RCRiotAvailPricingTokenizer', RCRiotAvailPricingTokenizer);
58})(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.