rein0421 commited on
Commit
0758a11
·
verified ·
1 Parent(s): ed7749b

Update templates/learning.html

Browse files
Files changed (1) hide show
  1. templates/learning.html +154 -23
templates/learning.html CHANGED
@@ -4,23 +4,9 @@
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>学習画面</title>
 
7
  <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
8
  </head>
9
- <!-- 例: フッターナビゲーション (各HTMLの </body> の直前に追加) -->
10
- <footer class="footer-nav">
11
- <button onclick="goToInput()" aria-label="入力">
12
- <span class="nav-icon">➕</span> <!-- アイコンは好みで変更 -->
13
- <span class="nav-text">入力</span>
14
- </button>
15
- <button onclick="goToHistory()" aria-label="履歴">
16
- <span class="nav-icon">🕒</span>
17
- <span class="nav-text">履歴</span>
18
- </button>
19
- <button onclick="goToSettings()" aria-label="設定">
20
- <span class="nav-icon">⚙️</span>
21
- <span class="nav-text">設定</span>
22
- </button>
23
- </footer>
24
  <body>
25
  <div class="screen">
26
  <header class="header">
@@ -30,32 +16,177 @@
30
  <button class="action-btn" aria-label="アクション"></button>
31
  </header>
32
  <main>
 
 
 
 
 
 
 
 
 
33
  <p style="text-align: center; color: #555; font-size: 14px; margin-bottom: 10px;" id="mode-indicator">クイズモード</p>
34
 
 
35
  <div class="card" id="learning-card" onclick="revealAnswer()">
36
  <p class="main-text" id="card-text">ここに表示される問題文または要約テキストはカードの中心に来るように調整されます。(サンプルテキスト)</p>
37
  <p class="answer-text" id="answer-text" style="display: none;">答え: 正解の選択肢</p>
38
  </div>
39
 
 
40
  <p class="tap-to-show" id="tap-to-show" onclick="revealAnswer()">タップして解答を表示</p>
41
 
42
  <!-- クイズの選択肢表示エリア (JSで動的に生成) -->
43
  <div id="options-area" style="margin-top: 15px;">
44
- <!-- 例:
45
- <button class="option-button">A: 選択肢A</button>
46
- <button class="option-button">B: 選択肢B</button>
47
- ...
48
- -->
49
  </div>
50
 
 
 
 
 
 
 
51
  <div class="pagination">
52
  <button id="prev-button" aria-label="前へ" onclick="goToPrev()"><</button>
53
- <span id="page-info">5 / 10</span>
54
  <button id="next-button" aria-label="次へ" onclick="goToNext()">></button>
55
  </div>
56
  </main>
57
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  <script src="{{ url_for('static', filename='script.js') }}"></script>
59
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  </body>
61
  </html>
 
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>学習画面</title>
7
+ <!-- CSSファイルの読み込み -->
8
  <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
9
  </head>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  <body>
11
  <div class="screen">
12
  <header class="header">
 
16
  <button class="action-btn" aria-label="アクション"></button>
17
  </header>
18
  <main>
19
+
20
+ <!-- YouTubeリンク入力欄と生成ボタン -->
21
+ <div style="margin-bottom: 20px; text-align: center;">
22
+ <input id="youtube-url" type="text" placeholder="YouTubeリンクを入力してください" style="padding: 5px; width: 70%;">
23
+ <button id="generate-button" style="padding: 5px 10px; margin-left: 5px;">生成する</button>
24
+ <p id="error-message" style="color: red; font-size: 14px; margin-top: 10px;"></p>
25
+ </div>
26
+
27
+ <!-- モード表示 -->
28
  <p style="text-align: center; color: #555; font-size: 14px; margin-bottom: 10px;" id="mode-indicator">クイズモード</p>
29
 
30
+ <!-- 学習カード -->
31
  <div class="card" id="learning-card" onclick="revealAnswer()">
32
  <p class="main-text" id="card-text">ここに表示される問題文または要約テキストはカードの中心に来るように調整されます。(サンプルテキスト)</p>
33
  <p class="answer-text" id="answer-text" style="display: none;">答え: 正解の選択肢</p>
34
  </div>
35
 
