forked from treehouse/mastodon
Merge commit 'bb51c0676d0cf27babc2c01ee337ca5fd24ae37c' into glitch-soc/merge-upstream
Conflicts: - `app/javascript/packs/public.jsx`: Upstream refactored slightly (but touching almost all the lines in the code), glitch-soc had moved a few of the code to another file. Refactored as upstream did.remotes/1723507292310805857/main
commit
7b09f585fa
|
@ -48,7 +48,6 @@ function loaded() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ready(() => {
|
|
||||||
const locale = document.documentElement.lang;
|
const locale = document.documentElement.lang;
|
||||||
|
|
||||||
const dateTimeFormat = new Intl.DateTimeFormat(locale, {
|
const dateTimeFormat = new Intl.DateTimeFormat(locale, {
|
||||||
|
@ -202,9 +201,9 @@ function loaded() {
|
||||||
const message = (statusEl.dataset.spoiler === 'expanded') ? (localeData['status.show_less'] || 'Show less') : (localeData['status.show_more'] || 'Show more');
|
const message = (statusEl.dataset.spoiler === 'expanded') ? (localeData['status.show_less'] || 'Show less') : (localeData['status.show_more'] || 'Show more');
|
||||||
spoilerLink.textContent = (new IntlMessageFormat(message, locale)).format();
|
spoilerLink.textContent = (new IntlMessageFormat(message, locale)).format();
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
const toggleSidebar = () => {
|
const toggleSidebar = () => {
|
||||||
const sidebar = document.querySelector('.sidebar ul');
|
const sidebar = document.querySelector('.sidebar ul');
|
||||||
const toggleButton = document.querySelector('.sidebar__toggle__icon');
|
const toggleButton = document.querySelector('.sidebar__toggle__icon');
|
||||||
|
|
||||||
|
@ -218,31 +217,29 @@ function loaded() {
|
||||||
|
|
||||||
toggleButton.classList.toggle('active');
|
toggleButton.classList.toggle('active');
|
||||||
sidebar.classList.toggle('visible');
|
sidebar.classList.toggle('visible');
|
||||||
};
|
};
|
||||||
|
|
||||||
delegate(document, '.sidebar__toggle__icon', 'click', () => {
|
delegate(document, '.sidebar__toggle__icon', 'click', () => {
|
||||||
toggleSidebar();
|
toggleSidebar();
|
||||||
});
|
});
|
||||||
|
|
||||||
delegate(document, '.sidebar__toggle__icon', 'keydown', e => {
|
delegate(document, '.sidebar__toggle__icon', 'keydown', e => {
|
||||||
if (e.key === ' ' || e.key === 'Enter') {
|
if (e.key === ' ' || e.key === 'Enter') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
toggleSidebar();
|
toggleSidebar();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Empty the honeypot fields in JS in case something like an extension
|
// Empty the honeypot fields in JS in case something like an extension
|
||||||
// automatically filled them.
|
// automatically filled them.
|
||||||
delegate(document, '#registration_new_user,#new_user', 'submit', () => {
|
delegate(document, '#registration_new_user,#new_user', 'submit', () => {
|
||||||
['user_website', 'user_confirm_password', 'registration_user_website', 'registration_user_confirm_password'].forEach(id => {
|
['user_website', 'user_confirm_password', 'registration_user_website', 'registration_user_confirm_password'].forEach(id => {
|
||||||
const field = document.getElementById(id);
|
const field = document.getElementById(id);
|
||||||
if (field) {
|
if (field) {
|
||||||
field.value = '';
|
field.value = '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
ready(loaded);
|
ready(loaded);
|
||||||
|
|
Loading…
Reference in New Issue