Quellcode durchsuchen

auto update script executed

Toby Chui vor 1 Jahr
Ursprung
Commit
c47661dcad
3 geänderte Dateien mit 14 neuen und 1 gelöschten Zeilen
  1. 5 0
      web/components/stats.html
  2. 1 0
      web/index.html
  3. 8 1
      web/script/utils.js

+ 5 - 0
web/components/stats.html

@@ -183,6 +183,11 @@
 
 
    function loadStatisticByDate(dateid){
    function loadStatisticByDate(dateid){
         $.getJSON("/api/analytic/load?id=" + dateid, function(data){
         $.getJSON("/api/analytic/load?id=" + dateid, function(data){
+            if (data.error != undefined){
+                msgbox(data.error, false, 6000);
+                return;
+            }
+            
             //Destroy all the previous charts
             //Destroy all the previous charts
             statisticCharts.forEach(function(thisChart){
             statisticCharts.forEach(function(thisChart){
                 thisChart.destroy();
                 thisChart.destroy();

+ 1 - 0
web/index.html

@@ -266,6 +266,7 @@
                     $("#messageBox").attr("class", "ui green floating compact message")
                     $("#messageBox").attr("class", "ui green floating compact message")
                     icon = `<i class="ui green circle check icon"></i>`;
                     icon = `<i class="ui green circle check icon"></i>`;
                 }else{
                 }else{
+                    message = message.capitalize();
                     $("#messageBox").attr("class", "ui red floating compact message")
                     $("#messageBox").attr("class", "ui red floating compact message")
                     icon = `<i class="ui red circle times icon"></i>`;
                     icon = `<i class="ui red circle times icon"></i>`;
                 }
                 }

+ 8 - 1
web/script/utils.js

@@ -19,4 +19,11 @@ function abbreviateNumber(value) {
     }
     }
     
     
     return newValue + suffixes[suffixNum];
     return newValue + suffixes[suffixNum];
-}
+}
+
+Object.defineProperty(String.prototype, 'capitalize', {
+    value: function() {
+        return this.charAt(0).toUpperCase() + this.slice(1);
+    },
+    enumerable: false
+});