relocated javascripts for better performance if disabling sections

This commit is contained in:
dg9vh 2016-10-12 20:31:36 +00:00
parent 4204ac33bd
commit 89c871dfe3
7 changed files with 62 additions and 57 deletions

View file

@ -30,4 +30,30 @@ $totalLH = count($lastHeard);
</table>
</div>
</div>
<script>
$(document).ready(function(){
var lastHeardT = $('#lastHeard').dataTable( {
"aaSorting": [[0,'desc']],
"ajax": '<?php
$protocol = "http";
if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443)
$protocol = "https";
echo $protocol."://";
$base_dir = __DIR__;// Absolute path to your installation, ex: /var/www/mywebsite
$base_dir = substr($basedir,0,strpos($basedir,"include"));
$doc_root = preg_replace("!${_SERVER['SCRIPT_NAME']}$!", '', $_SERVER['SCRIPT_FILENAME']); # ex: /var/www
echo $_SERVER['HTTP_HOST'].preg_replace("!^${doc_root}!", '', $base_dir) ?>/ajax.php?section=lastHeard',
"deferRender": true
} );
<?php
if (!isset($_GET['stoprefresh'])) {
?>
setInterval( function () {
lastHeardT.api().ajax.reload( );
}, <?php echo REFRESHAFTER * 1000 ?> );
<?php
}
?>
});
</script>

View file

@ -30,4 +30,30 @@ $totalLH = count($lastHeard);
</table>
</div>
</div>
<script>
$(document).ready(function(){
var localTxT = $('#localTx').dataTable( {
"aaSorting": [[0,'desc']],
"ajax": '<?php
$protocol = "http";
if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443)
$protocol = "https";
echo $protocol."://";
$base_dir = __DIR__; // Absolute path to your installation, ex: /var/www/mywebsite
$base_dir = substr($basedir,0,strpos($basedir,"include"));
$doc_root = preg_replace("!${_SERVER['SCRIPT_NAME']}$!", '', $_SERVER['SCRIPT_FILENAME']); # ex: /var/www
echo $_SERVER['HTTP_HOST'].preg_replace("!^${doc_root}!", '', $base_dir) ?>/ajax.php?section=localTx',
"deferRender": true
} );
<?php
if (!isset($_GET['stoprefresh'])) {
?>
setInterval( function () {
localTxT.api().ajax.reload( );
}, <?php echo REFRESHAFTER * 1000 ?> );
<?php
}
?>
});
</script>

View file

@ -25,7 +25,6 @@ function loadXMLDocSysinfo() {
xmlhttp.send();
var timeout = window.setTimeout("loadXMLDocSysinfo()", 20000);
refreshMode();
}
loadXMLDocSysinfo();
</script>

View file

@ -56,3 +56,11 @@
</table>
</div>
</div>
<script>
$(document).ready(function(){
var ysfGatewaysT = $('#ysfGateways').dataTable( {
"aaSorting": [[0,'asc']]
} );
});
</script>

View file

@ -106,60 +106,6 @@ if (!isset($_GET['stoprefresh'])) {
?>
| get your own at: <a href="https://github.com/dg9vh/MMDVMHost-Dashboard">https://github.com/dg9vh/MMDVMHost-Dashboard</a>
</div>
<script>
$(document).ready(function(){
var lastHeardT = $('#lastHeard').dataTable( {
"aaSorting": [[0,'desc']],
"ajax": '<?php
$protocol = "http";
if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443)
$protocol = "https";
echo $protocol."://";
$base_dir = __DIR__; // Absolute path to your installation, ex: /var/www/mywebsite
$doc_root = preg_replace("!${_SERVER['SCRIPT_NAME']}$!", '', $_SERVER['SCRIPT_FILENAME']); # ex: /var/www
echo $_SERVER['HTTP_HOST'].preg_replace("!^${doc_root}!", '', $base_dir) ?>/ajax.php?section=lastHeard',
"deferRender": true
} );
<?php
if (!isset($_GET['stoprefresh'])) {
?>
setInterval( function () {
lastHeardT.api().ajax.reload( );
}, <?php echo REFRESHAFTER * 1000 ?> );
<?php
}
?>
var localTxT = $('#localTx').dataTable( {
"aaSorting": [[0,'desc']],
"ajax": '<?php
$protocol = "http";
if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443)
$protocol = "https";
echo $protocol."://";
$base_dir = __DIR__; // Absolute path to your installation, ex: /var/www/mywebsite
$doc_root = preg_replace("!${_SERVER['SCRIPT_NAME']}$!", '', $_SERVER['SCRIPT_FILENAME']); # ex: /var/www
echo $_SERVER['HTTP_HOST'].preg_replace("!^${doc_root}!", '', $base_dir) ?>/ajax.php?section=localTx',
"deferRender": true
} );
<?php
if (!isset($_GET['stoprefresh'])) {
?>
setInterval( function () {
localTxT.api().ajax.reload( );
}, <?php echo REFRESHAFTER * 1000 ?> );
<?php
}
?>
var ysfGatewaysT = $('#ysfGateways').dataTable( {
"aaSorting": [[0,'asc']]
} );
});
</script>
<noscript>
For full functionality of this site it is necessary to enable JavaScript.
Here are the <a href="http://www.enable-javascript.com/" target="_blank">

View file

@ -10,7 +10,7 @@ $logLinesMMDVM = getShortMMDVMLog();
$reverseLogLinesMMDVM = $logLinesMMDVM;
array_multisort($reverseLogLinesMMDVM,SORT_DESC);
$lastHeard = getLastHeard($reverseLogLinesMMDVM, True);
$oldLastHeard = $_SESSION['lastHeard'];
//$oldLastHeard = $_SESSION['lastHeard'];
echo"<!--";
var_dump($lastHeard);
echo"-->";

View file

@ -1,3 +1,3 @@
<?php
define("VERSION", "20161012-2");
define("VERSION", "20161012-3");
?>