* add tons of colors * add tons of colors * moving cheese around and prepping for new theming system * documenting * . * moving theme code to own files * replacing some variables * whitespaces * replacing another batch of variables * get rid of another variable * replace loading animation variable with one-fits-all-sizes * get rid of theme-anchor-color * remove code colors variables * another batch of variables replaced * mostly bringing in variables for haxor theme * remove invert-image variable for chat * remove another inver-image variable * forgot to remove reaction-background variable * remove border variable * series * . * remove another variable * remove another variable.. * another batch of variables * and more... * header updates * i forgot to commits things in my PR.... * fix border * . * simplifyuing placeholder * responsiveness * responsive * search fix * fixing prefix-less classes * increase clickable area * small style updates for pink theme * tests * Fix test * responsive dropdown * tiny fixes * generator rewritten * dropdown reworked a little * adjustments * fix pwa Co-authored-by: rhymes <rhymesete@gmail.com>
59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
function getById(className) {
|
|
return document.getElementById(className);
|
|
}
|
|
function getClassList(className) {
|
|
return getById(className).classList;
|
|
}
|
|
|
|
function blur(event, className) {
|
|
setTimeout(() => {
|
|
if (document.activeElement !== getById(className)) {
|
|
getClassList('top-bar__menu').remove('showing');
|
|
}
|
|
}, 10);
|
|
}
|
|
|
|
function removeShowingMenu() {
|
|
getClassList('top-bar__menu').remove('showing');
|
|
setTimeout(() => {
|
|
getClassList('top-bar__menu').remove('showing');
|
|
}, 5);
|
|
setTimeout(() => {
|
|
getClassList('top-bar__menu').remove('showing');
|
|
}, 150);
|
|
}
|
|
|
|
function toggleMenu() {
|
|
getClassList('top-bar__menu').toggle('showing');
|
|
}
|
|
|
|
function initializeTouchDevice() {
|
|
var isTouchDevice = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|DEV-Native-ios/i.test(
|
|
navigator.userAgent,
|
|
);
|
|
if (navigator.userAgent === 'DEV-Native-ios') {
|
|
document
|
|
.getElementsByTagName('body')[0]
|
|
.classList.add('dev-ios-native-body');
|
|
}
|
|
setTimeout(() => {
|
|
removeShowingMenu();
|
|
if (isTouchDevice) {
|
|
// Use a named function instead of anonymous so duplicate event handlers are discarded
|
|
getById('navigation-butt').addEventListener('click', toggleMenu);
|
|
} else {
|
|
getClassList('top-bar__menu').add('desktop');
|
|
getById('navigation-butt').addEventListener('focus', e =>
|
|
getClassList('top-bar__menu').add('showing'),
|
|
);
|
|
getById('last-nav-link').addEventListener('blur', e =>
|
|
blur(e, 'second-last-nav-link'),
|
|
);
|
|
getById('navigation-butt').addEventListener('blur', e =>
|
|
blur(e, 'first-nav-link'),
|
|
);
|
|
}
|
|
}, 10);
|
|
}
|