Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176
This commit is contained in:
commit
9921556621
13277 changed files with 1459781 additions and 0 deletions
33
core/themes/seven/js/mobile.install.js
Normal file
33
core/themes/seven/js/mobile.install.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
(function () {
|
||||
|
||||
"use strict";
|
||||
|
||||
function findActiveStep(steps) {
|
||||
for (var 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() {
|
||||
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);
|
||||
}
|
||||
|
||||
})();
|
55
core/themes/seven/js/nav-tabs.js
Normal file
55
core/themes/seven/js/nav-tabs.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* @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) {
|
||||
|
||||
"use strict";
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the tabs JS.
|
||||
*/
|
||||
Drupal.behaviors.navTabs = {
|
||||
attach: function (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);
|
Reference in a new issue