mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-03-22 00:16:18 +00:00
add dark mode support
This commit is contained in:
@@ -148,7 +148,7 @@
|
||||
</div>
|
||||
|
||||
<center>
|
||||
<img id="graphImg" src="/rrd/graph/?peer={{ current_peer.uuid }}{% if request.GET.period %}&period={{ request.GET.period }}{% endif %}"
|
||||
<img id="graphImg" src="/rrd/graph/?peer={{ current_peer.uuid }}{% if request.GET.period %}&period={{ request.GET.period }}{% endif %}{% if request.COOKIES.darkMode == 'dark' %}&dark=1{% endif %}"
|
||||
class="img-fluid" alt="{% trans 'No traffic history, please wait a few minutes' %}"
|
||||
onerror="this.onerror=null; this.style.display='none'; this.insertAdjacentHTML('afterend', this.alt);">
|
||||
</center>
|
||||
@@ -324,7 +324,8 @@
|
||||
button.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
var period = this.getAttribute('data-period');
|
||||
var newSrc = '/rrd/graph/?peer={{ current_peer.uuid }}&period=' + period;
|
||||
var darkParam = $('body').hasClass('dark-mode') ? '&dark=1' : '';
|
||||
var newSrc = '/rrd/graph/?peer={{ current_peer.uuid }}&period=' + period + darkParam;
|
||||
var imgElement = document.getElementById('graphImg');
|
||||
if (imgElement) {
|
||||
imgElement.setAttribute('src', newSrc);
|
||||
|
||||
Reference in New Issue
Block a user