您的位置:首页 > 其它

又看到一种新的日志转贴方法

2010-11-12 14:43 232 查看
昨天发了一篇关于日志转贴方法的设置,但是对于不会html的朋友来说实现是有点难度了。呵呵,今天继续研究,看到别一个网站提供了一系列的日志转贴方法。研究了哈,呵呵,可以拿过来使用。方法如下,将下述,这段代码直接复制,一会儿也要粘贴的。  

 

<script type="text/javascript">
<!--

function share_to(m) {
if (m == "qq") {
window
.open(
'http://shuqian.qq.com/post?from=3&title='
+ encodeURIComponent(document.title) + '&uri='
+ encodeURIComponent(document.location.href)
+ '&jumpback=2&noui=1',
'favit',
'width=930,height=470,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes,left='
+ (screen.width - 930) / 2 + ',top='
+ (screen.height - 470) / 2);
} else if (m == "tsina") {
void ((function(s, d, e) {
try {
} catch (e) {
}
var f = 'http://v.t.sina.com.cn/share/share.php?', u = d.location.href, p = [
'url=', e(u), '&title=', e(d.title), '&appkey=330242870']
.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(d.location.href)
+ '&title='
+ e(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") {

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 == "tsohu") {
void ((function(s, d, e) {
var f = 'http://t.sohu.com/third/post.jsp?link=', u = d.location;
function a() {
if (!window
.open(
[f, e(u)].join(''),
'tsohu',
[
'toolbar=0,status=0,resizable=1,width=660,height=470,left=',
(s.width - 660) / 2, ',top=',
(s.height - 470) / 2].join('')))
u.href = [f, e(u)].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 = kw.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 = kaixin_url
;
var data = encodeURIComponent(c);
openPostWindow(url, c, '_blank')
}
add2Kaixin001();
}
else if (m == "qqwb") {
var _t = encodeURIComponent(document.title);
var _url = encodeURIComponent(document.location.href);
var _appkey = encodeURI("4b044984590e4efe977521cd69fe25ca"); //你从腾讯获得的appkey
var _pic = encodeURI(''); //(例如:var _pic='图片url1|图片url2|图片url3....)
var _site = 'http://www.yintai.com'; //你的网站地址
var _u = 'http://v.t.qq.com/share/share.php?title=' + _t + '&url=' + _url + '&appkey=' + _appkey + '&site=' + _site + '&pic=' + _pic;
window
.open(_u, '转播到腾讯微博', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no');
}
}
//-->
</script>


然后,复制到后台,一个设置的选项,





粘贴在这个框中,然后提交修改,就是点击保存。

现在的事件就简单了,

<a class="renren sina" title="新浪" onclick="share_to('tsina');return false;" href="javascript:void(0);">新浪</a>

这行,就会出现新浪,

其他的类似了。看如下

<a href="javascript:void(0);" title="人人网" onclick="share_to('renren');return false;" class="renren"></a>

<a href="javascript:void(0);" title="开心网" onclick="share_to('kaixin001');return false;" class="renren kaixin"></a>

<a href="javascript:void(0);" title="搜狐" onclick="share_to('tsohu');return false;" class="renren sohu"></a>

<a href="javascript:void(0);" title="腾讯空间" onclick="share_to('qq');return false;" class="renren qqzone"></a>

<a href="javascript:void(0);" title="腾讯微博" onclick="share_to('qqwb');return false;" class="renren qqzonewb"></a>

<a href="javascript:void(0);" id="copyContent" onclick="copyTitleAndUrl();" class="copy">复制链接地址</a>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: