Browse Source

pass image to vk & mail

master
Vitaliy Filippov 7 years ago
parent
commit
9b78baac95
  1. 2
      dist/social-likes.min.js
  2. 2
      dist/social-likes_flat.css
  3. 95
      src/social-likes.js
  4. 2
      src/styles/flat/font/social-likes.styl

2
dist/social-likes.min.js

File diff suppressed because one or more lines are too long

2
dist/social-likes_flat.css

File diff suppressed because one or more lines are too long

95
src/social-likes.js

@ -40,21 +40,33 @@
var node = document.createElement('script');
node.type = 'text/javascript';
node.src = url;
node.onreadystatechange = function(node)
node.onreadystatechange = function()
{
if (node.readyState == 'complete')
{
var head = document.head || document.getElementsByTagName('head')[0];
head.appendChild(node);
onsuccess && onsuccess();
}
else if (node.readyState == 'loaded')
{
node.children; // IE hack
if (node.readyState == 'loading')
onerror && onerror();
}
node.parentNode && node.parentNode.removeChild(node);
node = null;
};
node.onload = function()
{
onsuccess && onsuccess();
node.parentNode && node.parentNode.removeChild(node);
node = null;
};
node.onerror = function()
{
onerror && onerror();
node.parentNode && node.parentNode.removeChild(node);
node = null;
};
var head = document.head || document.getElementsByTagName('head')[0];
head.appendChild(node);
}
/**
@ -90,7 +102,7 @@
}
}
},
popupUrl: 'https://connect.mail.ru/share?share_url={url}',
popupUrl: 'https://connect.mail.ru/share?share_url={url}&title={title}&image_url={image}',
popupWidth: 492,
popupHeight: 500
},
@ -112,7 +124,7 @@
options._.push(deferred);
getScript(makeUrl(jsonUrl, {index: index}), null, function() { deferred.reject(); });
},
popupUrl: 'https://vk.com/share.php?url={url}',
popupUrl: 'https://vk.com/share.php?url={url}&title={title}&image={image}',
popupWidth: 655,
popupHeight: 450
},
@ -182,25 +194,41 @@
options.counter(jsonUrl, deferred);
else if (options.counterUrl)
{
GET(jsonUrl, function(r, d)
var cb = function(number)
{
if (!r.responseText)
try
{
if (typeof options.convertNumber == 'function')
number = options.convertNumber(number);
deferred.resolve(number);
}
catch (e)
{
deferred.reject();
else
}
};
if (jsonUrl.indexOf('=?') > 0)
{
var k = 0;
while (window['__jsonp'+k]) k++;
window['__jsonp'+k] = function(d)
{
var number = d||r.responseText;
try
{
if (typeof options.convertNumber == 'function')
number = options.convertNumber(number);
deferred.resolve(number);
}
catch (e)
{
delete window['__jsonp'+k];
cb(d);
};
jsonUrl = jsonUrl.replace('=?', '=__jsonp'+k);
getScript(jsonUrl, null, function() { deferred.reject(); });
}
else
{
GET(jsonUrl, function(r, d)
{
if (!r.responseText)
deferred.reject();
}
}
});
else
cb(d||r.responseText);
});
}
}
else
deferred.reject();
@ -235,9 +263,24 @@
}
};
function getOg()
{
var h = {};
var es = document.getElementsByTagName('meta');
for (var i = 0; i < es.length; i++)
{
var p = es[i].getAttribute('property');
if (p && p.substr(0, 3) == 'og:')
h[p.substr(3)] = es[i].getAttribute('content');
}
return h;
}
var og = getOg();
window.socialLikes.defaults = {
url: window.location.href.replace(window.location.hash, ''),
title: document.title,
title: og.title||document.title,
image: og.image,
counters: true,
zeroes: false,
wait: 500, // Show buttons only after counters are ready or after this amount of time
@ -484,7 +527,8 @@
if (options.clickUrl) {
var url = makeUrl(options.clickUrl, {
url: options.url,
title: options.title
title: options.title,
image: options.image||''
});
var link = document.createElement('a');
link.href = url;
@ -562,7 +606,8 @@
if (process) {
var url = makeUrl(options.popupUrl, {
url: options.url,
title: options.title
title: options.title,
image: options.image||''
});
url = this.addAdditionalParamsToUrl(url);
this.openPopup(url, {

2
src/styles/flat/font/social-likes.styl

@ -1,6 +1,6 @@
@font-face {
font-family:"social-likes";
src:url("data:application/x-font-woff;charset=utf-8;base64,d09GRk9UVE8AAAtIAAoAAAAADngAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABDRkYgAAAA9AAAB9EAAAi24oJsrUZGVE0AAAjIAAAAGgAAABxy1NpUT1MvMgAACOQAAABKAAAAYEE6XlxjbWFwAAAJMAAAADYAAAFCAA3zr2hlYWQAAAloAAAALgAAADYHtngBaGhlYQAACZgAAAAcAAAAJAPwAcpobXR4AAAJtAAAACAAAAAmD3MAAG1heHAAAAnUAAAABgAAAAYA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+5i3PxZLlH/Y2donPC7La5VbPAAM+WWzjFu+U2rvFpuYOB2FnuQooHyz3qL5iihEICw3MJiTn2PGNoKgkyRqdZErtGW5NmKJCT61hixZsSITz4jEN2GK4tIoy4Utubfvd6qJh5VBX1S2BaqsSopZzvZaxNkmnHceROm7WcFbmZFeVKydDz5XBtzDYajVKqaa16VerlynBExekL+qsdu43rDadXLBQLnWRupjeK2Y+CVf77lYj7r8GHakBtzB2yP8CE434ZjuTP55kG7tgN/WBytOGYYklZNzYln6kf8ppYW0SsykoXufT9wPN9Xx47+QtIaHlheJxjYGYAg/8HGCQZsAAAK7IB3AA=") format("woff");
src:url("data:application/x-font-woff;charset=utf-8;base64,d09GRk9UVE8AAAtMAAoAAAAADngAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABDRkYgAAAA9AAAB9EAAAi24oJsrUZGVE0AAAjIAAAAGgAAABxy2aNQT1MvMgAACOQAAABKAAAAYEE6XlxjbWFwAAAJMAAAADYAAAFCAA3zr2hlYWQAAAloAAAALgAAADYHu0D9aGhlYQAACZgAAAAcAAAAJAPwAcpobXR4AAAJtAAAACAAAAAmD3MAAG1heHAAAAnUAAAABgAAAAYAClAAbmFtZQAACdwAAAFZAAACpnAJYOpwb3N0AAALOAAAABMAAAAg/8MAGXicVZQNbBPnGcfPJLZPEMIWYxBTZqcd3QalQICtyz5CGGuA0kkk5aMNlJKQEExCHBInzoe/z+ez7zn7fPb5OzZO4thpGwJNmvJNGCHhqwFWVtEyraWbqNAUTUyr9lq6St25kabtfrr3f3re957ned+755Fg+fmYRCJZ3K49rKltfqlZ09TQjkkWYBLs1ewSLLtSkn1hQfbHednl+aonP1hXkKd6If1tQb5qIbbi9aJvAf77UCCnd2b57B5psaR4STGGfa9Ysu77xdjqYpwpwgpy/nBsCbYM+yG2EnsR24CVYRWYFXNjkY4WTWXp+tJ52TAvG+dl07z8bF5+Pi8vz8sv5qVsa1tDra6hvqSuu2SvRlfbrFmzZk2JXqM7WlKpbdFVatsaG0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