]> Softwares of Agnibho - obscalc.git/commitdiff
Version code correction
authorAgnibho Mondal <mail@agnibho.com>
Mon, 5 Dec 2016 10:57:04 +0000 (16:27 +0530)
committerAgnibho Mondal <mail@agnibho.com>
Mon, 5 Dec 2016 10:57:04 +0000 (16:27 +0530)
index.html
src/Settings.vue
src/routine.js

index 0cab821ec715d840d3cc2310020fc67cff4d8df3..2f1f5cba6026da9205081d767f8c1b8d283b0ba4 100755 (executable)
@@ -32,7 +32,7 @@
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script>
-        var VERSION=2.1;
+        var VERSION="2.1.0";
        </script>
        <style>
         .loader {
index b8732f83cfe35d7fb8606edc20c52277a57fd102..fe87f1213b507a6078e0c077bcd95c3274d60cbf 100644 (file)
@@ -61,7 +61,7 @@
                            </div>
                            <div id="about-text" class="panel-collapse collapse">
                                <div class="panel-body">
-                                   <p><strong>ObsCalc 2.0</strong></p>
+                                   <p><strong>ObsCalc <span class="version"></span></strong></p>
                                    <p>ObsCalc is a free and open source software published under GPL v3. It has been developed by Agnibho Mondal &lt;mail@agnibho.com&gt;.</p>
                                    <p><a href="https://code.agnibho.com/obscalc/">https://code.agnibho.com/obscalc/</a></p>
                                    <p>Copyright &copy; <span class="copyright" data-start="2016">2016</span> Agnibho Mondal</p>
index bed583b637267a1c5301af0720b787e5997f22a1..33be1c234efad9cfc13791d5c99ef62eff64fea4 100644 (file)
@@ -29,6 +29,9 @@ $(document).ready(function(){
     $(".loader").remove();
     $(".container").fadeIn();
 
+    //Insert version code
+    $(".version").text(VERSION);
+
     //Update copyright
     $(".copyright").each(function(){
        if(new Date().getFullYear()>$(this).data("start")){
@@ -86,7 +89,23 @@ $(document).ready(function(){
        $("#notify").width($(".container").width()-20);
     });
     $.get("https://code.agnibho.com/obscalc/info.json", function(data){
-       if(data.latest > VERSION){
+       var vCurr=VERSION.split(".").map(Number);
+       var vLtst=data.latest.split(".").map(Number);
+       function isBiggerThan(v1, v2){
+           while(v1.length<v2.length){
+               v1.push(0);
+           }
+           while(v2.length<v1.length){
+               v2.push(0);
+           }
+           for(var i=0; i<v1.length; i++){
+               if(v1[i]>v2[i]){
+                   return true;
+               }
+           }
+           return false;
+       }
+       if(isBiggerThan(data.latest, VERSION)){
            $("#notify").slideDown();
            $("#notify").width($(".container").width()-20);
            $("#notify-text").text("A new version of ObsCalc is available.");