-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsocialtags.js.html
executable file
·83 lines (60 loc) · 2.48 KB
/
socialtags.js.html
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#HTTP_HEADER{Content-Type: text/javascript}
// socialtags.js
// 'ajouter un bookmark' ne marche que sous IE
// les tuyaux trouves pour FF
// window.sidebar.addPanel(t,u,'');
// cf https://bugzilla.mozilla.org/show_bug.cgi?id=214530
// ou Opera sont creves
;var socialtags_addfavorite = function(u,t){
if(document.all)window.external.AddFavorite(u,t);
};
function share_content(evt){
elem=$(evt.target)
if($(elem).is('i'))
elem = $(elem).parent('a')
href=$(elem).attr('href');
if ($(elem).parent('li').attr('class')!='mail'){
window.open(href, "_blank", "screenX=50,left=50,screenY=50,top=50, width=550, height=450,toolbar=no, location=no,resizable=yes, scrollbars=yes")
return false;
}
return true;
}
(function($) {
var socialtags_init = function() {
var selector = $('[(#CONFIG{socialtags/jsselector}|sinon{#contenu})]');
if (!selector.length) return;
var socialtags = [(#CONFIG{socialtags/tags}|socialtags_json)];
var title = $('title').text() ||'';
var description = ($('meta[name=description]').attr('content') || '').substr(0,250);
var cano = $('link[rel=canonical]')[0];
var url = cano ? cano.href : document.location.href;
var socialdropdown = $('<div class="socialtagshare"><\/ul>');
var esc = function(x){return encodeURIComponent(x).replace(/\s/g,' ');};
var ref = document.referrer.match(/^.*\/\/([^\/]+)\//);
$(socialdropdown).append(' <div id="socialShare" ><i class="glyphicon glyphicon-share fa-inverse"></i> <ul class="btn-social"></ul></div>')
var ul = $('.btn-social',socialdropdown);
if (ref && ref[1].match(/\.facebook\./))
$.cookie('social_facebook', 1, { path: '/', expires: 30 }); // 30 jours
$.each(socialtags, function(){ if (this.u) {
if (this.a == 'bookmark' && !document.all) return;
[(#CONFIG{socialtags/ifreferer}|?{"
if ($.cookie('social_'+this.a)!=1) return;"})]
$('<a rel="nofollow" data-original-title="+ this.n +" rel="tooltip" href="#" class="btn btn-'+ this.a +'" data-placement="left"><i class="socicon-'+ this.a +'"></i><\/a>')
.attr('href',
this.u
.replace(/%u/g, esc(url))
.replace(/%t/g, esc(title))
.replace(/%d/g, esc(description))
.replace(/%u_site/g, esc(this.u_site))
)
.attr('title', this.n).wrap('<li class="'+this.a+'"><\/li>').click(share_content)
.parent().appendTo(ul);
}});
selector.after(socialdropdown);
[(#CONFIG{socialtags/plusone}|?{[$('<li>(#GOOGLEPLUS1)</li>').appendTo(ul);],''})]
#CONFIG{socialtags/badgejs}
};
$(function(){
$(socialtags_init);
});
})(jQuery);