Skip to content

Commit

Permalink
Include JS notice at the top if style is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDaugherty committed Dec 11, 2020
1 parent 855d40a commit b9d9ab7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/better_errors/templates/main.erb
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@
* Display area
* --------------------------------------------------------------------- */

.no-javascript-notice {
p.no-javascript-notice {
margin-bottom: 1em;
padding: 1em;
border: 2px solid #e00;
Expand Down Expand Up @@ -770,7 +770,7 @@

<p class='no-inline-style-notice'>
<strong>
Better Errors can't apply inline style,
Better Errors can't apply inline style<span class='no-javascript-notice'> (or run Javascript)</span>,
possibly because you have a Content Security Policy along with Turbolinks.
But you can
<a href='/__better_errors' target="_blank">open the interactive console in a new tab/window</a>.
Expand Down Expand Up @@ -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("<", "&lt;").inspect %> + "/__better_errors/" + OID + "/" + method, true);
Expand Down

0 comments on commit b9d9ab7

Please sign in to comment.