Compare commits
134 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2fcb9722d5 | |||
| d144702763 | |||
| caa5d2a68b | |||
| b6f130bd19 | |||
| 3032a81693 | |||
| 707dd92ea6 | |||
| 0b349148d3 | |||
| a959cf3973 | |||
| 064d81d468 | |||
| f228489903 | |||
| 1c5ed1eb2c | |||
| 8bc43ed8c8 | |||
| 3e64cbee9a | |||
| 7d454cf9d4 | |||
| 699e3039b9 | |||
| 5af3164f21 | |||
| cd585b8206 | |||
| 927c73567a | |||
| 09170c6636 | |||
| 8705f69725 | |||
| 9562e04ffe | |||
| 2ffb47b60c | |||
| 1208a78831 | |||
| 493ef92bd6 | |||
| a51ffe4a82 | |||
| 0ea25f1e97 | |||
| 16bd0fe192 | |||
| d75a495b19 | |||
| a346a1477c | |||
| c93ca94a61 | |||
| 4480c161d1 | |||
| deb9b40949 | |||
| fced009607 | |||
| 0890c1b9ff | |||
| 4b3816940b | |||
| 9ea23d6eba | |||
| 31ea303b88 | |||
| 7716cb516c | |||
| 70976c0554 | |||
| 5616c7ed96 | |||
| 13580a57d4 | |||
| c9481fb0c2 | |||
| 5cda45740c | |||
| 84d1305796 | |||
| 336e3510fa | |||
| 25780e1664 | |||
| e6fab84393 | |||
| 390acdeab7 | |||
| ff7a5624e6 | |||
| 9b79f224d3 | |||
| 2f76e3776f | |||
| 026da47d82 | |||
| 29be052bf6 | |||
| 2fb7d97d33 | |||
| 76ebf8055b | |||
| 7b572cd657 | |||
| 61fa0f8484 | |||
| 935aaf2610 | |||
| 8ec53d6e06 | |||
| e8b1a21a3b | |||
| e6b89842a3 | |||
| 1fc5220405 | |||
| 5489406578 | |||
| 2b217e98c7 | |||
| 2c2e61a2fa | |||
| c222b303df | |||
| 8f8c095ecd | |||
| e31e84ff34 | |||
| 2c2b355a3e | |||
| 5461087ca0 | |||
| 57c7285b6e | |||
| 5c134c95cc | |||
| 8781653fe8 | |||
| 67ccc37c17 | |||
| 92caab03f5 | |||
| dd3a57b3ae | |||
| 8df32b9c1d | |||
| 4b901d5015 | |||
| fc5c62685a | |||
| fbc98b2ff7 | |||
| 3502043176 | |||
| 2d0ad8d59e | |||
| b5172df7a9 | |||
| 740d414d2d | |||
| 8db3e6c218 | |||
| fb35b01d2e | |||
| 5fa6b1f73e | |||
| c16f7401ea | |||
| f260c5d2dd | |||
| 80e9f1a869 | |||
| 26096ba244 | |||
| 435a910ef9 | |||
| 68b9236d65 | |||
| 0148c12e08 | |||
| 34dc62aee6 | |||
| 54ae681f00 | |||
| db40351fec | |||
| 2dd8e62f85 | |||
| 0937fbb619 | |||
| 32edab3289 | |||
| fa96e68770 | |||
| 1681be4437 | |||
| 7f96c44e88 | |||
| 7d485c466c | |||
| 7869cbee6d | |||
| c2ad681891 | |||
| 163f9ead18 | |||
| 611fc9953f | |||
| fd95e99874 | |||
| f5d0f993db | |||
| b7e763d265 | |||
| 0afa6f402b | |||
| eacce53775 | |||
| 47b1eb325e | |||
| a145e2c24f | |||
| 862742cd3e | |||
| d5f2d367dd | |||
| b1f72f18b5 | |||
| d4d86fb7eb | |||
| 056a059a68 | |||
| 12676d59cf | |||
| bca2b300d3 | |||
| 406808ee58 | |||
| a8aadb7f08 | |||
| b810405573 | |||
| 6f62418426 | |||
| 88621dd1c8 | |||
| 12d9c1f49d | |||
| 30c2b8a2f9 | |||
| 8bc7069c4e | |||
| 737cd25539 | |||
| 2c50e5af67 | |||
| ea677b4da5 | |||
| 4525443e39 |
@@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import { NavigationContainer, DarkTheme, DefaultTheme } from "@react-navigation/native";
|
||||
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
|
||||
import { Animated, Platform, ActivityIndicator, View, StyleSheet, StatusBar, useWindowDimensions } from "react-native";
|
||||
import { Animated, Platform, ActivityIndicator, View, StyleSheet, StatusBar } from "react-native";
|
||||
import { useNavigationState } from "@react-navigation/native";
|
||||
import { useFonts } from "expo-font";
|
||||
import { LinearGradient } from "expo-linear-gradient";
|
||||
@@ -38,8 +38,6 @@ const Tab = createBottomTabNavigator<RootTabParamList>();
|
||||
export function AppContainer() {
|
||||
const { areaInfo, areaIconBadgeText, isInfo } = useAreaInfo();
|
||||
const { selectedLine } = useTrainMenu();
|
||||
const { width, height } = useWindowDimensions();
|
||||
const operationScreenKey = width > height ? "operation-landscape" : "operation-portrait";
|
||||
const [isExtraWindowOpen, setIsExtraWindowOpen] = React.useState(false);
|
||||
|
||||
// フェードアニメーション用 (0=通常, 1=追加ウィンドウ青)
|
||||
@@ -187,9 +185,8 @@ export function AppContainer() {
|
||||
areaInfo ? areaIconBadgeText : undefined,
|
||||
isInfo
|
||||
)}
|
||||
>
|
||||
{() => <TNDView key={operationScreenKey} />}
|
||||
</Tab.Screen>
|
||||
children={TNDView}
|
||||
/>
|
||||
</Tab.Navigator>
|
||||
</NavigationContainer>
|
||||
);
|
||||
|
||||
@@ -13,7 +13,6 @@ import { getTime, trainTimeFiltering } from "@/lib/trainTimeFiltering";
|
||||
import { eachTrainDiagramType, StationProps } from "@/lib/CommonTypes";
|
||||
import { useNavigation } from "@react-navigation/native";
|
||||
import { useThemeColors } from "@/lib/theme";
|
||||
import { stackAwareNavigate } from "@/lib/rootNavigation";
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -50,7 +49,7 @@ type props = {
|
||||
export const LED_vision: FC<props> = (props) => {
|
||||
const { station } = props;
|
||||
|
||||
const { navigate } = useNavigation();
|
||||
const { navigate, addListener, isFocused } = useNavigation();
|
||||
const { currentTrain } = useCurrentTrain();
|
||||
const [stationDiagram, setStationDiagram] = useState<{
|
||||
[key: string]: string;
|
||||
@@ -164,7 +163,7 @@ export const LED_vision: FC<props> = (props) => {
|
||||
<AreaDescription
|
||||
numberOfLines={1}
|
||||
areaInfo={areaInfo}
|
||||
onClick={() => stackAwareNavigate("information")}
|
||||
onClick={() => alert(areaInfo)}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+124
-1758
File diff suppressed because it is too large
Load Diff
@@ -1,101 +0,0 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const repoRoot = path.resolve(__dirname, "..");
|
||||
const sourcePath = path.join(repoRoot, "ndView.tsx");
|
||||
const outputDir = path.join(repoRoot, "docs", "generated");
|
||||
const outputPath = path.join(outputDir, "jrshikoku-operation-info.user.js");
|
||||
|
||||
const source = fs.readFileSync(sourcePath, "utf8");
|
||||
const match = source.match(/return String\.raw`([\s\S]*?)`;\n};/);
|
||||
if (!match) {
|
||||
throw new Error("Failed to locate buildOperationPageScript body in ndView.tsx");
|
||||
}
|
||||
|
||||
let scriptBody = match[1];
|
||||
|
||||
scriptBody = scriptBody.replace(
|
||||
" window.__jrsNativeOperationLayout = ${nativeLayout};",
|
||||
[
|
||||
" window.__jrsNativeOperationLayout = Object.assign({",
|
||||
" forceSignage: true,",
|
||||
" safeAreaLeft: 0,",
|
||||
" safeAreaRight: 0,",
|
||||
" lineBadges: []",
|
||||
" }, window.__TM_OPERATION_INFO_LAYOUT || {});"
|
||||
].join("\n")
|
||||
);
|
||||
|
||||
const nativePostMessageBlock = [
|
||||
" function postMessage(payload) {",
|
||||
" if (!window.ReactNativeWebView) return;",
|
||||
" payload.type = 'operationInfoCapture';",
|
||||
" window.ReactNativeWebView.postMessage(JSON.stringify(payload));",
|
||||
" }"
|
||||
].join("\n");
|
||||
|
||||
const tampermonkeyPostMessageBlock = [
|
||||
" function downloadCapture(dataUrl, fileName) {",
|
||||
" if (!dataUrl) return;",
|
||||
" if (typeof GM_download === 'function') {",
|
||||
" try {",
|
||||
" GM_download({ url: dataUrl, name: fileName, saveAs: true });",
|
||||
" return;",
|
||||
" } catch (error) {",
|
||||
" console.warn('[JRShikoku TM] GM_download failed, falling back to anchor download.', error);",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" var link = document.createElement('a');",
|
||||
" link.href = dataUrl;",
|
||||
" link.download = fileName || ('operation-info-' + Date.now() + '.png');",
|
||||
" link.rel = 'noopener';",
|
||||
" document.body.appendChild(link);",
|
||||
" link.click();",
|
||||
" link.remove();",
|
||||
" }",
|
||||
"",
|
||||
" function postMessage(payload) {",
|
||||
" if (!payload) return;",
|
||||
" if (payload.error) {",
|
||||
" console.error('[JRShikoku TM] capture failed', payload);",
|
||||
" window.alert('運行情報の画像生成に失敗しました。');",
|
||||
" return;",
|
||||
" }",
|
||||
" downloadCapture(payload.dataUrl, payload.fileName);",
|
||||
" }"
|
||||
].join("\n");
|
||||
|
||||
if (!scriptBody.includes(nativePostMessageBlock)) {
|
||||
throw new Error("Failed to locate React Native postMessage block in ndView.tsx");
|
||||
}
|
||||
scriptBody = scriptBody.replace(nativePostMessageBlock, tampermonkeyPostMessageBlock);
|
||||
|
||||
const header = [
|
||||
"// ==UserScript==",
|
||||
"// @name JR四国 運行情報 Inject",
|
||||
"// @namespace https://github.com/harukin/jrshikoku",
|
||||
"// @version 0.1.0",
|
||||
"// @description Run the JR Shikoku operation-info injection on desktop browsers via Tampermonkey.",
|
||||
"// @match https://www.jr-shikoku.co.jp/info/*",
|
||||
"// @run-at document-idle",
|
||||
"// @grant GM_download",
|
||||
"// ==/UserScript==",
|
||||
"",
|
||||
"/* Generated from ndView.tsx by scripts/generate-operation-info-userscript.mjs. */",
|
||||
"",
|
||||
"window.__TM_OPERATION_INFO_LAYOUT = Object.assign({",
|
||||
" forceSignage: true,",
|
||||
" safeAreaLeft: 0,",
|
||||
" safeAreaRight: 0,",
|
||||
" lineBadges: []",
|
||||
"}, window.__TM_OPERATION_INFO_LAYOUT || {});",
|
||||
""
|
||||
].join("\n");
|
||||
|
||||
fs.mkdirSync(outputDir, { recursive: true });
|
||||
fs.writeFileSync(outputPath, header + scriptBody.trimStart() + "\n", "utf8");
|
||||
console.log(path.relative(repoRoot, outputPath));
|
||||
Reference in New Issue
Block a user