bổ sung jquery để thay thế dupral_js
This commit is contained in:
+13862
-14
File diff suppressed because one or more lines are too long
+1
-1
@@ -19,7 +19,7 @@ if(window.jQuery)jQuery.noConflict();document.documentElement.className+=' js';(
|
|||||||
window.cookieconsent_options={message:drupalSettings.cookieconsent.message,dismiss:drupalSettings.cookieconsent.dismiss,learnMore:drupalSettings.cookieconsent.learnMore,link:drupalSettings.cookieconsent.link,container:drupalSettings.cookieconsent.container,theme:drupalSettings.cookieconsent.theme,path:drupalSettings.cookieconsent.path,domain:drupalSettings.cookieconsent.domain,expiryDays:drupalSettings.cookieconsent.expiry,target:drupalSettings.cookieconsent.target,markup:['<div class="cc_banner-wrapper {{containerClasses}}">',drupalSettings.cookieconsent.markup,'</div>']};;
|
window.cookieconsent_options={message:drupalSettings.cookieconsent.message,dismiss:drupalSettings.cookieconsent.dismiss,learnMore:drupalSettings.cookieconsent.learnMore,link:drupalSettings.cookieconsent.link,container:drupalSettings.cookieconsent.container,theme:drupalSettings.cookieconsent.theme,path:drupalSettings.cookieconsent.path,domain:drupalSettings.cookieconsent.domain,expiryDays:drupalSettings.cookieconsent.expiry,target:drupalSettings.cookieconsent.target,markup:['<div class="cc_banner-wrapper {{containerClasses}}">',drupalSettings.cookieconsent.markup,'</div>']};;
|
||||||
(function(Drupal,$,once){'use strict';Drupal.behaviors.headerSearch={attach(context){once('header-search','#search-drawer-trigger, #search-drawer-trigger-active',context).forEach((trigger)=>{$(trigger).on('click',function(){$('#search-flyout-container').slideToggle(300);$('.homepage [data-component-id="umass_base:tophat"]').toggleClass('search-active');$('[data-component-id="umass_base:site-header"]').toggleClass('search-active');$('#search-drawer-trigger').toggleClass('active');});});}};}(Drupal,jQuery,once));;
|
(function(Drupal,$,once){'use strict';Drupal.behaviors.headerSearch={attach(context){once('header-search','#search-drawer-trigger, #search-drawer-trigger-active',context).forEach((trigger)=>{$(trigger).on('click',function(){$('#search-flyout-container').slideToggle(300);$('.homepage [data-component-id="umass_base:tophat"]').toggleClass('search-active');$('[data-component-id="umass_base:site-header"]').toggleClass('search-active');$('#search-drawer-trigger').toggleClass('active');});});}};}(Drupal,jQuery,once));;
|
||||||
(function(Drupal,$,once){'use strict';window.DP=window.DP||window.Drupal||{};window.DP.behaviors=window.DP.behaviors||{};var playerData=[];var addScriptTag=function addScriptTag(){var firstScriptTag=document.getElementsByTagName('script')[0];if(typeof YT==='undefined'||typeof YT.Player==='undefined'){var YTtag=document.createElement('script');YTtag.src='//www.youtube.com/iframe_api';YTtag.id='youtube-iframe-api';firstScriptTag.parentNode.insertBefore(YTtag,firstScriptTag);}};var initYoutubeApi=function initYoutubeApi(){addScriptTag();window.onYouTubeIframeAPIReady=function(){for(var i=0;i<playerData.length;i+=1)playerData[i].player=new YT.Player(playerData[i].id,{events:{onReady:playerData[i].onReady,onStateChange:playerData[i].onStateChange}});};};window.DP.youtubeApiAddPlayer=function youtubeApiAddPlayer(frameID,onReady,onStateChange){playerData.push({id:frameID,onReady,onStateChange,player:null});};window.DP.youtubeApiGetPlayer=function youtubeApiGetPlayer(frameID){for(var i=0;i<playerData.length;i+=1)if(playerData[i].id===frameID)return playerData[i].player;};window.DP.behaviors.youtubeApiBootstap={attach:function(context){$(once('youtubeApiBootstrap','body',context)).each(function(){initYoutubeApi.apply(this);});}};}(Drupal,jQuery,once));;
|
(function(Drupal,$,once){'use strict';window.DP=window.DP||window.Drupal||{};window.DP.behaviors=window.DP.behaviors||{};var playerData=[];var addScriptTag=function addScriptTag(){var firstScriptTag=document.getElementsByTagName('script')[0];if(typeof YT==='undefined'||typeof YT.Player==='undefined'){var YTtag=document.createElement('script');YTtag.src='//www.youtube.com/iframe_api';YTtag.id='youtube-iframe-api';firstScriptTag.parentNode.insertBefore(YTtag,firstScriptTag);}};var initYoutubeApi=function initYoutubeApi(){addScriptTag();window.onYouTubeIframeAPIReady=function(){for(var i=0;i<playerData.length;i+=1)playerData[i].player=new YT.Player(playerData[i].id,{events:{onReady:playerData[i].onReady,onStateChange:playerData[i].onStateChange}});};};window.DP.youtubeApiAddPlayer=function youtubeApiAddPlayer(frameID,onReady,onStateChange){playerData.push({id:frameID,onReady,onStateChange,player:null});};window.DP.youtubeApiGetPlayer=function youtubeApiGetPlayer(frameID){for(var i=0;i<playerData.length;i+=1)if(playerData[i].id===frameID)return playerData[i].player;};window.DP.behaviors.youtubeApiBootstap={attach:function(context){$(once('youtubeApiBootstrap','body',context)).each(function(){initYoutubeApi.apply(this);});}};}(Drupal,jQuery,once));;
|
||||||
(function(window,$,Drupal){'use strict';window.DP=window.DP||window.Drupal||{};window.DP.behaviors=window.DP.behaviors||{};if(window.DP._behaviorBootstrapAttached)return;window.DP._behaviorBootstrapAttached=true;Drupal.behaviors.dpBehaviorBootstrap={attach:function(context){if(context!==document)return;$.each(window.DP.behaviors,function(key,behavior){if(behavior&&typeof behavior.attach==='function')behavior.attach(document);});}};}(window,jQuery,Drupal));;
|
(function(window,$,Drupal){'use strict';window.DP=window.DP||window.Drupal||{};window.DP.behaviors=window.DP.behaviors||{};if(window.DP._behaviorBootstrapAttached)return;window.DP._behaviorBootstrapAttached=true;Drupal.behaviors.dpBehaviorBootstrap={attach:function(context){if(context!==document)return;$.each(window.DP.behaviors,function(key,behavior){if(key!=='dpBehaviorBootstrap'&&behavior&&typeof behavior.attach==='function')behavior.attach(document);});}};}(window,jQuery,Drupal));;
|
||||||
(function(Drupal,$,once){'use strict';var initMediaEmbed=function(){var self=this;var $mediaContainer=$('.f--video-embed',self);var iframe=$mediaContainer.find('iframe');var $playButton=$('.button-play',self);var $exitMedia=$('.exit-media',self);if(iframe.length){var frameID=$(iframe).attr('id');iframe.attr('tabindex','-1');iframe.attr('aria-hidden','true');if(typeof frameID==='undefined'){frameID='media-'+Math.random().toString(36).substr(2,9);$(iframe).attr('id',frameID);}$(once('enableJS',iframe,$mediaContainer)).each(function(){var iframeSrc=$(this).attr('src');if(iframeSrc.indexOf('enablejsapi')<=0)$(this).attr('src',iframeSrc+'?enablejsapi=1');});$playButton.on('click',function(e){e.preventDefault();var player=window.DP.youtubeApiGetPlayer(frameID);var $mediaContainer=$(this).closest('.media-container');if(player&&typeof player.playVideo==='function')player.playVideo();$mediaContainer.addClass('show');iframe.attr('tabindex','0');iframe.attr('aria-hidden','false');});$exitMedia.on('click',function(){var player=window.DP.youtubeApiGetPlayer(frameID);player.pauseVideo();$mediaContainer.closest('.media-container').removeClass('show');iframe.attr('tabindex','-1');iframe.attr('aria-hidden','true');});window.DP.youtubeApiAddPlayer(frameID);}};window.DP.behaviors.mediaEmbed={attach:function(context){if(context===document)$(once('mediaEmbed','.cc--media-with-text, .cc--hero-article-media, .cc--media-full-width',context)).each(function(){initMediaEmbed.apply(this);});}};}(Drupal,jQuery,once));;
|
(function(Drupal,$,once){'use strict';var initMediaEmbed=function(){var self=this;var $mediaContainer=$('.f--video-embed',self);var iframe=$mediaContainer.find('iframe');var $playButton=$('.button-play',self);var $exitMedia=$('.exit-media',self);if(iframe.length){var frameID=$(iframe).attr('id');iframe.attr('tabindex','-1');iframe.attr('aria-hidden','true');if(typeof frameID==='undefined'){frameID='media-'+Math.random().toString(36).substr(2,9);$(iframe).attr('id',frameID);}$(once('enableJS',iframe,$mediaContainer)).each(function(){var iframeSrc=$(this).attr('src');if(iframeSrc.indexOf('enablejsapi')<=0)$(this).attr('src',iframeSrc+'?enablejsapi=1');});$playButton.on('click',function(e){e.preventDefault();var player=window.DP.youtubeApiGetPlayer(frameID);var $mediaContainer=$(this).closest('.media-container');if(player&&typeof player.playVideo==='function')player.playVideo();$mediaContainer.addClass('show');iframe.attr('tabindex','0');iframe.attr('aria-hidden','false');});$exitMedia.on('click',function(){var player=window.DP.youtubeApiGetPlayer(frameID);player.pauseVideo();$mediaContainer.closest('.media-container').removeClass('show');iframe.attr('tabindex','-1');iframe.attr('aria-hidden','true');});window.DP.youtubeApiAddPlayer(frameID);}};window.DP.behaviors.mediaEmbed={attach:function(context){if(context===document)$(once('mediaEmbed','.cc--media-with-text, .cc--hero-article-media, .cc--media-full-width',context)).each(function(){initMediaEmbed.apply(this);});}};}(Drupal,jQuery,once));;
|
||||||
(function(Drupal,$,once){'use strict';Drupal.behaviors.siteHeader={attach(context){once('site-header-hamburger','#mobile-hamburger',context).forEach((trigger)=>{$(trigger).on('click',function(){$(this).toggleClass('is-active');$('section[data-component-id="umass_base:site-header"]').toggleClass('mobile-menu-active');$('#mobile-flyout-container').slideToggle(300);});});once('site-header-arrow','#mobile-flyout-container .arrow-toggle',context).forEach((toggle)=>{$(toggle).on('click',function(){$(this).toggleClass('is-active');$(this).parent().next().slideToggle(300);});});}};}(Drupal,jQuery,once));;
|
(function(Drupal,$,once){'use strict';Drupal.behaviors.siteHeader={attach(context){once('site-header-hamburger','#mobile-hamburger',context).forEach((trigger)=>{$(trigger).on('click',function(){$(this).toggleClass('is-active');$('section[data-component-id="umass_base:site-header"]').toggleClass('mobile-menu-active');$('#mobile-flyout-container').slideToggle(300);});});once('site-header-arrow','#mobile-flyout-container .arrow-toggle',context).forEach((toggle)=>{$(toggle).on('click',function(){$(this).toggleClass('is-active');$(this).parent().next().slideToggle(300);});});}};}(Drupal,jQuery,once));;
|
||||||
(function(Drupal,$,once){'use strict';Drupal.behaviors.tophat={attach(context){once('tophat-hamburger','#tophat-hamburger',context).forEach((trigger)=>{$(trigger).on('click',function(){$(this).toggleClass('is-active');$('#tophat-flyout-container').slideToggle(300);$('div[data-component-id="umass_base:tophat"]').toggleClass('tophat-active');});});}};}(Drupal,jQuery,once));;
|
(function(Drupal,$,once){'use strict';Drupal.behaviors.tophat={attach(context){once('tophat-hamburger','#tophat-hamburger',context).forEach((trigger)=>{$(trigger).on('click',function(){$(this).toggleClass('is-active');$('#tophat-flyout-container').slideToggle(300);$('div[data-component-id="umass_base:tophat"]').toggleClass('tophat-active');});});}};}(Drupal,jQuery,once));;
|
||||||
|
|||||||
@@ -0,0 +1,129 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
// 1. Header Search Toggle
|
||||||
|
$('#search-drawer-trigger, #search-drawer-trigger-active').on('click', function() {
|
||||||
|
$('#search-flyout-container').slideToggle(300);
|
||||||
|
$('.homepage [data-component-id="umass_base:tophat"]').toggleClass('search-active');
|
||||||
|
$('[data-component-id="umass_base:site-header"]').toggleClass('search-active');
|
||||||
|
$('#search-drawer-trigger').toggleClass('active');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2. Site Header Hamburger
|
||||||
|
$('#mobile-hamburger').on('click', function() {
|
||||||
|
$(this).toggleClass('is-active');
|
||||||
|
$('section[data-component-id="umass_base:site-header"]').toggleClass('mobile-menu-active');
|
||||||
|
$('#mobile-flyout-container').slideToggle(300);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3. Site Header Arrow Toggle (Mobile Menu Submenus)
|
||||||
|
$('#mobile-flyout-container .arrow-toggle').on('click', function() {
|
||||||
|
$(this).toggleClass('is-active');
|
||||||
|
$(this).parent().next().slideToggle(300);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 4. Tophat Hamburger Toggle
|
||||||
|
$('#tophat-hamburger').on('click', function() {
|
||||||
|
$(this).toggleClass('is-active');
|
||||||
|
$('#tophat-flyout-container').slideToggle(300);
|
||||||
|
$('div[data-component-id="umass_base:tophat"]').toggleClass('tophat-active');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 5. Microsite Menu
|
||||||
|
var $micrositeMenu = $('.cc--menu-microsite');
|
||||||
|
if ($micrositeMenu.length) {
|
||||||
|
var $toggle = $('.menu-microsite-toggle');
|
||||||
|
var $arrowToggles = $micrositeMenu.find('.arrow-toggle');
|
||||||
|
var $subMenus = $micrositeMenu.find('.submenu-wrapper');
|
||||||
|
var $backButtons = $micrositeMenu.find('.button-back');
|
||||||
|
|
||||||
|
$toggle.on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$('html, body').animate({scrollTop: $('.cc--menu-microsite').offset().top}, 200);
|
||||||
|
|
||||||
|
var el = this;
|
||||||
|
setTimeout(function() {
|
||||||
|
var $menuWrapper = $('.menu-microsite-menu-wrapper');
|
||||||
|
$menuWrapper.removeAttr('style');
|
||||||
|
var $menuHeight = $menuWrapper.height();
|
||||||
|
var $toggleHeight = $('.menu-microsite-toggle').height();
|
||||||
|
var $menuTopOffset = $micrositeMenu.offset().top - $(window).scrollTop();
|
||||||
|
|
||||||
|
$menuWrapper.height($menuHeight - $menuTopOffset - $toggleHeight);
|
||||||
|
$menuWrapper.css('top', $menuTopOffset + $toggleHeight);
|
||||||
|
|
||||||
|
$('body').toggleClass('microsite-menu-is-active');
|
||||||
|
$('.content-main').toggleClass('menu-open');
|
||||||
|
$micrositeMenu.toggleClass('is-active');
|
||||||
|
$(el).toggleClass('is-active');
|
||||||
|
}, 200);
|
||||||
|
});
|
||||||
|
|
||||||
|
$arrowToggles.on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var $subMenu = $(this).closest('.menu-item').find('.submenu-wrapper').first();
|
||||||
|
$subMenu.show().removeClass('is-hidden').addClass('is-visible');
|
||||||
|
$micrositeMenu.addClass('is-hidden');
|
||||||
|
|
||||||
|
if ($(this).closest('.submenu-wrapper').hasClass('is-visible')) {
|
||||||
|
var $thisWrapper = $(this).closest('.submenu-wrapper');
|
||||||
|
setTimeout(function() {
|
||||||
|
$thisWrapper.addClass('second-level-hidden');
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$backButtons.on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var $this = $(this);
|
||||||
|
setTimeout(function() {
|
||||||
|
$this.closest('.submenu-wrapper').removeClass('is-visible');
|
||||||
|
}, 300);
|
||||||
|
|
||||||
|
if ($this.closest('.submenu-wrapper').hasClass('second-level-hidden')) {
|
||||||
|
$this.closest('.second-level-hidden').removeClass('second-level-hidden');
|
||||||
|
$this.parents('.submenu-wrapper.is-visible').first().removeClass('is-visible');
|
||||||
|
} else {
|
||||||
|
$this.closest('.submenu-wrapper').removeClass('is-hidden').removeClass('is-visible');
|
||||||
|
$micrositeMenu.removeClass('is-hidden');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. Sidebar Nav
|
||||||
|
var $navTitle = $('.cc--menu-left-nav .f--section-title h2, .cc--chaptered-nav .f--section-title h2');
|
||||||
|
$navTitle.on('click', function() {
|
||||||
|
if (window.matchMedia('(max-width: 1023px)').matches) {
|
||||||
|
var $this = $(this);
|
||||||
|
var $target = $this.parent().next();
|
||||||
|
if ($this.hasClass('open')) {
|
||||||
|
$this.removeClass('open');
|
||||||
|
$target.removeClass('active').slideUp(250);
|
||||||
|
} else {
|
||||||
|
$this.addClass('open');
|
||||||
|
$target.addClass('active').slideDown(250);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 7. Video Embed Toggle
|
||||||
|
$('.cc--media-with-text, .cc--hero-article-media, .cc--media-full-width').each(function() {
|
||||||
|
var $mediaContainer = $('.f--video-embed', this);
|
||||||
|
var $iframe = $mediaContainer.find('iframe');
|
||||||
|
var $playButton = $('.button-play', this);
|
||||||
|
var $exitMedia = $('.exit-media', this);
|
||||||
|
if ($iframe.length) {
|
||||||
|
var iframeSrc = $iframe.attr('src');
|
||||||
|
if (iframeSrc && iframeSrc.indexOf('enablejsapi') <= 0) {
|
||||||
|
$iframe.attr('src', iframeSrc + (iframeSrc.indexOf('?') > -1 ? '&' : '?') + 'enablejsapi=1');
|
||||||
|
}
|
||||||
|
$playButton.on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$(this).closest('.media-container').addClass('show');
|
||||||
|
$iframe[0].contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
|
||||||
|
});
|
||||||
|
$exitMedia.on('click', function() {
|
||||||
|
$(this).closest('.media-container').removeClass('show');
|
||||||
|
$iframe[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -14,9 +14,7 @@
|
|||||||
<script th:src="@{/flex-finish/lazysizes.min.js.download}"></script>
|
<script th:src="@{/flex-finish/lazysizes.min.js.download}"></script>
|
||||||
<script th:src="@{/flex-finish/iframe_api}"></script>
|
<script th:src="@{/flex-finish/iframe_api}"></script>
|
||||||
<script th:src="@{/flex-finish/www-widgetapi.js.download}"></script>
|
<script th:src="@{/flex-finish/www-widgetapi.js.download}"></script>
|
||||||
<script th:src="@{/flex-finish/js_Isp7h6FCXCjThDOnuvUMkKL6OTS1TFPRa8cj335OS78.js.download}"></script>
|
<script th:src="@{/js/custom-umass.js}"></script>
|
||||||
<script th:src="@{/flex-finish/js_JCi_juuOKmHD4jLfBeiPIEOsjGJaUI5Ql2UHefzU3E0.js.download}"></script>
|
|
||||||
<script th:src="@{/flex-finish/js_aQtUyeGxehNR84AlGzGB1VfMu1Wn3lqHxvL8rocj1EU.js.download}"></script>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body> <!-- Tất cả nội dung ruột của trang Flex Finish sẽ nằm trong thẻ main này -->
|
<body> <!-- Tất cả nội dung ruột của trang Flex Finish sẽ nằm trong thẻ main này -->
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* CSS override for SIS Vietnam custom logo aspect ratio */
|
/* CSS override for SIS Vietnam custom logo aspect ratio */
|
||||||
[data-component-id="umass_base:header-branding"] img,
|
/* [data-component-id="umass_base:header-branding"] img,
|
||||||
.tophat-logo img {
|
.tophat-logo img {
|
||||||
height: 45px !important;
|
height: 45px !important;
|
||||||
width: auto !important;
|
width: auto !important;
|
||||||
@@ -26,6 +26,30 @@
|
|||||||
height: 65px !important;
|
height: 65px !important;
|
||||||
width: auto !important;
|
width: auto !important;
|
||||||
}
|
}
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* Fix logo visibility on dark background with Glow effect */
|
||||||
|
[data-component-id="umass_base:header-branding"] {
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
left: 20px;
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-component-id="umass_base:site-header"] {
|
||||||
|
justify-content: flex-end !important;
|
||||||
|
position: relative;
|
||||||
|
/* ensure absolute logo is relative to header if needed, though usually fixed to top */
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-component-id="umass_base:header-branding"] img {
|
||||||
|
filter: drop-shadow(0px 0px 10px rgba(255, 255, 255, 0.9)) drop-shadow(0px 0px 20px rgba(255, 255, 255, 0.7));
|
||||||
|
transition: filter 0.3s ease, transform 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-component-id="umass_base:header-branding"] a:hover img {
|
||||||
|
transform: scale(1.05);
|
||||||
|
filter: drop-shadow(0px 0px 15px rgba(255, 255, 255, 1)) drop-shadow(0px 0px 30px rgba(255, 255, 255, 0.9));
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user