From: Agnibho Mondal Date: Mon, 5 Dec 2016 08:35:15 +0000 (+0530) Subject: Added update alert and some minor changes X-Git-Url: https://code.agnibho.com/repo?a=commitdiff_plain;h=f44181eb909ec404632fa74a1e29aab6db00ae85;p=obscalc.git Added update alert and some minor changes --- diff --git a/index.html b/index.html index 826168b..0cab821 100755 --- a/index.html +++ b/index.html @@ -31,6 +31,9 @@ + - +
diff --git a/src/ByUsg.vue b/src/ByUsg.vue index e739a11..c7ab6f9 100644 --- a/src/ByUsg.vue +++ b/src/ByUsg.vue @@ -52,7 +52,7 @@
- +
diff --git a/src/routine.js b/src/routine.js index 08c9d75..bed583b 100644 --- a/src/routine.js +++ b/src/routine.js @@ -77,4 +77,42 @@ $(document).ready(function(){ }, 1000); } }); + + //Notifications + $(window).resize(function(){ + $("#notify").width($(".container").width()-20); + }); + $(window).scroll(function(){ + $("#notify").width($(".container").width()-20); + }); + $.get("https://code.agnibho.com/obscalc/info.json", function(data){ + if(data.latest > VERSION){ + $("#notify").slideDown(); + $("#notify").width($(".container").width()-20); + $("#notify-text").text("A new version of ObsCalc is available."); + if(document.URL.indexOf("http://")==-1 && document.URL.indexOf("https://")==-1){ + if(/(android)/i.test(navigator.userAgent)){ + $("#notify-link").attr("href", data.apk); + $("#notify-link").text("Download"); + } + else{ + $("#notify-link").attr("href", data.url); + $("#notify-link").text("Load"); + } + } + else{ + $("#notify-link").attr("href", data.url); + $("#notify-link").text("Load"); + } + } + else if(document.URL.indexOf("http://")!=-1 || document.URL.indexOf("https://")!=-1){ + if(/(android)/i.test(navigator.userAgent)){ + $("#notify").slideDown(); + $("#notify").width($(".container").width()-20); + $("#notify-text").text(""); + $("#notify-link").attr("href", data.apk); + $("#notify-link").text("Download for Android"); + } + } + }); });