95 lines
2.6 KiB
JavaScript
95 lines
2.6 KiB
JavaScript
|
|
||
|
import {layoutResetPlayIpc,playVideoList} from "./tree.js";
|
||
|
function initLayout(number){
|
||
|
var div=setVideoDivHtml(parseInt(number));
|
||
|
$(".mainContentC").html(div);
|
||
|
addLayoutEvent();
|
||
|
}
|
||
|
|
||
|
function addLayoutEvent(){
|
||
|
$(".mainContentC>div").on('click',function(){
|
||
|
$(this).siblings("div").removeClass("statipnIpcSelect");
|
||
|
$(this).addClass("statipnIpcSelect");
|
||
|
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function setVideoDivHtml(number){
|
||
|
var div="";
|
||
|
for(var j=0;j<number;j++){
|
||
|
div+=`<div></div>`;
|
||
|
}
|
||
|
return div;
|
||
|
}
|
||
|
|
||
|
$(".videolayout>div").on('click',function(){
|
||
|
var number=$(this).attr('index');
|
||
|
initLayout(number);
|
||
|
resetIpcVideoData(number)
|
||
|
switch(number){
|
||
|
case "1":
|
||
|
setVideoOneDivSize(this);
|
||
|
break;
|
||
|
case "2":
|
||
|
setVideoTwoDivSize(this);
|
||
|
break;
|
||
|
case "4":
|
||
|
setVideoFourDivSize(this);
|
||
|
break;
|
||
|
case "9":
|
||
|
setVideoNiceDivSize(this);
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
})
|
||
|
|
||
|
function setVideoOneDivSize(that){
|
||
|
// $(that).attr("src","images/oneScreen.png");
|
||
|
// $(".twoScreen").attr("src","images/twoScreenClose.png");
|
||
|
// $(".fourScreen").attr("src","images/fourScreenClose.png");
|
||
|
// $(".niceScreen").attr("src","images/niceScreenClose.png");
|
||
|
$(".mainContentC>div").css("width","100%").css("height","100%");
|
||
|
}
|
||
|
|
||
|
function setVideoTwoDivSize(that){
|
||
|
// $(that).attr("src","images/twoScreen.png");
|
||
|
// $(".oneScreen").attr("src","images/oneScreenClose.png");
|
||
|
// $(".fourScreen").attr("src","images/fourScreenClose.png");
|
||
|
// $(".niceScreen").attr("src","images/niceScreenClose.png");
|
||
|
$(".mainContentC>div").css("width","50%").css("height","100%");
|
||
|
}
|
||
|
|
||
|
function setVideoFourDivSize(that){
|
||
|
// $(that).attr("src","images/fourScreen.png");
|
||
|
// $(".oneScreen").attr("src","images/oneScreenClose.png");
|
||
|
// $(".twoScreen").attr("src","images/twoScreenClose.png");
|
||
|
// $(".niceScreen").attr("src","images/niceScreenClose.png");
|
||
|
$(".mainContentC>div").css("width","50%").css("height","50%");
|
||
|
}
|
||
|
|
||
|
function setVideoNiceDivSize(that){
|
||
|
// $(that).attr("src","images/niceScreen.png");
|
||
|
// $(".oneScreen").attr("src","images/oneScreenClose.png");
|
||
|
// $(".twoScreen").attr("src","images/twoScreenClose.png");
|
||
|
// $(".fourScreen").attr("src","images/fourScreenClose.png");
|
||
|
$(".mainContentC>div").css("width","33.33%").css("height","33.33%");
|
||
|
}
|
||
|
|
||
|
function resetIpcVideoData(number){
|
||
|
if(playVideoList.length==0){
|
||
|
return;
|
||
|
}
|
||
|
if(number>=playVideoList.length){
|
||
|
layoutResetPlayIpc(playVideoList);
|
||
|
}else{
|
||
|
var tempArr=[];
|
||
|
for(var i=0;i<number;i++){
|
||
|
tempArr.push(playVideoList[i])
|
||
|
}
|
||
|
layoutResetPlayIpc(tempArr);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export {initLayout}
|