1 2var jq14 = jQuery.noConflict(true); 3 4var wpContent; 5(function($){ 6 7String.prototype.format = String.prototype.f = function () { 8 var s = this, i = arguments.length; 9 while (i--) { 10 s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]); 11 } 12 return s; 13}; 14 15var getUrlParameter = function getUrlParameter(sParam) { 16 var sPageURL = window.location.search.substring(1), 17 sURLVariables = sPageURL.split('&'), 18 sParameterName, 19 i; 20 21 for (i = 0; i < sURLVariables.length; i++) { 22 sParameterName = sURLVariables[i].split('='); 23 24 if (sParameterName[0] === sParam) { 25 return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); 26 } 27 } 28 return false; 29}; 30 31function getParameterByName( name ){ 32 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); 33 var regexS = "[\\?&]"+name+"=([^&#]*)"; 34 var regex = new RegExp( regexS ); 35 var results = regex.exec( window.location.href ); 36 if( results == null ) 37 return ""; 38 else 39 return decodeURIComponent(results[1].replace(/\+/g, " ")); 40} 41 42var getParameterByUrl = function getUrlParameter(sParam) { 43 var sPageURL = window.location.search.substring(1), 44 sURLVariables = sPageURL.split('&'), 45 sParameterName, 46 i; 47 48 for (i = 0; i < sURLVariables.length; i++) { 49 sParameterName = sURLVariables[i].split('='); 50 51 if (sParameterName[0] === sParam) { 52 return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); 53 } 54 } 55 return false; 56}; 57 58 59wpContent = { 60 init: function (onComplete) { 61 var c = wpContent; 62 63 64 c.buildTabContent.init(); 65 66 c.courseTabs.init() 67 68 if($('.nafa-slider').length > 0){ 69 c.slider.init() 70 } 71 72 c.courseGallery.init() 73 c.lightboxGallery.init() 74 75 c.videoControl.init(); 76 c.sideBar.init() 77 if ($('.showcase-graduates').length > 0) { 78 c.showcaseGraduates.init(); 79 } 80 if ($('#faculty-listing').length > 0) { 81 c.faculty.init(); 82 } 83 84 85 if ($('.events').length > 0) { 86 if ($('.alumni-dropdown').length > 0) { 87 c.alumniEvents.init(); 88 } 89 else { 90 c.events.init(); 91 } 92 } 93 if ($('.news').length > 0) { 94 c.news.init(); 95 } 96 if ($('.special-projects').length > 0) { 97 c.specialProjects.init(); 98 } 99 if ($('.testimonials').length > 0) { 100 c.testimonials.init(); 101 } 102 if ($('.interviews').length > 0) { 103 c.interviews.init(); 104 } 105 if ($('.awards-listing').length > 0) { 106 c.awardsListing.init(); 107 } 108 if ($('.commentaries').length > 0) { 109 c.commentaries.init(); 110 } 111 112 if ($('.events-coverage').length > 0) { 113 c.eventsCoverage.init(); 114 } 115 116 if ($('.alumni-listing').length > 0) { 117 c.alumniListing.init(); 118 } 119 120 if ($('.award-detail-tab').length > 0) { 121 c.featuredAlumni.init(); 122 } 123 124 if ($('.projects-listing').length > 0) { 125 c.projectsListing.init() 126 } 127 if ($('.studios-listing').length > 0) { 128 c.studiosListing.init() 129 } 130 if ($('.staffs-listing').length > 0) { 131 c.staffs.init(); 132 } 133 if($('.student-work-slider').length > 0){ 134 c.sliderStudentWork.init(); 135 } 136 if ($('.pr-article-listing').length > 0) { 137 c.prArticleListing.init(); 138 } 139 140 if ($('.tlc-article-listing').length > 0) { 141 c.tlcArticleListing.init(); 142 143 } 144 145 if ($('.tlc-staff-listing').length > 0) { 146 c.tlcStaffListing.init(); 147 148 } 149 150 151 if($('.slider-wrapper').length > 0){ 152 c.sliderListing.init(); 153 } 154 155 156 c.gallerySlider.init(); 157 c.awardDetail.init() 158 c.faqAccordion.init() 159 c.accordion.init(); 160 161 c.contentTabs.init(); 162 163 if ($('.cle-filters').length > 0) { 164 c.cleFilters.init(); 165 } 166 167 if ($('.syt-filters').length > 0) { 168 c.sytFilters.init(); 169 } 170 171 c.facilitiesSlider.init(); 172 c.sytNewsSlider.init(); 173 174 175 c.accordionHashParam.init(); 176 177 if (window.location.href.indexOf("teaching-learning-centre") > -1 && window.location.href.indexOf("profile") > -1) { 178 179 c.tlcStaffDetails.init(); 180 } 181 182 if (window.location.href.indexOf("teaching-learning-centre") > -1 && window.location.href.indexOf("article") > -1) { 183 184 c.tlcArticleDetails.init(); 185 } 186 187 if (window.location.href.indexOf("teaching-learning-centre") > -1 && window.location.href.indexOf("login") > -1) { 188 189 c.tlcLogin.init(); 190 } 191 192 c.tlcMenu.init(); 193 194 if ($('.orientation-container').length > 0) {
195 c.orientationStrokeColorChange.init(); 196 c.orientationRedirectUrl.init(); 197 } 198 199 c.conferenceSlider.init(); 200 201 }, 202 conferenceSlider: { 203 init: function () { 204 205 $("#banner-slider").slick({ 206 dots: true, 207 appendDots: $(".header-content"), 208 autoplay: true, 209 autoplaySpeed: 10000, 210 slide: "div" 211 //lazyLoad: 'ondemand', 212 }); 213 214 $('.cnf-accordion-wrapper .pgrm-accord').click(function() { 215 $(this).next('.cnf-programme-wrapper').slideToggle(); 216 $(this).toggleClass('active'); 217 }); 218 219 adjustBannerImageHeight(); // Initial adjustment 220 221 $(window).on('resize', function() { 222 setTimeout(function() { 223 adjustBannerImageHeight(); 224 console.log("resizing"); 225 }, 500); 226 }); 227 228function adjustBannerImageHeight() { 229 if ($(window).width() < 480) { 230 var mobileImage = $('.conference .banner-wrapper img.mobile'); 231 var bannerImage = $('.conference .banner-wrapper img:not(.mobile)'); 232 var mobileImageHeight = mobileImage.height(); 233 234 bannerImage.css('height', mobileImageHeight); 235 } else { 236 $('.conference .banner-wrapper img').removeAttr('style'); 237 } 238} 239 240 } 241 }, 242 orientationStrokeColorChange: { 243 init: function () { 244 245 if(window.location.href.indexOf("orientation2024") > -1){ 246 if(window.location.href.indexOf("school-of-music") > -1 || window.location.href.indexOf("school-of-theatre") > -1 || window.location.href.indexOf("school-of-dance") > -1 || window.location.href.indexOf("faculty-of-performing-arts") > -1){ 247 $(".stroke-finance").attr("src","/nafa-orientation/theme/default/images/block-orange-stroke.svg"); 248 $(".stroke-library").attr("src","/nafa-orientation/theme/default/images/block-umber-stroke.svg"); 249 $(".stroke-subsidy").attr("src","/nafa-orientation/theme/default/images/block-purple-stroke.svg"); 250 } 251 else if(window.location.href.indexOf("school-of-arts-management") > -1 || window.location.href.indexOf("faculty-of-interdisciplinary-practices") > -1){ 252 $(".stroke-finance").attr("src","/nafa-orientation/theme/default/images/block-beige-stroke.svg"); 253 $(".stroke-library").attr("src","/nafa-orientation/theme/default/images/block-darkgreen-stroke.svg"); 254 $(".stroke-subsidy").attr("src","/nafa-orientation/theme/default/images/block-green-stroke.svg"); 255 } 256 257 } 258 259 } 260 }, 261 orientationRedirectUrl: { 262 init: function () { 263 264 $("div.item").click(function(){ 265 if($(this).children("a.icon.arrow").length > 0){ 266 $(this).children("a.icon.arrow")[0].click(); 267 }else if($(this).children("a.icon.arrow-yellow").length > 0){ 268 $(this).children("a.icon.arrow-yellow")[0].click(); 269 } 270 271 272 }); 273 274 275 276 } 277 }, 278 prArticleListing: { 279 init: function () { 280 var c = wpContent; 281 var urlParams = new URLSearchParams(window.location.search); 282 //init slider 283 c.loader.show($('.pr-slider-parent-wrapper'), true); 284 $('#pr-articles-load-more').hide(); 285 $('.slider-wrapper-img').slick({ 286 dots: true, 287 infinite: true, 288 speed: 300, 289 slidesToShow: 1, 290 arrows: false, 291 adaptiveHeight: true, 292 asNavFor: ".slider-wrapper-info" 293 }); 294 $(".slider-wrapper-info").slick({ 295 dots: false, 296 infinite: true, 297 speed: 300, 298 slidesToShow: 1, 299 arrows: true, 300 adaptiveHeight: true, 301 asNavFor: ".slider-wrapper-img" 302 }); 303 $('.slider-wrapper-img').css('opacity','100'); 304 $('.slider-wrapper-info').css('opacity', '100'); 305 c.loader.hide($('.pr-slider-parent-wrapper')); 306 //getArticlesByType initial load 307 getArticlesByType(); 308 309 var currentType = urlParams.get('type'); 310 if (urlParams.get('type')) { 311 $('#filterDropdownType').text($('#filterType li a[data-type="' + currentType + '"]').text()); 312 } 313 314 function cleanAndPushUrlState() { 315
316 for (const [key, value] of urlParams.entries()) { 317 if (!value) { 318 urlParams.delete(key); 319 } 320 } 321 const newUrl = window.location.pathname + '?' + urlParams.toString(); 322 323 // const newUrl = window.location.pathname; 324 325 console.log("new url", newUrl) 326 window.history.pushState({}, '', newUrl); 327 } 328 329 330 331 function getArticlesByType() { 332 c.loader.show($('.pr-article-wrapper'), true); 333 $.ajax({ 334 url: '/api/corparticlesapi/getarticlesbytype?' + urlParams, 335 type: 'get', 336 contentType: 'application/json', 337 success: function (response) { 338 console.log(response) 339 var tempHTML = ""; 340 if (response.PageCount > 0) { 341 response.Data.forEach(item => { 342 tempHTML += `<div class="pr-article-item"> 343 <a href="research-knowledge-exchange/${item.UrlName}"> 344 <img src="${item.MainImage}"/> 345 </a> 346 <p class="text-color-orange"> 347 <strong> 348 ${item.ArticleType} 349 </strong> 350 </p> 351 <a href="research-knowledge-exchange/${item.UrlName}"><h4><strong>${item.Title}</strong></h4></a> 352 <p>${item.Summary}</p> 353 </div>`; 354 }); 355 } else { 356 tempHTML += `<p>No articles found.</p>`; 357 } 358 359 $('.pr-article-wrapper').html(tempHTML); 360 if ($('.pr-article-item').length < response.PageCount) { 361 console.log 362 $('#pr-articles-load-more').show(); 363 } else { 364 $('#pr-articles-load-more').hide(); 365 } 366 367 368 $('.pr-article-wrapper').fadeIn(); 369 cleanAndPushUrlState(); 370 c.loader.hide($('.pr-article-wrapper')); 371 }, 372 error: function (xhr, textStatus, errorThrown) { 373 console.error('Error:', errorThrown); 374 } 375 }); 376 } 377 378 function getArticlesBySeeMore() { 379 c.loader.show($('.pr-article-wrapper'), false); 380 $.ajax({
381 url: '/api/corparticlesapi/GetArticlesBySeeMore?' + urlParams, 382 type: 'get', 383 contentType: 'application/json', 384 success: function (response) { 385 console.log(response) 386 var tempHTML = ""; 387 response.Data.forEach(item => { 388 tempHTML += `<div class="pr-article-item"> 389 <a href="research-knowledge-exchange/${item.UrlName}"> 390 <img src="${item.MainImage}"/> 391 </a> 392 <p class="text-color-orange"> 393 <strong> 394 ${item.ArticleType} 395 </strong> 396 </p> 397 <a href="research-knowledge-exchange/${item.UrlName}"><h4><strong>${item.Title}</strong></h4></a> 398 <p>${item.Summary}</p> 399 </div>`; 400 }); 401 $('.pr-article-wrapper').append(tempHTML); 402 if ($('.pr-article-item').length < response.PageCount) { 403 console.log 404 $('#pr-articles-load-more').show(); 405 } else { 406 $('#pr-articles-load-more').hide(); 407 } 408 409 410 $('.pr-article-wrapper').fadeIn(); 411 urlParams.set('itemscount', $('.pr-article-item').length); 412 cleanAndPushUrlState(); 413 c.loader.hide($('.pr-article-wrapper')); 414 }, 415 error: function (xhr, textStatus, errorThrown) { 416 console.error('Error:', errorThrown); 417 } 418 }); 419 } 420 421 //loadMore 422 $('#pr-articles-load-more').on('click', function (e) { 423 e.preventDefault(); 424 urlParams.set('itemscount', $('.pr-article-item').length); 425 getArticlesBySeeMore(); 426 }); 427 //dropdown 428 $('.pr-article-listing .dropdown').on('click', function () { 429 $(this).toggleClass("open"); 430 }); 431 $('#filterType li a').on('click', function (e) { 432 e.preventDefault(); 433 urlParams.set('type', $(this).data('type')) 434 urlParams.delete('itemscount'); 435 getArticlesByType(); 436 $('#filterDropdownType').text($(this).text()); 437 }); 438 439 440 441 } 442 } 443 , 444 tlcLogin: { 445 init: function () { 446 if (window.location.href.indexOf("teaching-learning-centre") > -1 && window.location.href.indexOf("login") > -1) { 447 $(".btn").addClass("btn-cus btn-img-right btn-yellow"); 448 } 449 450 451 } 452 } 453 , 454 tlcArticleListing: { 455 init: function () { 456 var c = wpContent; 457 var urlParams = new URLSearchParams(window.location.search); 458 //init slider 459 //c.loader.show($('.pr-slider-parent-wrapper'), true); 460 $('#tlc-articles-load-more').hide(); 461 462 463 //var url = window.location.href.split('?')[0], 464 // parts = url.split("/"), 465 // last_part = parts[parts.length - 1]; 466 467 var url = window.location.href.split('?')[0], 468 parts = url.split("/").filter(segment => segment !== '' && !/^(Action|Preview|Edit|Draft)$/i.test(segment)), 469 last_part = parts[parts.length - 1]; 470 471 472 console.log("part length " + parts.length) 473 console.log("last part url : " + last_part); 474 475 //getArticlesByType initial load 476 urlParams.set('type', last_part); 477 getArticlesByType(); 478 479 480 481 482 483 484 //if (!currentType) {
485 // let urlParams = new URLSearchParams(location.search.substr(1)); 486 // urlParams.set("type", last_part); 487 488 // console.log("url" + urlParams.toString()) 489 //} 490 491 function cleanAndPushUrlState() { 492 493 for (const [key, value] of urlParams.entries()) { 494 if (!value) { 495 urlParams.delete(key); 496 } 497 } 498 //const newUrl = window.location.pathname + '?' + urlParams.toString(); 499 const newUrl = window.location.pathname; 500 501 console.log("new url", newUrl); 502 window.history.pushState({}, '', newUrl); 503 } 504 505 function getArticlesByType() { 506 c.loader.show($('.tlc-article-wrapper'), true); 507 508 509 $.ajax({ 510 url: '/api/tlcarticlesapi/getarticlesbytype?' + urlParams, 511 type: 'get', 512 contentType: 'application/json', 513 success: function (response) { 514 console.log(response) 515 var tempHTML = ""; 516 if (response.PageCount > 0) { 517 response.Data.forEach(item => { 518 tempHTML += `<div class="tlc-article-item"> 519 <a href="${last_part}/article/${item.UrlName}"> 520 <img src="${item.FeaturedImage}"/> 521 </a> 522 523 <a href="${last_part}/article/${item.UrlName}"><h4><strong>${item.Title}</strong></h4></a> 524 525 </div>`; 526 }); 527 } else { 528 tempHTML += `<p>No articles found.</p>`; 529 } 530 531 $('.tlc-article-wrapper').html(tempHTML); 532 if ($('.tlc-article-item').length < response.PageCount) { 533 console.log 534 $('#tlc-articles-load-more').show(); 535 } else { 536 $('#tlc-articles-load-more').hide(); 537 } 538 539 540 $('.tlc-article-wrapper').fadeIn(); 541 cleanAndPushUrlState(); 542 c.loader.hide($('.tlc-article-wrapper')); 543 }, 544 error: function (xhr, textStatus, errorThrown) { 545 console.error('Error:', errorThrown); 546 } 547 }); 548 } 549 550 function getArticlesBySeeMore() { 551 c.loader.show($('.tlc-article-wrapper'), false); 552 $.ajax({
553 url: '/api/tlcarticlesapi/GetArticlesBySeeMore?' + urlParams, 554 type: 'get', 555 contentType: 'application/json', 556 success: function (response) { 557 console.log(response) 558 var tempHTML = ""; 559 response.Data.forEach(item => { 560 tempHTML += `<div class="tlc-article-item"> 561 <a href="${last_part}/article/${item.UrlName}"> 562 <img src="${item.FeaturedImage}"/> 563 </a> 564 565 <a href="${last_part}/article/${item.UrlName}"><h4><strong>${item.Title}</strong></h4></a> 566 567 </div>`; 568 }); 569 $('.tlc-article-wrapper').append(tempHTML); 570 if ($('.tlc-article-item').length < response.PageCount) { 571 console.log 572 $('#tlc-articles-load-more').show(); 573 } else { 574 $('#tlc-articles-load-more').hide(); 575 } 576 577 578 $('.tlc-article-wrapper').fadeIn(); 579 urlParams.set('itemscount', $('.tlc-article-item').length); 580 cleanAndPushUrlState(); 581 c.loader.hide($('.tlc-article-wrapper')); 582 }, 583 error: function (xhr, textStatus, errorThrown) { 584 console.error('Error:', errorThrown); 585 } 586 }); 587 } 588 589 //loadMore 590 $('#tlc-articles-load-more').on('click', function (e) { 591 e.preventDefault(); 592 urlParams.set('itemscount', $('.tlc-article-item').length); 593 getArticlesBySeeMore(); 594 }); 595 //dropdown 596 //$('.tlc-article-listing .dropdown').on('click', function () { 597 // $(this).toggleClass("open"); 598 //}); 599 //$('#filterType li a').on('click', function (e) { 600 // e.preventDefault(); 601 // urlParams.set('type', $(this).data('type')) 602 // urlParams.delete('itemscount'); 603 // getArticlesByType(); 604 // $('#filterDropdownType').text($(this).text()); 605 //}); 606 607 608 609 } 610 } 611 , 612 tlcStaffListing: { 613 init: function () { 614 var c = wpContent; 615 var urlParams = new URLSearchParams(window.location.search); 616 //init slider 617 //c.loader.show($('.pr-slider-parent-wrapper'), true); 618 $('#tlc-articles-load-more').hide(); 619 620 //getArticlesByType initial load 621 //getArticlesByType(); 622 623 var currentType = urlParams.get('type'); 624 625 626 var url = $(location).attr('href'), 627 parts = url.split("/"), 628 second_part = parts[parts.length - 2]; 629 630 console.log("second part url : " + second_part); 631 632 //getArticlesByType initial load 633 urlParams.set('type', second_part); 634 getArticlesByType(); 635 636 function cleanAndPushUrlState() { 637 638 for (const [key, value] of urlParams.entries()) { 639 if (!value) { 640 urlParams.delete(key); 641 } 642 } 643 //const newUrl = window.location.pathname + '?' + urlParams.toString(); 644 const newUrl = window.location.pathname; 645 646 console.log("new url", newUrl); 647 window.history.pushState({}, '', newUrl); 648 } 649 650 function getArticlesByType() { 651 c.loader.show($('.tlc-article-wrapper'), true); 652 653 654 $.ajax({
655 url: '/api/tlcstaffprofilesapi/getarticlesbytype?' + urlParams, 656 type: 'get', 657 contentType: 'application/json', 658 success: function (response) { 659 console.log(response) 660 var tempHTML = ""; 661 if (response.PageCount > 0) { 662 response.Data.forEach(item => { 663 tempHTML += `<div class="tlc-article-item"> 664 <a href="overview/profile/${item.UrlName}"> 665 <img src="${item.ProfileImage}"/> 666 </a> 667 668 <a href="overview/profile/${item.UrlName}"><h4><strong>${item.Name}</strong></h4></a> 669 <p>${item.Designation}</p> 670 <a href="mailto:${item.Email}">${item.Email}</a> 671 </div>`; 672 }); 673 } else { 674 tempHTML += `<p>No staff found.</p>`; 675 } 676 677 $('.tlc-article-wrapper').html(tempHTML); 678 if ($('.tlc-article-item').length < response.PageCount) { 679 console.log 680 $('#tlc-articles-load-more').show(); 681 } else { 682 $('#tlc-articles-load-more').hide(); 683 } 684 685 686 $('.tlc-article-wrapper').fadeIn(); 687 cleanAndPushUrlState(); 688 c.loader.hide($('.tlc-article-wrapper')); 689 }, 690 error: function (xhr, textStatus, errorThrown) { 691 console.error('Error:', errorThrown); 692 } 693 }); 694 } 695 696 function getArticlesBySeeMore() { 697 c.loader.show($('.tlc-article-wrapper'), false); 698 $.ajax({
699 url: '/api/tlcstaffprofilesapi/GetArticlesBySeeMore?' + urlParams, 700 type: 'get', 701 contentType: 'application/json', 702 success: function (response) { 703 console.log(response) 704 var tempHTML = ""; 705 response.Data.forEach(item => { 706 tempHTML += `<div class="tlc-article-item"> 707 <a href="overview/profile/${item.UrlName}"> 708 <img src="${item.ProfileImage}"/> 709 </a> 710 711 <a href="overview/profile/${item.UrlName}"><h4><strong>${item.Name}</strong></h4></a> 712 <p>${item.Designation}</p> 713 </div>`; 714 }); 715 $('.tlc-article-wrapper').append(tempHTML); 716 if ($('.tlc-article-item').length < response.PageCount) { 717 console.log 718 $('#tlc-articles-load-more').show(); 719 } else { 720 $('#tlc-articles-load-more').hide(); 721 } 722 723 724 $('.tlc-article-wrapper').fadeIn(); 725 urlParams.set('itemscount', $('.tlc-article-item').length); 726 cleanAndPushUrlState(); 727 c.loader.hide($('.tlc-article-wrapper')); 728 }, 729 error: function (xhr, textStatus, errorThrown) { 730 console.error('Error:', errorThrown); 731 } 732 }); 733 } 734 735 //loadMore 736 $('#tlc-articles-load-more').on('click', function (e) { 737 e.preventDefault(); 738 urlParams.set('itemscount', $('.tlc-article-item').length); 739 getArticlesBySeeMore(); 740 }); 741 //dropdown 742 //$('.tlc-article-listing .dropdown').on('click', function () { 743 // $(this).toggleClass("open"); 744 //}); 745 //$('#filterType li a').on('click', function (e) { 746 // e.preventDefault(); 747 // urlParams.set('type', $(this).data('type')) 748 // urlParams.delete('itemscount'); 749 // getArticlesByType(); 750 // $('#filterDropdownType').text($(this).text()); 751 //}); 752 753 754 755 } 756 } 757 , 758 tlcArticleDetails: { 759 init: function () { 760 761 762 $(".sf_cols").find(".sf_2cols_1_75").removeClass("sf_2cols_1_75"); 763 $(".sf_cols").find(".tlc-article-col").addClass("sf_2cols_1_75"); 764 765 766 if($(".sub-nav-wrapper.tlc-article-details")[0]){ 767 $(".tlc-main.sub-nav-wrapper").css("display","none"); 768 } 769 770 771 772 } 773 }, 774 tlcStaffDetails: { 775 init: function () { 776 if (window.location.href.indexOf("teaching-learning-centre") > -1 && window.location.href.indexOf("profile") > -1) { 777 $(".sf_cols").find(".sf_2cols_1_75").removeClass("sf_2cols_1_75"); 778 779 } 780 781 782 } 783 }, 784 tlcMenu: { 785 init: function () { 786 $(window).resize(function () { 787 if ($(window).width() <= 768) { 788 if ($(".tlc-menu").hasClass("course-tabs")) 789 $(".tlc-menu").removeClass("course-tabs"); 790 $(".tlc-menu").addClass("mobile-course-tabs"); 791 } 792 else { 793 if ($(".tlc-menu").hasClass("mobile-course-tabs")) { 794 $(".tlc-menu").removeClass("mobile-course-tabs"); 795 $(".tlc-menu").addClass("course-tabs"); 796 } 797 798 } 799 }); 800 801 } 802 } 803 , 804 accordionHashParam: { 805 init: function() { 806 807 var doNotJump = false; 808 //Old accordion 809 if ($('#accordionpage').length > 0) { 810 811 $(window).on('hashchange', function() { 812 813 console.log(doNotJump) 814 815 if (!doNotJump) { 816 817 console.log("adkjashdkad") 818 oldAccHashChange() 819 820 } 821 822 }); 823 824 oldAccHashChange() 825 826 } 827 828 829 830 function oldAccHashChange() { 831 var hash = window.location.hash; 832 833 834 835 if (hash !== 'undefined' && hash != '') { 836 837 if (hash.indexOf("collapseEntry") > -1) { 838 console.log($(hash).length)
839 //$("html, body").animate({ scrollTop: $(hash).offset().top }, 1000); 840 841 $('#accordionpage').find(hash).prev('.panel-heading').trigger('click') 842 843 $('html, body').animate({ 844 scrollTop: $(hash).prev('.panel-heading').parent('.panel').offset().top - 100 845 }, 500); 846 } 847 848 } 849 } 850 851 $('#accordionpage .panel-title a').on('click', function(e){ 852 e.preventDefault(); 853 doNotJump = true 854 855 }) 856 857 858 //New accordion 859 if ($('.faq-list').length > 0) { 860 861 862 $(window).on('hashchange', function() { 863 console.log("dafadsfsd") 864 newAccHashChange() 865 }); 866 867 868 newAccHashChange() 869 } 870 871 function newAccHashChange() { 872 873 var hash = window.location.hash; 874 875 876 877 if (hash !== 'undefined' && hash != '') { 878 console.log($(hash).length) 879 880 881 882 if (hash.split("-").length >= 2) { 883 884 var params = hash.split("-") 885 886 if (params[0] == "#acc") { 887 888 var sel = params[1] 889 890 var count = 1 891 $('.faq-list').find('.accordion').each(function(){ 892 893 console.log(count) 894 if (count == parseInt(sel)) { 895 $(this).addClass("expand") 896 897 $('html, body').animate({ 898 scrollTop: $(this).offset().top - 100 899 }, 500); 900 } 901 902 count++; 903 }) 904 905 } 906 907 } 908 909 910 } 911 } 912 913 } 914 }, 915 sytNewsSlider: { 916 init: function() { 917 if ($('.syt-news-wrapper').length > 0) { 918 $('.syt-news-wrapper').slick({ 919 infinite:true, 920 dots: false, 921 speed: 500, 922 slidesToShow: 3, 923 slidesToScroll: 1, 924 arrows: true, 925 autoplay:true, 926 responsive: [ 927 { 928 breakpoint: 767, 929 settings: { 930 arrows: false, 931 slidesToShow: 1, 932 slidesToScroll: 1 933 } 934 }] 935 }); 936 } 937 } 938 }, 939 facilitiesSlider: { 940 init: function() { 941 942 if ($('.facilities-slider-wrapper').length > 0) { 943 944 $('.facilities-slider-wrapper').slick({ 945 infinite:true, 946 dots: false, 947 speed: 500, 948 slidesToShow: 3, 949 slidesToScroll: 1, 950 arrows: true, 951 autoplay:true, 952 responsive: [ 953 { 954 breakpoint: 767, 955 settings: { 956 arrows: false, 957 slidesToShow: 1, 958 slidesToScroll: 1 959 } 960 }] 961 }); 962 963 $('.facilities-slider-wrapper a.image-popup').magnificPopup({ 964 type: 'image', 965 mainClass: 'mfp-with-zoom cus-max-width', 966 gallery:{ 967 enabled:true 968 }, 969 image: { 970 titleSrc: function(item) { 971 var markup = ''; 972 973 if (item.el[0].hasAttribute("title")) { 974 markup += '<p class="mb-0"><strong>' + item.el.attr('title') + '</strong></p>'; 975 } 976 977 if (item.el[0].hasAttribute("data-desc")) { 978 markup += '<p class="mb-0">' + item.el.attr('data-desc') + '</p>'; 979 } 980 981 if (item.el[0].hasAttribute("data-event")) { 982 markup += '<p>' + item.el.attr('data-event') + '</p>'; 983 } 984 985 if (item.el[0].hasAttribute("data-content")) { 986 markup += '<p>' + item.el.attr('data-content') + '</p>'; 987 } 988 989 990 return markup 991 } 992 }, 993 994 zoom: { 995 enabled: true, 996 997 duration: 300, // duration of the effect, in milliseconds 998 easing: 'ease-in-out', // CSS transition easing function 999 1000 opener: function(openerElement) { 1001 1002 return openerElement.is('img') ? openerElement : openerElement.find('img'); 1003 } 1004 } 1005 1006 }); 1007 1008 } 1009 } 1010 }, 1011 sytFilters: { 1012 init: function() { 1013 1014 1015 var apiUrl = ""; 1016 var urlPushState = ""; 1017 1018 1019 var ddlFilter = $('.syt-filters'); 1020 var listingWrapper = $('.course-gallery.main-listing'); 1021 var loadMore = $('#syt-listing-load-more') 1022 1023 1024 var c= wpContent; 1025 1026 1027 1028 var currtype = getUrlParameter('type'); 1029 1030 if (currtype != '') { 1031 1032 var title = ''; 1033 1034 ddlFilter.children().removeClass("active") 1035 1036 ddlFilter.children().each(function () { 1037 var dataID = $(this).attr('data-value'); 1038 if (dataID == currtype) { 1039 title = $(this).attr('title'); 1040 $(this).addClass("active"); 1041 } 1042 }); 1043 1044 1045 var sel = ddlFilter.children('.active').attr('data-value'); 1046 1047 1048 if (sel != '') { 1049 apiUrl = '/api/CorpSYT/GetCoursesBySeeMore?itemscount=0&type={0}'.f(sel); 1050 urlPushState = '?itemscount=0&type={0}'.f(sel); 1051 } 1052 else { 1053 apiUrl = '/api/CorpSYT/GetCoursesBySeeMore?itemscount=0'; 1054 urlPushState = '?itemscount=0'; 1055 } 1056 1057 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 1058 1059 } else { 1060 1061 ddlFilter.find('a:first-child').addClass("active"); 1062 } 1063 1064 1065 1066 ddlFilter.find('a').unbind().bind('click', function (e) { 1067 e.preventDefault(); 1068 1069 c.loader.show(listingWrapper,true); 1070 1071 1072 var sel = $(this).attr('data-value'); 1073 1074 1075 if ($(this).attr('data-value') != '') { 1076 apiUrl = '/api/CorpSYT/GetCoursesBySeeMore?itemscount=0&type={0}'.f($(this).attr('data-value')); 1077 urlPushState = '?itemscount=0&type={0}'.f($(this).attr('data-value')); 1078 } 1079 else { 1080 apiUrl = '/api/CorpSYT/GetCoursesBySeeMore?itemscount=0'; 1081 urlPushState = '?itemscount=0'; 1082 } 1083 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 1084 1085 ddlFilter.children().each(function () { 1086 if ($(this).hasClass("active")) { 1087 $(this).removeClass("active"); 1088 } 1089 }); 1090 $(this).addClass("active"); 1091 1092 }); 1093 1094 // event click on seemore button in testimonials page add by tin 1095 loadMore.bind('click', function (e) { 1096 e.preventDefault(); 1097 1098 c.loader.show(listingWrapper); 1099 1100 var type = getUrlParameter('type'); 1101 1102 1103 if (type == "") { 1104 1105 var selType = $('.syt-filters').find('a.active').data("value"); 1106 1107 if (selType == "") { 1108 apiUrl = '/api/CorpSYT/GetCoursesBySeeMore?itemscount={0}'.f(listingWrapper.children('a').length); 1109 urlPushState = '?itemscount=0'; 1110 } else { 1111 apiUrl = '/api/CorpSYT/GetCoursesBySeeMore?itemscount={0}&type={1}'.f(listingWrapper.children('a').length, selType); 1112 urlPushState = '?itemscount=0&type={0}'.f(selType); 1113 } 1114 1115 } 1116 else { 1117 apiUrl = '/api/CorpSYT/GetCoursesBySeeMore?itemscount={0}&type={1}'.f(listingWrapper.children('a').length, type); 1118 urlPushState = '?itemscount=0&type={0}'.f(type); 1119 } 1120 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, "load-more"); 1121 }); 1122 1123 1124 $('.content-search-box.syt-search-box.landing').keyup(function(event) { 1125 1126 event.preventDefault(); 1127 if (event.keyCode === 13) { 1128 var query = $(this).val(); 1129 1130 console.log(query) 1131 1132 var defaultApiShowMoreUrlSearch = "/api/CorpSYT/GetCoursesBySearch?term={0}"; 1133 var defaultPushStareShowMoreUrlSearch = "?term={0}"; 1134 1135 if (query != "") { 1136 apiUrl = defaultApiShowMoreUrlSearch.f(query); 1137 urlPushState = defaultPushStareShowMoreUrlSearch.f(query); 1138 } 1139 1140 var action = "filtering" 1141 1142 1143 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, action); 1144 1145 } 1146 }); 1147 1148 $('.content-search-box.syt-search-box.main-type').keyup(function(event) { 1149 console.log("bind?") 1150 event.preventDefault(); 1151 if (event.keyCode === 13) { 1152 var query = $(this).val(); 1153 1154 console.log(query) 1155 1156 var type = $(this).data("type") 1157 1158 var defaultApiShowMoreUrlSearch = "/api/CorpSYT/GetCoursesBySearchNMainType?maintype={0}&term={1}"; 1159 var defaultPushStareShowMoreUrlSearch = "?type={0}term={1}"; 1160 1161 if (query != "") { 1162 apiUrl = defaultApiShowMoreUrlSearch.f(type, query); 1163 urlPushState = defaultPushStareShowMoreUrlSearch.f(type, query); 1164 } 1165 1166 var action = "filtering" 1167 1168 1169 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, action); 1170 1171 } 1172 }); 1173 1174 1175 function GetDataShowMore(flagDropdow, apiUrl, urlPushState, nameList, action) { 1176 // var $t = $(this); 1177 var items; 1178 var dataItems = ""; 1179 1180 $.ajax({
1181 url: apiUrl, 1182 success: function (data) { 1183 if (data.Result) { 1184 1185 1186 if (action == "filtering") { 1187 listingWrapper.html('') 1188 } 1189 1190 1191 $.each(data.Data, function (index, item) { 1192 1193 1194 var itemHTML = ""; 1195 1196 1197 itemHTML = `<a data-course-category="centre-for-lifelong-education" href="/courses/courses-for-children/${item.UrlName}">` 1198 1199 1200 + `<div class="course-gallery-item gallery-item">` 1201 + `<img src="${item.ProfileImage}" />` 1202 + `<p class="course-item-text gallery-item-text">` 1203 + `${item.Title}` 1204 + `</p>` 1205 + `</div>` 1206 1207 + `</a>` 1208 1209 1210 1211 if (itemHTML != "") { 1212 dataItems += itemHTML; 1213 } 1214 1215 1216 1217 1218 }); 1219 1220 1221 listingWrapper.append(dataItems); 1222 1223 1224 1225 if ($(listingWrapper).children().length >= data.PageCount) { 1226 loadMore.hide(); 1227 1228 if ($('#syt-listing-load-more-main-type').length > 0) { 1229 $('#syt-listing-load-more-main-type').hide(); 1230 } 1231 } else { 1232 loadMore.show(); 1233 1234 if ($('#syt-listing-load-more-main-type').length > 0) { 1235 $('#syt-listing-load-more-main-type').show(); 1236 } 1237 } 1238 1239 1240 1241 //For anchor with browser back 1242 var currentUrl = window.location; 1243 if (window.location.search.length) { 1244 var currentUrl = window.location.href.split('?')[0]; 1245 } 1246 urlPushState = currentUrl + urlPushState; 1247 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children('a').length)); 1248 window.history.pushState(null, null, urlPushState); 1249 } 1250 }, 1251 error: function (jqXHR, textStatus, errorThrown) { 1252 c.loader.hide(nameList); 1253 }, 1254 complete: function () { 1255 c.loader.hide(nameList); 1256 } 1257 }); 1258 } 1259 } 1260 }, 1261 cleFilters: { 1262 1263 init: function() { 1264 var c= wpContent; 1265 1266 $('.course-tab-item-wrapper').hover(function(){ 1267 1268 if (!$(this).find('.cle-dropdown').hasClass("active")) { 1269 $(this).find('.cle-dropdown').addClass("active") 1270 } 1271 1272 }, function() { 1273 1274 if ($(this).find('.cle-dropdown').hasClass("active")) { 1275 $(this).find('.cle-dropdown').removeClass("active") 1276 } 1277 }) 1278 1279 1280 $('.cle-dropdown div').on('click', function(){ 1281 window.location.href = $(this).attr('data-url') 1282 1283 }) 1284 1285 $('.cle-mobile-dd div').on('click', function(){ 1286 window.location.href = $(this).attr('data-url') 1287 1288 }) 1289 1290 1291 $('.mobile-course-tabs a:first-child').on('click', function() { 1292 1293 if (!$(this).next('ul').hasClass("active")) { 1294 1295 $(this).next('ul').slideDown( "slow", function() { 1296 $(this).addClass("active") 1297 }); 1298 1299 } else { 1300 1301 1302 $(this).next('ul').slideUp( "slow", function() { 1303 $(this).removeClass("active") 1304 }); 1305 } 1306 1307 }) 1308 1309 1310 var apiUrl = ""; 1311 var urlPushState = ""; 1312 1313 1314 var ddlFilter = $('.cle-filters .drop-down-group'); 1315 var listingWrapper = $('.course-gallery.main-listing'); 1316 var loadMore = $('#cle-listing-load-more') 1317 1318 /* Start CLE Course Filter */ 1319 1320 /*start autocomplete*/ 1321 var searchInput = $('.cle-search-box'); 1322 searchInput.after('<div class="cle-search-autocomplete"> </div>'); 1323 var autocompleteDropdown = $('.cle-search-autocomplete'); 1324 autocompleteDropdown.css('top', searchInput.outerHeight()); 1325 1326 initAutoComplete(searchInput, autocompleteDropdown); 1327 1328 function initAutoComplete(input, autocomplete) { 1329 1330 $(document).on('click', function(event) { 1331 var target = $(event.target); 1332 if ( 1333 !target.is(searchInput) && 1334 !target.closest(searchInput).length 1335 ) { 1336 autocomplete.hide(); 1337 } 1338 }); 1339 1340 input.on('keyup', function() { 1341 if (event.keyCode === 13) { 1342 return; // Skip code execution 1343 } 1344 1345 autocomplete.css('top', input.outerHeight()); 1346 var query = $(this).val().trim(); 1347 if ($(this).val().trim().length >= 2) { 1348 1349 $('.cle-search-autocomplete').hide(); 1350 1351 var params = new URLSearchParams(window.location.search); 1352 1353 if (query != '') { 1354 params.set('term', query); 1355 } 1356 var apiUrl = '/api/CorpCLE/GetCoursesByFilter?' + params; 1357 var urlPushState = '?' + params; 1358 1359 var action = "filtering"; 1360 1361 1362 1363 $.ajax({
1364 url: apiUrl, 1365 method: 'GET', 1366 success: function(data) { 1367 // Clear previous results 1368 autocomplete.empty(); 1369 //Display suggestions 1370 if (data.Data.length > 0) { 1371 $.each(data.Data.slice(0, 10), function(index, item) { 1372 var option = $('<div>').text(item.Title).addClass('autocomplete-item'); 1373 1374 // Click event for selecting an item 1375 option.on('click', function() { 1376 input.val(item.Title); 1377 autocomplete.empty(); 1378 autocomplete.hide(); 1379 filterByApplyBtn(); 1380 }); 1381 1382 autocomplete.append(option); 1383 }); 1384 } else { 1385 // No suggestions 1386 var option = $('<div>').text('No results found').addClass('autocomplete-item-disabled'); 1387 autocomplete.append(option); 1388 } 1389 autocomplete.show(); 1390 }, 1391 error: function() { 1392 // Handle error 1393 autocomplete.empty(); 1394 var option = $('<div>').text('Error occurred').addClass('autocomplete-item-disabled'); 1395 autocomplete.append(option); 1396 } 1397 }); 1398 } 1399 else { 1400 autocomplete.hide(); 1401 } 1402 }); 1403 } 1404 /*end autocomplete*/ 1405 1406 //Tick checkboxes onload based on url query 1407 function setCheckboxValues(name) { 1408 var queryParams = urlParams.get(name); 1409 if (queryParams !== null) { 1410 queryParams = queryParams.split(','); 1411 1412 if (queryParams.includes("all")) { 1413 $('input[type="checkbox"][name="' + name + '"]').prop('checked', true); 1414 } else { 1415 queryParams.forEach(function(value) { 1416 $('input[type="checkbox"][name="' + name + '"][data-value="' + value + '"]').prop('checked', true); 1417 }); 1418 } 1419 } 1420 } 1421 1422 var queryParams = {}; 1423 var urlParams = new URLSearchParams(window.location.search); 1424 setCheckboxValues('type'); 1425 setCheckboxValues('benefit'); 1426 setCheckboxValues('interest'); 1427 1428 queryParams = urlParams.get('term'); 1429 if (queryParams != null ){ 1430 $('.cle-search-box').val(queryParams); 1431 } 1432 1433 // queryParams = urlParams.get('type'); 1434 // if(queryParams != null) { 1435 // queryParams = queryParams.split(','); 1436 1437 // if(queryParams.includes("all")){ 1438 // $('input[type="checkbox"][name="type"]').prop('checked', true); 1439 // } else { 1440 // queryParams.forEach(function(value) { 1441 // $('input[type="checkbox"][name="type"][data-value="' + value + '"]').prop('checked', true); 1442 // }); 1443 // } 1444 // } 1445 1446 // queryParams = urlParams.get('benefit'); 1447 // if(queryParams != null) { 1448 // queryParams = queryParams.split(','); 1449 1450 // if(queryParams.includes("all")){ 1451 // $('input[type="checkbox"][name="benefit"]').prop('checked', true); 1452 // } else { 1453 // queryParams.forEach(function(value) { 1454 // $('input[type="checkbox"][name="benefit"][data-value="' + value + '"]').prop('checked', true); 1455 // }); 1456 // } 1457 // } 1458 1459 // queryParams = urlParams.get('interest'); 1460 // if(queryParams != null) { 1461 // queryParams = queryParams.split(','); 1462 1463 // if(queryParams.includes("all")){ 1464 // $('input[type="checkbox"][name="interest"]').prop('checked', true); 1465 // } else { 1466 // queryParams.forEach(function(value) { 1467 // $('input[type="checkbox"][name="interest"][data-value="' + value + '"]').prop('checked', true); 1468 // }); 1469 // } 1470 // } 1471 1472 1473 1474 // $('.checkbox-container input[type="checkbox"]').each(function() { 1475 // var checkbox = $(this); 1476 // var paramName = checkbox.data('type'); 1477 // var paramValue = checkbox.val(); 1478 1479 // if (params[paramName] && params[paramName].indexOf(paramValue) !== -1) { 1480 // checkbox.prop('checked', true); 1481 // } 1482 // }); 1483 1484 var defaultFontSizes = {}; 1485 1486 $('#course-overview').find('*').each(function() { 1487 var elementType = $(this).prop('tagName').toLowerCase(); 1488 var fontSize = parseFloat($(this).css('font-size')); 1489 defaultFontSizes[elementType] = fontSize; 1490 }); 1491 var fontSizeStage = 0; 1492 $('.font-button-content a').click(function(e) { 1493 e.preventDefault(); 1494 var action = $(this).attr('id'); 1495 $('#course-overview').find('*').each(function() { 1496 var elementType = $(this).prop('tagName').toLowerCase(); 1497 1498 if ($(this).closest('.font-buttons-wrapper').length > 0) { 1499 return; 1500 } 1501 1502 if (action === 'font-decrease' && fontSizeStage > -2) { 1503 $(this).css('font-size', parseFloat($(this).css('font-size')) - 2 + 'px'); 1504 } else if (action === 'font-increase' && fontSizeStage < 6) { 1505 $(this).css('font-size', parseFloat($(this).css('font-size')) + 2 + 'px'); 1506 } else if (action === 'font-default') { 1507 $(this).css('font-size', defaultFontSizes[elementType] + 'px'); 1508 } 1509 }); 1510 if (action === 'font-decrease' && fontSizeStage > -2) { 1511 fontSizeStage--; 1512 } 1513 else if (action === 'font-increase' && fontSizeStage < 6) { 1514 fontSizeStage++; 1515 } 1516 else if (action === 'font-default') { 1517 fontSizeStage = 0; 1518 } 1519 }); 1520 $('.cle-int-dropdown .header-text').on('click', function() { 1521 if ($(window).width() <= 768) { 1522 $('.cle-int-dropdown .cle-checkbox-wrapper').slideToggle(); 1523 $('.cle-int-dropdown').toggleClass('active'); 1524 } 1525 }); 1526 1527 let timeoutId; 1528 //Change filter function to onclick in mobile 1529 function checkMobileFilter(){ 1530 if ($(window).width() <= 768) { 1531 $('input[type="checkbox"][name="interest"], input[type="checkbox"][name="type"], input[type="checkbox"][name="benefit"]').on('change', function() { 1532 clearTimeout(timeoutId); 1533 timeoutId = setTimeout(filterByApplyBtn, 200); 1534 });
1535 } else { 1536 $('input[type="checkbox"][name="interest"], input[type="checkbox"][name="type"], input[type="checkbox"][name="benefit"]').off('change', filterByApplyBtn); 1537 $('.cle-int-dropdown .cle-checkbox-wrapper').css('display',''); 1538 $('.cle-int-dropdown .header-text span').text("I'm interested in").css('color',''); 1539 } 1540 }; 1541 1542 $(document).on('click', function(event) { 1543 if ($(window).width() <= 768) { 1544 var clickedElement = $(event.target); 1545 if (!clickedElement.closest('.cle-int-dropdown').length && !clickedElement.hasClass('header-text')) { 1546 $('.cle-int-dropdown .cle-checkbox-wrapper').slideUp(); 1547 } 1548 } 1549 }); 1550 1551 checkMobileFilter(); 1552 $(window).resize(function () { 1553 checkMobileFilter(); 1554 }); 1555 1556 $('#cle-filter-btn').on('click', function() { 1557 event.preventDefault(); 1558 filterByApplyBtn(); 1559 }); 1560 1561 1562 //Check if [all] interest is checked 1563 $('input[name="interest"][data-value="all"]').on('change', function() { 1564 const isChecked = $(this).prop('checked'); 1565 $('input[name="interest"]').prop('checked', isChecked); 1566 }); 1567 1568 $('input[name="interest"]:not([data-value="all"])').on('change', function() { 1569 const allCheckbox = $('input[name="interest"][data-value="all"]'); 1570 const areAllChecked = $('input[name="interest"]:not([data-value="all"])').length === $('input[name="interest"]:not([data-value="all"]):checked').length; 1571 allCheckbox.prop('checked', areAllChecked); 1572 }); 1573 1574 //Clear filter 1575 $('#cle-filter-clear-btn').on('click', function() { 1576 if($('input[type="checkbox"][name="interest"]:checked, input[type="checkbox"][name="type"]:checked, input[type="checkbox"][name="benefit"]:checked').length > 0 || $('.cle-course-listing .cle-search-box').val() != '') 1577 { 1578 $('input[type="checkbox"][name="interest"], input[type="checkbox"][name="type"], input[type="checkbox"][name="benefit"]').prop('checked', false); 1579 $('.cle-course-listing .cle-search-box').val(''); 1580 filterByApplyBtn(); 1581 } 1582 }); 1583 1584 function filterByApplyBtn() { 1585 $('.course-gallery-wrapper h4 strong').text('SEARCH RESULTS'); 1586 const searchBoxVal = $('.cle-course-listing .cle-search-box').val().trim(); 1587 const selectedType = $('input[name="type"]:checked').map(function() { 1588 return $(this).data('value'); 1589 }).get(); 1590 const selectedBenefit = $('input[name="benefit"]:checked').map(function() { 1591 return $(this).data('value'); 1592 }).get(); 1593 const selectedInterest = $('input[name="interest"]:checked').map(function() { 1594 return $(this).data('value'); 1595 }).get(); 1596 1597 if (selectedInterest.includes('all')) { 1598 selectedInterest.splice(0, selectedInterest.length, 'all'); 1599 } 1600 1601 let params = {}; 1602 1603 if (searchBoxVal.length > 0) { 1604 params['term'] = searchBoxVal; 1605 } 1606 if (selectedType.length > 0) { 1607 params['type'] = selectedType.join(','); 1608 } 1609 if (selectedBenefit.length > 0) { 1610 params['benefit'] = selectedBenefit.join(','); 1611 } 1612 if (selectedInterest.length > 0) { 1613 params['interest'] = selectedInterest.join(','); 1614 } 1615 1616 if ($(window).width() <= 768) { 1617 //append selected to mobile dropdown 1618 const formattedInterests = selectedInterest.map(function(interest) { 1619 return interest.replace(/-/g, ' ').replace(/\w\S*/g, function(txt) { 1620 return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); 1621 }); 1622 }).join(', '); 1623 $('.cle-int-dropdown .header-text span').text(formattedInterests).css('color', 'black'); 1624 if ($('.cle-int-dropdown .header-text span').text() == ''){ 1625 $('.cle-int-dropdown .header-text span').text("I'm interested in").css('color',''); 1626 } 1627 } 1628 var paramString = ($.param(params) != "") ? "?" + $.param(params) : ""; 1629 var defaultApiShowMoreUrlSearch = "/api/CorpCLE/GetCoursesByFilter" + paramString; 1630 var defaultPushStareShowMoreUrlSearch = paramString; 1631 1632 apiUrl = defaultApiShowMoreUrlSearch; 1633 urlPushState = defaultPushStareShowMoreUrlSearch; 1634 1635 var action = "filtering" 1636 1637 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, action); 1638 } 1639 /* End CLE Course Filter */ 1640 1641 /* 1642 var currtype = getUrlParameter('type'); 1643 var itemsCount = getUrlParameter('itemscount'); 1644 var termParam = getUrlParameter("term"); 1645 1646 1647 if (currtype != '' && termParam == '') { 1648 1649 var title = ''; 1650 console.log(currtype) 1651 ddlFilter.children().removeClass("active") 1652 1653 ddlFilter.children().each(function () { 1654 var dataID = $(this).attr('data-value'); 1655 if (dataID == currtype) { 1656 title = $(this).text(); 1657 $(this).addClass("active"); 1658 } 1659 }); 1660 1661 $('.drop-down-menu').find('.label').text(title) 1662 1663 if ($('.course-gallery.main-listing').children().length <= 0) { 1664 1665 listingWrapper.prepend('<p class="error-msg">No result currently.</p>') 1666 } 1667 1668 // if (itemsCount != '') { 1669 1670 // apiUrl = '/api/CorpCLE/GetCoursesBySeeMore?itemscount={0}&type={1}'.f(itemsCount, currtype); 1671 // urlPushState = '?itemscount=0&type={0}'.f(currtype); 1672 1673 // } 1674 1675 //var sel = ddlFilter.children('.active').attr('data-value'); 1676 1677 1678 1679 1680 1681 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 1682 1683 } else { 1684 1685 ddlFilter.find('li:first-child').addClass("active"); 1686 } 1687 */ 1688 1689 /* 1690 if(termParam != ''){ 1691 1692 var urlStr = window.location.href; 1693 urlStr = urlStr.split("?")[0]; 1694 // var lastIndex = urlStr.lastIndexOf("/"); 1695 1696 // var type = urlStr.substr(lastIndex+1); 1697 1698 apiUrl = '/api/CorpCLE/GetCoursesBySearch?term={0}'.f(termParam); 1699 urlPushState = '?term={0}'.f(termParam) 1700 $(".content-search-box.cle-search-box.main-type").val(termParam) 1701 1702 1703 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 1704 } 1705 1706 1707 1708 ddlFilter.find('li').click(function (e) { 1709 e.preventDefault(); 1710 1711 c.loader.show(listingWrapper,true); 1712 1713 var sel = $(this).attr('data-value'); 1714 $('#selTestimonial').text($(this).attr('Title'));
1715 1716 1717 if ($(this).attr('data-value') != '') { 1718 apiUrl = '/api/CorpCLE/GetCoursesBySeeMore?itemscount=0&type={0}'.f($(this).attr('data-value')); 1719 urlPushState = '?itemscount=0&type={0}'.f($(this).attr('data-value')); 1720 } 1721 else { 1722 apiUrl = '/api/CorpCLE/GetCoursesBySeeMore?itemscount=0'; 1723 urlPushState = '?itemscount=0'; 1724 } 1725 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 1726 1727 ddlFilter.children().each(function () { 1728 if ($(this).hasClass("active")) { 1729 $(this).removeClass("active"); 1730 } 1731 }); 1732 $(this).addClass("active"); 1733 1734 1735 ddlFilter.removeClass("active") 1736 }); 1737 */ 1738 1739 // event click on seemore button in testimonials page add by tin 1740 loadMore.bind('click', function (e) { 1741 e.preventDefault(); 1742 1743 c.loader.show(listingWrapper,false); 1744 1745 $(this).hide(); 1746 1747 var params = new URLSearchParams(window.location.search); 1748 1749 params.set('itemscount', listingWrapper.children('a').length); 1750 apiUrl = '/api/CorpCLE/GetCoursesByFilter?' + params; 1751 urlPushState = '?' + params; 1752 1753 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, "load-more"); 1754 }); 1755 1756 $('#cle-listing-load-more-main-type').bind('click', function (e) { 1757 e.preventDefault(); 1758 $(this).hide(); 1759 1760 1761 1762 var type = getUrlParameter('type'); 1763 1764 if (type == "") { 1765 1766 var selType = $('.cle-search-box.main-type').data("type"); 1767 1768 if (selType == "") { 1769 apiUrl = '/api/CorpCLE/GetCoursesBySeeMore?itemscount={0}'.f(listingWrapper.children('a').length); 1770 urlPushState = '?itemscount=0'; 1771 } else { 1772 apiUrl = '/api/CorpCLE/GetCoursesBySeeMore?itemscount={0}&type={1}'.f(listingWrapper.children('a').length, selType); 1773 urlPushState = '?itemscount=0&type={0}'.f(selType); 1774 } 1775 1776 } 1777 else { 1778 apiUrl = '/api/CorpCLE/GetCoursesBySeeMore?itemscount={0}&type={1}'.f(listingWrapper.children('a').length, type); 1779 urlPushState = '?itemscount=0&type={0}'.f(type); 1780 } 1781 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, "load-more"); 1782 }); 1783 1784 $('.content-search-box.cle-search-box.landing').keyup(function(event) { 1785 1786 event.preventDefault(); 1787 if (event.keyCode === 13) { 1788 1789 $('.cle-search-autocomplete').hide(); 1790 filterByApplyBtn(); 1791 } 1792 }); 1793 1794 1795 1796 $('.content-search-box.cle-search-box.main-type').keyup(function(event) { 1797 console.log("bind?") 1798 event.preventDefault(); 1799 if (event.keyCode === 13) { 1800 var query = $(this).val(); 1801 1802 1803 var type = $(this).data("type") 1804 1805 var defaultApiShowMoreUrlSearch = "/api/CorpCLE/GetCoursesBySearchNMainType?maintype={0}&term={1}"; 1806 var defaultPushStareShowMoreUrlSearch = "?type={0}&term={1}"; 1807 1808 //if (query != "") { 1809 apiUrl = defaultApiShowMoreUrlSearch.f(type, query); 1810 urlPushState = defaultPushStareShowMoreUrlSearch.f(type, query); 1811 //} 1812 1813 var action = "filtering" 1814 1815 1816 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, action); 1817 1818 } 1819 }); 1820 1821 1822 function GetDataShowMore(flagDropdow, apiUrl, urlPushState, nameList, action) { 1823 // var $t = $(this); 1824 var items; 1825 var dataItems = ""; 1826 1827 $.ajax({
1828 url: apiUrl, 1829 success: function (data) { 1830 if (data.Result) { 1831 1832 1833 if (action == "filtering") { 1834 listingWrapper.html('') 1835 } 1836 1837 if ($('.error-msg').length > 0) { 1838 $('.error-msg').remove() 1839 } 1840 1841 $.each(data.Data, function (index, item) { 1842 1843 1844 var itemHTML = ""; 1845 if (window.location.href.includes('centre-for-lifelong-education')){ 1846 itemHTML = `<a data-course-category="centre-for-lifelong-education" href="` 1847 + (item.VitaeUrl && item.VitaeUrl.trim() !== "" 1848 ? item.VitaeUrl 1849 : `/courses/part-time/${item.UrlName}`) 1850 + `" ` 1851 + (item.VitaeUrl && item.VitaeUrl.trim() !== "" ? `target="_blank"` : ``) 1852 + `>` 1853 + `<div class="course-gallery-item gallery-item">` 1854 + `<img src="${item.ProfileImage}" />` 1855 + `</div>` 1856 + `<p class="course-item-text">` 1857 + `${item.Title}` 1858 + `</p>` 1859 + `</a>` 1860 } else { 1861 itemHTML = `<a data-course-category="centre-for-lifelong-education" href="` 1862 + (item.VitaeUrl && item.VitaeUrl.trim() !== "" 1863 ? item.VitaeUrl 1864 : `/courses/part-time/${item.UrlName}`) 1865 + `" ` 1866 + (item.VitaeUrl && item.VitaeUrl.trim() !== "" ? `target="_blank"` : ``) 1867 + `>` 1868 + `<div class="course-gallery-item gallery-item">` 1869 + `<img src="${item.ProfileImage}" />` 1870 + `<p class="course-item-text gallery-item-text">` 1871 + `${item.Title}` 1872 + `</p>` 1873 + `</div>` 1874 1875 + `</a>` 1876 } 1877 1878 1879 1880 if (itemHTML != "") { 1881 dataItems += itemHTML; 1882 } 1883 1884 }); 1885 1886 1887 listingWrapper.append(dataItems); 1888 1889 1890 1891 if ($(listingWrapper).children('a').length >= data.PageCount) { 1892 loadMore.hide(); 1893 console.log($(listingWrapper).children().length); 1894 console.log(data.PageCount); 1895 if ($('#cle-listing-load-more-main-type').length > 0) { 1896 $('#cle-listing-load-more-main-type').hide(); 1897 } 1898 } else { 1899 loadMore.show(); 1900 1901 if ($('#cle-listing-load-more-main-type').length > 0) { 1902 $('#cle-listing-load-more-main-type').show(); 1903 } 1904 } 1905 1906 1907 1908 if (action == "filtering" && data.PageCount <= 0) { 1909 nameList.prepend('<p class="error-msg">No result currently.</p>') 1910 } 1911 1912 //For anchor with browser back 1913 var currentUrl = window.location; 1914 if (window.location.search.length) { 1915 var currentUrl = window.location.href.split('?')[0]; 1916 } 1917 1918 urlPushState = currentUrl + urlPushState; 1919 console.log(nameList.children('a').length) 1920 urlPushState = urlPushState.replace(/itemscount=\d+/, 'itemscount=' + nameList.children('a').length); 1921 window.history.pushState(null, null, urlPushState); 1922 1923 console.log(urlPushState) 1924 1925 } 1926 }, 1927 error: function (jqXHR, textStatus, errorThrown) { 1928 loadMore.show(); 1929 $('#cle-listing-load-more-main-type').show(); 1930 c.loader.hide(nameList); 1931 }, 1932 complete: function () { 1933 c.loader.hide(nameList); 1934 } 1935 }); 1936 } 1937 } 1938 }, 1939 contentTabs: { 1940 init: function() { 1941 1942 1943 1944 1945 1946 if ($('.course-tabs.no-sticky').length > 0) { 1947 1948 1949 hashParamUpdate() 1950 1951 $(window).on('hashchange',function(){ 1952 1953 hashParamUpdate() 1954 }); 1955 1956 1957 1958 1959 1960 1961 1962 1963 } 1964 1965 function updateSubnavWidth() { 1966 1967 if ($(window).width() > 768) { 1968 1969
1970 var subNavWidth = $(".sub-nav-wrapper").width(); 1971 1972 1973 subNav.attr('initial-width', subNavWidth) 1974 subNav.css('width', subNavWidth + 'px') 1975 1976 1977 } else { 1978 subNav.css('width', '100%') 1979 } 1980 1981 } 1982 1983 function hashParamUpdate() { 1984 var hashParam = window.location.hash; 1985 1986 if (hashParam != "" && hashParam !== 'undefined') { 1987 1988 1989 $('.course-tab-item').removeClass("active") 1990 $('.course-tab-item[href="' + hashParam + '"]').addClass("active") 1991 $('.course-tab-item[href="' + hashParam + '"]').trigger('click') 1992 1993 console.log('.tab-content' + hashParam) 1994 if ($('.tab-content' + hashParam).length > 0) { 1995 1996 $('.tab-content').addClass("hide") 1997 $('.tab-content' + hashParam).removeClass('hide') 1998 1999 } 2000 } 2001 2002 //If there is sidebar 2003 var subNav = $(".sub-nav-wrapper") 2004 if (subNav.length > 0) { 2005 2006 if (!subNav.hasClass("downloads-wrapper")) { 2007 2008 updateSubnavWidth(); 2009 2010 } 2011 } 2012 } 2013 2014 //Hide Featured Tag 2015 $(".cle-checkbox-wrapper label").each(function() { 2016 if ($(this).text().includes("Featured")) { 2017 $(this).hide(); 2018 } 2019 }); 2020 2021 2022 } 2023 }, 2024 buildTabContent: { 2025 init: function() { 2026 if ($('.tab-content').length > 0) { 2027 2028 var count = 1 2029 $('.course-tabs').find('.course-tab-item').each(function(){ 2030 var id = $(this).attr('href') 2031 2032 $('.tab-content-' + count).attr('id', id.replace("#", "")); 2033 2034 2035 2036 count++; 2037 }) 2038 2039 2040 var count1 = 1 2041 $('.tab-content').each(function(){ 2042 if (count1 > 1) { 2043 if (!$(this).hasClass("hide")) { 2044 $(this).addClass("hide") 2045 } 2046 } 2047 2048 count1++; 2049 }) 2050 $(".course-tabs a.course-tab-item").on("click",function(e){ 2051 var urlPushState = $(e.target).attr("href"); 2052 var currentUrl = window.location.toString(); 2053 var hashIndex = currentUrl.indexOf("#"); 2054 currentUrl = currentUrl.substr(0,hashIndex); 2055 2056 window.history.pushState(null, null, currentUrl + urlPushState) 2057 }) 2058 } 2059 } 2060 }, 2061 sliderListing: { 2062 init: function() { 2063 $('.slider-wrapper').slick({ 2064 infinite:true, 2065 dots: false, 2066 speed: 500, 2067 slidesToShow: 3, 2068 slidesToScroll: 1, 2069 arrows: true, 2070 autoplay:true, 2071 responsive: [ 2072 { 2073 breakpoint: 767, 2074 settings: { 2075 arrows: false, 2076 slidesToShow: 1, 2077 slidesToScroll: 1 2078 } 2079 }] 2080 }); 2081 } 2082 }, 2083 accordion: { 2084 init: function() { 2085 2086 if ($('.accordion-wrapper').length > 0) { 2087 2088 $('.accordion-btn').on('click', function() { 2089 2090 var currObj = $(this) 2091 $(this).next('.accordion-content').slideToggle( "slow", function() { 2092 // Animation complete. 2093 2094 if (currObj.hasClass("active")) { 2095 currObj.removeClass("active") 2096 } else { 2097 currObj.addClass("active") 2098 } 2099 2100 }); 2101 2102 }) 2103 } 2104 2105 } 2106 2107 }, 2108 sliderListing: { 2109 init: function() { 2110 $('.slider-wrapper').slick({ 2111 infinite:true, 2112 dots: false, 2113 speed: 500, 2114 slidesToShow: 3, 2115 slidesToScroll: 1, 2116 arrows: true, 2117 autoplay:true, 2118 responsive: [ 2119 { 2120 breakpoint: 767, 2121 settings: { 2122 arrows: false, 2123 slidesToShow: 1, 2124 slidesToScroll: 1 2125 } 2126 }] 2127 }); 2128 $('.tab-menu-slider ul').slick({ 2129 dots: false, 2130 speed: 500, 2131 slidesToShow: 7, 2132 slidesToScroll: 1, 2133 infinite: false, 2134 arrows: true, 2135 responsive: [ 2136 { 2137 breakpoint: 767, 2138 settings: { 2139 arrows: false, 2140 slidesToShow: 1, 2141 slidesToScroll: 1 2142 } 2143 }] 2144 }); 2145 2146 if ($('.slider-wrapper').length > 0) { 2147 2148 2149 $('.slider-wrapper a.image-popup').magnificPopup({ 2150 type: 'image', 2151 mainClass: 'mfp-with-zoom', 2152 gallery:{ 2153 enabled:true 2154 }, 2155 image: { 2156 titleSrc: function(item) { 2157 var markup = ''; 2158 2159 if (item.el[0].hasAttribute("title")) { 2160 markup += '<p class="mb-0"><strong>' + item.el.attr('title') + '</strong></p>'; 2161 } 2162 2163 if (item.el[0].hasAttribute("data-desc")) { 2164 markup += '<p class="mb-0">' + item.el.attr('data-desc') + '</p>'; 2165 } 2166 2167 if (item.el[0].hasAttribute("data-event")) { 2168 markup += '<p>' + item.el.attr('data-event') + '</p>'; 2169 } 2170 2171 if (item.el[0].hasAttribute("data-content")) { 2172 markup += '<p>' + item.el.attr('data-content') + '</p>'; 2173 } 2174 2175 2176 return markup 2177 } 2178 }, 2179 2180 zoom: { 2181 enabled: true, 2182 2183 duration: 300, // duration of the effect, in milliseconds 2184 easing: 'ease-in-out', // CSS transition easing function 2185 2186 opener: function(openerElement) { 2187 2188 return openerElement.is('img') ? openerElement : openerElement.find('img'); 2189 } 2190 } 2191 2192 }); 2193 } 2194 } 2195 }, 2196 sliderStudentWork: { 2197 init: function() { 2198 2199 2200 $('.student-work-slider').on('init', function(event, slick, currentSlide, nextSlide){ 2201 2202 console.log("slide init"); 2203 var slideCount = slick.slideCount; 2204 2205 if(slideCount <= 3){ 2206 $('.student-work-slider .slick-dots').css("display","none"); 2207 console.log("slick dot hide") 2208 }else{ 2209 $('.student-work-slider .slick-dots').css("display", "block"); 2210 console.log("slick dot show") 2211 } 2212 }); 2213 2214 $('.student-work-slider').slick({ 2215 infinite:false, 2216 dots: true, 2217 speed: 500, 2218 slidesToShow: 3, 2219 slidesToScroll: 3, 2220 arrows: true, 2221 autoplay:false, 2222 responsive: [ 2223 { 2224 breakpoint: 767, 2225 settings: {
2226 arrows: false, 2227 slidesToShow: 1, 2228 slidesToScroll: 1 2229 } 2230 }] 2231 }); 2232 2233 2234 2235 2236 2237 if ($('.student-work-slider').length > 0) { 2238 2239$('.student-work-slider .student-work-slide a').each(function(){ 2240 if ($(this).hasClass("video-item")) { 2241 2242 2243 2244 $(this).magnificPopup({ 2245 type: 'iframe' 2246 }); 2247 2248 } 2249 else{ 2250 2251 $('.student-work-slider .student-work-slide a').magnificPopup({ 2252 2253 type: 'image', 2254 mainClass: 'mfp-with-zoom', 2255 gallery:{ 2256 enabled:true 2257 }, 2258 image: { 2259 titleSrc: function(item) { 2260 var markup = ''; 2261 2262 if (item.el[0].hasAttribute("title")) { 2263 markup += '<i class="mb-0">' + item.el.attr('title') + '</i>'; 2264 } 2265 2266 if (item.el[0].hasAttribute("data-desc")) { 2267 markup += '<p class="mb-0">' + item.el.attr('data-desc') + '</p>'; 2268 } 2269 2270 if (item.el[0].hasAttribute("data-programme")) { 2271 markup += '<p class="mb-0">' + item.el.attr('data-programme') + '</p>'; 2272 } 2273 2274 // if (item.el[0].hasAttribute("data-content")) { 2275 // markup += '<p>' + item.el.attr('data-content') + '</p>'; 2276 // } 2277 2278 2279 return markup 2280 } 2281 }, 2282 2283 zoom: { 2284 enabled: true, 2285 2286 duration: 300, // duration of the effect, in milliseconds 2287 easing: 'ease-in-out', // CSS transition easing function 2288 2289 opener: function(openerElement) { 2290 2291 return openerElement.is('img') ? openerElement : openerElement.find('img'); 2292 } 2293 } 2294 2295 }); 2296 } 2297 2298 2299 }) 2300 } 2301 2302 } 2303 }, 2304 gallerySlider: { 2305 init: function() { 2306 2307 2308 let gallerySlickOptions = { 2309 dots: false, 2310 speed: 500, 2311 slidesToShow: 1, 2312 adaptiveHeight: true, 2313 slidesToScroll: 1, 2314 arrows: true, 2315 responsive: [ 2316 { 2317 breakpoint: 767, 2318 settings: { 2319 arrows: true, 2320 slidesToShow: 1, 2321 slidesToScroll: 1 2322 } 2323 }] 2324 }; 2325 let fypGallerySlickOptions = { 2326 dots: false, 2327 speed: 500, 2328 slidesToShow: 1, 2329 adaptiveHeight: true, 2330 slidesToScroll: 1, 2331 arrows: true, 2332 responsive: [ 2333 { 2334 breakpoint: 767, 2335 settings: { 2336 arrows: true, 2337 slidesToShow: 1, 2338 slidesToScroll: 1 2339 } 2340 }] 2341 }; 2342 2343 if($('#listGallery').length>0){ 2344 2345 2346 $('#current_tab1').on('click', function(){ 2347 $('#listGallery').slick('unslick'); 2348 $('#listGallery').slick(gallerySlickOptions); 2349 cusMagnificPopups() 2350 //$('#listGallery').slick('refresh'); 2351 }) 2352 2353 $('#listGallery').slick(gallerySlickOptions); 2354 } 2355 2356 if($('#fypListGallery').length>0){ 2357 2358 $('#current_tab5').on('click', function(){ 2359 $('#fypListGallery').slick('unslick'); 2360 $('#fypListGallery').slick(fypGallerySlickOptions); 2361 cusMagnificPopups_FYP() 2362 //$('#fypListGallery').slick('refresh'); 2363 }) 2364 2365 $('#fypListGallery').slick(fypGallerySlickOptions); 2366 2367 if ($('#fypListGallery.list-news-wrapper').length > 0) { 2368 2369 cusMagnificPopups_FYP() 2370 2371 } 2372 } 2373 2374 2375 //For showcase graduates detail page 2376 if ($('.tab-context-wrapper.awards #listGallery').length > 0) { 2377 cusMagnificPopups() 2378 2379 } 2380 2381 if ($('#listGallery.events-coverage').length > 0) { 2382 2383 cusMagnificPopups_EventsCoverage() 2384 2385 } 2386 2387 if ($('#listGallery.list-news-wrapper').length > 0) { 2388 2389 cusMagnificPopups_News() 2390 2391 } 2392 2393 2394 function cusMagnificPopups() { 2395 if($('.tab-context-wrapper.awards #listGallery a').length > 0){ 2396 2397 2398 $('.tab-context-wrapper.awards #listGallery a').each(function(){ 2399 2400 if ($(this).hasClass("video-item")) { 2401 $('.tab-context-wrapper.awards #listGallery a.video-item').each(function(){ 2402 2403 if ($(this).attr('href') == '/timages/fakevimeovideo.jpg') { 2404 2405 $(this).attr('href', 'https://player.vimeo.com/video/' + $(this).data('video')) 2406 2407 } 2408 }) 2409 2410 2411 $('.tab-context-wrapper.awards #listGallery a.video-item').magnificPopup({ 2412 type: 'iframe' 2413 }); 2414 2415 } else { 2416 2417 $(this).on('click', function(e) { 2418 2419 e.preventDefault() 2420 2421 }) 2422 // $('.tab-context-wrapper.awards #listGallery a').magnificPopup({ 2423 // type: 'image', 2424 // mainClass: 'mfp-with-zoom', 2425 // gallery:{ 2426 // enabled:true 2427 // }, 2428 // image: { 2429 // titleSrc: function(item) { 2430 // var markup = ''; 2431 2432 // if (item.el[0].hasAttribute("title")) { 2433 // markup += '<p class="mb-0"><strong>' + item.el.attr('title') + '</strong></p>'; 2434 // } 2435 2436 // // console.log($(item.el[0]).attr('title')) 2437 // // if ($(item.el[0]).parent('.img').next('.info').find('p').length > 0) { 2438 // // markup += $(item).parent('.img').next('.info').find('p').html(); 2439 // // } 2440 2441 2442 2443 // return markup 2444 // } 2445 // }, 2446 2447 // zoom: { 2448 // enabled: true, 2449 2450 // duration: 300, // duration of the effect, in milliseconds 2451 // easing: 'ease-in-out', // CSS transition easing function 2452 2453 // opener: function(openerElement) { 2454 2455 // return openerElement.is('img') ? openerElement : openerElement.find('img'); 2456 // } 2457 // } 2458 2459 // }); 2460 2461 } 2462 2463 }) 2464 2465 2466 } 2467 2468 2469 2470 } 2471 2472 function cusMagnificPopups_EventsCoverage() { 2473 if($('#listGallery.events-coverage a').length > 0){ 2474 2475 2476 $('#listGallery.events-coverage a').each(function(){ 2477 2478 if ($(this).hasClass("video-item")) { 2479 $('#listGallery.events-coverage a.video-item').each(function(){ 2480 2481 2482 console.log($(this).data('video')) 2483 2484 if ($(this).attr('href') == '/timages/fakevimeovideo.jpg' || $(this).attr('href') === undefined) { 2485 2486 $(this).attr('href', 'https://player.vimeo.com/video/' + $(this).data('video')) 2487 2488 } 2489 }) 2490 2491 2492 $('#listGallery.events-coverage a.video-item').magnificPopup({ 2493 type: 'iframe' 2494 }); 2495 2496 } else { 2497 2498 $(this).on('click', function(e) { 2499 2500 e.preventDefault() 2501 2502 }) 2503 2504 2505 } 2506 2507 }) 2508 2509 2510 } 2511 2512 2513 2514 } 2515 2516 function cusMagnificPopups_News() { 2517 if($('#listGallery.list-news-wrapper a').length > 0){ 2518 2519 2520 $('#listGallery.list-news-wrapper a').each(function(){ 2521 2522 if ($(this).hasClass("video-item")) { 2523 $('#listGallery.list-news-wrapper a.video-item').each(function(){ 2524 2525 2526 console.log($(this).data('video')) 2527 2528 if ($(this).attr('href') == '/timages/fakevimeovideo.jpg' || $(this).attr('href') === undefined) { 2529 2530 $(this).attr('href', 'https://player.vimeo.com/video/' + $(this).data('video')) 2531 2532 } 2533 }) 2534 2535 2536 $('#listGallery.list-news-wrapper a.video-item').magnificPopup({ 2537 type: 'iframe' 2538 }); 2539 2540 } else { 2541 2542 $(this).on('click', function(e) { 2543 2544 e.preventDefault() 2545 2546 }) 2547 2548 2549 } 2550 2551 }) 2552 2553 2554 } 2555 2556 2557 2558 } 2559 2560 function cusMagnificPopups_FYP() { 2561 if($('#fypListGallery.list-news-wrapper a').length > 0){ 2562 2563 2564 $('#fypListGallery.list-news-wrapper a').each(function(){ 2565 2566 if ($(this).hasClass("video-item")) { 2567 $('#fypListGallery.list-news-wrapper a.video-item').each(function(){ 2568 2569 2570 console.log($(this).data('video')) 2571 2572 //if ($(this).attr('href') == '/timages/fakevimeovideo.jpg' || $(this).attr('href') === undefined) { 2573 if ($(this).data('video') !== undefined) { 2574 $(this).attr('href', 'https://player.vimeo.com/video/' + $(this).data('video')) 2575 2576 } 2577 }) 2578 2579 2580 $('#fypListGallery.list-news-wrapper a.video-item').magnificPopup({ 2581 type: 'iframe' 2582 }); 2583 2584 } else { 2585 2586 $(this).on('click', function(e) { 2587 2588 e.preventDefault() 2589 2590 }) 2591 2592 2593 } 2594 2595 }) 2596 2597 2598 } 2599 2600 2601 2602 } 2603 2604 } 2605 }, 2606 faculty:{ 2607 init: function () { 2608 var ddlFilter = $('.tab-menu-wrapper#music-instruments-listing ul.desktop-type') 2609 var loadMore = $(".load-more[data-id=faculty-listing]") 2610 var listingWrapper = $("#faculty-listing") 2611 var c = wpContent; 2612 $('#faculty-listing').hide(); 2613 2614 //start new faculty listing 2615 const segments = window.location.href.split('?')[0].split('/'); 2616 const schoolsIndex = segments.indexOf('schools'); 2617 const currentSchool = segments[schoolsIndex + 1]; 2618 c.loader.show(listingWrapper.parent(), true); 2619 2620 function getStaffsToHtml(item) { 2621 var html = ''; 2622 2623 item.forEach(function (item) { 2624 html += `<a href="/experience/why-nafa/teaching-staff/profile/${item.LinkURL}" class="faculty-gallery-item gallery-item"><div> 2625 <img src="https://staffnet.nafa.edu.sg${item.ProfileImageURL}"> 2626 <div class="gallery-item-text"> 2627 <p class="font-weight-bold">${item.Name}</p> 2628 <p>${item.Position}</p> 2629 </div> 2630 </div></a>`; 2631 }); 2632 2633 return html; 2634 }; 2635 2636 $.ajax({
2637 url: '/api/corpstaffdirectoryapi/GetStaffsBySchool', 2638 data: { 2639 school: currentSchool 2640 }, 2641 type: 'get', 2642 contentType: 'application/json', 2643 success: function (response) { 2644 console.log(response); 2645 2646 var html = ''; 2647 html += '<div class="faculty-gallery api-gallery">'; 2648 html += getStaffsToHtml(response.Data); 2649 html += '</div>'; 2650 //html += `<div class=" text-center mt-5"> 2651 // <a data-id="faculty-listing" style="display: block;" class="load-more">Show More</a> 2652 // </div>`; 2653 c.loader.hide(listingWrapper.parent(), false); 2654 $('#faculty-listing').before(html); 2655 if ($('.faculty-gallery.api-gallery .faculty-gallery-item').length < response.TotalItems) { 2656 loadMore.show(); 2657 } else { 2658 loadMore.hide(); 2659 } 2660 } 2661 }); 2662 2663 loadMore.bind('click', function (e) { 2664 e.preventDefault(); 2665 c.loader.show(listingWrapper.parent(), false); 2666 $(this).hide(); 2667 2668 var type = listingWrapper.attr('data-school-type'); 2669 2670 var musicInst = ddlFilter.find('li.active').attr('data-id'); 2671 2672 2673 2674 $.ajax({
2675 url: '/api/corpstaffdirectoryapi/GetStaffsBySchool', 2676 data: { 2677 school: currentSchool, 2678 itemscount: $('.faculty-gallery.api-gallery .faculty-gallery-item').length, 2679 seeMore: true, 2680 instrument: musicInst 2681 }, 2682 type: 'get', 2683 contentType: 'application/json', 2684 success: function (response) { 2685 console.log(response); 2686 2687 var html = ''; 2688 2689 html += getStaffsToHtml(response.Data); 2690 2691 c.loader.hide(listingWrapper.parent(), false); 2692 $('.faculty-gallery.api-gallery').append(html); 2693 2694 console.log(response.TotalItems); 2695 console.log($('.faculty-gallery.api-gallery .faculty-gallery-item').length < response.TotalItems) 2696 if ($('.faculty-gallery.api-gallery .faculty-gallery-item').length < response.TotalItems) { 2697 loadMore.show(); 2698 } else { 2699 loadMore.hide(); 2700 } 2701 } 2702 }); 2703 2704 }); 2705 2706 //end new faculty listing 2707 2708 2709 2710 2711 //Re-create for mobile 2712 2713 2714 $('<div class="dropdown mobile-type-dropdown faculty" id="type"><div class="drop-down-menu"><div class="label"></div><ul id="mobileTypeFilter" class="dropdown-menu faculty" role="menu" ></ul></div></div>').insertBefore(ddlFilter); 2715 2716 ddlFilter.find('li').each(function(){ 2717 2718 if ($(this).hasClass("active")) { 2719 $('.mobile-type-dropdown').find('.label').text($("<div/>").html($(this).html()).text()) 2720 } 2721 2722 2723 $('.mobile-type-dropdown').find('ul').append($(this)[0].outerHTML) 2724 2725 }) 2726 2727 $('.mobile-type-dropdown').on('click', function(){ 2728 2729 if (!$(this).find('.dropdown-menu').hasClass("active")) { 2730 $(this).find('.dropdown-menu').addClass("active") 2731 } else { 2732 $(this).find('.dropdown-menu').removeClass("active") 2733 } 2734 }) 2735 2736 2737 $('.mobile-type-dropdown').find('li').bind('click', function (e) { 2738 e.preventDefault(); 2739 var $t = $(this); 2740 2741 c.loader.show(listingWrapper.parent(),true); 2742 2743 var selectValue = $(this).attr('data-id'); 2744 var musicInst = $(this).attr('data-id'); 2745 ddlFilter.find('li').each(function(){ 2746 2747 if ($(this).attr('data-id') == selectValue) { 2748 ddlFilter.find('li').removeClass("active") 2749 $(this).addClass("active") 2750 } 2751 2752 2753 }) 2754 2755 var selectTitle = $("<div/>").html($(this).html()).text(); 2756 2757 var type = listingWrapper.attr('data-school-type'); 2758 2759 if ($(this).attr('data-id') != '') { 2760 apiUrl = '/api/CorpStaff/GetStaffsBySeeMore?itemscount=0&type={0}&instrument={1}'.f(type, selectValue); 2761 urlPushState = '?itemscount=0&type={0}&instrument={1}'.f(type, selectValue); 2762 } 2763 2764 $.ajax({
2765 url: '/api/corpstaffdirectoryapi/GetStaffsBySchool', 2766 data: { 2767 school: currentSchool, 2768 instrument: musicInst 2769 }, 2770 type: 'get', 2771 contentType: 'application/json', 2772 success: function (response) { 2773 console.log(response); 2774 2775 var html = ''; 2776 html += getStaffsToHtml(response.Data); 2777 c.loader.hide(listingWrapper.parent(), false); 2778 $('.faculty-gallery.api-gallery').html(html); 2779 if ($('.faculty-gallery.api-gallery .faculty-gallery-item').length < response.TotalItems) { 2780 loadMore.show(); 2781 } else { 2782 loadMore.hide(); 2783 } 2784 } 2785 }); 2786 2787 2788 2789 $('.mobile-type-dropdown').find('.label').text(selectTitle) 2790 2791 2792 }); 2793 2794 //End re-create for mobile 2795 2796 2797 2798 if ($('.tab-menu-wrapper#music-instruments-listing ul.desktop-type').children().length > 8) { 2799 $('.tab-menu-wrapper#music-instruments-listing ul.desktop-type').slick({ 2800 dots: false, 2801 speed: 500, 2802 slidesToShow: 8, 2803 slidesToScroll: 1, 2804 infinite: false, 2805 arrows: true, 2806 responsive: [ 2807 { 2808 breakpoint: 767, 2809 settings: { 2810 arrows: false, 2811 slidesToShow: 1, 2812 slidesToScroll: 1 2813 } 2814 }] 2815 }); 2816 } 2817 2818 ////Hash param 2819 //var currtype = getUrlParameter('instrument'); 2820 2821 //if (currtype != '') { 2822 2823 // var title = ''; 2824 2825 // ddlFilter.children().removeClass("active") 2826 2827 // ddlFilter.children().each(function () { 2828 // var dataID = $(this).attr('data-id'); 2829 // if (dataID == currtype) { 2830 // title = $(this).attr('title'); 2831 // $(this).addClass("active"); 2832 // } 2833 // }); 2834 2835 2836 2837 // var type = listingWrapper.attr('data-school-type'); 2838 2839 2840 2841 // if (currtype != '') { 2842 // apiUrl = '/api/CorpStaff/GetStaffsBySeeMore?itemscount=0&type={0}&instrument={1}'.f(type, currtype); 2843 // urlPushState = '?itemscount=0&type={0}&instrument={1}'.f(type, currtype); 2844 // } 2845 2846 // GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 2847 2848 //} else { 2849 2850 // ddlFilter.find('a:first-child').addClass("active"); 2851 //} 2852 2853 2854 2855 2856 ddlFilter.find('li').click(function (e) { 2857 e.preventDefault(); 2858 2859 2860 var musicInst = $(this).attr('data-id'); 2861 var type = listingWrapper.attr('data-school-type'); 2862 2863 if ($(this).attr('data-id') != '') { 2864 apiUrl = '/api/CorpStaff/GetStaffsBySeeMore?itemscount=0&type={0}&instrument={1}'.f(type, musicInst); 2865 urlPushState = '?itemscount=0&type={0}&instrument={1}'.f(type, musicInst); 2866 } 2867 2868 2869 2870 c.loader.show(listingWrapper.parent(),true); 2871 $.ajax({
2872 url: '/api/corpstaffdirectoryapi/GetStaffsBySchool', 2873 data: { 2874 school: currentSchool, 2875 instrument: musicInst 2876 }, 2877 type: 'get', 2878 contentType: 'application/json', 2879 success: function (response) { 2880 console.log(response); 2881 2882 var html = ''; 2883 html += getStaffsToHtml(response.Data); 2884 c.loader.hide(listingWrapper.parent(), false); 2885 $('.faculty-gallery.api-gallery').html(html); 2886 if ($('.faculty-gallery.api-gallery .faculty-gallery-item').length < response.TotalItems) { 2887 loadMore.show(); 2888 } else { 2889 loadMore.hide(); 2890 } 2891 } 2892 }); 2893 2894 2895 ddlFilter.find('li').each(function () { 2896 2897 if ($(this).hasClass("active")) { 2898 $(this).removeClass("active"); 2899 } 2900 }); 2901 $(this).addClass("active"); 2902 2903 }); 2904 2905 //loadMore.bind('click', function (e) { 2906 // e.preventDefault(); 2907 2908 // c.loader.show(listingWrapper.parent(),false); 2909 2910 // $(this).hide(); 2911 2912 // var type = listingWrapper.attr('data-school-type'); 2913 2914 2915 // if ($('#music-instruments-listing').length > 0) { 2916 2917 // var musicInst = ddlFilter.find('li.active').attr('data-id'); 2918 2919 2920 2921 // apiUrl = '/api/CorpStaff/GetStaffsBySeeMore?itemscount={0}&type={1}&instrument={2}'.f(listingWrapper.children().length, type, musicInst); 2922 // urlPushState = '?itemscount=0&type={0}&instrument={1}'.f(type, musicInst); 2923 2924 2925 // } else { 2926 // if (type == 'false' || type == "") { 2927 // apiUrl = '/api/CorpStaff/GetStaffsBySeeMore?itemscount={0}'.f(listingWrapper.children().length); 2928 // urlPushState = '?itemscount=0'; 2929 // } 2930 // else { 2931 2932 2933 2934 // apiUrl = '/api/CorpStaff/GetStaffsBySeeMore?itemscount={0}&type={1}'.f(listingWrapper.children().length, type); 2935 // urlPushState = '?itemscount=0&type={0}'.f(type); 2936 // } 2937 // } 2938 2939 2940 // GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, "load-more"); 2941 //}); 2942 2943 function GetDataShowMore(flagDropdow, apiUrl, urlPushState, nameList, action) { 2944 // var $t = $(this); 2945 var items; 2946 var dataItems = ""; 2947 var loadMore = $(".load-more[data-id=faculty-listing]") 2948 2949 $.ajax({
2950 url: apiUrl, 2951 success: function (data) { 2952 if (data.Result) { 2953 2954 2955 if (action == "filtering") { 2956 nameList.html('') 2957 } 2958 2959 2960 $.each(data.Data, function (index, item) { 2961 2962 var imgHTML = ""; 2963 2964 2965 itemHTML = `<a href=${item.LinkURL} class="faculty-gallery-item gallery-item"> 2966 <div> 2967 <img src=${item.ProfileImageURL} alt=""> 2968 <div class="gallery-item-text"> 2969 <p class="font-weight-bold"> 2970 ${item.Name} 2971 </p> 2972 <p> 2973 ${item.Position} 2974 </p> 2975 </div> 2976 2977 </div> 2978 </a>` 2979 2980 2981 2982 2983 if (itemHTML != "") { 2984 dataItems += itemHTML; 2985 } 2986 2987 2988 2989 2990 2991 }); 2992 2993 2994 2995 2996 2997 nameList.append(dataItems); 2998 2999 3000 if (nameList.children().length >= data.PageCount) { 3001 loadMore.hide(); 3002 3003 3004 } else { 3005 loadMore.show(); 3006 3007 3008 } 3009 3010 3011 //For anchor with browser back 3012 var currentUrl = window.location; 3013 if (window.location.search.length) { 3014 var currentUrl = window.location.href.split('?')[0]; 3015 } 3016 urlPushState = currentUrl + urlPushState; 3017 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 3018 window.history.pushState(null, null, urlPushState); 3019 } 3020 }, 3021 error: function (jqXHR, textStatus, errorThrown) { 3022 3023 c.loader.hide(listingWrapper.parent()); 3024 loadMore.show(); 3025 3026 }, 3027 complete: function () { 3028 3029 c.loader.hide(listingWrapper.parent()); 3030 } 3031 }); 3032 } 3033 3034 3035 } 3036 }, 3037 specialProjects: { 3038 init: function() { 3039 3040 var listingWrapper = $('.tab-context-wrapper.special-projects .flex-wrapper'); 3041 var loadmore = $('#special-projects-load-more') 3042 3043 var dd = $('.staff-dropdown.special-projects'); 3044 3045 var c= wpContent; 3046 3047 3048 // dd.on('click', function (e) { 3049 // e.preventDefault(); 3050 // if ($(this).hasClass("open")) { 3051 // $(this).removeClass("open") 3052 // } else { 3053 // $(this).addClass("open") 3054 // } 3055 3056 // }) 3057 3058 3059 3060 dd.find('a').bind('click', function (e) { 3061 3062 3063 3064 3065 e.preventDefault(); 3066 3067 c.loader.show(listingWrapper.parent(),true); 3068 3069 var $t = $(this); 3070 3071 3072 3073 //loadEvent($t.attr('data-id')); 3074 3075 3076 3077 var selectValue = $(this).attr('data-id'); 3078 var selectTitle = $(this).attr('title'); 3079 3080 if (selectValue != '' && selectValue != 'all') { 3081 apiUrl = "/api/CorpSpecialProjectsApi/GetSpecialProjectsBySeeMore?itemscount=0&year={0}".f(selectValue); 3082 urlPushState = "?itemscount=0&year={0}".f(selectValue); 3083 } 3084 else { 3085 apiUrl = "/api/CorpSpecialProjectsApi/GetSpecialProjectsBySeeMore?itemscount=0&year={0}".f(selectValue); 3086 urlPushState = "?itemscount=0&year={0}".f(selectValue); 3087 } 3088 3089 3090 GetDataShowMoreSpecialProjects(true, apiUrl, urlPushState, listingWrapper); 3091 3092 3093 dd.find('.label').text(selectTitle) 3094 dd.find('#filterYear').removeClass("active") 3095 3096 3097 }); 3098 3099 function GetDataShowMoreSpecialProjects(flagDropdow, apiUrl, urlPushState, nameList) { 3100 // var $t = $(this); 3101 var items; 3102 var dataItems = ""; 3103 var loadMore = $('#special-projects-load-more') 3104 3105 $.ajax({
3106 url: apiUrl, 3107 success: function (data) { 3108 if (data.Result) { 3109 3110 nameList.html('') 3111 3112 $(data.Data).each(function(idx, item){ 3113 3114 3115 3116 var itemHTML = ""; 3117 3118 3119 //start 3120 3121 itemHTML = `<div class="flex-item-wrapper">` 3122 + `<div class="img-wrapper">` 3123 + `<a href="${item.LinkURL}"><img src="${item.ProfilePicture}" alt=""></a>` 3124 + `</div>` 3125 + `<div class="artist-name">` 3126 + `<p class="font-weight-bold pt-2 mb-0">${item.Title}</p>` 3127 3128 3129 3130 itemHTML += '</div>' 3131 + '</div>' 3132 3133 nameList.append(itemHTML) 3134 }) 3135 3136 3137 if (nameList.children().length >= data.PageCount) { 3138 loadMore.hide(); 3139 3140 3141 } else { 3142 loadMore.show(); 3143 3144 3145 } 3146 3147 3148 3149 //For anchor with browser back 3150 var currentUrl = window.location; 3151 if (window.location.search.length) { 3152 var currentUrl = window.location.href.split('?')[0]; 3153 } 3154 urlPushState = currentUrl + urlPushState; 3155 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 3156 window.history.pushState(null, null, urlPushState); 3157 3158 } 3159 }, 3160 error: function (jqXHR, textStatus, errorThrown) { 3161 c.loader.hide(listingWrapper.parent()); 3162 }, 3163 complete: function () { 3164 3165 c.loader.hide(listingWrapper.parent()); 3166 } 3167 3168 }); 3169 } 3170 3171 3172 //Load More 3173 $(loadmore).bind('click', function (e) { 3174 e.preventDefault(); 3175 3176 3177 3178 $(this).hide(); 3179 3180 var $t = $(this); 3181 var items; 3182 var dataItems = ""; 3183 var year = dd.find('a.active').attr("data-id"); 3184 var loadMore = $('#special-projects-load-more') 3185 var listingWrapper = $('.tab-context-wrapper.special-projects .flex-wrapper'); 3186 3187 c.loader.show(listingWrapper.parent(),false); 3188 3189 var serviceUrl = ""; 3190 if (dd.find('a.active').attr("data-id") != "" && dd.find('a.active').attr("data-id") != "all") { 3191 serviceUrl = '/api/CorpSpecialProjectsApi/GetSpecialProjectsBySeeMore?itemscount={0}&year={1}'.f(listingWrapper.children().length, year); 3192 urlPushState = '?itemscount=0&year={0}'.f(year); 3193 } 3194 else { 3195 serviceUrl = '/api/CorpSpecialProjectsApi/GetSpecialProjectsBySeeMore?itemscount={0}&year={1}'.f(listingWrapper.children().length, year); 3196 urlPushState = '?itemscount=0&year={0}'.f(year); 3197 } 3198 3199 $.ajax({
3200 url: serviceUrl, 3201 success: function (data) { 3202 $.each(data.Data, function (index, item) { 3203 3204 3205 var itemHTML = ""; 3206 3207 itemHTML = `<div class="flex-item-wrapper">` 3208 + `<div class="img-wrapper">` 3209 + `<a href="${item.LinkURL}"><img src="${item.ProfilePicture}" alt=""></a>` 3210 + `</div>` 3211 + `<div class="artist-name">` 3212 + `<p class="font-weight-bold pt-2 mb-0">${item.Title}</p>` 3213 itemHTML += '</div>' 3214 + '</div>' 3215 3216 if (itemHTML != "") { 3217 dataItems += itemHTML; 3218 } 3219 3220 3221 3222 3223 3224 }); 3225 3226 3227 listingWrapper.append(dataItems); 3228 3229 if ($(listingWrapper).children().length >= data.PageCount) { 3230 loadMore.hide(); 3231 3232 3233 } else { 3234 loadMore.show(); 3235 3236 3237 } 3238 3239 //For anchor with browser back 3240 var currentUrl = window.location; 3241 if (window.location.search.length) { 3242 var currentUrl = window.location.href.split('?')[0]; 3243 } 3244 urlPushState = currentUrl + urlPushState; 3245 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(listingWrapper.children().length)); 3246 window.history.pushState(null, null, urlPushState); 3247 3248 3249 }, 3250 error: function (jqXHR, textStatus, errorThrown) { 3251 $(loadmore).show() 3252 c.loader.hide(listingWrapper.parent()); 3253 }, 3254 complete: function () { 3255 c.loader.hide(listingWrapper.parent()); 3256 } 3257 }); 3258 }); 3259 } 3260 }, 3261 commentaries: { 3262 init: function() { 3263 3264 var listingWrapper = $('.tab-context-wrapper.commentaries .flex-wrapper'); 3265 3266 3267 var dd = $('.staff-dropdown.commentaries'); 3268 3269 var c= wpContent; 3270 3271 3272 // dd.on('click', function (e) { 3273 // e.preventDefault(); 3274 // if ($(this).hasClass("open")) { 3275 // $(this).removeClass("open") 3276 // } else { 3277 // $(this).addClass("open") 3278 // } 3279 3280 // }) 3281 3282 3283 3284 dd.find('a').bind('click', function (e) { 3285 3286 3287 3288 3289 e.preventDefault(); 3290 var $t = $(this); 3291 3292 c.loader.show(listingWrapper.parent(),true); 3293 3294 //loadEvent($t.attr('data-id')); 3295 3296 3297 3298 var selectValue = $(this).attr('data-id'); 3299 var selectTitle = $(this).attr('title'); 3300 3301 if (selectValue != '' && selectValue != 'all') { 3302 apiUrl = "/api/CorpCommentariesApi/GetCommentariesBySeeMore?itemscount=0&year={0}".f(selectValue); 3303 urlPushState = "?itemscount={0}&year={1}".f(listingWrapper.children().length, selectValue); 3304 } 3305 else { 3306 apiUrl = "/api/CorpCommentariesApi/GetCommentariesBySeeMore?itemscount=0&year={0}".f(selectValue); 3307 urlPushState = "?itemscount={0}&year={1}".f(listingWrapper.children().length, selectValue); 3308 } 3309 3310 3311 GetDataShowMoreCommentaries(true, apiUrl, urlPushState, listingWrapper); 3312 3313 3314 dd.find('.label').text(selectTitle) 3315 dd.find('#filterYear').removeClass("active") 3316 3317 3318 3319 }); 3320 3321 3322 3323 3324 3325 function GetDataShowMoreCommentaries(flagDropdow, apiUrl, urlPushState, nameList) { 3326 // var $t = $(this); 3327 var items; 3328 var dataItems = ""; 3329 var loadMore = $('#commentaries-load-more') 3330 3331 $.ajax({
3332 url: apiUrl, 3333 success: function (data) { 3334 if (data.Result) { 3335 3336 nameList.html('') 3337 3338 $(data.Data).each(function(idx, item){ 3339 3340 3341 3342 var itemHTML = ""; 3343 3344 3345 //start 3346 3347 itemHTML = `<div class="flex-item-wrapper">` 3348 + `<div class="img-wrapper">` 3349 + `<a href="${item.LinkURL}"><img src="${item.ProfilePicture}" alt=""></a>` 3350 + `</div>` 3351 + `<div class="artist-name">` 3352 + `<p class="font-weight-bold pt-2 mb-0">${item.Title}</p>` 3353 3354 3355 3356 itemHTML += '</div>' 3357 + '</div>' 3358 3359 nameList.append(itemHTML) 3360 }) 3361 3362 if (nameList.children().length >= data.PageCount) { 3363 loadMore.hide(); 3364 3365 3366 } else { 3367 loadMore.show(); 3368 3369 3370 } 3371 3372 //For anchor with browser back 3373 var currentUrl = window.location; 3374 if (window.location.search.length) { 3375 var currentUrl = window.location.href.split('?')[0]; 3376 } 3377 urlPushState = currentUrl + urlPushState; 3378 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(listingWrapper.children().length)); 3379 window.history.pushState(null, null, urlPushState); 3380 3381 } 3382 }, 3383 error: function (jqXHR, textStatus, errorThrown) { 3384 c.loader.hide(listingWrapper.parent()); 3385 }, 3386 complete: function () { 3387 c.loader.hide(listingWrapper.parent()); 3388 3389 } 3390 3391 }); 3392 } 3393 3394 3395 //Load More 3396 $('#commentaries-load-more').bind('click', function (e) { 3397 e.preventDefault(); 3398 var $t = $(this); 3399 var items; 3400 var dataItems = ""; 3401 var year = dd.find('a.active').attr("data-id"); 3402 var loadMore = $('#commentaries-load-more') 3403 var listingWrapper = $('.tab-context-wrapper.commentaries .flex-wrapper'); 3404 3405 3406 c.loader.show(listingWrapper.parent(),false); 3407 3408 var serviceUrl = ""; 3409 if (dd.find('a.active').attr("data-id") != "" && dd.find('a.active').attr("data-id") != "all") { 3410 serviceUrl = '/api/CorpCommentariesApi/GetCommentariesBySeeMore?itemscount={0}&year={1}'.f(listingWrapper.children().length, year); 3411 urlPushState = '?itemscount=0&year={0}'.f(year); 3412 } 3413 else { 3414 serviceUrl = '/api/CorpCommentariesApi/GetCommentariesBySeeMore?itemscount={0}&year={1}'.f(listingWrapper.children().length, year); 3415 urlPushState = '?itemscount=0&year={0}'.f(year); 3416 } 3417 3418 $.ajax({
3419 url: serviceUrl, 3420 success: function (data) { 3421 $.each(data.Data, function (index, item) { 3422 3423 3424 var itemHTML = ""; 3425 3426 itemHTML = `<div class="flex-item-wrapper">` 3427 + `<div class="img-wrapper">` 3428 + `<a href="${item.LinkURL}"><img src="${item.ProfilePicture}" alt=""></a>` 3429 + `</div>` 3430 + `<div class="artist-name">` 3431 + `<p class="font-weight-bold pt-2 mb-0">${item.Title}</p>` 3432 + `<p>${item.Description}</p>` 3433 + `</div>` 3434 + `</div>` 3435 3436 if (itemHTML != "") { 3437 dataItems += itemHTML; 3438 } 3439 3440 3441 3442 3443 }); 3444 3445 3446 listingWrapper.append(dataItems); 3447 3448 if (listingWrapper.children().length >= data.PageCount) { 3449 loadMore.hide(); 3450 3451 3452 } else { 3453 loadMore.show(); 3454 3455 3456 } 3457 3458 //For anchor with browser back 3459 var currentUrl = window.location; 3460 if (window.location.search.length) { 3461 var currentUrl = window.location.href.split('?')[0]; 3462 } 3463 urlPushState = currentUrl + urlPushState; 3464 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(listingWrapper.children().length)); 3465 window.history.pushState(null, null, urlPushState); 3466 3467 3468 }, 3469 error: function (jqXHR, textStatus, errorThrown) { 3470 c.loader.hide(listingWrapper.parent()); 3471 }, 3472 complete: function () { 3473 c.loader.hide(listingWrapper.parent()); 3474 } 3475 }); 3476 }); 3477 } 3478 }, 3479 events: { 3480 init: function() { 3481 3482 var c= wpContent; 3483 3484 var ddlFilter = $('.tab-menu-wrapper.events ul'); 3485 var listingWrapper = $('.tab-context-wrapper.events .flex-wrapper'); 3486 3487 var dd = $('.staff-dropdown.events'); 3488 3489 3490 // dd.on('click', function (e) { 3491 // e.preventDefault(); 3492 // if ($(this).hasClass("open")) { 3493 // $(this).removeClass("open") 3494 // } else { 3495 // $(this).addClass("open") 3496 // } 3497 3498 // }) 3499 3500 3501 bindYearDropdown() 3502 3503 3504 function bindYearDropdown() { 3505 3506 var ddInner = $('.staff-dropdown.events'); 3507 3508 ddInner.find('a').unbind().bind('click', function(e){ 3509 3510 e.preventDefault(); 3511 c.loader.show(listingWrapper.parent(),true); 3512 3513 //dd.find('#filterYear').val($(this).attr('data-id')) 3514 //dd.find('#filterDropdownYear').text($(this).attr('title')) 3515 3516 var selectValue = ddlFilter.find('li.active').attr('data-id'); 3517 3518 3519 3520 var year = $(this).attr("data-id") 3521 3522 if (selectValue != '' && selectValue != 'all') { 3523 3524 apiUrl = "/api/Events/GetEventsBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, year); 3525 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, year); 3526 3527 } else { 3528 3529 apiUrl = "/api/Events/GetEventsBySeeMore?itemscount=0&year={0}".f(year); 3530 urlPushState = "?itemscount=0&year={0}".f(year); 3531 } 3532 3533 var action = "yearFilter" 3534 3535 3536 GetDataShowMoreEvents(true, apiUrl, urlPushState, listingWrapper, action); 3537 3538 3539 3540 3541 //set the active year 3542 ddInner.find('li').each(function () { 3543 if ($(this).hasClass("active")) { 3544 $(this).removeClass("active"); 3545 } 3546 }); 3547 3548 console.log($(this).attr("data-id")) 3549 console.log($(this).parent('li')) 3550 $(this).parent('li').addClass("active"); 3551 3552 var selectTitle = ddInner.find('li.active').find('a').attr('title'); 3553 3554 3555 ddInner.find('.label').html(selectTitle) 3556 3557 ddInner.find('#filterYear').removeClass("active") 3558 }) 3559 } 3560 3561 3562 3563 3564 3565 // $('.tab-menu-wrapper#events-listing ul').slick({ 3566 // dots: false, 3567 // speed: 500, 3568 // slidesToShow: 8, 3569 // slidesToScroll: 1, 3570 // infinite: false, 3571 // arrows: true, 3572 // responsive: [ 3573 // { 3574 // breakpoint: 767, 3575 // settings: { 3576 // arrows: false, 3577 // slidesToShow: 1, 3578 // slidesToScroll: 1 3579 // } 3580 // }] 3581 // }); 3582 3583 ddlFilter.find('li').bind('click', function (e) { 3584 e.preventDefault(); 3585 var $t = $(this); 3586 3587 c.loader.show(listingWrapper.parent(),true); 3588 3589 //loadEvent($t.attr('data-id')); 3590 3591 var year = dd.find('li.active').find('a').attr("data-id") 3592 3593 3594 3595 var selectValue = $(this).attr('data-id'); 3596 3597 3598 if (selectValue != '' && selectValue != 'all') { 3599 apiUrl = "/api/Events/GetEventsBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, year); 3600 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, year); 3601 } 3602 else { 3603 apiUrl = "/api/Events/GetEventsBySeeMore?itemscount=0&year={0}".f(year); 3604 urlPushState = "?itemscount=0&year={0}".f(year); 3605 } 3606 3607 3608 var action = "typeFilter" 3609 3610 GetDataShowMoreEvents(true, apiUrl, urlPushState, listingWrapper, action); 3611 3612 3613 }); 3614 3615 function GetDataShowMoreEvents(flagDropdow, apiUrl, urlPushState, nameList, action) { 3616 // var $t = $(this); 3617 var items; 3618 var dataItems = ""; 3619 var loadMore = $('#events-load-more') 3620 3621 $.ajax({
3622 url: apiUrl, 3623 success: function (data) { 3624 if (data.Result) { 3625 3626 3627 if (action == "yearFilter" || action == "typeFilter") { 3628 3629 nameList.html('') 3630 3631 } 3632 3633 3634 $(data.Data).each(function(idx, item){ 3635 3636 var itemHTML = ""; 3637 3638 3639 //start 3640 var displayCalendar = ""; 3641 var displayCalendar2 = ""; 3642 var displayCalendar3 = ""; 3643 var displayCalendar4 = ""; 3644 var displayCalendar5 = ""; 3645 if (item.BookStatus != "Available") 3646 { 3647 displayCalendar = "display:none"; 3648 } 3649 if (item.BookStatus2 != "Available") 3650 { 3651 displayCalendar2 = "display:none"; 3652 } 3653 if (item.BookStatus3 != "Available") 3654 { 3655 displayCalendar3 = "display:none"; 3656 } 3657 if (item.BookStatus4 != "Available") 3658 { 3659 displayCalendar4 = "display:none"; 3660 } 3661 if (item.BookStatus5 != "Available") 3662 { 3663 displayCalendar5 = "display:none"; 3664 } 3665 3666 itemHTML = `<div class="flex-item-wrapper">` 3667 + `<div class="img-wrapper">` 3668 + `<a href="${item.LinkURL}"><img src="${item.ProfileImageURL}" alt=""></a>` 3669 + `</div>` 3670 + `<div class="artist-name">` 3671 + `<p class="font-weight-bold pt-2 mb-0">${item.Name} | ${item.EventType}</p>` 3672 3673 if (item.StartEndTimeAndDuration != "") 3674 { 3675 itemHTML += `<p class="text-darkgrey">` 3676 + `${item.StartEndTimeAndDuration}` 3677 + `<a class="bookstatus" href="javascript:void(0);"> ${item.BookStatus} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar}"></span></a>` 3678 + `</p>` 3679 } 3680 if (item.Location != "" && item.CheckLocation) 3681 { 3682 itemHTML += `<p class="bold">${item.Location}</p>` 3683 } 3684 if (item.StartEndTimeAndDuration2 != "") 3685 { 3686 itemHTML += `<p class="text-darkgrey">` 3687 + `${item.StartEndTimeAndDuration2}` 3688 + `<a class="bookstatus" href="javascript:void(0);"> ${item.BookStatus2} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar2}"></span></a>` 3689 + `</p>` 3690 } 3691 if (item.Location2 != "") 3692 { 3693 itemHTML += `<p class="bold">${item.Location2}</p>` 3694 } 3695 if (item.StartEndTimeAndDuration3 != "") 3696 { 3697 itemHTML += `<p class="text-darkgrey">` 3698 + `${item.StartEndTimeAndDuration3}` 3699 + `<a class="bookstatus" href="javascript:void(0);">${item.BookStatus3} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar3}"></span></a>` 3700 + `</p>` 3701 } 3702 3703 if (item.Location3 != "" && item.CheckLocation) 3704 { 3705 itemHTML += `<p class="bold">${item.Location3}</p>` 3706 } 3707 3708 if (item.StartEndTimeAndDuration4 != "") 3709 { 3710 itemHTML += `<p class="text-darkgrey">` 3711 + `${item.StartEndTimeAndDuration4}` 3712 + `<a class="bookstatus" href="javascript:void(0);">${item.BookStatus4} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar4}"></span></a>` 3713 + `</p>` 3714 } 3715 if (item.Location4!= "") 3716 { 3717 itemHTML += `<p class="bold">${item.Location4}</p>` 3718 } 3719 if (item.StartEndTimeAndDuration5 != "") 3720 { 3721 itemHTML += `<p class="text-darkgrey">` 3722 + `${item.StartEndTimeAndDuration5}` 3723 + `<a class="bookstatus" href="javascript:void(0);">${item.BookStatus5} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar5}"></span></a>` 3724 + `</p>` 3725 } 3726 if (item.Location5 != "") 3727 { 3728 itemHTML += `<p class="bold">${item.Location5}</p>` 3729 } 3730 if (!item.CheckLocation) 3731 { 3732 itemHTML += `<p class="bold">${item.Location}</p>` 3733 } 3734 3735 itemHTML += '</div>' 3736 + '</div>' 3737
3738 nameList.append(itemHTML) 3739 }) 3740 3741 3742 if (nameList.children().length >= data.PageCount) { 3743 loadMore.hide(); 3744 3745 3746 } else { 3747 loadMore.show(); 3748 3749 3750 } 3751 3752 //If year dropdown need to update 3753 if($(data.Years).length > 0 && action == "typeFilter") { 3754 3755 $('#filterYear').html('') 3756 3757 3758 var existInReturnedYears = false; 3759 var firstYearTitle = ""; 3760 $(data.Years).each(function(idx, obj){ 3761 3762 3763 if (idx == 0) { 3764 firstYearTitle = obj.Title; 3765 $('#filterYear').append(`<li class="active"><a data-id="${obj.Value}" tabindex="-1" href="#" title="${obj.Title}">${obj.Title}</a></li>`) 3766 } else { 3767 $('#filterYear').append(`<li><a data-id="${obj.Value}" tabindex="-1" href="#" title="${obj.Title}">${obj.Title}</a></li>`) 3768 } 3769 3770 if (obj.Value == $('.staff-dropdown.events .label').text()) { 3771 existInReturnedYears = true 3772 } 3773 3774 }) 3775 3776 if (!existInReturnedYears) { 3777 3778 $('.staff-dropdown.events .label').text(firstYearTitle) 3779 } 3780 3781 3782 bindYearDropdown() 3783 3784 } 3785 3786 3787 //For anchor with browser back 3788 var currentUrl = window.location; 3789 if (window.location.search.length) { 3790 var currentUrl = window.location.href.split('?')[0]; 3791 } 3792 urlPushState = currentUrl + urlPushState; 3793 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 3794 window.history.pushState(null, null, urlPushState); 3795 } 3796 }, 3797 error: function (jqXHR, textStatus, errorThrown) { 3798 c.loader.hide(listingWrapper.parent()); 3799 }, 3800 complete: function () { 3801 3802 c.loader.hide(listingWrapper.parent()); 3803 } 3804 3805 }); 3806 } 3807 3808 3809 //Load More 3810 $('#events-load-more').bind('click', function (e) { 3811 e.preventDefault(); 3812 3813 3814 var $t = $(this); 3815 var items; 3816 var dataItems = ""; 3817 var eventTypeId = ddlFilter.find('li.active').attr("data-id"); 3818 var year = dd.find('li.active').find('a').attr("data-id") 3819 var loadMore = $('#events-load-more') 3820 var listingWrapper = $('.tab-context-wrapper.events .flex-wrapper'); 3821 3822 c.loader.show(listingWrapper.parent(),false); 3823 3824 var serviceUrl = ""; 3825 3826 3827 serviceUrl = '/api/Events/GetEventsBySeeMore?itemscount={0}&type={1}&year={2}'.f(listingWrapper.children().length, eventTypeId, year); 3828 urlPushState = '?itemscount=0&type={0}&year={1}'.f(eventTypeId, year); 3829 3830 $.ajax({
3831 url: serviceUrl, 3832 success: function (data) { 3833 $.each(data.Data, function (index, item) { 3834 3835 3836 var itemHTML = ""; 3837 3838 3839 //start 3840 var displayCalendar = ""; 3841 var displayCalendar2 = ""; 3842 var displayCalendar3 = ""; 3843 var displayCalendar4 = ""; 3844 var displayCalendar5 = ""; 3845 if (item.BookStatus != "Available") 3846 { 3847 displayCalendar = "display:none"; 3848 } 3849 if (item.BookStatus2 != "Available") 3850 { 3851 displayCalendar2 = "display:none"; 3852 } 3853 if (item.BookStatus3 != "Available") 3854 { 3855 displayCalendar3 = "display:none"; 3856 } 3857 if (item.BookStatus4 != "Available") 3858 { 3859 displayCalendar4 = "display:none"; 3860 } 3861 if (item.BookStatus5 != "Available") 3862 { 3863 displayCalendar5 = "display:none"; 3864 } 3865 3866 itemHTML = `<div class="flex-item-wrapper">` 3867 + `<div class="img-wrapper">` 3868 + `<a href="${item.LinkURL}"><img src="${item.ProfileImageURL}" alt=""></a>` 3869 + `</div>` 3870 + `<div class="artist-name">` 3871 + `<p class="font-weight-bold pt-2 mb-0">${item.Name} | ${item.EventType}</p>` 3872 3873 if (item.StartEndTimeAndDuration != "") 3874 { 3875 itemHTML += `<p class="text-darkgrey">` 3876 + `${item.StartEndTimeAndDuration}` 3877 + `<a class="bookstatus" href="javascript:void(0);"> ${item.BookStatus} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar}"></span></a>` 3878 + `</p>` 3879 } 3880 if (item.Location != "" && item.CheckLocation) 3881 { 3882 itemHTML += `<p class="bold">${item.Location}</p>` 3883 } 3884 if (item.StartEndTimeAndDuration2 != "") 3885 { 3886 itemHTML += `<p class="text-darkgrey">` 3887 + `${item.StartEndTimeAndDuration2}` 3888 + `<a class="bookstatus" href="javascript:void(0);"> ${item.BookStatus2} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar2}"></span></a>` 3889 + `</p>` 3890 } 3891 if (item.Location2 != "") 3892 { 3893 itemHTML += `<p class="bold">${item.Location2}</p>` 3894 } 3895 if (item.StartEndTimeAndDuration3 != "") 3896 { 3897 itemHTML += `<p class="text-darkgrey">` 3898 + `${item.StartEndTimeAndDuration3}` 3899 + `<a class="bookstatus" href="javascript:void(0);">${item.BookStatus3} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar3}"></span></a>` 3900 + `</p>` 3901 } 3902 3903 if (item.Location3 != "" && item.CheckLocation) 3904 { 3905 itemHTML += `<p class="bold">${item.Location3}</p>` 3906 } 3907 3908 if (item.StartEndTimeAndDuration4 != "") 3909 { 3910 itemHTML += `<p class="text-darkgrey">` 3911 + `${item.StartEndTimeAndDuration4}` 3912 + `<a class="bookstatus" href="javascript:void(0);">${item.BookStatus4} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar4}"></span></a>` 3913 + `</p>` 3914 } 3915 if (item.Location4!= "") 3916 { 3917 itemHTML += `<p class="bold">${item.Location4}</p>` 3918 } 3919 if (item.StartEndTimeAndDuration5 != "") 3920 { 3921 itemHTML += `<p class="text-darkgrey">` 3922 + `${item.StartEndTimeAndDuration5}` 3923 + `<a class="bookstatus" href="javascript:void(0);">${item.BookStatus5} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar5}"></span></a>` 3924 + `</p>` 3925 } 3926 if (item.Location5 != "") 3927 { 3928 itemHTML += `<p class="bold">${item.Location5}</p>` 3929 } 3930 if (!item.CheckLocation) 3931 { 3932 itemHTML += `<p class="bold">${item.Location}</p>` 3933 } 3934 3935 itemHTML += '</div>' 3936 + '</div>' 3937 3938 if (itemHTML != "") { 3939 dataItems += itemHTML; 3940 } 3941 3942 3943 3944 3945 3946 }); 3947 3948 3949 listingWrapper.append(dataItems); 3950 3951 3952 if (listingWrapper.children().length >= data.PageCount) { 3953
3954 loadMore.hide(); 3955 3956 3957 } else { 3958 3959 loadMore.show(); 3960 3961 3962 } 3963 3964 //For anchor with browser back 3965 var currentUrl = window.location; 3966 if (window.location.search.length) { 3967 var currentUrl = window.location.href.split('?')[0]; 3968 } 3969 urlPushState = currentUrl + urlPushState; 3970 3971 console.log(listingWrapper.children().length) 3972 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(listingWrapper.children().length)); 3973 window.history.pushState(null, null, urlPushState); 3974 3975 3976 }, 3977 error: function (jqXHR, textStatus, errorThrown) { 3978 c.loader.hide(listingWrapper.parent()); 3979 }, 3980 complete: function () { 3981 c.loader.hide(listingWrapper.parent()); 3982 } 3983 }); 3984 }); 3985 } 3986 }, 3987 alumniEvents: { 3988 init: function() { 3989 3990 var c= wpContent; 3991 3992 var ddlFilter = $('.tab-menu-wrapper.events ul'); 3993 var listingWrapper = $('.tab-context-wrapper.events .flex-wrapper'); 3994 3995 var dd = $('.alumni-dropdown.events'); 3996 3997 3998 // dd.on('click', function (e) { 3999 // e.preventDefault(); 4000 // if ($(this).hasClass("open")) { 4001 // $(this).removeClass("open") 4002 // } else { 4003 // $(this).addClass("open") 4004 // } 4005 4006 // }) 4007 4008 4009 bindYearDropdown() 4010 4011 4012 function bindYearDropdown() { 4013 4014 var ddInner = $('.alumni-dropdown.events'); 4015 4016 ddInner.find('a').unbind().bind('click', function(e){ 4017 4018 e.preventDefault(); 4019 c.loader.show(listingWrapper.parent(),true); 4020 4021 //dd.find('#filterYear').val($(this).attr('data-id')) 4022 //dd.find('#filterDropdownYear').text($(this).attr('title')) 4023 4024 var selectValue = ddlFilter.find('li.active').attr('data-id'); 4025 4026 4027 4028 var year = $(this).attr("data-id") 4029 4030 if (selectValue != '' && selectValue != 'all') { 4031 4032 apiUrl = "/api/Events/GetAlumniEventsBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, year); 4033 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, year); 4034 4035 } else { 4036 4037 apiUrl = "/api/Events/GetAlumniEventsBySeeMore?itemscount=0&year={0}".f(year); 4038 urlPushState = "?itemscount=0&year={0}".f(year); 4039 } 4040 4041 var action = "yearFilter" 4042 4043 4044 GetDataShowMoreEvents(true, apiUrl, urlPushState, listingWrapper, action); 4045 4046 4047 4048 4049 //set the active year 4050 ddInner.find('li').each(function () { 4051 if ($(this).hasClass("active")) { 4052 $(this).removeClass("active"); 4053 } 4054 }); 4055 4056 console.log($(this).attr("data-id")) 4057 console.log($(this).parent('li')) 4058 $(this).parent('li').addClass("active"); 4059 4060 var selectTitle = ddInner.find('li.active').find('a').attr('title'); 4061 4062 4063 ddInner.find('.label').html(selectTitle) 4064 4065 ddInner.find('#filterYear').removeClass("active") 4066 }) 4067 } 4068 4069 4070 4071 4072 4073 // $('.tab-menu-wrapper#events-listing ul').slick({ 4074 // dots: false, 4075 // speed: 500, 4076 // slidesToShow: 8, 4077 // slidesToScroll: 1, 4078 // infinite: false, 4079 // arrows: true, 4080 // responsive: [ 4081 // { 4082 // breakpoint: 767, 4083 // settings: { 4084 // arrows: false, 4085 // slidesToShow: 1, 4086 // slidesToScroll: 1 4087 // } 4088 // }] 4089 // }); 4090 4091 ddlFilter.find('li').bind('click', function (e) { 4092 e.preventDefault(); 4093 var $t = $(this); 4094 4095 c.loader.show(listingWrapper.parent(),true); 4096 4097 //loadEvent($t.attr('data-id')); 4098 4099 var year = dd.find('li.active').find('a').attr("data-id") 4100 4101 4102 4103 var selectValue = $(this).attr('data-id'); 4104 4105 4106 if (selectValue != '' && selectValue != 'all') { 4107 apiUrl = "/api/Events/GetAlumniEventsBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, year); 4108 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, year); 4109 } 4110 else { 4111 apiUrl = "/api/Events/GetAlumniEventsBySeeMore?itemscount=0&year={0}".f(year); 4112 urlPushState = "?itemscount=0&year={0}".f(year); 4113 } 4114 4115 4116 var action = "typeFilter" 4117 4118 GetDataShowMoreEvents(true, apiUrl, urlPushState, listingWrapper, action); 4119 4120 4121 }); 4122 4123 function GetDataShowMoreEvents(flagDropdow, apiUrl, urlPushState, nameList, action) { 4124 // var $t = $(this); 4125 var items; 4126 var dataItems = ""; 4127 var loadMore = $('#events-load-more') 4128 4129 $.ajax({
4130 url: apiUrl, 4131 success: function (data) { 4132 if (data.Result) { 4133 4134 4135 if (action == "yearFilter" || action == "typeFilter") { 4136 4137 nameList.html('') 4138 4139 } 4140 4141 4142 $(data.Data).each(function(idx, item){ 4143 4144 var itemHTML = ""; 4145 4146 4147 //start 4148 var displayCalendar = ""; 4149 var displayCalendar2 = ""; 4150 var displayCalendar3 = ""; 4151 var displayCalendar4 = ""; 4152 var displayCalendar5 = ""; 4153 if (item.BookStatus != "Available") 4154 { 4155 displayCalendar = "display:none"; 4156 } 4157 if (item.BookStatus2 != "Available") 4158 { 4159 displayCalendar2 = "display:none"; 4160 } 4161 if (item.BookStatus3 != "Available") 4162 { 4163 displayCalendar3 = "display:none"; 4164 } 4165 if (item.BookStatus4 != "Available") 4166 { 4167 displayCalendar4 = "display:none"; 4168 } 4169 if (item.BookStatus5 != "Available") 4170 { 4171 displayCalendar5 = "display:none"; 4172 } 4173 4174 itemHTML = `<div class="flex-item-wrapper">` 4175 + `<div class="img-wrapper">` 4176 + `<a href="${item.LinkURL}"><img src="${item.ProfileImageURL}" alt=""></a>` 4177 + `</div>` 4178 + `<div class="artist-name">` 4179 + `<p class="font-weight-bold pt-2 mb-0">${item.Name} | ${item.EventType}</p>` 4180 4181 if (item.StartEndTimeAndDuration != "") 4182 { 4183 itemHTML += `<p class="text-darkgrey">` 4184 + `${item.StartEndTimeAndDuration}` 4185 + `<a class="bookstatus" href="javascript:void(0);"> ${item.BookStatus} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar}"></span></a>` 4186 + `</p>` 4187 } 4188 if (item.Location != "" && item.CheckLocation) 4189 { 4190 itemHTML += `<p class="bold">${item.Location}</p>` 4191 } 4192 if (item.StartEndTimeAndDuration2 != "") 4193 { 4194 itemHTML += `<p class="text-darkgrey">` 4195 + `${item.StartEndTimeAndDuration2}` 4196 + `<a class="bookstatus" href="javascript:void(0);"> ${item.BookStatus2} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar2}"></span></a>` 4197 + `</p>` 4198 } 4199 if (item.Location2 != "") 4200 { 4201 itemHTML += `<p class="bold">${item.Location2}</p>` 4202 } 4203 if (item.StartEndTimeAndDuration3 != "") 4204 { 4205 itemHTML += `<p class="text-darkgrey">` 4206 + `${item.StartEndTimeAndDuration3}` 4207 + `<a class="bookstatus" href="javascript:void(0);">${item.BookStatus3} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar3}"></span></a>` 4208 + `</p>` 4209 } 4210 4211 if (item.Location3 != "" && item.CheckLocation) 4212 { 4213 itemHTML += `<p class="bold">${item.Location3}</p>` 4214 } 4215 4216 if (item.StartEndTimeAndDuration4 != "") 4217 { 4218 itemHTML += `<p class="text-darkgrey">` 4219 + `${item.StartEndTimeAndDuration4}` 4220 + `<a class="bookstatus" href="javascript:void(0);">${item.BookStatus4} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar4}"></span></a>` 4221 + `</p>` 4222 } 4223 if (item.Location4!= "") 4224 { 4225 itemHTML += `<p class="bold">${item.Location4}</p>` 4226 } 4227 if (item.StartEndTimeAndDuration5 != "") 4228 { 4229 itemHTML += `<p class="text-darkgrey">` 4230 + `${item.StartEndTimeAndDuration5}` 4231 + `<a class="bookstatus" href="javascript:void(0);">${item.BookStatus5} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar5}"></span></a>` 4232 + `</p>` 4233 } 4234 if (item.Location5 != "") 4235 { 4236 itemHTML += `<p class="bold">${item.Location5}</p>` 4237 } 4238 if (!item.CheckLocation) 4239 { 4240 itemHTML += `<p class="bold">${item.Location}</p>` 4241 } 4242 4243 itemHTML += '</div>' 4244 + '</div>' 4245
4246 nameList.append(itemHTML) 4247 }) 4248 4249 4250 if (nameList.children().length >= data.PageCount) { 4251 loadMore.hide(); 4252 4253 4254 } else { 4255 loadMore.show(); 4256 4257 4258 } 4259 4260 //If year dropdown need to update 4261 if($(data.Years).length > 0 && action == "typeFilter") { 4262 4263 $('#filterYear').html('') 4264 4265 4266 var existInReturnedYears = false; 4267 var firstYearTitle = ""; 4268 $(data.Years).each(function(idx, obj){ 4269 4270 4271 if (idx == 0) { 4272 firstYearTitle = obj.Title; 4273 $('#filterYear').append(`<li class="active"><a data-id="${obj.Value}" tabindex="-1" href="#" title="${obj.Title}">${obj.Title}</a></li>`) 4274 } else { 4275 $('#filterYear').append(`<li><a data-id="${obj.Value}" tabindex="-1" href="#" title="${obj.Title}">${obj.Title}</a></li>`) 4276 } 4277 4278 if (obj.Value == $('.alumni-dropdown.events .label').text()) { 4279 existInReturnedYears = true 4280 } 4281 4282 }) 4283 4284 if (!existInReturnedYears) { 4285 4286 $('.alumni-dropdown.events .label').text(firstYearTitle) 4287 } 4288 4289 4290 bindYearDropdown() 4291 4292 } 4293 4294 4295 //For anchor with browser back 4296 var currentUrl = window.location.href.split('#')[0]; 4297 var anchor = window.location.href.split('#')[1]; 4298 if (window.location.search.length) { 4299 var currentUrl = window.location.href.split('?')[0]; 4300 } 4301 urlPushState = currentUrl + urlPushState + "#" + anchor; 4302 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 4303 window.history.pushState(null, null, urlPushState); 4304 } 4305 }, 4306 error: function (jqXHR, textStatus, errorThrown) { 4307 c.loader.hide(listingWrapper.parent()); 4308 }, 4309 complete: function () { 4310 4311 c.loader.hide(listingWrapper.parent()); 4312 } 4313 4314 }); 4315 } 4316 4317 4318 //Load More 4319 $('#events-load-more').bind('click', function (e) { 4320 e.preventDefault(); 4321 4322 4323 var $t = $(this); 4324 var items; 4325 var dataItems = ""; 4326 var eventTypeId = ddlFilter.find('li.active').attr("data-id"); 4327 var year = dd.find('li.active').find('a').attr("data-id") 4328 var loadMore = $('#events-load-more') 4329 var listingWrapper = $('.tab-context-wrapper.events .flex-wrapper'); 4330 4331 c.loader.show(listingWrapper.parent(),false); 4332 4333 var serviceUrl = ""; 4334 4335 4336 serviceUrl = '/api/Events/GetAlumniEventsBySeeMore?itemscount={0}&type={1}&year={2}'.f(listingWrapper.children().length, eventTypeId, year); 4337 urlPushState = '?itemscount=0&type={0}&year={1}'.f(eventTypeId, year); 4338 4339 $.ajax({
4340 url: serviceUrl, 4341 success: function (data) { 4342 $.each(data.Data, function (index, item) { 4343 4344 4345 var itemHTML = ""; 4346 4347 4348 //start 4349 var displayCalendar = ""; 4350 var displayCalendar2 = ""; 4351 var displayCalendar3 = ""; 4352 var displayCalendar4 = ""; 4353 var displayCalendar5 = ""; 4354 if (item.BookStatus != "Available") 4355 { 4356 displayCalendar = "display:none"; 4357 } 4358 if (item.BookStatus2 != "Available") 4359 { 4360 displayCalendar2 = "display:none"; 4361 } 4362 if (item.BookStatus3 != "Available") 4363 { 4364 displayCalendar3 = "display:none"; 4365 } 4366 if (item.BookStatus4 != "Available") 4367 { 4368 displayCalendar4 = "display:none"; 4369 } 4370 if (item.BookStatus5 != "Available") 4371 { 4372 displayCalendar5 = "display:none"; 4373 } 4374 4375 itemHTML = `<div class="flex-item-wrapper">` 4376 + `<div class="img-wrapper">` 4377 + `<a href="${item.LinkURL}"><img src="${item.ProfileImageURL}" alt=""></a>` 4378 + `</div>` 4379 + `<div class="artist-name">` 4380 + `<p class="font-weight-bold pt-2 mb-0">${item.Name} | ${item.EventType}</p>` 4381 4382 if (item.StartEndTimeAndDuration != "") 4383 { 4384 itemHTML += `<p class="text-darkgrey">` 4385 + `${item.StartEndTimeAndDuration}` 4386 + `<a class="bookstatus" href="javascript:void(0);"> ${item.BookStatus} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar}"></span></a>` 4387 + `</p>` 4388 } 4389 if (item.Location != "" && item.CheckLocation) 4390 { 4391 itemHTML += `<p class="bold">${item.Location}</p>` 4392 } 4393 if (item.StartEndTimeAndDuration2 != "") 4394 { 4395 itemHTML += `<p class="text-darkgrey">` 4396 + `${item.StartEndTimeAndDuration2}` 4397 + `<a class="bookstatus" href="javascript:void(0);"> ${item.BookStatus2} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar2}"></span></a>` 4398 + `</p>` 4399 } 4400 if (item.Location2 != "") 4401 { 4402 itemHTML += `<p class="bold">${item.Location2}</p>` 4403 } 4404 if (item.StartEndTimeAndDuration3 != "") 4405 { 4406 itemHTML += `<p class="text-darkgrey">` 4407 + `${item.StartEndTimeAndDuration3}` 4408 + `<a class="bookstatus" href="javascript:void(0);">${item.BookStatus3} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar3}"></span></a>` 4409 + `</p>` 4410 } 4411 4412 if (item.Location3 != "" && item.CheckLocation) 4413 { 4414 itemHTML += `<p class="bold">${item.Location3}</p>` 4415 } 4416 4417 if (item.StartEndTimeAndDuration4 != "") 4418 { 4419 itemHTML += `<p class="text-darkgrey">` 4420 + `${item.StartEndTimeAndDuration4}` 4421 + `<a class="bookstatus" href="javascript:void(0);">${item.BookStatus4} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar4}"></span></a>` 4422 + `</p>` 4423 } 4424 if (item.Location4!= "") 4425 { 4426 itemHTML += `<p class="bold">${item.Location4}</p>` 4427 } 4428 if (item.StartEndTimeAndDuration5 != "") 4429 { 4430 itemHTML += `<p class="text-darkgrey">` 4431 + `${item.StartEndTimeAndDuration5}` 4432 + `<a class="bookstatus" href="javascript:void(0);">${item.BookStatus5} <span class="ico ico-calendar-sm" style="float:none;${displayCalendar5}"></span></a>` 4433 + `</p>` 4434 } 4435 if (item.Location5 != "") 4436 { 4437 itemHTML += `<p class="bold">${item.Location5}</p>` 4438 } 4439 if (!item.CheckLocation) 4440 { 4441 itemHTML += `<p class="bold">${item.Location}</p>` 4442 } 4443 4444 itemHTML += '</div>' 4445 + '</div>' 4446 4447 if (itemHTML != "") { 4448 dataItems += itemHTML; 4449 } 4450 4451 4452 4453 4454 4455 }); 4456 4457 4458 listingWrapper.append(dataItems); 4459 4460 4461 if (listingWrapper.children().length >= data.PageCount) { 4462
4463 loadMore.hide(); 4464 4465 4466 } else { 4467 4468 loadMore.show(); 4469 4470 4471 } 4472 4473 //For anchor with browser back 4474 var currentUrl = window.location.href.split('#')[0]; 4475 var anchor = window.location.href.split('#')[1]; 4476 if (window.location.search.length) { 4477 var currentUrl = window.location.href.split('?')[0]; 4478 } 4479 urlPushState = currentUrl + urlPushState + "#" + anchor; 4480 4481 console.log(listingWrapper.children().length) 4482 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(listingWrapper.children().length)); 4483 window.history.pushState(null, null, urlPushState); 4484 4485 4486 }, 4487 error: function (jqXHR, textStatus, errorThrown) { 4488 c.loader.hide(listingWrapper.parent()); 4489 }, 4490 complete: function () { 4491 c.loader.hide(listingWrapper.parent()); 4492 } 4493 }); 4494 }); 4495 } 4496 }, 4497 eventsCoverage: { 4498 init: function() { 4499 var ddlFilter = $('.tab-menu-wrapper.events-coverage ul'); 4500 var listingWrapper = $('.tab-context-wrapper.events-coverage .flex-wrapper'); 4501 4502 4503 var dd = $('.staff-dropdown.events-coverage'); 4504 4505 4506 var c= wpContent; 4507 4508 // dd.on('click', function (e) { 4509 // e.preventDefault(); 4510 // if ($(this).hasClass("open")) { 4511 // $(this).removeClass("open") 4512 // } else { 4513 // $(this).addClass("open") 4514 // } 4515 4516 // }) 4517 4518 4519 4520 bindYearDropdown() 4521 4522 function bindYearDropdown() { 4523 4524 dd.find('a').unbind().bind('click', function(e){ 4525 e.preventDefault(); 4526 4527 4528 c.loader.show(listingWrapper.parent(),true); 4529 4530 var selType = ddlFilter.find('li.active').attr('data-id') 4531 4532 var year = $(this).attr('data-id'); 4533 var yearTitle = $(this).attr('title'); 4534 4535 4536 4537 if (year != '' && year != 'all') { 4538 4539 apiUrl = "/api/CorpEventsCoverage/GetEventsConverageBySeeMore?itemscount=0&type={0}&year={1}".f(selType, year); 4540 urlPushState = "?itemscount=0&type={0}&year={1}".f(selType, year); 4541 4542 } 4543 else { 4544 4545 apiUrl = "/api/CorpEventsCoverage/GetEventsConverageBySeeMore?itemscount=0&type={0}&year={1}".f(selType, year); 4546 urlPushState = "?itemscount=0&type={0}&year={1}".f(selType, year); 4547 4548 } 4549 4550 4551 var action = "yearFilter" 4552 GetDataShowMoreEventsCoverage(true, apiUrl, urlPushState, listingWrapper, action, year); 4553 4554 4555 4556 dd.find('.label').text(yearTitle) 4557 dd.find('#filterYear').removeClass("active") 4558 4559 4560 4561 //$(this).parent('li').addClass("active"); 4562 4563 }) 4564 4565 } 4566 4567 4568 //Re-create for mobile 4569 4570 4571 $('<div class="dropdown mobile-type-dropdown events-coverage" id="type"><div class="drop-down-menu"><div class="label"></div><ul id="mobileTypeFilter" class="dropdown-menu events-coverage" role="menu" ></ul></div></div>').insertBefore(ddlFilter); 4572 4573 ddlFilter.find('li').each(function(){ 4574 4575 if ($(this).hasClass("active")) { 4576 $('.mobile-type-dropdown').find('.label').text($("<div/>").html($(this).html()).text()) 4577 } 4578 4579 $('.mobile-type-dropdown').find('ul').append($(this)[0].outerHTML) 4580 4581 }) 4582 4583 $('.mobile-type-dropdown').on('click', function(){ 4584 4585 if (!$(this).find('.dropdown-menu').hasClass("active")) { 4586 $(this).find('.dropdown-menu').addClass("active") 4587 } else { 4588 $(this).find('.dropdown-menu').removeClass("active") 4589 } 4590 }) 4591 4592 4593 $('.mobile-type-dropdown').find('li').bind('click', function (e) { 4594 e.preventDefault(); 4595 var $t = $(this); 4596 4597 c.loader.show(listingWrapper.parent(),true); 4598 4599 var selectValue = $(this).attr('data-id'); 4600 4601 ddlFilter.find('li').each(function(){ 4602 4603 if ($(this).attr('data-id') == selectValue) { 4604 ddlFilter.find('li').removeClass("active") 4605 $(this).addClass("active") 4606 } 4607 4608 4609 }) 4610 4611 var selectTitle = $("<div/>").html($(this).html()).text(); 4612 4613 4614 if (selectValue != '' && selectValue != 'all') { 4615 apiUrl = "/api/CorpEventsCoverage/GetEventsConverageBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, year); 4616 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, year); 4617 } 4618 else { 4619 apiUrl = "/api/CorpEventsCoverage/GetEventsConverageBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, year); 4620 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, year); 4621 } 4622 4623 var action = "filtering" 4624 4625 4626 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, action); 4627 4628 $('.mobile-type-dropdown').find('.label').text(selectTitle) 4629 4630 4631 4632 }); 4633 4634 //End re-create for mobile 4635 4636 ddlFilter.find('li').bind('click', function (e) { 4637 e.preventDefault(); 4638 var $t = $(this); 4639 4640 //loadEvent($t.attr('data-id')); 4641 c.loader.show(listingWrapper.parent(),true); 4642 4643 4644 var selectValue = $(this).attr('data-id'); 4645 var year = dd.find('li.active').find('a').attr('data-id') 4646 4647 if (selectValue != '' && selectValue != 'all') { 4648 apiUrl = "/api/CorpEventsCoverage/GetEventsConverageBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, year); 4649 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, year); 4650 } 4651 else { 4652 apiUrl = "/api/CorpEventsCoverage/GetEventsConverageBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, year); 4653 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, year); 4654 } 4655 4656 4657 var action = "typeFilter" 4658 GetDataShowMoreEventsCoverage(true, apiUrl, urlPushState, listingWrapper, action, year); 4659 4660 4661 4662 4663 }); 4664 4665 function GetDataShowMoreEventsCoverage(flagDropdow, apiUrl, urlPushState, nameList, action, year) { 4666 // var $t = $(this); 4667 var items; 4668 var dataItems = ""; 4669 var loadMore = $('#events-coverage-load-more') 4670 4671 $.ajax({
4672 url: apiUrl, 4673 success: function (data) { 4674 if (data.Result) { 4675 4676 4677 if (action == "typeFilter" || action == "yearFilter") { 4678 nameList.html('') 4679 } 4680 4681 4682 4683 var dataHtml = "" 4684 4685 $(data.Data).each(function(idx, item){ 4686 4687 4688 4689 var itemHTML = ""; 4690 4691 4692 4693 itemHTML = `<div class="flex-item-wrapper">` 4694 + `<div class="img-wrapper">` 4695 + `<a href="${item.LinkURL}"><img src="${item.ProfileImageURL}" alt=""></a>` 4696 + `</div>` 4697 + `<div class="artist-name">` 4698 + `<p class="font-weight-bold pt-2 mb-0">${item.Name} | ${item.EventsConverageType}</p>` 4699 + `${item.StudentText}` 4700 + `${item.DepartmentText}` 4701 4702 4703 4704 itemHTML += '</div>' 4705 + '</div>' 4706 4707 dataHtml += itemHTML; 4708 4709 }) 4710 4711 nameList.append(dataHtml) 4712 4713 if (nameList.children().length >= data.PageCount) { 4714 4715 loadMore.hide(); 4716 4717 } else { 4718 4719 loadMore.show(); 4720 4721 } 4722 4723 4724 4725 //If year dropdown need to update 4726 if(($(data.Years).length > 0 && action == "yearFilter") ||($(data.Years).length > 0 && action == "typeFilter") || ($(data.Years).length > 0 && action == "load-more")) { 4727 4728 $('#filterYear').html('') 4729 4730 4731 var existInReturnedYears = false; 4732 var firstYearTitle = ""; 4733 var selectedYearTitle = ""; 4734 4735 $(data.Years).each(function(idx, obj){ 4736 4737 4738 if (idx == 0) { 4739 firstYearTitle = obj.Title; 4740 $('#filterYear').append(`<li class="active"><a data-id="${obj.Value}" tabindex="-1" href="#" title="${obj.Title}">${obj.Title}</a></li>`) 4741 } else { 4742 $('#filterYear').append(`<li><a data-id="${obj.Value}" tabindex="-1" href="#" title="${obj.Title}">${obj.Title}</a></li>`) 4743 } 4744 4745 4746 if (obj.Title == $('.staff-dropdown.events-coverage .label').text()) { 4747 existInReturnedYears = true 4748 selectedYear = obj.Value 4749 } 4750 4751 if (obj.Value == year) { 4752 selectedYearTitle = obj.Title 4753 } 4754 4755 }) 4756 4757 console.log(selectedYear) 4758 4759 if (!existInReturnedYears) { 4760 4761 $('.staff-dropdown.events-coverage .label').text(firstYearTitle) 4762 } else { 4763 4764 dd.find('li').each(function () { 4765 if ($(this).hasClass("active")) { 4766 $(this).removeClass("active"); 4767 } 4768 }); 4769 4770 4771 dd.find('.label').text(selectedYearTitle) 4772 dd.find('a[data-id="' + year + '"]').parent('li').addClass("active"); 4773 4774 dd.find('ul').removeClass("active") 4775 4776 } 4777 4778 bindYearDropdown() 4779 4780 } 4781 4782 4783 //For anchor with browser back 4784 var currentUrl = window.location; 4785 if (window.location.search.length) { 4786 var currentUrl = window.location.href.split('?')[0]; 4787 } 4788 urlPushState = currentUrl + urlPushState; 4789 4790 console.log(nameList.children().length) 4791 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 4792 window.history.pushState(null, null, urlPushState); 4793 4794 4795 } 4796 }, 4797 error: function (jqXHR, textStatus, errorThrown) { 4798 4799 loadMore.show(); 4800 c.loader.hide(nameList.parent()); 4801 }, 4802 complete: function () { 4803 c.loader.hide(nameList.parent()); 4804 4805 } 4806 4807 }); 4808 } 4809 4810 4811 //Load More 4812 $('#events-coverage-load-more').bind('click', function (e) { 4813 e.preventDefault(); 4814 var $t = $(this); 4815 var items; 4816 var dataItems = ""; 4817 var eventTypeId = ddlFilter.find('li.active').attr("data-id"); 4818 var year = dd.find('a.active').attr('data-id'); 4819 var listingWrapper = $('.tab-context-wrapper.events-coverage .flex-wrapper'); 4820 var loadMore = $(this) 4821 4822 4823 c.loader.show(listingWrapper.parent(),false); 4824 4825 var serviceUrl = ""; 4826 if (ddlFilter.find('li.active').attr("data-id") != "" && ddlFilter.find('li.active').attr("data-id") != "all") { 4827 apiUrl = '/api/CorpEventsCoverage/GetEventsConverageBySeeMore?itemscount={0}&type={1}&year={2}'.f(listingWrapper.children().length, eventTypeId, year); 4828 urlPushState = '?itemscount=0&type={0}&year={1}'.f(eventTypeId, year); 4829 } 4830 else { 4831 apiUrl = '/api/CorpEventsCoverage/GetEventsConverageBySeeMore?itemscount={0}&type={1}&year={2}'.f(listingWrapper.children().length, eventTypeId, year); 4832 urlPushState = '?itemscount=0&type={0}&year={1}'.f(eventTypeId, year); 4833 } 4834 4835 var action = "load-more" 4836 4837 GetDataShowMoreEventsCoverage(true, apiUrl, urlPushState, listingWrapper, action); 4838 4839 // $.ajax({
4840 // url: serviceUrl, 4841 // success: function (data) { 4842 // $.each(data.Data, function (index, item) { 4843 4844 4845 // var itemHTML = ""; 4846 4847 4848 4849 // itemHTML = `<div class="flex-item-wrapper">` 4850 // + `<div class="img-wrapper">` 4851 // + `<a href="${item.LinkURL}"><img src="${item.ProfileImageURL}" alt=""></a>` 4852 // + `</div>` 4853 // + `<div class="artist-name">` 4854 // + `<p class="font-weight-bold pt-2 mb-0">${item.Name} | ${item.EventsConverageType}</p>` 4855 // + `${item.StudentText}` 4856 // + `${item.DepartmentText}` 4857 4858 4859 4860 // itemHTML += '</div>' 4861 // + '</div>' 4862 4863 // if (itemHTML != "") { 4864 // dataItems += itemHTML; 4865 // } 4866 4867 4868 4869 4870 4871 // }); 4872 4873 4874 // listingWrapper.append(dataItems); 4875 4876 4877 // if (listingWrapper.children().length >= data.PageCount) { 4878 4879 // loadMore.hide(); 4880 4881 // } else { 4882 4883 // loadMore.show(); 4884 4885 // } 4886 4887 4888 // //For anchor with browser back 4889 // var currentUrl = window.location; 4890 // if (window.location.search.length) { 4891 // var currentUrl = window.location.href.split('?')[0]; 4892 // } 4893 // urlPushState = currentUrl + urlPushState; 4894 4895 // urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(listingWrapper.children().length)); 4896 // window.history.pushState(null, null, urlPushState); 4897 4898 4899 4900 // }, 4901 // error: function (jqXHR, textStatus, errorThrown) { 4902 // c.loader.hide(listingWrapper.parent()); 4903 // }, 4904 // complete: function () { 4905 // c.loader.hide(listingWrapper.parent()); 4906 // } 4907 // }); 4908 }); 4909 } 4910 }, 4911 news: { 4912 init: function() { 4913 var ddlFilter = $('.tab-menu-wrapper.news ul.desktop-type'); 4914 var listingWrapper = $('.tab-context-wrapper.news .flex-wrapper'); 4915 4916 var c= wpContent; 4917 4918 var dd = $('.staff-dropdown.news'); 4919 4920 // dd.on('click', function (e) { 4921 // e.preventDefault(); 4922 // if ($(this).hasClass("open")) { 4923 // $(this).removeClass("open") 4924 // } else { 4925 // $(this).addClass("open") 4926 // } 4927 4928 // }) 4929 4930 bindYearDropdown() 4931 4932 function bindYearDropdown() { 4933 4934 dd.find('a').unbind().bind('click', function(e){ 4935 e.preventDefault(); 4936 4937 c.loader.show(listingWrapper.parent(),true); 4938 4939 4940 4941 // dd.find('#filterDropdownYear').val($(this).attr('data-id')) 4942 // dd.find('#filterDropdownYear').text($(this).attr('title')) 4943 4944 var selectValue = ddlFilter.find('li.active').attr('data-id'); 4945 //var selectValue = $(this).attr('data-id'); 4946 4947 var yearValue = $(this).attr('data-id') 4948 4949 console.log(yearValue) 4950 4951 if (selectValue != '' && selectValue != 'all') { 4952 apiUrl = "/api/News/GetNewsBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, yearValue); 4953 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, yearValue); 4954 } 4955 else { 4956 //apiUrl = "/api/News/GetNewsBySeeMore?itemscount=0&year={0}".f(yearValue); 4957 //urlPushState = "?itemscount=0&year={0}".f(yearValue); 4958 4959 apiUrl = "/api/News/GetNewsBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, yearValue); 4960 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, yearValue); 4961 } 4962 4963 var action = "yearFilter" 4964 4965 4966 GetDataShowMoreNews(true, apiUrl, urlPushState, listingWrapper, action, yearValue); 4967 4968 4969 dd.find('li').each(function () { 4970 if ($(this).hasClass("active")) { 4971 $(this).removeClass("active"); 4972 } 4973 }); 4974 4975 4976 $(this).parent('li').addClass("active"); 4977 4978 var selectTitle = dd.find('li.active').find('a').attr('title'); 4979 4980 4981 dd.find('.label').html(selectTitle) 4982 4983 dd.find('#filterYear').removeClass("active") 4984 4985 }) 4986 4987 } 4988 4989 4990 4991 4992 4993 4994 //Re-create for mobile 4995 4996 4997 $('<div class="dropdown mobile-type-dropdown news" id="type"><div class="drop-down-menu"><div class="label"></div><ul id="mobileTypeFilter" class="dropdown-menu news" role="menu" ></ul></div></div>').insertBefore(ddlFilter); 4998 4999 ddlFilter.find('li').each(function(){ 5000 5001 if ($(this).hasClass("active")) { 5002 $('.mobile-type-dropdown').find('.label').text($("<div/>").html($(this).html()).text()) 5003 } 5004 5005 5006 $('.mobile-type-dropdown').find('ul').append($(this)[0].outerHTML) 5007 5008 }) 5009 5010 $('.mobile-type-dropdown').on('click', function(){ 5011 5012 if (!$(this).find('.dropdown-menu').hasClass("active")) { 5013 $(this).find('.dropdown-menu').addClass("active") 5014 } else { 5015 $(this).find('.dropdown-menu').removeClass("active") 5016 } 5017 }) 5018 5019 5020 $('.mobile-type-dropdown').find('li').bind('click', function (e) { 5021 e.preventDefault(); 5022 var $t = $(this); 5023 5024 c.loader.show(listingWrapper.parent(),true); 5025 5026 var selectValue = $(this).attr('data-id'); 5027 5028 ddlFilter.find('li').each(function(){ 5029 5030 if ($(this).attr('data-id') == selectValue) { 5031 ddlFilter.find('li').removeClass("active") 5032 $(this).addClass("active") 5033 } 5034 5035 5036 }) 5037 5038 var selectTitle = $("<div/>").html($(this).html()).text(); 5039 5040 var yearValue = dd.find('li.active').find('a').attr('data-id') 5041 5042 if (selectValue != '' && selectValue != 'all') { 5043 apiUrl = "/api/News/GetNewsBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, yearValue); 5044 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, yearValue); 5045 } 5046 else { 5047 apiUrl = "/api/News/GetNewsBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, yearValue); 5048 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, yearValue); 5049 5050 } 5051 5052 var action = "typeFilter" 5053 5054 5055 GetDataShowMoreNews(true, apiUrl, urlPushState, listingWrapper, action, yearValue); 5056 5057 5058 5059 $('.mobile-type-dropdown').find('.label').text(selectTitle) 5060 5061 5062 }); 5063 5064 //End re-create for mobile 5065 5066 5067 if ($('.tab-menu-wrapper#news-listing ul.desktop-type').children().length > 8) { 5068 $('.tab-menu-wrapper#news-listing ul.desktop-type').slick({ 5069 dots: false, 5070 speed: 500, 5071 slidesToShow: 8, 5072 slidesToScroll: 1, 5073 infinite: false, 5074 arrows: true, 5075 responsive: [ 5076 { 5077 breakpoint: 767, 5078 settings: {
5079 arrows: false, 5080 slidesToShow: 1, 5081 slidesToScroll: 1 5082 } 5083 }] 5084 }); 5085 } 5086 5087 ddlFilter.find('li').bind('click', function (e) { 5088 e.preventDefault(); 5089 var $t = $(this); 5090 5091 c.loader.show(listingWrapper.parent(),true); 5092 5093 var selectValue = $(this).attr('data-id'); 5094 5095 5096 var yearValue = dd.find('li.active').find('a').attr('data-id') 5097 5098 if (selectValue != '' && selectValue != 'all') { 5099 apiUrl = "/api/News/GetNewsBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, yearValue); 5100 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, yearValue); 5101 } 5102 else { 5103 //apiUrl = "/api/News/GetNewsBySeeMore?itemscount=0&year={0}".f(yearValue); 5104 //urlPushState = "?itemscount=0&year={0}".f(yearValue); 5105 apiUrl = "/api/News/GetNewsBySeeMore?itemscount=0&type={0}&year={1}".f(selectValue, yearValue); 5106 urlPushState = "?itemscount=0&type={0}&year={1}".f(selectValue, yearValue); 5107 5108 } 5109 5110 var action = "typeFilter" 5111 5112 5113 GetDataShowMoreNews(true, apiUrl, urlPushState, listingWrapper, action, yearValue); 5114 5115 $(this).prevAll('li').removeClass("active") 5116 $(this).nextAll('li').removeClass("active") 5117 5118 $(this).addClass("active"); 5119 5120 5121 }); 5122 5123 function GetDataShowMoreNews(flagDropdow, apiUrl, urlPushState, nameList, action, year) { 5124 // var $t = $(this); 5125 var items; 5126 var dataItems = ""; 5127 var loadMore = $('#news-load-more') 5128 5129 $.ajax({
5130 url: apiUrl, 5131 success: function (data) { 5132 if (data.Result) { 5133 5134 5135 if (action == "yearFilter" || action == "typeFilter") { 5136 nameList.html('') 5137 } 5138 5139 5140 5141 $(data.Data).each(function(idx, item){ 5142 5143 5144 5145 var itemHTML = ""; 5146 5147 5148 5149 5150 itemHTML = `<div class="flex-item-wrapper">` 5151 + `<div class="img-wrapper">` 5152 + `<a href="${item.LinkURL}"><img src="${item.ProfileImageURL}" alt=""></a>` 5153 + `</div>` 5154 + `<div class="artist-name">` 5155 + `<p class="font-weight-bold pt-2 mb-0">${item.Name} | ${item.NewsType}</p>` 5156 + `<p class="text-darkgrey">${item.StartEndTimeAndDuration}</p>` 5157 5158 itemHTML += '</div>' 5159 + '</div>' 5160 + '</div>' 5161 5162 nameList.append(itemHTML) 5163 }) 5164 5165 if (nameList.children().length >= data.PageCount) { 5166 loadMore.hide(); 5167 5168 5169 } else { 5170 loadMore.show(); 5171 5172 5173 } 5174 5175 //If year dropdown need to update 5176 if(($(data.Years).length > 0 && action == "typeFilter")) { 5177 5178 $('#filterYear').html('') 5179 5180 5181 var existInReturnedYears = false; 5182 var firstYearTitle = ""; 5183 var selectedYear = ""; 5184 $(data.Years).each(function(idx, obj){ 5185 5186 5187 5188 if (idx == 0) { 5189 firstYearTitle = obj.Title; 5190 $('#filterYear').append(`<li class="active"><a data-id="${obj.Value}" tabindex="-1" href="#" title="${obj.Title}">${obj.Title}</a></li>`) 5191 } else { 5192 $('#filterYear').append(`<li><a data-id="${obj.Value}" tabindex="-1" href="#" title="${obj.Title}">${obj.Title}</a></li>`) 5193 } 5194 5195 if (obj.Value == $('.staff-dropdown.news .label').text()) { 5196 existInReturnedYears = true 5197 selectedYear = obj.Value 5198 } 5199 5200 if (obj.Value == year) { 5201 selectedYearTitle = obj.Title 5202 } 5203 5204 }) 5205 5206 5207 if (!existInReturnedYears) { 5208 5209 $('.staff-dropdown.news .label').text(firstYearTitle) 5210 } else { 5211 5212 dd.find('li').each(function () { 5213 if ($(this).hasClass("active")) { 5214 $(this).removeClass("active"); 5215 } 5216 }); 5217 5218 5219 dd.find('.label').text(selectedYearTitle) 5220 dd.find('a[data-id="' + year + '"]').parent('li').addClass("active"); 5221 5222 dd.find('ul').removeClass("active") 5223 5224 } 5225 5226 5227 bindYearDropdown() 5228 5229 } 5230 5231 //For anchor with browser back 5232 var currentUrl = window.location; 5233 if (window.location.search.length) { 5234 var currentUrl = window.location.href.split('?')[0]; 5235 } 5236 urlPushState = currentUrl + urlPushState; 5237 5238 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 5239 window.history.pushState(null, null, urlPushState); 5240 5241 } 5242 }, 5243 error: function (jqXHR, textStatus, errorThrown) { 5244 c.loader.hide(listingWrapper.parent()); 5245 5246 }, 5247 complete: function () { 5248 5249 c.loader.hide(listingWrapper.parent()); 5250 } 5251 5252 }); 5253 } 5254 5255 5256 //Load More 5257 $('#news-load-more').bind('click', function (e) { 5258 e.preventDefault(); 5259 5260 5261 5262 var $t = $(this); 5263 var items; 5264 var dataItems = ""; 5265 var eventTypeId = ddlFilter.find('li.active').attr("data-id"); 5266 var loadMore = $('#news-load-more') 5267 var listingWrapper = $('.tab-context-wrapper.news .flex-wrapper'); 5268 5269 var yearValue = dd.find('li.active').find('a').attr('data-id') 5270 5271 5272 5273 c.loader.show(listingWrapper.parent(),false); 5274 5275 5276 var serviceUrl = ""; 5277 if (ddlFilter.find('li.active').attr("data-id") != "" && ddlFilter.find('li.active').attr("data-id") != "all") { 5278 apiUrl = '/api/News/GetNewsBySeeMore?itemscount={0}&type={1}&year={2}'.f(listingWrapper.children().length, eventTypeId, yearValue); 5279 urlPushState = '?itemscount=0&type={0}&year={1}'.f(eventTypeId, yearValue); 5280 } 5281 else { 5282 // apiUrl = '/api/News/GetNewsBySeeMore?itemscount={0}&year={1}'.f(listingWrapper.children().length, yearValue); 5283 // urlPushState = '?itemscount=0&year={0}'.f(yearValue); 5284 5285 apiUrl = '/api/News/GetNewsBySeeMore?itemscount={0}&type={1}&year={2}'.f(listingWrapper.children().length, eventTypeId, yearValue); 5286 urlPushState = '?itemscount=0&type={0}&year={1}'.f(eventTypeId, yearValue); 5287 } 5288 5289 5290 var action = "load-more"; 5291 5292 GetDataShowMoreNews(true, apiUrl, urlPushState, listingWrapper, action); 5293 5294 // $.ajax({
5295 // url: serviceUrl, 5296 // success: function (data) { 5297 // $.each(data.Data, function (index, item) { 5298 5299 5300 // var itemHTML = ""; 5301 5302 5303 5304 5305 // itemHTML = `<div class="flex-item-wrapper">` 5306 // + `<div class="img-wrapper">` 5307 // + `<a href="${item.LinkURL}"><img src="${item.ProfileImageURL}" alt=""></a>` 5308 // + `</div>` 5309 // + `<div class="artist-name">` 5310 // + `<p class="font-weight-bold pt-2 mb-0">${item.Name} | ${item.NewsType}</p>` 5311 // + `<p class="text-darkgrey">${item.StartEndTimeAndDuration}</p>` 5312 5313 5314 // itemHTML += '</div>' 5315 // + '</div>' 5316 // + '</div>' 5317 5318 // if (itemHTML != "") { 5319 // dataItems += itemHTML; 5320 // } 5321 5322 5323 5324 5325 5326 5327 // }); 5328 5329 5330 // listingWrapper.append(dataItems); 5331 5332 5333 5334 // if (listingWrapper.children().length >= data.PageCount) { 5335 // loadMore.hide(); 5336 5337 5338 // } else { 5339 // loadMore.show(); 5340 5341 5342 // } 5343 5344 5345 5346 5347 // //For anchor with browser back 5348 // var currentUrl = window.location; 5349 // if (window.location.search.length) { 5350 // var currentUrl = window.location.href.split('?')[0]; 5351 // } 5352 // urlPushState = currentUrl + urlPushState; 5353 // urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(listingWrapper.children().length)); 5354 // window.history.pushState(null, null, urlPushState); 5355 5356 5357 // }, 5358 // error: function (jqXHR, textStatus, errorThrown) { 5359 // c.loader.hide(listingWrapper.parent()); 5360 // }, 5361 // complete: function () { 5362 // c.loader.hide(listingWrapper.parent()); 5363 // } 5364 // }); 5365 }); 5366 } 5367 }, 5368 testimonials: { 5369 init: function() { 5370 5371 5372 var apiUrl = ""; 5373 var urlPushState = ""; 5374 5375 5376 var ddlFilter = $('.tab-menu-wrapper.testimonials ul.desktop-type'); 5377 var listingWrapper = $('.tab-context-wrapper.testimonials .flex-wrapper'); 5378 var loadMore = $('#testimonials-load-more') 5379 5380 var c = wpContent; 5381 5382 5383//Re-create for mobile 5384 5385 5386 $('<div class="dropdown mobile-type-dropdown testimonials" id="type"><div class="drop-down-menu"><div class="label"></div><ul id="mobileTypeFilter" class="dropdown-menu testimonials" role="menu" ></ul></div></div>').insertBefore(ddlFilter); 5387 5388 ddlFilter.find('li').each(function(){ 5389 5390 if ($(this).hasClass("active")) { 5391 $('.mobile-type-dropdown').find('.label').text($("<div/>").html($(this).html()).text()) 5392 } 5393 5394 $('.mobile-type-dropdown').find('ul').append($(this)[0].outerHTML) 5395 5396 }) 5397 5398 $('.mobile-type-dropdown').on('click', function(){ 5399 5400 if (!$(this).find('.dropdown-menu').hasClass("active")) { 5401 $(this).find('.dropdown-menu').addClass("active") 5402 } else { 5403 $(this).find('.dropdown-menu').removeClass("active") 5404 } 5405 }) 5406 5407 5408 $('.mobile-type-dropdown').find('li').bind('click', function (e) { 5409 e.preventDefault(); 5410 var $t = $(this); 5411 5412 c.loader.show(listingWrapper.parent(),true); 5413 5414 var selectValue = $(this).attr('data-id'); 5415 5416 ddlFilter.find('li').each(function(){ 5417 5418 if ($(this).attr('data-id') == selectValue) { 5419 ddlFilter.find('li').removeClass("active") 5420 $(this).addClass("active") 5421 } 5422 5423 5424 }) 5425 5426 var selectTitle = $("<div/>").html($(this).html()).text(); 5427 5428 5429 5430 if (selectValue != '' && selectValue != 'all') { 5431 apiUrl = '/api/Testimonials/GetTestimonialsBySeeMore?type={0}'.f($(this).attr('data-id')); 5432 urlPushState = '?itemscount=0&type={0}'.f($(this).attr('data-id')); 5433 } 5434 else { 5435 apiUrl = '/api/Testimonials/GetTestimonialsBySeeMore'; 5436 urlPushState = '?itemscount=0'; 5437 } 5438 5439 var action = "filtering" 5440 5441 5442 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, action); 5443 5444 5445 5446 $('.mobile-type-dropdown').find('.label').text(selectTitle) 5447 5448 5449 }); 5450 5451 //End re-create for mobile 5452 5453 5454 5455 5456
5457 if ($('.tab-menu-wrapper#testimonials-listing ul.desktop-type').children().length > 8) { 5458 $('.tab-menu-wrapper#testimonials-listing ul.desktop-type').slick({ 5459 dots: false, 5460 speed: 500, 5461 slidesToShow: 8, 5462 slidesToScroll: 1, 5463 infinite: false, 5464 arrows: true, 5465 responsive: [ 5466 { 5467 breakpoint: 767, 5468 settings: { 5469 arrows: false, 5470 slidesToShow: 1, 5471 slidesToScroll: 1 5472 } 5473 }] 5474 }); 5475 } 5476 5477 5478 5479 ddlFilter.find('li').on('click', function (e) { 5480 e.preventDefault(); 5481 5482 c.loader.show(listingWrapper.parent(),true); 5483 5484 var sel = $(this).attr('data-id'); 5485 5486 5487 if ($(this).attr('data-id') != '') { 5488 apiUrl = '/api/Testimonials/GetTestimonialsBySeeMore?type={0}'.f($(this).attr('data-id')); 5489 urlPushState = '?itemscount=0&type={0}'.f($(this).attr('data-id')); 5490 } 5491 else { 5492 apiUrl = '/api/Testimonials/GetTestimonialsBySeeMore'; 5493 urlPushState = '?itemscount=0'; 5494 } 5495 5496 5497 5498 5499 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 5500 5501 5502 $(this).prevAll('li').removeClass("active") 5503 $(this).nextAll('li').removeClass("active") 5504 5505 $(this).addClass("active"); 5506 }); 5507 5508 cusMagnificPopups() 5509 5510 function cusMagnificPopups() { 5511 if($('.tab-context-wrapper.testimonials .flex-wrapper .flex-item-wrapper .img-wrapper a.video-popup').length > 0){ 5512 5513 $('.tab-context-wrapper.testimonials .flex-wrapper .flex-item-wrapper .img-wrapper a.video-popup').magnificPopup({ 5514 type: 'iframe' 5515 }); 5516 } 5517 5518 if($('.tab-context-wrapper.testimonials .flex-wrapper .flex-item-wrapper .img-wrapper a.image-popup').length > 0){ 5519 $('.tab-context-wrapper.testimonials .flex-wrapper .flex-item-wrapper .img-wrapper a.image-popup').magnificPopup({ 5520 type: 'image', 5521 mainClass: 'mfp-with-zoom', 5522 gallery:{ 5523 enabled:true 5524 }, 5525 image: { 5526 titleSrc: function(item) { 5527 var markup = ''; 5528 5529 if (item.el[0].hasAttribute("title")) { 5530 markup += '<p class="mb-0"><strong>' + item.el.attr('title') + '</strong></p>'; 5531 } 5532 5533 if (item.el[0].hasAttribute("data-desc")) { 5534 markup += '<p class="mb-0">' + item.el.attr('data-desc') + '</p>'; 5535 } 5536 5537 if (item.el[0].hasAttribute("data-event")) { 5538 markup += '<p>' + item.el.attr('data-event') + '</p>'; 5539 } 5540 5541 if (item.el[0].hasAttribute("data-content")) { 5542 markup += '<p>' + item.el.attr('data-content') + '</p>'; 5543 } 5544 5545 5546 return markup 5547 } 5548 }, 5549 5550 zoom: { 5551 enabled: true, 5552 5553 duration: 300, // duration of the effect, in milliseconds 5554 easing: 'ease-in-out', // CSS transition easing function 5555 5556 opener: function(openerElement) { 5557 5558 return openerElement.is('img') ? openerElement : openerElement.find('img'); 5559 } 5560 } 5561 5562 }); 5563 5564 5565 } 5566 5567 } 5568 5569 5570 5571 5572 5573 5574 // event click on seemore button in testimonials page add by tin 5575 loadMore.bind('click', function (e) { 5576 e.preventDefault(); 5577 5578 c.loader.show(listingWrapper.parent(),false); 5579 5580 var type = getUrlParameter('type'); 5581 5582 if (type == 'false' || type == "") { 5583 apiUrl = '/api/Testimonials/GetTestimonialsBySeeMore?itemscount={0}'.f(listingWrapper.children().length); 5584 urlPushState = '?itemscount=0'; 5585 } 5586 else { 5587 apiUrl = '/api/Testimonials/GetTestimonialsBySeeMore?itemscount={0}&type={1}'.f(listingWrapper.children().length, type); 5588 urlPushState = '?itemscount=0&type={0}'.f(type); 5589 } 5590 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, "load-more"); 5591 }); 5592 5593 function GetDataShowMore(flagDropdow, apiUrl, urlPushState, nameList, action) { 5594 // var $t = $(this); 5595 var items; 5596 var dataItems = ""; 5597 var loadMore = $('#testimonials-load-more') 5598 5599 $.ajax({
5600 url: apiUrl, 5601 success: function (data) { 5602 if (data.Result) { 5603 5604 5605 if (action == "filtering") { 5606 nameList.html('') 5607 } 5608 5609 5610 $.each(data.Data, function (index, item) { 5611 5612 var imgHTML = ""; 5613 if (item.VideoId != "") 5614 { 5615 5616 imgHTML = `<a class="video-popup" href="https://player.vimeo.com/video/${item.VideoId}" data-video="${item.VideoId}" title="${item.PersonName}" data-desc="${item.PersonJobTitle}"><img src="${item.ImageUrl}" alt=""></a>` 5617 + `<div class="play-btn-wrapper">` 5618 + `<img src="/nafa-corp/theme/default/images/play-btn.png" alt="">` 5619 + `</div>` 5620 5621 } 5622 else 5623 { 5624 5625 imgHTML = `<a class="image-popup" href="${item.ImageUrl}" title="${item.PersonName}" data-desc="${item.PersonJobTitle}"><img src="${item.ImageUrl}" alt=""></a>` 5626 5627 5628 5629 } 5630 5631 5632 artistHTML = ""; 5633 5634 if (item.PersonJobTitle != "") 5635 { 5636 artistHTML += `<p class="mb-0">${item.PersonJobTitle}</p>` 5637 } 5638 if (item.Event != "") 5639 { 5640 artistHTML += `<p>${item.Event}</p>` 5641 } 5642 if (item.Testimonial) 5643 { 5644 artistHTML += `<p>${item.Testimonial}</p>` 5645 } 5646 5647 var itemHTML = ""; 5648 5649 5650 if ($('.flex-wrapper.listing-view').length <= 0) { 5651 5652 itemHTML = `<div class="flex-item-wrapper">` 5653 + `<div class="img-wrapper">` 5654 + imgHTML 5655 5656 + `</div>` 5657 + `<div class="artist-name">` 5658 + `<p class="font-weight-bold pt-2 mb-0">${item.PersonName}</p>` 5659 + artistHTML 5660 + `</div>` 5661 + `</div>` 5662 5663 } else { 5664 5665 itemHTML = `<div class="flex-item-wrapper">` 5666 + `<div class="img-wrapper">` 5667 + imgHTML 5668 5669 + `</div>` 5670 + `<div class="artist-name">` 5671 + artistHTML 5672 + `<p class="font-weight-bold pt-2 mb-0">${item.PersonName}</p>` 5673 + `</div>` 5674 + `</div>` 5675 5676 } 5677 5678 5679 5680 5681 if (itemHTML != "") { 5682 dataItems += itemHTML; 5683 } 5684 5685 5686 5687 5688 5689 }); 5690 5691 5692 5693 5694 5695 nameList.append(dataItems); 5696 5697 5698 if (nameList.children().length >= data.PageCount) { 5699 loadMore.hide(); 5700 5701 5702 } else { 5703 loadMore.show(); 5704 5705 5706 } 5707 5708 5709 //For anchor with browser back 5710 var currentUrl = window.location; 5711 if (window.location.search.length) { 5712 var currentUrl = window.location.href.split('?')[0]; 5713 } 5714 urlPushState = currentUrl + urlPushState; 5715 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 5716 window.history.pushState(null, null, urlPushState); 5717 } 5718 }, 5719 error: function (jqXHR, textStatus, errorThrown) { 5720 c.loader.hide(nameList.parent()); 5721 }, 5722 complete: function () { 5723 //Re magnific popup 5724 cusMagnificPopups() 5725 5726 c.loader.hide(nameList.parent()); 5727 } 5728 }); 5729 } 5730 } 5731 }, 5732 interviews: { 5733 init: function() { 5734 5735 5736 var apiUrl = ""; 5737 var urlPushState = ""; 5738 5739 5740 var ddlFilter = $('.tab-menu-wrapper.interviews ul'); 5741 var listingWrapper = $('.tab-context-wrapper.interviews .flex-wrapper'); 5742 var loadMore = $('#interviews-load-more') 5743 var c= wpContent; 5744 5745 5746 5747 if ($('.tab-menu-wrapper#interviews-listing ul').children().length > 8) { 5748 $('.tab-menu-wrapper#interviews-listing ul').slick({ 5749 dots: false, 5750 speed: 500, 5751 slidesToShow: 8, 5752 slidesToScroll: 1, 5753 infinite: false, 5754 arrows: true, 5755 responsive: [ 5756 { 5757 breakpoint: 767, 5758 settings: {
5759 arrows: false, 5760 slidesToShow: 1, 5761 slidesToScroll: 1 5762 } 5763 }] 5764 }); 5765 } 5766 5767 5768 5769 5770 cusMagnificPopups() 5771 5772 function cusMagnificPopups() { 5773 if($('.tab-context-wrapper.interviews .flex-wrapper .flex-item-wrapper .img-wrapper a.video-popup').length > 0){ 5774 5775 $('.tab-context-wrapper.interviews .flex-wrapper .flex-item-wrapper .img-wrapper a.video-popup').magnificPopup({ 5776 type: 'iframe' 5777 }); 5778 } 5779 5780 if($('.tab-context-wrapper.interviews .flex-wrapper .flex-item-wrapper .img-wrapper a.image-popup').length > 0){ 5781 $('.tab-context-wrapper.interviews .flex-wrapper .flex-item-wrapper .img-wrapper a.image-popup').magnificPopup({ 5782 type: 'image', 5783 mainClass: 'mfp-with-zoom', 5784 gallery:{ 5785 enabled:true 5786 }, 5787 image: { 5788 titleSrc: function(item) { 5789 var markup = ''; 5790 5791 if (item.el[0].hasAttribute("title")) { 5792 markup += '<p class="mb-0"><strong>' + item.el.attr('title') + '</strong></p>'; 5793 } 5794 5795 if (item.el[0].hasAttribute("data-desc")) { 5796 markup += '<p class="mb-0">' + item.el.attr('data-desc') + '</p>'; 5797 } 5798 5799 if (item.el[0].hasAttribute("data-event")) { 5800 markup += '<p>' + item.el.attr('data-event') + '</p>'; 5801 } 5802 5803 if (item.el[0].hasAttribute("data-content")) { 5804 markup += '<p>' + item.el.attr('data-content') + '</p>'; 5805 } 5806 5807 5808 return markup 5809 } 5810 }, 5811 5812 zoom: { 5813 enabled: true, 5814 5815 duration: 300, // duration of the effect, in milliseconds 5816 easing: 'ease-in-out', // CSS transition easing function 5817 5818 opener: function(openerElement) { 5819 5820 return openerElement.is('img') ? openerElement : openerElement.find('img'); 5821 } 5822 } 5823 5824 }); 5825 5826 5827 } 5828 5829 } 5830 5831 5832 ddlFilter.find('li').click(function (e) { 5833 e.preventDefault(); 5834 5835 c.loader.show(listingWrapper.parent(),true); 5836 5837 var sel = $(this).attr('data-id'); 5838 $('#selTestimonial').text($(this).attr('Title')); 5839 5840 5841 if ($(this).attr('data-id') != '') { 5842 apiUrl = '/api/CorpInterviewsApi/GetInterviewsBySeeMore?itemscount=0&type={0}'.f($(this).attr('data-id')); 5843 urlPushState = '?itemscount=0&type={0}'.f($(this).attr('data-id')); 5844 } 5845 else { 5846 apiUrl = '/api/CorpInterviewsApi/GetInterviewsBySeeMore?itemscount=0'; 5847 urlPushState = '?itemscount=0'; 5848 } 5849 5850 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 5851 5852 ddlFilter.children().each(function () { 5853 if ($(this).hasClass("active")) { 5854 $(this).removeClass("active"); 5855 } 5856 }); 5857 $(this).addClass("active"); 5858 5859 }); 5860 5861 // event click on seemore button in interviews page add by tin 5862 loadMore.bind('click', function (e) { 5863 e.preventDefault(); 5864 5865 c.loader.show(listingWrapper.parent(),false); 5866 5867 5868 var type = getUrlParameter('type'); 5869 5870 if (type == 'false' || type == "") { 5871 apiUrl = '/api/CorpInterviewsApi/GetInterviewsBySeeMore?itemscount={0}'.f(listingWrapper.children().length); 5872 urlPushState = '?itemscount=0'; 5873 } 5874 else { 5875 apiUrl = '/api/CorpInterviewsApi/GetInterviewsBySeeMore?itemscount={0}&type={1}'.f(listingWrapper.children().length, type); 5876 urlPushState = '?itemscount=0&type={0}'.f(type); 5877 } 5878 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, "load-more"); 5879 }); 5880 5881 function GetDataShowMore(flagDropdow, apiUrl, urlPushState, nameList, action) { 5882 // var $t = $(this); 5883 var items; 5884 var dataItems = ""; 5885 var loadMore = $('#interviews-load-more') 5886 5887 $.ajax({
5888 url: apiUrl, 5889 success: function (data) { 5890 if (data.Result) { 5891 5892 5893 if (action == "filtering") { 5894 listingWrapper.html('') 5895 } 5896 5897 5898 $.each(data.Data, function (index, item) { 5899 5900 var itemHTML = ""; 5901 5902 itemHTML = `<div class="flex-item-wrapper">` 5903 + `<div class="img-wrapper">` 5904 + `<a href="/alumni/outstanding-alumni-and-highlights/interviews/${item.UrlName}"><img src="${item.Thumbnail}"></a>` 5905 + `</div>` 5906 + `<div class="artist-name">` 5907 + `<p class="font-weight-bold pt-2 mb-0">` 5908 + `<a href="/alumni/outstanding-alumni-and-highlights/interviews/${item.UrlName}">` 5909 + `${item.Title}` 5910 + `</a></p>` 5911 + `</div>` 5912 + `</div>` 5913 5914 if (itemHTML != "") { 5915 dataItems += itemHTML; 5916 } 5917 5918 5919 5920 5921 5922 5923 }); 5924 5925 5926 nameList.append(dataItems); 5927 5928 if (nameList.children().length >= data.PageCount) { 5929 loadMore.hide(); 5930 5931 5932 } else { 5933 loadMore.show(); 5934 5935 5936 } 5937 //For anchor with browser back 5938 var currentUrl = window.location; 5939 if (window.location.search.length) { 5940 var currentUrl = window.location.href.split('?')[0]; 5941 } 5942 urlPushState = currentUrl + urlPushState; 5943 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 5944 window.history.pushState(null, null, urlPushState); 5945 } 5946 }, 5947 error: function (jqXHR, textStatus, errorThrown) { 5948 c.loader.hide(nameList.parent()); 5949 }, 5950 complete: function () { 5951 //Re magnific popup 5952 cusMagnificPopups() 5953 5954 c.loader.hide(nameList.parent()); 5955 } 5956 }); 5957 } 5958 } 5959 }, 5960 awardsListing: { 5961 init: function() { 5962 5963 5964 var apiUrl = ""; 5965 var urlPushState = ""; 5966 if($('[data-id="best-graduates"]').hasClass("active")){ 5967 $('.drop-down-menu.awardlisting').show(); 5968 BestGradYearSelect(); 5969 console.log("best") 5970 } 5971 else { 5972 $('.drop-down-menu.awardlisting').hide(); 5973 $('.convocation-wrapper').hide(); 5974 5975 } 5976 5977 if ($('[data-id="cultural-medallion"]').hasClass("active")) { 5978 //$('.cm-staff-alumni-dd').hide(); 5979 //cm-sr-live 5980 $('.cm-staff-alumni-dd').show(); 5981 } else { 5982 $('.cm-staff-alumni-dd').hide(); 5983 5984 } 5985 5986 var ddlFilter = $('.tab-menu-wrapper.awards-listing ul.desktop-type'); 5987 var listingWrapper = $('.tab-context-wrapper.awards-listing .flex-wrapper'); 5988 var loadMore = $('#awards-listing-load-more') 5989 5990 5991 var c= wpContent; 5992 5993 $('#award-types-tab .desktop-type li').on('click', function() { 5994 // Log to confirm the click event is firing 5995 //console.log("Tab was clicked!"); 5996 5997 var clickedTab = $(this); 5998 var tabId = clickedTab.data('id'); 5999 6000 // Log to see the ID of the clicked tab 6001 // console.log("The data-id of the clicked tab is: " + tabId); 6002 6003 clickedTab.addClass('active').siblings().removeClass('active'); 6004 6005 $('#award-descriptions-container .award-description').hide(); 6006 6007 $('#award-descriptions-container .award-description[data-content-for="' + tabId + '"]').show(); 6008 }); 6009 6010 6011//Re-create for mobile 6012 6013function BestGradYearSelect() { 6014 var selectedYear = $('.drop-down-menu.awardlisting .label').text(); 6015 if(selectedYear == '2019'){ 6016 $('.convocation-wrapper').hide(); 6017 $('#award-winning-listing').show(); 6018 } 6019 else { 6020 $('#award-winning-listing').hide(); 6021 $('.convocation-wrapper').hide(); 6022 $('#convocation-'+selectedYear).show(); 6023 } 6024} 6025 6026 $('<div class="dropdown mobile-type-dropdown news" id="type"><div class="drop-down-menu"><div class="label"></div><ul id="mobileTypeFilter" class="dropdown-menu news" role="menu" ></ul></div></div>').insertBefore(ddlFilter); 6027 6028 ddlFilter.find('li').each(function(){ 6029 6030 if ($(this).hasClass("active")) { 6031 $('.mobile-type-dropdown').find('.label').text($("<div/>").html($(this).html()).text()) 6032 } 6033 6034 6035 $('.mobile-type-dropdown').find('ul').append($(this)[0].outerHTML) 6036 6037 }) 6038 6039 $('.mobile-type-dropdown').on('click', function () { 6040 console.log("mobile type dropdown") 6041 6042 if (!$(this).find('#mobileTypeFilter').hasClass("active")) { 6043 console.log("drop down no active class"); 6044 $(this).find('#mobileTypeFilter').addClass("active") 6045 } else { 6046 $(this).find('#mobileTypeFilter').removeClass("active") 6047 } 6048 6049 if (!$(this).find('.dropdown-menu').hasClass("active")) { 6050 console.log("drop down no active class"); 6051 $(this).find('.dropdown-menu').addClass("active") 6052 } else { 6053 $(this).find('.dropdown-menu').removeClass("active") 6054 } 6055 }) 6056 6057 $('.drop-down-menu.awardlisting').find('li a').bind('click', function (e) { 6058 e.preventDefault(); 6059 var $t = $(this); 6060 6061 var selectValue = $(this).attr('data-id'); 6062 console.log(selectValue); 6063 var selectTitle = $("<div/>").html($(this).html()).text(); 6064 6065 6066 // if ($(this).attr('data-id') != '') { 6067 // console.log($(this).attr('data-id')) 6068 // console.log('#convocation-'+$(this).attr('data-id')) 6069 6070 // if ($(this).attr('data-id') == '2019'){ 6071 // $('.convocation-wrapper').hide(); 6072 // $('#award-winning-listing').show(); 6073 // } 6074 // else { 6075 // $('#award-winning-listing').hide(); 6076 // $('.convocation-wrapper').hide(); 6077 // $('#convocation-'+$(this).attr('data-id')).show(); 6078 // } 6079 // } 6080 $('.drop-down-menu.awardlisting').find('.label').text(selectTitle) 6081 BestGradYearSelect(); 6082 }); 6083 6084 $('.mobile-type-dropdown').find('li').bind('click', function (e) { 6085 e.preventDefault(); 6086 var $t = $(this); 6087 6088 c.loader.show(listingWrapper.parent(),true); 6089 6090 var selectValue = $(this).attr('data-id'); 6091 6092 ddlFilter.find('li').each(function(){ 6093 6094 if ($(this).attr('data-id') == selectValue) { 6095 ddlFilter.find('li').removeClass("active") 6096 $(this).addClass("active") 6097 } 6098 6099 6100 }) 6101 6102 var selectTitle = $("<div/>").html($(this).html()).text(); 6103 6104 6105 if ($(this).attr('data-id') != '') { 6106 6107 if ($(this).attr('data-id') == 'best-graduates'){ 6108 $('.drop-down-menu.awardlisting').show(); 6109 6110 BestGradYearSelect(); 6111 } 6112 else { 6113 $('.drop-down-menu.awardlisting').hide(); 6114 $('.convocation-wrapper').hide(); 6115 $('#award-winning-listing').show(); 6116 } 6117 6118 if ($(this).attr('data-id') == 'cultural-medallion'){ 6119 $('.cm-staff-alumni-dd').hide(); 6120 //cm-sr-live 6121 //$('.cm-staff-alumni-dd').show(); 6122 } else { 6123 $('.cm-staff-alumni-dd').hide(); 6124 6125 } 6126 6127 apiUrl = '/api/CorpAwards/GetAwardsBySeeMore?itemscount=0&type={0}'.f(selectValue); 6128 urlPushState = '?itemscount=0&type={0}'.f(selectValue); 6129 } 6130 else { 6131 apiUrl = '/api/CorpAwards/GetAwardsBySeeMore?itemscount=0'; 6132 urlPushState = '?itemscount=0'; 6133 } 6134 6135 var action = "filtering" 6136 6137 6138 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, action); 6139 6140 6141 6142 $('.mobile-type-dropdown').find('.label').text(selectTitle) 6143 6144 //$('.drop-down-menu').hide(); 6145 6146 }); 6147 6148 //End re-create for mobile 6149 6150 ddlFilter.find('li').click(function (e) { 6151 e.preventDefault(); 6152 6153 c.loader.show(listingWrapper.parent(),true); 6154 6155 var sel = $(this).attr('data-id'); 6156 //$('#selTestimonial').text($(this).attr('Title'));
6157 6158 6159 if ($(this).attr('data-id') != '') { 6160 6161 if ($(this).attr('data-id') == 'best-graduates'){ 6162 6163 $('.drop-down-menu.awardlisting').show(); 6164 6165 BestGradYearSelect(); 6166 } 6167 else { 6168 $('.drop-down-menu.awardlisting').hide(); 6169 $('.convocation-wrapper').hide(); 6170 $('#award-winning-listing').show(); 6171 } 6172 6173 if ($(this).attr('data-id') == 'cultural-medallion'){ 6174 $('.cm-staff-alumni-dd').hide(); 6175 //cm-sr-live 6176 //$('.cm-staff-alumni-dd').show(); 6177 } else { 6178 $('.cm-staff-alumni-dd').hide(); 6179 6180 } 6181 6182 apiUrl = '/api/CorpAwards/GetAwardsBySeeMore?itemscount=0&type={0}'.f($(this).attr('data-id')); 6183 urlPushState = '?itemscount=0&type={0}'.f($(this).attr('data-id')); 6184 } 6185 else { 6186 apiUrl = '/api/CorpAwards/GetAwardsBySeeMore?itemscount=0'; 6187 urlPushState = '?itemscount=0'; 6188 } 6189 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 6190 6191 ddlFilter.children().each(function () { 6192 if ($(this).hasClass("active")) { 6193 $(this).removeClass("active"); 6194 } 6195 }); 6196 $(this).addClass("active"); 6197 6198 }); 6199 6200 $('.cm-staff-alumni-dd').find('li a').bind('click', function (e) { 6201 e.preventDefault(); 6202 var $t = $(this); 6203 6204 c.loader.show(listingWrapper.parent(),true); 6205 var selectType = ddlFilter.find('li.active').attr('data-id'); 6206 var selectValue = $(this).attr('data-id'); 6207 6208 ddlFilter.find('li').each(function(){ 6209 6210 if ($(this).attr('data-id') == selectValue) { 6211 ddlFilter.find('li').removeClass("active") 6212 $(this).addClass("active") 6213 } 6214 6215 6216 }) 6217 6218 var selectTitle = $("<div/>").html($(this).html()).text(); 6219 6220 6221 if ($(this).attr('data-id') != '') { 6222 console.log(selectValue); 6223 apiUrl = '/api/CorpAwards/GetAwardsBySeeMore?itemscount=0&type={0}&profiletype={1}'.f(selectType, selectValue); 6224 urlPushState = '?itemscount=0&type={0}&profiletype={1}'.f(selectType, selectValue); 6225 } 6226 else { 6227 apiUrl = '/api/CorpAwards/GetAwardsBySeeMore?itemscount=0'; 6228 urlPushState = '?itemscount=0'; 6229 } 6230 6231 var action = "filtering" 6232 6233 6234 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, action); 6235 6236 6237 6238 $('.cm-staff-alumni-dd').find('.label').text(selectTitle) 6239 6240 $('.dropdown-menu.profiletype').removeClass('active'); 6241 }); 6242 6243 // event click on seemore button in testimonials page add by tin 6244 loadMore.bind('click', function (e) { 6245 e.preventDefault(); 6246 6247 c.loader.show(listingWrapper.parent(),false); 6248 var selectValue = $('.cm-staff-alumni-dd li a.active').attr('data-id'); 6249 var type = getUrlParameter('type'); 6250 6251 if (type == 'false' || type == "") { 6252 apiUrl = '/api/CorpAwards/GetAwardsBySeeMore?itemscount={0}'.f(listingWrapper.children().length); 6253 urlPushState = '?itemscount=0'; 6254 } 6255 else { 6256 apiUrl = '/api/CorpAwards/GetAwardsBySeeMore?itemscount={0}&type={1}'.f(listingWrapper.children().length, type); 6257 urlPushState = '?itemscount=0&type={0}'.f(type); 6258 } 6259 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, "load-more"); 6260 }); 6261 6262 function GetDataShowMore(flagDropdow, apiUrl, urlPushState, nameList, action) { 6263 // var $t = $(this); 6264 var items; 6265 var dataItems = ""; 6266 var loadMore = $('#awards-listing-load-more') 6267 6268 $.ajax({
6269 url: apiUrl, 6270 success: function (data) { 6271 if (data.Result) { 6272 6273 6274 if (action == "filtering") { 6275 nameList.html('') 6276 } 6277 6278 6279 $.each(data.Data, function (index, item) { 6280 6281 6282 var itemHTML = ""; 6283 6284 6285 itemHTML = `<div class="flex-item-wrapper">` 6286 + `<a href="${item.LinkURL}">` 6287 + `<img src="${item.ProfileImageURL}" />` 6288 + `</a>` 6289 + `<div class="artist-name">` 6290 + `<p class="font-weight-bold pt-2 mb-0">` 6291 + `${item.Name}` 6292 + `</p>` 6293 + `</div>` 6294 + `<div class="artist-desc">` 6295 + `<p>` 6296 + `${item.YearOfGraduation}` 6297 + `</p>` 6298 + `</div>` 6299 + `</div>` 6300 6301 6302 if (itemHTML != "") { 6303 dataItems += itemHTML; 6304 } 6305 6306 6307 6308 6309 }); 6310 6311 6312 6313 nameList.append(dataItems); 6314 6315 if (nameList.children().length >= data.PageCount) { 6316 loadMore.hide(); 6317 6318 6319 } else { 6320 loadMore.show(); 6321 6322 6323 } 6324 6325 6326 //For anchor with browser back 6327 var currentUrl = window.location; 6328 if (window.location.search.length) { 6329 var currentUrl = window.location.href.split('?')[0]; 6330 } 6331 urlPushState = currentUrl + urlPushState; 6332 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 6333 window.history.pushState(null, null, urlPushState); 6334 } 6335 }, 6336 error: function (jqXHR, textStatus, errorThrown) { 6337 c.loader.hide(nameList.parent()); 6338 }, 6339 complete: function () { 6340 c.loader.hide(nameList.parent()); 6341 } 6342 }); 6343 } 6344 } 6345 }, 6346 projectsListing: { 6347 init: function() { 6348 6349 6350 var apiUrl = ""; 6351 var urlPushState = ""; 6352 6353 6354 var ddlFilter = $('.drop-down-group'); 6355 var listingWrapper = $('.projects-listing'); 6356 var loadMore = $('.load-more[data-id="projects-listing"]') 6357 6358 6359 var c= wpContent; 6360 6361 6362 6363 6364 6365 ddlFilter.find('li').click(function (e) { 6366 e.preventDefault(); 6367 6368 c.loader.show(listingWrapper.parent(),true); 6369 6370 var sel = $(this).find('a').attr('data-id'); 6371 var selectTitle = $(this).find('a').attr('title'); 6372 6373 6374 6375 if ($(this).attr('data-id') != '') { 6376 apiUrl = '/api/CorpProject/GetProjectsBySeeMore?itemscount=0&year={0}'.f(sel); 6377 urlPushState = '?itemscount=0&year={0}'.f(sel); 6378 } 6379 else { 6380 apiUrl = '/api/CorpProject/GetProjectsBySeeMore?itemscount=0'; 6381 urlPushState = '?itemscount=0'; 6382 } 6383 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 6384 6385 ddlFilter.children().each(function () { 6386 if ($(this).hasClass("active")) { 6387 $(this).removeClass("active"); 6388 } 6389 }); 6390 $(this).addClass("active"); 6391 6392 console.log(ddlFilter.find('.label')) 6393 6394 ddlFilter.parent('.drop-down-menu').find('.label').text(selectTitle) 6395 ddlFilter.removeClass("active") 6396 6397 }); 6398 6399 // event click on seemore button in testimonials page add by tin 6400 loadMore.bind('click', function (e) { 6401 e.preventDefault(); 6402 6403 c.loader.show(listingWrapper.parent(),false); 6404 6405 var year = getUrlParameter('year'); 6406 6407 if (year == "" || year == "all") { 6408 apiUrl = '/api/CorpProject/GetProjectsBySeeMore?itemscount={0}&year={1}'.f(listingWrapper.children().length, year); 6409 urlPushState = '?itemscount=0&year={0}'.f(year); 6410 } 6411 else { 6412 apiUrl = '/api/CorpProject/GetProjectsBySeeMore?itemscount={0}&year={1}'.f(listingWrapper.children().length, year); 6413 urlPushState = '?itemscount=0&year={0}'.f(year); 6414 } 6415 6416 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, "load-more"); 6417 6418 }); 6419 6420 function GetDataShowMore(flagDropdow, apiUrl, urlPushState, nameList, action) { 6421 // var $t = $(this); 6422 var items; 6423 var dataItems = ""; 6424 var loadMore = $('.load-more[data-id="projects-listing"]') 6425 6426 $.ajax({
6427 url: apiUrl, 6428 success: function (data) { 6429 if (data.Result) { 6430 6431 6432 if (action == "filtering") { 6433 nameList.html('') 6434 } 6435 6436 6437 $.each(data.Data, function (index, item) { 6438 6439 6440 var itemHTML = ""; 6441 6442 6443 6444 itemHTML = `<div class="ps-0 col-lg-4">` 6445 + `<a href="${item.LinkUrl}">` 6446 + `<div class="hover-img-wrapper">` 6447 + `<img src="${item.ProfileImageUrl}">` 6448 + `</div>` 6449 + `</a>` 6450 + `<div class="artist-name">` 6451 + `<p class="font-weight-bold pt-2 mb-0">` 6452 + `${item.Name}` 6453 + `</p>` 6454 + `</div>` 6455 //+ `<div class="artist-desc">` 6456 6457 // + `<p>` 6458 6459 //+ `${item.ProjectType}` 6460 // + `</p>` 6461 6462 //+ `</div>` 6463 6464 + `</div>` 6465 6466 6467 if (itemHTML != "") { 6468 dataItems += itemHTML; 6469 } 6470 6471 6472 6473 6474 6475 6476 6477 }); 6478 6479 6480 6481 6482 6483 nameList.append(dataItems); 6484 6485 if (nameList.children().length >= data.PageCount) { 6486 loadMore.hide(); 6487 6488 6489 } else { 6490 loadMore.show(); 6491 6492 6493 } 6494 6495 //For anchor with browser back 6496 var currentUrl = window.location; 6497 if (window.location.search.length) { 6498 var currentUrl = window.location.href.split('?')[0]; 6499 } 6500 urlPushState = currentUrl + urlPushState; 6501 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 6502 window.history.pushState(null, null, urlPushState); 6503 } 6504 }, 6505 error: function (jqXHR, textStatus, errorThrown) { 6506 c.loader.hide(nameList.parent()); 6507 }, 6508 complete: function () { 6509 c.loader.hide(nameList.parent()); 6510 } 6511 }); 6512 } 6513 } 6514 }, 6515 studiosListing: { 6516 init: function () { 6517 6518 6519 var apiUrl = ""; 6520 var urlPushState = ""; 6521 6522 6523 var ddlFilter = $('.drop-down-group'); 6524 var listingWrapper = $('.studios-listing'); 6525 var loadMore = $('.load-more[data-id="studios-listing"]') 6526 6527 6528 var c = wpContent; 6529 6530 6531 6532 6533 ddlFilter.find('li').click(function (e) { 6534 e.preventDefault(); 6535 6536 c.loader.show(listingWrapper.parent(), true); 6537 6538 var sel = $(this).find('a').attr('data-id'); 6539 var selectTitle = $(this).find('a').attr('title'); 6540 6541 6542 6543 if ($(this).attr('data-id') != '') { 6544 apiUrl = '/api/CorpStudio/GetStudiosBySeeMore?itemscount=0&year={0}'.f(sel); 6545 urlPushState = '?itemscount=0&year={0}'.f(sel); 6546 } 6547 else { 6548 apiUrl = '/api/CorpStudio/GetStudiosBySeeMore?itemscount=0'; 6549 urlPushState = '?itemscount=0'; 6550 } 6551 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 6552 6553 ddlFilter.children().each(function () { 6554 if ($(this).hasClass("active")) { 6555 $(this).removeClass("active"); 6556 } 6557 }); 6558 $(this).addClass("active"); 6559 6560 ddlFilter.parent('.drop-down-menu').find('.label').text(selectTitle) 6561 ddlFilter.removeClass("active") 6562 6563 }); 6564 6565 loadMore.bind('click', function (e) { 6566 e.preventDefault(); 6567 6568 c.loader.show(listingWrapper.parent(), false); 6569 6570 var year = getUrlParameter('year'); 6571 6572 apiUrl = '/api/CorpStudio/GetStudiosBySeeMore?itemscount={0}&year={1}'.f(listingWrapper.children().length, year); 6573 urlPushState = '?itemscount=0&year={0}'.f(year); 6574 6575 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, "load-more"); 6576 6577 }); 6578 6579 function GetDataShowMore(flagDropdow, apiUrl, urlPushState, nameList, action) { 6580 var items; 6581 var dataItems = ""; 6582 var loadMore = $('.load-more[data-id="studios-listing"]') 6583 6584 $.ajax({
6585 url: apiUrl, 6586 success: function (data) { 6587 if (data.Result) { 6588 6589 6590 if (action == "filtering") { 6591 nameList.html('') 6592 } 6593 6594 6595 $.each(data.Data, function (index, item) { 6596 6597 6598 var itemHTML = ""; 6599 6600 itemHTML = `<div class="ps-0 col-xl-3">` 6601 + `<a href="${item.LinkUrl}">` 6602 + `<div class="studio hover-img-wrapper">` 6603 + `<img src="${item.ProfileImageUrl}">` 6604 + `</div>` 6605 + `</a>` 6606 + `<div class="artist-name">` 6607 + `<p class="font-weight-bold pt-2 mb-0">` 6608 + `${item.Name}` 6609 + `</p>` 6610 + `</div>`; 6611 6612 if (item.CountryOfOrigin) { 6613 itemHTML += `<div class="studio-listing-country-origin">${item.CountryOfOrigin}</div>`; 6614 } 6615 if (item.DateOfResidency) { 6616 itemHTML += `<div class="studio-listing-residency-period">${item.DateOfResidency}</div>`; 6617 } 6618 6619 itemHTML += `</div>`; 6620 6621 if (itemHTML != "") { 6622 dataItems += itemHTML; 6623 } 6624 6625 6626 }); 6627 6628 6629 nameList.append(dataItems); 6630 6631 if (nameList.children().length >= data.PageCount) { 6632 loadMore.hide(); 6633 6634 6635 } else { 6636 loadMore.show(); 6637 6638 6639 } 6640 6641 //For anchor with browser back 6642 var currentUrl = window.location; 6643 if (window.location.search.length) { 6644 var currentUrl = window.location.href.split('?')[0]; 6645 } 6646 urlPushState = currentUrl + urlPushState; 6647 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 6648 window.history.pushState(null, null, urlPushState); 6649 } 6650 }, 6651 error: function (jqXHR, textStatus, errorThrown) { 6652 c.loader.hide(nameList.parent()); 6653 }, 6654 complete: function () { 6655 c.loader.hide(nameList.parent()); 6656 } 6657 }); 6658 } 6659 } 6660 }, 6661 featuredAlumni: { 6662 init: function() { 6663 6664 var ddlFilter = $('.tab-menu-wrapper.award-detail-tab ul'); 6665 var listingWrapper = $('.tab-context-wrapper.awards'); 6666 //var loadMore = $('#alumni-load-more') 6667 6668 var c= wpContent; 6669 6670 var wrapAnchor = ""; 6671 6672 //Re-create for mobile 6673 6674 $('<div class="dropdown mobile-type-dropdown award" id="type"><div class="drop-down-menu"><div class="label"></div><ul id="mobileTypeFilter" class="has-hyperlinks dropdown-menu award" role="menu" ></ul></div></div>').insertBefore(ddlFilter); 6675 6676 // 6677 ddlFilter.find('li').each(function(){ 6678 if ($(this).hasClass("active")) { 6679 wrapAnchor += "<li class=\"active\">"; 6680 $('.mobile-type-dropdown').find('.label').text($(this).text()); 6681 } 6682 else 6683 wrapAnchor += "<li>"; 6684 wrapAnchor += "<a data-id=\""+$(this).attr('data-id')+"\" href=\"javascript:void(0);\">"+$(this).html()+"</a></li>"; 6685 }) 6686 6687 $('#mobileTypeFilter').html(wrapAnchor); 6688 6689 /* 6690 ddlFilter.find('li').each(function(){ 6691 if ($(this).hasClass("active")) { 6692 $('.mobile-type-dropdown').find('.label').text($("<div/>").html($(this).html("<a data-id=\""+$(this).attr('data-id')+"\" href=\"javascript:void(0);\">"+$(this).html()+"</a>")).text()) 6693 } 6694 $('.mobile-type-dropdown').find('ul').append($(this)[0].outerHTML) 6695 }) 6696 */ 6697 $('.mobile-type-dropdown').on('click', function(){ 6698 6699 if (!$(this).find('.dropdown-menu').hasClass("active")) { 6700 $(this).find('.dropdown-menu').addClass("active") 6701 } else { 6702 $(this).find('.dropdown-menu').removeClass("active") 6703 } 6704 }) 6705 6706 $('.mobile-type-dropdown').find('li').bind('click', function (e) { 6707 e.preventDefault(); 6708 6709 var selectValue = $(this).find('a').attr('data-id'); 6710 6711 ddlFilter.find('li').each(function(){ 6712 6713 if ($(this).attr('data-id') == selectValue) { 6714 ddlFilter.find('li').removeClass("active") 6715 $(this).addClass("active") 6716 } 6717 }) 6718 6719 var selectTitle = $("<div/>").html($(this).find('a').html()).text(); 6720 6721 6722 if ($(this).find('a').attr('data-id') != '') { 6723 console.log("remove active") 6724 $(".tab-context-wrapper.awards").removeClass("active"); 6725 $(".tab-context-wrapper.awards[data-id="+$(this).attr('data-id')+"]").addClass("active"); 6726 } 6727 6728 $('.mobile-type-dropdown').find('.label').text(selectTitle); 6729 6730 window.scrollTo({ 6731 top: 400, 6732 behavior: "smooth" 6733 }); 6734 6735 }); 6736 6737 6738 //End re-create for mobile 6739 } 6740 }, 6741 alumniListing: { 6742 init: function() { 6743 6744 6745 var apiUrl = ""; 6746 var urlPushState = ""; 6747 6748 6749 var ddlFilter = $('.tab-menu-wrapper.alumni-listing ul'); 6750 var listingWrapper = $('.tab-context-wrapper.alumni-listing .flex-wrapper'); 6751 var loadMore = $('#alumni-load-more') 6752 6753 6754 var c= wpContent; 6755
6756 //Re-create for mobile 6757 6758 6759 $('<div class="dropdown mobile-type-dropdown alumni" id="type"><div class="drop-down-menu"><div class="label"></div><ul id="mobileTypeFilter" class="has-hyperlinks dropdown-menu alumni" role="menu" ></ul></div></div>').insertBefore(ddlFilter); 6760 6761 ddlFilter.find('li').each(function(){ 6762 6763 if ($(this).hasClass("active")) { 6764 $('.mobile-type-dropdown').find('.label').text($("<div/>").html($(this).find('a').html()).text()) 6765 } 6766 6767 $('.mobile-type-dropdown').find('ul').append($(this)[0].outerHTML) 6768 6769 }) 6770 6771 $('.mobile-type-dropdown').on('click', function(){ 6772 6773 if (!$(this).find('.dropdown-menu').hasClass("active")) { 6774 $(this).find('.dropdown-menu').addClass("active") 6775 } else { 6776 $(this).find('.dropdown-menu').removeClass("active") 6777 } 6778 }) 6779 6780 6781 $('.mobile-type-dropdown').find('li').bind('click', function (e) { 6782 e.preventDefault(); 6783 var $t = $(this); 6784 6785 c.loader.show(listingWrapper.parent(),true); 6786 6787 var selectValue = $(this).find('a').attr('data-id'); 6788 6789 ddlFilter.find('li').each(function(){ 6790 6791 if ($(this).attr('data-id') == selectValue) { 6792 ddlFilter.find('li').removeClass("active") 6793 $(this).addClass("active") 6794 } 6795 6796 6797 }) 6798 6799 var selectTitle = $("<div/>").html($(this).find('a').html()).text(); 6800 6801 6802 if ($(this).find('a').attr('data-id') != '') { 6803 apiUrl = '/api/CorpAlumni/GetAwardsByPagination?itemscount=0&type={0}'.f($(this).find('a').attr('data-id')); 6804 urlPushState = '?itemscount=0&type={0}'.f($(this).find('a').attr('data-id')); 6805 } 6806 else { 6807 apiUrl = '/api/CorpAlumni/GetAwardsByPagination?itemscount=0'; 6808 urlPushState = '?itemscount=0'; 6809 } 6810 6811 var action = "filtering" 6812 6813 6814 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, action); 6815 6816 $('.mobile-type-dropdown').find('.label').text(selectTitle) 6817 6818 6819 6820 }); 6821 6822 //End re-create for mobile 6823 6824 ddlFilter.find('li').click(function (e) { 6825 e.preventDefault(); 6826 6827 6828 c.loader.show(listingWrapper.parent(),true); 6829 6830 var sel = $(this).find('a').attr('data-id'); 6831 6832 console.log(sel) 6833 6834 if ($(this).find('a').attr('data-id') != '') { 6835 apiUrl = '/api/CorpAlumni/GetAwardsByPagination?itemscount=0&type={0}'.f($(this).find('a').attr('data-id')); 6836 urlPushState = '?itemscount=0&type={0}'.f($(this).find('a').attr('data-id')); 6837 } 6838 else { 6839 apiUrl = '/api/CorpAlumni/GetAwardsByPagination?itemscount=0'; 6840 urlPushState = '?itemscount=0'; 6841 } 6842 6843 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 6844 6845 ddlFilter.children().each(function () { 6846 if ($(this).hasClass("active")) { 6847 $(this).removeClass("active"); 6848 } 6849 }); 6850 $(this).addClass("active"); 6851 6852 }); 6853 6854 // event click on seemore button in testimonials page add by tin 6855 loadMore.bind('click', function (e) { 6856 e.preventDefault(); 6857 6858 c.loader.show(listingWrapper.parent(),false); 6859 6860 var type = getUrlParameter('type'); 6861 6862 if (type == 'false' || type == "") { 6863 6864 selTab = ddlFilter.find('li.active').find('a').attr('data-id') 6865 if (selTab == "all") { 6866 apiUrl = '/api/CorpAlumni/GetAwardsByPagination?itemscount={0}&type={1}'.f(listingWrapper.children().length, selTab); 6867 urlPushState = '?itemscount=0&type={0}'.f(selTab); 6868 } else { 6869 apiUrl = '/api/CorpAlumni/GetAwardsByPagination?itemscount={0}'.f(listingWrapper.children().length); 6870 urlPushState = '?itemscount=0'; 6871 } 6872 6873 6874 } 6875 else { 6876 apiUrl = '/api/CorpAlumni/GetAwardsByPagination?itemscount={0}&type={1}'.f(listingWrapper.children().length, type); 6877 urlPushState = '?itemscount=0&type={0}'.f(type); 6878 } 6879 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, "load-more"); 6880 }); 6881 6882 function GetDataShowMore(flagDropdow, apiUrl, urlPushState, nameList, action) { 6883 // var $t = $(this); 6884 var items; 6885 var dataItems = ""; 6886 var loadMore = $('#alumni-load-more') 6887 6888 $.ajax({
6889 url: apiUrl, 6890 success: function (data) { 6891 if (data.Result) { 6892 6893 6894 if (action == "filtering") { 6895 nameList.html('') 6896 } 6897 6898 6899 $.each(data.Data, function (index, item) { 6900 6901 6902 var itemHTML = ""; 6903 6904 6905 itemHTML = `<div class="flex-item-wrapper">` 6906 + `<a href="${item.LinkURL}">` 6907 + `<img src="${item.ProfileImageURL}" />` 6908 + `</a>` 6909 + `<div class="artist-name">` 6910 + `<p class="font-weight-bold pt-2 mb-0">` 6911 + `${item.Name}` 6912 + `</p>` 6913 + `</div>` 6914 + `<div class="artist-desc">` 6915 + `<p>` 6916 + `${item.Designation}` 6917 + `</p>` 6918 + `</div>` 6919 + `</div>` 6920 6921 6922 if (itemHTML != "") { 6923 dataItems += itemHTML; 6924 } 6925 6926 6927 6928 6929 }); 6930 6931 6932 6933 nameList.append(dataItems); 6934 6935 6936 if (nameList.children().length >= data.PageCount) { 6937 loadMore.hide(); 6938 6939 6940 } else { 6941 loadMore.show(); 6942 6943 6944 } 6945 6946 //For anchor with browser back 6947 var currentUrl = window.location; 6948 if (window.location.search.length) { 6949 var currentUrl = window.location.href.split('?')[0]; 6950 } 6951 urlPushState = currentUrl + urlPushState; 6952 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 6953 window.history.pushState(null, null, urlPushState); 6954 } 6955 }, 6956 error: function (jqXHR, textStatus, errorThrown) { 6957 c.loader.hide(nameList.parent()); 6958 }, 6959 complete: function () { 6960 c.loader.hide(nameList.parent()); 6961 } 6962 }); 6963 } 6964 } 6965 }, 6966showcaseGraduates: { 6967 init: function() { 6968 var listingWrapper = $(".tab-context-wrapper.showcase-graduates .flex-wrapper") 6969 6970 6971 var dd = $('.staff-dropdown'); 6972 var loadMore = $('#showcase-graduates-load-more') 6973 6974 dd.on('click', function (e) { 6975 e.preventDefault(); 6976 6977 $(this).prevAll('.staff-dropdown').each(function(){ 6978 if ($(this).hasClass("open")) { 6979 $(this).removeClass("open") 6980 } 6981 }) 6982 6983 $(this).nextAll('.staff-dropdown').each(function(){ 6984 if ($(this).hasClass("open")) { 6985 $(this).removeClass("open") 6986 } 6987 }) 6988 6989 6990 if ($(this).hasClass("open")) { 6991 $(this).removeClass("open") 6992 } else { 6993 $(this).addClass("open") 6994 } 6995 6996 }) 6997 6998 var defaultApiUrl = "/api/ShowcaseGraduatesApi/GetShowMoreStudent?itemscount=0&year={0}&programme={1}&course={2}&graduate={3}&websiteUrl={4}&isCheckingAllGraduateTypes={5}"; 6999 var defaultPushStareUrl = "?itemscount=0&year={0}&programme={1}&course={2}&graduate={3}"; 7000 7001 var defaultApiShowMoreUrl = "/api/ShowcaseGraduatesApi/GetShowMoreStudent?itemscount={0}&year={1}&programme={2}&course={3}&graduate={4}&websiteUrl={5}&isCheckingAllGraduateTypes=false"; 7002 var defaultPushStareShowMoreUrl = "?itemscount=0&year={0}&programme={1}&course={2}&graduate={3}"; 7003 //assign value head for year 7004 var programmeParam = getParameterByName("programme"); 7005 var courseParam = getParameterByName("course"); 7006 var graduateParam = getParameterByName("graduate"); 7007 7008 if (programmeParam !== "" && programmeParam !== defaultProgrammes) { 7009 $('#filterProgrammes a').each(function (index) { 7010 var dataElement = $(this).attr('data-url'); 7011 7012 7013 if (dataElement == programmeParam) { 7014 $('#filterDropdownProgrammes').attr('data-url', dataElement); 7015 $('#filterDropdownProgrammes').html($(this).text() + '<span class="caret"></span>'); 7016 } 7017 }); 7018 } 7019 7020 if (courseParam != "" && courseParam != defaultCourse) { 7021 $('#filterCourses a').each(function (index) { 7022 var dataElement = $(this).attr('data-url'); 7023 if (dataElement == courseParam) { 7024 $('#filterDropdownCourses').attr('data-url', dataElement); 7025 $('#filterDropdownCourses').html($(this).text() + '<span class="caret"></span>'); 7026 } 7027 }); 7028 } 7029 7030 if (graduateParam != "" && graduateParam != defaultGraduates) { 7031 $('#filterCategory a').each(function (index) { 7032 var dataElement = $(this).attr('data-url'); 7033 if (dataElement == graduateParam) { 7034 $('#filterDropdown').attr('data-url', dataElement); 7035 $('#filterDropdown').html($(this).text() + '<span class="caret"></span>'); 7036 } 7037 }); 7038 } 7039 7040 7041 7042 // event click on seemore button in award page add by tin 7043 $("#showcase-graduates-load-more").bind("click", function (e) { 7044 e.preventDefault(); 7045 7046 var totalItem = listingWrapper.children().length; 7047 7048 //Filter Student Data 7049 var apiUrl = defaultApiShowMoreUrl.format(totalItem, $("#filterDropdownYear").attr("data-id"), $("#filterDropdownProgrammes").attr("data-url"), $("#filterDropdownCourses").attr("data-url"), $("#filterDropdown").attr("data-id"), window.location.origin); 7050 7051 var urlPushState = defaultPushStareUrl.format($("#filterDropdownYear").attr("data-id"), $("#filterDropdownProgrammes").attr("data-url"), $("#filterDropdownCourses").attr("data-url"), $("#filterDropdown").attr("data-id")); 7052 7053 7054 var action = "load-more" 7055 7056 7057 GetFilterData(false, apiUrl, urlPushState, action); 7058 }); 7059 7060 7061 7062 7063 function GetFilterData(isShow, apiUrl, urlPushState, action) { 7064 7065 7066 7067 GetDataShowMore(isShow, apiUrl, urlPushState, listingWrapper, action); 7068 } 7069 7070 function GetDataShowMore(flagDropdow, apiUrl, urlPushState, nameList, action) { 7071 7072 var items; 7073 var dataItems = ""; 7074 7075 7076 if (nameList.find('.error-msg').length > 0) { 7077 nameList.find('.error-msg').remove() 7078 7079 } 7080 7081 //$.when( 7082 7083 $.ajax({
7084 url: apiUrl, 7085 success: function (data) { 7086 7087 if (data.Result) { 7088 7089 //Append html here 7090 7091 7092 if (action == "filtering") { 7093 nameList.html('') 7094 } 7095 7096 7097 7098 $.each(data.Data, function (index, item) { 7099 7100 7101 7102 var courseHTML = "" 7103 $(item.StudentCourse).each(function(){ 7104 7105 courseHTML += $(this)[0].Title 7106 7107 }) 7108 7109 var programmeHTML = "" 7110 $(item.StudentProgramme).each(function(){ 7111 7112 programmeHTML += $(this)[0].Title 7113 7114 }) 7115 7116 var itemHTML = ""; 7117 7118 7119 itemHTML = `<div class="flex-item-wrapper">` 7120 + `<a href="/showcase/graduates-showcase-detail?itemscount=8&name=${item.StudentUrl}">` 7121 + `<img src="${item.StudentPhoto}" />` 7122 + `</a>` 7123 + `<div class="artist-name">` 7124 + `<p class="font-weight-bold pt-2 mb-0">` 7125 + `${item.StudentName} | ${courseHTML}` 7126 + `</p>` 7127 + `</div>` 7128 + `<div class="artist-desc">` 7129 + `<p>` 7130 + `${programmeHTML}` 7131 + `</p>` 7132 + `</div>` 7133 + `</div>` 7134 7135 7136 if (itemHTML != "") { 7137 dataItems += itemHTML; 7138 } 7139 7140 7141 7142 7143 });
7144 7145 7146 nameList.append(dataItems); 7147 7148 if (nameList.children().length >= data.PageCount) { 7149 loadMore.hide(); 7150 7151 7152 } else { 7153 loadMore.show(); 7154 7155 7156 } 7157 7158 if (action == "filtering") { 7159 7160 if (data.PageCount == 0) { 7161 7162 nameList.prepend('<p class="error-msg">No result currently.</p>') 7163 } 7164 7165 } 7166 7167 7168 7169 //For anchor with browser back 7170 var currentUrl = window.location; 7171 if (window.location.search.length) { 7172 currentUrl = window.location.href.split("?")[0]; 7173 } 7174 urlPushState = currentUrl + urlPushState; 7175 urlPushState = urlPushState.replace("itemscount=0", "itemscount={0}".format(nameList.children().length)); 7176 7177 urlPushState = CurrentUrl(urlPushState, data.GraduateType); 7178 7179 window.history.pushState(null, null, urlPushState); 7180 7181 7182 7183 7184 } 7185 }, 7186 error: function () { 7187 //CloseLoading(); 7188 }, 7189 complete: function () { 7190 7191 7192 } 7193 }) 7194 7195 //).done(function () { 7196 7197 //CloseLoading(); 7198 //}); 7199 } 7200 7201 function ShowLess(urlPushState, lengthRemove, nameList) { 7202 var lis = nameList.children(); 7203 if (lis.length > lengthRemove) { 7204 var itemsToRemove = lis.length % (lengthRemove / 2); 7205 if (itemsToRemove === 0) { itemsToRemove = (lengthRemove / 2); } 7206 lis.slice(lis.length - itemsToRemove).remove(); 7207 nameList.masonry(); 7208 7209 //For anchor with browser back 7210 var currentUrl = window.location; 7211 if (window.location.search.length) { 7212 currentUrl = window.location.href.split("?")[0]; 7213 } 7214 urlPushState = currentUrl + urlPushState; 7215 urlPushState = urlPushState.replace("itemscount=0", "itemscount={0}".f(nameList.children().length)); 7216 7217 urlPushState = CurrentUrl(urlPushState, null); 7218 7219 window.history.pushState(null, null, urlPushState); 7220 7221 } 7222 if (nameList.children().length <= lengthRemove) $(".read-more").show(), $(".read-less").hide(); 7223 $(".read-more").show(); 7224 } 7225 7226 function CurrentUrl(url, updatedGraduate) { 7227 7228 var urlMod = ""; 7229 urlMod = url.split("?")[1]; 7230 var programme = getParameterByUrl("programme", urlMod); 7231 var course = getParameterByUrl("course", urlMod); 7232 var graduate = getParameterByUrl("graduate", urlMod); 7233 7234 if (programme === "" || programme === defaultProgrammes) { 7235 url = url.replace("&programme=" + defaultProgrammes, ""); 7236 } 7237 7238 if (course === "" || course === defaultCourse) { 7239 url = url.replace("&course=" + defaultCourse, ""); 7240 } 7241 7242 if (graduate === "" || graduate === defaultGraduates) { 7243 url = url.replace("&graduate=" + defaultGraduates, ""); 7244 } 7245 else if (updatedGraduate) { 7246 var graduateElement; 7247 if (updatedGraduate === defaultGraduates) { 7248 // All 7249 url = url.replace("&graduate=" + graduate, ""); 7250 graduateElement = $("#allId"); 7251 } else { 7252 // Featured 7253 url = url.replace("&graduate=" + graduate, "&graduate=" + updatedGraduate); 7254 graduateElement = $("#featuredId"); 7255 } 7256 7257 $("#filterDropdown").attr('data-id', graduateElement.attr('data-id')); 7258 $("#filterDropdown").html(graduateElement.text() + '<span class="caret"></span>'); 7259 $("#filterDropdown").attr('data-url', graduateElement.attr("data-url")); 7260 } 7261 7262 urlMod = url; 7263 7264 return urlMod; 7265 7266 } 7267 7268 var ddlFilterShowCaseGraduates = $(".staff-dropdown ul"); 7269 7270 ddlFilterShowCaseGraduates.find("a").bind("click", function (e) { 7271 7272 e.preventDefault(); 7273 7274 var $t = $(this); 7275 var isCheckingAllGraduateTypes = true; 7276 $t.parents("ul").prev().html($t.text() + "<span class=\"caret\"></span>"); 7277 7278 $t.parents("ul").prev().attr("data-id", $(this).attr("data-id")); 7279 $t.parents("ul").prev().attr("data-type", $(this).attr("data-type")); 7280 $t.parents("ul").prev().attr("data-url", $(this).attr("data-url"));
7281 7282 if ($t.parents("ul").hasClass("Year")) { 7283 if ($t.attr("data-id") === '2014') { 7284 window.location = '/showcase/graduation-portfolios'; 7285 } 7286 $("#filterDropdownYear").attr('data-id', $(this).attr('data-id')); 7287 // GetFilterData(false, apiUrl, urlPushState); 7288 7289 //var id = $("#filterDropdownYear").attr("data-id"); 7290 7291 //var isFeatured = $("#" + id).attr("data-featured"); 7292 //var isBestGraduates = $("#" + id).attr("data-bestgraduates"); 7293 7294 //if (isFeatured === "True") { 7295 // $("#featuredId").parent().show(); 7296 //} else { 7297 // $("#featuredId").parent().hide(); 7298 //} 7299 7300 //if (isBestGraduates === "True") { 7301 // $("#bestId").parent().show(); 7302 //} else { 7303 // $("#bestId").parent().hide(); 7304 //} 7305 } 7306 else if ($t.parents("ul").hasClass("Programmer")) { 7307 7308 var selectedDataUrl = $(this).attr("data-url"); 7309 7310 $("#filterDropdownProgrammes").attr('data-id', $(this).attr('data-id')); 7311 $("#filterDropdownProgrammes").html($(this).text() + '<span class="caret"></span>'); 7312 $("#filterDropdownProgrammes").attr('data-url', selectedDataUrl); 7313 7314 var totalElement = $("#filterCourses li").length; 7315 var flag = false; 7316 7317 for (var i = 0; i < totalElement; i++) { 7318 7319 var element = $("#filterCourses li a")[i]; 7320 7321 if ($(element).attr("data-type") === $(this).attr("data-type") || $(element).attr("data-type") === defaultCourse || $(this).attr("data-type") === defaultProgrammes) { 7322 7323 $(element).show(); 7324 } else { 7325 7326 $(element).hide(); 7327 } 7328 } 7329 7330 // Reset selected course 7331 var firstElement = $("#filterCourses li a")[0]; 7332 $("#filterDropdownCourses").attr('data-id', $(firstElement).attr('data-id')); 7333 $("#filterDropdownCourses").html($(firstElement).text() + '<span class="caret"></span>'); 7334 $("#filterDropdownCourses").attr('data-url', $(firstElement).attr("data-url")); 7335 7336 // Reset selected graduate 7337 var firstGraduateType = $("#filterCategory li a")[0]; 7338 $("#filterDropdown").attr('data-id', $(firstGraduateType).attr('data-id')); 7339 $("#filterDropdown").html($(firstGraduateType).text() + '<span class="caret"></span>'); 7340 $("#filterDropdown").attr('data-url', $(firstGraduateType).attr("data-url")); 7341 } 7342 else if ($t.parents("ul").hasClass("Course")) { 7343 var selectedCourseDataUrl = $(this).attr("data-url"); 7344 $("#filterDropdownCourses").attr('data-id', $(this).attr('data-id')); 7345 $("#filterDropdownCourses").html($(this).text() + '<span class="caret"></span>'); 7346 $("#filterDropdownCourses").attr('data-url', selectedCourseDataUrl); 7347 7348 // Reset selected graduate 7349 var firstGraduateType = $("#filterCategory li a")[0]; 7350 $("#filterDropdown").attr('data-id', $(firstGraduateType).attr('data-id')); 7351 $("#filterDropdown").html($(firstGraduateType).text() + '<span class="caret"></span>'); 7352 $("#filterDropdown").attr('data-url', $(firstGraduateType).attr("data-url")); 7353 } else if ($t.parents("ul").hasClass("GraduatesType")) { 7354 isCheckingAllGraduateTypes = false; 7355 var selectedTypeDataUrl = $(this).attr("data-url"); 7356 7357 $("#filterDropdown").attr('data-id', $(this).attr('data-id')); 7358 $("#filterDropdown").html($(this).text() + '<span class="caret"></span>'); 7359 $("#filterDropdown").attr('data-url', selectedTypeDataUrl); 7360 7361 } 7362 7363 var apiUrl = defaultApiUrl.format($("#filterDropdownYear").attr("data-id"), $("#filterDropdownProgrammes").attr("data-url"), $("#filterDropdownCourses").attr("data-url"), $("#filterDropdown").attr("data-id"), window.location.origin, isCheckingAllGraduateTypes); 7364 7365 var urlPushState = defaultPushStareUrl.format($("#filterDropdownYear").attr("data-id"), $("#filterDropdownProgrammes").attr("data-url"), $("#filterDropdownCourses").attr("data-url"), $("#filterDropdown").attr("data-id")); 7366 7367 7368 GetFilterData(true, apiUrl, urlPushState, "filtering"); 7369 }); 7370 7371 7372 //Remove after eGrad launch start 7373 // var isCheckingAllGraduateTypes = true; 7374 7375 // var apiUrl = defaultApiUrl.format($("#filterDropdownYear").attr("data-id"), $("#filterDropdownProgrammes").attr("data-url"), $("#filterDropdownCourses").attr("data-url"), $("#filterDropdown").attr("data-id"), window.location.origin, isCheckingAllGraduateTypes); 7376 7377 // var urlPushState = defaultPushStareUrl.format($("#filterDropdownYear").attr("data-id"), $("#filterDropdownProgrammes").attr("data-url"), $("#filterDropdownCourses").attr("data-url"), $("#filterDropdown").attr("data-id")); 7378 7379 7380 // GetFilterData(true, apiUrl, urlPushState, "filtering"); 7381 //Remove after eGrad launch end 7382 7383 } 7384 }, 7385 staffs: { 7386 init: function() { 7387 7388 7389 var apiUrl = ""; 7390 var urlPushState = ""; 7391 7392 7393 var ddlFilter = $('.tab-menu-wrapper.staffs-listing ul.desktop-type'); 7394 var listingWrapper = $('.tab-context-wrapper.staffs-listing .flex-wrapper'); 7395 var loadMore = $('#staffs-load-more') 7396 7397 7398 var c= wpContent; 7399
7400 //Re-create for mobile 7401 7402 7403 $('<div class="dropdown mobile-type-dropdown staffs" id="type"><div class="drop-down-menu"><div class="label"></div><ul id="mobileTypeFilter" class="has-hyperlinks dropdown-menu staffs" role="menu" ></ul></div></div>').insertBefore(ddlFilter); 7404 7405 ddlFilter.find('li').each(function(){ 7406 7407 if ($(this).hasClass("active")) { 7408 $('.mobile-type-dropdown').find('.label').text($("<div/>").html($(this).find('a').html()).text()) 7409 } 7410 7411 $('.mobile-type-dropdown').find('ul').append($(this)[0].outerHTML) 7412 7413 }) 7414 7415 $('.mobile-type-dropdown').on('click', function(){ 7416 7417 if (!$(this).find('.dropdown-menu').hasClass("active")) { 7418 $(this).find('.dropdown-menu').addClass("active") 7419 } else { 7420 $(this).find('.dropdown-menu').removeClass("active") 7421 } 7422 }) 7423 7424 7425 $('.mobile-type-dropdown').find('li').bind('click', function (e) { 7426 e.preventDefault(); 7427 var $t = $(this); 7428 7429 c.loader.show(listingWrapper.parent(),true); 7430 7431 var selectValue = $(this).find('a').attr('data-id'); 7432 7433 ddlFilter.find('li').each(function(){ 7434 7435 if ($(this).attr('data-id') == selectValue) { 7436 ddlFilter.find('li').removeClass("active") 7437 $(this).addClass("active") 7438 } 7439 7440 7441 }) 7442 7443 var selectTitle = $("<div/>").html($(this).find('a').html()).text(); 7444 7445 7446 if ($(this).attr('data-id') != '') { 7447 apiUrl = '/api/CorpStaffsApi/GetStaffsBySeeMore?itemscount=0&type={0}'.f(selectValue); 7448 urlPushState = '?itemscount=0&type={0}'.f(selectValue); 7449 } 7450 else { 7451 apiUrl = '/api/CorpStaffsApi/GetStaffsBySeeMore?itemscount=0'; 7452 urlPushState = '?itemscount=0'; 7453 } 7454 7455 var action = "filtering" 7456 7457 7458 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, action); 7459 7460 $('.mobile-type-dropdown').find('.label').text(selectTitle) 7461 7462 7463 7464 }); 7465 7466 //End re-create for mobile 7467 7468 7469 if ($('.tab-menu-wrapper.staffs-listing ul.desktop-type').children().length > 8) { 7470 $('.tab-menu-wrapper.staffs-listing ul.desktop-type').slick({ 7471 dots: false, 7472 speed: 500, 7473 slidesToShow: 8, 7474 slidesToScroll: 1, 7475 infinite: false, 7476 arrows: true, 7477 responsive: [ 7478 { 7479 breakpoint: 767, 7480 settings: { 7481 arrows: false, 7482 slidesToShow: 1, 7483 slidesToScroll: 1 7484 } 7485 }] 7486 }); 7487 } 7488 7489 7490 ddlFilter.find('li').click(function (e) { 7491 e.preventDefault(); 7492 7493 c.loader.show(listingWrapper.parent(),true); 7494 7495 var sel = $(this).find('a').attr('data-id'); 7496 7497 7498 if ($(this).attr('data-id') != '') { 7499 apiUrl = '/api/CorpStaffsApi/GetStaffsBySeeMore?itemscount=0&type={0}'.f(sel); 7500 urlPushState = '?itemscount=0&type={0}'.f(sel); 7501 } 7502 else { 7503 apiUrl = '/api/CorpStaffsApi/GetStaffsBySeeMore?itemscount=0'; 7504 urlPushState = '?itemscount=0'; 7505 } 7506 7507 7508 GetDataShowMore(true, apiUrl, urlPushState, listingWrapper, "filtering"); 7509 7510 ddlFilter.children().each(function () { 7511 if ($(this).hasClass("active")) { 7512 $(this).removeClass("active"); 7513 } 7514 }); 7515 $(this).addClass("active"); 7516 7517 }); 7518 7519 // event click on seemore button in interviews page add by tin 7520 loadMore.bind('click', function (e) { 7521 e.preventDefault(); 7522 7523 c.loader.show(listingWrapper.parent(),false); 7524 7525 var type = getUrlParameter('type'); 7526 7527 if (type == 'false' || type == "") { 7528 apiUrl = '/api/CorpStaffsApi/GetStaffsBySeeMore?itemscount={0}'.f(listingWrapper.children().length); 7529 urlPushState = '?itemscount=0'; 7530 } 7531 else { 7532 apiUrl = '/api/CorpStaffsApi/GetStaffsBySeeMore?itemscount={0}&type={1}'.f(listingWrapper.children().length, type); 7533 urlPushState = '?itemscount=0&type={0}'.f(type); 7534 } 7535 GetDataShowMore(false, apiUrl, urlPushState, listingWrapper, "load-more"); 7536 }); 7537 7538 function GetDataShowMore(flagDropdow, apiUrl, urlPushState, nameList, action) { 7539 // var $t = $(this); 7540 var items; 7541 var dataItems = ""; 7542 var loadMore = $('#staffs-load-more') 7543 7544 $.ajax({
7545 url: apiUrl, 7546 success: function (data) { 7547 if (data.Result) { 7548 7549 7550 if (action == "filtering") { 7551 listingWrapper.html('') 7552 } 7553 7554 7555 $.each(data.Data, function (index, item) { 7556 7557 var itemHTML = ""; 7558 7559 itemHTML = `<div class="flex-item-wrapper">` 7560 + `<div class="img-wrapper">` 7561 + `<a href="${item.LinkURL}"><img src="${item.ProfileImageURL}"></a>` 7562 + `</div>` 7563 + `<div class="artist-name">` 7564 + `<p class="font-weight-bold pt-2 mb-0">` 7565 + `<a href="${item.LinkURL}">` 7566 + `${item.Name}` 7567 + `</a></p>` 7568 + `</div>` 7569 + `<div class="artist-desc">` 7570 + `<p>${item.Position}</p>` 7571 + `</div>` 7572 + `</div>` 7573 7574 if (itemHTML != "") { 7575 dataItems += itemHTML; 7576 } 7577 7578 7579 7580 7581 7582 7583 }); 7584 7585 7586 nameList.append(dataItems); 7587 7588 if (nameList.children().length >= data.PageCount) { 7589 loadMore.hide(); 7590 7591 7592 } else { 7593 loadMore.show(); 7594 7595 7596 } 7597 //For anchor with browser back 7598 var currentUrl = window.location; 7599 if (window.location.search.length) { 7600 var currentUrl = window.location.href.split('?')[0]; 7601 } 7602 urlPushState = currentUrl + urlPushState; 7603 urlPushState = urlPushState.replace('itemscount=0', 'itemscount={0}'.f(nameList.children().length)); 7604 window.history.pushState(null, null, urlPushState); 7605 } 7606 }, 7607 error: function (jqXHR, textStatus, errorThrown) { 7608 c.loader.hide(nameList.parent()); 7609 }, 7610 complete: function () { 7611 c.loader.hide(nameList.parent()); 7612 } 7613 }); 7614 } 7615 } 7616 }, 7617 courseTabs: { 7618 7619 init: function () { 7620 7621 this.sticky(); 7622 this.navigation() 7623 }, sticky: function () { 7624 var lastST = 0; 7625 var picBanner = $("header + div > .banner"); 7626 if (picBanner.length === 0 && $(window).width()<1181){ 7627 $(".course-tabs + *").css("margin-top", $("header").innerHeight()) 7628 } 7629 $(window).on("scroll", function () { 7630 var st = $(this).scrollTop(); 7631 if((st/$(document).height()>0.7 && st>lastST) || Math.ceil(st+$(window).height())>=$(document).height()){ 7632 7633 if ($('.always-visible').length > 0) { 7634 7635 } else { 7636 $(".course-tabs").css("opacity","0"); 7637 } 7638 7639 return; 7640 }else{ 7641 $(".course-tabs").css("opacity","1"); 7642 } 7643 wpContent.courseTabs.locateTabs(st-lastST) 7644 lastST = $(this).scrollTop() 7645 }) 7646 $(window).resize(function () { 7647 wpContent.courseTabs.locateTabs() 7648 7649 }) 7650 }, navigation: function () { 7651 //desktop view 7652 if (window.location.href.indexOf("teaching-learning-centre") === -1) { 7653 $(".course-tabs a,.mobile-course-tabs a").on("click", function (e) { 7654 e.preventDefault(); 7655 var feesLink = $(this).attr("href"); 7656 7657 if ($(this).hasClass("fees")) { 7658 window.open(feesLink, '_blank'); 7659 7660 } 7661 else { 7662 7663 if ($(this).hasClass("active")) { 7664 return; 7665 } 7666 7667 $(".course-tab-item").removeClass("active") 7668 $(".mobile-course-tabs a").removeClass("active") 7669 $(e.target).addClass("active") 7670 var id = $(e.target).attr("href") 7671 7672 7673 7674 7675 if ($('.tab-content').length > 0) { 7676 7677 7678 $('.tab-content').each(function () { 7679 if (!$(this).hasClass("hide")) { 7680 $(this).addClass("hide") 7681 } 7682 }) 7683 7684 console.log($('.tab-content' + id)); 7685 setTimeout(function () { $('.tab-content' + id).removeClass("hide") }, 100) 7686 var targetNode = $(e.target).closest(".course-tabs").length > 0 ? $(e.target).closest(".course-tabs") : $(e.target).closest(".mobile-course-tabs"); 7687 var targetPos = targetNode.offset().top - 80; 7688 window.scroll({ top: targetPos }) 7689 7690 } else { 7691 var height = $(id).offset().top - $(".header").innerHeight() - $(".course-tabs").innerHeight() + 1; 7692 7693 window.scroll({ top: height }) 7694 7695 7696 } 7697 7698 } 7699 7700 7701 7702 7703 7704 }) 7705 $(window).on("scroll", function (e) { 7706 7707 if ($('.tab-content').length <= 0) { 7708 7709 let posY = $(window).scrollTop() + $(".header").innerHeight() + $(".course-tabs").innerHeight(); 7710 $(".course-tabs .course-tab-item").each(function () { 7711 if (!$(this).hasClass("fees")) { 7712 var id = $(this).attr("href") 7713 if (posY >= $(id).offset().top && posY < $(id).offset().top + $(id).innerHeight()) { 7714 $(".course-tabs .course-tab-item").removeClass("active"); 7715 $(this).addClass("active"); 7716 return; 7717 } 7718 } 7719 }) 7720 } 7721 7722 7723 7724 7725 }) 7726 //mobile view 7727 /*$(".mobile-course-tabs a").on("click", function (e) { 7728 e.preventDefault(); 7729 7730 if ($('.tab-content').length > 0) { 7731 7732 7733 $('.tab-content').each(function(){ 7734 if (!$(this).hasClass("hide")) { 7735 $(this).addClass("hide") 7736 } 7737 }) 7738 7739 7740 $('.tab-content' + id).removeClass("hide") 7741 7742 } else { 7743 7744 var id = $(e.target).attr("href") 7745 var height = $(id).offset().top - $(".header").innerHeight(); 7746 7747 window.scroll({ top: height+"px" }) 7748 7749 } 7750 7751 7752 })*/ 7753 7754 7755 var id = window.location.hash; 7756 7757 if ($('.tab-content').length > 0 && id != "") { 7758 7759 7760 7761 7762 $('.course-tab-item').each(function () { 7763 if (!$(this).hasClass("fees")) { 7764 7765 if ($(this).hasClass("active")) { 7766 $(this).removeClass("active") 7767 } 7768 } 7769 }) 7770 7771 7772 $('.tab-content').each(function () { 7773 if (!$(this).hasClass("hide")) { 7774 $(this).addClass("hide") 7775 } 7776 }) 7777 7778 7779 $('.tab-content' + id).removeClass("hide") 7780 7781 } 7782 7783 7784 //Remove tab if section doesn't exist 7785 if ($('.course-tabs').length > 0) { 7786 7787 7788 $('.course-tab-item').each(function () { 7789 if (!$(this).hasClass("fees")) { 7790 var currObj = $(this) 7791 var id = $(this).attr('href') 7792 7793 7794 console.log($(id).attr("style")) 7795 7796 if ($(id).length <= 0 || $(id).attr("style") == "display:none") { 7797 7798 7799 console.log("empty") 7800 7801 currObj.remove() 7802 } 7803 } 7804 }) 7805 7806 7807 $('.mobile-course-tabs a').each(function () { 7808 7809 var currObj = $(this) 7810 var id = $(this).attr('href') 7811 7812 if (!$(this).hasClass("fees")) { 7813 7814 if ($(id).length <= 0 || $(id).attr("style") == "display:none") { 7815 7816 7817 console.log("empty") 7818 7819 currObj.remove() 7820 } 7821 } 7822 }) 7823 } 7824 } 7825 7826 }, 7827 locateTabs: function (offset = 1) { 7828 var top = $(window).scrollTop() + $("header").innerHeight(); 7829 var targetPosition = 0; 7830 var picBanner = $("header + div > .banner"); 7831 7832 var transform = $('header').css('transform'); 7833 7834 if ($(".banner").length > 0 && picBanner.length > 0) 7835 targetPosition = $(".banner").offset().top + $(".banner").innerHeight() 7836 7837 if (top >= targetPosition) { 7838 if (!$(".course-tabs").hasClass("sticky")) { 7839 $(".course-tabs").addClass("sticky") 7840 7841 } 7842 $(".course-tabs + *").css("margin-top", $(".course-tabs").innerHeight()) 7843 if (offset > 0 && $(window).width()<1181) $(".course-tabs").css("top", "0px") 7844 else $(".course-tabs").css("top", $(".menu-bar").innerHeight()-1 + "px") 7845 $(".course-tabs").css("left", 0) 7846 } else { 7847 $(".course-tabs + *").css("margin-top", 0) 7848 $(".course-tabs").removeClass("sticky") 7849 } 7850 if (picBanner.length === 0){ 7851 $(".course-tabs + *").css("margin-top", $("header").innerHeight()) 7852 } 7853 if(window.scrollY === 0){ 7854 $('.course-tabs').removeClass('sticky'); 7855 } 7856 } 7857 7858 }, slider: { 7859 init: function () {
7860 if($(".nafa-slider").length > 0){ 7861 $(".nafa-slider").slick({ 7862 dots: true, 7863 7864 // autoplay:true 7865 }); 7866 } 7867 7868 } 7869 }, 7870 courseGallery: { 7871 init: function () { 7872 this.onCourseChange() 7873 7874 }, 7875 onCourseChange: function () { 7876 $(".courses-btn-grp .btn-tab").on("click", function (e) { 7877 e.preventDefault() 7878 $(".courses-btn-grp .btn-tab").removeClass("active") 7879 var targetBtn = $(e.target); 7880 if (!targetBtn.hasClass("active")) { 7881 targetBtn.addClass("active") 7882 } 7883 $(".course-gallery a").removeClass("hide") 7884 var id = $(e.target).attr("href").replace("#", "") 7885 $(`.course-gallery a:not([data-course-category=${id}])`).addClass("hide") 7886 }) 7887 } 7888 }, 7889 lightboxGallery: { 7890 init: function () { 7891 var gal = wpContent.lightboxGallery; 7892 gal.onImageChanged() 7893 gal.onClose() 7894 gal.onPopUp() 7895 }, 7896 onPopUp: function () { 7897 $(".lightbox-trigger").on("click", function (e) { 7898 var index = $(e.target).attr("data-index") 7899 var lightboxId = $(e.target).attr("data-lightbox-id") 7900 console.log(index); 7901 $(`.img-lightbox-overlay[data-lightbox-id=${lightboxId}]`).addClass("active"); 7902 $(`.img-lightbox-overlay[data-lightbox-id=${lightboxId}] .lightbox-main-img .img-wrapper`).removeClass("active") 7903 $(`.img-lightbox-overlay[data-lightbox-id=${lightboxId}] .lightbox-main-img .img-wrapper[data-index=${index}]`).addClass("active") 7904 7905 $(`.img-lightbox-overlay[data-lightbox-id=${lightboxId}] .lightbox-gallery .img-wrapper`).removeClass("active") 7906 $(`.img-lightbox-overlay[data-lightbox-id=${lightboxId}] .lightbox-gallery .img-wrapper[data-index=${index}]`).addClass("active") 7907 }) 7908 }, 7909 onImageChanged: function () { 7910 $(".lightbox-gallery .img-wrapper").on("click", function (e) { 7911 7912 const index = $(e.target).attr("data-index") 7913 $(".lightbox-main-img .img-wrapper").removeClass("active"); 7914 $(".lightbox-gallery .img-wrapper").removeClass("active"); 7915 $(`.lightbox-main-img .img-wrapper[data-index=${index}]`).addClass("active") 7916 $(`.lightbox-gallery .img-wrapper[data-index=${index}]`).addClass("active") 7917 }) 7918 }, 7919 onClose: function () { 7920 $(".img-lightbox-overlay, .lightbox-main-img .lightbox-close-btn").on("click", function (e) { 7921 if ($(e.target).hasClass("img-lightbox-overlay") || $(e.target).hasClass("lightbox-close-btn")) 7922 $(".img-lightbox-overlay").removeClass("active"); 7923 7924 }) 7925 } 7926 },awardDetail:{ 7927 init:function(){ 7928 $(".tab-menu-wrapper.award-detail-tab ul li").on("click",function(e){ 7929 var id = $(e.target).attr("data-id"); 7930 7931 console.log(id); 7932 7933 $(".tab-context-wrapper.awards").removeClass("activeContent"); 7934 7935 $(".tab-context-wrapper.awards[data-id="+id+"]").addClass('activeContent'); 7936 7937 7938 7939 e.preventDefault; 7940 }) 7941 7942 7943 7944 $('.tab-menu-wrapper.award-detail-tab .tab-menu-dropdown').on('change', function(){ 7945 7946 7947 $(".tab-context-wrapper.awards").removeClass("active") 7948 $(".tab-context-wrapper.awards[data-id="+this.value+"]").addClass("active"); 7949 7950 }) 7951 } 7952 }, 7953 faqAccordion:{ 7954 init:function(){ 7955 7956 var accordionButton = $(".faq-list .accordion-item-title"); 7957 7958 $(".accordion-item-title").on("click",function(e){ 7959 7960 var target = $(e.target).closest(".accordion"); 7961 target.toggleClass("expand"); 7962 7963 7964 }) 7965 } 7966 }, 7967 videoControl:{ 7968 init:function(){ 7969 $(".video-item video").on("click",function(e){
7970 7971 var target = $(e.target).closest(".video-item"); 7972 target.toggleClass("video-hide"); 7973 }) 7974 } 7975 }, 7976 loader:{ 7977 show:function(target,isPrepend){ 7978 if(isPrepend){ 7979 target.prepend("<div class='loader'></div>") 7980 }else{ 7981 target.append("<div class='loader'></div>") 7982 } 7983 }, 7984 hide:function(target){ 7985 target.find(".loader").remove(); 7986 } 7987 }, 7988 sideBar:{ 7989 init:function(){ 7990 var subNav= $(".sub-nav-wrapper"); 7991 7992 if (!subNav.hasClass("downloads-wrapper")) { 7993 updateSubnavWidth(); 7994 7995 function updateSubnavWidth() { 7996 7997 if ($(window).width() > 768) { 7998 7999 8000 var subNavWidth = $(".sub-nav-wrapper").width(); 8001 8002 if (subNavWidth > 0) { 8003 subNav.attr('initial-width', subNavWidth) 8004 subNav.css('width', subNavWidth + 'px') 8005 8006 } 8007 8008 8009 } else { 8010 subNav.css('width', '100%') 8011 } 8012 8013 } 8014 8015 function updateSubnavWidthOnResize() { 8016 8017 if ($(window).width() > 768) { 8018 8019 if (subNav.hasClass("sticky")) { 8020 var subNavWidth = $(".sub-nav-wrapper").width(); 8021 subNav.attr('initial-width', subNavWidth) 8022 subNav.css('width', subNavWidth + 'px') 8023 } else { 8024 subNav.css('width', '100%') 8025 } 8026 8027 8028 8029 8030 } else { 8031 subNav.css('width', '100%') 8032 } 8033 8034 } 8035 8036 $(window).resize(function(){ 8037 8038 if(window.innerWidth >960 && subNav.length>0){ 8039 subNav.css({"position":"initial"}) 8040 } 8041 8042 8043 updateSubnavWidthOnResize() 8044 }) 8045 if(subNav.length > 0 ){ 8046 8047 8048 var lastSt = 0 ; 8049 8050 $(window).scroll(function(e){ 8051 var st = $(window).scrollTop(); 8052 var headerHeight = $(".menu-bar").innerHeight(); 8053 8054 if ($(".course-tabs.sticky").length) { 8055 headerHeight += ($(".course-tabs.sticky").innerHeight() + 10);
8056 console.log(headerHeight); 8057 } 8058 8059 var winPos = st+headerHeight; 8060 if(window.innerWidth >960){ 8061 8062 subNav.each(function(index){ 8063 var pos; 8064 if( $(this).closest(".sf_cols").length>0){ 8065 pos = $(this).closest(".sf_cols").offset().top; 8066 }else{ 8067 pos = $(this).parent().offset().top; 8068 } 8069 8070 if($(this).closest(".tab-content.hide").length>0)return; 8071 8072 var subNavBot = $(this).offset().top + $(this).innerHeight(); 8073 8074 if(st<lastSt && st+headerHeight<$(this).offset().top){ 8075 if(winPos > pos){ 8076 $(this).css({"position":"fixed","top":`${headerHeight}px`}) 8077 8078 8079 $(this).addClass("sticky") 8080 8081 8082 }else{ 8083 $(this).css({"position":"initial","top":"0px"}) 8084 8085 $(this).removeClass("sticky") 8086 8087 } 8088 8089 } 8090 8091 if(subNavBot >= $("footer").offset().top || $(this).css("position")==="absolute"){ 8092 $(this).css({"position":"absolute","top":`${$(this).offset().top}px`}) 8093 if($(this).offset().top + $(this).innerHeight() > $("footer").offset().top){ 8094 var maxPos = $("footer").offset().top - $(this).innerHeight() -20; 8095 8096 $(this).css({"top":`${maxPos}px`}) 8097 } 8098 8099 $(this).addClass("sticky") 8100 8101 }else if(winPos > pos){ 8102 $(this).css({"position":"fixed","top":`${headerHeight}px`}) 8103 8104 $(this).addClass("sticky") 8105 8106 }else{ 8107 $(this).css({"position":"relative","top":"0px"}) 8108 8109 $(this).removeClass("sticky") 8110 8111 8112 } 8113 8114 8115 8116 }) 8117 8118 } 8119 8120 8121 lastSt = st; 8122 }) 8123 } 8124 } 8125 8126 8127 } 8128 } 8129 8130 8131} 8132$(document).ready(function(){ 8133 8134 wpContent.init() 8135 if(window.scrollY === 0){ 8136 $('.course-tabs').removeClass('sticky'); 8137 } 8138 else{ 8139 console.log(window.scrollY); 8140 } 8141}); 8142})(jq14);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.