You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.3 KiB
54 lines
1.3 KiB
8 years ago
|
import emojify from 'mastodon/emoji';
|
||
8 years ago
|
import { length } from 'stringz';
|
||
8 years ago
|
|
||
8 years ago
|
window.jQuery = window.$ = require('jquery');
|
||
|
require('jquery-ujs');
|
||
|
require.context('../images/', true);
|
||
|
|
||
8 years ago
|
$(() => {
|
||
8 years ago
|
$.each($('.emojify'), (_, content) => {
|
||
8 years ago
|
const $content = $(content);
|
||
|
$content.html(emojify($content.html()));
|
||
|
});
|
||
8 years ago
|
|
||
|
$('.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();
|
||
|
});
|
||
8 years ago
|
|
||
|
$('.webapp-btn').on('click', e => {
|
||
|
if (e.button === 0) {
|
||
|
e.preventDefault();
|
||
|
window.location.href = $(e.target).attr('href');
|
||
|
}
|
||
|
});
|
||
8 years ago
|
|
||
|
$('.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);
|
||
|
}
|
||
|
});
|
||
8 years ago
|
|
||
|
$('.account_display_name').on('input', e => {
|
||
8 years ago
|
$('.name-counter').text(30 - length($(e.target).val()));
|
||
8 years ago
|
});
|
||
8 years ago
|
|
||
8 years ago
|
$('.account_note').on('input', e => {
|
||
8 years ago
|
$('.note-counter').text(160 - length($(e.target).val()));
|
||
8 years ago
|
});
|
||
8 years ago
|
});
|