36
+ <!-- タップして解答を表示 -->
37
  <p class="tap-to-show" id="tap-to-show" onclick="revealAnswer()">タップして解答を表示</p>
38
 
39
  <!-- クイズの選択肢表示エリア (JSで動的に生成) -->
40
  <div id="options-area" style="margin-top: 15px;">
41
+ <!-- サンプルボタン(実際の動作はJSに依存) -->
42
+ <button class="option-button" data-correct="true" onclick="handleOptionClick(this)">A: 正解</button>
43
+ <button class="option-button" data-correct="false" onclick="handleOptionClick(this)">B: 不正解</button>
44
+ <button class="option-button" data-correct="false" onclick="handleOptionClick(this)">C: 不正解</button>
45
+ <!-- JavaScriptによって動的に選択肢がここに追加されます -->
46
  </div>
47
 
48
+ <!-- 正解時のエフェクトボタンとエフェクトコンテナ -->
49
+ <!-- 注意: このボタンはデバッグ用かもしれません。通常は選択肢をクリックした結果としてエフェクトが表示されます -->
50
+ <button id="correctAnswer" onclick="showEffect()" style="display: block; margin: 10px auto;">(デバッグ用)正解エフェクト表示</button>
51
+ <div id="effect" style="display: none; text-align: center; font-size: 50px; color: red; margin-top: 10px;">〇</div>
52
+
53
+ <!-- ページネーション -->
54
  <div class="pagination">
55
  <button id="prev-button" aria-label="前へ" onclick="goToPrev()"><</button>
56
+ <span id="page-info">5 / 10</span> <!-- この表示もJSで更新される想定 -->
57
  <button id="next-button" aria-label="次へ" onclick="goToNext()">></button>
58
  </div>
59
  </main>
60
+ </div> <!-- screen -->
61
+
62
+ <!-- フッターナビゲーション -->
63
+ <footer class="footer-nav">
64
+ <button onclick="goToInput()" aria-label="入力">
65
+ <span class="nav-icon">➕</span>
66
+ <span class="nav-text">入力</span>
67
+ </button>
68
+ <button onclick="goToHistory()" aria-label="履歴">
69
+ <span class="nav-icon">🕒</span>
70
+ <span class="nav-text">履歴</span>
71
+ </button>
72
+ <button onclick="goToSettings()" aria-label="設定">
73
+ <span class="nav-icon">⚙️</span>
74
+ <span class="nav-text">設定</span>
75
+ </button>
76
+ </footer>
77
+
78
+ <!-- JavaScriptファイルの読み込み -->
79
  <script src="{{ url_for('static', filename='script.js') }}"></script>
