mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-15 23:54:52 +01:00
f5bf5ebb82
* Replace browserify with webpack * Add react-intl-translations-manager * Do not minify in development, add offline-plugin for ServiceWorker background cache updates * Adjust tests and dependencies * Fix production deployments * Fix tests * More optimizations * Improve travis cache for npm stuff * Re-run travis * Add back support for custom.scss as before * Remove offline-plugin and babili * Fix issue with Immutable.List().unshift(...values) not working as expected * Make travis load schema instead of running all migrations in sequence * Fix missing React import in WarningContainer. Optimize rendering performance by using ImmutablePureComponent instead of React.PureComponent. ImmutablePureComponent uses Immutable.is() to compare props. Replace dynamic callback bindings in <UI /> * Add react definitions to places that use JSX * Add Procfile.dev for running rails, webpack and streaming API at the same time
54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
import emojify from 'mastodon/emoji';
|
|
import { length } from 'stringz';
|
|
|
|
window.jQuery = window.$ = require('jquery');
|
|
require('jquery-ujs');
|
|
require.context('../images/', true);
|
|
|
|
$(() => {
|
|
$.each($('.emojify'), (_, content) => {
|
|
const $content = $(content);
|
|
$content.html(emojify($content.html()));
|
|
});
|
|
|
|
$('.video-player video').on('click', e => {
|
|
if (e.target.paused) {
|
|
e.target.play();
|
|
} else {
|
|
e.target.pause();
|
|
}
|
|
});
|
|
|
|
$('.media-spoiler').on('click', e => {
|
|
$(e.target).hide();
|
|
});
|
|
|
|
$('.webapp-btn').on('click', e => {
|
|
if (e.button === 0) {
|
|
e.preventDefault();
|
|
window.location.href = $(e.target).attr('href');
|
|
}
|
|
});
|
|
|
|
$('.status__content__spoiler-link').on('click', e => {
|
|
e.preventDefault();
|
|
const contentEl = $(e.target).parent().parent().find('div');
|
|
|
|
if (contentEl.is(':visible')) {
|
|
contentEl.hide();
|
|
$(e.target).parent().attr('style', 'margin-bottom: 0');
|
|
} else {
|
|
contentEl.show();
|
|
$(e.target).parent().attr('style', null);
|
|
}
|
|
});
|
|
|
|
$('.account_display_name').on('input', e => {
|
|
$('.name-counter').text(30 - length($(e.target).val()));
|
|
});
|
|
|
|
$('.account_note').on('input', e => {
|
|
$('.note-counter').text(160 - length($(e.target).val()));
|
|
});
|
|
});
|