From b31792ad9b3ef8c3bf87dd0f8bae0d0a5b5c9122 Mon Sep 17 00:00:00 2001 From: Nick Peng Date: Tue, 25 Feb 2020 21:34:42 +0800 Subject: [PATCH] luci-app-smartdns: clean javascript code --- .../resources/view/smartdns/smartdns.js | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/package/luci/files/luci/htdocs/luci-static/resources/view/smartdns/smartdns.js b/package/luci/files/luci/htdocs/luci-static/resources/view/smartdns/smartdns.js index 25f83b3..e9e6b52 100644 --- a/package/luci/files/luci/htdocs/luci-static/resources/view/smartdns/smartdns.js +++ b/package/luci/files/luci/htdocs/luci-static/resources/view/smartdns/smartdns.js @@ -81,9 +81,9 @@ function smartdnsRenderStatus(res) { var ipv6Enabled = uci.get_first('smartdns', 'smartdns', 'ipv6_server'); if (isRunning) { - renderHTML += "SmartDNS - " + _("RUNNING") + ""; + renderHTML += "SmartDNS - " + _("RUNNING") + ""; } else { - renderHTML += "SmartDNS - " + _("NOT RUNNING") + ""; + renderHTML += "SmartDNS - " + _("NOT RUNNING") + ""; return renderHTML; } @@ -92,7 +92,7 @@ function smartdnsRenderStatus(res) { var dnsmasqServer = uci.get_first('dhcp', 'dnsmasq', 'server') || ""; if (dnsmasqServer.indexOf(matchLine) < 0) { - renderHTML += "

" + _("Dnsmasq Forwared To Smartdns Failure") + ""; + renderHTML += "
" + _("Dnsmasq Forwared To Smartdns Failure") + ""; } } else if (redirectMode === "redirect") { var redirectRules = (ipt || '').split(/\n/).filter(function (rule) { @@ -100,13 +100,13 @@ function smartdnsRenderStatus(res) { }); if (redirectRules.length <= 0) { - renderHTML += "

" + _("IPV4 53 Port Redirect Failure") + ""; + renderHTML += "
" + _("IPV4 53 Port Redirect Failure") + ""; if (ipv6Enabled) { var redirectRules = (ip6t || '').split(/\n/).filter(function (rule) { return rule.match(/REDIRECT/) && rule.match(/dpt:53/) && rule.match("ports " + serverPort); }); if (redirectRules.length <= 0) { - renderHTML += "

" + _("IPV6 53 Port Redirect Failure") + ""; + renderHTML += "
" + _("IPV6 53 Port Redirect Failure") + ""; } } } @@ -118,8 +118,6 @@ function smartdnsRenderStatus(res) { return L.view.extend({ load: function () { return Promise.all([ - L.resolveDefault(fs.stat('/etc/config/smartdns'), null), - L.resolveDefault(fs.stat('/usr/sbin/smartdns'), {}), uci.load('smartdns'), uci.load('dhcp') ]); @@ -192,17 +190,18 @@ return L.view.extend({ o.rmempty = false; o.default = o.disabled; + // Domain prefetch load ; o = s.taboption("settings", form.Flag, "prefetch_domain", _("Domain prefetch"), - _("Enable domain prefetch, accelerate domain response speed.")); + _("Enable domain prefetch, accelerate domain response speed.")); o.rmempty = false; o.default = o.disabled; - + // Domain Serve expired o = s.taboption("settings", form.Flag, "serve_expired", _("Serve expired"), _("Attempts to serve old responses from cache with a TTL of 0 in the response without waiting for the actual resolution to finish.")); o.rmempty = false; o.default = o.disabled; - + // Redirect; o = s.taboption("settings", form.ListValue, "redirect", _("Redirect"), _("SmartDNS redirect mode")); o.placeholder = "none"; @@ -254,7 +253,7 @@ return L.view.extend({ // dns server group; o = s.taboption("seconddns", form.Value, "seconddns_server_group", _("Server Group"), - _("Query DNS through specific dns server group, such as office, home.")); + _("Query DNS through specific dns server group, such as office, home.")); o.rmempty = true; o.placeholder = "default"; o.datatype = "hostname"; @@ -436,7 +435,7 @@ return L.view.extend({ s.tab("blackip-list", _("IP Blacklist"), _("Set Specific ip blacklist.")); o = s.taboption("domain-address", form.TextValue, "address_conf", - _(""), + "", _("Specify an IP address to return for any host in the given domains, Queries in the domains are never " + "forwarded and always replied to with the specified IP address which may be IPv4 or IPv6.")); o.rows = 20; @@ -450,8 +449,7 @@ return L.view.extend({ // IP Blacklist; // blacklist; o = s.taboption("blackip-list", form.TextValue, "blackip_ip_conf", - _(""), - _("Configure IP blacklists that will be filtered from the results of specific DNS server.")); + "", _("Configure IP blacklists that will be filtered from the results of specific DNS server.")); o.rows = 20; o.cfgvalue = function (section_id) { return fs.trimmed('/etc/smartdns/blacklist-ip.conf');