-
Notifications
You must be signed in to change notification settings - Fork 0
/
social.js
49 lines (45 loc) · 1.83 KB
/
social.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(function() {
var b = function(a, b, c, d){
c = c || socialParams.width;
d = d || socialParams.height;
window.open(a, b, "scrollbars=yes, width=" + c + ", height=" + d +", top="+
((window.screenTop || window.screenY) +
(window.innerWidth||document.documentElement.clientHeight) / 2 - d) +", " +
"left=" +((window.screenLeft||window.screenX) +
(window.innerWidth || document.documentElement.clientWidth) / 2 - c / 2) + "").focus();
return!0
};
/**
* Share on Twitter
*/
document.querySelector(".share_twitter").addEventListener("click",function(a){
a.preventDefault();
a = this.getAttribute("data-url");a="https://twitter.com/intent/tweet?text="+
encodeURIComponent(document.title)+
"&via=Moussa__Ball&url=" + encodeURIComponent(a);
b(a, socialParams.twitter)});
/**
* Share on Facebook
*/
document.querySelector(".share_facebook").addEventListener("click",function(a){
a.preventDefault();
a = this.getAttribute("data-url");a='https://www.facebook.com/sharer/sharer.php?u=' +
encodeURIComponent(a);
b(a, socialParams.facebook)});
/**
* Share on Google+
*/
document.querySelector(".share_google-plus").addEventListener("click",function(a){
a.preventDefault();
a = this.getAttribute("data-url");a="https://www.plus.google.com/share?url="+
encodeURIComponent(a);
b(a, socialParams.google_plus)});
/**
* Share on Linkedin
*/
document.querySelector(".share_linkedin").addEventListener("click",function(a){
a.preventDefault();
a =this.getAttribute("data-url");
a ="https://www.linkedin.com/shareArticle?url="+encodeURIComponent(a);
b(a, socialParams.linkedin)});
})();