Add logger fallbacks for iframe forms and views

This commit is contained in:
thePR0M3TH3AN committed 2025-10-15 15:22:42 -04:00
1 parent 15a1986c55
commit b13104162d
11 files changed
+247 -16

No files matched your search

@@ -224,6 +224,22 @@
</div>
</div>
<script>
// Fallback loggers keep embeds functional without bitvidLogger while surfacing warnings/errors via the console.
const fallbackDev = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const fallbackUser = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const dev = window.bitvidLogger?.dev || fallbackDev;
const user = window.bitvidLogger?.user || fallbackUser;
document.addEventListener("DOMContentLoaded", () => {
// Logging functions for both on-page and console output.
function log(msg, type = "info") {
@@ -234,7 +250,18 @@
if (type === "warn") div.classList.add("warn");
div.textContent = msg;
document.getElementById("status").appendChild(div);
console.log(`[${type.toUpperCase()}] ${msg}`);
const formatted = `[${type.toUpperCase()}] ${msg}`;
if (type === "error") {
user.error(formatted);
} else if (type === "warn") {
user.warn(formatted);
} else if (type === "success") {
user.log(formatted);
} else if (type === "info") {
dev.info(formatted);
} else {
dev.log(formatted);
}
}
function clear() {
document.getElementById("status").innerHTML = "";
@@ -457,7 +484,7 @@ For further questions, contact us through bitvid’s Nostr support channels.
);
} catch (err) {
log("Error: " + err.message, "error");
console.error(err);
user.error(err);
}
});
});
@@ -207,6 +207,22 @@
</div>
</div>
<script>
// Fallback loggers keep embeds functional without bitvidLogger while surfacing warnings/errors via the console.
const fallbackDev = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const fallbackUser = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const dev = window.bitvidLogger?.dev || fallbackDev;
const user = window.bitvidLogger?.user || fallbackUser;
document.addEventListener("DOMContentLoaded", () => {
// Logging functions for both on-page and console output.
function log(msg, type = "info") {
@@ -217,7 +233,18 @@
if (type === "warn") div.classList.add("warn");
div.textContent = msg;
document.getElementById("status").appendChild(div);
console.log(`[${type.toUpperCase()}] ${msg}`);
const formatted = `[${type.toUpperCase()}] ${msg}`;
if (type === "error") {
user.error(formatted);
} else if (type === "warn") {
user.warn(formatted);
} else if (type === "success") {
user.log(formatted);
} else if (type === "info") {
dev.info(formatted);
} else {
dev.log(formatted);
}
}
function clear() {
document.getElementById("status").innerHTML = "";
@@ -438,7 +465,7 @@ For urgent issues, contact us through bitvid’s Nostr support channels.
);
} catch (err) {
log("Error: " + err.message, "error");
console.error(err);
user.error(err);
}
});
});
@@ -141,6 +141,22 @@
</div>
</div>
<script>
// Fallback loggers keep embeds functional without bitvidLogger while surfacing warnings/errors via the console.
const fallbackDev = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const fallbackUser = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const dev = window.bitvidLogger?.dev || fallbackDev;
const user = window.bitvidLogger?.user || fallbackUser;
document.addEventListener("DOMContentLoaded", () => {
// Logging functions for both on-page and console output.
function log(msg, type = "info") {
@@ -151,7 +167,18 @@
if (type === "warn") div.classList.add("warn");
div.textContent = msg;
document.getElementById("status").appendChild(div);
console.log(`[${type.toUpperCase()}] ${msg}`);
const formatted = `[${type.toUpperCase()}] ${msg}`;
if (type === "error") {
user.error(formatted);
} else if (type === "warn") {
user.warn(formatted);
} else if (type === "success") {
user.log(formatted);
} else if (type === "info") {
dev.info(formatted);
} else {
dev.log(formatted);
}
}
function clear() {
document.getElementById("status").innerHTML = "";
@@ -354,7 +381,7 @@ For further questions, reach out through bitvid’s Nostr support channels.
);
} catch (err) {
log("Error: " + err.message, "error");
console.error(err);
user.error(err);
}
});
});
@@ -143,6 +143,22 @@
</div>
</div>
<script>
// Fallback loggers keep embeds functional without bitvidLogger while surfacing warnings/errors via the console.
const fallbackDev = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const fallbackUser = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const dev = window.bitvidLogger?.dev || fallbackDev;
const user = window.bitvidLogger?.user || fallbackUser;
document.addEventListener("DOMContentLoaded", () => {
// Logging function for on-page and console output.
function log(msg, type = "info") {
@@ -153,7 +169,18 @@
if (type === "warn") div.classList.add("warn");
div.textContent = msg;
document.getElementById("status").appendChild(div);
console.log(`[${type.toUpperCase()}] ${msg}`);
const formatted = `[${type.toUpperCase()}] ${msg}`;
if (type === "error") {
user.error(formatted);
} else if (type === "warn") {
user.warn(formatted);
} else if (type === "success") {
user.log(formatted);
} else if (type === "info") {
dev.info(formatted);
} else {
dev.log(formatted);
}
}
function clear() {
document.getElementById("status").innerHTML = "";
@@ -337,7 +364,7 @@ For additional discussions, reach out via bitvid’s Nostr support channels.
);
} catch (err) {
log("Error: " + err.message, "error");
console.error(err);
user.error(err);
}
});
});
@@ -166,6 +166,22 @@
</div>
</div>
<script>
// Fallback loggers keep embeds functional without bitvidLogger while surfacing warnings/errors via the console.
const fallbackDev = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const fallbackUser = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const dev = window.bitvidLogger?.dev || fallbackDev;
const user = window.bitvidLogger?.user || fallbackUser;
document.addEventListener("DOMContentLoaded", () => {
// Logging function
function log(msg, type = "info") {
@@ -176,7 +192,18 @@
if (type === "warn") div.classList.add("warn");
div.textContent = msg;
document.getElementById("status").appendChild(div);
console.log(`[${type.toUpperCase()}] ${msg}`);
const formatted = `[${type.toUpperCase()}] ${msg}`;
if (type === "error") {
user.error(formatted);
} else if (type === "warn") {
user.warn(formatted);
} else if (type === "success") {
user.log(formatted);
} else if (type === "info") {
dev.info(formatted);
} else {
dev.log(formatted);
}
}
function clear() {
document.getElementById("status").innerHTML = "";
@@ -379,7 +406,7 @@ For further discussions, reach out through bitvid’s Nostr support channels.
);
} catch (err) {
log("Error: " + err.message, "error");
console.error(err);
user.error(err);
}
});
});
+17 -1
View File
@@ -13,6 +13,22 @@
</section>
<script>
// Fallback loggers keep embeds functional without bitvidLogger while surfacing warnings/errors via the console.
const fallbackDev = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const fallbackUser = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const dev = window.bitvidLogger?.dev || fallbackDev;
const user = window.bitvidLogger?.user || fallbackUser;
(async () => {
try {
const response = await fetch("content/about.md");
@@ -35,7 +51,7 @@
hljs.highlightBlock(block);
});
} catch (err) {
console.error("Error loading About content:", err);
user.error("Error loading About content:", err);
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = `
+17 -1
View File
@@ -16,6 +16,22 @@
</section>
<script>
// Fallback loggers keep embeds functional without bitvidLogger while surfacing warnings/errors via the console.
const fallbackDev = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const fallbackUser = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const dev = window.bitvidLogger?.dev || fallbackDev;
const user = window.bitvidLogger?.user || fallbackUser;
(async () => {
try {
// Fetch the markdown file (change path if needed)
@@ -39,7 +55,7 @@
hljs.highlightBlock(block);
});
} catch (err) {
console.error("Error loading community guidelines:", err);
user.error("Error loading community guidelines:", err);
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = `
+17 -1
View File
@@ -16,6 +16,22 @@
</section>
<script>
// Fallback loggers keep embeds functional without bitvidLogger while surfacing warnings/errors via the console.
const fallbackDev = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const fallbackUser = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const dev = window.bitvidLogger?.dev || fallbackDev;
const user = window.bitvidLogger?.user || fallbackUser;
(async () => {
try {
// Fetch the Markdown file
@@ -40,7 +56,7 @@
hljs.highlightBlock(block);
});
} catch (err) {
console.error("Error loading 'Getting Started' content:", err);
user.error("Error loading 'Getting Started' content:", err);
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = `
+17 -1
View File
@@ -13,6 +13,22 @@
</section>
<script>
// Fallback loggers keep embeds functional without bitvidLogger while surfacing warnings/errors via the console.
const fallbackDev = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const fallbackUser = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const dev = window.bitvidLogger?.dev || fallbackDev;
const user = window.bitvidLogger?.user || fallbackUser;
(async () => {
try {
const response = await fetch("content/ipns.md");
@@ -35,7 +51,7 @@
hljs.highlightBlock(block);
});
} catch (err) {
console.error("Error loading IPNS content:", err);
user.error("Error loading IPNS content:", err);
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = `
+17 -1
View File
@@ -13,6 +13,22 @@
</section>
<script>
// Fallback loggers keep embeds functional without bitvidLogger while surfacing warnings/errors via the console.
const fallbackDev = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const fallbackUser = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const dev = window.bitvidLogger?.dev || fallbackDev;
const user = window.bitvidLogger?.user || fallbackUser;
(async () => {
try {
const response = await fetch("content/links.md");
@@ -35,7 +51,7 @@
hljs.highlightBlock(block);
});
} catch (err) {
console.error("Error loading Links content:", err);
user.error("Error loading Links content:", err);
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = `
+17 -1
View File
@@ -13,6 +13,22 @@
</section>
<script>
// Fallback loggers keep embeds functional without bitvidLogger while surfacing warnings/errors via the console.
const fallbackDev = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const fallbackUser = {
log: () => {},
info: () => {},
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
};
const dev = window.bitvidLogger?.dev || fallbackDev;
const user = window.bitvidLogger?.user || fallbackUser;
(async () => {
try {
// Fetch your roadmap markdown
@@ -36,7 +52,7 @@
hljs.highlightBlock(block);
});
} catch (err) {
console.error("Error loading roadmap:", err);
user.error("Error loading roadmap:", err);
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = `