1riot.tag2('rc-riot-avail-filter', '<form id="{ids.form}" class="{\'rc-riot-avail-filter-form\': true}" onsubmit="{availFilterApply}"> <div class="input-wrap begin"> <label for="{ids.begin}" class="audible">{opts.txt.begin}</label> <input type="text" size="10" name="begin" class="begin" id="{ids.begin}" value="{search.rcav.begin}" placeholder="{opts.txt.begin}" readonly="readonly"> </div> <div class="input-wrap end"> <label for="{ids.end}" class="audible">{opts.txt.end}</label> <input type="text" size="10" name="end" class="end" id="{ids.end}" value="{search.rcav.end}" placeholder="{opts.txt.end}" readonly="readonly"> </div> <div each="{_if(flexAmt && opts.flex_expose===\'select\' )}" class="input-wrap flex flex-select"> <label for="{parent.ids.flex}" class="audible">{parent.opts.txt.flex}</label> <select name="flex" id="{parent.ids.flex}" onchange="{inputChanged}"> <option value="" __selected="{!parent.search.rcav.flex}">{parent.opts.txt.flex}</option> <option each="{ind, fo in parent.flexOpts}" value="{ind}" __selected="{ind==parent.parent.search.rcav.flex}">{ind > 1 ? fo = \'Flexible Arrival \' + ind + \' Days\' : fo = \'Flexible Arrival 1 Day\'}</option> </select> </div> <div each="{_if(flexAmt && opts.flex_expose === \'checkbox\')}" class="input-wrap flex flex-checkbox"> <input onchange="{parent.inputChanged}" type="checkbox" name="flex" class="flex" id="{parent.ids.flex}" value="{parent.flexAmt}" __checked="{parent.search.rcav.flex > 0}"> <label for="{parent.ids.flex}">{parent.opts.txt.flex}</label> </div> <div if="{opts.travs && opts.txt.adult}" class="input-wrap adult"> <label for="{ids.adult}" class="audible">{opts.txt.adult}</label> <select name="adult" id="{ids.adult}" onchange="{inputChanged}"> <option if="{opts.travelers_required}" value="" __selected="{\'\' == search.rcav.adult}"> Select Adults</option> <option each="{ind, ao in adultOpts}" value="{ind}" __selected="{ind == parent.search.rcav.adult}">{ao}</option> </select> </div> <div if="{opts.travs && opts.txt.child}" class="input-wrap child"> <label for="{ids.child}" class="audible">{opts.txt.child}</label> <select name="child" id="{ids.child}" onchange="{inputChanged}"> <option if="{opts.travelers_required}" value="" __selected="{\'\' == search.rcav.child}"> Select Children</option> <option each="{ind, co in childOpts}" value="{ind}" __selected="{ind == parent.search.rcav.child}">{co}</option> </select> </div> <div each="{_if(opts.txt.coupon)}" class="input-wrap coupon"> <label for="{parent.ids.coupon}" class="audible">{parent.opts.txt.coupon}</label> <input type="text" size="10" name="coupon" id="{parent.ids.coupon}" value="{parent.search.rcav.coupon}" placeholder="{parent.opts.txt.coupon}" onchange="{parent.inputChanged}"> </div> <input each="{_if(!opts.txt.coupon && opts.coupon)}" id="{parent.ids.coupon}" type="hidden" name="coupon" value="{parent.opts.coupon}"> <div each="{_if(opts.txt.search)}" class="submit-wrap"> <input type="submit" name="search-button" value="{parent.opts.txt.search}"> </div> </form> <div class="call-to-book-no-calendar" if="{!has_pricing && shouldHideCalendar()}"> <div class="display-name call-to-book"> {pricing_child.options.txt.call_to_book_text} <a href="tel:{pricing_child.options.txt.call_to_book_number}"> {pricing_child.options.txt.call_to_book_number} </a> </div> </div> <subtag each="{_if(has_pricing)}" tag="{parent.pricing_child.tag}" options="{Object.assign({}, parent.pricing_child.options, { \'eid\': parent.pricing.eid, \'has_call_to_book\': parent.opts.has_call_to_book })}"> </subtag>', '@-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-avail-filter,[riot-tag="rc-riot-avail-filter"],[data-is="rc-riot-avail-filter"]{ display: block; } rc-riot-avail-filter,[riot-tag="rc-riot-avail-filter"],[data-is="rc-riot-avail-filter"]{ width: 100%; height: auto; display: block; padding-top: 15px; } rc-riot-avail-filter:after,[riot-tag="rc-riot-avail-filter"]:after,[data-is="rc-riot-avail-filter"]:after{ content: \'\'; display: block; width: 0; height: 0; clear: both; } rc-riot-avail-filter.hide-calendar > form,[riot-tag="rc-riot-avail-filter"].hide-calendar > form,[data-is="rc-riot-avail-filter"].hide-calendar > form{ display: none; } rc-riot-avail-filter .audible,[riot-tag="rc-riot-avail-filter"] .audible,[data-is="rc-riot-avail-filter"] .audible{ position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; } rc-riot-avail-filter form:after,[riot-tag="rc-riot-avail-filter"] form:after,[data-is="rc-riot-avail-filter"] form:after{ content: \'\'; display: block; width: 0; height: 0; clear: both; } rc-riot-avail-filter .ui-datepicker-trigger,[riot-tag="rc-riot-avail-filter"] .ui-datepicker-trigger,[data-is="rc-riot-avail-filter"] .ui-datepicker-trigger{ display: none; } rc-riot-avail-filter .input-wrap,[riot-tag="rc-riot-avail-filter"] .input-wrap,[data-is="rc-riot-avail-filter"] .input-wrap{ width: 50%; float: left; padding-left: 15px; padding-right: 15px; position: relative; padding: 0 8px 15px; } rc-riot-avail-filter .input-wrap:nth-of-type(2n),[riot-tag="rc-riot-avail-filter"] .input-wrap:nth-of-type(2n),[data-is="rc-riot-avail-filter"] .input-wrap:nth-of-type(2n){ padding-right: 0; } rc-riot-avail-filter .input-wrap:nth-of-type(2n+1),[riot-tag="rc-riot-avail-filter"] .input-wrap:nth-of-type(2n+1),[data-is="rc-riot-avail-filter"] .input-wrap:nth-of-type(2n+1){ padding-left: 0; } rc-riot-avail-filter .input-wrap.coupon,[riot-tag="rc-riot-avail-filter"] .input-wrap.coupon,[data-is="rc-riot-avail-filter"] .input-wrap.coupon{ width: 100%; float: left; padding-left: 15px; padding-right: 15px; position: relative; padding-left: 0; padding-right: 0; } @media only screen and (min-width: 48em) { .front rc-riot-avail-filter,.front [riot-tag="rc-riot-avail-filter"],.front [data-is="rc-riot-avail-filter"]{ width: 66.66667%; float: left; padding-left: 15px; padding-right: 15px; position: relative; padding-left: 0; padding-right: 0; padding-top: 0; } .front rc-riot-avail-filter .input-wrap,.front [riot-tag="rc-riot-avail-filter"] .input-wrap,.front [data-is="rc-riot-avail-filter"] .input-wrap{ width: 50%; float: left; padding-left: 15px; padding-right: 15px; position: relative; padding-left: 0; padding-bottom: 0; } .front rc-riot-avail-filter .input-wrap input,.front [riot-tag="rc-riot-avail-filter"] .input-wrap input,.front [data-is="rc-riot-avail-filter"] .input-wrap input,.front rc-riot-avail-filter .input-wrap select,.front [riot-tag="rc-riot-avail-filter"] .input-wrap select,.front [data-is="rc-riot-avail-filter"] .input-wrap select{ margin-bottom: 0; } } @media only screen and (min-width: 48em) { .front rc-riot-avail-filter.has-travelers,.front [riot-tag="rc-riot-avail-filter"].has-travelers,.front [data-is="rc-riot-avail-filter"].has-travelers{ width: 80%; float: left; padding-left: 15px; padding-right: 15px; position: relative; padding-left: 0; padding-right: 0; padding-top: 0; } .front rc-riot-avail-filter.has-travelers .input-wrap,.front [riot-tag="rc-riot-avail-filter"].has-travelers .input-wrap,.front [data-is="rc-riot-avail-filter"].has-travelers .input-wrap{ width: 25%; float: left; padding-left: 15px; padding-right: 15px; position: relative; padding-left: 0; padding-bottom: 0; } .front rc-riot-avail-filter.has-travelers .input-wrap input,.front [riot-tag="rc-riot-avail-filter"].has-travelers .input-wrap input,.front [data-is="rc-riot-avail-filter"].has-travelers .input-wrap input,.front rc-riot-avail-filter.has-travelers .input-wrap select,.front [riot-tag="rc-riot-avail-filter"].has-travelers .input-wrap select,.front [data-is="rc-riot-avail-filter"].has-travelers .input-wrap select{ margin-bottom: 0; } } rc-riot-avail-filter .submit-wrap,[riot-tag="rc-riot-avail-filter"] .submit-wrap,[data-is="rc-riot-avail-filter"] .submit-wrap{ width: 100%; float: left; padding-left: 15px; padding-right: 15px; position: relative; padding-left: 0; padding-right: 0; } rc-riot-avail-filter > rc-riot-avail-pricing,[riot-tag="rc-riot-avail-filter"] > rc-riot-avail-pricing,[data-is="rc-riot-avail-filter"] > rc-riot-avail-pricing,rc-riot-avail-filter > [riot-tag="rc-riot-avail-pricing"],[riot-tag="rc-riot-avail-filter"] > [riot-tag="rc-riot-avail-pricing"],[data-is="rc-riot-avail-filter"] > [riot-tag="rc-riot-avail-pricing"],rc-riot-avail-filter > [data-is="rc-riot-avail-pricing"],[riot-tag="rc-riot-avail-filter"] > [data-is="rc-riot-avail-pricing"],[data-is="rc-riot-avail-filter"] > [data-is="rc-riot-avail-pricing"]{ text-align: center; } rc-riot-avail-filter > rc-riot-avail-pricing .price,[riot-tag="rc-riot-avail-filter"] > rc-riot-avail-pricing .price,[data-is="rc-riot-avail-filter"] > rc-riot-avail-pricing .price,rc-riot-avail-filter > [riot-tag="rc-riot-avail-pricing"] .price,[riot-tag="rc-riot-avail-filter"] > [riot-tag="rc-riot-avail-pricing"] .price,[data-is="rc-riot-avail-filter"] > [riot-tag="rc-riot-avail-pricing"] .price,rc-riot-avail-filter > [data-is="rc-riot-avail-pricing"] .price,[riot-tag="rc-riot-avail-filter"] > [data-is="rc-riot-avail-pricing"] .price,[data-is="rc-riot-avail-filter"] > [data-is="rc-riot-avail-pricing"] .price{ color: #ff1e00; font-size: 1.5em; } .node-listing.view-mode-full rc-riot-avail-filter input[type="submit"],.node-listing.view-mode-full [riot-tag="rc-riot-avail-filter"] input[type="submit"],.node-listing.view-mode-full [data-is="rc-riot-avail-filter"] input[type="submit"]{ background-color: #111; border-radius: 3px; color: #fff; display: block; text-align: center; border: none; transition-property: background-color, color; transition-timing-function: ease-in-out; transition-duration: .15s; letter-spacing: .03em; font-family: "Helvetica", Helvetica, "Arial", Arial, sans-serif; line-height: 1.3 !important; padding: 10px 12px; font-size: 15px; min-height: 38px; width: 100%; } .node-listing.view-mode-full rc-riot-avail-filter input[type="submit"]:hover,.node-listing.view-mode-full [riot-tag="rc-riot-avail-filter"] input[type="submit"]:hover,.node-listing.view-mode-full [data-is="rc-riot-avail-filter"] input[type="submit"]:hover,.node-listing.view-mode-full rc-riot-avail-filter input[type="submit"]:active,.node-listing.view-mode-full [riot-tag="rc-riot-avail-filter"] input[type="submit"]:active,.node-listing.view-mode-full [data-is="rc-riot-avail-filter"] input[type="submit"]:active{ background-color: black; } rc-riot-avail-filter .call-to-book-no-calendar .call-to-book,[riot-tag="rc-riot-avail-filter"] .call-to-book-no-calendar .call-to-book,[data-is="rc-riot-avail-filter"] .call-to-book-no-calendar .call-to-book{ font-weight: bold; text-align: center; }', 'class="{\'has-slider\': slider, \'has-travelers\': opts.travs, \'has-flex\': flexAmt && (opts.flex_expose === \'checkbox\' || opts.flex_expose === \'select\'), \'flex-select\': flexAmt && opts.flex_expose === \'select\', \'hide-calendar\': shouldHideCalendar(
1)}"', function(opts) { 2 this.mixin('RCRiotAvailPricing'); 3 this.mixin('RiotNotify'); 4 this.mixin('RiotTagsChildren'); 5 this.mixin('RiotSolrConnection'); 6 this.mixin('RCRiotValidation'); 7 (function ($, tag) { 8 tag.hash_parsed = false 9 tag.is_searching = false 10 tag.store_search = false 11 tag.link_search = typeof opts.link_search != 'undefined' ? opts.link_search : false; 12 tag.should_show_book_now = true; 13 tag.flexAmt = parseInt(opts.flex); 14 tag.getDefaultSearch = function () { 15 var ds = { 16 rcav: { 17 begin: '', 18 end: '', 19 adult: opts.travelers_required ? '' : 1, 20 child: opts.travelers_required ? '' : 0 21 } 22 } 23 if (opts.travelers_required){ 24 ds.rcav.adult = 0; 25 } 26 if (typeof opts.coupon != 'undefined' && opts.coupon.length > 0) { 27 ds.rcav.coupon = opts.coupon 28 } 29 if (typeof opts.search_extend != 'undefined') { 30 $.extend(ds, opts.search_extend) 31 } 32 return ds 33 } 34 tag.search = opts.search || tag.getDefaultSearch() 35 tag.ids = { 36 form: 'riot-' + tag._riot_id + '-form', 37 begin: 'riot-' + tag._riot_id + '-begin', 38 end: 'riot-' + tag._riot_id + '-end', 39 adult: 'riot-' + tag._riot_id + '-adult', 40 child: 'riot-' + tag._riot_id + '-child', 41 coupon: 'riot-' + tag._riot_id + '-coupon' 42 } 43 44 if(tag.flexAmt) { 45 tag.ids['flex'] = 'riot-' + tag._riot_id + '-flex'; 46 if(tag.opts.flex_expose === 'select') { 47 tag.flexOpts = {}; 48 tag.flexTypeLabel = tag.flex_type === 'w' ? 'Weeks' : 'Days'; 49 for (var f = 1; f <= tag.flexAmt; f++) { 50 tag.flexOpts[f] = f + ' ' + tag.flexTypeLabel 51 } 52 } 53 } 54 55 tag.adultOpts = {}; 56 tag.childOpts = {}; 57 58 for (var i = 1;
58 i <= tag.opts.form_settings.adult_max_ct; i++) { 59 tag.adultOpts[i] = opts.txt.adult + ": " + i; 60 } 61 for (var i = 0; i <= tag.opts.form_settings.child_max_ct; i++) { 62 tag.childOpts[i] = opts.txt.child + ": " + i; 63 } 64 65 if (typeof Drupal.settings.rcItemAvailForm == 'undefined') { 66 Drupal.settings.rcItemAvailForm = []; 67 } 68 69 var avfopts = {} 70 71 for (avf in Drupal.settings.rcItemAvailForm) { 72 if (typeof opts.eid != 'undefined' && opts.eid) { 73 if (Drupal.settings.rcItemAvailForm[avf].eid == parseInt(opts.eid)) { 74 avfopts = Drupal.settings.rcItemAvailForm[avf]; 75 } 76 } 77 else if (typeof opts.txt.id != 'undefined' && opts.txt.id) { 78 if (opts.txt.id == Drupal.settings.rcItemAvailForm[avf].id) { 79 avfopts = Drupal.settings.rcItemAvailForm[avf]; 80 } 81 } 82 else if ((typeof Drupal.settings.rcItemAvailForm[avf].eid == 'undefined' || !Drupal.settings.rcItemAvailForm[avf].eid) && 83 (typeof Drupal.settings.rcItemAvailForm[avf].id == 'undefined' || !Drupal.settings.rcItemAvailForm[avf].id)) { 84 avfopts = Drupal.settings.rcItemAvailForm[avf]; 85 } 86 } 87 88 Drupal.settings.rcItemAvailForm.push(Object.assign({}, avfopts, { 89 id: tag.ids.form, 90 beg: tag.ids.begin, 91 end: tag.ids.end, 92 emb: false, 93 ajx: null, 94 })); 95 96 tag.one('update', function () { 97 tag.parseHash() 98 }) 99 100 tag.inputDateFieldsChanged = function (e) { 101 $(this).trigger('InputDateFieldsChanged', { 102 tag: tag, 103 element: this 104 }) 105 } 106 107 tag.on('updated', function () { 108 Drupal.attachBehaviors(tag.root) 109 $('input.begin, input.end, select[name="flex"]', tag.root).once('inputDateFieldsChanged').on('change', tag.inputDateFieldsChanged); 110 $('input.begin, input.end', tag.root).datepicker().on('change', tag.inputChanged) 111 if(!tag.opts.hide_button_on_search_change) { 112 return; 113 } 114 $('input.begin, input.end', tag.root).datepicker().on('change', tag.hideBookNowButton); 115 }) 116 117 if (typeof tag.RiotSolrManager != 'undefined') { 118 tag.RiotSolrManager.observable.on('RiotSolrBoot', function () { 119 if (tag[tag.ids.begin].value != '' && tag[tag.ids.end].value != '') { 120 tag.triggerSearch() 121 } 122 }) 123 tag.RiotSolrManager.observable.on('RiotSolrRequestStart', function() { 124 $('input.begin, input.end', tag.root).prop('disabled', true) 125 }) 126 tag.RiotSolrManager.observable.on('RiotSolrRequestStop', function() { 127 $('input.begin, input.end', tag.root).prop('disabled', false) 128 }) 129 } 130 else { 131 tag.on('mount', function () { 132 if (tag[tag.ids.begin].value != '' && tag[tag.ids.end].value != '') { 133 tag.triggerSearch() 134 } 135 }) 136 } 137 138 tag.triggerSearch = function (e) { 139 var p = $.Deferred() 140 if (tag[tag.ids.begin].value && tag[tag.ids.end].value) { 141 tag.availFilterApply(e).done(function (obj) { 142 p.resolve(obj) 143 }) 144 } 145 else { 146 p.reject() 147 } 148 return p 149 } 150 151 var validateTravelers = function() { 152 var qp = tag.getQueryParams(); 153 if(!opts.travelers_required) { 154 return true; 155 } 156 return (qp.rcav.adult && (qp.rcav.child !== '')) ? true : false; 157 } 158 159 var travelersAlert = function(){ 160 tag.RiotNotifySend("Please enter # of Adults and Children", { 161 className: 'error', 162 elementPosition: 'top left', 163 closeWith: ['click', 'button'], 164 timeout: false 165 }, document.getElementById(tag.ids.adult)); 166 } 167 168 tag.addValidation(validateTravelers, travelersAlert); 169 170 if(tag.RiotSolrManager){ 171 tag.RiotSolrManager.observable.on('RiotSolrFacetGroupSubmission', function(event){ 172 event.shouldSubmit = tag.validate(); 173 }); 174 } 175 176 tag.hideBookNowButton = function(e) { 177 if(!tag.opts.hide_button_on_search_change) { 178 return; 179 } 180 tag.should_show_book_now = false;
181 182 tag.update(); 183 }; 184 185 tag.availFilterApply = function (e) { 186 return $.Deferred(function () { 187 var p = this, ct = 0 188 if (tag[tag.ids.begin].value && tag[tag.ids.end].value) { 189 if(!tag.validate()) { 190 p.fail(); 191 return; 192 } 193 var qp = tag.getQueryParams() 194 if (RiotSolrAppTracker) { 195 var eventData = { 196 category: 'Search - Availability', 197 action: 'Search', 198 label: qp.rcav.begin + ' - ' + qp.rcav.end, 199 value: tag.RCRiotUtils.nightsBetween(new Date(qp.rcav.begin), new Date(qp.rcav.end)), 200 beginDate: qp.rcav.begin, 201 endDate: qp.rcav.end, 202 nightsSearched: tag.RCRiotUtils.nightsBetween(new Date(qp.rcav.begin), new Date(qp.rcav.end)), 203 }; 204 205 if (qp.rcav.coupon) { 206 eventData.coupon = qp.rcav.coupon; 207 } 208 209 if (tag.RiotSolrManager) { 210 eventData.entityInfo = tag.RiotSolrManager.bundles 211 ? tag.RiotSolrManager.entityType + ' - ' + tag.RiotSolrManager.bundles.join(', ') 212 : tag.RiotSolrManager.entityType; 213 } else { 214 eventData.entityInfo = 'rc_core_item'; 215 } 216 217 RiotSolrAppTracker.trackEvent(eventData); 218 } 219 220 tag.setSearch(qp) 221 tag.setHash() 222 if (tag.opts.action) { 223 window.location = tag.opts.action + "?" + $.param({avail: JSON.stringify(qp)}) 224 } 225 else { 226 $(tag.root).addClass('pending') 227 tag.is_searching = true 228 $('input, button, select', tag.root).prop('disabled', true) 229 tag.doSearch(qp, tag.store_search, opts.show_multi).done(function (data, qp) { 230 if (typeof tag.opts.manager != 'undefined') { 231 tag.applySolrFilter() 232 } 233 $(tag.root).removeClass('pending') 234 tag.is_searching = false 235 $('input, button, select', tag.root).prop('disabled', false) 236 tag.trigger('SearchResultsUpdated', { 237 data: data, 238 query: qp 239 }) 240 p.resolve(data, qp) 241 if (data.pricing) { 242 for (var i in data.pricing) { 243 ct++ 244 } 245 if (ct == 0) { 246 tag.RiotNotifySend(opts.eid > 0 ? opts.txt.nores_single : opts.txt.nores_multi, { 247 className: 'error', 248 elementPosition: 'top left', 249 closeWith: ['click', 'button'], 250 timeout: false 251 }, tag.root); 252 if(tag.RiotSolrManager) { 253 tag.RiotSolrManager.observable.trigger('RiotSolrNoResultsBehavior') 254 } 255 } 256 } 257 }); 258 } 259 } 260 else { 261 p.reject() 262 tag.RiotNotifySend(opts.txt.dates, { 263 className: 'error', 264 elementPosition: 'top left', 265 closeWith: ['click', 'button'], 266 timeout: false 267 }, tag.root); 268 if(tag.RiotSolrManager) { 269 tag.RiotSolrManager.observable.trigger('RiotSolrNoResultsBehavior') 270 } 271 } 272 }); 273 } 274 tag.RCRiotAvailPricing.on('PricingChanged', function (obj) { 275 tag.setSearch(obj.query) 276 tag.setHash() 277 278 if(!tag.opts.hide_button_on_search_change) { 279 return; 280 } 281 tag.should_show_book_now = true; 282 283 tag.update(); 284 }) 285 tag.on('update', function () { 286 if (typeof tag.opts.eid !== 'undefined') { 287 tag.pricing = tag.getItemPricing(tag.opts.eid) 288 tag.pricing_child = tag.getPricingChild() 289 if (typeof tag.pricing != 'undefined') { 290 tag.has_pricing = true 291 } 292 else { 293 tag.has_pricing = false 294 } 295 } 296 }) 297 tag.on('RCRiotAvailFilterAfterRequest', function () { 298 if (typeof tag.RiotSolrManager != 'undefined') { 299 if (!tag.RiotSolrManager.store.find('fq', new RegExp('{!tag=RCRiotAvailFilter.*}item_id:*')) 300 && !tag.RiotSolrManager.store.find('rcav', new RegExp('.*')) 301 && !tag.is_searching) { 302 tag.resetSearch() 303 } 304 } 305 }) 306 307 tag.one('RCRiotAvailFilterAfterRequest', function () { 308 309 if (tag[tag.ids.begin].value != '' && tag[tag.ids.end].value != '') { 310 tag.triggerSearch(); 311 } 312 }) 313 314 tag.parseHash = function () { 315 var qd = {}, qp 316 location.hash.substr(1).split("&").forEach(function (item) { 317 var k = item.split("=")[0], v = decodeURIComponent(item.split("=")[1]); 318 (k in qd) ? qd[k].push(v) : qd[k] = [v] 319 }) 320 if (typeof qd.rcav != 'undefined') { 321 qp = JSON.parse(qd.rcav) 322 tag.setSearch(qp) 323 } 324 tag.hash_parsed = true 325 } 326 tag.applySolrFilter = function () { 327 var ap = tag.getAvailPricing(), eids = [], filterval, asc = [], desc = [], price = null; 328 for (ind in ap) { 329 eids.push(ap[ind].eid) 330 price = Math.round(ap[ind].prices[0]['p']); 331 asc.push(ap[ind].eid + '^=' + price * -1); 332 desc.push(ap[ind].eid + '^=' + price); 333 } 334 if (!tag.opts.skip_solr) { 335 if (typeof tag.RiotSolrManager.addBoost != 'undefined') { 336 tag.RiotSolrManager.addBoost('price_asc', 'item_id', asc); 337 tag.RiotSolrManager.addBoost('price_desc', 'item_id', desc); 338 } 339 340 filterval = "{!tag=RCRiotAvailFilter,RiotSolrWidget,RCRiotPrices}item_id:" + ( eids.length ? "(" + eids.join(" OR ") + ")" : 0 ); 341 tag.RiotSolrManager.store.removeByValue('fq', new RegExp('{!tag=.*RCRiotPrices.*}item_id:*')) 342 tag.RiotSolrManager.store.add('fq', new AjaxSolr.Parameter({ 343 name: 'fq', 344 value: filterval, 345 private: true, 346 })) 347 tag.instance.doRequest() 348 } 349 else { 350 tag.setHash() 351 } 352 } 353 tag.setSearch = function (qp) { 354 tag.search = qp
355 tag.update() 356 } 357 tag.resetSearch = function () { 358 tag.setAvailPricing({}, tag.getDefaultSearch()) 359 if (typeof tag.RiotSolrManager != 'undefined') { 360 tag.RiotSolrManager.store.remove('rcav') 361 } 362 tag.setSearch(tag.getDefaultSearch()) 363 $('input.begin, input.end').datepicker("setDate", null) 364 } 365 366 var procc = tag.processChildren 367 tag.processChildren = function () { 368 procc.apply(this) 369 var pc = tag.getPricingChild() 370 if (pc != null) { 371 pc.mounted = true 372 } 373 } 374 tag.getPricingChild = function () { 375 for (var c in tag.children) { 376 if (tag.children[c].plugin == "RCRiotAvailPricing") { 377 return tag.children[c] 378 } 379 } 380 return null 381 } 382 tag.inputChanged = function (e) { 383 tag.search.rcav[e.target.name] = $(e.target).val() 384 if (typeof tag.RiotSolrManager != 'undefined') { 385 tag.setHash() 386 } 387 return true 388 } 389 tag.setHash = function () { 390 if (typeof tag.RiotSolrManager != 'undefined') { 391 if (tag[tag.ids.begin].value && tag[tag.ids.end].value) { 392 tag.RiotSolrManager.store.add('rcav', new AjaxSolr.Parameter({ 393 name: 'rcav', 394 value: JSON.stringify(tag.getQueryParams()), 395 value_label: tag[tag.ids.begin].value + " - " + tag[tag.ids.end].value 396 })) 397 tag.RiotSolrManager.store.save() 398 } 399 } 400 else { 401 window.location.hash = '#' + $.param({rcav: JSON.stringify(tag.getQueryParams())}) 402 } 403 } 404 tag.getQueryParams = function () { 405 var qp = tag.getDefaultSearch() 406 qp.rcav.begin = tag[tag.ids.begin].value 407 qp.rcav.end = tag[tag.ids.end].value 408 if(opts.travs && opts.txt.adult) { 409 qp.rcav.adult = tag[tag.ids.adult].value 410 } 411 if(opts.travs && opts.txt.child) { 412 qp.rcav.child = tag[tag.ids.child].value 413 } 414 if (typeof tag.opts.eid !== 'undefined') { 415 qp.rcav.eid = tag.opts.eid 416 } 417 if (tag.opts.txt.coupon || tag.opts.coupon) { 418 qp.rcav.coupon = tag[tag.ids.coupon].value 419 } 420 if(tag.flexAmt) { 421 if(opts.flex_expose === 'checkbox') { 422 if(tag[tag.ids.flex].checked) { 423 qp.rcav.flex = tag[tag.ids.flex].value 424 } 425 } else if(opts.flex_expose === 'select') { 426 qp.rcav.flex = $(tag[tag.ids.flex]).val() 427 } else { 428 qp.rcav.flex = tag.flexAmt 429 } 430 qp.rcav.flex_type = tag.opts.flex_type 431 } 432 if (tag.opts.cats) { 433 for (cid in tag.opts.cats) { 434 for (cval in tag.opts.cats[cid]) { 435 if (!qp.ldrcCategoryValues) { 436 qp.ldrcCategoryValues = {}; 437 } 438 if (!qp.ldrcCategoryValues[cid]) { 439 qp.ldrcCategoryValues[cid] = {}; 440 } 441 qp.ldrcCategoryValues[cid][cval] = cval; 442 } 443 } 444 } 445 return qp 446 } 447 448 tag.shouldHideCalendar = function () { 449 return tag.opts.show_calendar !== undefined && !tag.opts.show_calendar; 450 }; 451 452 if (typeof tag.RiotSolrManager != 'undefined') { 453 tag.instance = new AjaxSolr.RCRiotAvailFilter({ 454 id: 'RCRiotAvailFilter', 455 observable: tag 456 }); 457 tag.RiotSolrManager.addWidget(tag.instance); 458 } 459 })(jQuery, this); 460});
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.