diff --git a/system/Debug/Toolbar/Views/toolbar.tpl.php b/system/Debug/Toolbar/Views/toolbar.tpl.php index 0768f62915bb..b86baba23336 100644 --- a/system/Debug/Toolbar/Views/toolbar.tpl.php +++ b/system/Debug/Toolbar/Views/toolbar.tpl.php @@ -28,6 +28,7 @@
diff --git a/system/Debug/Toolbar/Views/toolbarstandalone.js b/system/Debug/Toolbar/Views/toolbarstandalone.js new file mode 100644 index 000000000000..f4a71d5463a7 --- /dev/null +++ b/system/Debug/Toolbar/Views/toolbarstandalone.js @@ -0,0 +1,69 @@ +/* + * Bootstrap for standalone Debug Toolbar pages (?debugbar_time=...). + */ + +if (! document.getElementById('debugbar_loader')) { + if (typeof loadDoc !== 'function') { + window.loadDoc = function (time) { + if (isNaN(time)) { + return; + } + + window.location.href = ciSiteURL + '?debugbar_time=' + time; + }; + } + + (function () { + function ensureToolbarContainer(icon, toolbar) { + let toolbarContainer = document.getElementById('toolbarContainer'); + + if (toolbarContainer) { + return; + } + + toolbarContainer = document.createElement('div'); + toolbarContainer.setAttribute('id', 'toolbarContainer'); + + if (icon) { + toolbarContainer.appendChild(icon); + } + + if (toolbar) { + toolbarContainer.appendChild(toolbar); + } + + document.body.appendChild(toolbarContainer); + } + + function initStandaloneToolbar() { + if (typeof ciDebugBar !== 'object') { + return; + } + + const icon = document.getElementById('debug-icon'); + const toolbar = document.getElementById('debug-bar'); + + if (! toolbar || ! icon) { + return; + } + + const currentTime = new URLSearchParams(window.location.search).get('debugbar_time'); + + if (currentTime && ! isNaN(currentTime)) { + if (! localStorage.getItem('debugbar-time')) { + localStorage.setItem('debugbar-time', currentTime); + } + localStorage.setItem('debugbar-time-new', currentTime); + } + + ensureToolbarContainer(icon, toolbar); + ciDebugBar.init(); + } + + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', initStandaloneToolbar, false); + } else { + initStandaloneToolbar(); + } + })(); +} diff --git a/user_guide_src/source/changelogs/v4.7.1.rst b/user_guide_src/source/changelogs/v4.7.1.rst index 8a94a731a413..45b8da4c0614 100644 --- a/user_guide_src/source/changelogs/v4.7.1.rst +++ b/user_guide_src/source/changelogs/v4.7.1.rst @@ -34,6 +34,7 @@ Bugs Fixed - **ContentSecurityPolicy:** Fixed a bug where ``generateNonces()`` produces corrupted JSON responses by replacing CSP nonce placeholders with unescaped double quotes. The method now automatically JSON-escapes nonce attributes when the response Content-Type is JSON. - **Session:** Fixed a bug in ``MemcachedHandler`` where the constructor incorrectly threw an exception when ``savePath`` was not empty. +- **Toolbar:** Fixed a bug where the standalone toolbar page loaded from ``?debugbar_time=...`` was not interactive. See the repo's `CHANGELOG.md `_