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.

48 lines
1.1 KiB

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