1riot.tag2('bt-leads-share-url', '<div class="tag-content"> <a class="{disabled: disabled}" onclick="{triggerClicked}"> {opts.txt.trigger} </a> </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; } } bt-leads-share-url,[riot-tag="bt-leads-share-url"],[data-is="bt-leads-share-url"]{ display: block; } bt-leads-share-url a.disabled,[riot-tag="bt-leads-share-url"] a.disabled,[data-is="bt-leads-share-url"] a.disabled{ opacity: 0.5; }', '', function(opts) { 2 this.mixin('RiotSolrConnection'); 3 this.disabled = true; 4 this.pending = false; 5 this.resultCount = 0; 6 this.responses = []; 7 (function ($, tag) { 8 9 tag.handler = function (obs, data) { 10 if(data) { 11 tag.responses.push({ 12 entityType: obs.RiotSolrManager.entityType, 13 response: data 14 }) 15 } 16 if (tag.disabled) { 17 tag.disabled = !tag.isReady(); 18 tag.update() 19 } 20 }; 21 22 tag.isReady = function () { 23 var ret = true; 24 if(!tag.RiotSolrManager) { 25 RiotSolrManagers.forEach(function (item) { 26 if (parseInt(item.observable.opts.solr.max_rows) !== 0 && !item.firstRequest) { 27 ret = false;
28 } 29 }); 30 } 31 else { 32 ret = parseInt(tag.opts.solr.max_rows) === 0 || tag.RiotSolrManager.firstRequest 33 } 34 return ret; 35 }; 36 37 if (parseInt(opts.sharecount) > 0) { 38 tag.solrItems = {}; 39 40 if(typeof tag.RiotSolrManager !== 'undefined' && parseInt(tag.opts.solr.max_rows) === 0) { 41 tag.handler(tag, false); 42 } 43 else if (typeof tag.RiotSolrManager !== 'undefined') { 44 tag.RiotSolrManager.observable.on('RiotSolrUpdate', function (data) { 45 tag.handler(tag, data) 46 }); 47 } 48 else { 49 RiotTagsDispatch.on('RiotSolrUpdate', function (obs, data) { 50 tag.handler(obs, data); 51 }) 52 } 53 } 54 55 RiotTagsDispatch.on('RCRiotPricingChanged', function(availFilterTag, pricingData) { 56 var entityType = 'rc_core_item'; 57 if(typeof tag.solrItems[entityType] === 'undefined' || !tag.solrItems[entityType].count) { 58 return false; 59 } 60 61 RiotTagsDispatch.trigger('BTLeadsShareItems', tag, tag.solrItems[entityType], entityType); 62 }); 63 64 tag.setItems = function (items, entityType) { 65 var ct = 0, ind; 66 67 if(!items.length || !items[0].item_id) { 68 return false; 69 } 70 71 tag.solrItems[entityType] = { 72 count: items.length, 73 items: [] 74 }; 75 76 for (ind in items) { 77 tag.solrItems[entityType].items.push(items[ind]); 78 ct++; 79 if (ct >= opts.sharecount) { 80 break 81 } 82 } 83 84 RiotTagsDispatch.trigger('BTLeadsShareItems', tag, tag.solrItems[entityType], entityType); 85 }; 86 87 tag.triggerClicked = function (e) { 88 89 var promises = []; 90 91 if(tag.disabled) { 92 return false; 93 } 94 95 $(e.target).addClass('pending').prop('disabled', true) 96 if(!tag.responses.length && tag.opts.eid) { 97 promises.push(tag.RiotSolrManager.getDocumentsByKeys([tag.opts.eid]).done(function(docs) { 98 tag.setItems(docs, tag.RiotSolrManager.entityType) 99 })); 100 } 101 else { 102 tag.responses = tag.responses.slice(-1); 103 const topLevelResponse = tag.responses[0].response; 104 let docs = null; 105 106 if(typeof topLevelResponse.response.docs !== 'undefined') { 107 docs = topLevelResponse.response.docs.slice(0, 6); 108 tag.resultCount = tag.responses[0].response.response.response.numFound; 109 tag.responses[0].response.response.docs = docs; 110 } 111 else { 112 docs = topLevelResponse.response.response.docs.slice(0, 6); 113 tag.resultCount = tag.responses[0].response.response.response.response.numFound; 114 tag.responses[0].response.response.response.docs = docs; 115 } 116 tag.setItems(docs, tag.responses[0].entityType); 117 } 118 119 $.when.apply($, promises).done(function() { 120 $.post('/btleads/shareurl', { 121 url: opts.shareurl, 122 variant: opts.variant, 123 resultCount: tag.resultCount, 124 documents: JSON.stringify(tag.solrItems), 125 title: opts.sharetitle 126 }, null, 'json').done(function (data) { 127 var content = data.form 128 if (opts.txt.sharedesc.length) { 129 content = '<p>' + opts.txt.sharedesc + '</p>' + content 130 } 131 if (opts.txt.sharehead.length) { 132 content = '<h3>' + opts.txt.sharehead + '</h3>' + content 133 } 134 var modal = RiotTagsModal.show($(content)) 135 Drupal.settings.ajax = Drupal.settings.ajax || {} 136 Drupal.settings.ajax[data.submitid] = new Drupal.ajax(data.submitid, $('.form-submit', modal), { 137 url: '/system/ajax', 138 callback: 'bt_leads_share_url_form_submit_ajax' 139 }); 140 Drupal.attachBehaviors(modal) 141 if(!window.grecaptcha) { 142 if (typeof btLeadsRecaptchaLoader === 'function') btLeadsRecaptchaLoader(modal, true); 143 } 144 else { 145 if (typeof btLeadsRecaptchaCallback === 'function') btLeadsRecaptchaCallback(modal); 146 } 147 }) 148 }).always(function () { 149 $(e.target).removeClass('pending').prop('disabled', false) 150 }); 151 } 152 })(jQuery, this) 153});
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.