pages/assets/js/no_defer.js
George 8f960bbae6
Fix table color (#1424)
Fix table color when dark mode is default.

---------

Signed-off-by: George Araujo <george.gcac@gmail.com>
2023-05-14 22:10:29 -03:00

23 lines
768 B
JavaScript

// add bootstrap classes to tables
$(document).ready(function() {
$('table').each(function() {
if (document.documentElement.getAttribute("data-theme") == "dark") {
$(this).addClass('table-dark');
} else {
$(this).removeClass('table-dark');
}
// only select tables that are not inside an element with "news" (about page) or "card" (cv page) class
if($(this).parents('[class*="news"]').length==0 &&
$(this).parents('[class*="card"]').length==0 &&
$(this).parents('code').length == 0) {
// make table use bootstrap-table
$(this).attr('data-toggle','table');
// add some classes to make the table look better
// $(this).addClass('table-sm');
$(this).addClass('table-hover');
}
})
});