added function to remove control characters from names
This commit is contained in:
@@ -70,7 +70,8 @@ export const constructAvatarUrl = (hash, size) => {
|
|||||||
export const sortObjectValue = (obj, direction = 'asc') => {
|
export const sortObjectValue = (obj, direction = 'asc') => {
|
||||||
const sortable = []
|
const sortable = []
|
||||||
for (let key in obj) {
|
for (let key in obj) {
|
||||||
sortable.push([key, obj[key]])}
|
sortable.push([key, obj[key]])
|
||||||
|
}
|
||||||
|
|
||||||
if (direction === 'asc') {
|
if (direction === 'asc') {
|
||||||
sortable.sort((a, b) => {
|
sortable.sort((a, b) => {
|
||||||
@@ -101,3 +102,12 @@ export const scrollToPos = (pos = 0) => {
|
|||||||
behavior: 'smooth'
|
behavior: 'smooth'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const StripControlCodes = (str = '') => {
|
||||||
|
const regexpControl = /\p{C}/gu;
|
||||||
|
return str.replace(regexpControl, '')
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ProcessName = (str = '') => {
|
||||||
|
return StripControlCodes(str).trim()
|
||||||
|
}
|
||||||
|
@@ -32,7 +32,9 @@ import {
|
|||||||
setTitle,
|
setTitle,
|
||||||
sortObjectValue,
|
sortObjectValue,
|
||||||
truncate,
|
truncate,
|
||||||
scrollToPos
|
scrollToPos,
|
||||||
|
StripControlCodes,
|
||||||
|
ProcessName
|
||||||
} from "./Utils";
|
} from "./Utils";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@@ -68,5 +70,7 @@ export {
|
|||||||
CreatePlayersArray,
|
CreatePlayersArray,
|
||||||
GetMatches,
|
GetMatches,
|
||||||
LoadMoreMatchesExplore,
|
LoadMoreMatchesExplore,
|
||||||
scrollToPos
|
scrollToPos,
|
||||||
|
StripControlCodes,
|
||||||
|
ProcessName
|
||||||
}
|
}
|
||||||
|
@@ -134,7 +134,7 @@ import {
|
|||||||
FormatFullDate,
|
FormatFullDate,
|
||||||
GetMatchDetails,
|
GetMatchDetails,
|
||||||
GoToLink,
|
GoToLink,
|
||||||
LoadImage
|
LoadImage, ProcessName
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
import {useStore} from "vuex";
|
import {useStore} from "vuex";
|
||||||
import {useRoute} from 'vue-router'
|
import {useRoute} from 'vue-router'
|
||||||
@@ -173,6 +173,11 @@ export default {
|
|||||||
})
|
})
|
||||||
|
|
||||||
data.matchDetails = store.state.matchDetails
|
data.matchDetails = store.state.matchDetails
|
||||||
|
|
||||||
|
data.matchDetails.stats.forEach(p => {
|
||||||
|
p.player.name = ProcessName(p.player.name)
|
||||||
|
})
|
||||||
|
|
||||||
data.stats = data.matchDetails.stats
|
data.stats = data.matchDetails.stats
|
||||||
data.score = data.matchDetails.score
|
data.score = data.matchDetails.score
|
||||||
|
|
||||||
|
@@ -157,7 +157,8 @@ import {
|
|||||||
SaveLastVisitedToLocalStorage,
|
SaveLastVisitedToLocalStorage,
|
||||||
scrollToPos,
|
scrollToPos,
|
||||||
setTitle,
|
setTitle,
|
||||||
TrackMe
|
TrackMe,
|
||||||
|
ProcessName
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
import {FOOTER_HEIGHT, NAV_HEIGHT} from "@/constants";
|
import {FOOTER_HEIGHT, NAV_HEIGHT} from "@/constants";
|
||||||
import MatchesTable from "@/components/MatchesTable";
|
import MatchesTable from "@/components/MatchesTable";
|
||||||
@@ -189,7 +190,7 @@ export default {
|
|||||||
tie: 0,
|
tie: 0,
|
||||||
total: 0
|
total: 0
|
||||||
},
|
},
|
||||||
playerMeta: {}
|
playerMeta: {},
|
||||||
})
|
})
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
@@ -249,6 +250,8 @@ export default {
|
|||||||
|
|
||||||
if (res === 200 && resData) {
|
if (res === 200 && resData) {
|
||||||
if (resData.steamid64 !== store.state.playerDetails.steamid64 || reset) {
|
if (resData.steamid64 !== store.state.playerDetails.steamid64 || reset) {
|
||||||
|
resData.name = ProcessName(resData.name)
|
||||||
|
|
||||||
store.commit('resetPlayerDetails')
|
store.commit('resetPlayerDetails')
|
||||||
store.commit({
|
store.commit({
|
||||||
type: 'changePlayerDetails',
|
type: 'changePlayerDetails',
|
||||||
|
Reference in New Issue
Block a user