1
0

extras.jsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import emojify from './components/emoji';
  2. import { length } from 'stringz';
  3. $(() => {
  4. $.each($('.emojify'), (_, content) => {
  5. const $content = $(content);
  6. $content.html(emojify($content.html()));
  7. });
  8. $('.video-player video').on('click', e => {
  9. if (e.target.paused) {
  10. e.target.play();
  11. } else {
  12. e.target.pause();
  13. }
  14. });
  15. $('.media-spoiler').on('click', e => {
  16. $(e.target).hide();
  17. });
  18. $('.webapp-btn').on('click', e => {
  19. if (e.button === 0) {
  20. e.preventDefault();
  21. window.location.href = $(e.target).attr('href');
  22. }
  23. });
  24. $('.status__content__spoiler-link').on('click', e => {
  25. e.preventDefault();
  26. const contentEl = $(e.target).parent().parent().find('div');
  27. if (contentEl.is(':visible')) {
  28. contentEl.hide();
  29. $(e.target).parent().attr('style', 'margin-bottom: 0');
  30. } else {
  31. contentEl.show();
  32. $(e.target).parent().attr('style', null);
  33. }
  34. });
  35. // used on /settings/profile
  36. $('.account_display_name').on('input', e => {
  37. $('.name-counter').text(30 - length($(e.target).val()));
  38. });
  39. $('.account_note').on('input', e => {
  40. $('.note-counter').text(160 - length($(e.target).val()));
  41. });
  42. });