]> git.wh0rd.org - tt-rss.git/commitdiff
remove some unnecessary element IDs
authorAndrew Dolgov <noreply@fakecake.org>
Fri, 30 Nov 2018 11:39:06 +0000 (14:39 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Fri, 30 Nov 2018 11:39:06 +0000 (14:39 +0300)
rework plugins/note to use xhrJson()

classes/feeds.php
plugins/note/note.js

index 2bd9b0e6573f7afc0b6c3d4551b287bd262fdf56..d6da225e8afe20322415c48be63fbda2276c7b29 100755 (executable)
@@ -417,7 +417,7 @@ class Feeds extends Handler_Protected {
 
                                        $reply['content'] .= "<div onclick='return hlClicked(event, $id)'
                     class=\"hlTitle\"><span class='hlContent $hlc_suffix'>";
-                                       $reply['content'] .= "<a id=\"RTITLE-$id\" class=\"title $hlc_suffix\"
+                                       $reply['content'] .= "<a class=\"title $hlc_suffix\"
                     href=\"" . htmlspecialchars($line["link"]) . "\"
                     onclick=\"\">" .
                                                truncate_string($line["title"], 200);
@@ -523,7 +523,7 @@ class Feeds extends Handler_Protected {
                                        }
 
                                        // data-article-id included for context menu
-                                       $tmp_content .= "<span id=\"RTITLE-$id\"
+                                       $tmp_content .= "<span
                     onclick=\"return cdmClicked(event, $id);\"
                     data-article-id=\"$id\"
                     class=\"titleWrap hlMenuAttach $hlc_suffix\">
@@ -564,7 +564,7 @@ class Feeds extends Handler_Protected {
 
                                        $tmp_content .= "</div>"; //cdmHeader
 
-                                       $tmp_content .= "<div class=\"cdmContent\" onclick=\"return cdmClicked(event, $id, true);\" id=\"CICD-$id\">";
+                                       $tmp_content .= "<div class=\"cdmContent\" onclick=\"return cdmClicked(event, $id, true);\">";
 
                                        $tmp_content .= "<div id=\"POSTNOTE-$id\">";
                                        if ($line['note']) {
index 022fc88e7e98a95117660d9b98bb126155a155bb..bf69a680e85e25dbb9f3fa4e2e737c725b88e026 100644 (file)
@@ -12,31 +12,26 @@ function editArticleNote(id) {
                        style: "width: 600px",
                        execute: function() {
                                if (this.validate()) {
-                                       var query = dojo.objectToQuery(this.attr('value'));
-
                                        notify_progress("Saving article note...", true);
 
-                                       new Ajax.Request("backend.php", {
-                                       parameters: query,
-                                       onComplete: function(transport) {
-                                               notify('');
-                                               dialog.hide();
-
-                                               var reply = JSON.parse(transport.responseText);
-
-                                               cache_delete("article:" + id);
+                                       xhrJson("backend.php", this.attr('value'), (reply) => {
+                        notify('');
+                        dialog.hide();
 
-                                               var elem = $("POSTNOTE-" + id);
+                        if (reply) {
+                            cache_delete("article:" + id);
 
-                                               if (elem) {
-                                                       Element.hide(elem);
-                                                       elem.innerHTML = reply.note;
+                            var elem = $("POSTNOTE-" + id);
 
-                                                       if (reply.raw_length != 0)
-                                                               new Effect.Appear(elem);
-                                               }
+                            if (elem) {
+                                Element.hide(elem);
+                                elem.innerHTML = reply.note;
 
-                                       }});
+                                if (reply.raw_length != 0)
+                                    new Effect.Appear(elem);
+                            }
+                        }
+                    });
                                }
                        },
                        href: query,