Skip to content

Commit

Permalink
Minor Update
Browse files Browse the repository at this point in the history
  • Loading branch information
malisipi committed Jan 29, 2022
1 parent 9bca2d3 commit 569d28b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" href="css/main.css">
<script src="main.js"></script>
<link rel="stylesheet" href="css/panel.css">
<script src="js/panel.js" ></script>
<script src="js/panel.js" defer></script>
<link rel="stylesheet" href="css/Font.css">
<script src="js/window.js"></script>
<link rel="stylesheet" href="css/window.css">
Expand Down Expand Up @@ -39,7 +39,7 @@
<div class="panel-status" onclick="showStatusAbout();">
<img class="panel-status-icon" draggable="false" src="icons/Suru/Suru/scalable/status/network-wireless-connected-symbolic.svg"/>
<img class="panel-status-icon" draggable="false" src="icons/Suru/Suru/scalable/status/audio-volume-high-symbolic.svg"/>
<img class="panel-status-icon" draggable="false" src="icons/Suru/Suru/scalable/status/battery-level-100-charging-symbolic.svg"/>
<img class="panel-status-icon" draggable="false" id="battery" src="icons/Suru/Suru/scalable/status/battery-level-100-charging-symbolic.svg"/>
</div>
<iframe class="status-about" src="status.html" hidden></iframe>
<iframe class="notification-about" src="notification.html" hidden></iframe>
Expand Down
20 changes: 19 additions & 1 deletion js/panel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
monthShortNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
monthShortNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
if(navigator.getBattery!=undefined){
batteryIcon=document.querySelector("#battery");
(async ()=>{
deviceBattery=await navigator.getBattery();

updateBatteryIcon=()=>{
if(deviceBattery.charging){
batteryIcon.src="icons/Suru/Suru/scalable/status/battery-level-"+(Math.round(deviceBattery.level*10)*10)+"-charging-symbolic.svg";
} else {
batteryIcon.src="icons/Suru/Suru/scalable/status/battery-level-"+(Math.round(deviceBattery.level*10)*10)+"-symbolic.svg";
}
}
updateBatteryIcon();

deviceBattery.addEventListener("chargingchange",updateBatteryIcon);
deviceBattery.addEventListener("levelchange",updateBatteryIcon);
})();
}

function UpdatePanelTime(){
now = new Date();
Expand Down

0 comments on commit 569d28b

Please sign in to comment.