This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
help with chrome extention
Post Body

this is my first chrome extention project and Im having trouble getting it to work. Im totally lost

this is my manifest.json

{
  "manifest_version": 3,
  "name": "Bionic Reading Extension",
  "version": "1.0",
  "permissions": ["activeTab"],
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["content.js"]
    }
  ]
}

this is content.js

try {
document.addEventListener('DOMContentLoaded', () => {

  console.log('Content script loaded and running.');  // This line is for debugging

  function getBoldLength(word) {
    let boldLength = 2;
    if (word.length > 6) {
      boldLength = 4;
    }
    if (word.length > 10) {
      boldLength = 5;
    }
    return boldLength;
  }

  function makeTextBionic(text) {
    const words = text.split(' ');
    return words.map((word) => {
      const boldLength = getBoldLength(word);
      const boldPart = word.substr(0, boldLength);
      const normalPart = word.substr(boldLength);
      return `<b>${boldPart}</b>${normalPart}`;
    }).join(' ');
  }

  function processNode(node) {
    if (node.nodeType === Node.TEXT_NODE) {
      node.parentElement.innerHTML = makeTextBionic(node.nodeValue);
    } else if (node.nodeType === Node.ELEMENT_NODE) {
      Array.from(node.childNodes).forEach(processNode);
    }
  }

  document.body.innerHTML = makeTextBionic(document.body.innerText);
  console.log('Bionic Reading Script Loaded');
});
} catch (error) {
  console.error(error); 
}

the extention is supposed to take the text from a page and print the first few letters in bold. nothing is happening

Author
Account Strength
40%
Account Age
1 year
Verified Email
Yes
Verified Flair
No
Total Karma
326
Link Karma
307
Comment Karma
19
Profile updated: 1 day ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago