1var Shares = { 2 title: 'ÐоделиÑÑÑÑ', 3 width: 600, 4 height: 400, 5 init: function() { 6 var share = document.querySelectorAll('.social'); 7 for(var i = 0, l = share.length; i < l; i++) { 8 var url = share[i].getAttribute('data-url') || location.href, 9 title = share[i].getAttribute('data-title') || '', 10 desc = share[i].getAttribute('data-desc') || '', 11 el = share[i].querySelectorAll('a'); 12 for(var a = 0, al = el.length; a < al; a++) { 13 var id = el[a].getAttribute('data-id'); 14 if(id) this.addEventListener(el[a], 'click', {id: id, url: url, title: title, desc: desc}); 15 } 16 } 17 }, 18 addEventListener: function(el, eventName, opt) { 19 var _this = this, 20 handler = function() {_this.share(opt.id, opt.url, opt.title, opt.desc); }; 21 if(el.addEventListener) { 22 el.addEventListener(eventName, handler); 23 } else { 24 el.attachEvent('on' + eventName, function() { handler.call(el); }); 25 } 26 }, 27 share: function(id, url, title, desc) { 28 url = encodeURIComponent(url); 29 desc = encodeURIComponent(desc); 30 title = encodeURIComponent(title); 31 switch(id) { 32 case 'fb': 33 this.popupCenter('https://www.facebook.com/sharer/sharer.php?u=' + url, this.title, this.width, this.height); 34 break; 35 case 'tw': 36 var text = title || desc || ''; 37 if(title.length > 0 && desc.length > 0) text = title + ' - ' + desc; 38 if(text.length > 0) text = '&text=' + text; 39 this.popupCenter('https://twitter.com/intent/tweet?url=' + url + text, this.title, this.width, this.height); 40 break; 41 }; 42 }, 43 newTab: function(url) { 44 var win = window.open(url, '_blank'); 45 win.focus(); 46 }, 47 popupCenter: function(url, title, w, h) { 48 var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; 49 var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; 50 var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; 51 var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; 52 var left = ((width / 2) - (w / 2)) + dualScreenLeft; 53 var top = ((height / 3) - (h / 3)) + dualScreenTop; 54 var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); 55 if (window.focus) {newWindow.focus(); } 56 } 57}; 58 59$('.social a').on('click', function() { 60 var id = $(this).data('id'); 61 if(id) { 62 var data = $(this).parent('.social'); 63 var url = data.data('url') || location.href, 64 title = data.data('title') || '', 65 desc = data.data('desc') || ''; 66 Shares.share(id, url, title, desc); 67 } 68});
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.