1function ednaMultiButton(options) { 2 function onChatButtonClick(e) { 3 e && e.preventDefault(); 4 container.classList.add(hideClass); 5 ThreadsWidget.showChat(); 6 onButtonClick(); 7 } 8 9 function onButtonClick(e) { 10 e && e.preventDefault(); 11 const isActive = button.classList.contains(activeClass); 12 isActive ? topButtons.classList.add(hideClass) : topButtons.classList.remove(hideClass); 13 //isActive ? leftButtons.classList.add(hideClass) : leftButtons.classList.remove(hideClass); 14 button.classList.toggle(activeClass); 15 } 16 17 const buttonClass = 'ednamb-button'; 18 const topButtonsClass = 'ednamb-top-buttons'; 19 const leftButtonsClass = 'ednamb-left-buttons'; 20 const hideClass = 'ednamb-hide'; 21 const activeClass = 'ednamb-active'; 22 const containerId = options.containerId || 'ednamb-container'; 23 const topButtonsList = options.topButtons || []; 24 const container = document.getElementById(containerId); 25 const button = container.querySelector('.' + buttonClass); 26 const topButtons = container.querySelector('.' + topButtonsClass); 27 const leftButtons = container.querySelector('.' + leftButtonsClass); 28 29 button.addEventListener('click', onButtonClick); 30 31 topButtonsList.forEach(function (item) { 32 const a = document.createElement('a'); 33 const img = document.createElement('img'); 34 35 a.href = item.url; 36 a.textContent = item.text; 37 a.classList.add('ednamb-top-button'); 38 39 const classes = item.class.split(' '); 40 classes.forEach(cls => a.classList.add(cls)); 41 42 img.src = item.image; 43 img.alt = item.text; 44 45 if (item.url === '#call') { 46 a.addEventListener('click', function () { 47 makeCallbackCall(); 48 }); 49 makeCallbackCall(); 50 } else if (item.url) { 51 a.href = item.url; 52 } else { 53 a.href = '#'; 54 a.addEventListener('click', onChatButtonClick); 55 } 56 if (item.target == '_blank') { 57 a.target = '_blank'; 58 } 59 60 a.insertBefore(img, a.firstChild); 61 topButtons.appendChild(a); 62 }); 63 64 const hasThreads = 65 topButtonsList.findIndex(function (b) { 66 return !b.url; 67 }) >= 0; 68 69 // ÑÑнкÑÐ¸Ñ Ð¾Ð±ÑаÑного вÑзова пÑи закÑÑÑии ÑаÑа 70 if (hasThreads && ThreadsWidget) { 71 ThreadsWidget.onLoad(function () { 72 ThreadsWidget.on('hideChat', function () { 73 container.classList.remove(hideClass); 74 }); 75 }); 76 } 77 78 makeCallbackCall(); 79} 80 81//window.onload = function () { 82$(document).ready(function () { 83 ednaMultiButton({ 84 containerId: 'ednamb-container', 85 topButtons: [ 86 // { 87 // text: 'ÐапиÑаÑÑ Ð² WhatsApp', 88 // image: '/local/js/edna/assets/icon-whatsapp.png', 89 // url: 'https://api.whatsapp.com/send?phone=79104028550', 90 // class: 'green whatsapp', 91 // target: '_blank' 92 // }, 93 { 94 text: 'ÐапиÑаÑÑ Ð² VK', 95 image: '/local/js/edna/assets/icon-vk.png', 96 url: 'https://vk.com/write-181785838', 97 class: 'blue vk', 98 target: '_blank' 99 }, 100 { 101 text: 'ÐапиÑаÑÑ Ð² Telegram', 102 image: '/local/js/edna/assets/icon-tg.png', 103 url: 'https://t.me/Polyclinika_ru_bot', 104 class: 'blue telegram', 105 target: '_blank' 106 }, 107 { 108 text: 'ÐапиÑаÑÑ Ð² MAX', 109 image: '/local/js/edna/assets/icon-max.svg', 110 class: 'blue max js-max-ym', 111 url: 'https://max.ru/id7701020336_bot', 112 target: '_blank' 113 }, 114 { 115 text: 'ÐапиÑаÑÑ Ð² ÑаÑ', 116 image: '/local/js/edna/assets/button.svg', 117 class: 'blue-2 chat', 118 target: '_self', 119 onClick: function () { 120 ThreadsWidget.showChat(); 121 }, 122 }, 123 { 124 text: 'ÐаказаÑÑ Ð·Ð²Ð¾Ð½Ð¾Ðº', 125 image: '/local/js/edna/assets/icon-phone.png', 126 url: '#call', 127 class: 'purple top-phone-modal popup-with-move-anim phone-recall callbackShow', 128 }, 129 { 130 text: 'ÐозвониÑÑ', 131 image: '/local/js/edna/assets/icon-phone.png', 132 class: 'green2 phone-call', 133 url: 'tel:+74959258878', 134 target: '_self', 135 }, 136 ], 137 }); 138 139 // $('.ednamb-container a.whatsapp').click(function() { 140 // targetYm('click_messengers'); targetTmr('click_messengers'); 141 // }) 142 143 $('.ednamb-container a.vk').click(function (e) { 144 targetTmr('click_messengers'); 145 146 ym('10168531', 'reachGoal', 'ed-vk', { 147 URL: document.location.href 148 }); 149
150 Comagic.addOfflineRequest({ 151 name: 'ed-vk', 152 email: '', 153 phone: '', 154 message: '', 155 }); 156 }); 157 158 $('.ednamb-container a.telegram').click(function (e) { 159 targetTmr('click_messengers'); 160 161 ym('10168531', 'reachGoal', 'ed-telegram', { 162 URL: document.location.href 163 }) 164 165 Comagic.addOfflineRequest({ 166 name: 'ed-telegram', 167 email: '', 168 phone: '', 169 message: '', 170 }); 171 }) 172 173 $('.ednamb-container a.chat').click(function (e) { 174 targetTmr('click_messengers'); 175 176 ym('10168531', 'reachGoal', 'ed-chat', { 177 URL: document.location.href 178 }) 179 Comagic.addOfflineRequest({ 180 name: 'ed-chat', 181 email: '', 182 phone: '', 183 message: '', 184 }); 185 }) 186 $('.ednamb-container a.phone-recall').click(function (e) { 187 targetTmr('click_messengers'); 188 189 ym('10168531', 'reachGoal', 'ed-callback', { 190 URL: document.location.href 191 }) 192 }) 193 $('.ednamb-container a.phone-call').click(function (e) { 194 targetTmr('click_messengers'); 195 196 ym('10168531', 'reachGoal', 'ed-call', { 197 URL: document.location.href 198 }) 199 }) 200 201});
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.