injectJavascriptに変化条件を追加
This commit is contained in:
parent
f2d49cbbf2
commit
7b4badb9b0
@ -2,13 +2,15 @@ type InjectJavascriptData = (
|
|||||||
a: string,
|
a: string,
|
||||||
b: string,
|
b: string,
|
||||||
c: string,
|
c: string,
|
||||||
d: string
|
d: string,
|
||||||
|
e: string
|
||||||
) => string;
|
) => string;
|
||||||
export const injectJavascriptData: InjectJavascriptData = (
|
export const injectJavascriptData: InjectJavascriptData = (
|
||||||
mapSwitch,
|
mapSwitch,
|
||||||
iconSetting,
|
iconSetting,
|
||||||
stationMenu,
|
stationMenu,
|
||||||
trainMenu
|
trainMenu,
|
||||||
|
uiSetting
|
||||||
) => {
|
) => {
|
||||||
// 一番上のメニュー非表示 地図スイッチによって切り替え
|
// 一番上のメニュー非表示 地図スイッチによって切り替え
|
||||||
const topMenu =
|
const topMenu =
|
||||||
@ -1247,11 +1249,17 @@ export const injectJavascriptData: InjectJavascriptData = (
|
|||||||
const returnText1 = (isWanman ? "ワンマン " : "") + trainName + viaData;
|
const returnText1 = (isWanman ? "ワンマン " : "") + trainName + viaData;
|
||||||
const returnText2 = (ToData ? ToData+"行 " : ToData)+ TrainNumber;
|
const returnText2 = (ToData ? ToData+"行 " : ToData)+ TrainNumber;
|
||||||
行き先情報.innerText = "";
|
行き先情報.innerText = "";
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:10px;font-weight:bold;padding:0;color:black;text-align:center;'>" + (ToData ? ToData + "行 " : ToData) + "</p>");
|
${uiSetting === "tokyo" ? `
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + returnText1 + "</p>");
|
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:10px;font-weight:bold;padding:0;color:black;text-align:center;'>" + (ToData ? ToData + "行 " : ToData) + "</p>");
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:8px;padding:0;color:black;text-align:center;'>" + TrainNumber + (JRF ? "":"レ") + "</p>");
|
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:8px;font-weight:bold;padding:0;color: black;text-align:center;'>" + returnText1 + "</p>");
|
||||||
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:8px;font-weight:bold;padding:0;text-align:center;color: "+(hasProblem ? "red":"black")+";'>" + (hasProblem ? "‼️停止中‼️" : "") + "</p>");
|
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:8px;padding:0;color:black;text-align:center;'>" + TrainNumber + (JRF ? "":"レ") + "</p>");
|
||||||
}
|
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:8px;font-weight:bold;padding:0;text-align:center;color: "+(hasProblem ? "red":"black")+";'>" + (hasProblem ? "‼️停止中‼️" : "") + "</p>");
|
||||||
|
`: `
|
||||||
|
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:10px;font-weight:bold;padding:0;color: black;'>" + returnText1 + "</p>");
|
||||||
|
行き先情報.insertAdjacentHTML('beforebegin', "<div style='display:inline-flex;flex-direction:row;'><p style='font-size:10px;font-weight: bold;padding:0;color:black;'>" + (ToData ? ToData + "行 " : ToData) + "</p><p style='font-size:10px;padding:0;color:black;'>" + TrainNumber + (JRF ? "":"レ") + "</p></div>");
|
||||||
|
行き先情報.insertAdjacentHTML('beforebegin', "<p style='font-size:10px;font-weight:bold;padding:0;color: "+(hasProblem ? "red":"black")+";'>" + (hasProblem ? "‼️停止中‼️" : "") + "</p>");
|
||||||
|
`}
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const textInsert =
|
const textInsert =
|
||||||
@ -1293,58 +1301,62 @@ const setNewTrainItem = (element)=>{
|
|||||||
const setStrings = () =>{
|
const setStrings = () =>{
|
||||||
try {
|
try {
|
||||||
const elements = document.querySelectorAll('#disp > div > div > div[onclick]');
|
const elements = document.querySelectorAll('#disp > div > div > div[onclick]');
|
||||||
const elementBaseBase = document.querySelectorAll('[id^="stationBlock"]');
|
const setNewTrainItemUI = ()=>{
|
||||||
elementBaseBase.forEach(e=>{ //それぞれの駅ブロック横一列
|
const elementBaseBase = document.querySelectorAll('[id^="stationBlock"]');
|
||||||
e.style.display = 'flex';
|
elementBaseBase.forEach(e=>{ //それぞれの駅ブロック横一列
|
||||||
e.style.height = "unset";
|
e.style.display = 'flex';
|
||||||
e.style.flexDirection = 'row';
|
e.style.height = "unset";
|
||||||
//e.style.alignItems = "left";
|
e.style.flexDirection = 'row';
|
||||||
e.style.justifyContent = 'center';
|
//e.style.alignItems = "left";
|
||||||
const x = e.querySelectorAll(':scope > div');//配下のdiv要素を選択
|
e.style.justifyContent = 'center';
|
||||||
//x[0] 登りブロック x[2] 下りブロック x[1] 駅ブロック
|
const x = e.querySelectorAll(':scope > div');//配下のdiv要素を選択
|
||||||
const aaa = (x2,pos) => {
|
//x[0] 登りブロック x[2] 下りブロック x[1] 駅ブロック
|
||||||
x2.style.display = 'flex';
|
const aaa = (x2,pos) => {
|
||||||
x2.style.flexDirection = 'row';
|
x2.style.display = 'flex';
|
||||||
if(pos == "right"){
|
x2.style.flexDirection = 'row';
|
||||||
x2.style.alignItems = 'flex-start';
|
if(pos == "right"){
|
||||||
x2.style.justifyContent = 'flex-start';
|
x2.style.alignItems = 'flex-start';
|
||||||
}else if(pos == "left"){
|
x2.style.justifyContent = 'flex-start';
|
||||||
x2.style.alignItems = 'flex-end';
|
}else if(pos == "left"){
|
||||||
x2.style.justifyContent = 'flex-end';
|
x2.style.alignItems = 'flex-end';
|
||||||
|
x2.style.justifyContent = 'flex-end';
|
||||||
|
}
|
||||||
|
x2.style.flexWrap = 'wrap';
|
||||||
|
x2.style.width = '100%';
|
||||||
|
x2.style.height = "100%";
|
||||||
|
|
||||||
}
|
}
|
||||||
x2.style.flexWrap = 'wrap';
|
const aaa2 = (x2) => {
|
||||||
x2.style.width = '100%';
|
x2.style.display = 'flex';
|
||||||
x2.style.height = "100%";
|
x2.style.flexDirection = 'row';
|
||||||
|
x2.style.alignItems = 'center';
|
||||||
}
|
x2.style.justifyContent = 'center';
|
||||||
const aaa2 = (x2) => {
|
x2.style.flexWrap = 'wrap';
|
||||||
x2.style.display = 'flex';
|
x2.style.width = '100%';
|
||||||
x2.style.flexDirection = 'row';
|
x2.style.height = "unset";
|
||||||
x2.style.alignItems = 'center';
|
const x3 = x2.querySelectorAll(":scope > div");
|
||||||
x2.style.justifyContent = 'center';
|
x3.forEach(i=>{
|
||||||
x2.style.flexWrap = 'wrap';
|
i.style.position = "unset";
|
||||||
x2.style.width = '100%';
|
i.style.display = "flex";
|
||||||
x2.style.height = "unset";
|
i.style.flexDirection = "column";
|
||||||
const x3 = x2.querySelectorAll(":scope > div");
|
i.style.flex = "1";
|
||||||
x3.forEach(i=>{
|
i.style.backgroundColor = "#00000000";
|
||||||
i.style.position = "unset";
|
i.querySelectorAll(":scope > *").forEach(j=>{
|
||||||
i.style.display = "flex";
|
j.style.width = "100%";
|
||||||
i.style.flexDirection = "column";
|
j.style.textAlign = "center";
|
||||||
i.style.flex = "1";
|
j.style.margin = "5px";
|
||||||
i.style.backgroundColor = "#00000000";
|
j.style.padding = "5px";
|
||||||
i.querySelectorAll(":scope > *").forEach(j=>{
|
});
|
||||||
j.style.width = "100%";
|
|
||||||
j.style.textAlign = "center";
|
|
||||||
j.style.margin = "5px";
|
|
||||||
j.style.padding = "5px";
|
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
aaa(x[0],"left");
|
||||||
aaa(x[0],"left");
|
aaa2(x[1]);
|
||||||
aaa2(x[1]);
|
aaa(x[2],"right");
|
||||||
aaa(x[2],"right");
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
${uiSetting === "tokyo" ? `setNewTrainItemUI();`: ``}
|
||||||
for (let element of elements) {
|
for (let element of elements) {
|
||||||
if(element.getAttribute('offclick')){ continue; }
|
if(element.getAttribute('offclick')){ continue; }
|
||||||
element.setAttribute('offclick',element.getAttribute('onclick'))
|
element.setAttribute('offclick',element.getAttribute('onclick'))
|
||||||
@ -1375,7 +1387,7 @@ const setStrings = () =>{
|
|||||||
}
|
}
|
||||||
` : ""}
|
` : ""}
|
||||||
nameReplace(列車名データ,列番データ,行き先情報,hasProblem);
|
nameReplace(列車名データ,列番データ,行き先情報,hasProblem);
|
||||||
setNewTrainItem(element);
|
${uiSetting === "tokyo" ? `setNewTrainItem(element);`: ``}
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
for(let d of document.getElementById('disp').childNodes){
|
for(let d of document.getElementById('disp').childNodes){
|
||||||
|
Loading…
Reference in New Issue
Block a user