/* For Z-Blog erx_Weixin [ https://app.zblogcn.com/?id=15900 ] */
try {
	$(function(){
		var erxWeixinDom = `
	
		复制成功
		
			微信号: MeetyXiao
添加微信好友, 获取更多信息
			 我知道了
我知道了		 
		
	 
 
`, erxWeixinPath = "zb_users/plugin/erx_Weixin/";
		$("body").append(erxWeixinDom);
		if($(".erx-weixin-top").length){
			$("body").prepend('');
		}
		if($(".erx-weixin-bot").length){
			$("body").append('');
		}
		if($(".erx-wx-tel").length){
			var teldom = $(".erx-wx-tel").children("div"), telnum = teldom.html();
			teldom.html(telnum.replace(/\B(?=(\d{4})+(?!\d))/g, '-'));
			teldom.parent().click(function () {
				$(this).toggleClass("erxact");
			});
		}
		$(".erx-wx-close").click(function () {
			$(".erx-weixin-open").removeClass("erxact");
		});
		$.getScript(typeof(bloghost)=="undefined"?'/':bloghost+erxWeixinPath+"js/clipboard.min.js",function() {
			new ClipboardJS('.erx-wx-show, .erx-weixin-auto .erx-wx-btn').on('success', function(e) {
				$(".erx-weixin-copy").addClass("erxact");
				$(".erx-wx-ow .qrcode-ez").addClass("erxshow");
			}).on('error', function(e) {
				alert('\u590d\u5236\u5931\u8d25\uff01');
			});
		});
		$(".erx-weixin-insert .erx-wx-show").click(function () {
			$(".erx-wx-ow .qrcode-ez").removeClass("erxshow");
		});
		var erxWeixinAutoTimer, erxWeixinAuto_days = $(".erx-weixin-auto").attr("data-cookie")*1;
		erxWeixinAuto();
		$(".erx-wx-icon-close").click(function () {
			erxWeixinAuto();
		});
		$(".erx-weixin-auto .erx-wx-btn, .erx-wx-close.erx-wx-btn").click(function () {
			$(".erx-weixin-auto").removeClass("erxact");
			$(".erx-wx-ow .qrcode-ez").removeClass("erxshow");
			clearTimeout(erxWeixinAutoTimer);
			zbp.cookie.set("erxWeixinAuto", 1, erxWeixinAuto_days);
		});
		function erxWeixinAuto(){
			if($(".erx-weixin-auto").length){
				var atime = $(".erx-weixin-auto").attr("data-time")*1,
					cookie = zbp.cookie.get("erxWeixinAuto");
				if(cookie ==  null){
					erxWeixinAutoTimer = setTimeout(function() {
						if(!$(".erx-weixin-copy").hasClass("erxact")){
							$(".erx-weixin-auto").addClass("erxact");
							$(".erx-wx-ow .qrcode-ez").addClass("erxshow");
						}
					}, atime*1000);
				}
			}
		}
	});
} catch(e) {
	if(!window.jQuery && window.console && window.console.error){
		console.error("很遗憾,微信营销客服插件无法启用!原因是当前主题jQuery加载异常,可能缺失或不规范导致,建议联系主题作者修复或换用其它主题。");
	}
}