Created
February 10, 2023 12:54
-
-
Save messagetobala/4321ad2725df6df181e765a9e8946a37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let FILTERED_URLS = 'filtered_urls' | |
function modifyContent() { | |
document.body.textContent = "" | |
let bodyDiv = document.createElement('div') | |
bodyDiv.setAttribute("class", "watchdog_body") | |
let headerSection = document.createElement('section') | |
headerSection.setAttribute("class", "watchdog_header_section") | |
let headerPara_1 = document.createElement('p') | |
headerPara_1.setAttribute("class", "watchdog_para") | |
headerPara_1.textContent = 'A slight change in your daily habits can guide your life to a very different destination.' | |
let headerPara_2 = document.createElement('p') | |
headerPara_2.setAttribute("class", "watchdog_para") | |
headerPara_2.textContent = '- James Clear' | |
headerSection.appendChild(headerPara_1) | |
headerSection.appendChild(headerPara_2) | |
bodyDiv.appendChild(headerSection) | |
document.body.appendChild(bodyDiv) | |
} | |
function getHostname() { | |
return new URL(window.location.href).hostname | |
} | |
browser.storage.sync.get(FILTERED_URLS).then(function(items) { | |
if (items.hasOwnProperty(FILTERED_URLS) && | |
items[FILTERED_URLS].includes(getHostname())) { | |
modifyContent(); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment