mirror of
https://github.com/JamesonHuang/OpenWrt_Luci_Lua.git
synced 2024-11-24 06:10:11 +00:00
76 lines
2.3 KiB
HTML
76 lines
2.3 KiB
HTML
<%
|
|
--[[
|
|
Info Noflushd
|
|
]]--
|
|
local ver = require("xiaoqiang.XQVersion").webVersion
|
|
%>
|
|
|
|
<%include('web/inc/head')%>
|
|
<title>小米路由器</title>
|
|
<link rel="stylesheet" href="<%=resource%>/web/css/page.set.default.css?v=<%=ver%>"/>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="mod-setting-panel">
|
|
<div class="hd">
|
|
<h3>硬盘自动休眠</h3>
|
|
<a href="#" data-status="0" class="btn-offon btn-off" id="btnnoflushd"></a>
|
|
</div>
|
|
<div class="bd">
|
|
<div class="mod-nof" id="noflushd" style="">
|
|
<p>开启此功能后小米路由器将在硬盘非工作状态下使其进入休眠状态,以延长硬盘使用寿命。</p>
|
|
<p>(建议正在使用SSH连接路由器的用户不要开启此功能)</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<%include('web/inc/g.js.base')%>
|
|
<script>
|
|
var modelNoflushd = (function(){
|
|
|
|
function noflushdStatus(){
|
|
$.getJSON('<%=luci.dispatcher.build_url("api", "xqsystem", "noflushd")%>', {}, function(rsp){
|
|
if (rsp.code == 0) {
|
|
var btnnoflushd = $('#btnnoflushd')[0];
|
|
if (rsp.status == 0 || rsp.status == 2) {
|
|
btnnoflushd.className = 'btn-offon btn-off';
|
|
}else{ // 开启
|
|
btnnoflushd.className = 'btn-offon btn-on';
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function noflushdSwitch(){
|
|
var btnnoflushd = $('#btnnoflushd');
|
|
btnnoflushd.on('click', function(e){
|
|
e.preventDefault();
|
|
var st = $(this).hasClass('btn-on') ? 0 : 1,
|
|
btn = this;
|
|
btn.className = 'btn-offon btn-off';
|
|
$.getJSON('<%=luci.dispatcher.build_url("api", "xqsystem", "nof_switch")%>', {'switch': st}, function(rsp){
|
|
if (rsp.code == 0) {
|
|
if (st == 1) {
|
|
btnnoflushd[0].className = 'btn-offon btn-on';
|
|
} else {
|
|
btnnoflushd[0].className = 'btn-offon btn-off';
|
|
}
|
|
} else {
|
|
$.lightalert().setContent(rsp.msg).show();
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
return {
|
|
init : function(){
|
|
noflushdStatus();
|
|
noflushdSwitch();
|
|
}
|
|
}
|
|
}());
|
|
$(function(){
|
|
modelNoflushd.init();
|
|
});
|
|
</script>
|