first commit

This commit is contained in:
2020-06-08 23:57:36 +02:00
commit 6277454f7a
16057 changed files with 1715382 additions and 0 deletions
@@ -0,0 +1,12 @@
WHAT IS THIS DIRECTORY FOR?
--------------------------------
This directory is for JS files previously inherited from the Classy theme.
WHY ARE CLASSY JS FILES BEING COPIED HERE?
-------------------------------------------
Classy will be deprecated during the Drupal 9 lifecycle. To prepare for Classy's
removal, JS files that would otherwise be inherited from Classy are copied
here.
JS files that differ from the Classy versions should not be placed in this
directory or any subdirectory.
@@ -0,0 +1,22 @@
/**
* @file
* Classy theme overrides for the Media Embed CKEditor plugin.
*/
(Drupal => {
/**
* Themes the error displayed when the media embed preview fails.
*
* @param {string} error
* The error message to display
*
* @return {string}
* A string representing a DOM fragment.
*
* @see media-embed-error.html.twig
*/
Drupal.theme.mediaEmbedPreviewError = () =>
`<div class="media-embed-error media-embed-error--preview-error">${Drupal.t(
'An error occurred while trying to preview the media. Please save your work and reload this page.',
)}</div>`;
})(Drupal);
@@ -0,0 +1,12 @@
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function (Drupal) {
Drupal.theme.mediaEmbedPreviewError = function () {
return '<div class="media-embed-error media-embed-error--preview-error">' + Drupal.t('An error occurred while trying to preview the media. Please save your work and reload this page.') + '</div>';
};
})(Drupal);
@@ -0,0 +1,29 @@
(function() {
function findActiveStep(steps) {
for (let i = 0; i < steps.length; i++) {
if (steps[i].className === 'is-active') {
return i + 1;
}
}
// The final "Finished" step is never "active".
if (steps[steps.length - 1].className === 'done') {
return steps.length;
}
return 0;
}
function installStepsSetup() {
const steps = document.querySelectorAll('.task-list li');
if (steps.length) {
const header = document.querySelector('header[role="banner"]');
const stepIndicator = document.createElement('div');
stepIndicator.className = 'step-indicator';
stepIndicator.innerHTML = `${findActiveStep(steps)}/${steps.length}`;
header.appendChild(stepIndicator);
}
}
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', installStepsSetup);
}
})();
@@ -0,0 +1,36 @@
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function () {
function findActiveStep(steps) {
for (var i = 0; i < steps.length; i++) {
if (steps[i].className === 'is-active') {
return i + 1;
}
}
if (steps[steps.length - 1].className === 'done') {
return steps.length;
}
return 0;
}
function installStepsSetup() {
var steps = document.querySelectorAll('.task-list li');
if (steps.length) {
var header = document.querySelector('header[role="banner"]');
var stepIndicator = document.createElement('div');
stepIndicator.className = 'step-indicator';
stepIndicator.innerHTML = findActiveStep(steps) + '/' + steps.length;
header.appendChild(stepIndicator);
}
}
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', installStepsSetup);
}
})();
+54
View File
@@ -0,0 +1,54 @@
/**
* @file
* Responsive navigation tabs.
*
* This also supports collapsible navigable is the 'is-collapsible' class is
* added to the main element, and a target element is included.
*/
(function($, Drupal) {
function init(i, tab) {
const $tab = $(tab);
const $target = $tab.find('[data-drupal-nav-tabs-target]');
const isCollapsible = $tab.hasClass('is-collapsible');
function openMenu(e) {
$target.toggleClass('is-open');
}
function handleResize(e) {
$tab.addClass('is-horizontal');
const $tabs = $tab.find('.tabs');
const isHorizontal =
$tabs.outerHeight() <= $tabs.find('.tabs__tab').outerHeight();
$tab.toggleClass('is-horizontal', isHorizontal);
if (isCollapsible) {
$tab.toggleClass('is-collapse-enabled', !isHorizontal);
}
if (isHorizontal) {
$target.removeClass('is-open');
}
}
$tab.addClass('position-container is-horizontal-enabled');
$tab.on('click.tabs', '[data-drupal-nav-tabs-trigger]', openMenu);
$(window)
.on('resize.tabs', Drupal.debounce(handleResize, 150))
.trigger('resize.tabs');
}
/**
* Initialize the tabs JS.
*/
Drupal.behaviors.navTabs = {
attach(context, settings) {
const $tabs = $(context).find('[data-drupal-nav-tabs]');
if ($tabs.length) {
const notSmartPhone = window.matchMedia('(min-width: 300px)');
if (notSmartPhone.matches) {
$tabs.once('nav-tabs').each(init);
}
}
},
};
})(jQuery, Drupal);
+48
View File
@@ -0,0 +1,48 @@
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal) {
function init(i, tab) {
var $tab = $(tab);
var $target = $tab.find('[data-drupal-nav-tabs-target]');
var isCollapsible = $tab.hasClass('is-collapsible');
function openMenu(e) {
$target.toggleClass('is-open');
}
function handleResize(e) {
$tab.addClass('is-horizontal');
var $tabs = $tab.find('.tabs');
var isHorizontal = $tabs.outerHeight() <= $tabs.find('.tabs__tab').outerHeight();
$tab.toggleClass('is-horizontal', isHorizontal);
if (isCollapsible) {
$tab.toggleClass('is-collapse-enabled', !isHorizontal);
}
if (isHorizontal) {
$target.removeClass('is-open');
}
}
$tab.addClass('position-container is-horizontal-enabled');
$tab.on('click.tabs', '[data-drupal-nav-tabs-trigger]', openMenu);
$(window).on('resize.tabs', Drupal.debounce(handleResize, 150)).trigger('resize.tabs');
}
Drupal.behaviors.navTabs = {
attach: function attach(context, settings) {
var $tabs = $(context).find('[data-drupal-nav-tabs]');
if ($tabs.length) {
var notSmartPhone = window.matchMedia('(min-width: 300px)');
if (notSmartPhone.matches) {
$tabs.once('nav-tabs').each(init);
}
}
}
};
})(jQuery, Drupal);
@@ -0,0 +1,52 @@
/**
* @file
* Provides responsive behaviors to HTML details elements.
*/
(function($, Drupal) {
/**
* Initializes the responsive behaviors for details elements.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches the responsive behavior to status report specific details elements.
*/
Drupal.behaviors.responsiveDetails = {
attach(context) {
const $details = $(context)
.find('details')
.once('responsive-details');
if (!$details.length) {
return;
}
const $summaries = $details.find('> summary');
function detailsToggle(matches) {
if (matches) {
$details.attr('open', true);
$summaries.attr('aria-expanded', true);
$summaries.on('click.details-open', false);
} else {
// If user explicitly opened one, leave it alone.
const $notPressed = $details
.find('> summary[aria-pressed!=true]')
.attr('aria-expanded', false);
$notPressed.parent('details').attr('open', false);
// After resize, allow user to close previously opened details.
$summaries.off('.details-open');
}
}
function handleDetailsMQ(event) {
detailsToggle(event.matches);
}
const mql = window.matchMedia('(min-width:48em)');
mql.addListener(handleDetailsMQ);
detailsToggle(mql.matches);
},
};
})(jQuery, Drupal);
@@ -0,0 +1,41 @@
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal) {
Drupal.behaviors.responsiveDetails = {
attach: function attach(context) {
var $details = $(context).find('details').once('responsive-details');
if (!$details.length) {
return;
}
var $summaries = $details.find('> summary');
function detailsToggle(matches) {
if (matches) {
$details.attr('open', true);
$summaries.attr('aria-expanded', true);
$summaries.on('click.details-open', false);
} else {
var $notPressed = $details.find('> summary[aria-pressed!=true]').attr('aria-expanded', false);
$notPressed.parent('details').attr('open', false);
$summaries.off('.details-open');
}
}
function handleDetailsMQ(event) {
detailsToggle(event.matches);
}
var mql = window.matchMedia('(min-width:48em)');
mql.addListener(handleDetailsMQ);
detailsToggle(mql.matches);
}
};
})(jQuery, Drupal);