Skip to content
Snippets Groups Projects
Commit 067e0b24 authored by wodby's avatar wodby
Browse files

csfix run

parent c769d8c5
No related branches found
No related tags found
1 merge request!54Feature/istwcms 4790 ebremner tabs links
Showing
with 6478 additions and 4672 deletions
This diff is collapsed.
/**
* @file
*/
var comments = { var comments = {
"comments" : [ "comments" : [
{ {
......
/**
* @file
*/
(function ($, Drupal) { (function ($, Drupal) {
Drupal.behaviors.expandcollapse = { Drupal.behaviors.expandcollapse = {
attach: function (context, settings) { attach: function (context, settings) {
......
/**
* @file
*/
(function ($, Drupal) { (function ($, Drupal) {
Drupal.behaviors.factfigure = { Drupal.behaviors.factfigure = {
attach: function (context, settings) { attach: function (context, settings) {
......
/**
* @file
*/
(function ($, Drupal) { (function ($, Drupal) {
Drupal.behaviors.imagegallery = { Drupal.behaviors.imagegallery = {
attach: function (context, settings) { attach: function (context, settings) {
......
/**
* @file
*/
(function ($, Drupal) { (function ($, Drupal) {
Drupal.behaviors.menuhorizontal = { Drupal.behaviors.menuhorizontal = {
attach: function (context, settings) { attach: function (context, settings) {
// uw-horizontal-nav // uw-horizontal-nav.
$(document).ready(function () { $(document).ready(function () {
// Have to add the run this code only once, so that multiple // Have to add the run this code only once, so that multiple
// loads of the menu are not shown when logged in. // loads of the menu are not shown when logged in.
$(document, context).once('menuhorizontal').each( function () { $(document, context).once('menuhorizontal').each(function () {
const toggle = document.querySelector(".uw-navigation-button"); const toggle = document.querySelector(".uw-navigation-button");
const navHeader = document.querySelector(".uw-header__navigation"); const navHeader = document.querySelector(".uw-header__navigation");
...@@ -22,7 +26,8 @@ ...@@ -22,7 +26,8 @@
navHeader.classList.remove('open'); navHeader.classList.remove('open');
navHeader.classList.add('close'); navHeader.classList.add('close');
$('html').removeClass('no-scroll'); $('html').removeClass('no-scroll');
} else { }
else {
this.classList.add('active'); this.classList.add('active');
this.setAttribute('aria-expanded', 'true'); this.setAttribute('aria-expanded', 'true');
navHeader.classList.remove('close'); navHeader.classList.remove('close');
...@@ -49,31 +54,33 @@ ...@@ -49,31 +54,33 @@
this.setAttribute('aria-expanded', 'false'); this.setAttribute('aria-expanded', 'false');
} }
// If hamburger // If hamburger.
if (screenWidth <= 767) { if (screenWidth <= 767) {
// Look at parents and reset the menus // Look at parents and reset the menus.
if (parent.classList.contains('uw-horizontal-nav--secondary')) { if (parent.classList.contains('uw-horizontal-nav--secondary')) {
$('.uw-horizontal-nav--main').css('display', 'block'); $('.uw-horizontal-nav--main').css('display', 'block');
} }
} }
} else if ($('.submenu-active')) { }
else if ($('.submenu-active')) {
// Get elements with .submnenu-active than close them, // Get elements with .submnenu-active than close them,.
$('.submenu-active').removeClass('submenu-active').attr('aria-expanded', 'false'); $('.submenu-active').removeClass('submenu-active').attr('aria-expanded', 'false');
// and open this one. // And open this one.
this.classList.add("submenu-active"); this.classList.add("submenu-active");
this.setAttribute('aria-expanded', 'true'); this.setAttribute('aria-expanded', 'true');
// If hamburger // If hamburger.
if (screenWidth <= 767) { if (screenWidth <= 767) {
// Look at parents and hide other menus if not secondary and open // Look at parents and hide other menus if not secondary and open.
if (parent.classList.contains('uw-horizontal-nav--secondary')) { if (parent.classList.contains('uw-horizontal-nav--secondary')) {
$('.uw-horizontal-nav--main').css('display', 'none'); $('.uw-horizontal-nav--main').css('display', 'none');
$('.uw-horizontal-nav--secondary').css('display', 'block'); $('.uw-horizontal-nav--secondary').css('display', 'block');
} }
} }
} else { }
else {
this.classList.add('submenu-active'); this.classList.add('submenu-active');
this.setAttribute('aria-expanded', 'true'); this.setAttribute('aria-expanded', 'true');
} }
...@@ -107,7 +114,7 @@ ...@@ -107,7 +114,7 @@
} }
// Space bar keypress to open close menu // Space bar keypress to open close menu
// keyCode to be deprecated find way to use key // keyCode to be deprecated find way to use key.
}); });
item.addEventListener('keypress', function (e) { item.addEventListener('keypress', function (e) {
if (e.keyCode == 32) { if (e.keyCode == 32) {
...@@ -120,11 +127,11 @@ ...@@ -120,11 +127,11 @@
document.addEventListener("click", closeSubmenu, false); document.addEventListener("click", closeSubmenu, false);
// If Toggle on page Add event listeners on the menu toggle button. // If Toggle on page Add event listeners on the menu toggle button.
if (toggle){ if (toggle) {
toggle.addEventListener("click", toggleMenu, false); toggle.addEventListener("click", toggleMenu, false);
} }
// apply timeout to the to event firing // Apply timeout to the to event firing
// so it fires at end of event. // so it fires at end of event.
function debouncer(func) { function debouncer(func) {
var timeoutID, var timeoutID,
...@@ -142,17 +149,19 @@ ...@@ -142,17 +149,19 @@
// Check the width of the screen and // Check the width of the screen and
// force the button click if wider that 767px. // force the button click if wider that 767px.
function menuCheckWidth() { function menuCheckWidth() {
// Set screenWidth var // Set screenWidth var.
var screenWidth = $(window).width(); var screenWidth = $(window).width();
navHeader.classList.add('close'); navHeader.classList.add('close');
if (screenWidth > 767) { if (screenWidth > 767) {
if ($('html').hasClass('no-scroll')) { if ($('html').hasClass('no-scroll')) {
toggle.click(); toggle.click();
$('.uw-horizontal-nav').css('display', 'block'); $('.uw-horizontal-nav').css('display', 'block');
} else { }
else {
$('.uw-header__navigation').addClass('open'); $('.uw-header__navigation').addClass('open');
} }
} else { }
else {
if ($('.uw-header__navigation').hasClass('open')) { if ($('.uw-header__navigation').hasClass('open')) {
$('.uw-header__navigation').removeClass('open'); $('.uw-header__navigation').removeClass('open');
$('.uw-header__navigation').addClass('close'); $('.uw-header__navigation').addClass('close');
......
/**
* @file
*/
(function ($, Drupal) { (function ($, Drupal) {
Drupal.behaviors.multitypelist = { Drupal.behaviors.multitypelist = {
attach: function (context, settings) { attach: function (context, settings) {
...@@ -10,28 +14,29 @@ ...@@ -10,28 +14,29 @@
return; return;
} }
// Add a click event handler to each tab // Add a click event handler to each tab.
tabs.forEach(tab => { tabs.forEach(tab => {
tab.addEventListener("click", changeTabs); tab.addEventListener("click", changeTabs);
}); });
// Enable arrow navigation between tabs in the tab list // Enable arrow navigation between tabs in the tab list.
let tabFocus = 0; let tabFocus = 0;
tabList.addEventListener("keydown", e => { tabList.addEventListener("keydown", e => {
// Move right // Move right.
if (e.keyCode === 39 || e.keyCode === 37) { if (e.keyCode === 39 || e.keyCode === 37) {
tabs[tabFocus].setAttribute("tabindex", -1); tabs[tabFocus].setAttribute("tabindex", -1);
if (e.keyCode === 39) { if (e.keyCode === 39) {
tabFocus++; tabFocus++;
// If we're at the end, go to the start // If we're at the end, go to the start.
if (tabFocus >= tabs.length) { if (tabFocus >= tabs.length) {
tabFocus = 0; tabFocus = 0;
} }
// Move left // Move left.
} else if (e.keyCode === 37) { }
else if (e.keyCode === 37) {
tabFocus--; tabFocus--;
// If we're at the start, move to the end // If we're at the start, move to the end.
if (tabFocus < 0) { if (tabFocus < 0) {
tabFocus = tabs.length - 1; tabFocus = tabs.length - 1;
} }
...@@ -48,20 +53,20 @@ ...@@ -48,20 +53,20 @@
const parent = target.parentNode; const parent = target.parentNode;
const grandparent = parent.parentNode; const grandparent = parent.parentNode;
// Remove all current selected tabs // Remove all current selected tabs.
parent parent
.querySelectorAll('[aria-selected="true"]') .querySelectorAll('[aria-selected="true"]')
.forEach(t => t.setAttribute("aria-selected", false)); .forEach(t => t.setAttribute("aria-selected", false));
// Set this tab as selected // Set this tab as selected.
target.setAttribute("aria-selected", true); target.setAttribute("aria-selected", true);
// Hide all tab panels // Hide all tab panels.
grandparent grandparent
.querySelectorAll('[role="tabpanel"]') .querySelectorAll('[role="tabpanel"]')
.forEach(p => p.setAttribute("hidden", true)); .forEach(p => p.setAttribute("hidden", true));
// Show the selected panel // Show the selected panel.
grandparent.parentNode grandparent.parentNode
.querySelector(`#${target.getAttribute("aria-controls")}`) .querySelector(`#${target.getAttribute("aria-controls")}`)
.removeAttribute("hidden"); .removeAttribute("hidden");
......
/**
* @file
*/
(function ($, document, Drupal) { (function ($, document, Drupal) {
Drupal.behaviors.wcmsheadersearchbar = { Drupal.behaviors.wcmsheadersearchbar = {
attach: function (context, settings) { attach: function (context, settings) {
......
/**
* @file
*/
(function ($, document, Drupal) { (function ($, document, Drupal) {
Drupal.behaviors.wcmsheadersearch = { Drupal.behaviors.wcmsheadersearch = {
attach: function (context, settings) { attach: function (context, settings) {
...@@ -19,9 +23,9 @@ ...@@ -19,9 +23,9 @@
}, timeout); }, timeout);
}; };
} }
// Check the width of the screen and // Check the width of the screen and.
function checkWidth() { function checkWidth() {
// Set screenWidth var // Set screenWidth var.
var screenWidth = $(window).width(); var screenWidth = $(window).width();
if ($('.uw-header__masthead').hasClass('open')) { if ($('.uw-header__masthead').hasClass('open')) {
......
/**
* @file
*/
(function ($) { (function ($) {
Drupal.behaviors.responsive_menu_combined = { Drupal.behaviors.responsive_menu_combined = {
attach: function (context, settings) { attach: function (context, settings) {
...@@ -18,7 +22,8 @@ ...@@ -18,7 +22,8 @@
$list.hide(); $list.hide();
$('span:first-child',this).html('&#9656;'); $('span:first-child',this).html('&#9656;');
$(this).attr('aria-expanded', 'false'); $(this).attr('aria-expanded', 'false');
} else { }
else {
$list.show(); $list.show();
$('span:first-child',this).html('&#9662;'); $('span:first-child',this).html('&#9662;');
$(this).attr('aria-expanded', 'true'); $(this).attr('aria-expanded', 'true');
......
/** /**
* Ckeditor Modal * @file
* Ckeditor Modal.
*/ */
(function ($, Drupal) { (function ($, Drupal) {
if ($.ui && $.ui.dialog) { if ($.ui && $.ui.dialog) {
orig_allowInteraction = $.ui.dialog.prototype._allowInteraction; orig_allowInteraction = $.ui.dialog.prototype._allowInteraction;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment