]> git.wh0rd.org - tt-rss.git/commitdiff
code cleanups
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 29 Sep 2006 05:09:18 +0000 (06:09 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 29 Sep 2006 05:09:18 +0000 (06:09 +0100)
feedlist.js
functions.js
viewfeed.js

index c097a3eb0bc0dc2cd8afd80bf43d7466983a957d..cc36587a2eb288bbbdb3fdb99b74e8ea244950f8 100644 (file)
@@ -1,7 +1,7 @@
 //var xmlhttp = Ajax.getTransport();
 
 function viewCategory(cat) {
-       getMainContext().active_feed_is_cat = true;
+       active_feed_is_cat = true;
        viewfeed(cat, '', true);
 }
 
@@ -52,7 +52,7 @@ function viewfeed(feed, subop, is_cat, subop_param) {
                setActiveFeedId(feed);
        
                if (is_cat != undefined) {
-                       getMainContext().active_feed_is_cat = is_cat;
+                       active_feed_is_cat = is_cat;
                }
 
                if (subop == "MarkAllRead") {
index 2f7774b902e68a919dc6846dbbd7c626ee3a5ddc..bd0b5dcd70db1881481f6b4d7081466b2fa86c14 100644 (file)
@@ -169,30 +169,25 @@ function hotkey_handler(e) {
                        keycode = e.which;
                }
 
-               var m_ctx = getMainContext();
-               var f_ctx = getFeedsContext();
-               var h_ctx = getHeadlinesContext();
-
                if (keycode == 82) { // r
-                       return m_ctx.scheduleFeedUpdate(true);
+                       return scheduleFeedUpdate(true);
                }
 
                if (keycode == 83) { // r
-                       return m_ctx.displayDlg("search", getActiveFeedId());
+                       return displayDlg("search", getActiveFeedId());
                }
 
                if (keycode == 85) { // u
                        if (getActiveFeedId()) {
-                               return f_ctx.viewfeed(getActiveFeedId(), "ForceUpdate");
+                               return viewfeed(getActiveFeedId(), "ForceUpdate");
                        }
                }
        
                if (keycode == 65) { // a
-                       return m_ctx.toggleDispRead();
+                       return toggleDispRead();
                }
        
-               var f_doc = document;
-               var feedlist = f_doc.getElementById('feedList');
+               var feedlist = document.getElementById('feedList');
        
                if (keycode == 74) { // j
                        var feed = getActiveFeedId();
@@ -207,14 +202,14 @@ function hotkey_handler(e) {
                }
 
                if (keycode == 78 || keycode == 40) { // n, down
-                       if (typeof h_ctx.moveToPost != 'undefined') {
-                               return h_ctx.moveToPost('next');
+                       if (typeof moveToPost != 'undefined') {
+                               return moveToPost('next');
                        }
                }
        
                if (keycode == 80 || keycode == 38) { // p, up
-                       if (typeof h_ctx.moveToPost != 'undefined') {
-                               return h_ctx.moveToPost('prev');
+                       if (typeof moveToPost != 'undefined') {
+                               return moveToPost('prev');
                        }
                }
                
@@ -445,22 +440,22 @@ function gotoExportOpml() {
 function getActiveFeedId() {
 //     return getCookie("ttrss_vf_actfeed");
        try {
-               debug("gAFID: " + getMainContext().active_feed_id);
-               return getMainContext().active_feed_id;
+               debug("gAFID: " + active_feed_id);
+               return active_feed_id;
        } catch (e) {
                exception_error("getActiveFeedId", e);
        }
 }
 
 function activeFeedIsCat() {
-       return getMainContext().active_feed_is_cat;
+       return active_feed_is_cat;
 }
 
 function setActiveFeedId(id) {
 //     return setCookie("ttrss_vf_actfeed", id);
        try {
                debug("sAFID(" + id + ")");
-               getMainContext().active_feed_id = id;
+               active_feed_id = id;
        } catch (e) {
                exception_error("setActiveFeedId", e);
        }
@@ -468,8 +463,6 @@ function setActiveFeedId(id) {
 
 function parse_counters(reply, scheduled_call) {
        try {
-               var f_document = document;
-               var title_obj = this.window;
 
                var feeds_found = 0;
 
@@ -478,8 +471,6 @@ function parse_counters(reply, scheduled_call) {
                        reply = reply.firstChild;
                }
 
-               debug("F_DOC: " + f_document + ", T_OBJ: " + title_obj);
-
                for (var l = 0; l < reply.childNodes.length; l++) {
                        if (!reply.childNodes[l] ||
                                typeof(reply.childNodes[l].getAttribute) == "undefined") {
@@ -495,8 +486,8 @@ function parse_counters(reply, scheduled_call) {
                        var updated = reply.childNodes[l].getAttribute("updated");
        
                        if (id == "global-unread") {
-                               title_obj.global_unread = ctr;
-                               title_obj.updateTitle();
+                               global_unread = ctr;
+                               updateTitle();
                                continue;
                        }
 
@@ -506,19 +497,19 @@ function parse_counters(reply, scheduled_call) {
                        }
        
                        if (t == "category") {
-                               var catctr = f_document.getElementById("FCATCTR-" + id);
+                               var catctr = document.getElementById("FCATCTR-" + id);
                                if (catctr) {
                                        catctr.innerHTML = "(" + ctr + " unread)";
                                }
                                continue;
                        }
                
-                       var feedctr = f_document.getElementById("FEEDCTR-" + id);
-                       var feedu = f_document.getElementById("FEEDU-" + id);
-                       var feedr = f_document.getElementById("FEEDR-" + id);
-                       var feed_img = f_document.getElementById("FIMG-" + id);
-                       var feedlink = f_document.getElementById("FEEDL-" + id);
-                       var feedupd = f_document.getElementById("FLUPD-" + id);
+                       var feedctr = document.getElementById("FEEDCTR-" + id);
+                       var feedu = document.getElementById("FEEDU-" + id);
+                       var feedr = document.getElementById("FEEDR-" + id);
+                       var feed_img = document.getElementById("FIMG-" + id);
+                       var feedlink = document.getElementById("FEEDL-" + id);
+                       var feedupd = document.getElementById("FLUPD-" + id);
 
                        if (updated && feedlink) {
                                if (error) {
@@ -572,15 +563,14 @@ function parse_counters(reply, scheduled_call) {
                        }
                }
 
-               hideOrShowFeeds(getFeedsContext().document, 
-                       getInitParam("hide_read_feeds") == 1);
+               hideOrShowFeeds(document, getInitParam("hide_read_feeds") == 1);
 
-               var feeds_stored = getMainContext().number_of_feeds;
+               var feeds_stored = number_of_feeds;
 
                debug("Feed counters, C: " + feeds_found + ", S:" + feeds_stored);
 
                if (feeds_stored != feeds_found) {
-                       getMainContext().number_of_feeds = feeds_found;
+                       number_of_feeds = feeds_found;
 
                        if (feeds_stored != 0) {
                                debug("Subscribed feed number changed, refreshing feedlist");
@@ -612,7 +602,7 @@ function all_counters_callback() {
                        var runtime = counters.nextSibling;
 
                        if (runtime) {
-                               getMainContext().parse_runtime_info(runtime);
+                               parse_runtime_info(runtime);
                        }
 
                        if (getInitParam("feeds_sort_by_unread") == 1) {
@@ -675,7 +665,7 @@ function resort_category(doc, node) {
 function resort_feedlist() {
        debug("resort_feedlist");
 
-       var fd = getFeedsContext().document;
+       var fd = document;
 
        if (fd.getElementById("feedCatHolder")) {
 
@@ -754,7 +744,7 @@ function hideOrShowFeeds(doc, hide) {
 
        debug("hideOrShowFeeds: " + doc + ", " + hide);
 
-       var fd = getFeedsContext().document;
+       var fd = document;
 
        var list = fd.getElementById("feedList");
 
@@ -1259,7 +1249,7 @@ function qafAdd() {
 
        closeInfoBox();
 
-       var feeds_doc = getFeedsContext().document;
+       var feeds_doc = document;
 
 //     feeds_doc.location.href = "backend.php?op=error&msg=Loading,%20please wait...";
        
@@ -1299,7 +1289,6 @@ function getContentContext() {
        return this.window;
 }
 
-
 function getHeadlinesContext() {
        return this.window;
 }
@@ -1307,15 +1296,14 @@ function getHeadlinesContext() {
 var debug_last_class = "even";
 
 function debug(msg) {
-       var ctx = getMainContext();
 
-       if (ctx.debug_last_class == "even") {
-               ctx.debug_last_class = "odd";
+       if (debug_last_class == "even") {
+               debug_last_class = "odd";
        } else {
-               ctx.debug_last_class = "even";
+               debug_last_class = "even";
        }
 
-       var c = ctx.document.getElementById('debug_output');
+       var c = document.getElementById('debug_output');
        if (c && c.style.display == "block") {
                while (c.lastChild != 'undefined' && c.childNodes.length > 100) {
                        c.removeChild(c.lastChild);
@@ -1324,7 +1312,7 @@ function debug(msg) {
                var d = new Date();
                var ts = leading_zero(d.getHours()) + ":" + leading_zero(d.getMinutes()) +
                        ":" + leading_zero(d.getSeconds());
-               c.innerHTML = "<li class=\"" + ctx.debug_last_class + "\"><span class=\"debugTS\">[" + ts + "]</span> " + 
+               c.innerHTML = "<li class=\"" + debug_last_class + "\"><span class=\"debugTS\">[" + ts + "]</span> " + 
                        msg + "</li>" + c.innerHTML;
        }
 }
index e3aa51b05d62ff3130fd8adda9c66ba6bffa7388..9197fcc2ec16e57603c28be739d75ac3e679a601 100644 (file)
@@ -45,9 +45,6 @@ function view(id, feed_id) {
        try {
                debug("loading article: " + id + "/" + feed_id);
        
-               var f_document = getFeedsContext().document;
-               var m_document = document;
-       
                enableHotkeys();
        
                var crow = document.getElementById("RROW-" + id);
@@ -65,7 +62,7 @@ function view(id, feed_id) {
                active_post_id = id; 
                setActiveFeedId(feed_id);
        
-               var content = m_document.getElementById("content-frame");
+               var content = document.getElementById("content-frame");
        
                selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false);
                markHeadline(active_post_id);
@@ -88,8 +85,6 @@ function view(id, feed_id) {
 
 function toggleMark(id) {
 
-       var f_document = document;
-
        if (!xmlhttp_ready(xmlhttp_rpc)) {
                printLockingError();
                return;
@@ -98,7 +93,7 @@ function toggleMark(id) {
        var query = "backend.php?op=rpc&id=" + id + "&subop=mark";
 
        var mark_img = document.getElementById("FMARKPIC-" + id);
-       var vfeedu = f_document.getElementById("FEEDU--1");
+       var vfeedu = document.getElementById("FEEDU--1");
        var crow = document.getElementById("RROW-" + id);
 
        if (mark_img.alt != "Reset mark") {
@@ -121,8 +116,8 @@ function toggleMark(id) {
 
        }
 
-       var vfeedctr = f_document.getElementById("FEEDCTR--1");
-       var vfeedr = f_document.getElementById("FEEDR--1");
+       var vfeedctr = document.getElementById("FEEDCTR--1");
+       var vfeedr = document.getElementById("FEEDR--1");
 
        if (vfeedu && vfeedctr) {
                if ((+vfeedu.innerHTML) > 0) {
@@ -401,35 +396,10 @@ function labelFromSearch(search, search_mode, match_on, feed_id, is_cat) {
                debug("LFS: " + query);
        
                xmlhttp_rpc.open("GET", query, true);
-               xmlhttp_rpc.onreadystatechange=getMainContext().dlg_frefresh_callback;
+               xmlhttp_rpc.onreadystatechange=dlg_frefresh_callback;
                xmlhttp_rpc.send(null);
        }
 
 }
 
 
-/*
-function headlines_init() {
-       if (arguments.callee.done) return;
-       arguments.callee.done = true;           
-
-       if (parent.frames["feeds-frame"]) {
-               document.onkeydown = hotkey_handler;
-       }
-
-       var hl = document.getElementById("headlinesList");
-
-       if (!hl) {
-               hl = document.getElementById("headlinesContainer");
-       }
-
-       var hw = hl.scrollHeight;
-       var pw = parent.document.getElementById("headlines").scrollHeight;
-
-       if (hw >= pw) {
-               var bt = document.getElementById("headlineActionsBottom");
-               bt.className = "headlinesSubToolbar";
-       }
-
-}
-*/