mirror of
				https://github.com/kenzok8/openwrt-packages.git
				synced 2025-10-30 07:50:37 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| 
 | |
| <%
 | |
| local dsp = require "luci.dispatcher"
 | |
| -%>
 | |
| 
 | |
| <script type="text/javascript">
 | |
| 	//<![CDATA[
 | |
| 	var pings = document.getElementsByClassName('ping');
 | |
| 	for(var i = 0; i < pings.length; i++) {
 | |
| 		XHR.get('<%=dsp.build_url("admin", "services", "clash", "ping")%>', {
 | |
| 				index: i,
 | |
| 				domain: pings[i].getAttribute("hint")
 | |
| 			},
 | |
| 			function(x, result) {
 | |
| 					if (result.ping < 500) {
 | |
| 					pings[result.index].innerHTML = (result.ping ? "<b><font color='#ee1010'>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
 | |
| 					}
 | |
| 					if (result.ping < 200){
 | |
| 					pings[result.index].innerHTML = (result.ping ? "<b><font color='#7acc03'>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
 | |
| 					}
 | |
| 					if (result.ping < 100){
 | |
| 					pings[result.index].innerHTML = (result.ping ? "<b><font color='#007e1a'>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
 | |
| 					}
 | |
| 					
 | |
| 			}
 | |
| 		);
 | |
| 		XHR.poll(20,'<%=dsp.build_url("admin", "services", "clash", "ping")%>',{
 | |
| 				index: i,
 | |
| 				domain: pings[i].getAttribute("hint")
 | |
| 			},
 | |
| 			function(x, result) {
 | |
| 					if (result.ping < 500) {
 | |
| 					pings[result.index].innerHTML = (result.ping ? "<b><font color='#ee1010'>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
 | |
| 					}
 | |
| 					if (result.ping < 200){
 | |
| 					pings[result.index].innerHTML = (result.ping ? "<b><font color='#7acc03'>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
 | |
| 					}
 | |
| 					if (result.ping < 100){
 | |
| 					pings[result.index].innerHTML = (result.ping ? "<b><font color='#007e1a'>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Error%></font></b>");
 | |
| 					}
 | |
| 					
 | |
| 			}
 | |
| 		);
 | |
| 	}
 | |
| 	//]]>
 | |
| </script>
 | |
|  
 | 
![github-actions[bot]](/assets/img/avatar_default.png)