fix prev commit 2 redux

pull/46/head
justcool393 2022-12-04 18:02:49 -06:00
parent a80734facb
commit ad228e0d85
1 changed files with 19 additions and 19 deletions

View File

@ -885,28 +885,28 @@
const detectionDiv = document.querySelector('#detection');
const isAutoDark = getComputedStyle(detectionDiv).backgroundColor != 'rgb(255, 255, 255)';
if (!isAutoDark) {
const elements = []
{% if v.theme in THEMES_NAVBAR_WATERMARK %}
elements.add(document.getElementById('navbar'))
{% endif %}
{% if v.theme not in THEMES_EXCLUDE_WATERMARK %}
elements.add(document.getElementsByClassName('comment-section')[0])
const element = document.getElementsByClassName('comment-section')[0]);
{% else %}
const element = null;
{% endif %}
elements.forEach(() => {
if (element) {
let color = getComputedStyle(element).getPropertyValue('background-color');
color = 'rgba' + color.slice(3,-1) + ', 0.1)'
let color = getComputedStyle(element).getPropertyValue('background-color');
color = 'rgba' + color.slice(3,-1) + ', 0.1)'
const markTemplate = (name) => {
return `<svg xmlns='https://www.w3.org/2000/svg' version='1.1' width='50px' height='50px'><text transform='translate(10, 50) rotate(-45)' fill='${color}' font-size='20'>${name}</text></svg>`;
};
const base64Mark = btoa(markTemplate("{{v.id}}"));
const style = document.createElement('style');
style.innerHTML = `.actual-post:not(.deleted, .banned),.comment-section>.comment, #navbar {background-image:url("data:image/svg+xml;base64,${base64Mark}")}`;
document.getElementsByTagName('head')[0].appendChild(style);
}
});
const markTemplate = (name) => {
return `<svg xmlns='https://www.w3.org/2000/svg' version='1.1' width='50px' height='50px'><text transform='translate(10, 50) rotate(-45)' fill='${color}' font-size='20'>${name}</text></svg>`;
};
const base64Mark = btoa(markTemplate("{{v.id}}"));
{% if v.theme in THEMES_NAVBAR_WATERMARK %}
const navbarStyle = document.createElement('style');
navbarStyle.innerHtml = `#navbar {background-image:url("data:image/svg+xml;base64,${base64Mark}")}`;
document.getElementsByTagName('head')[0].appendChild(navbarStyle);
{% endif %}
if (element) {
const style = document.createElement('style');
style.innerHTML = `.actual-post:not(.deleted, .banned),.comment-section>.comment {background-image:url("data:image/svg+xml;base64,${base64Mark}")}`;
document.getElementsByTagName('head')[0].appendChild(style);
}
}
</script>
{% endif %}