]> Softwares of Agnibho - obscalc.git/commitdiff
Added update alert and some minor changes
authorAgnibho Mondal <mail@agnibho.com>
Mon, 5 Dec 2016 08:35:15 +0000 (14:05 +0530)
committerAgnibho Mondal <mail@agnibho.com>
Mon, 5 Dec 2016 08:35:15 +0000 (14:05 +0530)
index.html
src/ByDate.vue
src/ByUsg.vue
src/routine.js

index 826168b98e8cdc9f7408bacb410c70485a3367a7..0cab821ec715d840d3cc2310020fc67cff4d8df3 100755 (executable)
@@ -31,6 +31,9 @@
        <link rel="icon" href="dist/logo.png">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+       <script>
+        var VERSION=2.1;
+       </script>
        <style>
         .loader {
             position: absolute;
             100% { transform: rotate(360deg); }
         }
        </style>
-       
+
     </head>
     <body>
        <div class="loader"></div>
        <div class="container" style="display:none">
+           <div id="notify" style="position:fixed;margin:10px;z-index:2;display:none">
+               <div id="notify-alert" class="alert alert-info alert-dismissible">
+                   <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
+                   <h4><span id="notify-text"></span> <a id="notify-link" href="#" class="btn btn-success btn-lg">Download</a></h4>
+               </div>
+           </div>
            <div class="text-primary">
                <div class="jumbotron">
                    <h1>ObsCalc</h1>
index e845df93b4961fc94e708816aa79f9fb59b67f81..745cc5db33f438a832cea5ba971705be04d685f5 100644 (file)
@@ -56,7 +56,7 @@
                                        </div>
                                    </div>
                                    <div class="col-sm-4">
-                                       <input type="reset" class="btn">
+                                       <input type="reset" class="btn btn-default">
                                    </div>
                                </div>
                            </div>
index e739a111ecb3470dc231d12f5d08e2e21c7ad424..c7ab6f935bd9664cf33a9aeca0dfc0a8d476b420 100644 (file)
@@ -52,7 +52,7 @@
                        <div class="col-md-6 form-group"><input class="form-control stop-focus" type="number" min="0" max="6" maxlength="1" v-model.number="usgDy" placeholder="Days" required autocomplete="off" data-ref="#usgmat"><div class="help-block with-errors"></div></div>
                    </div>
                </div>
-               <input type="reset" class="btn">
+               <input type="reset" class="btn btn-default">
            </form>
            <br>
            <div id="usgmat">
index 08c9d7593d2fc6913b64a7e191cbe88aec215b0d..bed583b637267a1c5301af0720b787e5997f22a1 100644 (file)
@@ -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");
+           }
+       }
+    });
 });