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.

53 lignes
1.7KB

  1. /*
  2. * expand-all-images.js
  3. * https://github.com/savetheinternet/Tinyboard/blob/master/js/expand-all-images.js
  4. *
  5. * Adds an "Expand all images" button to the top of the page.
  6. *
  7. * Released under the MIT license
  8. * Copyright (c) 2012-2013 Michael Save <savetheinternet@tinyboard.org>
  9. * Copyright (c) 2013-2014 Marcin Łabanowski <marcin@6irc.net>
  10. * Copyright (c) 2014 sinuca <#55ch@rizon.net>
  11. *
  12. * Usage:
  13. * $config['additional_javascript'][] = 'js/jquery.min.js';
  14. * $config['additional_javascript'][] = 'js/inline-expanding.js';
  15. * $config['additional_javascript'][] = 'js/expand-all-images.js';
  16. *
  17. */
  18. if (active_page == 'ukko' || active_page == 'thread' || active_page == 'index')
  19. onready(function(){
  20. $('hr:first').before('<div id="expand-all-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>');
  21. $('div#expand-all-images a')
  22. .text(_('Expand all images'))
  23. .click(function() {
  24. $('a img.post-image').each(function() {
  25. // Don't expand YouTube embeds
  26. if ($(this).parent().parent().hasClass('video-container'))
  27. return;
  28. // or WEBM
  29. if (/^\/player\.php\?/.test($(this).parent().attr('href')))
  30. return;
  31. if (!$(this).parent().data('expanded'))
  32. $(this).parent().click();
  33. });
  34. if (!$('#shrink-all-images').length) {
  35. $('hr:first').before('<div id="shrink-all-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>');
  36. }
  37. $('div#shrink-all-images a')
  38. .text(_('Shrink all images'))
  39. .click(function(){
  40. $('a img.full-image').each(function() {
  41. if ($(this).parent().data('expanded'))
  42. $(this).parent().click();
  43. });
  44. $(this).parent().remove();
  45. });
  46. });
  47. });