From c98407527b36709272887adf5d6320434fb980c2 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sun, 15 Jun 2025 16:35:39 +0000 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E3=81=8D=E5=85=88=E3=81=AE=E8=A3=8F?= =?UTF-8?q?=E3=81=AB=E9=A7=85=E3=81=AE=E8=B7=AF=E7=B7=9A=E3=82=AB=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E3=82=92=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/webViewInjectjavascript.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/webViewInjectjavascript.ts b/lib/webViewInjectjavascript.ts index dc6568a..c4187ed 100644 --- a/lib/webViewInjectjavascript.ts +++ b/lib/webViewInjectjavascript.ts @@ -30,6 +30,10 @@ export const injectJavascriptData: InjectJavascriptData = ( // 上部ヘッダーの取り扱い、自動再読み込み、setStringsの実行 const bootData = ` + let stationList = {}; + fetch("https://n8n.haruk.in/webhook/jr-shikoku-station-list").then((response) => response.json()).then((data) => { + stationList = data; + }); let trainDataList = []; fetch("https://n8n.haruk.in/webhook/jr-shikoku-position-custom-datalist").then((response) => response.json()).then((data) => { trainDataList = data[0].data; @@ -1275,11 +1279,27 @@ export const injectJavascriptData: InjectJavascriptData = ( const returnText2 = (ToData ? ToData+"行 " : ToData)+ TrainNumber; 行き先情報.innerText = ""; ${uiSetting === "tokyo" ? ` + let stationIDs = []; + let stationLines = []; + Object.keys(stationList).forEach((key) => { + const data = stationList[key].find(e => e.Station_JP === ToData )?.StationNumber; + if(data){ + stationIDs.push(data); + stationLines.push(key); + } + }); + let getColors = []; + if(stationLines.length === 0){ + getColors = ["#000"]; + }else{ + getColors = stationLines.map(e => GetLineBarColor(e)); + } + const gradient = getColors.length > 1 ? "linear-gradient(130deg, " + getColors[0] + " 0%, "+ getColors[0]+"50%, "+ getColors[1]+"50%, " + getColors[1] + " 100%)" : getColors[0]; 行き先情報.insertAdjacentHTML('beforebegin', "

" + TrainNumber + (JRF ? "":"レ") + "

"); 行き先情報.insertAdjacentHTML('beforebegin', "

" + (isWanman ? "ワンマン " : "") + "

"); 行き先情報.insertAdjacentHTML('beforebegin', "

" + viaData + "

"); 行き先情報.insertAdjacentHTML('beforebegin', "

" + trainName + "

"); - 行き先情報.insertAdjacentHTML('beforebegin', "

" + (ToData ? ToData + "行 " : ToData) + "

"); + 行き先情報.insertAdjacentHTML('beforebegin', "

" + (ToData ? ToData + "行" : ToData) + "

"); 行き先情報.insertAdjacentHTML('beforebegin', "

" + (hasProblem ? "‼️停止中‼️" : "") + "

"); `: ` 行き先情報.insertAdjacentHTML('beforebegin', "

" + returnText1 + "

");