mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2025-12-23 22:37:53 -05:00
Merge pull request #4480 from IgorA100/patch-545508
Fix: With "bfcache," always refresh the page without analyzing the content height.
This commit is contained in:
@@ -2088,22 +2088,22 @@ function initPageGeneral() {
|
|||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
// https://web.dev/articles/bfcache Firefox has a peculiar behavior of caching the previous page.
|
// https://web.dev/articles/bfcache Firefox has a peculiar behavior of caching the previous page.
|
||||||
|
// The problem also occurs on some Linux (Chromium) and Android (Chrome) devices.
|
||||||
window.addEventListener('pageshow', (event) => {
|
window.addEventListener('pageshow', (event) => {
|
||||||
if (event.persisted) {
|
if (event.persisted) {
|
||||||
// Do any checks and updates to the page
|
// Do any checks and updates to the page
|
||||||
if (mainContentJ[0].clientHeight < 1) {
|
window.location.reload( true );
|
||||||
window.location.reload( true );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('beforeunload', function addListenerGlobalBeforeunload(event) {
|
function addListenerGlobalBeforeunload(event) {
|
||||||
|
//window.removeEventListener('beforeunload', addListenerGlobalBeforeunload);
|
||||||
//event.preventDefault();
|
//event.preventDefault();
|
||||||
if (navbar_type == 'left') {
|
if (navbar_type == 'left') {
|
||||||
closeMbExtruder(updateCookie = true);
|
closeMbExtruder(updateCookie = true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainContentJ) {
|
if (mainContent) {
|
||||||
if (mainContentJ.css('display') == 'flex') {
|
if (mainContentJ.css('display') == 'flex') {
|
||||||
// If flex-grow is set to a value > 0 then "height" will be ignored!
|
// If flex-grow is set to a value > 0 then "height" will be ignored!
|
||||||
mainContentJ.css({flex: "0 1 auto"});
|
mainContentJ.css({flex: "0 1 auto"});
|
||||||
@@ -2112,14 +2112,13 @@ function initPageGeneral() {
|
|||||||
mainContentJ.css({display: "none"});
|
mainContentJ.css({display: "none"});
|
||||||
} else {
|
} else {
|
||||||
mainContentJ.animate({height: 0}, 300, function rollupBeforeunloadPage() {
|
mainContentJ.animate({height: 0}, 300, function rollupBeforeunloadPage() {
|
||||||
const btnCollapse = $j('body').find('#btn-collapse');
|
|
||||||
if (btnCollapse.length) btnCollapse.css({display: "none"});
|
|
||||||
mainContentJ.css({display: "none"});
|
mainContentJ.css({display: "none"});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//event.returnValue = '';
|
//event.returnValue = '';
|
||||||
});
|
}
|
||||||
|
window.addEventListener('beforeunload', addListenerGlobalBeforeunload);
|
||||||
|
|
||||||
document.querySelectorAll('[id ^= "controlMute"]').forEach(function(el) {
|
document.querySelectorAll('[id ^= "controlMute"]').forEach(function(el) {
|
||||||
el.addEventListener("click", function clickControlMute(event) {
|
el.addEventListener("click", function clickControlMute(event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user