fix detection of unknown mobile IOS devices
This commit is contained in:
committed by
Pete Matsyburka
parent
3c83d459bd
commit
78fb93fd02
@@ -20,7 +20,8 @@ export default targetable(class extends HTMLElement {
|
|||||||
fetch(this.dataset.src).then(async (response) => {
|
fetch(this.dataset.src).then(async (response) => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const urls = await response.json()
|
const urls = await response.json()
|
||||||
const isSafariIos = /iPhone|iPad|iPod/i.test(navigator.userAgent)
|
const isMobileSafariIos = ('ontouchstart' in window || navigator.maxTouchPoints > 0) && /AppleWebKit/i.test(navigator.userAgent)
|
||||||
|
const isSafariIos = isMobileSafariIos || /iPhone|iPad|iPod/i.test(navigator.userAgent)
|
||||||
|
|
||||||
if (isSafariIos && urls.length > 1) {
|
if (isSafariIos && urls.length > 1) {
|
||||||
this.downloadSafariIos(urls)
|
this.downloadSafariIos(urls)
|
||||||
|
|||||||
@@ -215,7 +215,8 @@ export default {
|
|||||||
fetch(this.baseUrl + `/submitters/${this.submitterSlug}/download`).then(async (response) => {
|
fetch(this.baseUrl + `/submitters/${this.submitterSlug}/download`).then(async (response) => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const urls = await response.json()
|
const urls = await response.json()
|
||||||
const isSafariIos = /iPhone|iPad|iPod/i.test(navigator.userAgent)
|
const isMobileSafariIos = ('ontouchstart' in window || navigator.maxTouchPoints > 0) && /AppleWebKit/i.test(navigator.userAgent)
|
||||||
|
const isSafariIos = isMobileSafariIos || /iPhone|iPad|iPod/i.test(navigator.userAgent)
|
||||||
|
|
||||||
if (isSafariIos && urls.length > 1) {
|
if (isSafariIos && urls.length > 1) {
|
||||||
this.downloadSafariIos(urls)
|
this.downloadSafariIos(urls)
|
||||||
|
|||||||
@@ -856,7 +856,9 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isMobile () {
|
isMobile () {
|
||||||
return /android|iphone|ipad/i.test(navigator.userAgent)
|
const isMobileSafariIos = ('ontouchstart' in window || navigator.maxTouchPoints > 0) && /AppleWebKit/i.test(navigator.userAgent)
|
||||||
|
|
||||||
|
return isMobileSafariIos || /android|iphone|ipad/i.test(navigator.userAgent)
|
||||||
},
|
},
|
||||||
readonlyConditionalFieldValues () {
|
readonlyConditionalFieldValues () {
|
||||||
return this.readonlyConditionalFields.reduce((acc, f) => {
|
return this.readonlyConditionalFields.reduce((acc, f) => {
|
||||||
@@ -1111,7 +1113,9 @@ export default {
|
|||||||
this.minimizeForm()
|
this.minimizeForm()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
|
const isMobileSafariIos = ('ontouchstart' in window || navigator.maxTouchPoints > 0) && /AppleWebKit/i.test(navigator.userAgent)
|
||||||
|
|
||||||
|
if (isMobileSafariIos || /iPhone|iPad|iPod/i.test(navigator.userAgent)) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const root = this.$root.$el.parentNode.getRootNode()
|
const root = this.$root.$el.parentNode.getRootNode()
|
||||||
const scrollbox = root.getElementById('scrollbox')
|
const scrollbox = root.getElementById('scrollbox')
|
||||||
|
|||||||
@@ -703,7 +703,9 @@ export default {
|
|||||||
return this.locale.split('-')[0].toLowerCase()
|
return this.locale.split('-')[0].toLowerCase()
|
||||||
},
|
},
|
||||||
isMobile () {
|
isMobile () {
|
||||||
return /android|iphone|ipad/i.test(navigator.userAgent)
|
const isMobileSafariIos = ('ontouchstart' in window || navigator.maxTouchPoints > 0) && /AppleWebKit/i.test(navigator.userAgent)
|
||||||
|
|
||||||
|
return isMobileSafariIos || /android|iphone|ipad/i.test(navigator.userAgent)
|
||||||
},
|
},
|
||||||
defaultDateFormat () {
|
defaultDateFormat () {
|
||||||
const isUsBrowser = Intl.DateTimeFormat().resolvedOptions().locale.endsWith('-US')
|
const isUsBrowser = Intl.DateTimeFormat().resolvedOptions().locale.endsWith('-US')
|
||||||
|
|||||||
@@ -162,7 +162,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
isMobile () {
|
isMobile () {
|
||||||
return /android|iphone|ipad/i.test(navigator.userAgent)
|
const isMobileSafariIos = ('ontouchstart' in window || navigator.maxTouchPoints > 0) && /AppleWebKit/i.test(navigator.userAgent)
|
||||||
|
|
||||||
|
return isMobileSafariIos || /android|iphone|ipad/i.test(navigator.userAgent)
|
||||||
},
|
},
|
||||||
resizeDirectionClasses () {
|
resizeDirectionClasses () {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user