Archaic Word Converter

I created a program that will take the text on a webpage and replace any archaic words with their modern equivalents (e.g. “thee” –> “you”). The program runs in your web browser. I developed the program as a favour for a teacher of Biblical Greek, so it is designed to work on the BibleGateway website, but a web developer could easily tweak it to run on other websites.

In order to run the program, you have to download a browser extension such as Greasemonkey, Tampermonkey, or Violentmonkey. These extensions allow for userscripts, i.e. custom programs that run on the browser on selected webpages. I developed this extension on Violentmonkey specifically.

Once the extension is downloaded, you have to enable it, open its settings dashboard, and then click on the + button on screen to add a new script. Click ctrl+A and then backspace to delete the existing //==UserScript== metadata block, and copy-paste the following code in its place:

// ==UserScript==
// @name        BibleGateway Archaic Word Converter
// @namespace   Violentmonkey Scripts
// @match       *://*biblegateway.com/*
// @grant       none
// @version     1.0
// @author      Nick Prior
// @description Convert archaic words to modern ones on BibleGateway. 2025-04-20, 6:24:00 p.m.
// ==/UserScript==
// Define a mapping of archaic words to modern equivalents
const archaicToModern = {
    "ye": "you",
    "thee": "you",
    "thou": "you",
    "thy": "your",
    "thine": "yours",
    "art": "are",
    "hast": "have",
    "dost": "do",
    "wouldst": "would",
    "couldst": "could",
    "shouldst": "should",
    "ere": "before",
    "naught": "nothing",
    "whence": "from where",
    "wherefore": "why",
    "oft": "often",
    "fain": "gladly",
    "alack": "alas",
    "forsooth": "indeed",
    "hither": "here",
    "thither": "there",
    "yonder": "over there",
    "tis": "it is",
    "twas": "it was",
    "wilt": "will",
    "wot": "know",
    "sith": "since",
    "quoth": "said",
    "hath": "has",
    "verily": "truly",
    "doth": "does",
    "hadst": "had",
    "lo": "look",
    "saith": "says"
};

let originalText = '';
let modifiedText = '';
let showOriginal = false;
let showUnderline = true;

// Function to preserve the case of the matched word
function preserveCase(original, modern) {
    if (original === original.toUpperCase()) {
        return modern.toUpperCase();
    } else if (original === original.toLowerCase()) {
        return modern.toLowerCase();
    } else if (original[0] === original[0].toUpperCase()) {
        return modern.charAt(0).toUpperCase() + modern.slice(1);
    }
    return modern; // Default case (mixed case)
}

// Function to replace archaic words in a given text
function replaceArchaicWords(text) {
    const regex = new RegExp(`\\b(${Object.keys(archaicToModern).join('|')})\\b`, 'gi');

    return text.replace(regex, (matched) => {
        const modernWord = archaicToModern[matched.toLowerCase()];
        const preservedWord = preserveCase(matched, modernWord);
        return `<span class="archaic-word" title="${matched}">${preservedWord}</span>`;
    });
}

// Function to process the entire document
function processDocument() {
    originalText = document.querySelector(".passage-content").innerHTML;/*document.body.innerHTML;*/
    console.log(originalText);
    modifiedText = replaceArchaicWords(originalText);
    updateText();
}

// Function to update the displayed text based on the toggle state
function updateText() {
    const bodyText = showOriginal ? originalText : modifiedText;
    /*document.body.innerHTML*/
  document.querySelector(".passage-content").innerHTML = bodyText;

    // Recreate the settings panel after updating the text
    createSettingsPanel();

    // Add CSS for the dashed underline if enabled
    if (showUnderline) {
        const style = document.createElement('style');
        style.innerHTML = `
            .archaic-word {
                text-decoration: underline dashed grey;
                cursor: pointer;
            }
            .archaic-word:hover {
                text-decoration: underline solid grey;
            }
        `;
        document.head.appendChild(style);
    } else {
        // Remove the underline style if disabled
        const archaicWords = document.querySelectorAll('.archaic-word');
    archaicWords.forEach(word => {
        word.style.textDecoration = 'none'; // Remove underline
    });
    }
}

