The version of vichan running on lainchan.org
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

55 wiersze
1.2KB

  1. /*
  2. * show-op
  3. * https://github.com/savetheinternet/Tinyboard/blob/master/js/show-op.js
  4. *
  5. * Adds "(OP)" to >>X links when the OP is quoted.
  6. *
  7. * Released under the MIT license
  8. * Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org>
  9. * Copyright (c) 2014 Marcin Łabanowski <marcin@6irc.net>
  10. *
  11. * Usage:
  12. * $config['additional_javascript'][] = 'js/jquery.min.js';
  13. * $config['additional_javascript'][] = 'js/show-op.js';
  14. *
  15. */
  16. $(document).ready(function(){
  17. var showOPLinks = function() {
  18. var OP;
  19. if ($('div.banner').length == 0) {
  20. OP = parseInt($(this).parent().find('div.post.op a.post_no:eq(1)').text());
  21. } else {
  22. OP = parseInt($('div.post.op a.post_no:eq(1)').text());
  23. }
  24. $(this).find('div.body a:not([rel="nofollow"])').each(function() {
  25. var postID;
  26. if(postID = $(this).text().match(/^>>(\d+)$/))
  27. postID = postID[1];
  28. else
  29. return;
  30. if (postID == OP) {
  31. $(this).after(' <small>(OP)</small>');
  32. }
  33. });
  34. };
  35. $('div.post.reply').each(showOPLinks);
  36. // allow to work with auto-reload.js, etc.
  37. $(document).on('new_post', function(e, post) {
  38. if ($(post).is('div.post.reply')) {
  39. $(post).each(showOPLinks);
  40. }
  41. else {
  42. $(post).find('div.post.reply').each(showOPLinks);
  43. }
  44. });
  45. });