Skip to content

Commit

Permalink
update style & js
Browse files Browse the repository at this point in the history
  • Loading branch information
YapsBridging committed Feb 10, 2024
1 parent 1a53368 commit 1f02846
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 61 deletions.
27 changes: 13 additions & 14 deletions admin/css/debug-toolbar/toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,7 @@
#ci-history.debug-bar-dblock,
#ci-vars.debug-bar-dblock,
#ci-config.debug-bar-dblock,
#ci-timeline.debug-bar-dblock
{
#ci-timeline.debug-bar-dblock {
display: block;
}

Expand Down Expand Up @@ -523,46 +522,46 @@
overflow: hidden;
}

.debug-bar-dtableRow{
.debug-bar-dtableRow {
display: table-row;
}
}

.debug-bar-dinlineBlock{
.debug-bar-dinlineBlock {
display: inline-block;
}

.debug-bar-pointer{
.debug-bar-pointer {
cursor: pointer;
}

.debug-bar-mleft4{
.debug-bar-mleft4 {
margin-left: 4px;
}

.level-0{
.debug-bar-level-0 {
--level: 0;
}

.level-1{
.debug-bar-level-1 {
--level: 1;
}

.level-2{
.debug-bar-level-2 {
--level: 2;
}

.level-3{
.debug-bar-level-3 {
--level: 3;
}

.level-4{
.debug-bar-level-4 {
--level: 4;
}

.level-5{
.debug-bar-level-5 {
--level: 5;
}

.level-6{
.debug-bar-level-6 {
--level: 6;
}
2 changes: 1 addition & 1 deletion app/Views/welcome_message.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@
<!-- SCRIPTS -->

<script {csp-script-nonce}>
document.getElementById("menuToggle").addEventListener('click',toggleMenu);
document.getElementById("menuToggle").addEventListener('click', toggleMenu);
function toggleMenu() {
var menuItems = document.getElementsByClassName('menu-item');
for (var i = 0; i < menuItems.length; i++) {
Expand Down
4 changes: 2 additions & 2 deletions system/Debug/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ protected function renderTimelineRecursive(array $rows, float $startTime, int $s
$output .= '<tr>';
}

$output .= '<td class="' . ($isChild ? 'debug-bar-width30' : '') . ' level-' . $level . '" >' . ($hasChildren || $isQuery ? '<nav></nav>' : '') . $row['name'] . '</td>';
$output .= '<td class="' . ($isChild ? 'debug-bar-width30' : '') . ' debug-bar-level-' . $level . '" >' . ($hasChildren || $isQuery ? '<nav></nav>' : '') . $row['name'] . '</td>';
$output .= '<td class="' . ($isChild ? 'debug-bar-width10' : '') . '">' . $row['component'] . '</td>';
$output .= '<td class="' . ($isChild ? 'debug-bar-width10 ' : '') . 'debug-bar-alignRight">' . number_format($row['duration'] * 1000, 2) . ' ms</td>';
$output .= "<td class='debug-bar-noverflow' colspan='{$segmentCount}'>";
Expand All @@ -228,7 +228,7 @@ protected function renderTimelineRecursive(array $rows, float $startTime, int $s
if ($isQuery) {
// Output query string if query
$output .= '<tr>';
$output .= '<td class="query-container level-' . ($level + 1) . '" >' . $row['query'] . '</td>';
$output .= '<td class="query-container debug-bar-level-' . ($level + 1) . '" >' . $row['query'] . '</td>';
$output .= '</tr>';
} else {
// Recursively render children
Expand Down
14 changes: 7 additions & 7 deletions system/Debug/Toolbar/Views/toolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -832,30 +832,30 @@
margin-left: 4px;
}

.level-0 {
.debug-bar-level-0 {
--level: 0;
}

.level-1 {
.debug-bar-level-1 {
--level: 1;
}

.level-2 {
.debug-bar-level-2 {
--level: 2;
}

.level-3 {
.debug-bar-level-3 {
--level: 3;
}

.level-4 {
.debug-bar-level-4 {
--level: 4;
}

.level-5 {
.debug-bar-level-5 {
--level: 5;
}

.level-6 {
.debug-bar-level-6 {
--level: 6;
}
70 changes: 35 additions & 35 deletions system/Debug/Toolbar/Views/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var ciDebugBar = {
var tab = ciDebugBar.readCookie("debug-bar-tab");
if (document.getElementById(tab)) {
var el = document.getElementById(tab);
ciDebugBar.switchClass(el,"debug-bar-ndisplay","debug-bar-dblock");
ciDebugBar.switchClass(el, "debug-bar-ndisplay", "debug-bar-dblock");
ciDebugBar.addClass(el, "active");
tab = document.querySelector("[data-tab=" + tab + "]");
if (tab) {
Expand All @@ -71,21 +71,21 @@ var ciDebugBar = {
var links = this.toolbar.querySelectorAll("[data-toggle]");
for (var i = 0; i < links.length; i++) {
let toggleData = links[i].getAttribute("data-toggle");
if(toggleData=="datatable"){
if (toggleData === "datatable") {

let datatable = links[i].getAttribute("data-table");
links[i].addEventListener("click", function(){
links[i].addEventListener("click", function() {
ciDebugBar.toggleDataTable(datatable)
}, true);

}else if(toggleData=="childrows"){
} else if (toggleData === "childrows") {

let child = links[i].getAttribute("data-child");
links[i].addEventListener("click", function(){
links[i].addEventListener("click", function() {
ciDebugBar.toggleChildRows(child)
}, true);

}else{
} else {
links[i].addEventListener("click", ciDebugBar.toggleRows, true);
}
}
Expand All @@ -110,7 +110,7 @@ var ciDebugBar = {
var tabs = document.querySelectorAll("#debug-bar .tab");

for (var i = 0; i < tabs.length; i++) {
ciDebugBar.switchClass(tabs[i],"debug-bar-dblock","debug-bar-ndisplay");
ciDebugBar.switchClass(tabs[i], "debug-bar-dblock", "debug-bar-ndisplay");
}

// Mark all labels as inactive
Expand All @@ -122,7 +122,7 @@ var ciDebugBar = {

// Show/hide the selected tab
if (! state) {
ciDebugBar.switchClass(tab,"debug-bar-ndisplay","debug-bar-dblock");
ciDebugBar.switchClass(tab, "debug-bar-ndisplay", "debug-bar-dblock");
ciDebugBar.addClass(this.parentNode, "active");
// Create debug-bar-tab cookie to persistent state
ciDebugBar.createCookie(
Expand Down Expand Up @@ -155,9 +155,9 @@ var ciDebugBar = {
}
},

switchClass : function(el,classFrom,classTo){
ciDebugBar.removeClass(el,classFrom);
ciDebugBar.addClass(el,classTo);
switchClass : function(el, classFrom, classTo) {
ciDebugBar.removeClass(el, classFrom);
ciDebugBar.addClass(el, classTo);
},

/**
Expand All @@ -173,10 +173,10 @@ var ciDebugBar = {
row.getAttribute("data-toggle")
);

if(target.classList.contains("debug-bar-ndisplay")) {
ciDebugBar.switchClass(target,"debug-bar-ndisplay","debug-bar-dtableRow");
}else{
ciDebugBar.switchClass(target,"debug-bar-dtableRow","debug-bar-ndisplay");
if (target.classList.contains("debug-bar-ndisplay")) {
ciDebugBar.switchClass(target, "debug-bar-ndisplay", "debug-bar-dtableRow");
} else {
ciDebugBar.switchClass(target, "debug-bar-dtableRow", "debug-bar-ndisplay");
}
}
},
Expand All @@ -192,10 +192,10 @@ var ciDebugBar = {
}

if (obj) {
if(obj.classList.contains("debug-bar-ndisplay")){
ciDebugBar.switchClass(obj,"debug-bar-ndisplay","debug-bar-dblock");
}else{
ciDebugBar.switchClass(obj,"debug-bar-dblock","debug-bar-ndisplay");
if (obj.classList.contains("debug-bar-ndisplay")) {
ciDebugBar.switchClass(obj, "debug-bar-ndisplay", "debug-bar-dblock");
} else {
ciDebugBar.switchClass(obj, "debug-bar-dblock", "debug-bar-ndisplay");
}
}
},
Expand All @@ -213,10 +213,10 @@ var ciDebugBar = {

if (par && obj) {

if(obj.classList.contains("debug-bar-ndisplay")){
ciDebugBar.removeClass(obj,"debug-bar-ndisplay");
}else{
ciDebugBar.addClass(obj,"debug-bar-ndisplay");
if (obj.classList.contains("debug-bar-ndisplay")) {
ciDebugBar.removeClass(obj, "debug-bar-ndisplay");
} else {
ciDebugBar.addClass(obj, "debug-bar-ndisplay");
}

par.classList.toggle("timeline-parent-open");
Expand All @@ -231,12 +231,12 @@ var ciDebugBar = {
toggleToolbar: function () {
var open = ! ciDebugBar.toolbar.classList.contains("debug-bar-ndisplay");

if(open){
ciDebugBar.switchClass(ciDebugBar.icon,"debug-bar-ndisplay","debug-bar-dinlineBlock");
ciDebugBar.switchClass(ciDebugBar.toolbar,"debug-bar-dinlineBlock","debug-bar-ndisplay");
}else{
ciDebugBar.switchClass(ciDebugBar.icon,"debug-bar-dinlineBlock","debug-bar-ndisplay");
ciDebugBar.switchClass(ciDebugBar.toolbar,"debug-bar-ndisplay","debug-bar-dinlineBlock");
if (open) {
ciDebugBar.switchClass(ciDebugBar.icon, "debug-bar-ndisplay", "debug-bar-dinlineBlock");
ciDebugBar.switchClass(ciDebugBar.toolbar, "debug-bar-dinlineBlock", "debug-bar-ndisplay");
} else {
ciDebugBar.switchClass(ciDebugBar.icon, "debug-bar-dinlineBlock", "debug-bar-ndisplay");
ciDebugBar.switchClass(ciDebugBar.toolbar, "debug-bar-ndisplay", "debug-bar-dinlineBlock");
}

// Remember it for other page loads on this site
Expand All @@ -255,12 +255,12 @@ var ciDebugBar = {
setToolbarState: function () {
var open = ciDebugBar.readCookie("debug-bar-state");

if(open !="open"){
ciDebugBar.switchClass(ciDebugBar.icon,"debug-bar-ndisplay","debug-bar-dinlineBlock");
ciDebugBar.switchClass(ciDebugBar.toolbar,"debug-bar-dinlineBlock","debug-bar-ndisplay");
}else{
ciDebugBar.switchClass(ciDebugBar.icon,"debug-bar-dinlineBlock","debug-bar-ndisplay");
ciDebugBar.switchClass(ciDebugBar.toolbar,"debug-bar-ndisplay","debug-bar-dinlineBlock");
if (open != "open") {
ciDebugBar.switchClass(ciDebugBar.icon, "debug-bar-ndisplay", "debug-bar-dinlineBlock");
ciDebugBar.switchClass(ciDebugBar.toolbar, "debug-bar-dinlineBlock", "debug-bar-ndisplay");
} else {
ciDebugBar.switchClass(ciDebugBar.icon, "debug-bar-dinlineBlock", "debug-bar-ndisplay");
ciDebugBar.switchClass(ciDebugBar.toolbar, "debug-bar-ndisplay", "debug-bar-dinlineBlock");
}
},

Expand Down
4 changes: 2 additions & 2 deletions system/Debug/Toolbar/Views/toolbarloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ function newXHR() {
if (h2) {
h2.innerHTML = 'History <small>You have new debug data.</small> <button id="ci-history-update">Update</button>';
document.querySelector('a[data-tab="ci-history"] > span > .badge').className += ' active';
document.getElementById('ci-history-update').addEventListener('click',function(){
document.getElementById('ci-history-update').addEventListener('click', function () {
loadDoc(debugbarTime);
},false)
}, false)
}
}
}
Expand Down

0 comments on commit 1f02846

Please sign in to comment.