駅メニュー表示機能のスクリプト側の抜本的改造

This commit is contained in:
harukin-OneMix4
2023-06-26 22:41:00 +09:00
parent 34f907ef9b
commit 07adaf2ef5
2 changed files with 41 additions and 74 deletions

View File

@@ -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
);
};