1var RCAddonProvider, RCAddons = {}; 2 3(function($) { 4 5 RCAddonProvider = { 6 7 init: function() { 8 var processChildrenFunc, self = this; 9 10 if(typeof this.processChildren === 'undefined') { 11 this.mixin('RiotTagsChildren') 12 } 13 14 processChildrenFunc = this.processChildren 15 16 this.processChildren = function() { 17 var addons; 18 processChildrenFunc.call(this) 19 addons = this.getChildByPlugin('JHRPackagesModal') 20 if(addons) { 21 addons.mounted = true 22 } 23 } 24 25 this.getAddons = function(begin, end, eid) { 26 var cacheKey = btoa(begin), 27 promise = $.Deferred(); 28 29 30 if(RCAddons[cacheKey]) { 31 promise.resolve(RCAddons[cacheKey]) 32 } 33 else { 34 $.ajax('/jhr-packages/ajax/packages?begin=' + begin + '&end=' + end + '&eid=' + eid ) 35 .done(function(resp) { 36 RCAddons[cacheKey] = resp.data 37 promise.resolve(resp.data) 38 }) 39 .fail(function(err) { 40 promise.reject(err) 41 }); 42 } 43 44 return promise; 45 } 46 47 this.buyNowDirectly = function(price) { 48 49 } 50 51 this.one('update', function() { 52 this.buyNow = function(price) { 53 var addonsModal, 54 addonModalOpts, 55 callin_packages = [], 56 online_packages = [], 57 call_to_book = [], 58 addonsModal = self.getChildByPlugin('JHRPackagesModal'); 59 self.getAddons(price.qp.rcav.begin, price.qp.rcav.end, price.qp.eid).done(function(addons) { 60 addons.map(function(special) { 61 if (special.field_is_package) { 62 if (special.field_special_processing === 'call') { 63 callin_packages.push(special); 64 } 65 else { 66 online_packages.push(special); 67 } 68 } 69 else { 70 if (special.field_call_to_book_number && special.field_special_processing === 'call') { 71 call_to_book.push(special); 72 } 73 } 74 }); 75 76 77 addonModalOpts = { 78 price: price, 79 callin_packages: callin_packages, 80 online_packages: online_packages, 81 call_to_book: call_to_book 82 }; 83 console.log(callin_packages); 84 console.log(online_packages); 85 console.log(call_to_book); 86 if (online_packages.length >= 1) { 87 RiotTagsModal.mount( 88 'jhr-packages-modal', 89 Object.assign(addonModalOpts, addonsModal['options']), 90 null, 91 { 92 'class': 'jhr-packages-modal' 93 } 94 ); 95 } 96 else { 97 console.log('window location'); 98 window.location.href = '/rescms/item/' + price.qp.eid + '/buy?' + $.param(price.qp); 99 } 100 }) 101 } 102 }); 103 } 104 }; 105 106 riot.mixin('RCAddonProvider', RCAddonProvider) 107})(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.