Make translation tooltip work
							parent
							
								
									13a091be72
								
							
						
					
					
						commit
						0bfb35b978
					
				| 
						 | 
					@ -114,12 +114,12 @@ function showWordMeaning(event) {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            tooltip.textContent = data.translation || '没有找到该单词的中文意思';
 | 
					            tooltip.textContent = data.translation || '没有找到该单词的中文意思';
 | 
				
			||||||
            tooltip.style.left = `${tooltipX}px`;
 | 
					            tooltip.style.left = `${tooltipX}px`;
 | 
				
			||||||
            tooltip.style.top = `${tooltipY}px`;
 | 
					            tooltip.style.top = `${tooltipY}px`;
 | 
				
			||||||
            tooltip.style.display = 'block';
 | 
					            tooltip.style.display = 'block';
 | 
				
			||||||
 | 
						    tooltip.style.position = 'absolute';
 | 
				
			||||||
 | 
						    tooltip.style.background = 'yellow';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // 可以在这里添加点击事件监听器来隐藏tooltip,但注意避免内存泄漏
 | 
					            // 可以在这里添加点击事件监听器来隐藏tooltip,但注意避免内存泄漏
 | 
				
			||||||
            document.addEventListener('click', function handler(e) {
 | 
					            document.addEventListener('click', function handler(e) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,6 +107,7 @@
 | 
				
			||||||
                <button onclick="toggle_visibility('answer');">ANSWER</button>
 | 
					                <button onclick="toggle_visibility('answer');">ANSWER</button>
 | 
				
			||||||
                <div id="answer" style="display:none;">{{ today_article['answer'] }}</div><br/>
 | 
					                <div id="answer" style="display:none;">{{ today_article['answer'] }}</div><br/>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
						    <div id="tooltip"></div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div class="alert alert-success" role="alert" id="not_found" style="display:none;">
 | 
					        <div class="alert alert-success" role="alert" id="not_found" style="display:none;">
 | 
				
			||||||
            <p class="text-muted"><span class="badge bg-success">Notes:</span><br>No article is currently available for you. You can try again a few times or mark new words in the passage to improve your level.</p>
 | 
					            <p class="text-muted"><span class="badge bg-success">Notes:</span><br>No article is currently available for you. You can try again a few times or mark new words in the passage to improve your level.</p>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,5 +4,5 @@ PyYAML~=6.0
 | 
				
			||||||
pony==0.7.16
 | 
					pony==0.7.16
 | 
				
			||||||
snowballstemmer==2.2.0
 | 
					snowballstemmer==2.2.0
 | 
				
			||||||
Werkzeug==2.2.2
 | 
					Werkzeug==2.2.2
 | 
				
			||||||
 | 
					requests
 | 
				
			||||||
pytest~=8.1.1
 | 
					pytest~=8.1.1
 | 
				
			||||||
		Loading…
	
		Reference in New Issue