PageSourceSearch

https://www.jhrl.com/sites/all/modules/bluetent/riot_solr/tags/rio…/build/riot_solr_alternates.js?tlse4v

js jhrl.com collected 2026-10-06 13:19:05 UTC 7,208 bytes, 142 lines download raw bytes

1riot.tag2('riot-solr-alternates', '<h4 if="{opts.txt.title}">{opts.txt.title}</h4> <div if="{opts.txt.body}" class="riot-solr-alternates-body"> {opts.txt.body} </div> <div class="{pending: pending}"> <div each="{i, alt in alternates}" class="alternates-section"> <h6>{alt.label}</h6> <ul> <li each="{a in alt.items}"> <a onclick="{removeFacet}" href="#"> Remove {a.label} to add back {a.count} results. <i><?xml version="1.0" encoding="utf-8"?> <svg version="1.1" class="close" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewbox="0 0 27.5 27.5" style="enable-background:new 0 0 27.5 27.5;" xml:space="preserve" preserveaspectratio="xMinYMid"> <path d="M18.9,13.7l7.4-7.4c0.7-0.7,1.1-1.6,1.1-2.6c0-1-0.4-1.9-1.1-2.6C25.7,0.4,24.7,0,23.8,0c0,0,0,0,0,0c-1,0-1.9,0.4-2.6,1.1 l-7.4,7.4L6.3,1.1C5.6,0.4,4.7,0,3.7,0c0,0,0,0,0,0c-1,0-1.9,0.4-2.6,1.1C0.4,1.8,0,2.7,0,3.7s0.4,1.9,1.1,2.6l7.4,7.4l-7.4,7.4 C0.4,21.9,0,22.8,0,23.8c0,1,0.4,1.9,1.1,2.6c0.7,0.7,1.6,1.1,2.6,1.1s1.9-0.4,2.6-1.1l7.4-7.4l7.4,7.4c0.7,0.7,1.6,1.1,2.6,1.1 c1,0,1.9-0.4,2.6-1.1c0.7-0.7,1.1-1.6,1.1-2.6c0-1-0.4-1.9-1.1-2.6L18.9,13.7z"></path> </svg> </i> </a> </li> </ul> </div> </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; } } riot-solr-alternates,[riot-tag="riot-solr-alternates"],[data-is="riot-solr-alternates"]{ display: block; } riot-solr-alternates,[riot-tag="riot-solr-alternates"],[data-is="riot-solr-alternates"]{ padding: 10px; width: 100%; display: block; height: auto; position: relative; } riot-solr-alternates:after,[riot-tag="riot-solr-alternates"]:after,[data-is="riot-solr-alternates"]:after{ content: \'\'; display: block; width: 0; height: 0; clear: both; } riot-solr-alternates ul,[riot-tag="riot-solr-alternates"] ul,[data-is="riot-solr-alternates"] ul{ list-style: none; margin-left: 0; } riot-solr-alternates ul:after,[riot-tag="riot-solr-alternates"] ul:after,[data-is="riot-solr-alternates"] ul:after{ content: \'\'; display: block; width: 0; height: 0; clear: both; } riot-solr-alternates li,[riot-tag="riot-solr-alternates"] li,[data-is="riot-solr-alternates"] li{ display: inline-block; width: auto; margin-right: 4px; margin-bottom: 4px; } riot-solr-alternates li:last-of-type,[riot-tag="riot-solr-alternates"] li:last-of-type,[data-is="riot-solr-alternates"] li:last-of-type,riot-solr-alternates li:last-child,[riot-tag="riot-solr-alternates"] li:last-child,[data-is="riot-solr-alternates"] li:last-child{ clear: both; font-weight: 700; } riot-solr-alternates li a,[riot-tag="riot-solr-alternates"] li a,[data-is="riot-solr-alternates"] li a{ display: inline-block; width: auto; border-radius: 3px; padding: 2px 25px 2px 5px; border: solid 1px rgba(17, 17, 17, 0.5); font-size: 15px; position: relative; } riot-solr-alternates li a i,[riot-tag="riot-solr-alternates"] li a i,[data-is="riot-solr-alternates"] li a i{ display: block; width: 10px; height: 10px; top: 0px; right: 6px; bottom: 5px; margin: auto; line-height: 1.0; position: absolute; } riot-solr-alternates li a i,[riot-tag="riot-solr-alternates"] li a i,[data-is="riot-solr-alternates"] li a i,riot-solr-alternates li a i *,[riot-tag="riot-solr-alternates"] li a i *,[data-is="riot-solr-alternates"] li a i *{ background-position: center; }', '', function(opts) {
2  (function ($, tag) {
3    tag.mixin('RiotSolrConnection')
4
5    tag.pending = true;
6
7    tag.RiotSolrManager.observable.on('RiotSolrNoResults', function(parentTag) {
8      var requests = tag.getRequests(),
9          promises = [],
10          p;
11
12      for(var r in requests) {
13        if(!requests.hasOwnProperty(r)) {
14          continue;
15        }
16
17        p = $.Deferred(function() {
18          var self = this,
19              widget = requests[r].widget,
20              label = requests[r].label,
21              value = requests[r].value,
22              facetLabel = requests[r].facetLabel,
23              field = requests[r].field;
24          tag.RiotSolrManager.executeRequest(
25              'select',
26              requests[r]['string'],
27              function(response) {
28                var data = {
29                  rawResponse: response,
30                  widget: widget,
31                  label: label,
32                  value: value,
33                  field: field,
34                  facetLabel: facetLabel
35                };
36                self.resolve(data)
37              },
38              function(err) {
39                self.reject(err)
40              }
41          );
42        });
43
44        promises.push(p)
45      }
46
47      $.when.apply($, promises).then(function() {
48        var arg;
49        tag.alternates = {};
50        for(var a = 0; a < arguments.length; a++) {
51          arg = arguments[a];
52          if(arg.rawResponse.response.docs.length > 0) {
53            if(!tag.alternates[arg.field]) {
54              tag.alternates[arg.field] = {
55                label: arg.facetLabel,
56                items: []
57              }
58            }
59            tag.alternates[arg.field]['items'].push({
60              label: arg.label.replace(/[^A-Z\d\s]/gi, '').toLowerCase(),
61              count: arg.rawResponse.response.numFound,
62              field: arg.field,
63              value: arg.value,
64              facetLabel: arg.facetLabel,
65              widget: arg.widget
66            });
67          }
68        }
69        tag.pending = false;
70        tag.update()
71      });
72    });
73
74    tag.getRequests = function() {
75      var requests = [];
76      tag.RiotSolrManager.widgets.map(function(item) {
77        var widgetVals,
78            widget = item;
79        if(typeof item.getValues !== 'function') {
80          return false;
81        }
82
83        widgetVals = item.getCurrent(false)
84
85        if(!widgetVals.length) {
86          return false;
87        }
88
89        requests = typeof widget.provideAlternates === 'function'
90            ? requests.concat(widget.provideAlternates())
91            : requests.concat(tag.provideAlternates(widget))
92
93      });
94
95      return requests;
96    };
97
98    tag.removeFacet = function(e) {
99      var item = e.item.a;
100      if(typeof item.value === 'function') {
101        item.value()
102      }
103      else {
104        item.widget.remove(item.value)
105      }
106      item.widget.doRequest()
107    };
108
109    tag.provideAlternates = function(widget) {
110      var fqVals = widget.getCurrent(false),
111          clone = $.extend({}, widget),
112          alternates = [];
113
114      fqVals.map(function(item) {
115        var values = widget.getValues(item);
116
117        values.map(function(v) {
118          clone.activeFacets.push({
119            facet: v,
120            isActive: true
121          })
122        });
123
124        values.map(function(v) {
125          clone.remove(v);
126          alternates.push({
127            widget: widget,
128            label: v,
129            facetLabel: widget.getLabel(),
130            field: widget.field,
131            value: v,
132            string: clone.manager.store.string()
133          });
134          clone.add(v);
135        });
136      });
137
138      clone = undefined;
139      return alternates;
140    }
141  })(jQuery, this);
142});

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.