openwrt_helloworld/luci-app-openclash/luasrc/view/openclash/input_file_name.htm
2024-09-25 05:44:37 +08:00

20 lines
709 B
HTML

<%+cbi/valueheader%>
<script type="text/javascript">
//<![CDATA[
function import_file_name(btn, option, file_path) {
var file_name = prompt("<%:Paste the name of the new file (including the extension) here:%>", "");
if (file_name == null || file_name == "") {
return false;
}
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "create_file")%>', {filename: file_name, filepath: file_path}, function(x, status) {
if (x && x.status == 200)
{
location.reload();
}
});
}
//]]>
</script>
<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Create File%>" onclick="return import_file_name(this, '<%=self.option%>', '<%=self.value%>')" />
<%+cbi/valuefooter%>