// var gClickFlag = false;
var gResizeInitCount = 0;
function veo_commonInit()
{
var gIsAutoPlay = true;
$.each($(".topSlider .sliderItem"), function(_i, _el){
if($(_el).find('.videoWrapper').data("video") !== undefined){
gIsAutoPlay = false;
}
});
$(".topSlider").slick
(
{
dots: true,
infinite: true,
speed: 300,
slidesToShow: 1,
adaptiveHeight: true,
fade: true,
autoplay: gIsAutoPlay,
autoplaySpeed: 5000
}
);
$(".topSlider").on
(
"beforeChange",
function(pEvent, pSlick, pCurrentSlide, pNextSlide)
{
var _video = $(".topSlider").find(".sliderItem[data-slick-index=" + pNextSlide + "]").find(".videoWrapper").data("video");
$(".topSlider").find(".sliderItem").removeClass("active");
$(".topSlider").find(".sliderItem[data-slick-index=" + pNextSlide + "]").addClass("active");
updateSliderVideo($(".topSlider"), $(".topSlider").find(".sliderItem[data-slick-index=" + pNextSlide + "]"), _video);
}
);
/*
$(".topSlider").on
(
"afterChange",
function(pEvent, pSlick, pCurrentSlide)
{
}
);
*/
$(".topSlider").find(".sliderItem").removeClass("active");
$(".topSlider").find(".sliderItem[data-slick-index=0]").addClass("active");
updateSliderVideo($(".topSlider"), $(".topSlider").find(".sliderItem.active"), $(".topSlider").find(".sliderItem.active").find(".videoWrapper").data("video"));
$(".statSlider").slick
(
{
dots: false,
infinite: false,
speed: 300,
slidesToShow: 2,
adaptiveHeight: true,
fade: false,
centerMode: false,
autoplay: false,
autoplaySpeed: 5000,
responsive:
[
{
breakpoint: 760,
settings:
{
slidesToShow: 1,
centerMode: false
}
}
]
}
);
closeAllTeams();
$(window).on
(
"resize",
function(pEvent, pResponsive_str)
{
gResizeInitCount++;
if ((gResizeInitCount < 2) || ($(window).width() != gDisplayWidth))
{
gDisplayWidth = $(window).width();
$("html, body").removeClass("transitionFreeze").addClass("transitionFreeze");
closeAllTeams();
if ($(".campusMenuWrapper").length > 0)
{
updateCampusMenu($(".campusMenuWrapper").find("#campusMenu_faculty"));
}
if ($(".learningwithusMenuWrapper").length > 0)
{
updateLearningwithusMenu($(".learningwithusMenuWrapper").find("#campusMenu_faculty"));
}
if ($(".tabMenuWrapper").length > 0)
{
if(gCurrentTab != '') {
updateTabMenu(gCurrentTab);
}
// 20180115 call closeFaqItems() only when it is declared
if (typeof closeFaqItems !== 'undefined' && typeof closeFaqItems === 'function') {
closeFaqItems();
}
}
setTimeout
(
function ()
{
$("html, body").removeClass("transitionFreeze");
},
10
);
}
}
);
}
function veo_campusInit()
{
$(".campusMenu").find("input[type='radio']").on
(
"change",
function (pEvent)
{
updateCampusMenu($(pEvent.currentTarget));
}
);
gDisplayWidth = $(window).width();
gCurrentCampusSection = $(".campusMenuWrapper").find("#campusMenu_faculty").val();
$(".campusMenuWrapper").find("#campusMenu_faculty").trigger("click");
updateCampusMenu($(".campusMenuWrapper").find("#campusMenu_faculty"));
}
function veo_learningwithusInit()
{
$(".learningwithusMenu").find("input[type='radio']").on
(
"change",
function (pEvent)
{
updateLearningwithusMenu($(pEvent.currentTarget));
}
);
gDisplayWidth = $(window).width();
gCurrentLearningwithusSection = $(".learningwithusMenuWrapper").find("#campusMenu_faculty").val();
$(".learningwithusMenuWrapper").find("#campusMenu_faculty").trigger("click");
}
function updateSliderVideo(pSlider, pSliderItem, pVideo)
{
var _html = null;
var _popVideoType = pSliderItem.data("type");
var _popVideo = pSliderItem.data("id");
_html = '';
if (pVideo != undefined)
{
if ($("body").hasClass("deviceDesktop"))
{
_html += '';
}
}
if ((_popVideoType != undefined) && (_popVideoType != ""))
{
_html += '';
}
pSliderItem.find(".videoWrapper").html(_html);
}
function toggleTeam(pTeam)
{
var _team = $(".staffPanel").find("." + pTeam);
if ($("body").hasClass("mobile"))
{
if (_team.hasClass("active"))
{
closeAllTeams();
}
else
{
closeAllTeams();
_team.addClass("active");
}
}
}
function toggleStaff(pTeam, pStaff)
{
var _team = $(".staffPanel").find("." + pTeam);
var _staff = _team.find("." + pStaff);
var _itemOrder = parseInt(_staff.data("order"));
var _itemRowOrder = _itemOrder % 3;
var _offsetLeft = null;
var _offsetCheck = null;
var _lastRowRemainder = _team.find(".staffItem").length % 3;
var _indicatorOffset = null;
if ($("body").hasClass("mobile"))
{
if (_team.hasClass("active"))
{
if (_staff.hasClass("active"))
{
closeAllStaffs(_team);
}
else
{
closeAllStaffs(_team);
_staff.addClass("active");
}
}
else
{
closeAllTeams();
}
}
else
{
if (_staff.hasClass("active"))
{
closeAllTeams();
}
else
{
closeAllTeams();
_staff.addClass("active");
if (_itemRowOrder == 1)
{
_offsetLeft = 0;
}
else if (_itemRowOrder == 2)
{
_offsetLeft = 1;
}
else if (_itemRowOrder == 0)
{
_offsetLeft = 2;
}
_offsetCheck = 4 - _itemRowOrder;
if (_offsetCheck == 4)
{
_offsetCheck = 1;
}
_indicatorOffset = _offsetLeft;
console.log('_offsetLeft:'+_offsetLeft);
console.log('_indicatorOffset:'+_indicatorOffset);
if ((_itemOrder + _offsetCheck) > _team.find(".staffItem").length)
{
if (_lastRowRemainder == 1)
{
_offsetLeft += 1.5;
_indicatorOffset += 1.5;
}
else if (_lastRowRemainder == 2)
{
_offsetLeft += 1;
_indicatorOffset += 1;
}
else if (_lastRowRemainder == 3)
{
_offsetLeft += 0.5;
_indicatorOffset += 0.5;
}
}
console.log('_offsetLeft 2:'+_offsetLeft);
console.log('_indicatorOffset 2:'+_indicatorOffset);
if ($("body").hasClass("tablet"))
{
_offsetLeft = (_offsetLeft * (STAFF_ITEM_WIDTH_TABLET + (STAFF_ITEM_MARGIN_TABLET * 2)) + STAFF_ITEM_LAST_MARGIN_TABLET) * -1;
console.log('STAFF_ITEM_WIDTH_TABLET:'+STAFF_ITEM_WIDTH_TABLET);
_staff.find(".indicator").css({"left": (_indicatorOffset * 33.33) + "%"});
_staff.find(".staffDesc").css({"left": _offsetLeft + "vw"});
_staff.find(".staffDescMask").css({"left": (_offsetLeft - 1) + "vw"});
}
else
{
_offsetLeft = (_offsetLeft * (320 + (STAFF_ITEM_MARGIN_DESKTOP * 2)) + STAFF_ITEM_LAST_MARGIN_DESKTOP) * -1;
console.log('STAFF_ITEM_WIDTH_DESKTOP:'+STAFF_ITEM_WIDTH_DESKTOP);
console.log('STAFF_ITEM_MARGIN_DESKTOP:'+STAFF_ITEM_MARGIN_DESKTOP);
console.log('STAFF_ITEM_LAST_MARGIN_DESKTOP:'+STAFF_ITEM_LAST_MARGIN_DESKTOP);
console.log('_offsetLeft 3:'+_offsetLeft);
console.log('_indicatorOffset 3:'+ _indicatorOffset);
_staff.find(".indicator").css({"left": (_indicatorOffset * 33.33) + "%"});
_staff.find(".staffDesc").css({"left": _offsetLeft + "px"});
_staff.find(".staffDescMask").css({"left": (_offsetLeft - 10) + "px"});
}
}
}
}
function closeStaffMessage(pTeam, pStaff)
{
var _team = $(".staffPanel").find("." + pTeam);
var _staff = _team.find("." + pStaff);
setTimeout
(
function ()
{
doPageScroll(_staff);
},
200
);
if (_team.hasClass("active"))
{
closeAllStaffs(_team);
}
else
{
closeAllTeams();
}
}
function closeAllTeams()
{
$(".staffPanel").find(".staffTeam").removeClass("active");
$(".staffPanel").find(".staffTeam").find(".staffWrapper").each
(
function (pIndex, pElement)
{
var _totalItems = null;
closeAllStaffs($(pElement));
_totalItems = $(pElement).find(".staffItem").length;
$(pElement).css({"margin-top": ((_totalItems * STAFF_ITEM_HEIGHT_MOBILE * -1) - 10) + "px"});
}
);
}
function closeAllStaffs(pTeam)
{
pTeam.find(".staffItem").removeClass("active");
pTeam.find(".staffItem").each
(
function (pIndex, pElement)
{
var _staffDescHeight = $(pElement).find(".staffDesc").height();
$(pElement).find(".staffDesc").css({"margin-top": ((_staffDescHeight + (STAFF_ITEM_DESC_PADDING_MOBILE * 2)) * -1) + "px"});
}
);
}