if (parallaxComponents.length > 0 ) {
new Rellax('.parallax', { speed: -1 });
}
+
+ if (document.body.classList.contains('with-modals')) {
+ const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
+ const scrollbarWidthStyle = document.createElement('style');
+ scrollbarWidthStyle.id = 'scrollbar-width';
+ document.head.appendChild(scrollbarWidthStyle);
+ scrollbarWidthStyle.sheet.insertRule(`body.with-modals--active { margin-right: ${scrollbarWidth}px; }`, 0);
+ }
});
-
- delegate(document, '.webapp-btn', 'click', ({ target, button }) => {
- if (button !== 0) {
- return true;
- }
- window.location.href = target.href;
- return false;
- });
-
- delegate(document, '.status__content__spoiler-link', 'click', ({ target }) => {
- const contentEl = target.parentNode.parentNode.querySelector('.e-content');
-
- if (contentEl.style.display === 'block') {
- contentEl.style.display = 'none';
- target.parentNode.style.marginBottom = 0;
- } else {
- contentEl.style.display = 'block';
- target.parentNode.style.marginBottom = null;
- }
-
- return false;
- });
-
- delegate(document, '.modal-button', 'click', e => {
- e.preventDefault();
-
- let href;
-
- if (e.target.nodeName !== 'A') {
- href = e.target.parentNode.href;
- } else {
- href = e.target.href;
- }
-
- window.open(href, 'mastodon-intent', 'width=445,height=600,resizable=no,menubar=no,status=no,scrollbars=yes');
- });
-
- delegate(document, '#account_display_name', 'input', ({ target }) => {
- const name = document.querySelector('.card .display-name strong');
- if (name) {
- if (target.value) {
- name.innerHTML = emojify(escapeTextContentForBrowser(target.value));
- } else {
- name.textContent = document.querySelector('#default_account_display_name').textContent;
- }
- }
- });
-
- delegate(document, '#account_avatar', 'change', ({ target }) => {
- const avatar = document.querySelector('.card .avatar img');
- const [file] = target.files || [];
- const url = file ? URL.createObjectURL(file) : avatar.dataset.originalSrc;
-
- avatar.src = url;
- });
-
- delegate(document, '#account_header', 'change', ({ target }) => {
- const header = document.querySelector('.card .card__img img');
- const [file] = target.files || [];
- const url = file ? URL.createObjectURL(file) : header.dataset.originalSrc;
-
- header.src = url;
- });
-
- delegate(document, '#account_locked', 'change', ({ target }) => {
- const lock = document.querySelector('.card .display-name i');
-
- if (target.checked) {
- lock.style.display = 'inline';
- } else {
- lock.style.display = 'none';
- }
- });
-
- delegate(document, '.input-copy input', 'click', ({ target }) => {
- target.select();
- });
-
- delegate(document, '.input-copy button', 'click', ({ target }) => {
- const input = target.parentNode.querySelector('.input-copy__wrapper input');
-
- input.focus();
- input.select();
-
- try {
- if (document.execCommand('copy')) {
- input.blur();
- target.parentNode.classList.add('copied');
-
- setTimeout(() => {
- target.parentNode.classList.remove('copied');
- }, 700);
- }
- } catch (err) {
- console.error(err);
- }
- });
}
loadPolyfills().then(main).catch(error => {
%link{ rel: 'alternate', type: 'application/rss+xml', href: tag_url(@tag, format: 'rss') }/
%script#initial-state{ type: 'application/json' }!= json_escape(@initial_state_json)
- = javascript_pack_tag 'about', integrity: true, crossorigin: 'anonymous'
= render 'og'
- .landing-page.tag-page.alternative
- .features
- .container
- .grid
- .column-1
- #mastodon-timeline{ data: { props: Oj.dump(default_props.merge(hashtag: @tag.name)) } }
-
- .column-2
- .about-mastodon
- .about-hashtag.landing-page__information
- .brand
- = link_to root_url do
- = image_tag asset_pack_path('logo_full.svg'), alt: 'Mastodon'
-
- %p= t 'about.about_hashtag_html', hashtag: @tag.name
-
- .cta
- - if user_signed_in?
- = link_to t('settings.back'), root_path, class: 'button button-secondary'
- - else
- = link_to t('auth.login'), new_user_session_path, class: 'button button-secondary'
- = link_to t('about.learn_more'), about_path, class: 'button button-alternative'
-
- .landing-page__features.landing-page__information
- %h3= t 'about.what_is_mastodon'
- %p= t 'about.about_mastodon_html'
-
- = render 'features'
+ .page-header
+ %h1= "##{@tag.name}"
+ %p= t('about.about_hashtag_html', hashtag: @tag.name)
+ #mastodon-timeline{ data: { props: Oj.dump(default_props.merge(hashtag: @tag.name)) }}
#modal-container