<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">$(function()
{
    //google AD
    // (function()
    // {
    //     var googleAd=[
    //         {
    //             google_ad_client:'ca-pub-4450095342289148',
    //             google_ad_slot:'9137478091',
    //             google_ad_width:336,
    //             google_ad_height:280
    //         },
    //         {
    //             google_ad_client:"ca-pub-4450095342289148",
    //             google_ad_slot:"9109557933",
    //             google_ad_width:336,
    //             google_ad_height:280
    //         }
    //     ];
    //     var gaPush=window.adsbygoogle=new Array();
    //     head=$(window.document).find('head')[0];
    //     var content=jQuery('#contentWrap');
    //     var initGoogleAd=function()
    //     {
    //         var script=document.createElement('script');
    //         script.src='https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
    //         head.appendChild(script);
    //     };
    //     var createGoogleAdByIndex=function(index)
    //     {
    //         if(typeof googleAd[index]=='object')
    //         {
    //             if(googleAd[index].google_ad_width&gt;jQuery(window).width())
    //             {
    //                 googleAd[index].google_ad_width=jQuery(window).width();
    //             }
    //             var ins=$('&lt;ins&gt;&lt;/ins&gt;').attr({
    //                 'class':'adsbygoogle',
    //                 'data-ad-client':googleAd[index].google_ad_client,
    //                 'data-ad-slot':googleAd[index].google_ad_slot,
    //                 'data-ad-region':'test',
    //                 'data-page-url':'parameter'
    //             }).css({
    //                 'display':'block',
    //                 'width':googleAd[index].google_ad_width+'px',
    //                 'height':googleAd[index].google_ad_height+'px',
    //                 'margin':'0px auto'
    //             });
    //             return ins;
    //         }
    //         return false;
    //     };
    //     var pElements=content.find('p');
    //     if(pElements.length&gt;(googleAd.length+1))
    //     {
            
    //         //add gad in main content
            
    //         var jumpRange=Math.floor(pElements.length/(googleAd.length+1));
    //         var g;
    //         for(g=0;g&lt;googleAd.length;g++)
    //         {
    //             if(typeof pElements[((g+1)*jumpRange)]!='undefined')
    //             {
    //                 var ins=createGoogleAdByIndex(g);
    //                 if(ins)
    //                 {
    //                     jQuery(pElements[((g+1)*jumpRange)]).after(ins);
    //                     gaPush.push({});
    //                 }
    //             }
    //         }
    //         initGoogleAd();
    //     }
    //     else
    //     {
    //         var ins1=createGoogleAdByIndex(0);
    //         var ins2=createGoogleAdByIndex(1);
    //         if(ins1)
    //         {
    //             content.before(ins1);
    //             gaPush.push({});
    //         }
    //         if(ins2)
    //         {
    //             content.after(ins2);
    //             gaPush.push({});
    //         }
    //         initGoogleAd();
    //     }
    // })();
    
    //auto photo
    (function()
    {
        var hasInstagram=false;
        var c=$('#contentWrap');
        var conf={
            contentWidth:c.width()  
        };
        c.find('img').each(function()
        {
            var imgResizeFlag=true;
            if($(this).hasClass('photoAutoSizeSystem'))
            {
                var format=this.src.split('.');
                $(this).attr('src',window.PHOTO_HOST+'/photo/'+$(this).attr('alt')+'_0_'+conf.contentWidth+'.'+format[1]);
                imgResizeFlag=false;
            }
            else
            {
                var embed=$(this).attr('data-id');
                var facebookEmbed=$(this).attr('data-href');
                var _this=this;
                if(typeof embed!='undefined')
                {
                    var regex=/^embed\_([0-9]+)$/;
                    var embedId=embed.match(regex);
                    if(typeof embedId[1]!='undefined')
                    {
                        if(!isNaN(embedId[1]))
                        {
                            $.ajax({
                                 url:'/api/embed/get',
                                 data:{id:embedId[1]},
                                 dataType:'json',
                                 type:'get',
                                 success:function(data)
                                 {
                                     if(data.status)
                                     {
                                         if(typeof data.data[embedId[1]]!='undefined')
                                         {
                                             var vd=data.data[embedId[1]];
                                             var va=document.createElement('a');
                                             va.href=vd.thumbnail_url;
                                             var ifr=null;
                                             switch(va.hostname)
                                             {
                                                 case 'scontent.xx.fbcdn.net':
                                                    var vdf=vd.format.pop();
                                                    vifr=$(vdf.embed_html);
                                                    if(vdf.width&gt;conf.contentWidth)
                                                    {
                                                        var ratio=conf.contentWidth/vdf.width;
                                                        var nh=vdf.height*ratio;
                                                        vifr.attr({'width':conf.contentWidth,'height':nh});
                                                        ifr=$('&lt;div&gt;&lt;/div&gt;').css({'margin':'5px auto','width':conf.contentWidth+'px','height':nh+'px'}).append(vifr);
                                                    }
                                                    else
                                                    {
                                                        ifr=$('&lt;div&gt;&lt;/div&gt;').css({'margin':'5px auto','width':vdf.width+'px','height':vdf.height+'px'}).append(vifr);
                                                    }
                                                    break;
                                                 case 'i.ytimg.com':
                                                    var ratio=conf.contentWidth/vd.width;
                                                    ifr=$(vd.html).attr({'width':conf.contentWidth,'height':vd.height*ratio});
                                                    break;
                                             }
                                             $(_this).after(ifr);
                                             $(_this).remove();
                                         }
                                     }
                                 }
                            });
                            imgResizeFlag=false;
                        }
                    }
                }
                if(typeof facebookEmbed!='undefined')
                {
                    var div=$('&lt;div&gt;&lt;/div&gt;').attr({'class':'fb-video','data-href':facebookEmbed});
                    $(this).after(div);
                    $(this).remove();
                }
            }
            if(imgResizeFlag)
            {
                $(this).css('max-width',conf.contentWidth+'px');
            }
            if( $(this).hasClass('photoGif') )
            {
                var height = $(this).height();
                var width = $(this).width();
                var delay = $(this).data('delay');
                var frame = $(this).data('frame');
                var src = $(this).attr('src');
                var div = document.createElement("div");
                var GifImg = document.createElement("img");
                var GifImgSrc,GifImgOffsetCorrect;
                var count = 0 ;
                var timeoutTmp , start=true;
                if( width &gt; 300 &amp;&amp; width &gt; 300 )
                {
                    GifImgSrc = '/media/image/button/gif_b.png';
                    GifImgOffsetCorrect = 50;
                }
                else
                {
                    GifImgSrc = '/media/image/button/gif_s.png';
                    GifImgOffsetCorrect = 30;
                }
                $(div).height(height).width(width).css({'background':'url("'+src.replace(/\.jpeg/,'.png')+'") no-repeat','background-position':'0px 0px','position':'relative'});
                $(GifImg).attr('src',GifImgSrc).css({'position':'absolute','top':((height/2)-GifImgOffsetCorrect)+'px','left':(width/2-GifImgOffsetCorrect)+'px'}).appendTo($(div));
                $(this).after(div);
                $(this).remove();
                var loop = function()
                {
                    if( count &lt; frame - 1)
                    {
                        count++;
                    }
                    else
                    {
                        count = 0;
                    }
                    
                    $(div).css({'background-position-x':'-'+(count*width)+'px'});
                    
                    timeoutTmp = setTimeout(loop,delay*10);
                }
                $(div).click(function(){
                    if( start )
                    {
                        $(GifImg).remove();
                        loop();
                        start = false;
                    }
                    else
                    {
                        $(GifImg).appendTo($(this));
                        clearTimeout(timeoutTmp)
                        start = true;
                    }
                });
            }
        });
        $('.photoAutoSizeSystem').each(function()
        {
            $(this).append($('&lt;img&gt;').attr('src',window.PHOTO_HOST+'/photo/'+$(this).attr('data-id')+'_0_'+$(this).width()+'.'+$(this).attr('data-format')));
        });
        c.find('.instagramPhoto').each(function()
        {
            var url=$(this).attr('data-href');
            if(typeof url=='undefined')
            {
                $(this).remove();
            }
            else
            {
                var html='&lt;blockquote class="instagram-media" data-instgrm-captioned data-instgrm-version="6" style=" width:99%"&gt;&lt;a href="'+url+'" target="_blank"&gt;&amp;nbsp;&lt;/a&gt;&lt;/blockquote&gt;';
                $(this).html(html);
                hasInstagram=true;
            } 
        });
        if(hasInstagram)
        {
            var script=document.createElement('script');
            script.src='//platform.instagram.com/en_US/embeds.js';
            document.body.appendChild(script);
        }
    })();
    
    //facebook sdk
    (function()
    {
        $('BODY').append($('&lt;div&gt;&lt;/div&gt;').attr('id','fb-root'));
        (function(d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/zh_TW/sdk.js#xfbml=1&amp;version=v2.5&amp;appId=388014514595363";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
    })();
    
    //self analytics
    (function()
    {
        
        window.caqReady = function()
        {
            cqa('cv', 2, parseInt(window._laqContentId), function (data)
            {
                $('#view_count').html(data[window._laqContentId]);
                $.ajax({
                     url:'/api/viewCount/update',
                     data:{token:window._laqToken,count:data[window._laqContentId]},
                     dataType:'json',
                     type:'post',
                     success:function(data)
                     {
                         
                     }
                 });
            });
        };
        
        if(typeof $_GET.uid!='undefined')
        {
            window._laqUserId=$_GET.uid;
        }
        window._caq = window._caq || [];
        window._caq.push(['_setId', window._laqContentId]);
        window._caq.push(['_setWebSite', 2]);
        window._caq.push(['_setDomain', window.location.hostname]);
        window._caq.push(['_setForwardUser', window._laqUserId]);
        window._caq.push(['_setAuthorId', window._laqWriterId]);
        window._caq.push(['_setAuthorWebSite', 6]);
        
        (function(d, s, id) {
        var js, ref = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//analytics.ipetgroup.com/media/js/ia.js";
        ref.parentNode.insertBefore(js, ref);
        }(document, 'script', 'ipetgroupAnalytics'));
    })();
    
    //sa record
    (function()
    {
        // window._saq = {
        //     siteId : 4,
        //     articleId : window._laqContentId,
        //     categoryId : window.CID,
        //     tagIds : window._laqTagIds
        // };
        // var script = document.createElement('script');
        // script.src = '//cowr.shareba.com/sa.min.js?v=201711242146';
        // script.async = true;
        // script.defer = true;
        // document.getElementsByTagName('head')[0].appendChild(script);
    })();
    
    //right readMore
    (function()
    {
        if(typeof window.CONTENT_ID!='undefined')
        {
            $.ajax({
                url:'/api/contentList/readMoreByTags',
                data: {
                    contentId: window.CONTENT_ID,
                    limit: 6
                },
                dataType:'json',
                type:'post',
                success:function(data)
                {
                    if(data.status)
                    {
                        var wrap=$('#rightReadMore');
                        $.each(data.data,function(k,v)
                        {
                            var tisrc=window.PHOTO_HOST+'/photo/'+v.title_image+'_4_100.'+v.title_image_format;
                            var vti=parseInt(v.title_image,10);
                            if(isNaN(vti))
                            {
                                tisrc=v.title_image;
                                if(tisrc=='')
                                {
                                    tisrc='/media/image/nophoto/100X75.gif';
                                }
                            }
                            var a=$('&lt;a&gt;&lt;/a&gt;').attr({'class':'rightReadMoreBox','href':'/article/'+v.alias_id+'.html'})
                                .append($('&lt;div&gt;&lt;/div&gt;').attr('class','rightReadMoreImgWrap').append($('&lt;img&gt;').attr('src',tisrc)))
                                .append($('&lt;div&gt;&lt;/div&gt;').attr('class','rightReadMoreText').html(v.title));
                            wrap.append(a);
                        });
                    }
                }
            });
        }    
    })();
    
    //bottom readMore
    (function()
    {
        var loadStart=false;
        
        $(window).scroll(function()
        {
            var readyTop=$('#readMore').offset().top-1000;
            if($(this).scrollTop()&gt;readyTop)
            {
                if(loadStart)
                {
                    return false;
                }
                loadStart=true;
                if(typeof window.CONTENT_ID!='undefined')
                {
                    $.ajax({
                         url:'/api/contentList/readMoreByTags',
                         data:{
                             contentId:window.CONTENT_ID,
                             limit:9,
                             offset:6
                         },
                         dataType:'json',
                         type:'post',
                         success:function(data)
                         {
                             if(data.status)
                             {
                                 var wrap=$('#readMore');
                                 $.each(data.data,function(k,v)
                                 {
                                     var tisrc=window.PHOTO_HOST+'/photo/'+v.title_image+'_2_200.'+v.title_image_format;
                                     var vti=parseInt(v.title_image,10);
                                     if(isNaN(vti))
                                     {
                                         tisrc=v.title_image;
                                         if(tisrc=='')
                                         {
                                             tisrc='/media/image/nophoto/220X110.gif';
                                         }
                                     }
                                     var a=$('&lt;a&gt;&lt;/a&gt;').attr({'class':'readMoreBox','href':'/article/'+v.alias_id+'.html'})
                                        .append($('&lt;div&gt;&lt;/div&gt;').attr('class','readMoreImgWrap').append($('&lt;img&gt;').attr('src',tisrc)))
                                        .append($('&lt;div&gt;&lt;/div&gt;').attr('class','readMoreText').html(v.title));
                                     wrap.append(a);
                                     // if((k+1)%2==0)
                                     // {
                                     //     //wrap.append($('&lt;div&gt;&lt;/div&gt;').attr('class','gemini-ad-a2e6ada1-79c8-44e9-98d0-a71222244300'));
                                     // }
                                 });
                                 /*window.Yahoo=null;
                                 window.sectionCode = window.sectionCode || [];
                                 window.sectionCode.push("a2e6ada1-79c8-44e9-98d0-a71222244300");
                                 var p=document.getElementsByTagName('script')[0];
                                 var js=document.createElement('script');
                                 js.src='https://s.yimg.com/av/gemini/ga/gemini.js';
                                 p.parentNode.insertBefore(js,p);*/
                             }
                         }
                     });
                }
            }
            
        });
        
        
    })(); 
    
    //lock copy
    /*(function()
    {
        
        if( window.location.host != "v4loc.enews.com.tw" )
        {
            function iEsc(){ return false; }
            function iRec(){ return true; }
            function DisableKeys()
            {
                if(event.ctrlKey || event.shiftKey || event.altKey || event.keyCode == "123" || event.keyCode == "255" )
                {
                    window.event.returnValue=false;
                    iEsc();
                }
            }
            document.ondragstart=iEsc;
            document.onkeydown=DisableKeys;
            document.oncontextmenu=iEsc;
            if (typeof document.onselectstart !="undefined")
            {
                document.onselectstart=iEsc;
            }
            else
            {
                document.onmousedown=iEsc;
                document.onmouseup=iRec;
            }
            function DisableRightClick(qsyzDOTnet)
            {
                if (window.Event){
                    if (qsyzDOTnet.which == 2 || qsyzDOTnet.which == 3)
                    {
                        iEsc();
                    }
                }
                else
                {
                    if (event.button == 2 || event.button == 3)
                    {
                        event.cancelBubble = true
                        event.returnValue = false;
                        iEsc();
                    }
                }
            }
        }
    })();
    */
});
</pre></body></html>