<?php

// $user_agent = $_SERVER['HTTP_USER_AGENT'];

// $weixin=strpos($user_agent, 'MicroMessenger');



$postarr = array();

foreach($postlist as $key => $post) {

    if($post['first']) {

//        $post['message']=strip_tags($post['message']);

//        echo $post['message'];exit;

        $message = str_replace('size=', '', $post['message']);

        $post['message']=preg_replace("/<(\/?br.*?)>/si","",$message); //过滤br标签

        $postarr = $post;

        unset($postlist[$key]);

        break;

    }

}

$maingroup = $_G['group'];

if(array_key_exists('videolist', $postarr) && $postarr['videolist']) {

    foreach($postarr['videolist'] as $videourl) {

        if(!preg_match('/http:\/\/v\.youku\.com\/v_show\/id_(\S+)\.html/i', $videourl, $match)) {

            continue;

        }

        $postarr['message'] .= '<div class="videoCon"><iframe src="http://player.youku.com/embed/'.$match[1].'" width="240" height="136" frameborder="0"></iframe></div>';

    }

}

?>

<html lang="en">

<head>

    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET ?>">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

	<title>biu分享</title>

	<meta name="Keywords" content=""/>

	<meta name="Description" content=""/>

        <script type="text/javascript" src="assets/js/jquery-1.8.0.min.js"></script>

        <script type="text/javascript" src="assets/js/commondz.js"></script>

        <script type="text/javascript" src="assets/js/artDialog.js"></script>

        <script type="text/javascript" src="assets/js/iframeTools.source.js"></script>

        <link rel="stylesheet" type="text/css" href="assets/css/poshare.css?_hash=20114">

        <link rel="stylesheet" type="text/css" href="assets/css/style.css">

        <style type="text/css">.img_detail{margin-top:5px;}</style>

</head>

<script type="text/javascript">

if(/Android (\d+\.\d+)/.test(navigator.userAgent)){

	var version = parseFloat(RegExp.$1);

	if(version>2.3){

		var phoneScale = parseInt(window.screen.width)/640;

		document.write('<meta name="viewport" content="width=640, minimum-scale = '+ phoneScale +', maximum-scale = '+ phoneScale +', target-densitydpi=device-dpi">');

	}else{

		document.write('<meta name="viewport" content="width=640, target-densitydpi=device-dpi">');

	}

}else{

	document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');

}

</script>

