more concise unsupported platform detector

This commit is contained in:
Nikita Krupin committed 2022-01-12 13:19:59 -05:00
1 parent 7a01751faa
commit 9f8fe1bd10
3 files changed
+40 -38

No files matched your search

+16 -26
View File
@@ -40,7 +40,13 @@
<span class="my-auto" v-html="alert.html"></span> <span class="my-auto" v-html="alert.html"></span>
<template #action="{ attrs }"> <template #action="{ attrs }">
<v-btn v-bind="attrs" color="primary" text icon @click="alert.show = false"> <v-btn
v-bind="attrs"
color="primary"
text
icon
@click="alert.show = false"
>
<v-icon>mdi-close-circle-outline</v-icon> <v-icon>mdi-close-circle-outline</v-icon>
</v-btn> </v-btn>
</template> </template>
@@ -67,38 +73,22 @@ export default {
}), }),
mounted() { mounted() {
setTimeout(() => { setTimeout(() => {
// Chrome < 70 // Chrome < 70 or FF < 60
if ( if (
window.navigator.userAgent.indexOf("Chrome") > -1 && (this.$ua._parsed.name == "Chrome" &&
window.navigator.userAgent.indexOf("Edge") === -1 parseInt(this.$ua._parsed.version.slice(0, 2)) < 70) ||
(this.$ua._parsed.name == "Firefox" &&
parseInt(this.$ua._parsed.version.slice(0, 2)) < 60)
) { ) {
let chrome = window.navigator.userAgent.match(/Chrome\/(\d+)/); this.alert.html = `<b style="background: #222; border-radius: .5rem; padding: .25rem .25rem .25rem .5rem; margin: 0 .25rem;">
let chromeVersion = chrome ? chrome[1] : 0; ${this.$ua._parsed.name} ${this.$ua._parsed.version.slice(0, 2)}
if (chromeVersion < 70) { </b> is not supported. Consider upgrading to the latest version.`;
this.alert.html = `<b style="background: #222; border-radius: .5rem; padding: .25rem .5rem;">${this.$ua._parsed.name} ${this.$ua._parsed.version}</b> is not supported. Consider updating to the latest version.`;
this.alert.show = true;
}
}
// FF < 60
if (window.navigator.userAgent.indexOf("Firefox") > -1) {
let firefox = window.navigator.userAgent.match(/Firefox\/(\d+)/);
let firefoxVersion = firefox ? firefox[1] : 0;
if (firefoxVersion < 60) {
this.alert.html = `<b style="background: #222; border-radius: .5rem; padding: .25rem .5rem;">${this.$ua._parsed.name} ${this.$ua._parsed.version}</b> is not supported. Consider updating to the latest version.`;
this.alert.show = true;
}
}
// IE
if (window.navigator.userAgent.indexOf("MSIE") > -1) {
this.alert.html = `Looks like you're using <b style="background: #222; border-radius: .5rem; padding: .25rem .5rem;">Internet Explorer</b>. Stop it, get some help.`;
this.alert.show = true; this.alert.show = true;
} }
// Win7 // Win7
if (window.navigator.userAgent.indexOf("Windows NT 6.1") > -1) { if (window.navigator.userAgent.indexOf("Windows NT 6.1") > -1) {
this.alert.html = `<b style="background: #222; border-radius: .5rem; padding: .25rem .5rem;">Windows 7</b> is not supported. Consider upgrading Windows, or installing Linux.`; this.alert.html = `<b style="background: #222; border-radius: .5rem; padding: .25rem .5rem; margin: 0 .25rem;">Windows 7</b> is not supported. Consider upgrading Windows, or installing Linux.`;
this.alert.show = true; this.alert.show = true;
} }
}, 1000); }, 1000);
+9 -3
View File
@@ -3,7 +3,9 @@
<h1 class="primary--text">Basic Fetching Tutorial</h1> <h1 class="primary--text">Basic Fetching Tutorial</h1>
<span>Example to get votes of a given YouTube video ID:</span> <span>Example to get votes of a given YouTube video ID:</span>
<a href="https://youtube.com/watch?v=kxOuG8jMIgI" target="_blank">kxOuG8jMIgI</a> <a href="https://youtube.com/watch?v=kxOuG8jMIgI" target="_blank"
>kxOuG8jMIgI</a
>
<h2>Example Request:</h2> <h2>Example Request:</h2>
<span>Request URL:</span> <span>Request URL:</span>
@@ -45,8 +47,12 @@
</div> </div>
<br /> <br />
<v-alert border="left" color="orange" text type="info"> <v-alert border="left" color="orange" text type="info">
<span>An invalid YouTube ID will return status code 404 "Not Found".</span><br /> <span>An invalid YouTube ID will return status code 404 "Not Found".</span
<span>An incorrectly formatted YouTube ID will return 400 "Bad Request".</span> ><br />
<span
>An incorrectly formatted YouTube ID will return 400 "Bad
Request".</span
>
</v-alert> </v-alert>
<a :href="endpointUrl" target="_blank" v-text="endpointUrl" /> <a :href="endpointUrl" target="_blank" v-text="endpointUrl" />
+15 -9
View File
@@ -1,5 +1,8 @@
<template> <template>
<div style="width: 80vw" class="col-xs-12 col-sm-11 col-md-9 col-lg-7 mx-auto"> <div
style="width: 80vw"
class="col-xs-12 col-sm-11 col-md-9 col-lg-7 mx-auto"
>
<h1 class="title-text pt-12">Troubleshooting</h1> <h1 class="title-text pt-12">Troubleshooting</h1>
<ol style="line-height: 3rem; color: #aaa" class="text-left"> <ol style="line-height: 3rem; color: #aaa" class="text-left">
<li> <li>
@@ -10,8 +13,8 @@
right now right now
</li> </li>
<li> <li>
Try removing extension and installing it again, then restarting the browser (all Try removing extension and installing it again, then restarting the
active windows, not just one tab). browser (all active windows, not just one tab).
</li> </li>
<li> <li>
Make sure that this link opens: Make sure that this link opens:
@@ -25,8 +28,9 @@
, <br /> , <br />
you should see plain text: <br /> you should see plain text: <br />
<span style="color: #eee"> <span style="color: #eee">
{"id":"QOFEgexls14", "dateCreated":"2021-12-15T16:54:12.250813Z", "likes":2907, {"id":"QOFEgexls14", "dateCreated":"2021-12-15T16:54:12.250813Z",
"dislikes":215, "rating":4.725641025641026, "viewCount":28222, "deleted":false} "likes":2907, "dislikes":215, "rating":4.725641025641026,
"viewCount":28222, "deleted":false}
</span> </span>
</li> </li>
<li> <li>
@@ -73,8 +77,8 @@
</li> </li>
<li style="position: relative; width: 100%"> <li style="position: relative; width: 100%">
Take screenshot of page with problem (i.e. youtube video page) with console Take screenshot of page with problem (i.e. youtube video page) with
open (press <code>F12</code>) - example screenshot below. console open (press <code>F12</code>) - example screenshot below.
<img <img
width="100%" width="100%"
style="border-radius: 1rem; border: 2px solid #333" style="border-radius: 1rem; border: 2px solid #333"
@@ -84,13 +88,15 @@
</li> </li>
<li> <li>
Take screenshot of extensions page of your browser with extension installed. Take screenshot of extensions page of your browser with extension
installed.
<br /> <br />
To see extensions put this into adress bar: To see extensions put this into adress bar:
<br /> <br />
<code>about:addons</code> for Firefox <code>about:addons</code> for Firefox
<br /> <br />
<code>chrome://extensions</code> for Chrome, Edge, Brave, Opera, Vivaldi <code>chrome://extensions</code> for Chrome, Edge, Brave, Opera,
Vivaldi
</li> </li>
</ol> </ol>
</li> </li>