mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
localized spinner support
This commit is contained in:
@@ -2093,10 +2093,10 @@ input[readonly] {
|
|||||||
#loadingSpinner {
|
#loadingSpinner {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
top: 0;
|
/* top: 0; */
|
||||||
left: 0;
|
/* left: 0; */
|
||||||
width: 100%;
|
/* width: 100%; */
|
||||||
height: 100%;
|
/* height: 100%; */
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity 0.3s ease-in-out;
|
transition: opacity 0.3s ease-in-out;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|||||||
@@ -123,7 +123,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content" style="min-height: 430px;">
|
<div class="tab-content spinnerTarget" style="min-height: 430px;">
|
||||||
|
|
||||||
<!-- tab page 1 ------------------------------------------------------------ -->
|
<!-- tab page 1 ------------------------------------------------------------ -->
|
||||||
|
|
||||||
|
|||||||
@@ -1112,38 +1112,92 @@ let animationTime = 300
|
|||||||
function showSpinner(stringKey = 'Loading') {
|
function showSpinner(stringKey = 'Loading') {
|
||||||
const text = isEmpty(stringKey) ? "Loading" : getString(stringKey || "Loading");
|
const text = isEmpty(stringKey) ? "Loading" : getString(stringKey || "Loading");
|
||||||
const spinner = $("#loadingSpinner");
|
const spinner = $("#loadingSpinner");
|
||||||
|
const target = $(".spinnerTarget").first(); // Only use the first one if multiple exist
|
||||||
if (spinner.length && spinner.is(':visible')) {
|
|
||||||
clearTimeout(spinnerTimeout);
|
|
||||||
|
|
||||||
$("#loadingSpinnerText").text(text);
|
|
||||||
spinner.addClass("visible");
|
|
||||||
|
|
||||||
spinner.fadeIn(animationTime);
|
$("#loadingSpinnerText").text(text);
|
||||||
|
|
||||||
|
if (target.length) {
|
||||||
|
// Position relative to target
|
||||||
|
const offset = target.offset();
|
||||||
|
const width = target.outerWidth();
|
||||||
|
const height = target.outerHeight();
|
||||||
|
|
||||||
|
spinner.css({
|
||||||
|
position: "absolute",
|
||||||
|
top: offset.top,
|
||||||
|
left: offset.left,
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
zIndex: 800
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
$("#loadingSpinnerText").text(text);
|
// Fullscreen fallback
|
||||||
|
spinner.css({
|
||||||
requestAnimationFrame(() => {
|
position: "fixed",
|
||||||
spinner.addClass("visible");
|
top: 0,
|
||||||
spinner.fadeIn(animationTime);
|
left: 0,
|
||||||
|
width: "100%",
|
||||||
|
height: "100%",
|
||||||
|
zIndex: 800
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
spinner.addClass("visible");
|
||||||
|
spinner.fadeIn(animationTime);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideSpinner() {
|
function hideSpinner() {
|
||||||
clearTimeout(spinnerTimeout);
|
clearTimeout(spinnerTimeout);
|
||||||
|
|
||||||
const spinner = $("#loadingSpinner");
|
const spinner = $("#loadingSpinner");
|
||||||
|
|
||||||
if (spinner.length) {
|
if (!spinner.length) return;
|
||||||
spinner.removeClass("visible");
|
|
||||||
spinner.fadeOut(animationTime);
|
|
||||||
|
|
||||||
spinnerTimeout = setTimeout(() => {
|
const target = $(".spinnerTarget").first();
|
||||||
spinner.removeClass("visible");
|
|
||||||
spinner.fadeOut(animationTime); // optional remove or hide again
|
if (target.length) {
|
||||||
}, 300);
|
// Lock position to target
|
||||||
|
const offset = target.offset();
|
||||||
|
const width = target.outerWidth();
|
||||||
|
const height = target.outerHeight();
|
||||||
|
|
||||||
|
spinner.css({
|
||||||
|
position: "absolute",
|
||||||
|
top: offset.top,
|
||||||
|
left: offset.left,
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
zIndex: 800
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Fullscreen fallback
|
||||||
|
spinner.css({
|
||||||
|
position: "fixed",
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
width: "100%",
|
||||||
|
height: "100%",
|
||||||
|
zIndex: 800
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Trigger fade-out and only remove styles AFTER fade completes AND display is none
|
||||||
|
spinner.removeClass("visible").fadeOut(animationTime, () => {
|
||||||
|
// Ensure it's really hidden before resetting styles
|
||||||
|
spinner.css({
|
||||||
|
display: "none"
|
||||||
|
});
|
||||||
|
|
||||||
|
spinner.css({
|
||||||
|
position: "",
|
||||||
|
top: "",
|
||||||
|
left: "",
|
||||||
|
width: "",
|
||||||
|
height: "",
|
||||||
|
zIndex: ""
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,10 @@
|
|||||||
|
|
||||||
<!-- Main content ---------------------------------------------------------- -->
|
<!-- Main content ---------------------------------------------------------- -->
|
||||||
<section class="content">
|
<section class="content">
|
||||||
|
|
||||||
|
<script>
|
||||||
|
showSpinner();
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@@ -143,7 +146,7 @@ $db->close();
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content spinnerTarget">
|
||||||
<div class="tab-pane active" id="tab_DBTools">
|
<div class="tab-pane active" id="tab_DBTools">
|
||||||
<div class="db_info_table">
|
<div class="db_info_table">
|
||||||
<div class="db_info_table_row">
|
<div class="db_info_table_row">
|
||||||
@@ -709,6 +712,8 @@ window.onload = function asyncFooter() {
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
hideSpinner();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
0
front/php/templates/language/it_it.json
Normal file → Executable file
0
front/php/templates/language/it_it.json
Normal file → Executable file
@@ -42,15 +42,15 @@
|
|||||||
<?= lang('Systeminfo_System');?>
|
<?= lang('Systeminfo_System');?>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a id="tabNetwork" href="#panNetwork" data-toggle="tab">
|
<a id="tabNetwork" href="#panNetwork" data-toggle="tab">
|
||||||
<i class="fa fa-sitemap fa-rotate-270"></i>
|
<i class="fa fa-sitemap fa-rotate-270"></i>
|
||||||
<span class="dev-detail-tab-name">
|
<span class="dev-detail-tab-name">
|
||||||
<?= lang('Systeminfo_Network');?>
|
<?= lang('Systeminfo_Network');?>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a id="tabStorage" href="#panStorage" data-toggle="tab">
|
<a id="tabStorage" href="#panStorage" data-toggle="tab">
|
||||||
<i class="fa fa-hdd"></i>
|
<i class="fa fa-hdd"></i>
|
||||||
@@ -61,30 +61,20 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content" style="min-height: 430px;">
|
<div class="tab-content spinnerTarget" style="min-height: 430px;">
|
||||||
|
|
||||||
<!-- tab page ------------------------------------------------------------ -->
|
|
||||||
|
|
||||||
<div class="tab-pane fade" data-php-file="systeminfoServer.php" id="panServer">
|
<div class="tab-pane fade" data-php-file="systeminfoServer.php" id="panServer">
|
||||||
<!-- PLACEHOLDER -->
|
<!-- PLACEHOLDER -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- tab page ------------------------------------------------------------ -->
|
|
||||||
|
|
||||||
<div class="tab-pane fade" data-php-file="systeminfoNetwork.php" id="panNetwork">
|
<div class="tab-pane fade" data-php-file="systeminfoNetwork.php" id="panNetwork">
|
||||||
<!-- PLACEHOLDER -->
|
<!-- PLACEHOLDER -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- tab page ------------------------------------------------------------ -->
|
|
||||||
<div class="tab-pane fade table-responsive" data-php-file="systeminfoStorage.php" id="panStorage">
|
<div class="tab-pane fade table-responsive" data-php-file="systeminfoStorage.php" id="panStorage">
|
||||||
<!-- PLACEHOLDER -->
|
<!-- PLACEHOLDER -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /.tab-content -->
|
<!-- /.tab-content -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /.nav-tabs-custom -->
|
<!-- /.nav-tabs-custom -->
|
||||||
|
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /.col -->
|
<!-- /.col -->
|
||||||
@@ -93,59 +83,22 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- /.content -->
|
<!-- /.content -->
|
||||||
<?php
|
|
||||||
require 'php/templates/footer.php';
|
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /.content-wrapper -->
|
<!-- /.content-wrapper -->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require 'php/templates/footer.php';
|
||||||
|
?>
|
||||||
|
|
||||||
<!-- ----------------------------------------------------------------------- -->
|
<!-- ----------------------------------------------------------------------- -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
// function initializeTabs () {
|
|
||||||
|
|
||||||
// key ="activeSysinfoTab"
|
|
||||||
|
|
||||||
// // Activate panel
|
|
||||||
// if(!emptyArr.includes(getCache(key)))
|
|
||||||
// {
|
|
||||||
// selectedTab = getCache(key);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $('.nav-tabs a[id='+ selectedTab +']').tab('show');
|
|
||||||
|
|
||||||
// // When changed save new current tab
|
|
||||||
// $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
|
||||||
// setCache(key, $(e.target).attr('id'))
|
|
||||||
|
|
||||||
// var target = $(e.target).attr("href") // activated tab
|
|
||||||
|
|
||||||
// if (target === '#panStorage' && !$(target).data('loaded')) {
|
|
||||||
// // Load content only once
|
|
||||||
|
|
||||||
// showSpinner();
|
|
||||||
// $(target).load('systeminfoStorage.php', function () {
|
|
||||||
// $(target).data('loaded', true);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// window.onload = function async()
|
|
||||||
// {
|
|
||||||
// initializeTabs();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
function loadTabContent(target) {
|
function loadTabContent(target) {
|
||||||
const $tab = $(target);
|
const $tab = $(target);
|
||||||
const phpFile = $tab.data('php-file');
|
const phpFile = $tab.data('php-file');
|
||||||
|
|
||||||
console.log(phpFile);
|
|
||||||
console.log(target);
|
|
||||||
console.log($tab );
|
|
||||||
|
|
||||||
|
|
||||||
if (phpFile && !$tab.data('loaded')) {
|
if (phpFile && !$tab.data('loaded')) {
|
||||||
showSpinner();
|
showSpinner();
|
||||||
@@ -164,8 +117,6 @@ function initializeTabs() {
|
|||||||
selectedTab = cached;
|
selectedTab = cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(selectedTab);
|
|
||||||
|
|
||||||
// Activate the correct tab
|
// Activate the correct tab
|
||||||
const $tabLink = $('.nav-tabs a[id="' + selectedTab + '"]');
|
const $tabLink = $('.nav-tabs a[id="' + selectedTab + '"]');
|
||||||
$tabLink.tab('show');
|
$tabLink.tab('show');
|
||||||
|
|||||||
Reference in New Issue
Block a user