The version of vichan running on lainchan.org
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.

63 lines
1.5KB

  1. /*
  2. * catalog-link.js - This script puts a link to the catalog below the board
  3. * subtitle and next to the board list.
  4. * https://github.com/vichan-devel/Tinyboard/blob/master/js/catalog-link.js
  5. *
  6. * Released under the MIT license
  7. * Copyright (c) 2013 copypaste <wizardchan@hush.com>
  8. * Copyright (c) 2013-2014 Marcin Łabanowski <marcin@6irc.net>
  9. *
  10. * Usage:
  11. * $config['additional_javascript'][] = 'js/jquery.min.js';
  12. * $config['additional_javascript'][] = 'js/catalog-link.js';
  13. */
  14. (function($) {
  15. var catalog = function() {
  16. var board = $('input[name="board"]');
  17. if (!board.length) {
  18. return;
  19. }
  20. var catalog_url = configRoot + board.first().val() + '/catalog.html';
  21. var pages = $('.pages');
  22. var bottom = $('.boardlist.bottom');
  23. var subtitle = $('.subtitle');
  24. var link = $('<a class="catalog" />')
  25. .attr('href', catalog_url);
  26. if (pages.length) {
  27. link.text(_('Catalog'))
  28. .css({
  29. color: '#F10000',
  30. padding: '4px',
  31. textDecoration: 'underline',
  32. display: 'table-cell'
  33. });
  34. link.insertAfter(pages);
  35. } else if (bottom.length) {
  36. link.text('['+_('Catalog')+']')
  37. .css({
  38. paddingLeft: '10px',
  39. textDecoration: 'underline'
  40. });
  41. link.insertBefore(bottom);
  42. }
  43. if (subtitle.length) {
  44. subtitle.append('<br />');
  45. $('<a class="catalog" />')
  46. .text(_('Catalog'))
  47. .attr('href', catalog_url)
  48. .appendTo(subtitle);
  49. }
  50. }
  51. if (active_page == 'thread' || active_page == 'index' || active_page == 'ukko') {
  52. $(document).ready(catalog);
  53. }
  54. })(jQuery);