From 6db393f63dbfc617e55076459baeefd9cf98c786 Mon Sep 17 00:00:00 2001 From: Leon Date: Mon, 3 Jun 2024 11:15:33 +0200 Subject: [PATCH] Add Turbo Drive enabled status to the info tab --- src/components/detail_panel.js | 25 ++++++++++++++++++++----- src/content.js | 2 +- src/inject.js | 2 ++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/components/detail_panel.js b/src/components/detail_panel.js index 8e2c1e7..566438b 100644 --- a/src/components/detail_panel.js +++ b/src/components/detail_panel.js @@ -306,14 +306,29 @@ export default class DetailPanel { Turbo Frames: ${document.querySelectorAll("turbo-frame").length} + ${ + typeof this.devTool.turboDetails.turboDriveEnabled === "boolean" + ? ` +
+ Turbo Drive: + ${this.devTool.turboDetails.turboDriveEnabled ? "On" : "Off"} +
+ ` + : ` +
+ Turbo Drive: + - +
+ ` + } ${ getMetaContent("turbo-prefetch") === "false" ? ` -
- Link Prefetch: - Off -
- ` +
+ Link Prefetch: + Off +
+ ` : "" }
diff --git a/src/content.js b/src/content.js index cb3598a..3ff59a7 100644 --- a/src/content.js +++ b/src/content.js @@ -121,7 +121,7 @@ const injectedScriptMessageHandler = (event) => { } break case "turboDetails": - detailPanel.turboDetails = event.data.details + devTool.turboDetails = event.data.details renderDetailPanel() break } diff --git a/src/inject.js b/src/inject.js index a05bae6..e0711f0 100644 --- a/src/inject.js +++ b/src/inject.js @@ -26,3 +26,5 @@ const events = ["DOMContentLoaded", "turbolinks:load", "turbo:load", "turbo:fram events.forEach((event) => { document.addEventListener(event, sendWindowDetails) }) + +sendWindowDetails()