闭社主体 forked from https://github.com/tootsuite/mastodon
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.

49 lines
1.2 KiB

  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. });