!function(n,t,i,r){var u=n(t);n.fn.lazyload=function(f){function s(){var t=0;o.each(function(){var i=n(this);if((!e.skip_invisible||i.is(":visible"))&&!n.abovethetop(this,e)&&!n.leftofbegin(this,e))if(n.belowthefold(this,e)||n.rightoffold(this,e)){if(++t>e.failure_limit)return!1}else i.trigger("appear"),t=0})}var h,o=this,e={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:t,data_attribute:"original",skip_invisible:!0,appear:null,load:null};return f&&(r!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),r!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),n.extend(e,f)),h=e.container===r||e.container===t?u:n(e.container),0===e.event.indexOf("scroll")&&h.bind(e.event,function(){return s()}),this.each(function(){var t=this,i=n(t);t.loaded=!1;i.one("appear",function(){if(!this.loaded){if(e.appear){var r=o.length;e.appear.call(t,r,e)}n("<img />").bind("load",function(){var r,u;i.hide().attr("src",i.data(e.data_attribute))[e.effect](e.effect_speed);t.loaded=!0;r=n.grep(o,function(n){return!n.loaded});(o=n(r),e.load)&&(u=o.length,e.load.call(t,u,e))}).attr("src",i.data(e.data_attribute))}});0!==e.event.indexOf("scroll")&&i.bind(e.event,function(){t.loaded||i.trigger("appear")})}),u.bind("resize",function(){s()}),/iphone|ipod|ipad.*os 5/gi.test(navigator.appVersion)&&u.bind("pageshow",function(t){t.originalEvent.persisted&&o.each(function(){n(this).trigger("appear")})}),n(i).ready(function(){s()}),this};n.belowthefold=function(i,f){return(f.container===r||f.container===t?u.height()+u.scrollTop():n(f.container).offset().top+n(f.container).height())<=n(i).offset().top-f.threshold};n.rightoffold=function(i,f){return(f.container===r||f.container===t?u.width()+u.scrollLeft():n(f.container).offset().left+n(f.container).width())<=n(i).offset().left-f.threshold};n.abovethetop=function(i,f){return(f.container===r||f.container===t?u.scrollTop():n(f.container).offset().top)>=n(i).offset().top+f.threshold+n(i).height()};n.leftofbegin=function(i,f){return(f.container===r||f.container===t?u.scrollLeft():n(f.container).offset().left)>=n(i).offset().left+f.threshold+n(i).width()};n.inviewport=function(t,i){return!(n.rightoffold(t,i)||n.leftofbegin(t,i)||n.belowthefold(t,i)||n.abovethetop(t,i))};n.extend(n.expr[":"],{"below-the-fold":function(t){return n.belowthefold(t,{threshold:0})},"above-the-top":function(t){return!n.belowthefold(t,{threshold:0})},"right-of-screen":function(t){return n.rightoffold(t,{threshold:0})},"left-of-screen":function(t){return!n.rightoffold(t,{threshold:0})},"in-viewport":function(t){return n.inviewport(t,{threshold:0})},"above-the-fold":function(t){return!n.belowthefold(t,{threshold:0})},"right-of-fold":function(t){return n.rightoffold(t,{threshold:0})},"left-of-fold":function(t){return!n.rightoffold(t,{threshold:0})}})}(jQuery,window,document);$(document).ready(()=>{function i(n){$("#alert_box_collect p").html(n);$("#alert_box_collect").show(300).delay(2e3).hide(300)}function r(r){if(r.preventDefault(),t)return!1;t=!0;n=$(this);$(this).attr("data-status")=="true"?$.ajax({type:"POST",url:"/api/CancelCollect",dataType:"json",data:{C_SN:n.attr("data-sn")},success:function(r){r.code==200?(n.children("img").attr("src","/images/collect_icon_blue.svg"),n.attr("data-status","false"),i("成功取消收藏")):r.code==300?(alert("請先登入會員"),location.href="https://membercenter.yam.com/Signin?URL="+location.href):i("取消收藏失敗，請再試一次");t=!1}}):$.ajax({type:"POST",url:"/api/getCollectType",dataType:"json",success:function(n){if(n.code==200){tempHtml="";tempHtml='<li><a href="#" class="new_type_edit_name collect_btn_new"><div class="collect_type_img"><img src="/images/plus_icon.png" alt=""><\/div>建立新的分類<\/a><\/li>';$.each(n.data,function(n,t){tempHtml+="<li>";tempHtml+='<a href="#" class="collect_btn" data-ct='+t.CT_SN+">";tempHtml+='<div class="collect_type_img">';tempHtml+=t.CT_PHOTO==""?'<img src="/images/collect_1_big.png" alt="" />':'<img src="https://travelimg.yam.com/ARTICLE/'+t.CT_PHOTO+'?r=true&c=true&w=160&h=120" alt="" />';tempHtml+="<\/div >"+t.CT_NAME+"<\/a>";tempHtml+="<\/li>"});$(".alert_box_collect_content .save_to_collection_ul").html(tempHtml);$(".save_to_collection_ul .collect_btn_new").on("click",u);$(".save_to_collection_ul .collect_btn").on("click",f);$(".alert_box_collect_choose_type").show()}else{if(n.code==300)return alert("請先登入會員"),location.href="https://membercenter.yam.com/Signin?URL="+location.href,!1;i("收藏失敗，請再試一次")}t=!1}})}function u(t){if(t.preventDefault(),n==null)return i("收藏失敗，請再試一次"),$(".alert_box_collect_choose_type").hide(),!1;$(".alert_box_collect_choose_type").hide();$(".alert_box_collect_new").show()}function f(r){if(r.preventDefault(),n==null)return i("收藏失敗，請再試一次"),$(".alert_box_collect_choose_type").hide(),!1;if(t)return!1;t=!0;_A_SN=$(n).attr("data-asn");_CT_SN=$(this).attr("data-ct");_CT_NAME=$(this).text();$.ajax({type:"POST",url:"/api/AddCollect",dataType:"json",data:{CT_SN:_CT_SN,A_SN:_A_SN},success:function(r){r.code==200?(n.children("img").attr("src","/images/collect_icon_yellow.svg"),n.attr("data-status","true"),n.attr("data-sn",r.data),$(".alert_box_collect_choose_type").hide(),i("成功收藏至「"+_CT_NAME+"」")):r.code==300?(alert("請先登入會員"),location.href="https://membercenter.yam.com/Signin?URL="+location.href):i("收藏失敗，請再試一次");t=!1}})}function e(){var n=[],i="";$(".article_list_action_a.collect_icon,.article_actions_a.collect_icon").each(function(){n[$(this).attr("data-asn")]=$(this);i+=i!=""?","+$(this).attr("data-asn"):$(this).attr("data-asn")});$(".index_member_action_login")!=null&&$.ajax({type:"POST",url:"/api/chkCOLLECT",dataType:"json",data:{A_SNs:i},success:function(i){i.code==200&&$.each(i.data,function(t,i){n[i.A_SN].children("img").attr("src","/images/collect_icon_yellow.svg");n[i.A_SN].attr("data-status","true");n[i.A_SN].attr("data-sn",i.C_SN)});t=!1}})}var t=!1,n;$(".article_list_action_a.collect_icon,.article_actions_a.collect_icon").on("click",r);$(".alert_close_btn,.alert_box_collect_overlay,.new_collect_btn.new_cancel_btn").on("click",function(){$(".alert_box_collect_choose_type,.alert_box_collect_new").hide()});$(".edit_collect_type_btn").on("click",function(n){n.preventDefault();$(".alert_box_collect_edit").show()});$(".alert_box_collect_edit .alert_close_btn").on("click",function(n){n.preventDefault();$(".alert_box_collect_edit").hide()});$(".add_collect_type_btn").on("click",function(n){n.preventDefault();$(".alert_box_collect_new").show()});n=null;$(".new_collect_btn.new_add_btn").click(function(r){if(r.preventDefault(),n==null)return i("收藏失敗，請再試一次"),$(".alert_box_collect_choose_type").hide(),!1;if($("#Input_New_CType").val()=="")return i("請輸入分類名稱"),!1;if(t)return!1;t=!0;_CT_NAME=$("#Input_New_CType").val();_A_SN=n.attr("data-asn");$.ajax({type:"POST",url:"/api/addTypeAndCollect",dataType:"json",data:{Name:_CT_NAME,A_SN:_A_SN},success:function(r){r.code==200?(n.children("img").attr("src","/images/collect_icon_yellow.svg"),n.attr("data-status","true"),n.attr("data-sn",r.data),$(".alert_box_collect_new").hide(),$("#Input_New_CType").val(""),i("成功收藏至「"+_CT_NAME+"」")):r.code==300?(alert("請先登入會員"),location.href="https://membercenter.yam.com/Signin?URL="+location.href):i("收藏失敗，請再試一次");t=!1}})});e()});$(document).ready(function(){$(".article_box img").lazyload({effect:"fadeIn",threshold:400});$(".article_box a").each(function(){let n=$(this).attr("href");n!=null&&n.indexOf("http")==0&&n.indexOf("travel.yam.com")<0&&$(this).attr("target","_blank").attr("rel","noreferrer noopener")});setTimeout(function(){$("#googleMap").replaceWith('<iframe frameborder="0" title="'+$("#googleMap").attr("data-title")+'" src="'+$("#googleMap").attr("data-src")+'"><\/iframe>')},2e3);$(".QA_each h3").on("click",function(){$(this).next("p").slideToggle();$(this).next("p").hasClass("open")?($(this).next("p").removeClass("open"),$(this).children(".QA_arrow").css("transform","rotate(-45deg) translateX(0px)")):($(this).next("p").addClass("open"),$(this).children(".QA_arrow").css("transform","rotate(45deg) translateX(-5px)"))})})