From b9d9ab7ec103ba15a3d302b7539c8b0bd14598db Mon Sep 17 00:00:00 2001 From: Robin Daugherty Date: Fri, 11 Dec 2020 13:56:36 -0500 Subject: [PATCH] Include JS notice at the top if style is unavailable --- lib/better_errors/templates/main.erb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/better_errors/templates/main.erb b/lib/better_errors/templates/main.erb index 136e8a67..5c1c71dd 100644 --- a/lib/better_errors/templates/main.erb +++ b/lib/better_errors/templates/main.erb @@ -420,7 +420,7 @@ * Display area * --------------------------------------------------------------------- */ - .no-javascript-notice { + p.no-javascript-notice { margin-bottom: 1em; padding: 1em; border: 2px solid #e00; @@ -770,7 +770,7 @@

- Better Errors can't apply inline style, + Better Errors can't apply inline style (or run Javascript), possibly because you have a Content Security Policy along with Turbolinks. But you can open the interactive console in a new tab/window. @@ -850,6 +850,11 @@ document.querySelector('body').classList.remove("better-errors-javascript-not-loaded"); document.querySelector('body').classList.add("better-errors-javascript-loaded"); + var noJSNotices = document.querySelectorAll('.no-javascript-notice'); + for(var i = 0; i < noJSNotices.length; i++) { + noJSNotices[i].remove(); + } + function apiCall(method, opts, cb) { var req = new XMLHttpRequest(); req.open("POST", "//" + window.location.host + <%== uri_prefix.gsub("<", "<").inspect %> + "/__better_errors/" + OID + "/" + method, true);