diff options
-rw-r--r-- | cdm.css | 22 | ||||
-rw-r--r-- | classes/api.php | 4 | ||||
-rw-r--r-- | classes/feeds.php | 5 | ||||
-rw-r--r-- | classes/rpc.php | 27 | ||||
-rw-r--r-- | include/functions.php | 26 | ||||
-rw-r--r-- | index.php | 2 | ||||
-rw-r--r-- | js/tt-rss.js | 2 | ||||
-rw-r--r-- | js/viewfeed.js | 48 | ||||
-rw-r--r-- | plugins/af_pennyarcade/init.php | 54 | ||||
-rw-r--r-- | tt-rss.css | 2 |
10 files changed, 168 insertions, 24 deletions
@@ -121,7 +121,7 @@ div.cdmHeader span.hlFeed { } div.cdm.expanded .cdmHeader { - background : #EEF6FD; + background : #EEEEEE; } div.cdm.expanded.Unread div.cdmHeader { @@ -174,3 +174,23 @@ div.cdm.expanded div.cdmHeader a.title, div.cdm.active div.cdmHeader a.title { font-size : 13px; } +div#small_article_preview { + width : 300px; + max-height : 350px; + overflow : hidden; + border : 1px solid #c0c0c0; + background : white; + position : absolute; + box-shadow : 2px 2px 4px #c0c0c0; + z-index : 2; +} + +div#small_article_preview div.content { + padding : 5px; + font-size : 12px; + color : gray; +} + +div#small_article_preview div.content img { + max-width : 290px; +} diff --git a/classes/api.php b/classes/api.php index 44130d397..ba0eebb36 100644 --- a/classes/api.php +++ b/classes/api.php @@ -351,7 +351,9 @@ class API extends Handler { } function updateFeed() { - $feed_id = db_escape_string($this->link, $_REQUEST["feed_id"]); + require_once "include/rssfuncs.php"; + + $feed_id = (int) db_escape_string($this->link, $_REQUEST["feed_id"]); update_rss_feed($this->link, $feed_id, true); diff --git a/classes/feeds.php b/classes/feeds.php index 3657a0564..89ebd4a0a 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -413,7 +413,7 @@ class Feeds extends Handler_Protected { } } - $mouseover_attrs = "onmouseover='postMouseIn($id)' + $mouseover_attrs = "onmouseover='postMouseIn(event, $id)' onmouseout='postMouseOut($id)'"; $reply['content'] .= "<div class='$class' id='RROW-$id' $label_row_style $mouseover_attrs>"; @@ -512,7 +512,7 @@ class Feeds extends Handler_Protected { } } - $mouseover_attrs = "onmouseover='postMouseIn($id)' + $mouseover_attrs = "onmouseover='postMouseIn(event, $id)' onmouseout='postMouseOut($id)'"; $expanded_class = $expand_cdm ? "expanded" : ""; @@ -537,7 +537,6 @@ class Feeds extends Handler_Protected { onclick=\"return cdmClicked(event, $id);\" class=\"titleWrap$hlc_suffix\"> <a class=\"title\" - title=\"".htmlspecialchars($line['title'])."\" target=\"_blank\" href=\"". htmlspecialchars($line["link"])."\">". $line["title"] . diff --git a/classes/rpc.php b/classes/rpc.php index ea139935e..eb241591b 100644 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -843,5 +843,32 @@ class RPC extends Handler_Protected { } } + function cdmArticlePreview() { + $id = db_escape_string($this->link, $_REQUEST['id']); + + $result = db_query($this->link, "SELECT link, + ttrss_entries.title, content, feed_url + FROM + ttrss_entries, ttrss_user_entries + LEFT JOIN ttrss_feeds ON (ttrss_user_entries.feed_id = ttrss_feeds.id) + WHERE ref_id = '$id' AND ref_id = ttrss_entries.id AND + ttrss_user_entries.owner_uid = ". $_SESSION["uid"]); + + if (db_num_rows($result) != 0) { + $link = db_fetch_result($result, 0, "link"); + $title = db_fetch_result($result, 0, "title"); + $feed_url = db_fetch_result($result, 0, "feed_url"); + + $content = sanitize($this->link, + db_fetch_result($result, 0, "content"), false, false, $feed_url); + + print "<div class='content'>".$content."</content>"; + + } else { + print "Article not found."; + } + + } + } ?> diff --git a/include/functions.php b/include/functions.php index 32fc5ae2a..b52531f66 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2039,6 +2039,7 @@ $data['cdm_expanded'] = get_pref($link, 'CDM_EXPANDED'); $data['dep_ts'] = calculate_dep_timestamp(); + $data['reload_on_ts_change'] = !defined('_NO_RELOAD_ON_TS_CHANGE'); if (file_exists(LOCK_DIRECTORY . "/update_daemon.lock")) { @@ -2235,14 +2236,29 @@ if ($search) { $view_query_part = " "; } else if ($feed != -1) { - $unread = getFeedUnread($link, $feed, $cat_view); - if ($cat_view && $feed > 0 && $include_children) - $unread += getCategoryChildrenUnread($link, $feed); + if (get_pref($link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) { + $a_date_sort_field = "updated"; + } else { + $a_date_sort_field = "date_entered"; + } + + if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) { + $a_order_by = "$a_date_sort_field"; + } else { + $a_order_by = "$a_date_sort_field DESC"; + } - if ($unread > 0) { - $view_query_part = " unread = true AND "; + if (!$override_order) { + $override_order = "unread DESC, $a_order_by"; } + + if (!$ignore_vfeed_group && ($is_cat || $feed_id < 0) && + get_pref($link, 'VFEED_GROUP_BY_FEED', $owner_uid)) { + + $override_order = "ttrss_feeds.title, $override_order"; + } + } } @@ -123,6 +123,8 @@ </div> </div> +<div style="display : none" onclick="Element.hide(this)" id="small_article_preview"></div> + <div id="header"> <img id="net-alert" style="display : none" title="<?php echo __("Communication problem with server.") ?>" diff --git a/js/tt-rss.js b/js/tt-rss.js index eaa1f3daf..54ac077f4 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -447,7 +447,7 @@ function parse_runtime_info(data) { } if (k == "dep_ts" && parseInt(getInitParam("dep_ts")) > 0) { - if (parseInt(getInitParam("dep_ts")) < parseInt(v)) { + if (parseInt(getInitParam("dep_ts")) < parseInt(v) && getInitParam("reload_on_ts_change")) { window.location.reload(); } } diff --git a/js/viewfeed.js b/js/viewfeed.js index 485ee3606..0e2e9e3fa 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -13,6 +13,8 @@ var catchup_timeout_id = false; var cids_requested = []; var loaded_article_ids = []; +var _post_preview_timeout = false; + var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null; function headlines_callback2(transport, offset, background, infscroll_req) { @@ -1166,17 +1168,61 @@ function getActiveArticleId() { return _active_article_id; } -function postMouseIn(id) { +function postMouseIn(e, id) { post_under_pointer = id; + + if (_post_preview_timeout) window.clearTimeout(_post_preview_timeout); + + if (!getInitParam("cdm_expanded")) { + _post_preview_timeout = window.setTimeout(function() { + displaySmallArticlePreview(e, id); + }, 1000); + } +} + +function displaySmallArticlePreview(e, id) { + try { + var query = "?op=rpc&method=cdmarticlepreview&id=" + id; + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function(transport) { + cexc = $("CEXC-" + id); + preview = $("small_article_preview"); + row = $("RROW-" + id); + + if (id != getActiveArticleId() && (!isCdmMode() || (cexc && Element.visible(cexc))) && row && preview) { + preview.innerHTML = transport.responseText; + new Effect.Appear(preview, {duration:0.2}); + + preview.setStyle({ + left: (e.clientX + 20) + 'px', + top: (Element.cumulativeOffset(row)[1] + row.offsetHeight + 10) + 'px' }); + + } + + } }); + + + } catch (e) { + exception_error("displaySmallArticlePreview", e); + } } function postMouseOut(id) { post_under_pointer = false; + + if (_post_preview_timeout) window.clearTimeout(_post_preview_timeout); + + if (Element.visible("small_article_preview")) + Element.hide("small_article_preview"); } function unpackVisibleHeadlines() { try { + if (!isCdmMode()) return; + $$("#headlines-frame > div[id*=RROW]").each( function(child) { if (child.offsetTop <= $("headlines-frame").scrollTop + diff --git a/plugins/af_pennyarcade/init.php b/plugins/af_pennyarcade/init.php index 26d19bc01..06c1230a6 100644 --- a/plugins/af_pennyarcade/init.php +++ b/plugins/af_pennyarcade/init.php @@ -5,7 +5,7 @@ class Af_PennyArcade extends Plugin { private $host; function about() { - return array(1.0, + return array(1.1, "Strip unnecessary stuff from PA feeds", "fox"); } @@ -22,25 +22,22 @@ class Af_PennyArcade extends Plugin { if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "Comic:") !== FALSE) { if (strpos($article["plugin_data"], "pennyarcade,$owner_uid:") === FALSE) { - + + if ($debug_enabled) { + _debug("af_pennyarcade: Processing comic"); + } + $doc = new DOMDocument(); - @$doc->loadHTML(fetch_file_contents($article["link"])); + $doc->loadHTML(fetch_file_contents($article["link"])); $basenode = false; if ($doc) { $xpath = new DOMXPath($doc); - $entries = $xpath->query('(//img[@src])'); // we might also check for img[@class='strip'] I guess... - - $matches = array(); + $entries = $xpath->query('(//div[@class="post comic"])'); foreach ($entries as $entry) { - - if (preg_match("/(http:\/\/art.penny-arcade.com\/.*)/i", $entry->getAttribute("src"), $matches)) { - - $basenode = $entry; - break; - } + $basenode = $entry; } if ($basenode) { @@ -52,6 +49,39 @@ class Af_PennyArcade extends Plugin { $article["content"] = $article["stored"]["content"]; } } + + if (strpos($article["link"], "penny-arcade.com") !== FALSE && strpos($article["title"], "News Post:") !== FALSE) { + if (strpos($article["plugin_data"], "pennyarcade,$owner_uid:") === FALSE) { + if ($debug_enabled) { + _debug("af_pennyarcade: Processing news post"); + } + $doc = new DOMDocument(); + $doc->loadHTML(fetch_file_contents($article["link"])); + + if ($doc) { + $xpath = new DOMXPath($doc); + $entries = $xpath->query('(//div[@class="post"])'); + + $basenode = false; + + foreach ($entries as $entry) { + $basenode = $entry; + } + + $uninteresting = $xpath->query('(//div[@class="heading"])'); + foreach ($uninteresting as $i) { + $i->parentNode->removeChild($i); + } + + if ($basenode){ + $article["content"] = $doc->saveXML($basenode); + $article["plugin_data"] = "pennyarcade,$owner_uid:" . $article["plugin_data"]; + } + } + } else if (isset($article["stored"]["content"])) { + $article["content"] = $article["stored"]["content"]; + } + } return $article; } diff --git a/tt-rss.css b/tt-rss.css index 715de1f6e..cd79aa5a8 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -1220,3 +1220,5 @@ body#ttrssZoom div.footer { margin-top : 1em; text-align : center; } + + |