闭社主体 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.

40 lines
925 B

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