2014-01-19 14:27:24 +01:00
|
|
|
/*
|
|
|
|
* catalog-link.js - This script puts a link to the catalog below the board
|
|
|
|
* subtitle and next to the board list.
|
|
|
|
* https://github.com/vichan-devel/Tinyboard/blob/master/js/catalog-link.js
|
|
|
|
*
|
|
|
|
* Released under the MIT license
|
|
|
|
* Copyright (c) 2013 copypaste <wizardchan@hush.com>
|
|
|
|
* Copyright (c) 2013-2014 Marcin Łabanowski <marcin@6irc.net>
|
|
|
|
*
|
|
|
|
* Usage:
|
|
|
|
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
|
|
|
* $config['additional_javascript'][] = 'js/catalog-link.js';
|
|
|
|
*/
|
2013-08-08 21:07:22 +02:00
|
|
|
|
|
|
|
function catalog() {
|
2023-08-06 00:32:46 +02:00
|
|
|
var board = $("input[name='board']");
|
|
|
|
var boardValue = board.first().val();
|
|
|
|
|
|
|
|
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 bottom = document.getElementsByClassName('boardlist bottom')[0];
|
|
|
|
var subtitle = document.getElementsByClassName('subtitle')[0];
|
|
|
|
|
|
|
|
var link = document.createElement('a');
|
|
|
|
link.href = catalog_url;
|
|
|
|
|
2024-05-17 09:51:24 +02:00
|
|
|
if (!pages) {
|
2023-08-06 00:32:46 +02:00
|
|
|
link.textContent = '['+_('Catalog')+']';
|
|
|
|
link.style.paddingLeft = '10px';
|
|
|
|
link.style.textDecoration = "underline";
|
|
|
|
document.body.insertBefore(link, bottom);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (subtitle) {
|
|
|
|
var link2 = document.createElement('a');
|
|
|
|
link2.textContent = _('Catalog');
|
|
|
|
link2.href = catalog_url;
|
|
|
|
|
|
|
|
var br = document.createElement('br');
|
|
|
|
subtitle.appendChild(br);
|
|
|
|
subtitle.appendChild(link2);
|
|
|
|
}
|
2013-08-08 21:07:22 +02:00
|
|
|
}
|
2013-08-16 16:45:01 +02:00
|
|
|
|
2014-01-06 03:35:07 +01:00
|
|
|
if (active_page == 'thread' || active_page == 'index') {
|
2023-08-06 00:32:46 +02:00
|
|
|
$(document).ready(catalog);
|
2013-08-16 16:45:43 +02:00
|
|
|
}
|