Android向け裏処理完成

This commit is contained in:
harukin-OneMix4 2023-07-01 14:26:30 +09:00
parent b4c306bce3
commit 0618ff0180

View File

@ -577,10 +577,14 @@ const setStrings = () =>{
try {
const elements = document.querySelectorAll('#disp > div > div > div[onclick]');
for (let element of elements) {
if(!element.getAttribute('offclick')){
element.setAttribute('offclick',element.getAttribute('onclick'))
}
var 行き先情報 = element.getElementsByTagName("p")[0];
var 列番データ = element.getAttribute('onclick').split('"')[1];
var 列番データ = element.getAttribute('offclick').split('"')[1];
var flag=false;
var TrainType = undefined;
setTrainMenuDialog(element)
if(行き先情報.innerText.includes(列番データ))continue; //回避
` +
trainIcon +
@ -705,6 +709,18 @@ makeTrainView.observe(document.getElementById('modal_content'), {
//trainMenu == "true"
true
? `
// これの中身抽出ShowTrainTimeInfo("1228M","normal")
function setTrainMenuDialog(d){
try{
const offclick = d.getAttribute('offclick');
if(!offclick) return;
const s = offclick.replace('ShowTrainTimeInfo(','').replaceAll('"','').replace(')','').split(',') ;
const returnData = {type:"ShowTrainTimeInfo",trainNum:s[0],limited:s[1]};
d.onclick = ()=>window.ReactNativeWebView.postMessage(JSON.stringify(returnData));
}catch(e){
}
}
function ShowTrainTimeInfo(trainNum,limited){
window.ReactNativeWebView.postMessage(JSON.stringify({type:"ShowTrainTimeInfo",trainNum,limited}));
};
@ -725,8 +741,6 @@ const setStationMenuDialog = new MutationObserver( (mutations) => {
d.offclick = d.onclick.toString();
}
d.onclick = () =>{
//const s = d.offclick.replace('function onclick(event)','').replace('ShowTrainTimeInfo(','').replace(')','').split('(')[1].split(',')
// これの中身抽出ShowTrainTimeInfo("1228M","normal")
const s = d.offclick.replace('(event)','').replaceAll("'", "").split('(')[1].split(')')[0].split(',');
// これの中身抽出 PopUpMenu(event,'2','端岡','http://www.jr-shikoku.co.jp/01_trainbus/jikoku/pdf/hashioka.pdf','https://www.google.co.jp/maps/place/34.305027,133.967643','','1')
window.ReactNativeWebView.postMessage(JSON.stringify({type:"PopUpMenu",event:s[0],id:s[1],name:s[2],pdf:s[3],map:s[4],url:s[5],chk:s[6]}));
@ -750,8 +764,8 @@ setStationMenuDialog.observe(document.querySelector('#disp'), {
topMenu +
makeTrainView +
trainIconMaker +
textInsert +
makeTrainMenu +
textInsert +
makeStationMenu
);
};