[Web] Minify more resources, fix missing JS
parent
61cd2c0353
commit
ea83f72981
|
@ -1009,8 +1009,8 @@ echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
|
||||||
echo "var log_pagination_size = '". $LOG_PAGINATION_SIZE . "';\n";
|
echo "var log_pagination_size = '". $LOG_PAGINATION_SIZE . "';\n";
|
||||||
?>
|
?>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/site/admin.js"></script>
|
|
||||||
<?php
|
<?php
|
||||||
|
$js_minifier->add('/web/js/site/admin.js');
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
||||||
} else {
|
} else {
|
||||||
header('Location: /');
|
header('Location: /');
|
||||||
|
|
|
@ -341,8 +341,8 @@ echo "var log_pagination_size = '". $LOG_PAGINATION_SIZE . "';\n";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/site/debug.js"></script>
|
|
||||||
<?php
|
<?php
|
||||||
|
$js_minifier->add('/web/js/site/debug.js');
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1226,8 +1226,7 @@ echo "var csrf_token = '". $_SESSION['CSRF']['TOKEN'] . "';\n";
|
||||||
echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
|
echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
|
||||||
?>
|
?>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/footable.min.js"></script>
|
|
||||||
<script src="/js/edit.js"></script>
|
|
||||||
<?php
|
<?php
|
||||||
|
$js_minifier->add('/web/js/site/edit.js');
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -3,7 +3,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/modals/footer.php';
|
||||||
logger();
|
logger();
|
||||||
?>
|
?>
|
||||||
<div style="margin-bottom: 100px;"></div>
|
<div style="margin-bottom: 100px;"></div>
|
||||||
<script><?=$js_footer;?></script>
|
<script type='text/javascript'><?=$js_minifier->minify();?></script>
|
||||||
<script>
|
<script>
|
||||||
<?php
|
<?php
|
||||||
$lang_footer = json_encode($lang['footer']);
|
$lang_footer = json_encode($lang['footer']);
|
||||||
|
|
|
@ -11,17 +11,30 @@
|
||||||
<script src="/js/html5shiv.min.js"></script>
|
<script src="/js/html5shiv.min.js"></script>
|
||||||
<script src="/js/respond.min.js"></script>
|
<script src="/js/respond.min.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<script src="/js/jquery-1.12.4.min.js"></script>
|
<script type='text/javascript' src="/js/jquery-1.12.4.min.js"></script>
|
||||||
<style><?=$css_header;?></style>
|
|
||||||
<?php if (strtolower(trim($DEFAULT_THEME)) != "lumen"): ?>
|
<?php if (strtolower(trim($DEFAULT_THEME)) != "lumen"): ?>
|
||||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/<?= strtolower(trim($DEFAULT_THEME)); ?>/bootstrap.min.css">
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/<?= strtolower(trim($DEFAULT_THEME)); ?>/bootstrap.min.css">
|
||||||
<?php endif; ?>
|
<?php endif;
|
||||||
<?= (preg_match("/mailbox/i", $_SERVER['REQUEST_URI'])) ? '<link rel="stylesheet" href="/css/site/mailbox.css">' : null; ?>
|
if (preg_match("/mailbox/i", $_SERVER['REQUEST_URI'])) {
|
||||||
<?= (preg_match("/admin/i", $_SERVER['REQUEST_URI'])) ? '<link rel="stylesheet" href="/css/site/admin.css">' : null; ?>
|
$css_minifier->add('/web/css/site/mailbox.css');
|
||||||
<?= (preg_match("/user/i", $_SERVER['REQUEST_URI'])) ? '<link rel="stylesheet" href="/css/site/user.css">' : null; ?>
|
}
|
||||||
<?= (preg_match("/edit/i", $_SERVER['REQUEST_URI'])) ? '<link rel="stylesheet" href="/css/site/edit.css">' : null; ?>
|
if (preg_match("/admin/i", $_SERVER['REQUEST_URI'])) {
|
||||||
<?= (preg_match("/quarantine/i", $_SERVER['REQUEST_URI'])) ? '<link rel="stylesheet" href="/css/site/quarantine.css">' : null; ?>
|
$css_minifier->add('/web/css/site/admin.css');
|
||||||
<?= (preg_match("/debug/i", $_SERVER['REQUEST_URI'])) ? '<link rel="stylesheet" href="/css/site/debug.css">' : null; ?>
|
}
|
||||||
|
if (preg_match("/user/i", $_SERVER['REQUEST_URI'])) {
|
||||||
|
$css_minifier->add('/web/css/site/user.css');
|
||||||
|
}
|
||||||
|
if (preg_match("/edit/i", $_SERVER['REQUEST_URI'])) {
|
||||||
|
$css_minifier->add('/web/css/site/edit.css');
|
||||||
|
}
|
||||||
|
if (preg_match("/quarantine/i", $_SERVER['REQUEST_URI'])) {
|
||||||
|
$css_minifier->add('/web/css/site/quarantine.css');
|
||||||
|
}
|
||||||
|
if (preg_match("/debug/i", $_SERVER['REQUEST_URI'])) {
|
||||||
|
$css_minifier->add('/web/css/site/debug.css');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<style><?=$css_minifier->minify();?></style>
|
||||||
<link rel="shortcut icon" href="/favicon.png" type="image/png">
|
<link rel="shortcut icon" href="/favicon.png" type="image/png">
|
||||||
<link rel="icon" href="/favicon.png" type="image/png">
|
<link rel="icon" href="/favicon.png" type="image/png">
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -24,7 +24,6 @@ $js_dir = array_diff(scandir('/web/js/build'), array('..', '.'));
|
||||||
foreach ($js_dir as $js_file) {
|
foreach ($js_dir as $js_file) {
|
||||||
$js_minifier->add('/web/js/build/' . $js_file);
|
$js_minifier->add('/web/js/build/' . $js_file);
|
||||||
}
|
}
|
||||||
$js_footer = $js_minifier->minify();
|
|
||||||
|
|
||||||
// Minify CSS
|
// Minify CSS
|
||||||
$css_minifier = new Minify\CSS();
|
$css_minifier = new Minify\CSS();
|
||||||
|
@ -32,7 +31,6 @@ $css_dir = array_diff(scandir('/web/css/build'), array('..', '.'));
|
||||||
foreach ($css_dir as $css_file) {
|
foreach ($css_dir as $css_file) {
|
||||||
$css_minifier->add('/web/css/build/' . $css_file);
|
$css_minifier->add('/web/css/build/' . $css_file);
|
||||||
}
|
}
|
||||||
$css_header = $css_minifier->minify();
|
|
||||||
|
|
||||||
// U2F API + T/HOTP API
|
// U2F API + T/HOTP API
|
||||||
$u2f = new u2flib_server\U2F('https://' . $_SERVER['HTTP_HOST']);
|
$u2f = new u2flib_server\U2F('https://' . $_SERVER['HTTP_HOST']);
|
||||||
|
|
|
@ -108,6 +108,6 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.container -->
|
</div><!-- /.container -->
|
||||||
<script src="/js/site/index.js"></script>
|
|
||||||
<?php
|
<?php
|
||||||
|
$js_minifier->add('/web/js/site/index.js');
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
||||||
|
|
|
@ -336,8 +336,8 @@ echo "var is_dual = " . $is_dual . ";\n";
|
||||||
echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
|
echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
|
||||||
?>
|
?>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/site/mailbox.js"></script>
|
|
||||||
<?php
|
<?php
|
||||||
|
$js_minifier->add('/web/js/site/mailbox.js');
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -62,8 +62,8 @@ echo "var role = '". $role . "';\n";
|
||||||
echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
|
echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
|
||||||
?>
|
?>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/site/quarantine.js"></script>
|
|
||||||
<?php
|
<?php
|
||||||
|
$js_minifier->add('/web/js/site/quarantine.js');
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
||||||
} else {
|
} else {
|
||||||
header('Location: /');
|
header('Location: /');
|
||||||
|
|
|
@ -412,7 +412,7 @@ elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == '
|
||||||
</div>
|
</div>
|
||||||
<form class="form-inline" data-id="add_wl_policy_mailbox">
|
<form class="form-inline" data-id="add_wl_policy_mailbox">
|
||||||
<div class="input-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">
|
<div class="input-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">
|
||||||
<input type="text" class="form-control" name="object_from" id="object_from" placeholder="*@example.org" required>
|
<input type="text" class="form-control" name="object_from" placeholder="*@example.org" required>
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-default" data-action="add_item" data-id="add_wl_policy_mailbox" data-api-url='add/mailbox-policy' data-api-attr='{"username":<?= json_encode($username); ?>,"object_list":"wl"}' href="#"><span class="glyphicon glyphicon-plus"></span> <?=$lang['user']['spamfilter_table_add'];?></button>
|
<button class="btn btn-default" data-action="add_item" data-id="add_wl_policy_mailbox" data-api-url='add/mailbox-policy' data-api-attr='{"username":<?= json_encode($username); ?>,"object_list":"wl"}' href="#"><span class="glyphicon glyphicon-plus"></span> <?=$lang['user']['spamfilter_table_add'];?></button>
|
||||||
</span>
|
</span>
|
||||||
|
@ -435,7 +435,7 @@ elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == '
|
||||||
</div>
|
</div>
|
||||||
<form class="form-inline" data-id="add_bl_policy_mailbox">
|
<form class="form-inline" data-id="add_bl_policy_mailbox">
|
||||||
<div class="input-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">
|
<div class="input-group" data-acl="<?=$_SESSION['acl']['spam_policy'];?>">
|
||||||
<input type="text" class="form-control" name="object_from" id="object_from" placeholder="*@example.org" required>
|
<input type="text" class="form-control" name="object_from" placeholder="*@example.org" required>
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-default" data-action="add_item" data-id="add_bl_policy_mailbox" data-api-url='add/mailbox-policy' data-api-attr='{"username":<?= json_encode($username); ?>,"object_list":"bl"}' href="#"><span class="glyphicon glyphicon-plus"></span> <?=$lang['user']['spamfilter_table_add'];?></button>
|
<button class="btn btn-default" data-action="add_item" data-id="add_bl_policy_mailbox" data-api-url='add/mailbox-policy' data-api-attr='{"username":<?= json_encode($username); ?>,"object_list":"bl"}' href="#"><span class="glyphicon glyphicon-plus"></span> <?=$lang['user']['spamfilter_table_add'];?></button>
|
||||||
</span>
|
</span>
|
||||||
|
@ -485,9 +485,8 @@ echo "var mailcow_cc_username = '". $_SESSION['mailcow_cc_username'] . "';\n";
|
||||||
echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
|
echo "var pagination_size = '". $PAGINATION_SIZE . "';\n";
|
||||||
?>
|
?>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/footable.min.js"></script>
|
|
||||||
<script src="/js/user.js"></script>
|
|
||||||
<?php
|
<?php
|
||||||
|
$js_minifier->add('/web/js/site/user.js');
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue