/* var pageCount = 0 ; */ var vu ; var pos = {afterX:-1,afterY:-1,nowX:0,nowY:0}; var timer ; $(function(){ vu = new VideoUtil(); vu.set_inter(setInterval(function(){ var timer = vu.get_timer() + 1 ; vu.set_timer(timer); }, 1000)); $(document).mousemove(function(e){ showcoords(event,this); }); var bw = $(window).height() - 30; $("#main_tab").css({width:"100%",height:bw+"px"}); $("#side_bar").css({width:"100%",height:bw+"px"}); $(window).resize(function(){ var bw = $(window).height() - 30; $("#main_tab").css({width:"100%",height:bw+"px"}); $("#side_bar").css({width:"100%",height:bw+"px"}); $(".video_count").each(function(i){ var id = $(this).attr("id"); var w = $(this).width(); var h = $(this).height(); CKobject.getObjectById("ck_" + id ).width = w ; CKobject.getObjectById("ck_" + id ).height = h ; }); }); vu.countList( vu.nextPage,"\".np\""); /*jQuery(function($) { $('div.mousewheel_example') .bind('mousewheel', function(event, delta) { var dir = delta > 0 ? 'Up' : 'Down', vel = Math.abs(delta); $(this).text(dir + ' at a velocity of ' + vel); return false; }); }); */ waterMark(); }); $(function(){ $("body").mouseover(function(){ $(".search_emer_video").show(); }); $("body").mouseout(function(){ $(".search_emer_video").hide(); }); $(".search_emer_video").click(function(){ if($(".rsc").is(":hidden")){ $("td").eq(0).animate({width:"70%"},1000); $("td").eq(1).fadeIn(1000); }else{ $("td").eq(0).animate({width:"100%"},1000); $("td").eq(1).fadeOut(1000); } }); }); /* 视频工具栏展示 */ $(".bar").live("click",function(){ if($(this).hasClass("bar_hide")){ var id = $(this).attr("id"); $(this).next().empty(); $(this).removeClass("bar_hide"); $(this).next().slideDown(600); var bw = $(this).next().next().width(); var bl = $(this).width(); var ost = $(this).offset().top; var osl = $(this).offset().left; $(this).next().width(bw-bl); $(this).next().css({top:ost,left:osl+bl}); /*$(this).next().append("" + "" + "" + "");*/ /* $(this).next().append("" + "" + "");*/ $(this).next().append("" + "" ); var interval = setInterval(function(){ if(vu.get_timer() >= 10){ $("#"+id).addClass("bar_hide") ; $("#"+id).next().slideUp(600) ; vu.set_timer(0) ; clearInterval(vu.get_interval()); } },10000); vu.set_interval(interval); }; //
//
//
" + }); /* 监听鼠标是否移动 */ function showcoords(e,obj){ var event = window.event || e; if(pos.nowX==e.clientX && pos.nowY == e.clientY){ // no move }else{ // move pos.afterX = pos.nowX ; pos.afterY = pos.nowY ; pos.nowX = event.clientX; pos.nowY = event.clientY; vu.set_timer(0); } }; /* 鼠标离开工具条事件绑定 */ $(".bar_count").live("mouseleave",function(){ var id = $(this).attr("id"); clearInterval(vu.get_interval()); var ml_timer = setTimeout(function(){ $("#"+id).prev().addClass("bar_hide"); $("#"+id).slideUp(600); },3000); vu.set_ml_timer(ml_timer); }); /* 鼠标移入工具条事件绑定 */ $(".bar_count").live("mouseover",function(){ clearInterval(vu.get_ml_timer()); }); /* 点击搜索框清空水印 */ $("#svp").mousedown(function(){ if($("#svp").find("watermark")){ $(this).removeClass("watermark"); $(this).val(""); } }); /* 搜索框焦点失去 */ $("#svp").focusout(function(){ if($("#svp").val()==""){ waterMark() ; } }); /* 搜索框得到焦点 */ $("#svp").keydown(function(event){ if(event.keyCode==13){ var params = $("#svp").val() == "输入部门、上传人进行查询" ? "" : $("#svp").val() ; if(!params == ""){ $("#searbut").addClass("key_search"); } vu.sbcList(vu.nextPage, "\".np\"", params); }; }); /* 搜索框显示水印 */ function waterMark(){ $("#svp").addClass("watermark"); $("#svp").val("输入部门、上传人进行查询"); } /* 点击搜索框清除水印 */ function downClearWM(){ } /* 侧边描述信息隐藏/显示条 */ $(".rc").on({ "mouseenter":function(){ if($(".rsc").is(":hidden")){ clearTimeout(timer); setTimeout(function(){ $("td").eq(0).animate({width:"70%"},1000); $("td").eq(1).fadeIn(1000); },500); } }, "mouseleave":function(){ clearTimeout(timer); } }); /* 下一页 */ function nextPage(){ vu.nextPage("\".np\""); }; /*$(".np").on("click",function(){ vu.nextPage("\".np\""); });*/ /* 上一页 */ function lastPage(){ vu.lastPage("\".lp\""); }; /*$(".lp").on({"click":function(){ vu.lastPage("\".lp\""); }});*/ /* 侧面关闭按钮 */ $(".close").on({ "click":function(){ $("td").eq(0).animate({width:"100%"},1000); $("td").eq(1).fadeOut(1000); } }); /* 打开关闭描述按钮绑定事件 */ $("#btn_oc_des").live("click",function(){ timer = 0 ; var id = $(this).parent().next().attr("id"); if($(this).parent().prev().hasClass("one_open")){ $(this).parent().prev().removeClass("one_open"); $(this).parent().prev().addClass("one_close"); CKobject.getObjectById("ck_" + id).marqueeClose(); }else{ $(this).parent().prev().removeClass("one_close"); $(this).parent().prev().addClass("one_open"); CKobject.getObjectById("ck_" + id).marqueeLoad(true); } }); /* 暂停继续按钮绑定事件 */ /*$("#btn_pg_des").live("click",function(){ timer = 0 ; var id = $(this).parent().next().attr("id"); if($(this).parent().prev().hasClass("two_open")){ $(this).parent().prev().removeClass("two_open"); $(this).parent().prev().addClass("two_close"); CKobject.getObjectById("ck_" + id).frontAdPause(); }else{ $(this).parent().prev().removeClass("two_close"); $(this).parent().prev().addClass("two_open"); CKobject.getObjectById("ck_" + id).frontAdPause(false); } });*/ /* 打开关闭调整按钮绑定事件 */ $("#btn_oc_adju").live("click",function(){ timer = 0 ; var id = $(this).parent().next().attr("id"); if($(this).parent().prev().hasClass("three_open")){ $(this).parent().prev().removeClass("three_open"); $(this).parent().prev().addClass("three_close"); CKobject.getObjectById('ck_'+id).plugin('adjustment.swf',true); }else{ $(this).parent().prev().removeClass("three_close"); $(this).parent().prev().addClass("three_open"); CKobject.getObjectById('ck_'+id).plugin('adjustment.swf',false); } }); /* 打开关闭视频按钮绑定事件 */ $("#btn_oc_video").live("click",function(){ timer = 0 ; if($(this).parent().prev().hasClass("four_open")){ $(this).parent().prev().removeClass("four_open"); $(this).parent().prev().addClass("four_close"); }else{ $(this).parent().prev().removeClass("four_close"); $(this).parent().prev().addClass("four_open"); } }); VideoUtil = function(){ var _this=this; var pageCount = 0 ; var pageNum = 0 ; var pageList = 0 ; var screen = 1 ; var screen_class = "ao_one" ; /* 当前布局样式 */ var load_flag = true ; var replace_class = {"x":"await_orders","y":"other_await"}; /* 下一个替换样式组 */ var interval = "" ; var inter = "" ; var timer = 0 ; var ml_timer = "" ; /* 重置 */ this.resetPageNo = function(){ pageCount = 0 ; pageNum = 0 ; pageList = 0 ; screen = 1 ; screen_class = "ao_one" ; /* 当前布局样式 */ load_flag = true ; replace_class = {"x":"await_orders","y":"other_await"}; /* 下一个替换样式组 */ /*$(".np").removeAttr("disabled"); $(".lp").attr("disabled","false");*/ }; /* 跟据条件查询总页数 */ this.sbcList = function(fn,fnp,param){ var params = {listNum:5,condition:param}; var url = "/nwyj/ws/cockpit/CockpitService/searchByCondition"; $.post(url,params,function(data){ _this.resetPageNo(); pageCount = data["countPage"]; pageList = data["countList"]; /*$(".lp").attr("disabled","false");*/ $(".lp").empty(); $(".lp").append("上一页"); if(pageCount==1) { /*$(".np").attr("disabled","false");*/ $(".np").empty(); $(".np").append("下一页"); } _this.splitScreen(); if(fn!=""||fn!=null) fn(fnp); },"json"); }; /* 跟据每页显示的条数查询出总页数有多少 */ this.countList = function(fn,param){ var params = {listNum:5}; var url = "/nwyj/ws/cockpit/CockpitService/pageCountByVideo"; $.post(url,params,function(data){ pageCount = data["countPage"]; pageList = data["countList"]; /*$(".lp").attr("disabled","false");*/ if(pageCount==1) { /* $(".np").attr("disabled","false"); */ $(".np").empty(); $(".np").append("下一页"); } _this.splitScreen(); if(fn!=""||fn!=null) fn(param); }); }; /* 得到屏幕数 */ this.getScreen = function(){ return screen; }; /* 得到要替换样式 */ this.get_replace_class = function(){ return replace_class ; }; /* 设置要替换样式 */ this.set_replace_class = function(name){ replace_class = name ; }; this.get_interval = function(){ return interval ; }; this.set_interval = function(iv){ interval = iv ; }; this.get_inter = function(){ return inter ; }; this.set_inter = function(inte){ inter = inte ; }; this.get_timer = function(){ return timer ; }; this.set_timer = function(time){ timer = time ; }; this.get_ml_timer = function(){ return ml_timer ; }; this.set_ml_timer = function(mt){ ml_timer = mt ; }; /* 分屏 */ this.splitScreen = function(){ $("#video_box").empty(); if(pageList<=1){ /* 1屏 */ screen = 1 ; screen_class = "ao_one"; $("#video_box").append("
"); } else if(pageList==2){ /* 2屏 */ screen = 2 ; screen_class = "ao_two"; $("#video_box").append("
" + "
"); } else if(pageList==3){ /* 3屏 */ screen = 3 ; screen_class = "ao_three"; $("#video_box").append("
" + "
" + "
") ; } else{ /* 4屏 */ screen = 4 ; screen_class = "ao_four"; $("#video_box").append("
" + "
" + "
" + "
"); } }; /* 得到屏幕布局样式名 */ this.get_screen_class = function(){ return screen_class; }; /* 执行下一页操作 */ this.nextPage = function(nc){ pageNum++ ; if(pageNum == 2){ $(".lp").empty(); $(".lp").append("上一页"); } if(pageNum >= pageCount) { /* $(".np").attr("disabled","false"); */ $(".np").empty(); $(".np").append("下一页"); pageNum = pageCount; }else{ $(".np").empty(); $(".np").append("下一页"); }; if(pageNum > 1) $(".lp").removeAttr("disabled"); _this.showList(nc); }; /* 执行上一页操作 */ this.lastPage = function(nc){ pageNum-- ; if(pageNum==pageCount-1){ $(".np").empty(); $(".np").append("下一页"); } if(pageNum == 1) { /* $(".lp").attr("disabled","false"); */ $(".lp").empty(); $(".lp").append("上一页"); pageNum = 1 ; /* return; */ } /* if(pageNum < pageCount) { $(".np").removeAttr("disabled"); } */ _this.showList(nc); }; /* 显示当前页面列表项 */ this.showList = function(nc){ var condition = $("#svp").val() == "输入部门、上传人进行查询" ? "" : $("#svp").val() ; var params = {begin:pageNum * 5 - 4, end:pageNum * 5,condition:condition}; var url = "/nwyj/ws/cockpit/CockpitService/queryVideo" ; $.post(url,params,function(data){ if(data){ $("#tbv").empty(); for(var key in data){ /*$("#tbv").append("" + "" + "" + "
部门:" + data[key]["dept_name"] + "
上传人:" + data[key]["oper_name"] + "
上传时间:" + data[key]["oper_time"] + "
描述:" + data[key]["description"] + "
") ;*/ $("#tbv").append("" + "" + "" + "
部门:" + data[key]["dept_name"] + "
上传人:" + data[key]["oper_name"] + "
上传时间:" + data[key]["oper_time"] + "
") ; } if(load_flag){ _this.load_ckplay(data); load_flag = false; } _this.ck_play(); // if($("#searbut").hasClass("key_search")){ // $("#searbut").removeClass("key_search"); $("#tbv").html(function(i,oldHTML){ var key = $("#svp").val() == "输入部门、上传人进行查询" ? "" : $("#svp").val() ; var exp = "/" + key + "/g" ; exp = exp.replace(/\/\//g,"\/"); var ke = eval(exp); var temp = "" + key + "" ; return oldHTML.replace(ke,temp); }); // } }else{ $("#tbv").empty().append("
没有查到相关视频,请更换关键字重新查询。
"); if(pageCount!=1){ pageCount = pageCount - 1; } } }); }; this.ck_play = function(){ // CKobject.getObjectById('ckplayer_a1').videoPlay(); }; /* 视频初始化 */ this.load_ckplay = function(data){ var div_id = ""; var name = ""; for(var i = 0 ; i < screen ; i++){ div_id = $("."+screen_class).eq(i).attr("id"); name = data[i]["name"] + "." + data[i]["fileext"] ; _this.init_ckplay(name, div_id,data[i]["description"]); } }; /* 初始化加载视频 */ this.init_ckplay = function(name, div_id, description){ var host = window.location.host; var flashvars={ f:"http://" + host + "/nwyj/upload/"+name, c:0, p:'0', loaded:'loadedHandler' }; // alert(flashvars.f) var hei = $("#"+div_id).height(); CKobject.embed('/nwyj/page/cockpit/ckplayer/ckplayer.swf',div_id,"ck_" + div_id,'100%',hei,false,flashvars); setTimeout(function(){ _this.add_description("ck_" + div_id, description); },5000); }; /* 得到下一个等待id */ this.next_await = function(){ var await_id = $("."+replace_class["x"]).eq(0).attr("id"); if(await_id==undefined){ var temp = replace_class["x"]; replace_class["x"] = replace_class["y"]; replace_class["y"] = temp; await_id = $("."+replace_class["x"]).eq(0).attr("id"); } $("#"+await_id).removeClass(replace_class["x"]); $("#"+await_id).addClass(replace_class["y"]); return await_id; }; /* 添加描述信息 */ this.add_description = function(ck_id, description){ CKobject.getObjectById(ck_id).marqueeLoad(true); CKobject.getObjectById(ck_id).marqueeLoad(true,'{font color=\'#FFDD00\'}' + description + ',{/font}'); }; }; //VideoUtil类结束 /* 点击视频 */ function ckplay(name,description){ var await_id = vu.next_await(); var host = window.location.host; var flashvars={ f: "http://" + host + '/nwyj/upload/' + name, c:0, p:'1', e:'5', loaded:'loadedHandler' }; var hei = $("#"+await_id).height(); $(".video_count").height(hei); // alert(flashvars.f) CKobject.embed('/nwyj/page/cockpit/ckplayer/ckplayer.swf',await_id,"ck_" + await_id,'100%',hei,false,flashvars); setTimeout(function(){ vu.add_description("ck_" + await_id, description); },5000); }; $("#searbut").on("click",function(){ // vu.resetPageNo(); var params = $("#svp").val() == "输入部门、上传人进行查询" ? "" : $("#svp").val() ; if(!params == ""){ $(this).addClass("key_search"); } vu.sbcList(vu.nextPage, "\".np\"", params); });