<body >

	<div class="w640">

		<header class="header" >

			<span class="huati"><img src="assets/images/logo.png?20157236544" alt=""></span>

		</header>

		<div class="userinfo cc">

                    <a href="javascript:;" class="img">

                        <?php echo $postarr['avatar']; ?>

                    </a>

                    <dl>

                        <dt><a href="javascript:;" ><?php echo $_G['forum_thread']['author']; ?></a></dt>

                        <dd>被赞了<?php echo $postarr['praisenum']; ?>次</dd>

                    </dl>

                    <span class="right"><?php echo date('m-d H:i',$_G['forum_thread']['dateline']); ?></span>

		</div>

		<div class="content">

                    <div class="detail">

                            <?php echo  $postarr['message'];?>

                            <?php if($postarr['attachment']>0){  ?>

                                <?php foreach($postarr['annexlist']['thumb'] as $val){  ?>

                                    <img src="<?php echo $val?>" alt="">

                                <?php }?>

                            <?php }?>

                            <?php if($postarr['annexlist']['sound']){ ?>

                                <audio src="<?php echo  $postarr['annexlist']['sound'];?>" preload="auto" />

                            <?php }?>	

                    </div>

		</div>

		<div class="operate">

                    <a href="<?php echo $_G['baseurl'];?>mocuzapp.php"><img src="assets/images/a1.jpg" alt=""><?php echo $postarr['praisenum']; ?></a>

		</div>

		<div class="count">

                    <span>浏览 <?php echo $_G['forum_thread']['views']; ?></span>

                    <span>评论 <?php echo $_G['forum_thread']['replies']; ?></span>

		</div>

                <div class="bbs-feed-list">

                    <div class="itm comments"></div>

                    <div class="loading-con" style="text-align:center" id="replay_itm">

                            <img src="assets/images/loading.gif?hash=201503301552" >

                            <span class="loadtext">正在加载中...</span>

                    </div>

                </div> 

		<div class="more">

                    <a href="<?php echo $_G['baseurl']; ?>mocuzapp.php">查看更多精彩回复</a>

		</div>

		<div class="downapp">

                    <a href="<?php echo $_G['baseurl']; ?>mocuzapp.php"><img src="assets/images/downapp.png?_=12414" alt=""><span></span></a>

		</div>

		<div class="shareTip">

                    <img src="assets/images/share.png" alt="">

		</div>

	</div>

	<script type="text/javascript" src="assets/js/detail.js"></script>

    <script type="text/javascript" src='assets/js/jquery.lazyload.min.js?_=20150929164733'></script>

    <script type="text/javascript">

            $(function() {

                $(".img_detail").lazyload({ 

                    effect: "fadeIn"

                });  

            });

        </script>

    <script type="text/javascript">

        var MocuzMobile = {

            Android: function() {

                return /Android/i.test(navigator.userAgent);

            },

            BlackBerry: function() {

                return /BlackBerry/i.test(navigator.userAgent);

            },

            iOS: function() {

                return /iPhone|iPad|iPod/i.test(navigator.userAgent);

            },

            Windows: function() {

                return /IEMobile/i.test(navigator.userAgent);

            },

            any: function() {

                return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Windows());

            }

        };



        //论坛h5客户端加载

        function testClick(cmd,pid,uid,name){

            var tid=<?php echo $_G['tid']?>;  

            if(MocuzMobile.Android()) {

                window.myjs.runJs(""+tid, ""+pid, ""+uid, ""+name);//android

                return;

            }

            if(MocuzMobile.iOS()) {

                window.location.href="objc://"+cmd+":/"+tid+"/"+uid+"/"+pid+"/"+name;

            }

        }

        $(function() {

            var  contentid = '<?php echo $_G['tid']?>';

            var data = {

                'tid'        : '<?php echo $_G['tid']?>'

            };

            DetailHandler.sendDataToClientIOS(data, "getBbsContentInfo");

            if (window.androidclient && window.androidclient.onClientInit) {

                window.androidclient.onClientInit(DetailHandler.json2str(data));

            }

            var contentid = "<?php echo $_G['tid']?>";

            var totalpage = "<?php echo $totalpage?>";

            //加载获取更多内容  



            var tabContainter = $("div.bbs-feed-list");

            var loadinInter   = tabContainter .find('div.loading-con');

            var containter    = tabContainter .find("div.itm");

            var currentP = 1 ,currentLoaded = false ,currentLoading = false ;

            var refresh = function(){

                currentLoading =  true;

                $.ajax({

                    url:"<?php echo $_G['baseurl'].$_G['mocuz_config']['mocuz_type'];?>/index.php?mod=biu_detail&debug=1",

                    type:'GET',

                    data:{tid:contentid,item_view:1,page:currentP},

                    dataType: "html",success:function(html) {

                        var viewLen = $(html).find('li.item-view') .length;

    //                    alert(viewLen)

                        if(viewLen < 9){

                            loadinInter .hide();

                            currentLoaded = true;

                        }else currentP ++;

                        if(viewLen>0&&currentP-1<=totalpage){

                            $(".parameter").remove();

                            containter .append($(html));

                        }else{

                            loadinInter .hide();

                        }

                        currentLoading = false;

                        //评论列表回复的回复

                        tabContainter.find(".reply-box-btn").on("click",function(event){

                            var authorid = $(this).attr("authorid");

                            var data = {

    //                            'username' : $(this).attr("username"),

                                'tid': $(this).attr("commentid")

                            }; 

                            DetailHandler.sendDataToClientIOS(data, "commentReplyKey");

                            if( window.androidclient){

                                window.androidclient.onReplyBtnClick(DetailHandler.json2str(data));

                            }

                        });

                    }

                }) 

            }

            //滚动触发加载

            var scrollTrriget = function(){

                if(currentLoaded || currentLoading) return;

                var bodyTop = document.documentElement.scrollTop ;//document.body.scrollTop; 

//                    if(bodyTop==0) bodyTop = document.body.scrollTop; 

                //滚动到底部时出发函数

                //滚动的当前位置+窗口的高度 >= 整个body的高度

                if(bodyTop+$(window).height() >= $(document.body).height()- 100) refresh();

            }

            window.onload=refresh;

            $(window) .bind('scroll',function(event){scrollTrriget()});

            var AdapterObj = {

                scrollEvent: scrollTrriget

            };

            window.AdapterObj = AdapterObj;

            //==============================

            })

    </script>

</body>

</html>