tools.share = function(name) { var list = { //微信 ‘wechat‘ : function(selector){ $(selector).append(‘<img src="http://qr.liantu.com/api.php?text=‘+encodeURIComponent(window.location.href)+‘" />‘).show();//在线生成二维码 }, //新浪微博 ‘sina‘ : ‘http://service.weibo.com/share/share.php?title=__shareTitle__&url=__shareUrl__&language=zh_cn‘, //脸书 ‘facebook‘ : ‘http://www.facebook.com/sharer.php?u=__shareUrl__&t=__shareTitle__‘, //推特 ‘twitter‘ : ‘http://twitter.com/?status=__shareUrl__%20-%20__shareTitle__‘, //pin ‘pinterest‘: ‘http://pinterest.com/pin/create/button/?url=__shareUrl__&media=__shareTitle__‘ }; if(typeof(list[name]) == ‘undefined‘) { alert(‘暂未开放‘); return; } else if(typeof(list[name]) == ‘function‘) { list[name](arguments[1]); } else if(typeof(list[name]) == ‘string‘) { var url = list[name].replace(‘__shareUrl__‘,encodeURIComponent(window.location.href)).replace(‘__shareTitle__‘,encodeURIComponent(document.title)); window.open(url,"Both","width=850,height=520,menubar=0,scrollbars=1,resizable=1,status=1,titlebar=0,toolbar=0,location=1"); } }; 调用:tools.share(‘sina‘);
二维码生成工具
http://www.liantu.com/pingtai/
时间: 2024-10-11 01:47:08