openwrt_helloworld/luci-app-openclash/luasrc/view/openclash/update_config.htm
2025-02-15 10:30:29 +08:00

28 lines
793 B
HTML

<%+cbi/valueheader%>
<%
local fs = require "luci.openclash"
local filename = fs.filename(self:cfgvalue(section)) or "config"
local display = self.display or ""
local idname = math.random(1000)..(string.match(filename, "[%w_]+") or "")
%>
<script type="text/javascript">//<![CDATA[
function act_update_config_<%=idname%>(btn)
{
btn.disabled = true;
btn.value = '<%:UpDate%>';
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash","update_config")%>',{filename: "<%=filename%>"}, function(x,status){});
btn.disabled = false;
return false;
};
//]]></script>
<%
if display == "" then
%>
<input type="button" class="btn cbi-button cbi-input-reload" value="<%:UpDate%>" onclick="return act_update_config_<%=idname%>(this)" />
<%
end
%>
<%+cbi/valuefooter%>