From d8ba287dcdece011fcd4cd695b59432f157b092b Mon Sep 17 00:00:00 2001 From: Mariam Maarouf Date: Sun, 4 Oct 2020 13:39:23 +0200 Subject: [PATCH] Fix bug with comment boxes --- content_script.js | 34 ++++++++++++++++++---------------- manifest.json | 2 +- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/content_script.js b/content_script.js index 0179a2f..3d9ee16 100644 --- a/content_script.js +++ b/content_script.js @@ -74,23 +74,25 @@ const replaceText = (textNode, input_word, replace_value) => { function walk(node, v, p){ - // I stole this function from here: + // I stole the base to this function from here: // http://is.gd/mwZp7E - var child, next; - switch (node.nodeType){ - case 1: // Element - case 9: // Document - case 11: // Document fragment - child = node.firstChild; - while (child){ - next = child.nextSibling; - walk(child, v, p); - child = next; - } - break; - case 3: // Text node - replaceText(node, v, p); - break; + if (node.contentEditable != 'true' && node.type != 'textarea' && node.type != 'input') { + var child, next; + switch (node.nodeType){ + case 1: // Element + case 9: // Document + case 11: // Document fragment + child = node.firstChild; + while (child){ + next = child.nextSibling; + walk(child, v, p); + child = next; + } + break; + case 3: // Text node + replaceText(node, v, p); + break; + } } } diff --git a/manifest.json b/manifest.json index eae46aa..6a34d30 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "manifest_version": 2, "name": "InteractiveFics", "author": "mariamrf", - "version": "5.1.0", + "version": "5.1.1", "description": "Replaces Y/N & other variables in Reader Insert/second person fics with words of your choice.", "browser_action": { "default_title": "InteractiveFics",