undefined typeof
This commit is contained in:
parent
d62716e301
commit
0eb63de209
13 changed files with 25 additions and 25 deletions
|
|
@ -409,7 +409,7 @@ const getNodeInfo = async ({ store }) => {
|
||||||
|
|
||||||
useInstanceCapabilitiesStore().set(
|
useInstanceCapabilitiesStore().set(
|
||||||
'tagPolicyAvailable',
|
'tagPolicyAvailable',
|
||||||
typeof federation.mrf_policies === 'undefined'
|
federation.mrf_policies === undefined
|
||||||
? false
|
? false
|
||||||
: metadata.federation.mrf_policies.includes('TagPolicy'),
|
: metadata.federation.mrf_policies.includes('TagPolicy'),
|
||||||
)
|
)
|
||||||
|
|
@ -421,7 +421,7 @@ const getNodeInfo = async ({ store }) => {
|
||||||
useInstanceStore().set({
|
useInstanceStore().set({
|
||||||
path: 'federating',
|
path: 'federating',
|
||||||
value:
|
value:
|
||||||
typeof federation.enabled === 'undefined' ? true : federation.enabled,
|
federation.enabled === undefined ? true : federation.enabled,
|
||||||
})
|
})
|
||||||
|
|
||||||
const accountActivationRequired = metadata.accountActivationRequired
|
const accountActivationRequired = metadata.accountActivationRequired
|
||||||
|
|
@ -547,7 +547,7 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => {
|
||||||
|
|
||||||
const overrides = window.___pleromafe_dev_overrides || {}
|
const overrides = window.___pleromafe_dev_overrides || {}
|
||||||
const server =
|
const server =
|
||||||
typeof overrides.target !== 'undefined'
|
overrides.target !== undefined
|
||||||
? overrides.target
|
? overrides.target
|
||||||
: window.location.origin
|
: window.location.origin
|
||||||
useInstanceStore().set({ path: 'server', value: server })
|
useInstanceStore().set({ path: 'server', value: server })
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ const Chat = {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener('scroll', this.handleScroll)
|
window.addEventListener('scroll', this.handleScroll)
|
||||||
if (typeof document.hidden !== 'undefined') {
|
if (document.hidden !== undefined) {
|
||||||
document.addEventListener(
|
document.addEventListener(
|
||||||
'visibilitychange',
|
'visibilitychange',
|
||||||
this.handleVisibilityChange,
|
this.handleVisibilityChange,
|
||||||
|
|
@ -74,7 +74,7 @@ const Chat = {
|
||||||
unmounted() {
|
unmounted() {
|
||||||
window.removeEventListener('scroll', this.handleScroll)
|
window.removeEventListener('scroll', this.handleScroll)
|
||||||
window.removeEventListener('resize', this.handleResize)
|
window.removeEventListener('resize', this.handleResize)
|
||||||
if (typeof document.hidden !== 'undefined')
|
if (document.hidden !== undefined)
|
||||||
document.removeEventListener(
|
document.removeEventListener(
|
||||||
'visibilitychange',
|
'visibilitychange',
|
||||||
this.handleVisibilityChange,
|
this.handleVisibilityChange,
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ export default {
|
||||||
emits: ['update:modelValue'],
|
emits: ['update:modelValue'],
|
||||||
computed: {
|
computed: {
|
||||||
present() {
|
present() {
|
||||||
return typeof this.modelValue !== 'undefined'
|
return this.modelValue !== undefined
|
||||||
},
|
},
|
||||||
validColor() {
|
validColor() {
|
||||||
return hex2rgb(this.modelValue || this.fallback)
|
return hex2rgb(this.modelValue || this.fallback)
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ export default {
|
||||||
emits: ['update:modelValue'],
|
emits: ['update:modelValue'],
|
||||||
computed: {
|
computed: {
|
||||||
present() {
|
present() {
|
||||||
return typeof this.modelValue !== 'undefined'
|
return this.modelValue !== undefined
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ export default {
|
||||||
emits: ['update:modelValue'],
|
emits: ['update:modelValue'],
|
||||||
computed: {
|
computed: {
|
||||||
present() {
|
present() {
|
||||||
return typeof this.modelValue !== 'undefined'
|
return this.modelValue !== undefined
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ export default {
|
||||||
emits: ['update:modelValue'],
|
emits: ['update:modelValue'],
|
||||||
computed: {
|
computed: {
|
||||||
present() {
|
present() {
|
||||||
return typeof this.modelValue !== 'undefined'
|
return this.modelValue !== undefined
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ export default {
|
||||||
return this.source || this.defaultSource
|
return this.source || this.defaultSource
|
||||||
},
|
},
|
||||||
realDraftMode() {
|
realDraftMode() {
|
||||||
return typeof this.draftMode === 'undefined'
|
return this.draftMode === undefined
|
||||||
? this.defaultDraftMode
|
? this.defaultDraftMode
|
||||||
: this.draftMode
|
: this.draftMode
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (typeof this.shadowSelected === 'undefined') {
|
if (this.shadowSelected === undefined) {
|
||||||
this.shadowSelected = this.shadowsAvailable[0]
|
this.shadowSelected = this.shadowsAvailable[0]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -634,15 +634,15 @@ export default {
|
||||||
if (input.version) version = input.version
|
if (input.version) version = input.version
|
||||||
// Old v1 naming: fg is text, btn is foreground
|
// Old v1 naming: fg is text, btn is foreground
|
||||||
if (
|
if (
|
||||||
typeof colors.text === 'undefined' &&
|
colors.text === undefined &&
|
||||||
typeof colors.fg !== 'undefined'
|
colors.fg !== undefined
|
||||||
) {
|
) {
|
||||||
version = 1
|
version = 1
|
||||||
}
|
}
|
||||||
// New v2 naming: text is text, fg is foreground
|
// New v2 naming: text is text, fg is foreground
|
||||||
if (
|
if (
|
||||||
typeof colors.text !== 'undefined' &&
|
colors.text !== undefined &&
|
||||||
typeof colors.fg !== 'undefined'
|
colors.fg !== undefined
|
||||||
) {
|
) {
|
||||||
version = 2
|
version = 2
|
||||||
}
|
}
|
||||||
|
|
@ -679,7 +679,7 @@ export default {
|
||||||
if (opacity && !this.keepOpacity) {
|
if (opacity && !this.keepOpacity) {
|
||||||
this.clearOpacity()
|
this.clearOpacity()
|
||||||
Object.entries(opacity).forEach(([k, v]) => {
|
Object.entries(opacity).forEach(([k, v]) => {
|
||||||
if (typeof v === 'undefined' || v === null || Number.isNaN(v)) return
|
if (v === undefined || v === null || Number.isNaN(v)) return
|
||||||
this[k + 'OpacityLocal'] = v
|
this[k + 'OpacityLocal'] = v
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ const Timeline = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (typeof document.hidden !== 'undefined') {
|
if (document.hidden !== undefined) {
|
||||||
document.addEventListener(
|
document.addEventListener(
|
||||||
'visibilitychange',
|
'visibilitychange',
|
||||||
this.handleVisibilityChange,
|
this.handleVisibilityChange,
|
||||||
|
|
@ -168,7 +168,7 @@ const Timeline = {
|
||||||
unmounted() {
|
unmounted() {
|
||||||
window.removeEventListener('scroll', this.handleScroll)
|
window.removeEventListener('scroll', this.handleScroll)
|
||||||
window.removeEventListener('keydown', this.handleShortKey)
|
window.removeEventListener('keydown', this.handleShortKey)
|
||||||
if (typeof document.hidden !== 'undefined')
|
if (document.hidden !== undefined)
|
||||||
document.removeEventListener(
|
document.removeEventListener(
|
||||||
'visibilitychange',
|
'visibilitychange',
|
||||||
this.handleVisibilityChange,
|
this.handleVisibilityChange,
|
||||||
|
|
|
||||||
|
|
@ -34,15 +34,15 @@ const VideoAttachment = {
|
||||||
// If hasAudio is false, we've already marked this video to not have audio,
|
// If hasAudio is false, we've already marked this video to not have audio,
|
||||||
// a video can't gain audio out of nowhere so don't bother checking again.
|
// a video can't gain audio out of nowhere so don't bother checking again.
|
||||||
if (!this.hasAudio) return
|
if (!this.hasAudio) return
|
||||||
if (typeof target.webkitAudioDecodedByteCount !== 'undefined') {
|
if (target.webkitAudioDecodedByteCount !== undefined) {
|
||||||
// non-zero if video has audio track
|
// non-zero if video has audio track
|
||||||
if (target.webkitAudioDecodedByteCount > 0) return
|
if (target.webkitAudioDecodedByteCount > 0) return
|
||||||
}
|
}
|
||||||
if (typeof target.mozHasAudio !== 'undefined') {
|
if (target.mozHasAudio !== undefined) {
|
||||||
// true if video has audio track
|
// true if video has audio track
|
||||||
if (target.mozHasAudio) return
|
if (target.mozHasAudio) return
|
||||||
}
|
}
|
||||||
if (typeof target.audioTracks !== 'undefined') {
|
if (target.audioTracks !== undefined) {
|
||||||
if (target.audioTracks.length > 0) return
|
if (target.audioTracks.length > 0) return
|
||||||
}
|
}
|
||||||
this.hasAudio = false
|
this.hasAudio = false
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ export const getTextColor = function (bg, text, preserve) {
|
||||||
contrast = getContrastRatio(bg, convert(result).rgb)
|
contrast = getContrastRatio(bg, convert(result).rgb)
|
||||||
}
|
}
|
||||||
|
|
||||||
const base = typeof text.a !== 'undefined' ? { a: text.a } : {}
|
const base = text.a !== undefined ? { a: text.a } : {}
|
||||||
return Object.assign(convert(result).rgb, base)
|
return Object.assign(convert(result).rgb, base)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ export const parseUser = (data) => {
|
||||||
// deactivated was changed to is_active in Pleroma 2.3.0
|
// deactivated was changed to is_active in Pleroma 2.3.0
|
||||||
// so check if is_active is present
|
// so check if is_active is present
|
||||||
output.deactivated =
|
output.deactivated =
|
||||||
typeof data.pleroma.is_active !== 'undefined'
|
data.pleroma.is_active !== undefined
|
||||||
? !data.pleroma.is_active // new backend
|
? !data.pleroma.is_active // new backend
|
||||||
: data.pleroma.deactivated // old backend
|
: data.pleroma.deactivated // old backend
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -523,7 +523,7 @@ export const generateColors = (themeData) => {
|
||||||
(acc, [k, v]) => {
|
(acc, [k, v]) => {
|
||||||
if (!v) return acc
|
if (!v) return acc
|
||||||
acc.solid[k] = rgb2hex(v)
|
acc.solid[k] = rgb2hex(v)
|
||||||
acc.complete[k] = typeof v.a === 'undefined' ? rgb2hex(v) : rgba2css(v)
|
acc.complete[k] = v.a === undefined ? rgb2hex(v) : rgba2css(v)
|
||||||
return acc
|
return acc
|
||||||
},
|
},
|
||||||
{ complete: {}, solid: {} },
|
{ complete: {}, solid: {} },
|
||||||
|
|
@ -545,7 +545,7 @@ export const generateColors = (themeData) => {
|
||||||
export const generateRadii = (input) => {
|
export const generateRadii = (input) => {
|
||||||
let inputRadii = input.radii || {}
|
let inputRadii = input.radii || {}
|
||||||
// v1 -> v2
|
// v1 -> v2
|
||||||
if (typeof input.btnRadius !== 'undefined') {
|
if (input.btnRadius !== undefined) {
|
||||||
inputRadii = Object.entries(input)
|
inputRadii = Object.entries(input)
|
||||||
.filter(([k]) => k.endsWith('Radius'))
|
.filter(([k]) => k.endsWith('Radius'))
|
||||||
.reduce((acc, e) => {
|
.reduce((acc, e) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue