Browse Source

Add mod.php logic

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

90
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 {
var catalog_url = configRoot + board.first().val() + '/catalog.html'; catalog_url = configRoot + boardValue + '/catalog.html';
}
var pages = $('.pages');
var bottom = $('.boardlist.bottom'); var pages = document.getElementsByClassName('pages')[0];
var subtitle = $('.subtitle'); var bottom = document.getElementsByClassName('boardlist bottom')[0];
var subtitle = document.getElementsByClassName('subtitle')[0];
var link = $('<a class="catalog" />')
.attr('href', catalog_url); var link = document.createElement('a');
link.href = catalog_url;
if (pages.length) {
link.text(_('Catalog')) if (pages) {
.css({ link.textContent = _('Catalog');
color: '#F10000', link.style.color = '#F10000';
padding: '4px', link.style.padding = '4px';
textDecoration: 'underline', link.style.paddingLeft = '9px';
display: 'table-cell' link.style.borderLeft = '1px solid';
}); link.style.borderLeftColor = '#A8A8A8';
link.insertAfter(pages); link.style.textDecoration = "underline";
} else if (bottom.length) {
link.text('['+_('Catalog')+']') pages.appendChild(link);
.css({ } else {
paddingLeft: '10px', link.textContent = '['+_('Catalog')+']';
textDecoration: 'underline' link.style.paddingLeft = '10px';
}); link.style.textDecoration = "underline";
link.insertBefore(bottom); document.body.insertBefore(link, 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