The version of vichan running on lainchan.org
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

48 行
1.1KB

  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. *
  10. * Usage:
  11. * $config['additional_javascript'][] = 'js/jquery.min.js';
  12. * $config['additional_javascript'][] = 'js/show-op.js';
  13. *
  14. */
  15. $(document).ready(function(){
  16. var showOPLinks = function() {
  17. var OP;
  18. if ($('div.banner').length == 0) {
  19. OP = $(this).parent().find('div.post.op a.post_no:eq(1)').text();
  20. } else {
  21. OP = $('div.post.op a.post_no:eq(1)').text();
  22. }
  23. $(this).find('div.body a:not([rel="nofollow"])').each(function() {
  24. var postID;
  25. if(postID = $(this).text().match(/^>>(\d+)$/))
  26. postID = postID[1];
  27. else
  28. return;
  29. if (postID == OP) {
  30. $(this).after(' <small>(OP)</small>');
  31. }
  32. });
  33. };
  34. $('div.post.reply').each(showOPLinks);
  35. // allow to work with auto-reload.js, etc.
  36. $(document).on('new_post', function(e, post) {
  37. $(post).each(showOPLinks);
  38. });
  39. });