diff --git a/components/Apps/WebView.tsx b/components/Apps/WebView.tsx index 1ea920d..0488fef 100644 --- a/components/Apps/WebView.tsx +++ b/components/Apps/WebView.tsx @@ -144,7 +144,9 @@ export const AppsWebView = ({ openStationACFromEachTrainInfo }) => { favoriteStation[0][0].StationNumber ); if (!string) return () => {}; - webview?.current.injectJavaScript(string); + setTimeout(() => { + webview?.current?.injectJavaScript(string); + }, 500); once = true; }; diff --git a/components/StationDiagram/ListViewItem.tsx b/components/StationDiagram/ListViewItem.tsx index 3340db0..7a3b3d4 100644 --- a/components/StationDiagram/ListViewItem.tsx +++ b/components/StationDiagram/ListViewItem.tsx @@ -58,7 +58,8 @@ export const ListViewItem: FC<{ priority, uwasa, vehicleFormation, - trainInfoUrl,lineColor + trainInfoUrl,lineColor, + trainNumberOverride ] = useMemo(() => { const { type, @@ -69,6 +70,7 @@ export const ListViewItem: FC<{ train_info_url, to_data, to_data_color, + train_number_override, } = customTrainDataDetector(d.trainNumber, allCustomTrainData); const [typeString, fontAvailable, isOneMan] = getStringConfig( type, @@ -109,7 +111,8 @@ export const ListViewItem: FC<{ uwasa, vehicle_formation, train_info_url, - finalColor + finalColor, + train_number_override ]; } @@ -125,7 +128,8 @@ export const ListViewItem: FC<{ uwasa, vehicle_formation, train_info_url, - finalColor + finalColor, + train_number_override ]; default: // 行先がある場合は、行先を取得 @@ -141,7 +145,8 @@ export const ListViewItem: FC<{ uwasa, vehicle_formation, train_info_url, - finalColor + finalColor, + train_number_override ]; } }, [d.array, allCustomTrainData]); @@ -217,7 +222,7 @@ export const ListViewItem: FC<{ sources.push({ label: "運用", text: unitIds.join("・"), badgeColor: "#00BCD4", textColor: isDark ? "#4dd0e1" : "#006064" }); } } - const unyoText = getUnyohubByTrainNumber?.(d.trainNumber); + const unyoText = getUnyohubByTrainNumber?.(trainNumberOverride || d.trainNumber); if (unyoText) { sources.push({ label: "Hub", text: unyoText, badgeColor: "#9E9E9E", textColor: isDark ? "#cccccc" : "#424242" }); } diff --git a/lib/webViewInjectjavascript.ts b/lib/webViewInjectjavascript.ts index 33b34dc..bf93047 100644 --- a/lib/webViewInjectjavascript.ts +++ b/lib/webViewInjectjavascript.ts @@ -817,9 +817,10 @@ export const injectJavascriptData = ({ } const optionalTextColor = optionalText.includes("最終") ? "red" : "black"; - const unyohubFormation = getUnyohubFormation(列番データ); + const unyohubLookupNum = TrainNumberOverride || 列番データ; + const unyohubFormation = getUnyohubFormation(unyohubLookupNum); const hasUnyohub = unyohubFormation !== null; - const unyohubStale = hasUnyohub && isUnyohubStale(列番データ); + const unyohubStale = hasUnyohub && isUnyohubStale(unyohubLookupNum); if(hasUnyohub) { console.log('[UnyoHub] Badge shown for', 列番データ, ':', unyohubFormation, unyohubStale ? '(stale)' : ''); } @@ -861,7 +862,7 @@ export const injectJavascriptData = ({ badgeHtml += "
" + (TrainNumberOverride ? TrainNumberOverride : TrainNumber) + "
" + (isWanman ? "ワンマン " : "") + "
" + viaData + "
" + optionalText + "
" + trainName + "
" + (ToData ? ToData + "行" : ToData) + "
" + trainType + "
" + (hasProblem ? "‼️停止中‼️" : "") + "
" + (TrainNumberOverride ? TrainNumberOverride : TrainNumber) + "
" + (isWanman ? "ワンマン " : "") + "
" + viaData + "
" + optionalText + "
" + trainName + "
" + (ToData ? ToData + "行" : ToData) + "
" + trainType + "
" + (hasProblem ? "‼️停止中‼️" : "") + "
" + returnText1 + "
"); diff --git a/stateBox/useStationList.tsx b/stateBox/useStationList.tsx index ba5f5fc..36533c8 100644 --- a/stateBox/useStationList.tsx +++ b/stateBox/useStationList.tsx @@ -152,7 +152,9 @@ export const StationListProvider: FC