[javascript]Three parts of javascript code snippet

	<script>
		(function(){
			/*
			if (navigator.userAgent.toLowerCase().indexOf("iphone") == -1){
				$("#id_download_btn img").attr("src" , "http://cache.hinabian.com/mobile/images/downLoadLink.png");
				return;
			}
			*/
			
			var oldurl = "http://a.app.qq.com/o/simple.jsp?pkgname=com.hinabian.migrate";
			var newurl = "http://m.hinabian.com/dlapp.html";
			if (navigator.userAgent.toLowerCase().indexOf("micromessenger") == -1)
			{
				$("#id_download_btn").click(function(){
					location.href = newurl;
				});
			}else{
			
				$("#id_download_btn").click(function(){
					location.href = newurl;
				});
				/*
				$("#id_share_info").click(function(){
					$(this).hide();
				});
				*/
			}			
			
		})();
	
	</script>
	<script>
		(function(){
			if (navigator.userAgent.indexOf("MicroMessenger") == -1)
				return;
			var json_config = JSON.parse(window.SIGNPACKAGE);
			wx.config({
				debug: false ,
				appId: json_config.appId ,
				timestamp: json_config.timestamp,
				nonceStr: json_config.nonceStr,
				signature: json_config.signature ,
				jsApiList: ['onMenuShareTimeline' , 'onMenuShareAppMessage']
			});
			
			var title = "";
			var desc = "";
			var imgUrl = "http://cache.hinabian.com/images/share/logo.jpg";
			var shareLink = location.href;
			wx.ready(function(){
				// 分享到朋友圈
				wx.onMenuShareTimeline({
					title:  '海那边APP,带你了解海外生活,开启你的海外生活!',
					link:	shareLink,
					imgUrl: imgUrl
				});
				// 分享给朋友
				wx.onMenuShareAppMessage({
					title: '了解海外生活,下载海那边APP' , // 分享标题
					desc: '每年几十万华人去到国外,他们在海外生活怎么样?海那边带你了解海外生活,开启你的海外生活!' , // 分享描述
					link: shareLink, // 分享链接
					imgUrl: imgUrl, // 分享图标
					type: '', // 分享类型,music、video或link,不填默认为link
					dataUrl: '' // 如果type是music或video,则要提供数据链接,默认为空
				});
			});			
		})();
	</script>
	<!--统计代码 -->
	<script>
	var _hmt = _hmt || [];
	(function() {
	  var hm = document.createElement("script");
	  hm.src = "//hm.baidu.com/hm.js?41c4562713e00298de3d6b8c5a8192ae";
	  var s = document.getElementsByTagName("script")[0]; 
	  s.parentNode.insertBefore(hm, s);
	})();
	</script>
	<script type="text/javascript">
		$(window).on("orientationchange" , function(){
			$("body").removeClass('redraw');
			$("body").addClass('redraw');
		});	
	</script>

 

你可能感兴趣的:([javascript]Three parts of javascript code snippet)