guess OS version on checkup page

pull/1/head
ansuz 3 years ago
parent d8af3a16ab
commit 7647a60219

@ -88,11 +88,10 @@ html, body {
.cp-notice-browser, .cp-notice-details, .cp-notice-other { .cp-notice-browser, .cp-notice-details, .cp-notice-other {
font-size: 70%; font-size: 70%;
} }
.underline { text-decoration: underline; }
.cp-app-checkup-version, .cp-app-checkup-browser { .cp-app-checkup-version, .cp-app-checkup-browser {
text-decoration: underline; .underline;
} }
iframe { iframe {
display: none; display: none;
} }

@ -14,6 +14,25 @@ define([
return false; return false;
}; };
var OS_HINTS = {
"Win": "Windows",
"Mac": "MacOS",
"X11": "UNIX",
"Linux": "Linux",
};
Tools.guessOS = function () {
var result = "UNKNOWN";
if (!window.navigator || !window.navigator.appVersion) { return result; }
result = window.navigator.appVersion;
console.log(result);
Object.keys(OS_HINTS).some(function (key) {
if (result.indexOf(key) === -1) { return; }
result = OS_HINTS[key]; // else
return true;
});
return result;
};
Tools.isSafari = function () { Tools.isSafari = function () {
return navigator.vendor.match(/apple/i); return navigator.vendor.match(/apple/i);

@ -932,7 +932,9 @@ define([
return h('p.cp-notice-browser', [ return h('p.cp-notice-browser', [
"You appear to be using a ", "You appear to be using a ",
h('span.cp-app-checkup-browser', name), h('span.cp-app-checkup-browser', name),
' browser to view this page.', ' browser on ',
h('span.underline', Tools.guessOS()),
' to view this page.',
]); ]);
}; };

Loading…
Cancel
Save