-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.js
More file actions
20 lines (17 loc) · 740 Bytes
/
compose.js
File metadata and controls
20 lines (17 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
let bs = document.body.style;
let isHTML = !((bs.whiteSpace === 'pre-wrap') && (bs.fontFamily === 'monospace'));
if (isHTML) {
let marker_id = '#CustomCSS-add-on-marker';
let style_elements = document.head.getElementsByTagName('style');
let max = style_elements.length;
for (let i=max-1; i >=0 ; i--)
if (style_elements[i].textContent.startsWith(marker_id))
document.head.removeChild(style_elements[i]);
function setCustomCSS(result) {
let style = document.createElement("style");
style.textContent = marker_id + '{}\n' + result.custom_css;
document.head.appendChild(style);
}
let getting = browser.storage.local.get('custom_css');
getting.then(setCustomCSS)
}