1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-23 23:20:57 +01:00

Add mod.php logic

This commit is contained in:
RealAngeleno 2023-08-05 15:32:46 -07:00 committed by GitHub
parent 4a151acb18
commit ea08c250fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,46 +13,51 @@
*/ */
function catalog() { function catalog() {
var board = $("input[name='board']"); var board = $("input[name='board']");
var boardValue = board.first().val();
var catalog_url = configRoot + board.first().val() + "/catalog.html"; var catalog_url = '';
if (window.location.href.includes('mod.php?/')) {
catalog_url = configRoot + 'mod.php?/' + boardValue + '/catalog.html';
} else {
catalog_url = configRoot + boardValue + '/catalog.html';
}
var pages = document.getElementsByClassName('pages')[0]; var pages = document.getElementsByClassName('pages')[0];
var bottom = document.getElementsByClassName('boardlist bottom')[0] var bottom = document.getElementsByClassName('boardlist bottom')[0];
var subtitle = document.getElementsByClassName('subtitle')[0]; var subtitle = document.getElementsByClassName('subtitle')[0];
var link = document.createElement('a'); var link = document.createElement('a');
link.href = catalog_url; link.href = catalog_url;
if (pages) { if (pages) {
link.textContent = _('Catalog'); link.textContent = _('Catalog');
link.style.color = '#F10000'; link.style.color = '#F10000';
link.style.padding = '4px'; link.style.padding = '4px';
link.style.paddingLeft = '9px'; link.style.paddingLeft = '9px';
link.style.borderLeft = '1px solid' link.style.borderLeft = '1px solid';
link.style.borderLeftColor = '#A8A8A8'; link.style.borderLeftColor = '#A8A8A8';
link.style.textDecoration = "underline"; link.style.textDecoration = "underline";
pages.appendChild(link) pages.appendChild(link);
} } else {
else { link.textContent = '['+_('Catalog')+']';
link.textContent = '['+_('Catalog')+']'; link.style.paddingLeft = '10px';
link.style.paddingLeft = '10px'; link.style.textDecoration = "underline";
link.style.textDecoration = "underline"; document.body.insertBefore(link, bottom);
document.body.insertBefore(link, bottom); }
}
if (subtitle) { if (subtitle) {
var link2 = document.createElement('a'); var link2 = document.createElement('a');
link2.textContent = _('Catalog'); link2.textContent = _('Catalog');
link2.href = catalog_url; link2.href = catalog_url;
var br = document.createElement('br'); var br = document.createElement('br');
subtitle.appendChild(br); subtitle.appendChild(br);
subtitle.appendChild(link2); subtitle.appendChild(link2);
} }
} }
if (active_page == 'thread' || active_page == 'index') { if (active_page == 'thread' || active_page == 'index') {
$(document).ready(catalog); $(document).ready(catalog);
} }