refactoring part 1

This commit is contained in:
Peter Papp
2021-08-23 09:32:21 +02:00
parent a926545146
commit cc0436b8f3
8 changed files with 54 additions and 59 deletions

View File

@@ -212,20 +212,6 @@ const FunctionHelpers = {
return locations.includes(route.name)
}
Vue.prototype.$isThisLocation = function (location) {
// Get current location
let currentLocation = store.getters.currentFolder && store.getters.currentFolder.location ? store.getters.currentFolder.location : undefined
// Check if type is object
if (typeof location === 'Object' || location instanceof Object) {
return location.includes(currentLocation)
} else {
return currentLocation === location
}
}
Vue.prototype.$checkPermission = function (type) {
let currentPermission = store.getters.permission
@@ -239,22 +225,6 @@ const FunctionHelpers = {
}
}
Vue.prototype.$isMobile = function () {
const toMatch = [
/Android/i,
/webOS/i,
/iPhone/i,
/iPad/i,
/iPod/i,
/BlackBerry/i,
/Windows Phone/i
]
return toMatch.some(toMatchItem => {
return navigator.userAgent.match(toMatchItem)
})
}
Vue.prototype.$isSomethingWrong = function () {
events.$emit('alert:open', {
title: i18n.t('popup_error.title'),
@@ -305,10 +275,8 @@ const FunctionHelpers = {
}
// Detect windows
Vue.prototype.$checkOS = function () {
if (navigator.userAgent.indexOf('Windows') != -1) {
document.body.classList.add('windows')
}
Vue.prototype.$isWIndows = function () {
return navigator.userAgent.indexOf('Windows') != -1
}
// Check if device is Apple
@@ -328,6 +296,22 @@ const FunctionHelpers = {
})
}
Vue.prototype.$isMobile = function () {
const toMatch = [
/Android/i,
/webOS/i,
/iPhone/i,
/iPad/i,
/iPod/i,
/BlackBerry/i,
/Windows Phone/i
]
return toMatch.some(toMatchItem => {
return navigator.userAgent.match(toMatchItem)
})
}
Vue.prototype.$closePopup = function () {
events.$emit('popup:close')
}