1var Shares = { 2 title: 'ÐоделиÑÑÑÑ', 3 width: 800, 4 height: 800, 5 6 init: function() { 7 var share = document.querySelectorAll('.social-gd-button'); 8 for(var i = 0, l = share.length; i < l; i++) { 9 var url = share[i].getAttribute('data-url') || location.href, title = share[i].getAttribute('data-title') || '', 10 desc = share[i].getAttribute('data-desc') || '', el = share[i].querySelectorAll('a'); 11 for(var a = 0, al = el.length; a < al; a++) { 12 var id = el[a].getAttribute('data-id'); 13 if(id) 14 this.addEventListener(el[a], 'click', {id: id, url: url, title: title, desc: desc}); 15 } 16 } 17 }, 18 19 addEventListener: function(el, eventName, opt) { 20 var _this = this, handler = function() { 21 _this.share(opt.id, opt.url, opt.title, opt.desc); 22 }; 23 if(el.addEventListener) { 24 el.addEventListener(eventName, handler); 25 } else { 26 el.attachEvent('on' + eventName, function() { 27 handler.call(el); 28 }); 29 } 30 }, 31 32 share: function(id, url, title, desc) { 33 url = encodeURIComponent(url); 34 desc = encodeURIComponent(desc); 35 title = encodeURIComponent(title); 36 switch(id) { 37 case 'fb': 38 this.popupCenter('https://www.facebook.com/sharer/sharer.php?u=' + url, this.title, this.width, this.height); 39 break; 40 case 'vk': 41 this.popupCenter('https://vk.com/share.php?url=' + url + '&description=' + title + '. ' + desc, this.title, this.width, this.height); 42 break; 43 case 'tw': 44 var text = title || desc || ''; 45 if(title.length > 0 && desc.length > 0) 46 text = title + ' - ' + desc; 47 if(text.length > 0) 48 text = '&text=' + text; 49 this.popupCenter('https://twitter.com/intent/tweet?url=' + url + text, this.title, this.width, this.height); 50 break; 51 case 'ok': 52 this.popupCenter('https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=' + url, this.title, this.width, this.height); 53 break; 54 case 'telegram': 55 this.popupCenter('https://telegram.me/share/url?url=' + url, this.title, this.width, this.height); 56 break; 57 case 'whatsapp': 58 this.popupCenter('whatsapp://send?text=' + url, this.title, this.width, this.height); 59 break; 60 case 'viber': 61 this.popupCenter('viber://forward?text=' + url, this.title, this.width, this.height); 62 break; 63 } 64 }, 65 66 67 68 69 newTab: function(url) { 70 var win = window.open(url, '_blank'); 71 win.focus(); 72 }, 73 74 popupCenter: function(url, title, w, h) { 75 var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; 76 var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; 77 var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; 78 var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; 79 var left = ((width / 2) - (w / 2)) + dualScreenLeft; 80 var top = ((height / 3) - (h / 3)) + dualScreenTop; 81 var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); 82 if (window.focus) { 83 newWindow.focus(); 84 } 85 } 86}; 87 88jQuery(document).ready(function($) { 89 $('.social-gd-button a').on('click', function() { 90 var id = $(this).data('id'); 91 if(id) { 92 var data = $(this).parent('.social-gd-button'); 93 var url = data.data('url') || location.href, title = data.data('title') || '', desc = data.data('desc') || ''; 94 Shares.share(id, url, title, desc); 95 } 96 }); 97});
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.