mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
Remove circular dependencies between utility functions
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { replaceBioSymbols } from './common';
|
import { replaceBioSymbols } from './base/string';
|
||||||
import { useAuthStore } from '../../stores';
|
import { useAuthStore } from '../../stores';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -99,11 +99,58 @@ function changeLogRemoveLinks(text) {
|
|||||||
return text.replace(/([^!])\[[^\]]+\]\([^)]+\)/g, '$1');
|
return text.replace(/([^!])\[[^\]]+\]\([^)]+\)/g, '$1');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {string} text
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function replaceBioSymbols(text) {
|
||||||
|
if (typeof text !== 'string') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
const symbolList = {
|
||||||
|
'@': '@',
|
||||||
|
'#': '#',
|
||||||
|
$: '$',
|
||||||
|
'%': '%',
|
||||||
|
'&': '&',
|
||||||
|
'=': '=',
|
||||||
|
'+': '+',
|
||||||
|
'/': '⁄',
|
||||||
|
'\\': '\',
|
||||||
|
';': ';',
|
||||||
|
':': '˸',
|
||||||
|
',': '‚',
|
||||||
|
'?': '?',
|
||||||
|
'!': 'ǃ',
|
||||||
|
'"': '"',
|
||||||
|
'<': '≺',
|
||||||
|
'>': '≻',
|
||||||
|
'.': '․',
|
||||||
|
'^': '^',
|
||||||
|
'{': '{',
|
||||||
|
'}': '}',
|
||||||
|
'[': '[',
|
||||||
|
']': ']',
|
||||||
|
'(': '(',
|
||||||
|
')': ')',
|
||||||
|
'|': '|',
|
||||||
|
'*': '∗'
|
||||||
|
};
|
||||||
|
let newText = text;
|
||||||
|
for (const key in symbolList) {
|
||||||
|
const regex = new RegExp(symbolList[key], 'g');
|
||||||
|
newText = newText.replace(regex, key);
|
||||||
|
}
|
||||||
|
return newText.replace(/ {1,}/g, ' ').trimRight();
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
escapeTag,
|
escapeTag,
|
||||||
escapeTagRecursive,
|
escapeTagRecursive,
|
||||||
textToHex,
|
textToHex,
|
||||||
commaNumber,
|
commaNumber,
|
||||||
localeIncludes,
|
localeIncludes,
|
||||||
changeLogRemoveLinks
|
changeLogRemoveLinks,
|
||||||
|
replaceBioSymbols
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import {
|
|||||||
useSearchStore,
|
useSearchStore,
|
||||||
useWorldStore
|
useWorldStore
|
||||||
} from '../../stores';
|
} from '../../stores';
|
||||||
|
import { escapeTag, replaceBioSymbols } from './base/string';
|
||||||
import { AppDebug } from '../../service/appConfig.js';
|
import { AppDebug } from '../../service/appConfig.js';
|
||||||
import { compareUnityVersion } from './avatar';
|
import { compareUnityVersion } from './avatar';
|
||||||
import { escapeTag } from './base/string';
|
|
||||||
import { miscRequest } from '../../api';
|
import { miscRequest } from '../../api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -345,52 +345,6 @@ function buildTreeData(json) {
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {string} text
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
function replaceBioSymbols(text) {
|
|
||||||
if (typeof text !== 'string') {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
const symbolList = {
|
|
||||||
'@': '@',
|
|
||||||
'#': '#',
|
|
||||||
$: '$',
|
|
||||||
'%': '%',
|
|
||||||
'&': '&',
|
|
||||||
'=': '=',
|
|
||||||
'+': '+',
|
|
||||||
'/': '⁄',
|
|
||||||
'\\': '\',
|
|
||||||
';': ';',
|
|
||||||
':': '˸',
|
|
||||||
',': '‚',
|
|
||||||
'?': '?',
|
|
||||||
'!': 'ǃ',
|
|
||||||
'"': '"',
|
|
||||||
'<': '≺',
|
|
||||||
'>': '≻',
|
|
||||||
'.': '․',
|
|
||||||
'^': '^',
|
|
||||||
'{': '{',
|
|
||||||
'}': '}',
|
|
||||||
'[': '[',
|
|
||||||
']': ']',
|
|
||||||
'(': '(',
|
|
||||||
')': ')',
|
|
||||||
'|': '|',
|
|
||||||
'*': '∗'
|
|
||||||
};
|
|
||||||
let newText = text;
|
|
||||||
for (const key in symbolList) {
|
|
||||||
const regex = new RegExp(symbolList[key], 'g');
|
|
||||||
newText = newText.replace(regex, key);
|
|
||||||
}
|
|
||||||
return newText.replace(/ {1,}/g, ' ').trimRight();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} link
|
* @param {string} link
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { instanceRequest } from '../../api';
|
import { instanceRequest } from '../../api';
|
||||||
import { parseLocation } from './location';
|
import { parseLocation } from './locationParser';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user