share.js
5.38 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
function share_to(m) {
if (m == "tsina") {
void ((function(s, d, e) {
try {
} catch (e) {
}
var f = 'http://v.t.sina.com.cn/share/share.php?', u = share_url || d.location.href, ralateUid = tsina_ralateUid || 0, i = share_pic || '', p = ['url=', e(u), '&title=', e(share_title||d.title), '&appkey=', (tsina_appkey || ''), '&ralateUid=', ralateUid].join('');
function a() {
if (!window
.open(
[ f, p ].join(''),
'mb',
[
'toolbar=0,status=0,resizable=1,width=620,height=450,left=',
(s.width - 620) / 2, ',top=',
(s.height - 450) / 2 ].join('')))
u.href = [ f, p ].join('');
}
;
if (/Firefox/.test(navigator.userAgent)) {
setTimeout(a, 0)
} else {
a()
}
})(screen, document, encodeURIComponent));
} else if (m == "douban") {
void (function() {
var d = document, e = encodeURIComponent, s1 = window.getSelection, s2 = d.getSelection, s3 = d.selection, s = s1 ? s1()
: s2 ? s2() : s3 ? s3.createRange().text : '', r = 'http://www.douban.com/recommend/?url='
+ e(share_url || d.location.href)
+ '&title='
+ e(share_title || d.title)
+ '&sel='
+ e(s) + '&v=1', x = function() {
if (!window
.open(r, 'douban',
'toolbar=0,resizable=1,scrollbars=yes,status=1,width=450,height=355,left='
+ (screen.width - 450) / 2 + ',top='
+ (screen.height - 330) / 2))
location.href = r + '&r=1'
};
if (/Firefox/.test(navigator.userAgent)) {
setTimeout(x, 0)
} else {
x()
}
})();
} else if (m == "renren") {
// 官方分享方式2
void ((function(s, d, e) {
if (/renren\.com/.test(d.location))
return;
var f = 'http://share.renren.com/share/buttonshare.do?link=', u =
d.location, l = d.title, p = [
e(u), '&title=', e(l) ].join('');
function a() {
if (!window
.open(
[ f, p ].join(''),
'xnshare',
[
'toolbar=0,status=0,resizable=1,width=626,height=436,left=',
(s.width - 626) / 2, ',top=',
(s.height - 436) / 2 ].join('')))
u.href = [ f, p ].join('');
}
;
if (/Firefox/.test(navigator.userAgent))
setTimeout(a, 0);
else
a();
})(screen, document, encodeURIComponent));
} else if (m == "kaixin001") {
var kw = window
.open(
'',
'kaixin001',
'toolbar=no,titlebar=no,status=no,menubar=no,scrollbars=no,location:no,directories:no,width=570,height=350,left='
+ (screen.width - 570)
/ 2
+ ',top='
+ (screen.height - 420) / 2);
var tempForm = document.createElement('form');
function openPostWindow(url, data, name) {
var tempForm = document.createElement('form');
tempForm.id = 'tempForm1';
tempForm.method = 'post';
tempForm.action = url;
tempForm.target = 'kaixin001';
var hideInput = document.createElement('input');
hideInput.type = 'hidden';
hideInput.name = 'rcontent';
hideInput.value = data;
tempForm.appendChild(hideInput);
document.body.appendChild(tempForm);
tempForm.submit();
document.body.removeChild(tempForm);
}
function add2Kaixin001() {
var u = document.location.href;
var t = document.title;
var c = '' + (document.getSelection ? document.getSelection()
: document.selection.createRange().text);
var iframec = '';
var url = 'http://www.kaixin001.com/repaste/bshare.php?rtitle='
+ encodeURIComponent(t) + '&rurl=' + encodeURIComponent(u)
+ '&from=maxthon';
var data = encodeURIComponent(c);
openPostWindow(url, c, '_blank')
}
add2Kaixin001();
} else if (m == "tqq") {
var _t = encodeURI(share_title || document.title);
var _url = encodeURIComponent(share_url || document.location);
var _appkey = tqq_appkey || '';//你从腾讯获得的appkey
var _pic = share_pic || '';//(例如:var _pic='图片url1|图片url2|图片url3....)
var _assname = tqq_ralateUid || 0;
var _site = share_site || '';//你的网站地址
var _u = 'http://v.t.qq.com/share/share.php?url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic+'&title='+_t + '&assname=' + encodeURI(_assname);
window.open( _u,'', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
} else if (m == 'yohocn') {
var _t = encodeURI(share_title || document.title);
var _url = encodeURIComponent(share_url || document.location);
var _appkey = yoho_appkey || '';//你获得的appkey
var _pic = share_pic || '';//(例如:var _pic='图片url1|图片url2|图片url3....)
var _assname = yoho_ralateUid || 0;
var _site = share_site || 'http://new.yoho.cn/partner/iframe/share';//你的网站地址
var _skn = skn;
var _u = 'http://new.yoho.cn/partner/iframe/share?url='+_url+'&appkey='+_appkey+'&site='+_site+'&skn='+_skn+'&pic='+_pic+'&title='+_t + '&assname=' + encodeURI(_assname) + '&t=' + Math.random();
window.open( _u,'', 'width=475, height=400, toolbar=0, menubar=no, scrollbars=no, resizable=no, status=0,left='+(screen.width - 475)/2 + ',top=' +(screen.height - 400) / 2 );
}
return false;
}
function st_addBookmark(title){
var url = parent.location.href;
if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url,"");
} else if(document.all) { // IE Favorite
window.external.AddFavorite( url, title);
} else if(window.opera) { // Opera 7+
return false; // do nothing
} else {
alert('请按 Ctrl + D 为chrome浏览器添加书签!');
}
}