1// JL Like Social Buttons - Vanilla JS version 2// ÐолнÑй оÑказ Ð¾Ñ jQuery 3 4var socialButtonCountObjects = {}; 5var jllikeproShareUrls = { 6 mail: {}, 7 pinteres: {}, 8 linkedin: {}, 9 vkontakte: {} 10}; 11 12function getParam(key) { 13 if (key) { 14 var pairs = top.location.search.replace(/^\?/, '').split('&'); 15 for (var i in pairs) { 16 var current = pairs[i]; 17 var match = current.match(/([^=]*)=(\w*)/); 18 if (match && match[1] === key) { 19 return decodeURIComponent(match[2]); 20 } 21 } 22 } 23 return false; 24} 25 26var ButtonConfiguration = function (params) { 27 if (params) { 28 // ÐлÑбокое копиÑование обÑекÑа 29 return Object.assign({}, ButtonConfiguration.defaults, params); 30 } 31 return ButtonConfiguration.defaults; 32} 33 34ButtonConfiguration.defaults = { 35 selectors: { 36 facebookButton: '.l-fb', 37 twitterButton: '.l-tw', 38 vkontakteButton: '.l-vk', 39 odnoklassnikiButton: '.l-ok', 40 mailButton: '.l-ml', 41 linButton: '.l-ln', 42 pinteresButton: '.l-pinteres', 43 LivejournalButton: '.l-lj', 44 BloggerButton: '.l-bl', 45 WeiboButton: '.l-wb', 46 TelegramButton: '.l-tl', 47 WhatsappButton: '.l-wa', 48 ViberButton: '.l-vi', 49 count: '.l-count', 50 ico: '.l-ico', 51 shareTitle: 'h2', 52 shareSumary: 'p', 53 shareImages: 'img[src]' 54 }, 55 buttonDepth: 2, 56 alternativeImage: '', 57 alternativeSummary: '', 58 alternativeTitle: '', 59 forceAlternativeImage: false, 60 forceAlternativeSummary: false, 61 forceAlternativeTitle: false, 62 classes: { 63 countVisibleClass: 'like-not-empty' 64 }, 65 keys: { 66 shareLinkParam: 'href' 67 }, 68 popupWindowOptions: [ 69 'left=0', 70 'top=0', 71 'width=500', 72 'height=400', 73 'personalbar=0', 74 'toolbar=0', 75 'scrollbars=1', 76 'resizable=1' 77 ] 78}; 79 80function cropText(text, max) { 81 if (text.length > max) { 82 return text.substring(0, max); 83 } 84 return text; 85} 86 87function updateAllCounter(container) { 88 var counts = container.querySelectorAll('.l-count:not(.l-all-count)'); 89 var sum = 0; 90 counts.forEach(function (el) { 91 var val = parseInt(el.textContent, 10); 92 if (!isNaN(val)) sum += val; 93 }); 94 var allCount = container.querySelector('.l-all-count'); 95 if (allCount) { 96 allCount.textContent = sum; 97 } 98} 99 100function Button(config, context, index) { 101 this.config = config; 102 this.index = index; 103 this.context = context; 104 this.id = context.getAttribute('id'); 105 this.countElem = context.querySelector(this.config.selectors.count); 106 this.icoElem = context.querySelector(this.config.selectors.ico); 107 this.collectShareInfo(); 108 this.bindEvents(); 109 this.ajaxRequest = this.countLikes(); 110} 111 112Button.prototype = { 113 bindEvents: function () { 114 // ÐбÑабоÑка клика по вÑей кнопке 115 this.context.addEventListener('click', this.openShareWindow.bind(this)); 116 }, 117 setCountValue: function (count) { 118 this.context.classList.add('like-not-empty'); 119 if (this.countElem) { 120 this.countElem.textContent = count; 121 } 122 // ÐбновиÑÑ Ð¾Ð±Ñий ÑÑеÑÑик 123 var container = this.context.closest('.jllikeproSharesContayner'); 124 if (container) { 125 updateAllCounter(container); 126 // ÐбновиÑÑ ÑиÑÐ¸Ð½Ñ ÐºÐ½Ð¾Ð¿ÐºÐ¸ "ÐÑÑ" поÑле Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ ÑÑеÑÑика 127 updateMoreButtonWidth(container); 128 } 129 }, 130 getPopupOptions: function () { 131 return 'left=0,top=0,width=500,height=400,personalbar=0,toolbar=0,scrollbars=1,resizable=1'; 132 }, 133 plusOne: function () { 134 var counter = this.countElem; 135 var count = counter ? counter.textContent : ''; 136 count = (count === '') ? 0 : parseInt(count); 137 this.context.classList.add('like-not-empty'); 138 if (counter) counter.textContent = count + 1; 139 }, 140 disableMoreLikes: function () { 141 if (window.jllickeproSettings && jllickeproSettings.disableMoreLikes) { 142 var parent = this.context.closest('.jllikeproSharesContayner'); 143 var id = parent ? (parent.querySelector('.share-id') || {}).value : ''; 144 var date = new Date(new Date().getTime() + 60 * 60 * 24 * 30 * 1000); 145 document.cookie = 'jllikepro_article_' + id + '=1; path=/; expires=' + date.toUTCString(); 146 var div = document.createElement('div'); 147 div.className = 'disable_more_likes';
148 parent.prepend(div); 149 } 150 }, 151 openShareWindow: function (e) { 152 e.preventDefault(); 153 var shareUri = this.getShareLink(); 154 var windowOptions = this.getPopupOptions(); 155 var newWindow = window.open(shareUri, '', windowOptions); 156 this.plusOne(); 157 this.disableMoreLikes(); 158 if (window.focus && newWindow) { 159 newWindow.focus(); 160 } 161 }, 162 collectShareInfo: function () { 163 var parent = this.context; 164 var parentContayner = (window.jllickeproSettings && jllickeproSettings.parentContayner) || '.jllikeproSharesContayner'; 165 var parentElem = parent.closest(parentContayner) || parent.closest('.jllikeproSharesContayner'); 166 var href = parentElem ? (parentElem.querySelector('input.link-to-share') || {}).value : ''; 167 var title = parentElem ? (parentElem.querySelector('input.share-title') || {}).value : ''; 168 var image = parentElem ? (parentElem.querySelector('input.share-image') || {}).value : ''; 169 var $title = parentElem ? parentElem.querySelector('h2') : null; 170 var $summary = parentElem ? parentElem.querySelector('input.share-desc') : null; 171 if (!$title) $title = document.querySelector('h2'); 172 var summary = $summary ? $summary.value : ''; 173 if (!summary) { 174 var sumEl = parentElem ? parentElem.querySelector('p') : null; 175 summary = sumEl ? sumEl.textContent : ''; 176 } 177 if (!summary) summary = parentElem ? parentElem.textContent : ''; 178 if (!summary && parentElem && parentElem.parentElement) summary = parentElem.parentElement.textContent; 179 this.domenhref = window.location.protocol + '//' + window.location.host; 180 this.linkhref = (window.jllickeproSettings ? jllickeproSettings.url : '') + window.location.pathname + window.location.search; 181 this.linkToShare = (!href) ? this.linkhref : href; 182 this.title = title !== '' ? title : ($title ? $title.textContent : document.title); 183 this.summary = summary.length > 0 ? summary : ''; 184 this.summary = (this.summary.length > 200) ? cropText(this.summary, 200) + '...' : this.summary; 185 this.images = []; 186 if (typeof image === 'undefined' || !image.length) { 187 var images = parentElem ? parentElem.querySelectorAll('img[src]') : []; 188 if (images.length > 0) { 189 images.forEach(function (img, index) { 190 this.images[index] = img.src; 191 }, this); 192 } 193 } else { 194 this.images[0] = image; 195 } 196 }, 197 // ÐаглÑÑки Ð´Ð»Ñ Ð½Ð°Ñледников 198 countLikes: function () {}, 199 getShareLink: function () { return '#'; } 200}; 201 202// VK Button (пÑимеÑ) 203function VkontakteButton(config, context, index) { 204 Button.call(this, config, context, index); 205 this.type = 'VkontakteButton'; 206 this.countServiceUrl = 'https://vk.com/share.php?act=count&index='; 207} 208VkontakteButton.prototype = Object.create(Button.prototype); 209VkontakteButton.prototype.constructor = VkontakteButton; 210VkontakteButton.prototype.countLikes = function () { 211 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 212 if (this.countElem) this.countElem.remove(); 213 return; 214 } 215 var self = this; 216 setTimeout(function () { 217 var count = 0; 218 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 219 count = Math.floor(Math.random() * 100); 220 } 221 self.setCountValue(count); 222 }, 500); 223}; 224VkontakteButton.prototype.getShareLink = function () { 225 return 'https://vk.com/share.php?url=' + encodeURIComponent(this.linkToShare) + '&title=' + encodeURIComponent(this.title) + '&description=' + encodeURIComponent(this.summary) + (this.images[0] ? '&image=' + encodeURIComponent(this.images[0]) : ''); 226}; 227 228// --- ÐниÑиализаÑÐ¸Ñ Ð²ÑÐµÑ VK-кнопок --- 229document.addEventListener('DOMContentLoaded', function () { 230 var vkButtons = document.querySelectorAll('.l-vk'); 231 vkButtons.forEach(function (button, index) { 232 var conf = ButtonConfiguration.defaults; 233 new VkontakteButton(conf, button, index); 234 });
235}); 236 237// --- Facebook Button (Vanilla JS) --- 238function FacebookButton(config, context, index) { 239 Button.call(this, config, context, index); 240 this.type = 'FacebookButton'; 241 this.countServiceUrl = 'https://graph.facebook.com/?id='; 242} 243FacebookButton.prototype = Object.create(Button.prototype); 244FacebookButton.prototype.constructor = FacebookButton; 245FacebookButton.prototype.countLikes = function () { 246 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 247 if (this.countElem) this.countElem.remove(); 248 return; 249 } 250 var self = this; 251 setTimeout(function () { 252 var count = 0; 253 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 254 count = Math.floor(Math.random() * 100); 255 } 256 self.setCountValue(count); 257 }, 500); 258}; 259FacebookButton.prototype.getShareLink = function () { 260 return 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(this.linkToShare) + '&t=' + encodeURIComponent(this.title); 261}; 262 263// --- ÐниÑиализаÑÐ¸Ñ Ð²ÑÐµÑ Facebook-кнопок --- 264document.addEventListener('DOMContentLoaded', function () { 265 var fbButtons = document.querySelectorAll('.l-fb'); 266 fbButtons.forEach(function (button, index) { 267 var conf = ButtonConfiguration.defaults; 268 new FacebookButton(conf, button, index); 269 }); 270}); 271 272// --- Odnoklassniki Button --- 273function OdnoklassnikiButton(config, context, index) { 274 Button.call(this, config, context, index); 275 this.type = 'OdnoklassnikiButton'; 276} 277OdnoklassnikiButton.prototype = Object.create(Button.prototype); 278OdnoklassnikiButton.prototype.constructor = OdnoklassnikiButton; 279OdnoklassnikiButton.prototype.countLikes = function () { 280 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 281 if (this.countElem) this.countElem.remove(); 282 return; 283 } 284 var self = this; 285 setTimeout(function () { 286 var count = 0; 287 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 288 count = Math.floor(Math.random() * 100); 289 } 290 self.setCountValue(count); 291 }, 500); 292}; 293OdnoklassnikiButton.prototype.getShareLink = function () { 294 return 'https://connect.ok.ru/offer?url=' + encodeURIComponent(this.linkToShare) + '&description=' + encodeURIComponent(this.summary); 295}; 296 297// --- LinkedIn Button --- 298function LinkedInButton(config, context, index) { 299 Button.call(this, config, context, index); 300 this.type = 'LinkedInButton'; 301} 302LinkedInButton.prototype = Object.create(Button.prototype); 303LinkedInButton.prototype.constructor = LinkedInButton; 304LinkedInButton.prototype.countLikes = function () { 305 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 306 if (this.countElem) this.countElem.remove(); 307 return; 308 } 309 var self = this; 310 setTimeout(function () { 311 var count = 0; 312 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 313 count = Math.floor(Math.random() * 100); 314 } 315 self.setCountValue(count); 316 }, 500); 317}; 318LinkedInButton.prototype.getShareLink = function () { 319 return 'https://www.linkedin.com/shareArticle?mini=true&url=' + encodeURIComponent(this.linkToShare) + 320 '&title=' + encodeURIComponent(this.title) + 321 '&summary=' + encodeURIComponent(this.summary); 322}; 323 324// --- Pinterest Button --- 325function PinterestButton(config, context, index) { 326 Button.call(this, config, context, index); 327 this.type = 'PinterestButton'; 328} 329PinterestButton.prototype = Object.create(Button.prototype); 330PinterestButton.prototype.constructor = PinterestButton; 331PinterestButton.prototype.countLikes = function () { 332 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 333 if (this.countElem) this.countElem.remove(); 334 return; 335 } 336 var self = this; 337 setTimeout(function () { 338 var count = 0; 339 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 340 count = Math.floor(Math.random() * 100); 341 } 342 self.setCountValue(count); 343 }, 500); 344}; 345PinterestButton.prototype.getShareLink = function () { 346 var media = (this.images[0] != undefined) ? this.images[0] : ''; 347 return 'https://www.pinterest.com/pin/create/button/?url=' + encodeURIComponent(this.linkToShare) + 348 '&media=' + encodeURIComponent(media) + 349 '&description=' + encodeURIComponent(this.summary); 350}; 351 352// --- LiveJournal Button --- 353function LivejournalButton(config, context, index) { 354 Button.call(this, config, context, index); 355 this.type = 'LivejournalButton'; 356} 357LivejournalButton.prototype = Object.create(Button.prototype); 358LivejournalButton.prototype.constructor = LivejournalButton; 359LivejournalButton.prototype.countLikes = function () { 360 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 361 if (this.countElem) this.countElem.remove(); 362 return; 363 } 364 var self = this; 365 setTimeout(function () { 366 var count = 0; 367 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 368 count = Math.floor(Math.random() * 100); 369 } 370 self.setCountValue(count); 371 }, 500); 372}; 373LivejournalButton.prototype.getShareLink = function () { 374 return 'http://livejournal.com/update.bml?subject=' + encodeURIComponent(this.title) + 375 '&event=' + encodeURIComponent('<a href="' + this.linkToShare + '">' + this.title + '</a> ' + this.summary); 376}; 377 378// --- Blogger Button --- 379function BloggerButton(config, context, index) { 380 Button.call(this, config, context, index); 381 this.type = 'BloggerButton'; 382} 383BloggerButton.prototype = Object.create(Button.prototype); 384BloggerButton.prototype.constructor = BloggerButton; 385BloggerButton.prototype.countLikes = function () { 386 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 387 if (this.countElem) this.countElem.remove(); 388 return; 389 } 390 var self = this; 391 setTimeout(function () { 392 var count = 0; 393 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 394 count = Math.floor(Math.random() * 100); 395 } 396 self.setCountValue(count); 397 }, 500); 398}; 399BloggerButton.prototype.getShareLink = function () { 400 return 'https://www.blogger.com/blog-this.g?u=' + encodeURIComponent(this.linkToShare) + 401 '&n=' + encodeURIComponent(this.title); 402}; 403 404// --- Weibo Button --- 405function WeiboButton(config, context, index) { 406 Button.call(this, config, context, index); 407 this.type = 'WeiboButton'; 408} 409WeiboButton.prototype = Object.create(Button.prototype); 410WeiboButton.prototype.constructor = WeiboButton; 411WeiboButton.prototype.countLikes = function () { 412 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 413 if (this.countElem) this.countElem.remove(); 414 return; 415 } 416 var self = this; 417 setTimeout(function () { 418 var count = 0; 419 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 420 count = Math.floor(Math.random() * 100); 421 } 422 self.setCountValue(count); 423 }, 500); 424}; 425WeiboButton.prototype.getShareLink = function () { 426 return 'http://service.weibo.com/share/share.php?url=' + encodeURIComponent(this.linkToShare) + '&title=' + encodeURIComponent(this.title); 427}; 428 429// --- Telegram Button --- 430function TelegramButton(config, context, index) { 431 Button.call(this, config, context, index); 432 this.type = 'TelegramButton'; 433} 434TelegramButton.prototype = Object.create(Button.prototype); 435TelegramButton.prototype.constructor = TelegramButton; 436TelegramButton.prototype.countLikes = function () { 437 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 438 if (this.countElem) this.countElem.remove(); 439 return; 440 } 441 var self = this; 442 setTimeout(function () { 443 var count = 0; 444 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 445 count = Math.floor(Math.random() * 100); 446 } 447 self.setCountValue(count); 448 }, 500); 449}; 450TelegramButton.prototype.getShareLink = function () { 451 return 'https://t.me/share/url?url=' + encodeURIComponent(this.linkToShare) + '&text=' + encodeURIComponent(this.title); 452}; 453 454// --- Whatsapp Button --- 455function WhatsappButton(config, context, index) { 456 Button.call(this, config, context, index); 457 this.type = 'WhatsappButton'; 458}
459WhatsappButton.prototype = Object.create(Button.prototype); 460WhatsappButton.prototype.constructor = WhatsappButton; 461WhatsappButton.prototype.countLikes = function () { 462 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 463 if (this.countElem) this.countElem.remove(); 464 return; 465 } 466 var self = this; 467 setTimeout(function () { 468 var count = 0; 469 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 470 count = Math.floor(Math.random() * 100); 471 } 472 self.setCountValue(count); 473 }, 500); 474}; 475WhatsappButton.prototype.getShareLink = function () { 476 return 'https://wa.me/?text=' + encodeURIComponent(this.title + ' ' + this.linkToShare); 477}; 478 479// --- Viber Button --- 480function ViberButton(config, context, index) { 481 Button.call(this, config, context, index); 482 this.type = 'ViberButton'; 483} 484ViberButton.prototype = Object.create(Button.prototype); 485ViberButton.prototype.constructor = ViberButton; 486ViberButton.prototype.countLikes = function () { 487 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 488 if (this.countElem) this.countElem.remove(); 489 return; 490 } 491 var self = this; 492 setTimeout(function () { 493 var count = 0; 494 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 495 count = Math.floor(Math.random() * 100); 496 } 497 self.setCountValue(count); 498 }, 500); 499}; 500ViberButton.prototype.getShareLink = function () { 501 return 'viber://forward?text=' + encodeURIComponent(this.title + ' ' + this.linkToShare); 502}; 503 504// --- Threads Button --- 505function ThreadsButton(config, context, index) { 506 Button.call(this, config, context, index); 507 this.type = 'ThreadsButton'; 508} 509ThreadsButton.prototype = Object.create(Button.prototype); 510ThreadsButton.prototype.constructor = ThreadsButton; 511ThreadsButton.prototype.countLikes = function () { 512 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 513 if (this.countElem) this.countElem.remove(); 514 return; 515 } 516 var self = this; 517 setTimeout(function () { 518 var count = 0; 519 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 520 count = Math.floor(Math.random() * 100); 521 } 522 self.setCountValue(count); 523 }, 500); 524}; 525ThreadsButton.prototype.getShareLink = function () { 526 return 'https://www.threads.net/intent/post?text=' + encodeURIComponent(this.title + ' ' + this.linkToShare); 527}; 528 529// --- Reddit Button --- 530function RedditButton(config, context, index) { 531 Button.call(this, config, context, index); 532 this.type = 'RedditButton'; 533} 534RedditButton.prototype = Object.create(Button.prototype); 535RedditButton.prototype.constructor = RedditButton; 536RedditButton.prototype.countLikes = function () { 537 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 538 if (this.countElem) this.countElem.remove(); 539 return; 540 } 541 var self = this; 542 setTimeout(function () { 543 var count = 0; 544 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 545 count = Math.floor(Math.random() * 100); 546 } 547 self.setCountValue(count); 548 }, 500); 549}; 550RedditButton.prototype.getShareLink = function () { 551 return 'https://reddit.com/submit?url=' + encodeURIComponent(this.linkToShare) + '&title=' + encodeURIComponent(this.title); 552}; 553 554// --- УнивеÑÑалÑÐ½Ð°Ñ Ð¸Ð½Ð¸ÑиализаÑÐ¸Ñ Ð²ÑÐµÑ ÐºÐ½Ð¾Ð¿Ð¾Ðº (добавлено Ð´Ð»Ñ OK.ru) --- 555document.addEventListener('DOMContentLoaded', function () { 556 var conf = ButtonConfiguration && ButtonConfiguration.defaults ? ButtonConfiguration.defaults : {}; 557 var buttonTypes = [ 558 {selector: '.l-vk', ctor: VkontakteButton}, 559 {selector: '.l-fb', ctor: FacebookButton}, 560 {selector: '.l-tw', ctor: TwitterButton}, 561 {selector: '.l-ok', ctor: OdnoklassnikiButton}, 562 {selector: '.l-ml', ctor: MailButton}, 563 {selector: '.l-ln', ctor: LinkedInButton}, 564 {selector: '.l-pinteres', ctor: PinterestButton}, 565 {selector: '.l-lj', ctor: LivejournalButton}, 566 {selector: '.l-bl', ctor: BloggerButton}, 567 {selector: '.l-wb', ctor: WeiboButton}, 568 {selector: '.l-tl', ctor: TelegramButton}, 569 {selector: '.l-wa', ctor: WhatsappButton}, 570 {selector: '.l-vi', ctor: ViberButton}, 571 {selector: '.l-th', ctor: ThreadsButton}, 572 {selector: '.l-rd', ctor: RedditButton} 573 ];
574 buttonTypes.forEach(function (type) { 575 var btns = document.querySelectorAll(type.selector); 576 btns.forEach(function (button, index) { 577 new type.ctor(conf, button, index); 578 }); 579 }); 580 581 // Initialize "More" buttons for collapse functionality 582 initMoreButtons(); 583}); 584 585// --- Helper function to update "More" button width --- 586function updateMoreButtonWidth(container) { 587 if (!container) return; 588 var moreButton = container.querySelector('.jllike-more-button'); 589 if (!moreButton) return; 590 591 // ÐайÑи пеÑвÑÑ Ð²Ð¸Ð´Ð¸Ð¼ÑÑ ÐºÐ½Ð¾Ð¿ÐºÑ Ñ ÐºÐ»Ð°ÑÑом .like (не ÑкÑÑÑÑÑ) 592 var firstButton = container.querySelector('.like:not(.jllike-hidden)'); 593 if (firstButton) { 594 // ÐолÑÑиÑÑ Ð¾Ð±ÑÑÑ ÑиÑÐ¸Ð½Ñ ÐºÐ½Ð¾Ð¿ÐºÐ¸ (иконка + ÑÑеÑÑик + margins/paddings) 595 var buttonWidth = firstButton.offsetWidth; 596 if (buttonWidth > 0) { 597 moreButton.style.width = buttonWidth + 'px'; 598 moreButton.style.height = ''; // СбÑоÑиÑÑ ÑикÑиÑованнÑÑ Ð²ÑÑоÑÑ 599 } 600 } 601} 602 603// --- Collapse Buttons Functionality --- 604function initMoreButtons() { 605 var moreButtons = document.querySelectorAll('.jllike-more-button'); 606 607 function adjustMoreButtonWidth() { 608 moreButtons.forEach(function (btn) { 609 var container = btn.closest('.jllikeproSharesContayner'); 610 updateMoreButtonWidth(container); 611 }); 612 } 613 614 // УÑÑановиÑÑ ÑиÑÐ¸Ð½Ñ ÑÑÐ°Ð·Ñ 615 adjustMoreButtonWidth(); 616 617 // ÐовÑоÑно ÑÑÑановиÑÑ ÑиÑÐ¸Ð½Ñ Ð¿Ð¾Ñле загÑÑзки ÑÑеÑÑиков (ÑеÑез 600ms) 618 setTimeout(adjustMoreButtonWidth, 600); 619 620 moreButtons.forEach(function (btn) { 621 btn.addEventListener('click', function (e) { 622 e.preventDefault(); 623 var container = this.closest('.jllikeproSharesContayner'); 624 if (!container) return; 625 626 var hiddenButtons = container.querySelectorAll('.jllike-hidden'); 627 hiddenButtons.forEach(function (hidden) { 628 hidden.classList.remove('jllike-hidden'); 629 hidden.classList.add('jllike-visible'); 630 }); 631 632 // Hide the "More" button after revealing all buttons 633 this.style.display = 'none'; 634 }); 635 }); 636} 637 638// --- Twitter Button --- 639function TwitterButton(config, context, index) { 640 Button.call(this, config, context, index); 641 this.type = 'TwitterButton'; 642} 643TwitterButton.prototype = Object.create(Button.prototype); 644TwitterButton.prototype.constructor = TwitterButton; 645TwitterButton.prototype.countLikes = function () { 646 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 647 if (this.countElem) this.countElem.remove(); 648 return; 649 } 650 var self = this; 651 setTimeout(function () { 652 var count = 0; 653 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 654 count = Math.floor(Math.random() * 100); 655 } 656 self.setCountValue(count); 657 }, 500); 658}; 659TwitterButton.prototype.getShareLink = function () { 660 return 'https://twitter.com/intent/tweet?url=' + encodeURIComponent(this.linkToShare) + '&text=' + encodeURIComponent(this.title); 661}; 662 663// --- Mail Button --- 664function MailButton(config, context, index) { 665 Button.call(this, config, context, index); 666 this.type = 'MailButton'; 667} 668MailButton.prototype = Object.create(Button.prototype); 669MailButton.prototype.constructor = MailButton; 670MailButton.prototype.countLikes = function () { 671 if (window.jllickeproSettings && jllickeproSettings.enableCounters === false) { 672 if (this.countElem) this.countElem.remove(); 673 return; 674 } 675 var self = this; 676 setTimeout(function () { 677 var count = 0; 678 if (!window.jllickeproSettings || window.jllickeproSettings.random_likes !== false) { 679 count = Math.floor(Math.random() * 100); 680 } 681 self.setCountValue(count); 682 }, 500); 683}; 684MailButton.prototype.getShareLink = function () { 685 return 'https://connect.mail.ru/share?url=' + encodeURIComponent(this.linkToShare) + 686 '&image_url=' + encodeURIComponent(this.images[0] || '') + 687 '&title=' + encodeURIComponent(this.title) + 688 '&description=' + encodeURIComponent(this.summary); 689}; 690 691// --- ÐÑÑалÑнÑе ÑÐ¸Ð¿Ñ ÐºÐ½Ð¾Ð¿Ð¾Ðº (Facebook, Twitter и Ñ.д.) бÑдÑÑ ÑÐµÐ°Ð»Ð¸Ð·Ð¾Ð²Ð°Ð½Ñ Ð°Ð½Ð°Ð»Ð¾Ð³Ð¸Ñно ---
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.