$(document).keydown(function(event){ 
    if(event.keyCode==13){

        var txt = $('.y_lplist_inp').val();
        if (txt != '') {
            window.location.href = '/video/home?name='+ txt;
        };

    } 
}); 

// 获取 "video" 视频元素时长
$(function(){
    function myFunction(cid){
         cid.each(function(){
            var _this=$(this)
            _this.find('video.video_list_main')[0].addEventListener("loadedmetadata", function(){
            var tol = this.duration;//获取总时长
            var time = parseInt(tol);
            var minutes = parseInt(time / 60);
            var seconds =( time - minutes * 60);
            _this.find('.time_b').html(Appendzero(minutes)+':'+Appendzero(seconds))
         })
     })  
    }
    function Appendzero (obj) { //时间补零
     if (obj < 10) return "0" + obj; else return obj;
    }
    myFunction($('.m_video_box ul li'));
});


//获取url中的参数
function getUrlParam(name){ 
//构造一个含有目标参数的正则表达式对象 
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); 
//匹配目标参数 
var r = window.location.search.substr(1).match(reg); 
//alert(r); 
//返回参数值 
if (r!=null) return decodeURI(r[2]); 
return null; 
} 


var _name = getUrlParam('name'); 
if(_name){
   $('.m_videohead_box').hide();
}else{
   $('.m_videohead_box').show();
}