check for existing canvas
This commit is contained in:
@@ -55,6 +55,11 @@ observer.observe(document.body, {
|
||||
|
||||
|
||||
function initializeCanvas() {
|
||||
if (document.getElementById('snowfallCanvas')) {
|
||||
console.warn('Canvas bereits vorhanden.');
|
||||
return;
|
||||
}
|
||||
|
||||
const container = document.querySelector('.snowfall-container');
|
||||
if (!container) {
|
||||
console.error('Error: No element with class "snowfall-container" found.');
|
||||
|
@@ -57,6 +57,11 @@ observer.observe(document.body, {
|
||||
|
||||
|
||||
function initializeCanvas() {
|
||||
if (document.getElementById('snowfallCanvas')) {
|
||||
console.warn('Canvas bereits vorhanden.');
|
||||
return;
|
||||
}
|
||||
|
||||
const container = document.querySelector('.snowstorm-container');
|
||||
if (!container) {
|
||||
console.error('Error: No element with class "snowfall-container" found.');
|
||||
|
@@ -55,6 +55,11 @@ observer.observe(document.body, {
|
||||
|
||||
|
||||
function initializeCanvas() {
|
||||
if (document.getElementById('snowfallCanvas')) {
|
||||
console.warn('Canvas bereits vorhanden.');
|
||||
return;
|
||||
}
|
||||
|
||||
const container = document.querySelector('.santa-container');
|
||||
if (!container) {
|
||||
console.error('Error: No element with class "santa-container" found.');
|
||||
@@ -144,7 +149,7 @@ function animateSnowfall() {
|
||||
// initialize santa
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
if (!santa) {
|
||||
console.warn('Snowfall is disabled.');
|
||||
console.warn('Sante is disabled.');
|
||||
return; // exit if santa is disabled
|
||||
}
|
||||
const container = document.querySelector('.santa-container');
|
||||
@@ -155,7 +160,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
snowflakesCount = snowflakesCountMobile;
|
||||
}
|
||||
|
||||
console.log('Snowfall enabled.');
|
||||
console.log('Santa enabled.');
|
||||
initializeCanvas();
|
||||
snowflakes = createSnowflakes(container);
|
||||
animateSnowfall();
|
||||
|
@@ -55,6 +55,11 @@ observer.observe(document.body, {
|
||||
|
||||
|
||||
function initializeCanvas() {
|
||||
if (document.getElementById('snowfallCanvas')) {
|
||||
console.warn('Canvas bereits vorhanden.');
|
||||
return;
|
||||
}
|
||||
|
||||
const container = document.querySelector('.snowfall-container');
|
||||
if (!container) {
|
||||
console.error('Error: No element with class "snowfall-container" found.');
|
||||
|
@@ -57,6 +57,11 @@ observer.observe(document.body, {
|
||||
|
||||
|
||||
function initializeCanvas() {
|
||||
if (document.getElementById('snowfallCanvas')) {
|
||||
console.warn('Canvas bereits vorhanden.');
|
||||
return;
|
||||
}
|
||||
|
||||
const container = document.querySelector('.snowstorm-container');
|
||||
if (!container) {
|
||||
console.error('Error: No element with class "snowfall-container" found.');
|
||||
|
Reference in New Issue
Block a user