Browse Source

Add mod.php logic

main
RealAngeleno 10 months ago
committed by -
parent
commit
8e5681b44f
  1. 76
      js/catalog-link.js

76
js/catalog-link.js

@ -12,51 +12,53 @@
* $config['additional_javascript'][] = 'js/catalog-link.js'; * $config['additional_javascript'][] = 'js/catalog-link.js';
*/ */
(function($) { function catalog() {
var catalog = function() { var board = $("input[name='board']");
var board = $('input[name="board"]'); var boardValue = board.first().val();
if (!board.length) { var catalog_url = '';
return; if (window.location.href.includes('mod.php?/')) {
catalog_url = configRoot + 'mod.php?/' + boardValue + '/catalog.html';
} else {
catalog_url = configRoot + boardValue + '/catalog.html';
} }
var catalog_url = configRoot + board.first().val() + '/catalog.html'; var pages = document.getElementsByClassName('pages')[0];
var bottom = document.getElementsByClassName('boardlist bottom')[0];
var pages = $('.pages'); var subtitle = document.getElementsByClassName('subtitle')[0];
var bottom = $('.boardlist.bottom');
var subtitle = $('.subtitle'); var link = document.createElement('a');
link.href = catalog_url;
var link = $('<a class="catalog" />')
.attr('href', catalog_url); if (pages) {
link.textContent = _('Catalog');
if (pages.length) { link.style.color = '#F10000';
link.text(_('Catalog')) link.style.padding = '4px';
.css({ link.style.paddingLeft = '9px';
color: '#F10000', link.style.borderLeft = '1px solid';
padding: '4px', link.style.borderLeftColor = '#A8A8A8';
textDecoration: 'underline', link.style.textDecoration = "underline";
display: 'table-cell'
}); pages.appendChild(link);
link.insertAfter(pages); } else {
} else if (bottom.length) { link.textContent = '['+_('Catalog')+']';
link.text('['+_('Catalog')+']') link.style.paddingLeft = '10px';
.css({ link.style.textDecoration = "underline";
paddingLeft: '10px', document.body.insertBefore(link, bottom);
textDecoration: 'underline'
});
link.insertBefore(bottom);
} }
if (subtitle.length) { if (subtitle) {
subtitle.append('<br />'); var link2 = document.createElement('a');
$('<a class="catalog" />') link2.textContent = _('Catalog');
.text(_('Catalog')) link2.href = catalog_url;
.attr('href', catalog_url)
.appendTo(subtitle); var br = document.createElement('br');
subtitle.appendChild(br);
subtitle.appendChild(link2);
} }
} }
if (active_page == 'thread' || active_page == 'index' || active_page == 'ukko') { if (active_page == 'thread' || active_page == 'index') {
$(document).ready(catalog); $(document).ready(catalog);
} }
})(jQuery); })(jQuery);

Loading…
Cancel
Save