本WIKI于2021年03月04日通过了时雨音的接管申请,编辑权限开放。
欢迎收藏本WIKI防止迷路,也希望有爱的小伙伴和我们一起编辑哟~
建议使用PC版页面访问本WIKI以获得更佳体验!
编辑帮助 • WIKI建议 • 加入我们 • 使用哔哩哔哩APP打开WIKI
全站通知:
用户:646195980/Voice.js
刷
历
编
跳到导航
跳到搜索
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:按 Ctrl-F5。
/**
* VoiceTable.js
* Author: 飞小RAN (https://wiki.biligame.com/gt/User:646195980)
* License: See https://wiki.biligame.com/gt/User:646195980#License
* Look In My Eyes!为什么 Lua 模块不能用 mw.loadJsonData 加载数据!
**/
(function() {
'use strict';
// Part.1 Text
const TextData = JSON.parse(document.querySelector('.voice-data pre').textContent || '{}');
const hero = document.querySelector('.voicetable').dataset.hero;
const path = document.querySelector('.voice-data pre').dataset.json.split('/').map((p, i) => i ? p.replace('.json', '') : p.toLowerCase()).join('_');
const order = [
"zhCN",
"zhTW",
"jaJP",
"koKR",
"enUS",
"deDE",
"frFR",
"esES",
"ptPT",
"thTH",
"itIT",
"ruRU",
"viVN",
"idID",
"arAE"
];
const map = {
"NormalBattleWin": 1,
"myth_NormalBattleWin": 49,
"BossBattleWin": 2,
"myth_BossBattleWin": 50,
"Die": 3,
"myth_Die": 51,
"GetExp": 4,
"LevelUp": 5,
"myth_LevelUp": 52,
"EquipWeapon": 6,
"EquipCostume": 7,
"Evolve": 8,
"Attack1": 9,
"Attack2": 10,
"Attack3": 11,
"myth_Attack3": 53,
"Skill1": 12,
"Skill2": 13,
"myth_Skill2": 54,
"Damaged1": 14,
"Damaged2": 15,
"myth_Damaged2": 55,
"PlayerChooseBright": 16,
"myth_PlayerChooseBright": 56,
"PlayerChooseDark": 17,
"myth_PlayerChooseDark": 57,
"WeakEnemyBattleStart": 18,
"NormalEnemyBattleStart": 19,
"StrongEnemyBattleStart": 20,
"myth_StrongEnemyBattleStart": 58,
"BossBattleStart": 21,
"JoinParty": 22,
"CoopAttack": 23,
"myth_CoopAttack": 59,
"CoopHeal": 24,
"CoopRun": 25,
"CoopWin": 26,
"myth_CoopWin": 60,
"CoopMVP": 27,
"myth_CoopMVP": 61,
"CoopHi": 28,
"myth_CoopHi": 62,
"CoopHurryUp": 29,
"myth_CoopHurryUp": 63,
"CoopBelieve": 30,
"TouchReactionGood1": 31,
"myth_TouchReactionGood1": 64,
"TouchReactionGood2": 32,
"myth_TouchReactionGood2": 65,
"TouchReactionBad1": 33,
"myth_TouchReactionBad1": 66,
"TouchReactionBad2": 34,
"myth_TouchReactionBad2": 67,
"NoticeMail": 35,
"NoticeEvent": 36,
"SummonSpeech1": 37,
"SummonSpeech2": 38,
"SummonSpeech3": 39,
"Special1": 40,
"Special2": 41,
"Special3": 42,
"Special4": 43,
"Special5": 44,
"Special6": 45,
"Special7": 46,
"Special8": 47,
"myth_LeaderSkill": 48
};
let types = {};
for (const key in map) {
if (map.hasOwnProperty(key)) {
types[`${path}_${key}`] = map[key];
}
}
let content = '';
for (const key in types) {
if (TextData.hasOwnProperty(key)) {
let lines = '';
let title;
if (types[key] >= 48) {
title = key.split('_').slice(-2).join('_');
} else {
title = key.split('_').at(-1);
}
const index = types[key].toString().padStart(2, '0');
order.forEach(order => {
let show;
if (order === 'zhCN'){
show = 'on';
} else {
show = 'off';
}
lines += `<p class="voice-line" lang="${order.slice(0, 2)}" data-lang="${order}" data-show="${show}">${TextData[key][order]||''}</p>`;
});
let row = `<tr data-title="${key}"><th class="voice-title">${title}</th><td class="voice-file mwiki-hide" data-cv="cn" title="汉语"><audio class="voice-player" src="https://wiki.biligame.com/gt/Special:Redirect/file/${hero}汉语${index}.wav" controls="" preload="none" controlslist="noplaybackrate nodownload nofullscreen"></audio></td><td class="voice-file mwiki-hide" data-cv="en" title="英语"><audio class="voice-player" src="https://wiki.biligame.com/gt/Special:Redirect/file/${hero}英语${index}.wav" controls="" preload="none" controlslist="noplaybackrate nodownload nofullscreen"></audio></td><td class="voice-file mwiki-hide" data-cv="ja" title="日语"><audio class="voice-player" src="https://wiki.biligame.com/gt/Special:Redirect/file/${hero}日语${index}.wav" controls="" preload="none" controlslist="noplaybackrate nodownload nofullscreen"></audio></td><td class="voice-file mwiki-hide" data-cv="ko" title="韩语"><audio class="voice-player" src="https://wiki.biligame.com/gt/Special:Redirect/file/${hero}韩语${index}.wav" controls="" preload="none" controlslist="noplaybackrate nodownload nofullscreen"></audio></td><td class="voice-text">${lines}</td></tr>`;
content += row;
}
}
document.querySelector('.voice-content').outerHTML = content;
// Part.2 Title
let MapData = JSON.parse(document.querySelector(`.jsondata[data-json="Map.json"]`).textContent || '{}');
document.querySelectorAll('.voice-title').forEach(item => {
let text = item.textContent;
if (MapData.hasOwnProperty(text)) {
item.textContent = MapData[text];
}
});
// Part.3 Choice
const filelist = document.querySelector('.voicetable').dataset.file.split(',');
let cvlist = [
{ value: 'cn', label: '汉语', selected: true },
{ value: 'ja', label: '日语' },
{ value: 'en', label: '英语' },
{ value: 'ko', label: '韩语' },
];
cvlist.forEach(i => {
if (!filelist.includes(i.value)) {
i.disabled = 'true';
if (i.value === 'cn' && filelist.includes('ja')) {
cvlist[0].selected = false;
cvlist[1].selected = true;
}
}
});
let Choices = window.Choices;
var voiceSimple = new Choices('#voice-simple', {
allowHTML: true,
searchEnabled: false,
choices: cvlist,
});
voiceSimple.passedElement.element.addEventListener('change', event => {
const value = voiceSimple.getValue(true);
document.querySelector('.voicetable').dataset.cv = value;
});
var voiceMultiple = new Choices('#voice-multiple', {
allowHTML: true,
removeItemButton: true,
maxItemCount: 5,
});
voiceMultiple.passedElement.element.addEventListener('change', event => {
const value = voiceMultiple.getValue(true);
document.querySelectorAll('.voice-line').forEach(i => {
if (value.includes(i.dataset.lang)) {
i.dataset.show = 'on';
} else {
i.dataset.show = 'off';
}
});
});
// Part.4 AnimeChara
window.AnimeChara = [];
window.AnimeChara.push(TextData?.[`${path}_SummonSpeech1`]?.zhCN ?? TextData[`${path}_JoinParty`].zhCN);
window.AnimeChara.push(TextData?.[`${path}_SummonSpeech2`]?.zhCN ?? TextData[`${path}_TouchReactionGood1`].zhCN);
window.AnimeChara.push(TextData?.[`${path}_SummonSpeech3`]?.zhCN ?? TextData[`${path}_TouchReactionGood2`].zhCN);
voiceMultiple.passedElement.element.addEventListener('change', event => {
const value = voiceMultiple.getValue(true);
document.querySelectorAll('.voice-line').forEach(i => {
if (value.includes(i.dataset.lang)) {
i.dataset.show = 'on';
} else {
i.dataset.show = 'off';
}
});
});
// Part.5 End
document.querySelector('.loading').style.display = 'none';
})();

沪公网安备 31011002002714 号