Merge pull request #80 from narspt/narspt-patch-2

dashboard: avoid page scroll to top on reloads
This commit is contained in:
LX1IQ 2018-02-03 07:13:00 +01:00 committed by GitHub
commit 14f00b9711
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 8 deletions

View File

@ -97,12 +97,19 @@ else {
<script>
var PageRefresh;
function ReloadPage() {
function ReloadPage() {';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
echo '
document.location.href = "./index.php';
if (isset($_GET['show'])) {
echo '?show='.$_GET['show'];
if (isset($_GET['show'])) {
echo '?show='.$_GET['show'];
}
echo '";';
} else {
echo '
document.location.reload();';
}
echo '";
echo '
}';
if (!isset($_GET['show']) || (($_GET['show'] != 'liveircddb') && ($_GET['show'] != 'reflectors') && ($_GET['show'] != 'interlinks'))) {

View File

@ -107,21 +107,32 @@ if ($CallingHome['Active']) {
if ($PageOptions['PageRefreshActive']) {
echo '
<script>
var PageRefresh;
function ReloadPage() {
function ReloadPage() {';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
echo '
document.location.href = "./index.php';
if (isset($_GET['show'])) {
if (isset($_GET['show'])) {
echo '?show=' . $_GET['show'];
}
echo '";';
} else {
echo '
document.location.reload();';
}
echo '";
echo '
}';
if (!isset($_GET['show']) || (($_GET['show'] != 'liveircddb') && ($_GET['show'] != 'reflectors') && ($_GET['show'] != 'interlinks'))) {
echo '
setTimeout(ReloadPage, ' . $PageOptions['PageRefreshDelay'] . ');';
PageRefresh = setTimeout(ReloadPage, ' . $PageOptions['PageRefreshDelay'] . ');';
}
echo '
function SuspendPageRefresh() {
clearTimeout(PageRefresh);
}
</script>';
}
if (!isset($_GET['show'])) $_GET['show'] = "";