Datatables update

I noticed if the datatables files wasn't cached some pages that didn't use it would take slightly longer to load whilst it downloaded it.
This will only write the js and css files onto the page if $use_datatable = true;  is set on the page.
See accounts/news/players pages for examples.

It wasn't a massive performance loss for the user but not needed if those pages are hardly ever used.
This commit is contained in:
Lee 2020-11-07 13:53:11 +00:00
parent dcf83d5608
commit 9bc63bb55c
4 changed files with 7 additions and 0 deletions

View File

@ -7,7 +7,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/adminlte.min.css">
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/font-awesome.min.css">
<?php if (isset($use_datatable)) { ?>
<link rel="stylesheet" href="<?php echo BASE_URL; ?>tools/css/datatables.bs.min.css">
<?php } ?>
<link rel="stylesheet" type="text/css" href="<?php echo $template_path; ?>style.css"/>
<!--[if lt IE 9]>
<script src="<?php echo BASE_URL; ?>tools/js/html5shiv.min.js"></script>
@ -173,8 +175,10 @@
?>
<script src="<?php echo BASE_URL; ?>tools/js/bootstrap.min.js"></script>
<script src="<?php echo BASE_URL; ?>tools/js/jquery-ui.min.js"></script>
<?php if (isset($use_datatable)) { ?>
<script src="<?php echo BASE_URL; ?>tools/js/datatables.min.js"></script>
<script src="<?php echo BASE_URL; ?>tools/js/datatables.bs.min.js"></script>
<?php } ?>
<script src="<?php echo BASE_URL; ?>tools/js/adminlte.min.js"></script>
</body>
</html>

View File

@ -11,6 +11,7 @@ defined('MYAAC') or die('Direct access not allowed!');
$title = 'Account editor';
$admin_base = BASE_URL . 'admin/?p=accounts';
$use_datatable = true;
if ($config['account_country'])
require SYSTEM . 'countries.conf.php';

View File

@ -13,6 +13,7 @@ require_once LIBS . 'forum.php';
require_once LIBS . 'news.php';
$title = 'News Panel';
$use_datatable = true;
if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) {
echo 'Access denied.';

View File

@ -12,6 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
$title = 'Player editor';
$player_base = BASE_URL . 'admin/?p=players';
$use_datatable = true;
require_once LIBS . 'forum.php';
$skills = array(