1BX.addCustomEvent( 2 'onCounterGoals', 3 function (eventdata) { 4 try { 5 if ( 6 eventdata.goal && 7 eventdata.params && 8 eventdata.params.id && 9 ( 10 eventdata.goal === 'goal_wish_add' || 11 eventdata.goal === 'goal_wish_remove' 12 ) 13 ) { 14 requestFavorit(); 15 } 16 } 17 catch (e) { 18 console.error(e); 19 } 20 } 21); 22 23document.addEventListener('click', function(e){ 24 const label = e.target.closest('.js_clear_favorits'); 25 26 if (label) { 27 const action = JItemActionFavorite.prototype.action.toUpperCase(); 28 29 if ( 30 typeofExt(arAsproCounters) === 'object' && 31 typeofExt(arAsproCounters[action]) === 'object' && 32 typeofExt(arAsproCounters[action].ITEMS) === 'object' 33 ) { 34 BX.ajax({ 35 url: JItemAction.prototype.requestUrl, 36 data: { 37 action: JItemActionFavorite.prototype.action.toLowerCase(), 38 type: 'multiple', 39 items: Object.keys(arAsproCounters[action].ITEMS), 40 sessid: BX.bitrix_sessid(), 41 }, 42 method: 'POST', 43 dataType: 'json', 44 async: true, 45 onsuccess: function(data) { 46 label.remove(); 47 arAsproCounters[action].COUNT = data.count; 48 49 requestFavorit('.personal__block--favorite-products .catalog-block'); 50 } 51 }); 52 } 53 } 54}); 55 56function requestFavorit(selector){ 57 const selectorNode = selector || '.personal__block--favorite-products .js_append.ajax_load'; 58 59 BX.ajax({ 60 url: location.href, 61 data: { 62 action: 'reload', 63 ajax: 'y', 64 sessid: BX.bitrix_sessid(), 65 }, 66 method: 'POST', 67 dataType: 'html', 68 async: true, 69 onsuccess: function(html) { 70 var ob = BX.processHTML(html); 71 72 const action = JItemActionFavorite.prototype.action.toUpperCase(); 73 if (arAsproCounters[action].COUNT) { 74 $(selectorNode).html(ob.HTML); 75 } 76 else { 77 $('.js_clear_favorits').remove(); 78 $(selectorNode).closest('.personal__block--favorite-products').html(ob.HTML); 79 } 80 81 JItemActionFavorite.markItems(); 82 } 83 }); 84}
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.