From bc810fb9d0114455f2307f0f2bfa29a4106763a8 Mon Sep 17 00:00:00 2001 From: binaryDiv Date: Tue, 16 Oct 2018 23:03:04 +0200 Subject: [PATCH] Content script finds textareas --- content_scripts/fairlang.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/content_scripts/fairlang.js b/content_scripts/fairlang.js index d53eb92..a577c7b 100644 --- a/content_scripts/fairlang.js +++ b/content_scripts/fairlang.js @@ -1,4 +1,19 @@ -// Example code, taken from -// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension +// --------------------------------- +// Content script to be run on pages +// --------------------------------- -document.body.style.border = "5px solid red"; +(function() { + // Only run this script once + if (window.hasRun) { + return; + } + window.hasRun = true; + + // Search for all text areas + document.querySelectorAll("textarea").forEach(function(textarea) { + // Do something with it... + console.log(textarea); + textarea.style.border = "2px solid red"; + }); + +})();