80
+ <script>
81
+ // learning.html 固有の初期化処理やイベントリスナー設定
82
+ document.addEventListener('DOMContentLoaded', function() {
83
+ // initializeLearningScreen のような初期化関数があればここで呼び出す
84
+ // 例: initializeLearningScreen();
85
+
86
+ // YouTube生成ボタンのイベントリスナー
87
+ const generateButton = document.getElementById('generate-button');
88
+ const youtubeUrlInput = document.getElementById('youtube-url');
89
+ const errorMessage = document.getElementById('error-message');
90
+
91
+ if (generateButton) {
92
+ generateButton.addEventListener('click', () => {
93
+ const url = youtubeUrlInput.value.trim();
94
+ if (url) {
95
+ console.log("生成ボタンがクリックされました。URL:", url);
96
+ errorMessage.textContent = ''; // エラーメッセージをクリア
97
+ // ここで実際にYouTubeリンクからデータを生成する処理を呼び出す
98
+ // 例: generateContentFromYouTube(url);
99
+ } else {
100
+ errorMessage.textContent = 'YouTubeリンクを入力してください。';
101
+ console.log("YouTubeリンクが入力されていません。");
102
+ }
103
+ });
104
+ }
105
+
106
+ // 他の learning.html 固有の初期化処理があればここに追加
107
+ });
108
+
109
+ // --- script.js に含まれる想定の関数 (ここでは例として定義) ---
110
+
111
+ function openMenu() { console.log("メニューを開く"); }
112
+ function revealAnswer() {
113
+ console.log("解答を表示/非表示");
114
+ const answerText = document.getElementById('answer-text');
115
+ const tapToShow = document.getElementById('tap-to-show');
116
+ if (answerText) {
117
+ answerText.style.display = answerText.style.display === 'none' ? 'block' : 'none';
118
+ }
119
+ if (tapToShow) {
120
+ // 解答が表示されたら「タップして非表示」などに変えることも可能
121
+ tapToShow.textContent = answerText.style.display === 'none' ? 'タップして解答を表示' : 'タップして解答を隠す';
122
+ }
123
+ }
124
+ function handleOptionClick(buttonElement) {
125
+ console.log("選択肢クリック:", buttonElement.textContent);
126
+ const isCorrect = buttonElement.getAttribute('data-correct') === 'true';
127
+ // 正誤判定とフィードバック表示
128
+ if (isCorrect) {
129
+ console.log("正解!");
130
+ showEffect(); // 正解エフェクト表示
131
+ // 正解時のスタイル変更など
132
+ buttonElement.classList.add('correct');
133
+ } else {
134
+ console.log("不正解...");
135
+ // 不正解時のスタイル変更など
136
+ buttonElement.classList.add('incorrect');
137
+ // 正解の選択肢をハイライトするなど(オプション)
138
+ const correctButton = document.querySelector('#options-area .option-button[data-correct="true"]');
139
+ if(correctButton) correctButton.classList.add('correct');
140
+ }
141
+ // 一度選択したら他のボタンは無効化するなどの処理
142
+ const allOptions = document.querySelectorAll('#options-area .option-button');
143
+ allOptions.forEach(btn => btn.disabled = true);
144
+
145
+ // 解答テキストも表示する
146
+ const answerText = document.getElementById('answer-text');
147
+ if (answerText) answerText.style.display = 'block';
148
+ const tapToShow = document.getElementById('tap-to-show');
149
+ if (tapToShow) tapToShow.style.display = 'none'; // 選択肢を選んだらタップ表示は不要かも
150
+
151
+ }
152
+ function showEffect() {
153
+ console.log("正解エフェクト表示");
154
+ const effectElement = document.getElementById('effect');
155
+ if (effectElement) {
156
+ effectElement.style.display = 'block';
157
+ // 一定時間後に非表示にする
158
+ setTimeout(() => {
159
+ effectElement.style.display = 'none';
160
+ }, 1500); // 1.5秒後に消える
161
+ }
162
+ }
163
+ function goToPrev() { console.log("前のカードへ"); /* 実際の処理 */ }
164
+ function goToNext() { console.log("次のカードへ"); /* 実際の処理 */ }
165
+ function goToInput() { console.log("入力画面へ"); window.location.href = '/input'; /* Flaskのルーティングに合わせる */ }
166
+ function goToHistory() { console.log("履歴画面へ"); window.location.href = '/history'; /* Flaskのルーティングに合わせる */ }
167
+ function goToSettings() { console.log("設定画面へ"); window.location.href = '/settings'; /* Flaskのルーティングに合わせる */ }
168
+
169
+ // ページ読み込み時に関数を実行する場合(例)
170
+ // function initializeLearningScreen() {
171
+ // console.log("学習画面の初期化処理");
172
+ // // カードの内容やページネーションの表示を更新する処理など
173
+ // updateCardContent(currentCardIndex); // 仮の関数
174
+ // updatePagination(); // 仮の関数
175
+ // }
176
+
177
+ // let currentCardIndex = 0; // 現在表示しているカードのインデックス(仮)
178
+ // const cardsData = [ /* カードデータの配列 */ ]; // 仮のデータ
179
+
180
+ // function updateCardContent(index) {
181
+ // // 実際のカードデータを表示する処理
182
+ // }
183
+ // function updatePagination() {
184
+ // // ページネーション表示を更新する処理
185
+ // const pageInfo = document.getElementById('page-info');
186
+ // if(pageInfo) pageInfo.textContent = `${currentCardIndex + 1} / ${cardsData.length}`;
187
+ // // 前へ/次へボタンの有効/無効化
188
+ // }
189
+
190
+ </script>
191
  </body>
192
  </html>