Skip to content

Commit b9d9ab7

Browse files
Include JS notice at the top if style is unavailable
1 parent 855d40a commit b9d9ab7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/better_errors/templates/main.erb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@
420420
* Display area
421421
* --------------------------------------------------------------------- */
422422

423-
.no-javascript-notice {
423+
p.no-javascript-notice {
424424
margin-bottom: 1em;
425425
padding: 1em;
426426
border: 2px solid #e00;
@@ -770,7 +770,7 @@
770770

771771
<p class='no-inline-style-notice'>
772772
<strong>
773-
Better Errors can't apply inline style,
773+
Better Errors can't apply inline style<span class='no-javascript-notice'> (or run Javascript)</span>,
774774
possibly because you have a Content Security Policy along with Turbolinks.
775775
But you can
776776
<a href='/__better_errors' target="_blank">open the interactive console in a new tab/window</a>.
@@ -850,6 +850,11 @@
850850
document.querySelector('body').classList.remove("better-errors-javascript-not-loaded");
851851
document.querySelector('body').classList.add("better-errors-javascript-loaded");
852852

853+
var noJSNotices = document.querySelectorAll('.no-javascript-notice');
854+
for(var i = 0; i < noJSNotices.length; i++) {
855+
noJSNotices[i].remove();
856+
}
857+
853858
function apiCall(method, opts, cb) {
854859
var req = new XMLHttpRequest();
855860
req.open("POST", "//" + window.location.host + <%== uri_prefix.gsub("<", "&lt;").inspect %> + "/__better_errors/" + OID + "/" + method, true);

0 commit comments

Comments
 (0)