Globally replace luci.dispatcher.build_url(...) with url(...) invocations
[project/luci.git] / applications / luci-app-ddns / luasrc / view / ddns / overview_status.htm
index 6cca0e7..5464812 100644 (file)
 
                // do start/stop
                var btnXHR = new XHR();
-               btnXHR.get('<%=luci.dispatcher.build_url("admin", "services", "ddns", "startstop")%>/' + section + '/' + cbx.checked, null,
+               btnXHR.get('<%=url('admin/services/ddns/startstop')%>/' + section + '/' + cbx.checked, null,
                        function(x, data) {
                                if (x.responseText == "_uncommitted_") {
                                        // we need a trick to display Ampersand "&" in stead of "&#38;" or "&amp;"
                                } else {
                                        // should have data because status changed
                                        // so update screen
-                                       if (data)
-                                               _data2elements(data);
+                                       if (data) { _data2elements(data); }
                                }
                                // make me invisible
                                obj.parentNode.style.display = "none";
                );
        }
 
-       var ddns_ov_XHR = new XHR();
        // force to immediate show status on page load (not waiting for XHR.poll)
-       ddns_ov_XHR.get('<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null,
+       XHR.get('<%=url('admin/services/ddns/status')%>', null,
                function(x, data) {
-                       _data2elements(data);
+                       if (data) { _data2elements(data); }
                }
        );
 
        // define only ONE XHR.poll in a page because if one is running it blocks the other one
        // optimum is to define on Map or Section Level from here you can reach all elements
        // we need update every 15 seconds only
-       ddns_ov_XHR.poll(15, '<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null,
+       XHR.poll(15, '<%=url('admin/services/ddns/status')%>', null,
                function(x, data) {
-                       _data2elements(data);
+                       if (data) { _data2elements(data); }
                }
        );