// Function to create the settings panel
function createSettingsPanel() {
    // Check if the panel already exists
    let panel = document.getElementById('settings-panel');
    if (!panel) {
        panel = document.createElement('div');
        panel.id = 'settings-panel';
        panel.style.position = 'fixed';
        panel.style.bottom = '20px';
        panel.style.right = '20px';
        panel.style.backgroundColor = 'white';
        panel.style.border = '1px solid #ccc';
        panel.style.padding = '10px';
        panel.style.boxShadow = '0 2px 10px rgba(0, 0, 0, 0.1)';
        panel.style.zIndex = '1000';

        const toggleOriginal = document.createElement('label');
      toggleOriginal.innerHTML = `<p>Archaic Word Converter</p>
            <input type="checkbox" id="toggleOriginal" />
            Show Original Text
        `;
        toggleOriginal.style.display = 'block';
        toggleOriginal.style.marginBottom = '10px';
        toggleOriginal.querySelector('input').checked = showOriginal; // Set initial state
        toggleOriginal.onclick = () => {
            /*showOriginal = toggleOriginal.querySelector('input').checked;*/
            if (toggleOriginal.querySelector('input').checked) {
              showOriginal = true;
            } else {
              showOriginal = false;
            }
            updateText();
        };

        const toggleUnderline = document.createElement('label');
        toggleUnderline.innerHTML = `
            <input type="checkbox" id="toggleUnderline" checked />
            Show Underline
        `;
        toggleUnderline.style.display = 'block';
        toggleUnderline.querySelector('input').checked = showUnderline; // Set initial state
        toggleUnderline.onclick = () => {
            showUnderline = toggleUnderline.querySelector('input').checked;
            updateText();
        };

        panel.appendChild(toggleOriginal);
        panel.appendChild(toggleUnderline);
        document.body.appendChild(panel);
    }
}

// Run the function to process the document and create the settings panel
processDocument();
createSettingsPanel();

Then save and close the script. You may need to click a toggle button beside the script in the extension’s settings in order to activate it. You can read through the relevant extension’s user guide if you run into any difficulty with these steps.

(Note: if you have trouble following this process, please contact me and I can send you a video showing the steps.)

Result:

Example image showing the Archaic Word Converter settings panel in the bottom-right corner.
The modernized words in the text (left side) are underlined in grey.
If you hover your mouse over the words, it shows their original, archaic form.

Adding additional words to the program

If you want to add additional pairs of words to the program, follow these steps:

  1. Open up the extension’s settings dashboard;
  2. Click on the <> button to edit the script;
  3. Click at the end of the line that says “const archaicToModern = {” and then press enter on your keyboard to add a line break;
  4. Press tab on your keyboard (if needed) to indent to the same level as the other words. This isn’t strictly necessary, because whitespace doesn’t do anything in JavaScript, but it keeps it looking nice and easy to edit in the future.
  5. Write in the text “old”: “new”, (including the comma and the quotation marks) and replace the word “old” with the corresponding archaic word (e.g. “lo”) and “new” with the corresponding modern word (e.g. “look”). For example: “lo”: “look”,.
  6. Save and close the extension. (Start again from step 1 to add additional words.)

Note: It is not advisable to manually add words to this list.

I used the following Linux command to search through eBible’s HTML version of the YLT:

grep -o -r '\b\w*eth\b' * | awk -F: '{print $2}' | sort | uniq

This revealed that there are a whopping 631 unique words in the YLT ending in -eth. Although some of these are proper nouns (e.g. “Remeth”), the majority are third-person singular verbs. Similarly, there are 247 unique words ending in -est; some of which are superlatives like “youngest”, but many of which are second-person singular verbs. (The KJV, by contrast, produces 793 and 367 matches, respectively.) I haven’t added all these words to the extension at this time — just the most common ones — but I may add them later. The process of finding and adding close to 1000 words is the kind of task that should be handled by a programmer.

There is also the question of what to do with archaic nouns like “murrain” (i.e. “disease”). I have left these out of the converter and have focused instead on verbs, but one could very well do things the other way around, or could target both categories.

Notes for web developers:

There are two things that would need to be tweaked to make this converter run on other websites:

  1. The @match key in the userscript metadata block, which specifies the website(s) that this program runs in;
  2. The “.passage-content” parameter, which would need to change to whatever selector is relevant to the website(s) that you want it to run in. The .passage-content class is what BibleGateway uses to identify the main text section of its page, but different websites will identify their main text section in different ways.