openwrt-packages/luci-app-filebrowser/luasrc/view/filebrowser/filebrowser_status.htm
2024-10-14 08:36:44 +08:00

33 lines
1.1 KiB
HTML

<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="openClient();" />';
tb.innerHTML = links;
} else {
tb.innerHTML = '<font color=red>Filebrowser <%:未运行%></font>';
}
}
}
);
function openClient() {
var curWwwPath = window.document.location.href;
var pathName = window.document.location.pathname;
var pos = curWwwPath.indexOf(pathName);
var localhostPath = curWwwPath.substring(0, pos);
var clientPort = window.document.getElementById("cbid.filebrowser.config.port").value
var url = localhostPath + ":" + clientPort;
window.open(url)
};
//]]>
</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>