Commit d277ee9c authored by Corentin Mors's avatar Corentin Mors
Browse files

Check dayhour to enable darkmode

parent f44e96b6
$("#darkButton").click(function(){$("body").hasClass("dark")?$("body").removeClass("dark"):$("body").addClass("dark")}),$(document).ready(function(){$("#sidebar").mCustomScrollbar({theme:"minimal"}),$("#sidebarCollapse").on("click",function(){$("#sidebar, #content").toggleClass("active"),$(".collapse.in").toggleClass("in"),$("a[aria-expanded=true]").attr("aria-expanded","false")})}),$(document).ready(function(){var a,o,e;if("geolocation"in navigator){navigator.geolocation.getCurrentPosition(function(t){a=t.coords.latitude,o=t.coords.longitude,e="http://api.openweathermap.org/data/2.5/weather?lat="+a+"&lon="+o+"&units=metric&appid=b231606340553d9174136f7f083904b3",$.ajax({url:e,method:"GET",success:function(a){var o=a.main.temp,e=a.name;a.weather.description;$("#live-weather").html(o+"°C in "+e)}})})}else console.log("Your browser doesn't support geolocation. Sorry.")});
\ No newline at end of file
$("#darkButton").click(function(){$("body").hasClass("dark")?$("body").removeClass("dark"):$("body").addClass("dark")}),$(document).ready(function(){var a=new Date;$("#live-hour").html("<i class='far fa-clock'></i> "+a);var o=a.getHours();(o>17||o<8)&&$("body").addClass("dark")}),$(document).ready(function(){$("#sidebar").mCustomScrollbar({theme:"minimal"}),$("#sidebarCollapse").on("click",function(){$("#sidebar, #content").toggleClass("active"),$(".collapse.in").toggleClass("in"),$("a[aria-expanded=true]").attr("aria-expanded","false")})}),$(document).ready(function(){var a,o,e;if("geolocation"in navigator){navigator.geolocation.getCurrentPosition(function(t){a=t.coords.latitude,o=t.coords.longitude,e="http://api.openweathermap.org/data/2.5/weather?lat="+a+"&lon="+o+"&units=metric&appid=b231606340553d9174136f7f083904b3",$.ajax({url:e,method:"GET",success:function(a){var o=a.main.temp,e=a.name;a.weather.description;$("#live-weather").html(o+"°C in "+e)}})})}else console.log("Your browser doesn't support geolocation. Sorry.")});
\ No newline at end of file
......@@ -11,6 +11,16 @@ $("#darkButton").click(function(){
$("body").addClass("dark")
});
$(document).ready(function () {
var d = new Date();
$("#live-hour").html("<i class='far fa-clock'></i> " + d)
var n = d.getHours();
if(n > 17 || n < 8){
$("body").addClass("dark")
}
});
/*** Lateral menu ***/
$(document).ready(function () {
$("#sidebar").mCustomScrollbar({
......
......@@ -88,6 +88,10 @@
This is the default content
{% endblock %}
<hr>
<span>X-Cockpit -- </span> <span id="live-hour" class="float-center"></span>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment