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

Added custom Markdown checkbox design. #9

Merged
merged 13 commits into from
Oct 29, 2023
Binary file added public/design/no.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/design/yes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions public/js/@include/CheckD.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function replaceCheckboxesWithImages() {
const checkboxes = document.querySelectorAll('input[type="checkbox"]');

checkboxes.forEach(checkbox => {
if (checkbox.hasAttribute('checked') && checkbox.hasAttribute('disabled')) {
checkbox.outerHTML = '<img src="/design/yes.jpg" width="25" height="25">';
} else if (checkbox.hasAttribute('disabled')) {
checkbox.outerHTML = '<img src="/design/no.jpg" width="25" height="25">';
}
});
}
replaceCheckboxesWithImages();
2 changes: 1 addition & 1 deletion src/pages/wiki/guides/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ const { Content } = await entry.render();
</div>
</div>
<script src="/js/docs.js" is:inline></script>

<script src="/js/@include/CheckD.js" is:inline></script>
</Layout>
2 changes: 1 addition & 1 deletion src/pages/wiki/software/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ const slugify = (str: string) => {
</div>
</div>
</div>

<script src="/js/@include/CheckD.js" is:inline></script>
<script src="/js/docs.js" is:inline></script>
</Layout>
1 change: 1 addition & 0 deletions src/pages/wiki/vtubers/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ const socials = CreateSocials(data);
</div>
<script src="/js/docs.js" is:inline></script>
<script src="/js/@include/@profile/classes.js" is:inline></script>
<script src="/js/@include/CheckD.js" is:inline></script>
</Layout>