]> git.wh0rd.org Git - tt-rss.git/commitdiff
handle_rpc_json: fix netalert button never appearing on JSON parse error
authorAndrew Dolgov <noreply@fakecake.org>
Thu, 9 Feb 2017 20:04:34 +0000 (23:04 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Thu, 9 Feb 2017 20:04:34 +0000 (23:04 +0300)
index.php
js/tt-rss.js

index 6e81bd619a9aa7ff94738aedf6f9da2c84f55fed..e4cad9d00112baabb2ac57b66044e9dbf0c51935 100644 (file)
--- a/index.php
+++ b/index.php
 
                        <button id="net-alert" dojoType="dijit.form.Button" style="display : none" disabled="true"
                                title="<?php echo __("Communication problem with server.") ?>">
-                       <img
-                               src="images/error.png" />
+                               <img src="images/error.png" />
                        </button>
 
                        <div dojoType="dijit.form.DropDownButton">
index 36be92f4e0f7e642ef4ad99daf1e415d57b3e6ff..4ed89d4b2e848229f8c36702ee4662bb5f945b2d 100644 (file)
@@ -994,14 +994,14 @@ function reverseHeadlineOrder() {
 }
 
 function handle_rpc_json(transport, scheduled_call) {
-       try {
-               var reply = JSON.parse(transport.responseText);
 
-               var netalert_dijit = dijit.byId("net-alert");
-               var netalert = false;
+       var netalert_dijit = dijit.byId("net-alert");
+       var netalert = false;
+
+       if (netalert_dijit) netalert = netalert_dijit.domNode;
 
-               if (netalert_dijit)
-                       netalert = netalert_dijit.domNode;
+       try {
+               var reply = JSON.parse(transport.responseText);
 
                if (reply) {
 
@@ -1049,18 +1049,18 @@ function handle_rpc_json(transport, scheduled_call) {
                        if (runtime_info)
                                parse_runtime_info(runtime_info);
 
-                       if (netalert) Element.hide(netalert);
+                       if (netalert) netalert.hide();
 
                } else {
                        if (netalert)
-                               Element.show(netalert);
+                               netalert.show();
                        else
                                notify_error("Communication problem with server.");
                }
 
        } catch (e) {
                if (netalert)
-                       Element.show(netalert);
+                       netalert.show();
                else
                        notify_error("Communication problem with server.");