]> git.wh0rd.org - tt-rss.git/commitdiff
MSIE5 compatibility workarounds
authorAndrew Dolgov <fox@bah.spb.su>
Thu, 25 Aug 2005 15:15:27 +0000 (16:15 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Thu, 25 Aug 2005 15:15:27 +0000 (16:15 +0100)
NEWS
backend.php
functions.js
prefs.js
tt-rss.js

diff --git a/NEWS b/NEWS
index 2bfa8e697b853b2c211f4754a231272a21f488ed..ddd243de672a3f50309a38e097c1bc774fa3bd46 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ v1.0 (Aug xx, 2005)
        - Background feed updates
        - Update detection based on content checksum (somewhat flaky)
        - Automatically cleanup posts older then specified number of days
+       - More or less compatible with MSIE (tested on 5.0)
 
        - Milestone 0.2 changed to 1.0
 
index cfdc4be9c451784bd3fbfae44b05cd4de1300b0d..cc9b6b492846eccf9614619c9f25bb59f1d2d57f 100644 (file)
                        }
                }
        
-               $result = pg_query("SELECT * FROM ttrss_feeds ORDER by title");
+               $result = pg_query("SELECT 
+                               id,title,feed_url,substring(last_updated,1,16) as last_updated
+                       FROM 
+                               ttrss_feeds ORDER by title");
 
                print "<p><table width=\"100%\" class=\"prefFeedList\" id=\"prefFeedList\">";
                print "<tr class=\"title\">
-                                       <td>Select</td><td>Title</td><td>Link</td><td>Last Updated</td></tr>";
+                                       <td>&nbsp;</td><td>Select</td><td>Title</td><td>Link</td><td>Last Updated</td></tr>";
                
                $lnum = 0;
                
                        
                        print "<tr class=\"$class\" id=\"FEEDR-$feed_id\">";
 
+                       $icon_file = ICONS_DIR . "/$feed_id.ico";
+
+                       if (file_exists($icon_file) && filesize($icon_file) > 0) {
+                                       $feed_icon = "<img width=\"16\" height=\"16\"
+                                               src=\"" . ICONS_URL . "/$feed_id.ico\">";
+                       } else {
+                               $feed_icon = "&nbsp;";
+                       }
+                       print "<td align='center'>$feed_icon</td>";             
+
                        print "<td><input onclick='toggleSelectRow(this);' 
                                type=\"checkbox\" id=\"FRCHK-".$line["id"]."\"></td>";
+               
                        print "<td><a href=\"javascript:editFeed($feed_id);\">" . 
                                $line["title"] . "</td>";               
                        print "<td><a href=\"javascript:editFeed($feed_id);\">" . 
index f33b3970d356307bc325a603b61022f75a69eb4e..d7f0ec75059c0f8af199750704b11aa4e305896e 100644 (file)
@@ -8,6 +8,11 @@ function enableHotkeys() {
        hotkeys_enabled = true;
 }
 
+function xmlhttp_ready(obj) {
+       return obj.readyState == 4 || obj.readyState == 0 || !obj.readyState;
+}
+
+
 function notify_callback() {
        var container = document.getElementById('notify');
        if (xmlhttp.readyState == 4) {
index a9701dd32818f0ba30fbcab0cfefa5bfb80406b8..3296ee665da8266df5979ea93a08478336a2e4fc 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -42,7 +42,7 @@ function notify_callback() {
 
 function updateFeedList() {
 
-       if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
+       if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
                return
        }
@@ -71,7 +71,7 @@ function toggleSelectRow(sender) {
 
 function addFeed() {
 
-       if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
+       if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
                return
        }
@@ -98,7 +98,7 @@ function editFeed(feed) {
 
 //     notify("Editing feed...");
 
-       if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
+       if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
                return
        }
@@ -128,7 +128,7 @@ function getSelectedFeeds() {
 
 function readSelectedFeeds() {
 
-       if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
+       if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
                return
        }
@@ -153,7 +153,7 @@ function readSelectedFeeds() {
 
 function unreadSelectedFeeds() {
 
-       if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
+       if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
                return
        }
@@ -178,7 +178,7 @@ function unreadSelectedFeeds() {
 
 function removeSelectedFeeds() {
 
-       if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
+       if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
                return
        }
@@ -204,7 +204,7 @@ function removeSelectedFeeds() {
 
 function feedEditCancel() {
 
-       if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
+       if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
                return
        }
@@ -219,7 +219,7 @@ function feedEditCancel() {
 
 function feedEditSave(feed) {
 
-       if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
+       if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
                return
        }
index 99c539c2508f362ec797b1bd06545d0c3a274383..cfc6b0d94b231e28de8f02c8f9a047f46b6e736e 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -51,19 +51,13 @@ function feedlist_callback() {
        if (xmlhttp.readyState == 4) {
                container.innerHTML=xmlhttp.responseText;
 
-//             var feedtu = document.getElementById("FEEDTU");
-//             if (feedtu) {
-//                     total_unread = feedtu.innerHTML;
-//                     update_title();
-//             }
-
                if (first_run) {
                        scheduleFeedUpdate(false);
                        first_run = false;
                } else {
                        notify("");
-               }
-       }
+               } 
+       } 
 }
 
 function viewfeed_callback() {
@@ -122,17 +116,13 @@ function view_callback() {
 }
 
 function refetch_callback() {
+
        if (xmlhttp_rpc.readyState == 4) {
                notify("All feeds updated");
-               
                var container = document.getElementById('feeds');
-
                container.innerHTML = xmlhttp_rpc.responseText;
-
                document.title = "Tiny Tiny RSS";
-
-               //updateFeedList(true, false);
-       }
+       } 
 }
 
 function scheduleFeedUpdate(force) {
@@ -149,17 +139,17 @@ function scheduleFeedUpdate(force) {
                query_str = query_str + "updateAllFeeds";
        }
 
-       if (xmlhttp_rpc.readyState == 4 || xmlhttp_rpc.readyState == 0) {
+       if (xmlhttp_ready(xmlhttp_rpc)) {
                xmlhttp_rpc.open("GET", query_str, true);
                xmlhttp_rpc.onreadystatechange=refetch_callback;
                xmlhttp_rpc.send(null);
        } else {
                printLockingError();
-       }
+       }   
 }
 
 function updateFeedList(silent, fetch) {
-       
+
        if (silent != true) {
                notify("Loading feed list...");
        }
@@ -168,7 +158,7 @@ function updateFeedList(silent, fetch) {
 
        if (fetch) query_str = query_str + "&fetch=yes";
 
-       if (xmlhttp.readyState == 4 || xmlhttp.readyState == 0) {
+       if (xmlhttp_ready(xmlhttp)) {
                xmlhttp.open("GET", query_str, true);
                xmlhttp.onreadystatechange=feedlist_callback;
                xmlhttp.send(null);
@@ -179,7 +169,7 @@ function updateFeedList(silent, fetch) {
 
 function catchupPage(feed) {
 
-       if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
+       if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
                return
        }
@@ -228,7 +218,7 @@ function catchupPage(feed) {
 
 function catchupAllFeeds() {
 
-       if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
+       if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
                return
        }
@@ -263,7 +253,7 @@ function viewfeed(feed, skip, subop) {
                return;
        }
 
-       if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
+       if (!xmlhttp_ready(xmlhttp)) {
                printLockingError();
                return
        }
@@ -302,7 +292,7 @@ function view(id,feed_id) {
 
        enableHotkeys();
 
-       if (xmlhttp_view.readyState != 4 && xmlhttp_view.readyState != 0) {
+       if (!xmlhttp_ready(xmlhttp_view)) {
                printLockingError();
                return
        }
@@ -320,8 +310,6 @@ function view(id,feed_id) {
                }
 
                total_unread--;
-
-               update_title(); 
        }       
 
        cleanSelectedHeadlines();
@@ -342,14 +330,12 @@ function view(id,feed_id) {
        xmlhttp_view.onreadystatechange=view_callback;
        xmlhttp_view.send(null);
 
+
 }
 
 function timeout() {
-
        scheduleFeedUpdate(true);
-
        setTimeout("timeout()", 1800*1000);
-
 }
 
 function resetSearch() {
@@ -358,35 +344,14 @@ function resetSearch() {
 }
 
 function search(feed) {
-
-//     if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0) {
-//             printLockingError();
-//             return
-//     }
-
-//     notify("Search: " + feed + ", " + sender.value)
-
-/*     document.getElementById('headlines').innerHTML='Loading headlines, please wait...';             
-       document.getElementById('content').innerHTML='&nbsp;';          
-
-       xmlhttp.open("GET", "backend.php?op=viewfeed&feed=" + param_escape(feed) +
-               "&search=" + param_escape(sender.value) + "&subop=search", true);
-       xmlhttp.onreadystatechange=viewfeed_callback;
-       xmlhttp.send(null); */
-
        viewfeed(feed, 0, "");
-
-}
-
-function update_title() {
-       //document.title = "Tiny Tiny RSS (" + total_unread + " unread)";
 }
 
 function localPiggieFunction(enable) {
        if (enable) {
                var query_str = "backend.php?op=feeds&subop=piggie";
 
-               if (xmlhttp.readyState == 4 || xmlhttp.readyState == 0) {
+               if (xmlhttp_ready(xmlhttp)) {
 
                        xmlhttp.open("GET", query_str, true);
                        xmlhttp.onreadystatechange=feedlist_callback;
@@ -493,7 +458,15 @@ function localHotkeyHandler(keycode) {
 
 
 function init() {
-       if (!xmlhttp) {
+
+       // IE kludge
+
+       if (xmlhttp && !xmlhttp_rpc) {
+               xmlhttp_rpc = xmlhttp;
+               xmlhttp_view = xmlhttp;
+       }
+
+       if (!xmlhttp || !xmlhttp_rpc || !xmlhttp_view) {
                document.getElementById("headlines").innerHTML = 
                        "<b>Fatal error:</b> This program needs XmlHttpRequest " + 
                        "to function properly. Your browser doesn't seem to support it.";