diff options
author | Andrew Dolgov <[email protected]> | 2006-09-28 13:00:03 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2006-09-28 13:00:03 +0100 |
commit | 6b4163cb464534e827b4282f84541d86c8e19ec5 (patch) | |
tree | ebd893ba5c618d5a4ee6c20bc27e5d604d900122 | |
parent | 1f64b1be201ee9b23ea52e4021bc5264697dc5b5 (diff) |
css-based layout + required fixes
-rw-r--r-- | backend.php | 110 | ||||
-rw-r--r-- | feedlist.js | 60 | ||||
-rw-r--r-- | functions.js | 32 | ||||
-rw-r--r-- | tt-rss.css | 143 | ||||
-rw-r--r-- | tt-rss.js | 23 | ||||
-rw-r--r-- | tt-rss.php | 163 | ||||
-rw-r--r-- | version.php | 2 | ||||
-rw-r--r-- | viewfeed.js | 44 |
8 files changed, 305 insertions, 272 deletions
diff --git a/backend.php b/backend.php index 719cb1b16..cfe322b72 100644 --- a/backend.php +++ b/backend.php @@ -124,7 +124,7 @@ function outputFeedList($link, $tags = false) { - print "<html><head> +/* print "<html><head> <title>Tiny Tiny RSS : Feedlist</title> <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">"; @@ -159,7 +159,7 @@ document.addEventListener(\"DOMContentLoaded\", init, null); } window.onload = init; - </script>"; + </script>"; */ print "<ul class=\"feedList\" id=\"feedList\">\n"; @@ -440,21 +440,21 @@ print "</ul>"; - print ' - <script type="text/javascript"> - /* for IE */ - function statechange() { - if (document.readyState == "interactive") init(); - } - - if (document.readyState) { - if (document.readyState == "interactive" || document.readyState == "complete") { - init(); - } else { - document.onreadystatechange = statechange; - } - } - </script></body></html>'; +# print ' +# <script type="text/javascript"> +# /* for IE */ +# function statechange() { +# if (document.readyState == "interactive") init(); +# } +# +# if (document.readyState) { +# if (document.readyState == "interactive" || document.readyState == "complete") { +# init(); +# } else { +# document.onreadystatechange = statechange; +# } +# } +# </script></body></html>'; } @@ -520,7 +520,7 @@ FROM ttrss_entries,ttrss_user_entries WHERE id = '$id' AND ref_id = id AND owner_uid = " . $_SESSION["uid"]); - print "<html><head> +/* print "<html><head> <title>Tiny Tiny RSS : Article $id</title> <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">"; @@ -544,7 +544,7 @@ <script type=\"text/javascript\" src=\"prototype.js\"></script> <script type=\"text/javascript\" src=\"functions.js?$script_dt_add\"></script> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> - </head><body $rtl_tag>"; + </head><body $rtl_tag>"; */ if ($result) { @@ -669,7 +669,7 @@ </script>"; } - print "</body></html>"; +// print "</body></html>"; } if ($op == "viewfeed") { @@ -683,7 +683,7 @@ if ($subop == "undefined") $subop = ""; - print "<html><head> +/* print "<html><head> <title>Tiny Tiny RSS : Feed $feed</title> <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">"; @@ -700,7 +700,7 @@ } else { print "<link title=\"Compact Stylesheet\" rel=\"alternate stylesheet\" type=\"text/css\" href=\"tt-rss_compact.css\"/>"; - } + } */ if ($subop == "CatchupSelected") { $ids = split(",", db_escape_string($_GET["ids"])); @@ -757,7 +757,7 @@ $script_dt_add = get_script_dt_add(); - print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> +/* print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> <script type=\"text/javascript\" src=\"prototype.js\"></script> <script type=\"text/javascript\" src=\"functions.js?$script_dt_add\"></script> <script type=\"text/javascript\" src=\"viewfeed.js?$script_dt_add\"></script> @@ -771,7 +771,7 @@ document.addEventListener(\"DOMContentLoaded\", init, null); } window.onload = init; - </script>"; + </script>"; */ /// START ///////////////////////////////////////////////////////////////////////////////// @@ -1053,37 +1053,37 @@ print "</div>"; - print " - <script type=\"text/javascript\"> - try { - document.onkeydown = hotkey_handler; - try { - parent.update_all_counters(\"$feed\"); - } catch (e) { - // this is workaround against mysterious permission - // denied feature/bug of firefox (ticket #73) - // if call from this context failed - ignore silently - exception_error(\"viewfeed/footer1/counters\", e, true); - } - } catch (e) { - exception_error(\"viewfeed/footer1\", e); - } - - /* for IE */ - function statechange() { - if (document.readyState == \"interactive\") init(); - } - - if (document.readyState) { - if (document.readyState == \"interactive\" || document.readyState == \"complete\") { - init(); - } else { - document.onreadystatechange = statechange; - } - } - </script>"; - - print "</body></html>"; +# print " +# <script type=\"text/javascript\"> +# try { +# document.onkeydown = hotkey_handler; +# try { +# parent.update_all_counters(\"$feed\"); +# } catch (e) { +# // this is workaround against mysterious permission +# // denied feature/bug of firefox (ticket #73) +# // if call from this context failed - ignore silently +# exception_error(\"viewfeed/footer1/counters\", e, true); +# } +# } catch (e) { +# exception_error(\"viewfeed/footer1\", e); +# } +# +# /* for IE */ +# function statechange() { +# if (document.readyState == \"interactive\") init(); +# } +# +# if (document.readyState) { +# if (document.readyState == \"interactive\" || document.readyState == \"complete\") { +# init(); +# } else { +# document.onreadystatechange = statechange; +# } +# } +# </script>"; +# +# print "</body></html>"; } if ($op == "pref-feeds") { diff --git a/feedlist.js b/feedlist.js index b3c2b833a..df1e17fb6 100644 --- a/feedlist.js +++ b/feedlist.js @@ -5,31 +5,30 @@ function viewCategory(cat) { viewfeed(cat, '', true); } +function feedlist_callback() { + if (xmlhttp.readyState == 4) { + var f = document.getElementById("feeds-frame"); + f.innerHTML = xmlhttp.responseText; + } +} + function viewfeed(feed, subop, is_cat, subop_param) { try { - + enableHotkeys(); var toolbar_query = parent.Form.serialize("main_toolbar_form"); - var toolbar_form = parent.document.forms["main_toolbar_form"]; + var toolbar_form = document.forms["main_toolbar_form"]; - if (parent.document.forms["main_toolbar_form"].query) { + if (document.forms["main_toolbar_form"].query) { toolbar_form.query.value = ""; } -// setCookie("ttrss_vf_limit", toolbar_form.limit[toolbar_form.limit.selectedIndex].value); -// setCookie("ttrss_vf_vmode", toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value); - - storeInitParam("toolbar_limit", +/* storeInitParam("toolbar_limit", toolbar_form.limit[toolbar_form.limit.selectedIndex].value); storeInitParam("toolbar_view_mode", - toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value); - -/* var sp = new Object(); - sp["toolbar_limit"] = toolbar_form.limit[toolbar_form.limit.selectedIndex].value; - sp["toolbar_view_mode"] = toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value; - storeInitParams(sp); */ + toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value); */ var query = "backend.php?op=viewfeed&feed=" + feed + "&" + toolbar_query + "&subop=" + param_escape(subop); @@ -56,18 +55,6 @@ function viewfeed(feed, subop, is_cat, subop_param) { if (subop == "MarkAllRead") { -/* var feedr = document.getElementById("FEEDR-" + feed); - var feedctr = document.getElementById("FEEDCTR-" + feed); - - if (feedr && feedctr) { - - feedctr.className = "invisible"; - - if (feedr.className.match("Unread")) { - feedr.className = feedr.className.replace("Unread", ""); - } - } */ - var feedlist = document.getElementById('feedList'); var next_unread_feed = getRelativeFeedId(feedlist, @@ -93,12 +80,6 @@ function viewfeed(feed, subop, is_cat, subop_param) { query = query + "&ts=" + timestamp } - debug(query); - - headlines_frame.location.href = query; - -// cleanSelectedList("feedList"); - if (!activeFeedIsCat()) { var feedr = document.getElementById("FEEDR-" + getActiveFeedId()); if (feedr && !feedr.className.match("Selected")) { @@ -106,8 +87,19 @@ function viewfeed(feed, subop, is_cat, subop_param) { } } - parent.disableContainerChildren("headlinesToolbar", false); - parent.Form.enable("main_toolbar_form"); + disableContainerChildren("headlinesToolbar", false); + Form.enable("main_toolbar_form"); + + debug(query); + + if (xmlhttp_ready(xmlhttp)) { + xmlhttp.open("GET", query, true); + xmlhttp.onreadystatechange=headlines_callback; + xmlhttp.send(null); + } else { + debug("xmlhttp busy (@feeds)"); + } + } catch (e) { exception_error("viewfeed", e); @@ -147,7 +139,7 @@ function toggleCollapseCat(cat) { } } -function init() { +function feedlist_init() { try { if (arguments.callee.done) return; arguments.callee.done = true; diff --git a/functions.js b/functions.js index 6fbabb69d..ccf2bab16 100644 --- a/functions.js +++ b/functions.js @@ -162,6 +162,8 @@ function hotkey_handler(e) { var keycode; if (!hotkeys_enabled) return; + + return; //fixme disables for now if (window.event) { keycode = window.event.keyCode; @@ -468,8 +470,8 @@ function setActiveFeedId(id) { function parse_counters(reply, scheduled_call) { try { - var f_document = getFeedsContext().document; - var title_obj = getMainContext(); + var f_document = document; + var title_obj = this.window; var feeds_found = 0; @@ -602,7 +604,7 @@ function all_counters_callback() { return; } - debug("in all_counters_callback"); + debug("in all_counters_callback : " + xmlhttp_rpc.responseXML); var reply = xmlhttp_rpc.responseXML.firstChild; @@ -1287,36 +1289,20 @@ function filterCR(e) } function getMainContext() { - if (parent.window != window) { - return parent.window; - } else { - return this.window; - } + return this.window; } function getFeedsContext() { - try { - return getMainContext().frames["feeds-frame"]; - } catch (e) { - exception_error("getFeedsContext", e); - } + return this.window; } function getContentContext() { - try { - return getMainContext().frames["content-frame"]; - } catch (e) { - exception_error("getContentContext", e); - } + return this.window; } function getHeadlinesContext() { - try { - return getMainContext().frames["headlines-frame"]; - } catch (e) { - exception_error("getHeadlinesContext", e); - } + return this.window; } var debug_last_class = "even"; diff --git a/tt-rss.css b/tt-rss.css index 337797e73..29f855a0d 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -176,44 +176,44 @@ ul.feedList li { margin : 0px; } -ul.feedlist li.feedUnread, -ul.feedlist li.errorUnread, -ul.feedlist li.labelUnread, -ul.feedlist li.virtUnread, -ul.feedlist li.tagUnread { +li.feedUnread, +li.errorUnread, +li.labelUnread, +li.virtUnread, +li.tagUnread { font-weight : bold; } -ul.feedlist li.errorSelected a, -ul.feedlist li.error a, -ul.feedlist li.errorUnread a, -ul.feedlist li.errorUnreadSelected a { +li.errorSelected a, +li.error a, +li.errorUnread a, +li.errorUnreadSelected a { color : #f04040; } -ul.feedlist li.feedSelected a, -ul.feedlist li.labelSelected a, -ul.feedlist li.virtSelected a, -ul.feedlist li.tagSelected a { +li.feedSelected a, +li.labelSelected a, +li.virtSelected a, +li.tagSelected a { color : #4684ff; } -ul.feedlist li.feedUnreadSelected a, -ul.feedlist li.labelUnreadSelected a, -ul.feedlist li.virtUnreadSelected a, -ul.feedlist li.tagUnreadSelected a { +li.feedUnreadSelected a, +li.labelUnreadSelected a, +li.virtUnreadSelected a, +li.tagUnreadSelected a { color : #4684ff; } -ul.feedlist li.feedUnreadSelected, -ul.feedlist li.errorUnreadSelected, -ul.feedlist li.labelUnreadSelected, -ul.feedlist li.virtUnreadSelected, -ul.feedlist li.tagUnreadSelected { +li.feedUnreadSelected, +li.errorUnreadSelected, +li.labelUnreadSelected, +li.virtUnreadSelected, +li.tagUnreadSelected { font-weight : bold; } -ul.feedList li.feed { +li.feed { display : block; } @@ -1060,14 +1060,14 @@ a.cdmToggleLink:hover { } #debug_output { - width : 400; - height : 200; - right : 20; - bottom : 20; + position : absolute; + width : 400px; + height : 200px; + right : 20px; + bottom : 20px; + z-index : 999; background-color : white; display : none; - z-index : 999; - position : absolute; border : 1px solid #c0c0c0; overflow : auto; margin : 0px; @@ -1223,3 +1223,88 @@ table.loginForm2 .innerLoginCell { #milestoneDetails { display : none; } + +/* layout */ + +#header { + position : absolute; + white-space: nowrap; + top : 10px; + left : 15px; + right : 5px; + height : 40px; + color : #4684ff; + font-size : x-small; +} + +#feeds-holder { + border-width : 1px 1px 1px 0px; + border-style : solid; + border-color : #88b0f0; + top : 50px; + left : 0px; + position : absolute; + width : 260px; + overflow : auto; + bottom : 50px; +} + +#toolbar { + position : absolute; + left : 261px; + padding : 5px 10px 5px 5px; + top : 50px; + right : 0px; + white-space: nowrap; + height : 30px; + background-image : url("images/toolbar.png"); + background-position : bottom left; + background-repeat : repeat-x; + font-size : small; +} + +#headlines-frame { + position : absolute; + border-width : 1px 0px 0px 0px; + border-style : solid; + border-color : #88b0f0; + left : 260px; + height : 300px; + top : 85px; + right : 0px; + overflow : auto; + font-size : small; +} + +#content-frame { + position : absolute; + border-width : 1px 0px 1px 0px; + border-style : solid; + border-color : #88b0f0; + overflow : auto; + top : 390px; + left : 260px; + bottom : 50px; + right : 0px; +} + +#footer { + position : absolute; + bottom : 0px; + height : 30px; + text-align : center; + color : gray; + font-size : x-small; + background-image : url("images/footer.png"); + background-position : top left; + background-repeat : repeat-x; + background-color : white; + right : 0px; + left : 0px; + padding : 10px; +} + +#headlinesContainer { + margin-left : 1px; + background-color : white; +} @@ -222,9 +222,20 @@ function updateFeedList(silent, fetch) { if (fetch) query_str = query_str + "&fetch=yes"; - var feeds_frame = document.getElementById("feeds-frame"); +// var feeds_frame = document.getElementById("feeds-frame"); +// feeds_frame.src = query_str; + + debug("updateFeedList"); + + if (xmlhttp_ready(xmlhttp)) { + xmlhttp.open("GET", query_str, true); + xmlhttp.onreadystatechange=feedlist_callback; + xmlhttp.send(null); + } else { + debug("xmlhttp busy"); + //printLockingError(); + } - feeds_frame.src = query_str; } function catchupAllFeeds() { @@ -382,9 +393,11 @@ function resize_feeds_frame() { if (th) { header_height = th.scrollHeight; } - - f.style.height = document.body.scrollHeight - footer_height - - header_height - 50 + "px"; + + if (f) { + f.style.height = document.body.scrollHeight - footer_height - + header_height - 50 + "px"; + } } function init_second_stage() { diff --git a/tt-rss.php b/tt-rss.php index 1315e3aa1..a3a7f465c 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -17,6 +17,8 @@ $dt_add = get_script_dt_add(); ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Tiny Tiny RSS</title> @@ -52,6 +54,9 @@ <script type="text/javascript" src="tt-rss.js?<?php echo $dt_add ?>"></script> <script type="text/javascript" src="functions.js?<?php echo $dt_add ?>"></script> + <script type="text/javascript" src="feedlist.js?<?php echo $dt_add ?>"></script> + <script type="text/javascript" src="viewfeed.js?<?php echo $dt_add ?>"></script> + <!--[if gte IE 5.5000]> <script type="text/javascript" src="pngfix.js"></script> <link rel="stylesheet" type="text/css" href="tt-rss-ie.css"> @@ -70,7 +75,8 @@ <body> -<div id="overlay"><div id="overlay_inner">Loading, please wait...</div></div> +<!-- <div id="overlay"><div id="overlay_inner">Loading, please wait...</div></div> --> + <div id="fatal_error"><div id="fatal_error_inner"> <h1>Fatal Error</h1> <div id="fatal_error_msg">Unknown Error</div> @@ -89,69 +95,51 @@ window.onload = init; start the daemon process or contact instance owner. </div> -<iframe id="backReqBox"></iframe> - <ul id="debug_output"></ul> <div id="infoBoxShadow"><div id="infoBox"> </div></div> -<table width="100%" height="100%" cellspacing="0" cellpadding="0" class="main"> -<?php if (get_pref($link, 'DISPLAY_HEADER')) { ?> -<tr> - <td colspan="2" class="headerBox" id="mainHeader"> - <table cellspacing="0" cellpadding="0" width="100%"><tr> - <td rowspan="2" class="header" valign="middle"> - <img src="<?php echo $theme_image_path ?>images/ttrss_logo.png" alt="Tiny Tiny RSS"> - </td> - <td valign="top" class="notifyBox"> - <div id="notify" class="notify"><span id="notify_body"> </span></div> - </td> - </tr><tr><td class="welcomePrompt"> - <?php if (!SINGLE_USER_MODE) { ?> - Hello, <b><?php echo $_SESSION["name"] ?></b> - (<a href="logout.php">Logout</a>) - <?php } ?> - </td> - </tr></table> - </td> -</tr> -<?php } else { ?> -<tr> - <td class="small" id="mainHeader"> - <div id="notify" class="notify_sm"><span id="notify_body"> </span></div> - <div id="userDlgShadow"><div id="userDlg"> </div></div> - </td><td class="welcomePrompt"> - <?php if (!SINGLE_USER_MODE) { ?> +<div id="header"> + <?php if (!SINGLE_USER_MODE) { ?> + <div style="float : right"> Hello, <b><?php echo $_SESSION["name"] ?></b> (<a href="logout.php">Logout</a>) - <?php } ?> -</td></tr> -<?php } ?> -<tr> - <?php if (get_pref($link, 'COMBINED_DISPLAY_MODE')) - $feeds_rowspan = 2; - else - $feeds_rowspan = 3; ?> - <td valign="top" rowspan="<?php echo $feeds_rowspan ?>" class="feeds"> - <table class="innerFeedTable" - cellspacing="0" cellpadding="0" height="100%" width="100%"> - <tr><td> - <div id="dispSwitch"> - <a id="dispSwitchPrompt" href="javascript:toggleTags()">display tags</a> </div> - </td></tr> - <tr><td height="100%" width="100%" valign="top"> - - <iframe frameborder="0" - id="feeds-frame" name="feeds-frame" class="feedsFrame"></iframe> + <?php } ?> + <img src="<?php echo $theme_image_path ?>images/ttrss_logo.png" alt="Tiny Tiny RSS"> +</div> - </td></tr></table> +<div id="feeds-holder"> + <div id="dispSwitch"> + <a id="dispSwitchPrompt" href="javascript:toggleTags()">display tags</a> + </div> + <div id="feeds-frame">-fixme-</div> +</div> - </td> - <td valign="top" class="headlinesToolbarBox"> - <table width="100%" cellpadding="0" cellspacing="0"> +<div id="toolbar"> - <tr><td class="headlinesToolbar" id="headlinesToolbar"> + <div style="float : right"> + <select id="quickMenuChooser" onchange="quickMenuChange()"> + <option value="qmcDefault" selected>Actions...</option> + <option value="qmcPrefs">Preferences</option> + <option value="qmcSearch">Search</option> + <option disabled>--------</option> + <option style="color : #5050aa" disabled>Feed actions:</option> + <option value="qmcAddFeed"> Subscribe to feed</option> + <option value="qmcRemoveFeed"> Unsubscribe</option> + <!-- <option>Edit this feed</option> --> + <option disabled>--------</option> + <option style="color : #5050aa" disabled>All feeds:</option> + <?php if (!ENABLE_UPDATE_DAEMON && !DAEMON_REFRESH_ONLY) { ?> + <option value="qmcUpdateFeeds"> Update</option> + <?php } ?> + <option value="qmcCatchupAll"> Mark as read</option> + <option value="qmcShowOnlyUnread"> Show only unread</option> + <option disabled>--------</option> + <option style="color : #5050aa" disabled>Other actions:</option> + <option value="qmcAddFilter"> Create filter</option> + </select> + </div> <form id="main_toolbar_form"> @@ -203,64 +191,15 @@ window.onload = init; <input class="button" type="submit" onclick="catchupCurrentFeed()" value="Mark as read"> - </td> - <td align="right"> - <select id="quickMenuChooser" onchange="quickMenuChange()"> - <option value="qmcDefault" selected>Actions...</option> - <option value="qmcPrefs">Preferences</option> - <option value="qmcSearch">Search</option> - <option disabled>--------</option> - <option style="color : #5050aa" disabled>Feed actions:</option> - <option value="qmcAddFeed"> Subscribe to feed</option> - <option value="qmcRemoveFeed"> Unsubscribe</option> - <!-- <option>Edit this feed</option> --> - <option disabled>--------</option> - <option style="color : #5050aa" disabled>All feeds:</option> - <?php if (!ENABLE_UPDATE_DAEMON && !DAEMON_REFRESH_ONLY) { ?> - <option value="qmcUpdateFeeds"> Update</option> - <?php } ?> - <option value="qmcCatchupAll"> Mark as read</option> - <option value="qmcShowOnlyUnread"> Show only unread</option> - <option disabled>--------</option> - <option style="color : #5050aa" disabled>Other actions:</option> - <option value="qmcAddFilter"> Create filter</option> - </select> - </td> - </tr> - </table> - </td> -</tr> -<?php if (get_pref($link, 'COMBINED_DISPLAY_MODE')) { ?> -<tr> - <td id="headlines" class="headlines2" valign="top"> - <iframe frameborder="0" name="headlines-frame" - id="headlines-frame" class="headlinesFrame"></iframe> - </td> -</tr> -<?php } else { ?> -<tr> - <td id="headlines" class="headlines" valign="top"> - <iframe frameborder="0" name="headlines-frame" - id="headlines-frame" class="headlinesFrame"></iframe> - </td> -</tr><tr> - <td class="content" id="content" valign="top"> - <iframe frameborder="0" name="content-frame" - id="content-frame" class="contentFrame"> </iframe> - </td> -</tr> -<?php } ?> -<?php if (get_pref($link, 'DISPLAY_FOOTER')) { ?> -<tr> - <td colspan="2" class="footer" id="mainFooter"> - <a href="http://tt-rss.spb.ru/">Tiny Tiny RSS</a> v<?php echo VERSION ?> © 2005-2006 Andrew Dolgov - <?php if (WEB_DEMO_MODE) { ?> - <br>Running in demo mode, some functionality is disabled. - <?php } ?> - </td> -</td> -<?php } ?> -</table> + </div> + +<div id="headlines-frame"> -fixme- </div> + +<div id="content-frame"> -fixme- </div> + +<div id="footer"> + <a href="http://tt-rss.spb.ru/">Tiny Tiny RSS</a> v<?php echo VERSION ?> © 2005-2006 Andrew Dolgov +</div> <?php db_close($link); ?> diff --git a/version.php b/version.php index efa3485f0..275ce79d9 100644 --- a/version.php +++ b/version.php @@ -1,3 +1,3 @@ <?php - define('VERSION', "1.2.3-p1"); + define('VERSION', "1.2.3.99"); ?> diff --git a/viewfeed.js b/viewfeed.js index 58bc7abd4..ee8d0216e 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -2,13 +2,30 @@ var active_post_id = false; var xmlhttp_rpc = Ajax.getTransport(); +function headlines_callback() { + if (xmlhttp.readyState == 4) { + debug("headlines_callback"); + var f = document.getElementById("headlines-frame"); + f.innerHTML = xmlhttp.responseText; + } +} + +function article_callback() { + if (xmlhttp.readyState == 4) { + debug("article_callback"); + var f = document.getElementById("content-frame"); + f.innerHTML = xmlhttp.responseText; + update_all_counters(); + } +} + function view(id, feed_id) { try { debug("loading article: " + id + "/" + feed_id); var f_document = getFeedsContext().document; - var m_document = parent.document; + var m_document = document; enableHotkeys(); @@ -29,12 +46,20 @@ function view(id, feed_id) { var content = m_document.getElementById("content-frame"); - content.src = "backend.php?op=view&id=" + param_escape(id) + - "&feed=" + param_escape(feed_id); - selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false); markHeadline(active_post_id); + var query = "backend.php?op=view&id=" + param_escape(id) + + "&feed=" + param_escape(feed_id); + + if (xmlhttp_ready(xmlhttp)) { + xmlhttp.open("GET", query, true); + xmlhttp.onreadystatechange=article_callback; + xmlhttp.send(null); + } else { + debug("xmlhttp busy (@view)"); + } + } catch (e) { exception_error("view", e); } @@ -42,7 +67,7 @@ function view(id, feed_id) { function toggleMark(id) { - var f_document = parent.frames["feeds-frame"].document; + var f_document = document; if (!xmlhttp_ready(xmlhttp_rpc)) { printLockingError(); @@ -58,7 +83,6 @@ function toggleMark(id) { if (mark_img.alt != "Reset mark") { mark_img.src = "images/mark_set.png"; mark_img.alt = "Reset mark"; - mark_img.setAttribute('onclick', 'javascript:toggleMark('+id+')'); query = query + "&mark=1"; if (vfeedu && crow.className.match("Unread")) { @@ -68,7 +92,6 @@ function toggleMark(id) { } else { mark_img.src = "images/mark_unset.png"; mark_img.alt = "Set mark"; - mark_img.setAttribute('onclick', 'javascript:toggleMark('+id+')'); query = query + "&mark=0"; if (vfeedu && crow.className.match("Unread")) { @@ -134,11 +157,6 @@ function moveToPost(mode) { } } -function viewfeed(id) { - var f = parent.frames["feeds-frame"]; - f.viewfeed(id, 0); -} - function toggleUnread(id, cmode) { try { if (!xmlhttp_ready(xmlhttp_rpc)) { @@ -368,7 +386,7 @@ function labelFromSearch(search, search_mode, match_on, feed_id, is_cat) { -function init() { +function headlines_init() { if (arguments.callee.done) return; arguments.callee.done = true; |