|
@@ -17,6 +17,11 @@ const browserInfo = browser();
|
|
|
dayjs.extend(duration);
|
|
|
|
|
|
/**
|
|
|
+ * 需要隐藏的中文速度文本
|
|
|
+ */
|
|
|
+const hideSpeedWords: string[] = ["中速"];
|
|
|
+
|
|
|
+/**
|
|
|
* 获取节拍器的时间
|
|
|
* @param speed 速度
|
|
|
* @param firstMeasure 曲谱第一个小节
|
|
@@ -624,6 +629,7 @@ export const formatXML = (xml: string, xmlUrl?: string): string => {
|
|
|
// 解析处理evxml
|
|
|
if (state.isEvxml) {
|
|
|
analyzeEvxml(xmlParse, xmlUrl);
|
|
|
+ customizationXml(xmlParse);
|
|
|
}
|
|
|
// const words: any = xmlParse.getElementsByTagName("words");
|
|
|
// for (const word of words) {
|
|
@@ -660,6 +666,15 @@ export const formatXML = (xml: string, xmlUrl?: string): string => {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ // 如果有特殊中文速度文本,需要删除
|
|
|
+ if (measure.getElementsByTagName("words").length && state.isEvxml) {
|
|
|
+ const wordList = Array.from(measure.getElementsByTagName("words")) || [];
|
|
|
+ wordList.forEach((word: any) => {
|
|
|
+ if(hideSpeedWords.includes(word?.textContent) && word?.parentNode?.parentNode) {
|
|
|
+ measure.removeChild(word.parentNode.parentNode);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
if (measure.getElementsByTagName("note").length === 0) {
|
|
|
const forwardTimeElement = measure.getElementsByTagName("forward")[0]?.getElementsByTagName("duration")[0];
|
|
|
if (forwardTimeElement) {
|
|
@@ -1254,6 +1269,28 @@ export const verifyCanRepeat = (startNum: number, endNum: number) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 处理妙极客xml谱面
|
|
|
+const customizationXml = (xmlParse: any) => {
|
|
|
+ const credits: any = Array.from(xmlParse.querySelectorAll('credit'));
|
|
|
+ const creators: any = Array.from(xmlParse.querySelectorAll('creator'));
|
|
|
+ if (credits && credits.length) {
|
|
|
+ for (const credit of credits) {
|
|
|
+ if (credit.getElementsByTagName("credit-type")?.[0]?.textContent === 'lyricist') {
|
|
|
+ const creditWord = credit.getElementsByTagName("credit-words")
|
|
|
+ creditWord?.[0].setAttribute('justify', 'right')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (creators && creators.length) {
|
|
|
+ for (const creator of creators) {
|
|
|
+ if (creator.getAttribute('type') === 'lyricist') {
|
|
|
+ // creator.textContent = '测试一下1';
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 计算evxml的起始播放时间
|
|
|
const analyzeEvxml = (xmlParse: any, xmlUrl?: string) => {
|
|
|
// xml拍号数
|