/
tweet.js
54 lines (41 loc) · 1.22 KB
/
tweet.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
50
51
52
53
54
(function(){
var pluginName = "tweet";
var plugin = function(){
$lib = AtKit.lib();
// Internationalisation
AtKit.addLocalisationMap("en", {
"tweet_title" : "Tweet this page"
});
// Tweet
AtKit.addButton(
'tweet',
AtKit.localisation("tweet_title"),
AtKit.getPluginURL() + 'images/twitter.png',
function(dialogs, functions){
f='http://twitter.com/share?url='+encodeURIComponent(window.location.href)+'&text='+encodeURIComponent(document.title);
a=function(){window.open(f,'twitterui','location=yes,links=no,scrollbars=yes,toolbar=no,status=no,width=550,height=450')};
if(/Firefox/.test(navigator.userAgent)){
setTimeout(a,0)}else{a()
}
},
null, null
);
};
if(typeof window['AtKit'] == "undefined"){
window.AtKitLoaded = function(){
var eventAction = null;
this.subscribe = function(fn) {
eventAction = fn;
};
this.fire = function(sender, eventArgs) {
if (eventAction != null) {
eventAction(sender, eventArgs);
}
};
}
window['AtKitLoaded'] = new AtKitLoaded();
window['AtKitLoaded'].subscribe(function(){ AtKit.registerPlugin(pluginName, plugin); });
} else {
AtKit.registerPlugin(pluginName, plugin);
}
})();