//$('.detail-nav').before('<a href="https://m.ali213.net/api/qrcode.php?shorturl=zw1qyc" target="_blank"><img style="width:100%;" src="//pbmp.ali213.net/Pics/2023/app_gl_dhxm_750c112.jpg"></a>');
(function(){
	var el = document.createElement("script");
	el.src = "https://sf1-scmcdn-tos.pstatp.com/goofy/ttzz/push.js?cd74a56532ca8728e20e51c528d2497ed7704c14232a30cc7e35fcf98ee83ca71d7d2afe3d33e28ba2e6368b0dbe19868ea22ccffa47c1a7a05232d3921b074f";
	el.id = "ttzz";
	var s = document.getElementsByTagName("script")[0];
	s.parentNode.insertBefore(el, s);
})(window);

var u = navigator.userAgent;
if(u.indexOf('Android') > -1 || u.indexOf('Adr') > -1){
    $(".self .ios").hide();
    $(".rmyx.ios").hide();
    $(".self .android").show();
    $(".rmyx.android").show();

}else{ 
    $(".self .ios").show();
    $(".rmyx.ios").show();
    $(".self .android").hide();
    $(".rmyx.android").hide();
}

$('.img-text-ul').each(function () {
	if($(this).find('.img-text-li').length>4){
		$(this).addClass('active');
		if($(this).parent().find('.load-more-label').length<=0 && $(this).find('.img-text-li').length>8){
			$(this).after('<div class="load-more-label"><span class="more-text">点击展开</span></div>')
		}
	}
});

$('.img-text-container').on('click','.load-more-label',function () {
	if(!$(this).hasClass('active')){
		$(this).prev().removeClass('active');
		$(this).addClass('active').find('.more-text').text('点击收起')
	}else{
		$(this).prev().addClass('active');
		$(this).removeClass('active').find('.more-text').text('点击收起')
	}
});

$('.three-ul').each(function () {
	if($(this).find('.three-li').length>4){
		$(this).addClass('active');
		if($(this).find('.three-li').length>8){
			$(this).after('<div class="load-more-label"><span class="more-text">点击展开</span></div>')
		}
	}
});

$('.three-btn-container').on('click','.load-more-label',function () {
	if(!$(this).hasClass('active')){
		$(this).prev().removeClass('active');
		$(this).addClass('active').find('.more-text').text('点击收起')
	}else{
		$(this).prev().addClass('active');
		$(this).removeClass('active').find('.more-text').text('点击收起')
	}
});

/**
 * 
 */
