駅メニュー表示機能のスクリプト側の抜本的改造
This commit is contained in:
parent
34f907ef9b
commit
07adaf2ef5
50
Apps.js
50
Apps.js
@ -112,34 +112,32 @@ export default function Apps({
|
||||
alert("駅名標データを取得中...");
|
||||
return;
|
||||
}
|
||||
const selectedStationPDFAddress = event.nativeEvent.data
|
||||
.split(",")[3]
|
||||
.replace("'", "")
|
||||
.replace("'", "");
|
||||
const dataSet = JSON.parse(event.nativeEvent.data);
|
||||
if (dataSet.type == "PopUpMenu") {
|
||||
const selectedStationPDFAddress = dataSet.pdf;
|
||||
const findStationEachLine = (selectLine) => {
|
||||
let NearStation = selectLine.filter(
|
||||
(d) => d.StationTimeTable == selectedStationPDFAddress
|
||||
);
|
||||
return NearStation;
|
||||
};
|
||||
let returnDataBase = lineList
|
||||
.map((d) => findStationEachLine(originalStationList[d]))
|
||||
.filter((d) => d.length > 0)
|
||||
.reduce((pre, current) => {
|
||||
pre.push(...current);
|
||||
return pre;
|
||||
}, []);
|
||||
|
||||
const findStationEachLine = (selectLine) => {
|
||||
let NearStation = selectLine.filter(
|
||||
(d) => d.StationTimeTable == selectedStationPDFAddress
|
||||
);
|
||||
return NearStation;
|
||||
};
|
||||
|
||||
let returnDataBase = lineList
|
||||
.map((d) => findStationEachLine(originalStationList[d]))
|
||||
.filter((d) => d.length > 0)
|
||||
.reduce((pre, current) => {
|
||||
pre.push(...current);
|
||||
return pre;
|
||||
}, []);
|
||||
if (returnDataBase.length) {
|
||||
setStationBoardData(returnDataBase);
|
||||
StationBoardAcSR.current?.setModalVisible();
|
||||
} else {
|
||||
setStationBoardData(undefined);
|
||||
StationBoardAcSR.current?.hide();
|
||||
if (returnDataBase.length) {
|
||||
setStationBoardData(returnDataBase);
|
||||
StationBoardAcSR.current?.setModalVisible();
|
||||
} else {
|
||||
setStationBoardData(undefined);
|
||||
StationBoardAcSR.current?.hide();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
const onNavigationStateChange = (event) => {
|
||||
|
@ -597,7 +597,6 @@ const setStrings = () =>{
|
||||
var TrainType = undefined;
|
||||
if(行き先情報.innerText.includes(列番データ))continue; //回避
|
||||
` +
|
||||
//makeTrainMenu +
|
||||
trainIcon +
|
||||
normal_train_name +
|
||||
JRF_name +
|
||||
@ -723,57 +722,27 @@ modal_observer.observe(modal_content, {
|
||||
`;
|
||||
const makeStationMenu =
|
||||
stationMenu == "true"
|
||||
? `
|
||||
//駅メニューダイアログの配置
|
||||
const setStationMenuDialog = () =>{
|
||||
document.querySelector('#pMENU_2').style.display='none';
|
||||
document.querySelector('#pMENU_3').style.display='none';
|
||||
document.querySelector('#pMENU_2').style.display='none';
|
||||
const data =[];
|
||||
document.querySelectorAll('#disp div div').forEach(d=>d.id.indexOf("st")!= -1 && data.push(d));
|
||||
|
||||
for(let d of data ){
|
||||
if(!d.offclick){
|
||||
d.offclick = d.onclick.toString();
|
||||
}
|
||||
d.onclick = () =>{
|
||||
window.ReactNativeWebView.postMessage(d.offclick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const observer3 = new MutationObserver( (mutations) => {
|
||||
// observer3.disconnect(); // 監視を終了
|
||||
setStationMenuDialog();
|
||||
});
|
||||
|
||||
// 監視を開始
|
||||
observer3.observe(target, {
|
||||
attributes: true, // 属性変化の監視
|
||||
//attributeOldValue: true, // 変化前の属性値を matation.oldValue に格納する
|
||||
//characterData: true, // テキストノードの変化を監視
|
||||
//characterDataOldValue: true, // 変化前のテキストを matation.oldValue に格納する
|
||||
childList: true, // 子ノードの変化を監視
|
||||
//subtree: true // 子孫ノードも監視対象に含める
|
||||
});
|
||||
`
|
||||
? 'function PopUpMenu(event,id,name,pdf,map,url,chk){window.ReactNativeWebView.postMessage(JSON.stringify({type:"PopUpMenu",event,id,name,pdf,map,url,chk}));}'
|
||||
: ``;
|
||||
|
||||
// const makeTrainMenu =
|
||||
// //trainMenu == "true"
|
||||
// true
|
||||
// ? `
|
||||
|
||||
// if(!element.offclick){
|
||||
// element.offclick = element.onclick.toString();
|
||||
// }
|
||||
// element.onclick = () =>{
|
||||
// console.log("hoge")
|
||||
// window.ReactNativeWebView.postMessage(element.offclick);
|
||||
// }
|
||||
// const makeTrainMenu =
|
||||
// //trainMenu == "true"
|
||||
// true
|
||||
// ? `
|
||||
// function ShowTrainTimeInfo(trainNum,limited){
|
||||
// alert("hoge")
|
||||
// };
|
||||
// // if(!element.offclick){
|
||||
// // element.offclick = element.onclick.toString();
|
||||
// // }
|
||||
// // element.onclick = () =>{
|
||||
// // console.log("hoge")
|
||||
// // window.ReactNativeWebView.postMessage(element.offclick);
|
||||
// // }
|
||||
// `
|
||||
// : ``;
|
||||
// : ``;
|
||||
return (
|
||||
bootData + makeTrainView + trainIconMaker + textInsert + makeStationMenu
|
||||
//makeTrainMenu
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user