You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found out, that there are code snippets that just don't work minified. I am unable to find the exact reason why.
The code just does not work
Here is one example
function applyTableStyles() {
const tables = document.querySelectorAll('table');
tables.forEach(table => {
table.addEventListener('click', (event) => {
event.stopPropagation();
console.log('Table clicked');
alert('Table clicked!');
exportToExcel(table);
}, true);
});
}
function exportToExcel(table) {
let tableData = table.outerHTML; // Capture the table HTML
tableData = tableData.replace(/<input[^>]*>|<\/input>/gi, ""); // Remove input elements if any
let a = document.createElement('a');
a.href = 'data:application/vnd.ms-excel;charset=utf-8,' + encodeURIComponent(tableData);
a.download = `table_${get_suffix()}.xls`;
a.click();
}
function get_suffix() {
let dateObj = new Date();
let dateTime = `${dateObj.getHours()}${dateObj.getMinutes()}${dateObj.getSeconds()}`;
return `${dateTime}${Math.floor(Math.random() * 100)}`;
}
document.addEventListener('DOMContentLoaded', () => {
applyTableStyles();
const observer = new MutationObserver(applyTableStyles);
observer.observe(document.body, { childList: true, subtree: true });
});
The text was updated successfully, but these errors were encountered:
I found out, that there are code snippets that just don't work minified. I am unable to find the exact reason why.
The code just does not work
Here is one example
The text was updated successfully, but these errors were encountered: