From 529c8bbfc580f7d817ee3b57765880480f5c2cbc Mon Sep 17 00:00:00 2001 From: John McLaughlin Date: Sun, 5 Oct 2014 08:39:42 -0700 Subject: [PATCH 1/2] fix to allow backspace in node-inspector --- content.js | 39 ++++++++++++++++++++++----------------- manifest.json | 2 +- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/content.js b/content.js index 42b306d..e958bf4 100644 --- a/content.js +++ b/content.js @@ -1,21 +1,26 @@ -$(document).keydown(function(e) { - // If backspace is pressed - if (e.which === 8) { - var active = $(document.activeElement); - - notEditable = function(element) { - var edit = element.attr('contenteditable'); + +(function () { + var isWebInspector = !!$('body#-webkit-web-inspector'); + $(document).keydown(function(e) { + // If backspace is pressed + if (e.which === 8) { + var active = $(document.activeElement); - // Ensure backspace still works on any element with contenteditable="true" - if (typeof edit !== 'undefined' && edit !== false) { - return true; - } else if (element.is('input, textarea')) { - return true; + notEditable = function(element) { + var edit = element.attr('contenteditable'); + // Ensure backspace still works on any element with contenteditable="true" + if (typeof edit !== 'undefined' && edit !== false) { + return true; + } else if (element.is('input, textarea')) { + return true; + } else if (isWebInspector && (element.attr('id') === 'console-prompt')) { + return true; + } + + return false; } - return false; + return notEditable(active); } - - return notEditable(active); - } -}); + }); +}()); diff --git a/manifest.json b/manifest.json index 6cf6b15..c8abe8d 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "BackStop", "description": "Stop Backspace returning to previous page.", - "version": "2.0.1", + "version": "2.0.2", "manifest_version" : 2, "icons": { "16": "logo16.png", From 8d5ba4101e18835a41241adb8a3508da9de315c9 Mon Sep 17 00:00:00 2001 From: John McLaughlin Date: Sun, 5 Oct 2014 08:48:14 -0700 Subject: [PATCH 2/2] Update content.js --- content.js | 1 + 1 file changed, 1 insertion(+) diff --git a/content.js b/content.js index e958bf4..b495029 100644 --- a/content.js +++ b/content.js @@ -8,6 +8,7 @@ notEditable = function(element) { var edit = element.attr('contenteditable'); + // Ensure backspace still works on any element with contenteditable="true" if (typeof edit !== 'undefined' && edit !== false) { return true;