The version of vichan running on lainchan.org
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

40 lignes
950B

  1. /*
  2. * expand-too-long.js
  3. * https://github.com/vichan-devel/vichan/blob/master/js/expand-too-long.js
  4. *
  5. * Released under the MIT license
  6. * Copyright (c) 2013-2014 Marcin Łabanowski <marcin@6irc.net>
  7. *
  8. * Usage:
  9. * $config['additional_javascript'][] = 'js/jquery.min.js';
  10. * $config['additional_javascript'][] = 'js/expand-too-long.js';
  11. *
  12. */
  13. $(function() {
  14. var do_expand = function() {
  15. $(this).find('a').click(function(e) {
  16. e.preventDefault();
  17. var url = $(this).attr('href');
  18. var body = $(this).parents('.body');
  19. $.ajax({
  20. url: url,
  21. context: document.body,
  22. success: function(data) {
  23. var content = $(data).find('#'+url.split('#')[1]).parent().parent().find(".body").first().html();
  24. body.html(content);
  25. }
  26. });
  27. });
  28. };
  29. $('.toolong').each(do_expand);
  30. $(document).on("new_post", function(e, post) {
  31. $(post).find('.toolong').each(do_expand)
  32. });
  33. });