Каталог файловtilda-menu-1.1.js
601 menu.style.opacity = diffOpacity.toString();602 diffOpacity = direction === 'toTop' ? diffOpacity - 0.1 : diffOpacity + 0.1;603 diff = direction === 'toTop' ? diff + menuHeight / 20 : diff - menuHeight / 20;604 605 if (direction === 'toTop' && diff >= menuHeight) {606 menu.style.transform = 'translateY(-' + menuHeight + 'px)';607 menu.style.opacity = '0';608 delete menu.dataset.slideState;609 clearInterval(timerID);610 }611 if (direction === 'toBottom' && diff <= 0) {612
История файла и сравнение версий
menu.style.transform = '';
613 menu.style.opacity = '1'; 614 menu.dataset.slideState = 'visible'; 615 clearInterval(timerID); 622 * Interact with menu and submenu from keyboard 623 * @param {string} recid - record ID 626function t_menuBase__interactFromKeyboard(recid) { 627 var rec = document.getElementById('rec' + recid); 629 var menuItems = rec.querySelectorAll('.t-menu__list > li > a'); 630 var submenuItems = rec.querySelectorAll('.t-menu__list > li li'); 639 var menuCurrentIndex = 0; 640 var submenuCurrentIndex; 642 var t_menuBase__focusOnCurrentMenuItem = function (index) { 643 if (index === menuItems.length) { 645 } else if (index < 0) { 646 index = menuItems.length - 1; 648 menuItems[index].focus(); 649 menuCurrentIndex = index; 652 var t_menuBase__focusOnCurrentSubmenuItem = function (menu, index) { 653 var items = menu.querySelectorAll('a'); 654 if (index == items.length) { 656 } else if (index < 0) { 657 index = items.length - 1; 659 items[index].focus(); 660 submenuCurrentIndex = index; 663 var t_menuBase__interactWithMenuFromKeyboard = function (menuItem) { 664 menuItem.addEventListener('keydown', function (event) { 665 var submenu = this.parentNode.querySelector('.t-menusub__list'); 666 switch (event.keyCode) { 668 if (!event.shiftKey && menuCurrentIndex <= menuItems.length - 2) { 669 t_menuBase__focusOnCurrentMenuItem(menuCurrentIndex + 1); 670 } else if (event.shiftKey && menuCurrentIndex > 0) { 671 t_menuBase__focusOnCurrentMenuItem(menuCurrentIndex - 1); 678 if (!submenu) return; 680 submenuCurrentIndex = 0; 681 t_menuBase__focusOnCurrentSubmenuItem(submenu, 0); 684 event.preventDefault(); 688 var t_menuBase__focusOnMenuItem = function (menuItem) { 689 menuItem.addEventListener('focus', function () { 690 submenuCurrentIndex = 0; 694 var t_menuBase__clickOnMenuItem = function (menuItem) { 695 var submenu = menuItem.parentNode.querySelector('.t-menusub__menu'); 696 menuItem.addEventListener('click', function (event) { 697 if (this.getAttribute('aria-expanded') == 'false' || this.getAttribute('aria-expanded') == null) { 698 this.setAttribute('aria-expanded', 'true'); 699 var menusubWrapper = menuItem.nextElementSibling; 700 var marginValue = menusubWrapper ? menusubWrapper.getAttribute('data-submenu-margin') : 0;