Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix table color #1424

Merged
merged 3 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ bootstrap:
integrity:
css: "sha256-DF7Zhf293AJxJNTmh5zhoYYIMs2oXitRfBjY+9L//AY="
js: "sha256-fgLAgv7fyCGopR/gBNq2iW3ZKIdqIcyshnUULC4vex8="
bootstrap-table:
version: "1.21.4"
fontawesome:
version: "5.15.4"
integrity: "sha256-mUZM63G8m73Mcidfrv5E+Y61y7a12O5mW4ezU3bxqW4="
Expand Down
2 changes: 1 addition & 1 deletion _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mdbootstrap@{{ site.mdb.version }}/css/mdb.min.css" integrity="{{ site.mdb.integrity.css }}" crossorigin="anonymous" />

<!-- Bootstrap Table -->
<link defer rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.21.3/dist/bootstrap-table.min.css">
<link defer rel="stylesheet" href="https://unpkg.com/bootstrap-table@{{ site.bootstrap-table.version }}/dist/bootstrap-table.min.css">

<!-- Fonts & Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@{{ site.fontawesome.version }}/css/all.min.css" integrity="{{ site.fontawesome.integrity }}" crossorigin="anonymous">
Expand Down
2 changes: 1 addition & 1 deletion _includes/scripts/misc.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% endif %}

<!-- Bootstrap Table -->
<script defer src="https://unpkg.com/bootstrap-table@1.21.3/dist/bootstrap-table.min.js"></script>
<script defer src="https://unpkg.com/bootstrap-table@{{ site.bootstrap-table.version }}/dist/bootstrap-table.min.js"></script>

<!-- Load Common JS -->
<script src="{{ '/assets/js/no_defer.js' | relative_url }}"></script>
Expand Down
5 changes: 4 additions & 1 deletion _sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ table.table a {
}
}

.table-dark {
background-color: transparent;
}

figure,
img {
max-width: 90vw;
Expand Down Expand Up @@ -946,4 +950,3 @@ nav[data-toggle="toc"] {
top: 0;
}
}

12 changes: 6 additions & 6 deletions assets/js/no_defer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// 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 &&
Expand All @@ -10,12 +16,6 @@ $(document).ready(function() {
// add some classes to make the table look better
// $(this).addClass('table-sm');
$(this).addClass('table-hover');

if (document.documentElement.getAttribute("data-theme") == "dark") {
$(this).addClass('table-dark');
} else {
$(this).removeClass('table-dark');
}
}
})
});
Expand Down