<style>
	#hid_btn {
		display: block;
		width: 18px;
		margin:0 auto;
	}
	.rotate{
    transform-origin:center center;
    transform: rotate(180deg);
    -webkit-transform: rotate(180deg);
    -moz-transform: rotate(180deg);
    -ms-transform: rotate(180deg);
    -o-transform: rotate(180deg);
    transition: transform 0.2s;
    -moz-transition: -moz-transform 0.2s; 
    -moz-transition: -moz-transform 0.2s; 
    -o-transition: -o-transform 0.2s; 
    -ms-transition: -ms-transform 0.2s; 
}

	.rotate1{
    transform-origin:center center;
    transform: rotate(360deg);
    -webkit-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
    -o-transform: rotate(360deg);
    transition: transform 0.2s; 
    -moz-transition: -moz-transform 0.2s; 
    -moz-transition: -moz-transform 0.2s; 
    -o-transition: -o-transform 0.2s; 
    -ms-transition: -ms-transform 0.2s; 
}
	.rotate2{
    transform: rotate(0deg);
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -ms-transform: rotate(0deg);
    -o-transform: rotate(0deg);
}
</style>
<fieldset class="cbi-section">
	<table width="100%">
	   <tr>
	  	<td colspan="4" width="100%">
	  		<p align="center">
	      <img id="logo" src="data:image/png;base64, " title="Hello, World!" alt="Openclash" width="150" onclick="return homepage()" />
        </p>
	  		<p id="_clashversion" align="center" >
	  		   <b><%:Collecting data...%></b>
	  		</p>
	   </td></tr>
	   <tr><td colspan="4" width="100%">
     	  <p align="center">
    	     <img id="wiki" src="https://img.shields.io/badge/Tutorials--lightgrey?logo=Wikipedia&style=social" loading="lazy" alt="Wiki" width="75px" height="20px" onerror="return imgerrorfuns(this,this.src)" onclick="return wikipage()" />
    	     &nbsp;&nbsp;&nbsp;
    	     <img id="star" src="https://img.shields.io/badge/Star--lightgrey?logo=github&style=social" loading="lazy" alt="star" width="50px" height="20px" onerror="return imgerrorfuns(this,this.src)" onclick="return homepage()" />
    	     &nbsp;&nbsp;&nbsp;
    	     <!--
    	     <img id="telegram" src="https://img.shields.io/badge/Telegram--lightgrey?logo=Telegram&style=social" loading="lazy" alt="Telegram" onerror="return imgerrorfuns(this,this.src)" onclick="return telegrampage()" />
    	     &nbsp;&nbsp;&nbsp;
    	     -->
    	     <img id="sponsor" src="https://img.shields.io/badge/Sponsor--lightgrey?logo=ko-fi&style=social" loading="lazy" alt="Sponsor" width="73px" height="20px" onerror="return imgerrorfuns(this,this.src)" onclick="return sponsorpage()" />
        </p>
     </td></tr>
	  <tr><td width="100%" colspan="4">
	  	<p align="center" id="_clashstart">
	  		<b> Tip: OpenClash 成功启动后请耐心等待下方网站访问检查连接正常后再使用 </b>
	  	</p>
	  </td></tr>
		<tr><td width="25%"> OpenClash 主程序 </td><td  width="25%" align="left" id="_clash"><%:Collecting data...%></td><td width="25%"> 控制面板登录IP </td><td width="25%" align="left" id="_daip"><%:Collecting data...%></td></tr>
		<tr><td width="25%"> OpenClash 守护程序 </td><td width="25%" align="left" id="_watchdog"><%:Collecting data...%></td><td width="25%"> 控制面板登录端口 </td><td width="25%" align="left" id="_dapo"><%:Collecting data...%></td></tr>
		<tr><td width="25%"> OpenClash 运行模式 </td><td  width="25%" align="left" id="_mode"><%:Collecting data...%></td><td width="25%"> 控制面板登录密钥 </td><td width="25%" align="left" id="_dase"><%:Collecting data...%></td></tr>
		<tr><td width="25%"> Yacd 控制面板 </td><td width="25%" align="left" id="_web"><%:Collecting data...%></td><td width="25%"> Dashboard 控制面板 </td><td width="25%" align="left" id="_webo"><%:Collecting data...%></td></tr>
		<tr><td width="100%" colspan="4"><p align="center"><img id="hid_btn" alt="Show More" height="20px" onclick="return hid_btn_action()"/></p></td></tr>
		<tr id="hid_1"><td width="100%" colspan="4"><p align="center"><b> 常用操作快捷按钮 </b></p></td></tr>
    <tr id="hid_2"><td width="25%" align="center" id="_get_history"><%:Collecting data...%></td>
    	<td width="25%" align="center" id="_restore_history"><%:Collecting data...%></td>
    	<td width="25%" align="center" id="_close_all_connection"><%:Collecting data...%></td>
			<td width="25%" align="center" id="_reload_firewall"><%:Collecting data...%></td></tr>
		<tr id="hid_3"><td width="25%" align="center" id="_update_subscribe"><%:Collecting data...%></td>
			<td width="25%" align="center" id="_one_key_update"><%:Collecting data...%></td>
			<td width="25%" align="center" id="_update_other_rules"><%:Collecting data...%></td>
			<td width="25%" align="center" id="_update_geoip"><%:Collecting data...%></td>
			</tr>
