文字列管理を分離

This commit is contained in:
harukin-expo-dev-env
2025-02-08 08:57:18 +00:00
parent 8e0f04c5b2
commit ea4fa46fe0

View File

@@ -1067,6 +1067,7 @@ export const injectJavascriptData: InjectJavascriptData = (
`;
const normal_train_name = `
const nameReplace = (列車名データ,列番データ,行き先情報) =>{
if(列車名データ.match("サンポート")){
const textBase = 列車名データ.split(":")[1];
行き先情報.innerText = textBase+行き先情報.innerText;
@@ -1185,7 +1186,9 @@ const data = getJRF(列番データ);
}
}
行き先情報.innerText = getThrew(列番データ) || 行き先情報.innerText;
//列番付与
行き先情報.innerText = 行き先情報.innerText+列番データ+(JRF ? "":"レ");
}
`;
const textInsert =
@@ -1205,12 +1208,8 @@ const setStrings = () =>{
var TrainType = undefined;
setTrainMenuDialog(element)
if(行き先情報.innerText.includes(列番データ))continue; //回避
` +
(iconSetting == "true" ? "setTrainIcon(列番データ,element);" : "") +
normal_train_name +
`
//列番付与
行き先情報.innerText = 行き先情報.innerText+列番データ+(JRF ? "":"レ");
${iconSetting == "true" ? "setTrainIcon(列番データ,element);" : ""}
nameReplace(列車名データ,列番データ,行き先情報);
}
try{
for(let d of document.getElementById('disp').childNodes){
@@ -1309,23 +1308,22 @@ textInsert.observe(document.getElementById('disp'), {
// 列車メニュー表示の起動用スクリプト
const makeTrainView = `
const makeTrainView = new MutationObserver( (mutations) => {
for(let d of modal_content.getElementsByTagName("button") ){
const data = d.onclick.toString().split("\\"")[1];
d.onclick = () => window.ReactNativeWebView.postMessage(data)
}
});
// 監視を開始
makeTrainView.observe(document.getElementById('modal_content'), {
//attributes: true, // 属性変化の監視
//attributeOldValue: true, // 変化前の属性値を matation.oldValue に格納する
//characterData: true, // テキストノードの変化を監視
//characterDataOldValue: true, // 変化前のテキストを matation.oldValue に格納する
childList: true, // 子ノードの変化を監視
//subtree: true // 子孫ノードも監視対象に含める
});
`;
const makeTrainView = new MutationObserver( (mutations) => {
for(let d of modal_content.getElementsByTagName("button") ){
const data = d.onclick.toString().split("\\"")[1];
d.onclick = () => window.ReactNativeWebView.postMessage(data)
}
});
// 監視を開始
makeTrainView.observe(document.getElementById('modal_content'), {
//attributes: true, // 属性変化の監視
//attributeOldValue: true, // 変化前の属性値を matation.oldValue に格納する
//characterData: true, // テキストノードの変化を監視
//characterDataOldValue: true, // 変化前のテキストを matation.oldValue に格納する
childList: true, // 子ノードの変化を監視
//subtree: true // 子ノードも監視対象に含める
});
`;
const makeTrainMenu =
trainMenu == "true"
? `
@@ -1403,6 +1401,7 @@ setStationMenuDialog.observe(document.querySelector('#disp'), {
bootData +
topMenu +
trainIcon +
normal_train_name +
makeTrainView +
makeTrainMenu +
textInsert +