pages/assets/js/no_defer.js
Simmo Saan 02eee8da81
Remove bootstrap-table from archive tables (#2306)
The blog archive page tables have `table-borderless`, but
bootstrap-table JS adds `table-bordered` by default and this forces an
`!important` border.
Since these tables are also supposed to be borderless, this PR excludes
them from bootstrap-table, just like the news and CV table are.
2024-04-03 15:35:18 -03:00

25 lines
816 B
JavaScript

// add bootstrap classes to tables
$(document).ready(function () {
$("table").each(function () {
if (determineComputedTheme() == "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('[class*="archive"]').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");
}
});
});