</table>
</fieldset>
<fieldset id="state" class="cbi-section">
	<table>
		<tr><td width="100%" colspan="4">
			<p align="center">
				<b> 组件的状态显示，运行前请确保各项目显示正常，需要更新请到全局设置页面操作 </b>
			</p>
		</td></tr>
		<tr><td width="25%"> 策略组节点选择 备份日期 </td><td width="25%" align="left" id="_historychecktime"><%:Collecting data...%></td><td width="25%"> lhie1 规则更新日期 </td><td width="25%" align="left" id="_lhie1"><%:Collecting data...%></td></tr>
		<tr><td width="25%"> ConnersHua 规则更新日期 </td><td width="25%" align="left" id="_ConnersHua"><%:Collecting data...%></td><td width="25%"> ConnersHua 回国规则更新日期 </td><td width="25%" align="left" id="_ConnersHua_return"><%:Collecting data...%></td></tr>
		<tr><td width="25%"> 大陆IP白名单 更新日期 </td><td width="25%" align="left" id="_chnroute"><%:Collecting data...%></td><td width="25%"> GEOIP（By MaxMind）数据库日期 </td><td width="25%" align="left" id="_ipdb"><%:Collecting data...%></td></tr>
	</table>
</fieldset>
<script type="text/javascript">//<![CDATA[
	var clash = document.getElementById('_clash');
	var mode = document.getElementById('_mode');
	var web = document.getElementById('_web');
	var webo = document.getElementById('_webo');
	var watchdog = document.getElementById('_watchdog');
	var daip = document.getElementById('_daip');
	var dase = document.getElementById('_dase');
	var dapo = document.getElementById('_dapo');
	var clashversion = document.getElementById('_clashversion');
	var close_all_connection = document.getElementById('_close_all_connection');
	var restore_history = document.getElementById('_restore_history');
	var get_history = document.getElementById('_get_history');
	var reload_firewall = document.getElementById('_reload_firewall');
	var one_key_update = document.getElementById('_one_key_update');
	var update_subscribe = document.getElementById('_update_subscribe');
	var update_other_rules = document.getElementById('_update_other_rules');
	var update_geoip = document.getElementById('_update_geoip');
	var ipdb = document.getElementById('_ipdb');
	var lhie1 = document.getElementById('_lhie1');
	var ConnersHua = document.getElementById('_ConnersHua');
	var ConnersHua_return = document.getElementById('_ConnersHua_return');
	var chnroute = document.getElementById('_chnroute');
	var historychecktime = document.getElementById('_historychecktime');
	var hid_1 = document.getElementById("hid_1");
	var hid_2 = document.getElementById("hid_2");
	var hid_3 = document.getElementById("hid_3");
	var state = document.getElementById("state");
	var hid_btn = document.getElementById("hid_btn");
	var hid_btn_if = true;
	var arrow="data:image/png;base64, "

	hid_1.style.display = "none";
	hid_2.style.display = "none";
	hid_3.style.display = "none";
  state.style.display="none";
  hid_btn.src=arrow;

	function hid_btn_action() {
		if (hid_btn_if) {
			hid_1.style.display = "";
			hid_2.style.display = "";
			hid_3.style.display = "";
			state.style.display = "block";
			hid_btn.className="rotate";
			hid_btn_if = false;
		} else {
			hid_1.style.display = "none";
			hid_2.style.display = "none";
			hid_3.style.display = "none";
			state.style.display = "none";
			hid_btn.className="rotate1";
			hid_btn_if = true;
		}
		if (hid_btn.className == "rotate1"){
			setTimeout('hid_btn.className="rotate2"',200);
		}
	}
	
	XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "state")%>', null, function(x, status) {
		if ( x && x.status == 200 ) {
			ipdb.innerHTML = status.ipdb ? "<b><font color=green>"+status.ipdb+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>";
			lhie1.innerHTML = status.lhie1 ? "<b><font color=green>"+status.lhie1+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>";
			ConnersHua.innerHTML = status.ConnersHua ? "<b><font color=green>"+status.ConnersHua+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>";
			ConnersHua_return.innerHTML = status.ConnersHua_return ? "<b><font color=green>"+status.ConnersHua_return+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>";
			chnroute.innerHTML = status.chnroute ? "<b><font color=green>"+status.chnroute+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>";
			if ( status.historychecktime != "0" ) {
			   historychecktime.innerHTML = "<b><font color=green>"+status.historychecktime+"</font></b>";
			}
		  else {
		  	 historychecktime.innerHTML = "<b><font color=green>"+"<%:暂未备份%>"+"</font></b>";
		  }
		}
	});
	XHR.poll(2, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "status")%>', null, function(x, status) {
		if ( x && x.status == 200 ) {
			clash.innerHTML = status.clash ? '<b><font color=green><%:RUNNING%></font></b>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
			if ( status.mode == "fake-ip\n" )
      {
			   mode.innerHTML = status.clash ? "<b><font color=green><%: Fake-IP（增强）模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
			}
			else if ( status.mode == "redir-host\n" )
			{
			   mode.innerHTML = status.clash ? "<b><font color=green><%: Redir-Host（兼容）模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
			}
			else if ( status.mode == "redir-host-tun\n" )
			{
			   mode.innerHTML = status.clash ? "<b><font color=green><%: Redir-Host（TUN）模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
			}
			else if ( status.mode == "fake-ip-tun\n" )
			{
			   mode.innerHTML = status.clash ? "<b><font color=green><%: Fake-IP（TUN）模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
			}
			else if ( status.mode == "redir-host-vpn\n" )
			{
			   mode.innerHTML = status.clash ? "<b><font color=green><%: Redir-Host（游戏）模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
			}
			else if ( status.mode == "fake-ip-vpn\n" )
			{
			   mode.innerHTML = status.clash ? "<b><font color=green><%: Fake-IP（游戏）模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
			}
			else if ( status.mode == "fake-ip-mix\n" )
			{
			   mode.innerHTML = status.clash ? "<b><font color=green><%: Fake-IP（TUN-混合）模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
			}
			else if ( status.mode == "redir-host-mix\n" )
			{
			   mode.innerHTML = status.clash ? "<b><font color=green><%: Redir-Host（TUN-混合）模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
			}
			watchdog.innerHTML = status.watchdog ? '<b><font color=green><%:RUNNING%></font> </b>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
			daip.innerHTML = status.daip ? "<b><font color=green>"+status.daip+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";
			dase.innerHTML = status.dase ? "<b><font color=green>"+status.dase+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";
			dapo.innerHTML = status.cn_port ? "<b><font color=green>"+status.cn_port+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";
			web.innerHTML = status.web ? '<input type="button" class="cbi-button cbi-button-reload" value="<%:打开控制面板%>" onclick="return ycad_dashboard(this)"/>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
			webo.innerHTML = status.web ? '<input type="button" class="cbi-button cbi-button-reload" value="<%:打开控制面板%>" onclick="return net_dashboard(this)"/>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
			close_all_connection.innerHTML = status.clash ? '<input type="button" class="cbi-button cbi-button-reload" value="<%:重置所有链接%>" onclick="return b_close_all_connection(this)"/>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
			restore_history.innerHTML = status.clash ? '<input type="button" class="cbi-button cbi-button-reload" value="<%:还原策略组节点选择%>" onclick="return b_restore_history(this)"/>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
			get_history.innerHTML = status.clash ? '<input type="button" class="cbi-button cbi-button-reload" value="<%:保存策略组节点选择%>" onclick="return b_get_history(this)"/>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
			reload_firewall.innerHTML = status.clash ? '<input type="button" class="cbi-button cbi-button-reload" value="<%:重置防火墙规则%>" onclick="return b_reload_firewall(this)"/>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
			one_key_update.innerHTML = '<input type="button" class="cbi-button cbi-button-reload" value="<%:插件和内核检查更新%>" onclick="return all_one_key_update(this)"/>';
			update_subscribe.innerHTML = '<input type="button" class="cbi-button cbi-button-reload" value="<%:配置文件检查更新%>" onclick="return b_update_subscribe(this)"/>';
			update_other_rules.innerHTML = '<input type="button" class="cbi-button cbi-button-reload" value="<%:第三方规则检查更新%>" onclick="return b_update_other_rules(this)"/>';
			update_geoip.innerHTML = '<input type="button" class="cbi-button cbi-button-reload" value="<%:GEOIP数据库检查更新%>" onclick="return b_update_geoip(this)"/>';
		}
	});
	XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "state")%>', null, function(x, status) {
		if ( x && x.status == 200 ) {
			ipdb.innerHTML = status.ipdb ? "<b><font color=green>"+status.ipdb+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>";
			lhie1.innerHTML = status.lhie1 ? "<b><font color=green>"+status.lhie1+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>";
			ConnersHua.innerHTML = status.ConnersHua ? "<b><font color=green>"+status.ConnersHua+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>";
			ConnersHua_return.innerHTML = status.ConnersHua_return ? "<b><font color=green>"+status.ConnersHua_return+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>";
			chnroute.innerHTML = status.chnroute ? "<b><font color=green>"+status.chnroute+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>";
			if ( status.historychecktime != "0" ) {
			   historychecktime.innerHTML = "<b><font color=green>"+status.historychecktime+"</font></b>";
			}
		  else {
		  	 historychecktime.innerHTML = "<b><font color=green>"+"<%:暂未备份%>"+"</font></b>";
		  }
		}
	});
	  function winOpen(url)
	  {
	  	var winOpen = window.open(url);
      if(winOpen == null || typeof(winOpen) == 'undefined'){
         window.location.href=url;
      }
	  }
	  
	  function all_one_key_update(btn)
    {
        btn.value    = '<%:插件和内核检查更新%>';
        btn.disabled = true;
        var r = confirm("确定要一键检查并更新所有内核及插件吗？")
        if (r == true) {
        XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "one_key_update_check")%>', null, function(x, status) {
        	if ( x && x.status == 200 ) {
        		if ( status.corever != "0\n" ) {
        			XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "one_key_update")%>', null, function(x, status) {
              	if ( x && x.status == 200 ) {
              		alert('一键检查更新正在进行...')
              	}
              	else {
            			alert('一键检查更新失败,请稍后再试！')
           			}
              });
						}
						else {
							alert('未选择编译版本，请到常规设置标签中配置！')
           	}
        	}
          else {
            alert('一键检查更新失败,请稍后再试！')
          }
        });
				}
				else {
        }
        btn.disabled = false;
        return false; 
    }
    function b_update_other_rules(btn)
    {
        btn.disabled = true;
        btn.value    = '<%:正在检查更新...%>';
        XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update_other_rules")%>', null, function(x, status) {
        if ( x && x.status == 200 ) {
           btn.disabled = false;
           btn.value    = '<%:第三方规则检查更新%>';
        }
        else {
        	btn.disabled = false;
          btn.value    = '<%:第三方规则检查更新%>';
        }
        return false;
        });
    }
    function b_update_geoip(btn)
    {
        btn.disabled = true;
        btn.value    = '<%:正在检查更新...%>';
        XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update_geoip")%>', null, function(x, status) {
        if ( x && x.status == 200 ) {
           btn.disabled = false;
           btn.value    = '<%:GEOIP数据库检查更新%>';
        }
        else {
        	btn.disabled = false;
          btn.value    = '<%:GEOIP数据库检查更新%>';
        }
        return false;
        });
    }
    function b_update_subscribe(btn)
    {
        btn.disabled = true;
        btn.value    = '<%:正在检查更新...%>';
        XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update_subscribe")%>', null, function(x, status) {
        if ( x && x.status == 200 ) {
           btn.disabled = false;
           btn.value    = '<%:配置文件检查更新%>';
        }
        else {
        	btn.disabled = false;
          btn.value    = '<%:配置文件检查更新%>';
        }
        return false;
        });
    }
	  function b_reload_firewall(btn)
    {
        btn.disabled = true;
        btn.value    = '<%:正在重置...%>';
        XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "reload_firewall")%>', null, function(x, status) {
        if ( x && x.status == 200 ) {
           btn.disabled = false;
           btn.value    = '<%:重置防火墙规则%>';
        }
        else {
        	btn.disabled = false;
          btn.value    = '<%:防火墙规则重置失败%>';
        }
        return false;
        });
    }
	  function b_close_all_connection(btn)
    {
        btn.disabled = true;
        btn.value    = '<%:正在重置...%>';
        XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "close_all_connection")%>', null, function(x, status) {
        if ( x && x.status == 200 ) {
           btn.disabled = false;
           btn.value    = '<%:重置所有链接%>';
        }
        else {
        	btn.disabled = false;
          btn.value    = '<%:重置链接失败%>';
        }
        return false;
        });
    }
    function b_restore_history(btn)
    {
        btn.disabled = true;
        btn.value    = '<%:正在还原...%>';
        XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "restore_history")%>', null, function(x, status) {
        if ( x && x.status == 200 ) {
           btn.disabled = false;
           btn.value    = '<%:还原策略组节点选择%>';
        }
        else {
        	btn.disabled = false;
          btn.value    = '<%:还原失败%>';
        }
        return false;
        });
    }
    function b_get_history(btn)
    {
        btn.disabled = true;
        btn.value    = '<%:正在保存...%>';
        XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "get_history")%>', null, function(x, status) {
        if ( x && x.status == 200 ) {
           btn.disabled = false;
           btn.value    = '<%:保存策略组节点选择%>';
        }
        else {
        	btn.disabled = false;
          btn.value    = '<%:保存失败%>';
        }
        return false;
        });
    }
    
	  function ycad_dashboard(btn)
    {
        XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "status")%>', status.cn_port, function(x, status) {
        btn.disabled = true;
        btn.value    = '<%:打开控制面板%>';
        url1='<%="http://'+window.location.hostname+status.uh_port+'/luci-static/openclash?hostname='+ status.daip + '&port=' + status.cn_port + '&secret=' + status.dase +'"%>';
        winOpen(url1);
        return false;
        });
    }
    function net_dashboard(btn)
    {
        XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "status")%>', status.cn_port, function(x, status) {
        btn.disabled = true;
        btn.value    = '<%:打开控制面板%>';
        url2='http://'+window.location.hostname+':'+status.cn_port+'/ui';
        winOpen(url2);
        return false;
        });
    }
    
    function homepage()
    {
        url3='https://github.com/vernesong/OpenClash';
        winOpen(url3);
    }
    
    function wikipage()
    {
        url5='https://github.com/vernesong/OpenClash/wiki';
        winOpen(url5);
    }
    
    function telegrampage()
    {
        url6='https://t.me/joinchat/D4mVX0n-n5mOK6YO_W3_Og';
        winOpen(url6);
    }
    
    function sponsorpage()
    {
        url7='https://ko-fi.com/vernesong';
        winOpen(url7);
    }
    

	  XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "currentversion")%>', status.currentversion, function(x, status) {
	     if ( x && x.status == 200 ) {
	        clashversion.innerHTML = '<img id="currenntver" src="'+status.currentversion+'" alt="currentversion" width="200px" onload="return clashversion_check()" onclick="return go_update()">';
	     }
	  });

    function clashversion_check()
    {
    XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "lastversion")%>', status.lastversion, function(x, status) {
       if ( x && x.status == 200 ) {
          if ( status.lastversion != "\n" && status.lastversion != "" )
          {
             clashversion.innerHTML = '<img id="lastver" src="'+status.lastversion+'" alt="lastversion" onerror="return clashversion_error()" onclick="return go_update()">';
          }
       }
        });
    }

    function clashversion_error()
    {
       XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "currentversion")%>', status.currentversion, function(x, status) {
	        if ( x && x.status == 200 ) {
             clashversion.innerHTML = '<img id="currenntver" src="'+status.currentversion+'" alt="currentversion" width="200px" onclick="return go_update()">';
	        }
	     });
    }
    
    function imgerrorfuns(imgobj,imgSrc){
    	setTimeout(function(){
        imgobj.src=imgSrc;
      },1000*10);
     }
     
    function go_update()
    {
       url4='https://github.com/vernesong/OpenClash/releases';
       winOpen(url4);
    }
    
	var startlog = document.getElementById('_clashstart');
	XHR.poll(6, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "startlog")%>', status.startlog, function(x, status) {
	  if ( x && x.status == 200 ) {
		   if ( status.startlog == "\n" || status.startlog == "" ) {
          var rdmdl=Math.floor(Math.random()*12)+1;
          if(rdmdl==1)
          {
             startlog.innerHTML = '<b><font><%: Tip: 您可以在配置文件页面直接修改配置文件（适用于没被接管的内容） %></font></b>';
          }
          if(rdmdl==2)
          {
             startlog.innerHTML = '<b><font><%: Tip: 点击上方版本图标可跳转到客户端发布页面 %></font></b>';
          }
          if(rdmdl==3)
          {
             startlog.innerHTML = '<b><font><%: Tip: 不会编写配置文件？试试在【服务器与策略组管理】页面一键创建 %></font></b>';
          }
          if(rdmdl==4)
          {
             startlog.innerHTML = '<b><font><%: Tip: 某些网站链接出现异常? 试试切换模式或者使用第三方规则 %></font></b>';
          }
          if(rdmdl==5)
          {
             startlog.innerHTML = '<b><font><%: Tip: 使用 Fake-IP 模式可以获得更加快速的访问体验 %></font></b>';
          }
          if(rdmdl==6)
          {
             startlog.innerHTML = '<b><font><%: Tip: 使用 TLS & TCP & HTTPS 方式查询DNS可以获得更好的抗污染效果 %></font></b>';
          }
          if(rdmdl==7)
          {
             startlog.innerHTML = '<b><font><%: Tip: OpenClash 启动时会检查配置文件参数【服务器（策略）组、规则、DNS设置】以确保能够正常工作 %></font></b>';
          }
          if(rdmdl==8)
          {
             startlog.innerHTML = '<b><font><%: Tip: 使用自定义DNS上游服务器时NameServer组必须设置至少一个服务器 %></font></b>';
          }
          if(rdmdl==9)
          {
             startlog.innerHTML = '<b><font><%: Tip: 网站访问检查展示的是当前登录LUCI页面设备的连接情况 %></font></b>';
          }
          if(rdmdl==10)
          {
             startlog.innerHTML = '<b><font><%: Tip: OpenClash 成功启动后请耐心等待下方网站访问检查连接正常后再使用 %></font></b>';
          }
          if(rdmdl==11)
          {
             startlog.innerHTML = '<b><font><%: Tip: 如果不使用IPV6，请关闭IPV6的DHCP服务，否则会造成连接异常 %></font></b>';
          }
          if(rdmdl==12)
          {
             startlog.innerHTML = '<b><font><%: Tip: 您可以在全局设置页面进行版本更新操作 %></font></b>';
          }
       }
	  }
	});
	XHR.poll(1, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "startlog")%>', status.startlog, function(x, status) {
	  if ( x && x.status == 200 ) {
		   if ( status.startlog != "\n" && status.startlog != "" ) {
	     startlog.innerHTML = '<b><font color="green">'+status.startlog+'</font></b>';
	     }
	  }
	});
//]]></script>

