2017-05-02 17:04:16 -07:00
|
|
|
import emojify from 'mastodon/emoji';
|
2017-04-25 08:37:51 -07:00
|
|
|
import { length } from 'stringz';
|
2016-12-18 06:20:39 -08:00
|
|
|
|
2017-05-02 17:04:16 -07:00
|
|
|
window.jQuery = window.$ = require('jquery');
|
|
|
|
require('jquery-ujs');
|
|
|
|
require.context('../images/', true);
|
|
|
|
|
2016-12-18 06:20:39 -08:00
|
|
|
$(() => {
|
2017-01-09 19:40:45 -08:00
|
|
|
$.each($('.emojify'), (_, content) => {
|
2016-12-18 06:20:39 -08:00
|
|
|
const $content = $(content);
|
|
|
|
$content.html(emojify($content.html()));
|
|
|
|
});
|
2016-12-18 10:47:11 -08:00
|
|
|
|
|
|
|
$('.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();
|
|
|
|
});
|
2016-12-20 15:13:13 -08:00
|
|
|
|
|
|
|
$('.webapp-btn').on('click', e => {
|
|
|
|
if (e.button === 0) {
|
|
|
|
e.preventDefault();
|
|
|
|
window.location.href = $(e.target).attr('href');
|
|
|
|
}
|
|
|
|
});
|
2017-03-31 04:54:36 -07:00
|
|
|
|
|
|
|
$('.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);
|
|
|
|
}
|
|
|
|
});
|
2017-04-21 09:17:21 -07:00
|
|
|
|
|
|
|
$('.account_display_name').on('input', e => {
|
2017-04-25 08:37:51 -07:00
|
|
|
$('.name-counter').text(30 - length($(e.target).val()));
|
2017-04-21 09:17:21 -07:00
|
|
|
});
|
2017-05-02 17:04:16 -07:00
|
|
|
|
2017-04-21 09:17:21 -07:00
|
|
|
$('.account_note').on('input', e => {
|
2017-04-25 08:37:51 -07:00
|
|
|
$('.note-counter').text(160 - length($(e.target).val()));
|
2017-04-21 09:17:21 -07:00
|
|
|
});
|
2016-12-18 06:20:39 -08:00
|
|
|
});
|