소스 검색

Update 'src/app/core/application/browser.js'

Added information about iGeomJS version
Added "console.log" in the end of "constructor()"
leo 2 년 전
부모
커밋
a42cd661c6
1개의 변경된 파일31개의 추가작업 그리고 10개의 파일을 삭제
  1. 31 10
      src/app/core/application/browser.js

+ 31 - 10
src/app/core/application/browser.js

@@ -1,5 +1,21 @@
+/*
+ * iGeom by LInE
+ * Free software to student private data
+ *
+ * http://www.matematica.br/igeom
+ * http://www.usp.br/line
+ *
+ * Build information about the browser to be used in GEO file by app/core/models/application/actions/action-manager.js
+ *
+ * ./app/core/application/browser.js
+ *
+ * @calledby app/core/models/application/actions/action-manager.js!save(): to build browser information to put in GEO file
+ * @version 2021/11/25
+ */
+
 class Browser {
-  constructor() {
+
+  constructor () {
     let nVer = navigator.appVersion;
     let nAgt = navigator.userAgent;
     let browserName = navigator.appName;
@@ -15,29 +31,29 @@ class Browser {
       fullVersion = nAgt.substring(verOffset + 6);
       if ((verOffset = nAgt.indexOf("Version")) != -1)
         fullVersion = nAgt.substring(verOffset + 8);
-    }
+      }
     // In MSIE, the true version is after "MSIE" in userAgent
     else if ((verOffset = nAgt.indexOf("MSIE")) != -1) {
       browserName = "Microsoft Internet Explorer";
       fullVersion = nAgt.substring(verOffset + 5);
-    }
+      }
     // In Chrome, the true version is after "Chrome"
     else if ((verOffset = nAgt.indexOf("Chrome")) != -1) {
       browserName = "Chrome";
       fullVersion = nAgt.substring(verOffset + 7);
-    }
+      }
     // In Safari, the true version is after "Safari" or after "Version"
     else if ((verOffset = nAgt.indexOf("Safari")) != -1) {
       browserName = "Safari";
       fullVersion = nAgt.substring(verOffset + 7);
       if ((verOffset = nAgt.indexOf("Version")) != -1)
         fullVersion = nAgt.substring(verOffset + 8);
-    }
+      }
     // In Firefox, the true version is after "Firefox"
     else if ((verOffset = nAgt.indexOf("Firefox")) != -1) {
       browserName = "Firefox";
       fullVersion = nAgt.substring(verOffset + 8);
-    }
+      }
     // In most other browsers, "name/version" is at the end of userAgent
     else if (
       (nameOffset = nAgt.lastIndexOf(" ") + 1) <
@@ -47,8 +63,8 @@ class Browser {
       fullVersion = nAgt.substring(verOffset + 1);
       if (browserName.toLowerCase() == browserName.toUpperCase()) {
         browserName = navigator.appName;
+        }
       }
-    }
     // trim the fullVersion string at semicolon/space if present
     if ((ix = fullVersion.indexOf(";")) != -1)
       fullVersion = fullVersion.substring(0, ix);
@@ -59,7 +75,7 @@ class Browser {
     if (isNaN(majorVersion)) {
       fullVersion = "" + parseFloat(navigator.appVersion);
       majorVersion = parseInt(navigator.appVersion, 10);
-    }
+      }
     let OSName = "Unknown OS";
     if (navigator.appVersion.indexOf("Win") != -1) OSName = "Windows";
     if (navigator.appVersion.indexOf("Mac") != -1) OSName = "MacOS";
@@ -71,6 +87,11 @@ class Browser {
     this.appName = navigator.appName;
     this.userAgent = navigator.userAgent;
     this.osName = OSName;
+    var aux = "browserName=" + browserName + ", fullVersion=" + fullVersion + ", navigator.appName=";
+    aux += navigator.appName + ", navigator.userAgent=" + navigator.userAgent + ", OSName=" + OSName;
+    console.log("browser.js!constructor(): final - information to 'app/core/models/application/actions/action-manager.js' - " + aux);
+    } // constructor()
+
   }
-}
-export const browser = new Browser();
+
+export const browser = new Browser();