From 728ccdde9d2d0c726abab0fa9efa6f0ee05984ac Mon Sep 17 00:00:00 2001 From: Robin Daugherty Date: Wed, 4 Nov 2020 13:46:04 -0500 Subject: [PATCH 1/2] If the user ever used the console, hide the hint --- lib/better_errors/templates/main.erb | 18 +++++++++++++++++- lib/better_errors/templates/variable_info.erb | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/better_errors/templates/main.erb b/lib/better_errors/templates/main.erb index c7c8c6a8..1fe049ce 100644 --- a/lib/better_errors/templates/main.erb +++ b/lib/better_errors/templates/main.erb @@ -849,15 +849,31 @@ this.inputElement = this.container.querySelector("input"); this.outputElement = this.container.querySelector("pre"); + this.hasUsedConsole = document.cookie.split('; ').find(function(cookie) { + return cookie.startsWith('BetterErrors-has-used-console='); + }); + if (this.hasUsedConsole) { + this.hideConsoleHint(); + } + var self = this; this.inputElement.onkeydown = function(ev) { self.onKeyDown(ev); + if (!self.hasUsedConsole) { + self.hideConsoleHint(); + self.hasUsedConsole = true; + document.cookie = "BetterErrors-has-used-console=true;path=/;max-age=31536000;samesite" + } }; this.setPrompt(">>"); REPL.all[this.index] = this; - } + }; + + REPL.prototype.hideConsoleHint = function() { + document.querySelector('#live-shell-hint').style["display"] = "none"; + }; REPL.prototype.focus = function() { this.inputElement.focus(); diff --git a/lib/better_errors/templates/variable_info.erb b/lib/better_errors/templates/variable_info.erb index 24f21cd5..8b9c61bd 100644 --- a/lib/better_errors/templates/variable_info.erb +++ b/lib/better_errors/templates/variable_info.erb @@ -25,7 +25,7 @@ <% if BetterErrors.binding_of_caller_available? && @frame.frame_binding %> -
+
This is a live shell. Type in here.
From a5293dfdbd5e414e27cf19d1a69f5500f033b744 Mon Sep 17 00:00:00 2001 From: Robin Daugherty Date: Wed, 4 Nov 2020 13:46:19 -0500 Subject: [PATCH 2/2] Remove divider line between variable types --- lib/better_errors/templates/main.erb | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/better_errors/templates/main.erb b/lib/better_errors/templates/main.erb index 1fe049ce..5da0c530 100644 --- a/lib/better_errors/templates/main.erb +++ b/lib/better_errors/templates/main.erb @@ -611,17 +611,6 @@ margin: 10px 0; } - .sub:before { - content: ''; - display: block; - width: 100%; - height: 4px; - - border-radius: 2px; - background: rgba(0, 150, 200, 0.05); - box-shadow: 1px 1px 0 rgba(255, 255, 255, 0.7), inset 0 0 0 1px rgba(0, 0, 0, 0.04), inset 2px 2px 2px rgba(0, 0, 0, 0.07); - } - .sub h3 { color: #39a; font-size: 1.1em;