Browse Source

Allow user to set the boardlist to point to catalog links instead of regular index page in Options.

Edited to only affect local board links, not external index.html links.
main
Benjamin Southall 5 years ago
committed by discomrade
parent
commit
3c89b30861
  1. 2
      inc/display.php
  2. 33
      js/boardlist-catalog-links.js

2
inc/display.php

@ -35,7 +35,7 @@ function doBoardListPart($list, $root, &$boards) {
$title = ' title="'.$boards[$board].'"';
}
$body .= ' <a href="' . $root . $board . '/' . $config['file_index'] . '"'.$title.'>' . $board . '</a> /';
$body .= ' <a class="board" href="' . $root . $board . '/' . $config['file_index'] . '"'.$title.'>' . $board . '</a> /';
}
}
}

33
js/boardlist-catalog-links.js

@ -0,0 +1,33 @@
/*
* boardlist-catalog-links.js
*
* Usage:
* $config['additional_javascript'][] = 'js/jquery.min.js';
* $config['additional_javascript'][] = 'js/boardlist-catalog-links.js';
*
*/
$(document).ready(function() {
function replace_index_links() {
$('.boardlist').children('span[class="sub"]').children('a.board').each(function() {
this.href = this.href.replace('index.html', 'catalog.html');
});
}
if (window.Options && Options.get_tab('general')) {
Options.extend_tab("general", "<fieldset><legend> Board List Catalog Links </legend><label><input type='checkbox' id='boardlist_catalog_links' /> "+_('Use catalog links for the board list')+"</label></fieldset>");
$('#boardlist_catalog_links').on('change', function(){
var setting = $(this).attr('id');
localStorage[setting] = $(this).is(':checked');
location.reload();
});
if (localStorage.boardlist_catalog_links === 'true') {
$('#boardlist_catalog_links').prop('checked', true);
replace_index_links();
}
}
});
Loading…
Cancel
Save