]> git.wh0rd.org Git - tt-rss.git/commitdiff
js: code cleanup
authorAndrew Dolgov <fox@fakecake.org>
Sun, 7 Nov 2010 09:11:05 +0000 (12:11 +0300)
committerAndrew Dolgov <fox@fakecake.org>
Sun, 7 Nov 2010 09:11:05 +0000 (12:11 +0300)
feedlist.js
functions.js
functions.php
modules/backend-rpc.php
offline.js
prefs.js
tt-rss.js
viewfeed.js

index d1bb7f9a715c331dd2a708075d2ae7f63fadee29..3c6e881a04bbccf7529ae0580aa34b5f46b0e7ea 100644 (file)
@@ -44,16 +44,6 @@ function render_feedlist(data) {
        }
 }
 
-function feedlist_callback2(transport) {
-       try {
-               console.log("feedlist_callback2");
-               if (!transport_error_check(transport)) return;
-               render_feedlist(transport.responseText);
-       } catch (e) {
-               exception_error("feedlist_callback2", e);
-       }
-}
-
 function viewNextFeedPage() {
        try {
                //if (!getActiveFeedId()) return;
@@ -112,7 +102,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
                        var date = new Date();
                        var timestamp = Math.round(date.getTime() / 1000);
 
-                       console.log("<b>" + _infscroll_request_sent + " : " + timestamp + "</b>");
+                       console.log(_infscroll_request_sent + " : " + timestamp);
 
                        if (_infscroll_request_sent && _infscroll_request_sent + 30 > timestamp) {
                                console.log("infscroll request in progress, aborting");
index f6b7ec335e9c582cd90f86ff02fda4aa2ba18455..2aa0dab4fded804dd5f6c06a110f1474e31fe9da 100644 (file)
@@ -581,12 +581,9 @@ function parse_counters_reply(transport, scheduled_call) {
 function all_counters_callback2(transport, async_call) {
        try {
                if (async_call) async_counters_work = true;
-               
                if (offline_mode) return;
 
-               console.log("<b>all_counters_callback2 IN: " + transport + "</b>");
                parse_counters_reply(transport);
-               console.log("<b>all_counters_callback2 OUT: " + transport + "</b>");
 
        } catch (e) {
                exception_error("all_counters_callback2", e, transport);
@@ -1723,21 +1720,11 @@ function displayHelpInfobox(topic_id) {
 
 }
 
-function focus_element(id) {
-       try {
-               var e = $(id);
-               if (e) e.focus();
-       } catch (e) {
-               exception_error("focus_element", e);
-       }
-       return false;
-}
-
 function loading_set_progress(p) {
        try {
                if (p < last_progress_point || !Element.visible("overlay")) return;
 
-               console.log("<b>loading_set_progress : " + p + " (" + last_progress_point + ")</b>");
+               console.log("loading_set_progress : " + p + " (" + last_progress_point + ")");
 
                var o = $("l_progress_i");
 
@@ -1892,7 +1879,7 @@ function displayNewContentPrompt(id) {
 
                $('auxDlg').innerHTML = msg;
 
-               Element.show('auxDlg');
+               new Effect.Appear('auxDlg', {duration : 0.5});
 
        } catch (e) {
                exception_error("displayNewContentPrompt", e);
@@ -2167,7 +2154,6 @@ function backend_sanity_check_callback(transport) {
 
                if (params) {
                        console.log('reading init-params...');
-                       //var param = params.firstChild;
 
                        params = JSON.parse(params.firstChild.nodeValue);
 
@@ -2177,7 +2163,7 @@ function backend_sanity_check_callback(transport) {
                                        var k = params[i].param;
                                        var v = params[i].value;
        
-                                       console.log(k + " => " + v);
+                                       if (getURLParam('debug')) console.log(k + " => " + v);
                                        init_params[k] = v;                                     
        
                                        if (db) {
@@ -2198,4 +2184,3 @@ function backend_sanity_check_callback(transport) {
        } 
 }
 
-
index 8b9c742e275b35cbaf425869752acbdc276856d3..d787b71862996cc470edf97c62d5f6c1c6ca10a5 100644 (file)
 
                                $sel_inv_link = "javascript:invertHeadlineSelection()";
 
-                               $tog_unread_link = "javascript:selectionToggleUnread(true)";
-                               $tog_marked_link = "javascript:selectionToggleMarked(true)";
-                               $tog_published_link = "javascript:selectionTogglePublished(true)";
+                               $tog_unread_link = "javascript:selectionToggleUnread()";
+                               $tog_marked_link = "javascript:selectionToggleMarked()";
+                               $tog_published_link = "javascript:selectionTogglePublished()";
 
                        }
 
index 55babdaa78b9fc9e42ecec9c17bd82766f7aff4e..fee93a58643ab746080fd080a2ec63440a5b361b 100644 (file)
                        return;
                }
 
-               if ($subop == "forceUpdateAllFeeds" || $subop == "updateAllFeeds") {
+               if ($subop == "updateAllFeeds") {
        
                        $global_unread_caller = sprintf("%d", $_REQUEST["uctr"]);
                        $global_unread = getGlobalUnread($link);
index 9abad919ae2ba7de85f3128e5980f5a027831a49..a25f0c6fef17ecacca8803128c593b22268129d6 100644 (file)
@@ -166,8 +166,8 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
                                        sel_none_link = "javascript:cdmSelectArticles('none')";
                                        sel_inv_link = "javascript:invertHeadlineSelection()";
 
-                                       tog_unread_link = "javascript:selectionToggleUnread(true)";
-                                       tog_marked_link = "javascript:selectionToggleMarked(true)";
+                                       tog_unread_link = "javascript:selectionToggleUnread()";
+                                       tog_marked_link = "javascript:selectionToggleMarked()";
                                }
 
                                tmp += __('Select:')+
index 9fce9059b7ddac005aa471a11dd9ef1d79581211..33887b15e864072820de250d7d06a6ae2cd33f8d 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -1380,7 +1380,7 @@ function pref_hotkey_handler(e) {
                                for (var i = 0; i < search_boxes.length; i++) {
                                        var elem = $(search_boxes[i]);
                                        if (elem) {
-                                               focus_element(search_boxes[i]);
+                                               $(search_boxes[i]).focus();
                                                return false;
                                        }
                                }
index b0aa84706ad0192b01522a178694dd0db842dc35..51c1d3c5f79e8ecc69fab3b6229b74823b43367a 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -26,7 +26,7 @@ function activeFeedIsCat() {
 
 function getActiveFeedId() {
        try {
-               console.log("gAFID: " + _active_feed_id);
+               //console.log("gAFID: " + _active_feed_id);
                return _active_feed_id;
        } catch (e) {
                exception_error("getActiveFeedId", e);
@@ -35,7 +35,7 @@ function getActiveFeedId() {
 
 function setActiveFeedId(id, is_cat) {
        try {
-               console.log("sAFID(" + id + ", " + is_cat + ")");
+               //console.log("sAFID(" + id + ", " + is_cat + ")");
                _active_feed_id = id;
 
                if (is_cat != undefined) {
@@ -93,17 +93,11 @@ function dlg_frefresh_callback(transport, deleted_feed) {
        closeInfoBox();
 }
 
-function scheduleFeedUpdate(force) {
+function scheduleFeedUpdate() {
 
        console.log("in scheduleFeedUpdate");
 
-       var query_str = "backend.php?op=rpc&subop=";
-
-       if (force) {
-               query_str = query_str + "forceUpdateAllFeeds";
-       } else {
-               query_str = query_str + "updateAllFeeds";
-       }
+       var query_str = "backend.php?op=rpc&subop=updateAllFeeds";
 
        var omode;
 
@@ -130,39 +124,31 @@ function scheduleFeedUpdate(force) {
                        } });
 }
 
-function updateFeedList(silent, fetch) {
-
-//     if (silent != true) {
-//             notify("Loading feed list...");
-//     }
-
-       console.log("<b>updateFeedList</b>");
-
-       if (offline_mode) return render_offline_feedlist();
-
-       var query_str = "backend.php?op=feeds";
-
-       if (display_tags) {
-               query_str = query_str + "&tags=1";
-       }
-
-       if (getActiveFeedId() && !activeFeedIsCat()) {
-               query_str = query_str + "&actid=" + getActiveFeedId();
-       }
+function updateFeedList() {
+       try {
+               console.log("updateFeedList");
        
-       if (fetch) query_str = query_str + "&fetch=yes";
-
-//     var feeds_frame = $("feeds-frame");
-//     feeds_frame.src = query_str;
-
-       console.log("updateFeedList Q=" + query_str);
-
-       new Ajax.Request("backend.php", {
-               parameters: query_str,
-               onComplete: function(transport) { 
-                       feedlist_callback2(transport); 
-               } });
+               if (offline_mode) return render_offline_feedlist();
+       
+               var query_str = "backend.php?op=feeds";
+       
+               if (display_tags) {
+                       query_str = query_str + "&tags=1";
+               }
+       
+               if (getActiveFeedId() && !activeFeedIsCat()) {
+                       query_str = query_str + "&actid=" + getActiveFeedId();
+               }
+               
+               new Ajax.Request("backend.php", {
+                       parameters: query_str,
+                       onComplete: function(transport) { 
+                               render_feedlist(transport.responseText);
+                       } });
 
+       } catch (e) {
+               exception_error("updateFeedList", e);
+       }
 }
 
 function catchupAllFeeds() {
index 5a0bf77edbc030dcbb4d6b1eab23f64cf82c6cff..a6065ecb4b4c04bd427a8c7d3b5ff8a09d752e3c 100644 (file)
@@ -1001,11 +1001,11 @@ function selectionAssignLabel(id) {
        }
 }
 
-function selectionToggleUnread(cdm_mode, set_state, callback_func, no_error) {
+function selectionToggleUnread(set_state, callback_func, no_error) {
        try {
                var rows;
 
-               if (cdm_mode) {
+               if (isCdmMode()) {
                        rows = cdmGetSelectedArticles();
                } else {        
                        rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
@@ -1085,12 +1085,12 @@ function selectionToggleUnread(cdm_mode, set_state, callback_func, no_error) {
        }
 }
 
-function selectionToggleMarked(cdm_mode) {
+function selectionToggleMarked() {
        try {
        
                var rows;
                
-               if (cdm_mode) {
+               if (isCdmMode()) {
                        rows = cdmGetSelectedArticles();
                } else {        
                        rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
@@ -1129,12 +1129,12 @@ function selectionToggleMarked(cdm_mode) {
        }
 }
 
-function selectionTogglePublished(cdm_mode) {
+function selectionTogglePublished() {
        try {
        
                var rows;
                
-               if (cdm_mode) {
+               if (isCdmMode()) {
                        rows = cdmGetSelectedArticles();
                } else {        
                        rows = getSelectedTableRowIds("headlinesList", "RROW", "RCHK");
@@ -1266,11 +1266,11 @@ function catchupPage() {
 
        if ($("headlinesList")) {
                selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true);
-               selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
+               selectionToggleUnread(false, 'viewCurrentFeed()', true);
                selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
        } else {
                cdmSelectArticles('all');
-               selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
+               selectionToggleUnread(false, 'viewCurrentFeed()', true)
                cdmSelectArticles('none');
        }
 }
@@ -1411,9 +1411,9 @@ function catchupSelection() {
                }
        
                if ($("headlinesList")) {
-                       selectionToggleUnread(false, false, 'viewCurrentFeed()', true);
+                       selectionToggleUnread(false, 'viewCurrentFeed()', true);
                } else {
-                       selectionToggleUnread(true, false, 'viewCurrentFeed()', true)
+                       selectionToggleUnread(false, 'viewCurrentFeed()', true)
                }
 
        } catch (e) {