Dark mode

This commit is contained in:
sandipSubedi 2020-10-11 21:33:19 -05:00
parent 4e12a61b51
commit 7ae4090d34
2 changed files with 9 additions and 0 deletions

View file

@ -14,6 +14,10 @@
<script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script> <script src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.0/moment.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.0/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/darkmode-js@1.5.7/lib/darkmode-js.min.js"></script>
<style>
.darkmode-layer, .darkmode-toggle { z-index: 500; }
</style>
</head> </head>
<body class='mt-4 mb-2'> <body class='mt-4 mb-2'>

View file

@ -1,5 +1,6 @@
window.addEventListener('load', () => { window.addEventListener('load', () => {
initDT(); // Initialize the DatatTable and window.columnNames variables initDT(); // Initialize the DatatTable and window.columnNames variables
addDarkmodeWidget();
const repo = getRepoFromUrl(); const repo = getRepoFromUrl();
@ -14,6 +15,10 @@ document.getElementById('form').addEventListener('submit', e => {
fetchData(); fetchData();
}); });
function addDarkmodeWidget() {
new Darkmode( { label: '🌓' } ).showWidget();
}
function fetchData() { function fetchData() {
const repo = document.getElementById('q').value; const repo = document.getElementById('q').value;
const re = /[-_\w]+\/[-_.\w]+/; const re = /[-_\w]+\/[-_.\w]+/;