From ea4fa46fe0a202728da1f2f3f8e43b1c251d86f8 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 8 Feb 2025 08:57:18 +0000 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E5=AD=97=E5=88=97=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=82=92=E5=88=86=E9=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/webViewInjectjavascript.ts | 47 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/lib/webViewInjectjavascript.ts b/lib/webViewInjectjavascript.ts index ff05fb3..07895fe 100644 --- a/lib/webViewInjectjavascript.ts +++ b/lib/webViewInjectjavascript.ts @@ -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 +