]> git.wh0rd.org Git - tt-rss.git/commitdiff
js: code cleanup
authorAndrew Dolgov <fox@fakecake.org>
Sat, 13 Nov 2010 22:41:27 +0000 (01:41 +0300)
committerAndrew Dolgov <fox@fakecake.org>
Sat, 13 Nov 2010 22:41:27 +0000 (01:41 +0300)
digest.js
feedlist.js
viewfeed.js

index 50d5e3116e9e429875d1fbca4ef776c8edd80ed6..22835adf8d1eddcddf21a113473d84abc4023261 100644 (file)
--- a/digest.js
+++ b/digest.js
@@ -637,27 +637,22 @@ function init() {
        }
 }
 
-function toggle_mark(mark_img, id) {
+function toggle_mark(img, id) {
 
        try {
 
                var query = "?op=rpc&id=" + id + "&subop=mark";
-       
-               query = query + "&afid=" + _active_feed_id;
-               query = query + "&omode=c";
 
-               if (!mark_img) return;
+               if (!img) return;
 
-               if (mark_img.src.match("mark_unset")) {
-                       mark_img.src = mark_img.src.replace("mark_unset", "mark_set");
-                       mark_img.alt = __("Unstar article");
+               if (img.src.match("mark_unset")) {
+                       img.src = img.src.replace("mark_unset", "mark_set");
+                       img.alt = __("Unstar article");
                        query = query + "&mark=1";
                } else {
-                       mark_img.alt = __("Please wait...");
+                       img.src = img.src.replace("mark_set", "mark_unset");
+                       img.alt = __("Star article");
                        query = query + "&mark=0";
-       
-                       mark_img.src = mark_img.src.replace("mark_set", "mark_unset");
-                       mark_img.alt = __("Star article");
                }
 
                new Ajax.Request("backend.php", {
@@ -671,35 +666,29 @@ function toggle_mark(mark_img, id) {
        }
 }
 
-function toggle_pub(mark_img, id, note) {
+function toggle_pub(img, id, note) {
 
        try {
 
                var query = "?op=rpc&id=" + id + "&subop=publ";
        
-               query = query + "&afid=" + _active_feed_id;
-
                if (note != undefined) {
                        query = query + "&note=" + param_escape(note);
                } else {
                        query = query + "&note=undefined";
                }
 
-               query = query + "&omode=c";
+               if (!img) return;
 
-               if (!mark_img) return;
-
-               if (mark_img.src.match("pub_unset") || note != undefined) {
-                       mark_img.src = mark_img.src.replace("pub_unset", "pub_set");
-                       mark_img.alt = __("Unpublish article");
+               if (img.src.match("pub_unset") || note != undefined) {
+                       img.src = img.src.replace("pub_unset", "pub_set");
+                       img.alt = __("Unpublish article");
                        query = query + "&pub=1";
 
                } else {
-                       mark_img.alt = __("Please wait...");
+                       img.src = img.src.replace("pub_set", "pub_unset");
+                       img.alt = __("Publish article");
                        query = query + "&pub=0";
-       
-                       mark_img.src = mark_img.src.replace("pub_set", "pub_unset");
-                       mark_img.alt = __("Publish article");
                }
 
                new Ajax.Request("backend.php", {
index 9285c61fdc8794e04227a5e4782c2c8c7d160921..09e76f825e5aec8f76308ae48875a99fbb23da2d 100644 (file)
@@ -210,14 +210,6 @@ function viewfeed(feed, subop, is_cat, offset) {
 
                Form.enable("main_toolbar_form");
 
-               // for piggybacked counters
-
-               if (tagsAreDisplayed()) {
-                       query = query + "&omode=lt";
-               } else {
-                       query = query + "&omode=flc";
-               }
-
                console.log(query);
 
                var container = $("headlinesInnerContainer");
index fa5c618eed4e42c72a271fa99544a8cca72bafd5..f06c99444ecc85bdfcf2a8b7a7b9e72b3da05ebe 100644 (file)
@@ -417,14 +417,6 @@ function view(id) {
 
                console.log("additional ids: " + cids_to_request.toString());                   
        
-               /* additional info for piggyback counters */
-
-               if (tagsAreDisplayed()) {
-                       query = query + "&omode=lt";
-               } else {
-                       query = query + "&omode=flc";
-               }
-
                query = query + "&cids=" + cids_to_request.toString();
 
                var crow = $("RROW-" + id);
@@ -513,30 +505,17 @@ function tPub_afh_off(effect) {
        }
 }
 
-function toggleMark(id, client_only, no_effects) {
-
+function toggleMark(id, client_only) {
        try {
-
                var query = "?op=rpc&id=" + id + "&subop=mark";
        
-               query = query + "&afid=" + getActiveFeedId();
-       
-               if (tagsAreDisplayed()) {
-                       query = query + "&omode=tl";
-               } else {
-                       query = query + "&omode=flc";
-               }
-       
-               var mark_img = $("FMPIC-" + id);
+               var img = $("FMPIC-" + id);
 
-               if (!mark_img) return;
-
-               var vfeedu = $("FEEDU--1");
-               var crow = $("RROW-" + id);
+               if (!img) return;
        
-               if (mark_img.src.match("mark_unset")) {
-                       mark_img.src = mark_img.src.replace("mark_unset", "mark_set");
-                       mark_img.alt = __("Unstar article");
+               if (img.src.match("mark_unset")) {
+                       img.src = img.src.replace("mark_unset", "mark_set");
+                       img.alt = __("Unstar article");
                        query = query + "&mark=1";
 
                        if (db) {
@@ -544,29 +523,23 @@ function toggleMark(id, client_only, no_effects) {
                        }
 
                } else {
-                       mark_img.alt = __("Please wait...");
+                       img.src = img.src.replace("mark_set", "mark_unset");
+                       img.alt = __("Star article");
                        query = query + "&mark=0";
-       
-                       mark_img.src = mark_img.src.replace("mark_set", "mark_unset");
-                       mark_img.alt = __("Star article");
 
                        if (db) {
                                db.execute("UPDATE articles SET marked = 0 WHERE id = ?", [id]);
                        }
-
                }
 
-               if (!no_effects) update_local_feedlist_counters();
+               update_local_feedlist_counters();
 
                if (!client_only) {
-                       //console.log(query);
-
                        new Ajax.Request("backend.php", {
                                parameters: query,
                                onComplete: function(transport) { 
                                        handle_rpc_reply(transport); 
                                } });
-
                }
 
        } catch (e) {
@@ -575,44 +548,29 @@ function toggleMark(id, client_only, no_effects) {
 }
 
 function togglePub(id, client_only, no_effects, note) {
-
        try {
-
                var query = "?op=rpc&id=" + id + "&subop=publ";
        
-               query = query + "&afid=" + getActiveFeedId();
-
                if (note != undefined) {
                        query = query + "&note=" + param_escape(note);
                } else {
                        query = query + "&note=undefined";
                }
-       
-               if (tagsAreDisplayed()) {
-                       query = query + "&omode=tl";
-               } else {
-                       query = query + "&omode=flc";
-               }
-       
-               var mark_img = $("FPPIC-" + id);
 
-               if (!mark_img) return;
+               var img = $("FPPIC-" + id);
 
-               var vfeedu = $("FEEDU--2");
-               var crow = $("RROW-" + id);
+               if (!img) return;
        
-               if (mark_img.src.match("pub_unset") || note != undefined) {
-                       mark_img.src = mark_img.src.replace("pub_unset", "pub_set");
-                       mark_img.alt = __("Unpublish article");
+               if (img.src.match("pub_unset") || note != undefined) {
+                       img.src = img.src.replace("pub_unset", "pub_set");
+                       img.alt = __("Unpublish article");
                        query = query + "&pub=1";
 
                } else {
-                       mark_img.alt = __("Please wait...");
-                       query = query + "&pub=0";
-       
-                       mark_img.src = mark_img.src.replace("pub_set", "pub_unset");
-                       mark_img.alt = __("Publish article");
+                       img.src = img.src.replace("pub_set", "pub_unset");
+                       img.alt = __("Publish article");
 
+                       query = query + "&pub=0";
                }
 
                if (!client_only) {
@@ -1012,10 +970,6 @@ function selectionToggleMarked() {
                        var query = "?op=rpc&subop=markSelected&ids=" +
                                param_escape(rows.toString()) + "&cmode=2";
 
-                       query = query + "&afid=" + getActiveFeedId();
-
-                       query = query + "&omode=lc";
-
                        new Ajax.Request("backend.php", {
                                parameters: query,
                                onComplete: function(transport) { 
@@ -1048,10 +1002,6 @@ function selectionTogglePublished() {
                        var query = "?op=rpc&subop=publishSelected&ids=" +
                                param_escape(rows.toString()) + "&cmode=2";
 
-                       query = query + "&afid=" + getActiveFeedId();
-
-                       query = query + "&omode=lc";
-
                        new Ajax.Request("backend.php", {
                                parameters: query,
                                onComplete: function(transport) {