$(document).ready(function(){

	/*app推广弹窗*/
	function getCookie(name){var strCookies = document.cookie;var cookieName = name + "=";var valueBegin, valueEnd, value;valueBegin = strCookies.indexOf(cookieName);if (valueBegin == -1) return null;valueEnd = strCookies.indexOf(";", valueBegin);if (valueEnd == -1)valueEnd = strCookies.length;value = strCookies.substring(valueBegin+cookieName.length,valueEnd);return unescape(value);}
	function setCookie (name, value) {var argv = setCookie.arguments;var argc = setCookie.arguments.length;var path = (argc > 2) ? argv[2] : null;var expireDays = (argc > 3) ? argv[3] : 365;var domain = (argc > 4) ? argv[4] : "my.com";var secure = (argc > 5) ? argv[5] : false;var date=new Date();date.setTime(date.getTime()+expireDays*24*3600*1000);deleteCookie (name);document.cookie = name + "=" +  escape(value) + ((expireDays == null) ? "" : ("; expires=" + date.toGMTString())) + ((path == null) ? "" : ("; path=" + path));}
	function deleteCookie (name) {  var exp = new Date();  exp.setTime (exp.getTime() - 1); var cval = getCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();}
	var html_b = '<a href="javascript:void(0)" class="download-text">打开游侠APP&nbsp;,&nbsp;查看更多精彩内容</a>';
	$(".unfold-field-download").append(html_b);
	var cookieName = getCookie("app");
	var createIframe=(function(){
	  	var iframe;
	    return function(){
	        if(iframe){
	            return iframe;
	        }else{
	            iframe = document.createElement('iframe');
	            iframe.style.display = 'none';
	            document.body.appendChild(iframe);
	            return iframe;      
	        }
	    }
	})(),
	 	ua = navigator.userAgent.toLowerCase(),
		isAndroid = ua.match(/android/gi),
		isIos = ua.match(/iphone|ipod|ipad/gi),
		isIos9 = isIos && ua.match(/OS\s(\d+)/i)[1] > 8,
		isWeixin = ua.match(/micromessenger/i),
		isQQ = ua.match(/qq/i),
		isChrome = ua.match(/webkit/i),
		isBaidu = ua.match(/baidubrowser/i);
	if(cookieName == null || cookieName == "undefined"){
		if(ua.match(/ali213app/i) != 'ali213app'){
			setCookie("app","app","/",1);
		}else{
			console.log("You are using the App!");
		}
	}else{
		console.log("secend!");
	}
	$("body").delegate(".mask","click",function(){
		$("body .mask").remove();
	});
	//检测屏幕高度  
	//var sheight=$(window).height();
	//scroll() 方法为滚动事件  
	//$(window).scroll(function(){
	//	if($(window).scrollTop()>sheight){
	//		if($('.download-app').length<1){
	//			$("body").append('<a href="javascript:void(0);" class="download-app"></a>');
	//		}
	//	}else{
	//		$(".download-app").remove();
	//	}
	//});
});
$(".unflod-field__mask").click(function(){
	$(".unflod-field__mask").css("display","none");
	$(".download-text").eq(0).css("display","block");
	$(".detail_content").css("height","auto");
});
$("body").delegate(".download-text,.download-app","click",function(){
	var createIframe=(function(){
		  	var iframe;
		    return function(){
		        if(iframe){
		            return iframe;
		        }else{
		            iframe = document.createElement('iframe');
		            iframe.style.display = 'none';
		            document.body.appendChild(iframe);
		            return iframe;      
		        }
		    }
		})(),
 	ua = navigator.userAgent.toLowerCase(),
	isAndroid = ua.match(/android/gi),
	isIos = ua.match(/iphone|ipod|ipad/gi),
	isIos9 = isIos && ua.match(/OS\s(\d+)/i)[1] > 8,
	isWeixin = ua.match(/micromessenger/i),
	isQQ = ua.match(/qq/i),
	isChrome = ua.match(/webkit/i),
	isBaidu = ua.match(/baidubrowser/i);

		if(isWeixin || isQQ){
			var intro = '<div class="mask" style="position:fixed;width: 100%;height: 100%;left:0;top:0;background:rgba(0,0,0,.5);z-index:999999;"><img src="http://3g.ali213.net/images/instruction.png" style="position:absolute;width:15px;height:46px;top:6px;right:18px;"><font style="position:absolute;right:11px;color:#fff;top:60px;font-size:18px;line-height:1;">请在其他浏览器中打开</font></div>';
    		$("body").prepend(intro);
		}else{
			var openIframe=createIframe();
			if(isIos){
				var loadDateTime = new Date();
		        setTimeout(function () {
		            var timeOutDateTime = Date.now();
		            if (timeOutDateTime - loadDateTime < 1000) {
		                window.location.href = "http://www.ali213.net/app/transfer.html?malisy";
		            }else {  
	                    window.close();  
	                }
		        }, 25);
		        openIframe.src = "ali213netYX://xxx?channel=gl&id="+newsid;
			}else if(isAndroid){
				if (isChrome) {
		            //chrome浏览器用iframe打不开得直接去打开，算一个坑
		            window.location.href = "ali213net://xxx?channel=gl&id="+newsid;
		        } else {
		            //抛出你的scheme
		            openIframe.src = "ali213net://xxx?channel=gl&id="+newsid;
		        }
		        setTimeout(function () {
		            window.location.href = "http://www.ali213.net/app/transfer.html?malisy";
		        }, 500);
			}
	}
});

$(".qz_detail_pl").click(function() {
	$('html,body').scrollTop($('.comment_con').offset().top);
});
if(typeof keyword != "undefined" && keyword.length > 0){
	if(keyword=='青年大学习'){
		$('#ALICOMMENT').remove();
	}
}
/*if(typeof keyword != "undefined" && keyword.length > 0){
	if(keyword=='最强蜗牛' && $('.detail_content').length>0){
		var khstr='<a href="//click.ali213.net/ALiClick-311.html" target="_blank"><img src="//pbmp.ali213.net/Pics/2020/sygl3gny_zqwn_650c150.jpg"></a>';
		setTimeout(function(){$('.detail_content').prepend(khstr)},1000);
	}
}*/