Skip to content

Commit f985561

Browse files
authored
Rename toolbar loader to be a regular JS file
* Rename toolbar loader to be a regular JS file * Use `str_replace` instead of `window.appUrl`
1 parent ed23c34 commit f985561

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

system/Debug/Toolbar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,9 @@ public function respond()
435435
header('Content-Type: application/javascript');
436436

437437
ob_start();
438-
include $this->config->viewsPath . 'toolbarloader.js.php';
438+
include $this->config->viewsPath . 'toolbarloader.js';
439439
$output = ob_get_clean();
440-
$output = substr($output, 8, -10); // trim the script tags
440+
$output = str_replace('{url}', rtrim(site_url(), '/'), $output);
441441
echo $output;
442442

443443
exit;

system/Debug/Toolbar/Views/toolbarloader.js.php renamed to system/Debug/Toolbar/Views/toolbarloader.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
<?php if (ENVIRONMENT === 'testing') {
2-
return;
3-
} ?>
4-
<script>
51
document.addEventListener('DOMContentLoaded', loadDoc, false);
62

73
function loadDoc(time) {
@@ -12,7 +8,7 @@ function loadDoc(time) {
128

139
localStorage.setItem('debugbar-time-new', time);
1410

15-
let url = "<?= rtrim(site_url(), '/') ?>";
11+
let url = '{url}';
1612
let xhttp = new XMLHttpRequest();
1713

1814
xhttp.onreadystatechange = function() {
@@ -89,4 +85,3 @@ function newXHR() {
8985
}
9086

9187
window.XMLHttpRequest = newXHR;
92-
</script>

0 commit comments

Comments
 (0)