<script type="text/javascript">//<![CDATA[
XHR.poll(1, '<%=url([[admin]], [[nas]], [[filebrowser]], [[status]])%>', null,
	function(x, data) {
		var tb = document.getElementById('filebrowser_status');
		if (data && tb) {
			if (data.running) {
				var links = '<font color=green>Filebrowser <%:运行中%></font><input class="cbi-button mar-10" type="button" value="<%:打开管理界面%>" onclick="openwebui();" />';
				tb.innerHTML = links;
			} else {
				tb.innerHTML = '<font color=red>Filebrowser <%:未运行%></font>';
			}
		}
	}
);

function openwebui(){
	var url = window.location.host+":<%=luci.sys.exec("uci -q get filebrowser.config.port"):gsub("^%s*(.-)%s*$", "%1")%>";
	window.open('http://'+url,'target','');
};
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
	<p id="filebrowser_status">
		<em><%:Collecting data...%></em>
	</p>
</fieldset>
