-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwatermark.js
30 lines (22 loc) · 1 KB
/
watermark.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
chrome.storage.local.get({ domains: defaultDomainList, text: defaultWatermarkText }, ({ domains, text }) => {
const textToRepeat = text;
const spacingCharacters = " ";
const timesToRepeatText = 100;
(function main() {
if (!domains.includes(window.location.hostname)) return;
attachStylesToDom();
const overlay = document.createElement("div");
overlay.setAttribute("id", "domain-watermarker-overlay");
overlay.dataset.text = (textToRepeat + spacingCharacters).repeat(timesToRepeatText);
document.body.appendChild(overlay);
})();
function attachStylesToDom() {
const head = document.getElementsByTagName("head")[0];
const link = document.createElement("link");
const url = chrome.runtime.getURL("watermark.css");
link.setAttribute("rel", "stylesheet");
link.setAttribute("type", "text/css");
link.setAttribute("href", url);
head.appendChild(link);
}
});