--- /dev/null
+// This file will be loaded on public pages, regardless of theme.
+
+import createHistory from 'history/createBrowserHistory';
+import ready from '../mastodon/ready';
+
+const { delegate } = require('rails-ujs');
+const { length } = require('stringz');
+
+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');
+});
++
++const getProfileAvatarAnimationHandler = (swapTo) => {
++ //animate avatar gifs on the profile page when moused over
++ return ({ target }) => {
++ const swapSrc = target.getAttribute(swapTo);
++ //only change the img source if autoplay is off and the image src is actually different
++ if(target.getAttribute('data-autoplay') === 'false' && target.src !== swapSrc) {
++ target.src = swapSrc;
++ }
++ };
++};
++
++delegate(document, 'img#profile_page_avatar', 'mouseover', getProfileAvatarAnimationHandler('data-original'));
++
++delegate(document, 'img#profile_page_avatar', 'mouseout', getProfileAvatarAnimationHandler('data-static'));
++
++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;
++});
}
// Submit disabled:
- const { is_submitting, is_changing_upload, is_uploading, anyMedia } = this.props;
- const fulltext = [this.props.spoiler_text, countableText(this.props.text)].join('');
+ const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props;
+ const fulltext = [this.props.spoilerText, countableText(this.props.text)].join('');
- if (is_submitting || is_uploading || is_changing_upload || length(fulltext) > maxChars || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
- if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
++ if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
return;
}
render () {
const { intl, onPaste, showSearch, anyMedia } = this.props;
- const disabled = this.props.is_submitting;
- const text = [this.props.spoiler_text, countableText(this.props.text)].join('');
- const disabledButton = disabled || this.props.is_uploading || this.props.is_changing_upload || length(text) > maxChars || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
+ const disabled = this.props.isSubmitting;
+ const text = [this.props.spoilerText, countableText(this.props.text)].join('');
- const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 500 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
++ const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > maxChars || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
let publishText = '';
if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
export const deleteModal = getMeta('delete_modal');
export const me = getMeta('me');
export const searchEnabled = getMeta('search_enabled');
+export const maxChars = (initialState && initialState.max_toot_chars) || 500;
export const invitesEnabled = getMeta('invites_enabled');
+ export const repository = getMeta('repository');
+ export const source_url = getMeta('source_url');
export const version = getMeta('version');
export const mascot = getMeta('mascot');
export const profile_directory = getMeta('profile_directory');
@font-face {
font-family: 'mastodon-font-display';
- src: local('Montserrat'),
+ src: local('Montserrat Medium'),
- url('../fonts/montserrat/Montserrat-Medium.ttf') format('truetype');
+ url('~fonts/montserrat/Montserrat-Medium.ttf') format('truetype');
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: 'mastodon-font-sans-serif';
- src: local('Roboto'),
+ src: local('Roboto Italic'),
- url('../fonts/roboto/roboto-italic-webfont.woff2') format('woff2'),
- url('../fonts/roboto/roboto-italic-webfont.woff') format('woff'),
- url('../fonts/roboto/roboto-italic-webfont.ttf') format('truetype'),
- url('../fonts/roboto/roboto-italic-webfont.svg#roboto-italic-webfont') format('svg');
+ url('~fonts/roboto/roboto-italic-webfont.woff2') format('woff2'),
+ url('~fonts/roboto/roboto-italic-webfont.woff') format('woff'),
+ url('~fonts/roboto/roboto-italic-webfont.ttf') format('truetype'),
+ url('~fonts/roboto/roboto-italic-webfont.svg#roboto-italic-webfont') format('svg');
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: 'mastodon-font-sans-serif';
- src: local('Roboto'),
+ src: local('Roboto Bold'),
- url('../fonts/roboto/roboto-bold-webfont.woff2') format('woff2'),
- url('../fonts/roboto/roboto-bold-webfont.woff') format('woff'),
- url('../fonts/roboto/roboto-bold-webfont.ttf') format('truetype'),
- url('../fonts/roboto/roboto-bold-webfont.svg#roboto-bold-webfont') format('svg');
+ url('~fonts/roboto/roboto-bold-webfont.woff2') format('woff2'),
+ url('~fonts/roboto/roboto-bold-webfont.woff') format('woff'),
+ url('~fonts/roboto/roboto-bold-webfont.ttf') format('truetype'),
+ url('~fonts/roboto/roboto-bold-webfont.svg#roboto-bold-webfont') format('svg');
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: 'mastodon-font-sans-serif';
- src: local('Roboto'),
+ src: local('Roboto Medium'),
- url('../fonts/roboto/roboto-medium-webfont.woff2') format('woff2'),
- url('../fonts/roboto/roboto-medium-webfont.woff') format('woff'),
- url('../fonts/roboto/roboto-medium-webfont.ttf') format('truetype'),
- url('../fonts/roboto/roboto-medium-webfont.svg#roboto-medium-webfont') format('svg');
+ url('~fonts/roboto/roboto-medium-webfont.woff2') format('woff2'),
+ url('~fonts/roboto/roboto-medium-webfont.woff') format('woff'),
+ url('~fonts/roboto/roboto-medium-webfont.ttf') format('truetype'),
+ url('~fonts/roboto/roboto-medium-webfont.svg#roboto-medium-webfont') format('svg');
font-weight: 500;
font-style: normal;
}
end
def repository
- 'glitch-soc/mastodon'
- ENV.fetch('GITHUB_REPOSITORY') { 'tootsuite/mastodon' }
++ ENV.fetch('GITHUB_REPOSITORY') { 'glitch-soc/mastodon' }
end
def source_base_url