|
@@ -252,10 +252,10 @@ export const getCustomInfo = (xml: string): CustomInfo => {
|
|
|
showSpeed: true,
|
|
|
parsedXML: xml,
|
|
|
};
|
|
|
- console.time('解析xml 耗时3')
|
|
|
+ //console.time('解析xml 耗时3')
|
|
|
// const xmlParse = new DOMParser().parseFromString(xml, "text/xml");
|
|
|
const xmlParse = xmlDocRef.value ? xmlDocRef.value : new DOMParser().parseFromString(xml, "text/xml");
|
|
|
- console.timeEnd('解析xml 耗时3')
|
|
|
+ //console.timeEnd('解析xml 耗时3')
|
|
|
const words: any = xmlParse?.getElementsByTagName("words");
|
|
|
for (const word of words) {
|
|
|
if (word && word.textContent?.trim() === "隐藏速度") {
|
|
@@ -365,10 +365,10 @@ export const onlyVisible = (xml: string, partIndex: number, resourceType?: strin
|
|
|
if (!xml) return "";
|
|
|
// console.log('原始xml')
|
|
|
const detailId = state.examSongId + "";
|
|
|
- console.time('解析xml 耗时4')
|
|
|
+ //console.time('解析xml 耗时4')
|
|
|
// const xmlParse = new DOMParser().parseFromString(xml, "text/xml");
|
|
|
const xmlParse = xmlDocRef.value ? xmlDocRef.value : new DOMParser().parseFromString(xml, "text/xml");
|
|
|
- console.timeEnd('解析xml 耗时4')
|
|
|
+ //console.timeEnd('解析xml 耗时4')
|
|
|
const partList = xmlParse.getElementsByTagName("part-list")?.[0]?.getElementsByTagName("score-part") || [];
|
|
|
const partListNames = Array.from(partList).map((item) => item.getElementsByTagName("part-name")?.[0]?.textContent?.trim() || "");
|
|
|
const parts: any = xmlParse.getElementsByTagName("part");
|
|
@@ -634,9 +634,9 @@ export const formatZoom = (num = 1) => {
|
|
|
/** 妙极客多分轨的曲子,可能没有part-name标签,需要手动加上该标签 */
|
|
|
export const xmlAddPartName = (xml: string) => {
|
|
|
if (!xml) return "";
|
|
|
- console.time('解析xml 耗时6')
|
|
|
+ console.time('解析xml 耗时')
|
|
|
const xmlParse = new DOMParser().parseFromString(xml, "text/xml");
|
|
|
- console.timeEnd('解析xml 耗时6')
|
|
|
+ console.timeEnd('解析xml 耗时')
|
|
|
const scoreParts = Array.from(xmlParse.getElementsByTagName("score-part"));
|
|
|
for (const scorePart of scoreParts) {
|
|
|
if (scorePart.getElementsByTagName("part-name").length === 0) {
|
|
@@ -659,10 +659,10 @@ export const xmlAddPartName = (xml: string) => {
|
|
|
*/
|
|
|
export const formatXML = (xml: string, xmlUrl?: string): string => {
|
|
|
if (!xml) return "";
|
|
|
- console.time('解析xml 耗时7')
|
|
|
+ //console.time('解析xml 耗时7')
|
|
|
// const xmlParse = new DOMParser().parseFromString(xml, "text/xml");
|
|
|
const xmlParse = xmlDocRef.value ? xmlDocRef.value : new DOMParser().parseFromString(xml, "text/xml");
|
|
|
- console.timeEnd('解析xml 耗时7')
|
|
|
+ //console.timeEnd('解析xml 耗时7')
|
|
|
// 声调
|
|
|
const fifths = xmlParse.getElementsByTagName("fifths");
|
|
|
if (fifths && fifths.length) {
|
|
@@ -818,6 +818,7 @@ export const formatXML = (xml: string, xmlUrl?: string): string => {
|
|
|
transferJianNote(measure, divisions, preBeats, preBeatType)
|
|
|
}
|
|
|
}
|
|
|
+ xmlDocRef.value = xmlParse;
|
|
|
return new XMLSerializer().serializeToString(xmlParse);
|
|
|
};
|
|
|
|