$print_exec_time = false;
break; // digestSend
+ case "loading":
+ print __("Loading, please wait...") . " " .
+ "<img src='images/indicator_tiny.gif'>";
+
case "getProfiles":
$login = db_escape_string($_REQUEST["login"]);
$password = db_escape_string($_REQUEST["password"]);
} // Select action according to $op value.
+
// We close the connection to database.
db_close($link);
?>
-body {
+body#ttrssDigest {
background : #f0f0f0;
color : black;
- font-family : sans-serif;
+ font-family : "Lucida Grande", Arial, sans-serif;
font-size : 12px;
}
#overlay img {
vertical-align : middle;
}
+
+div.fatalError button {
+ margin-top : 5px;
+}
+
+div.fatalError textarea {
+ width : 100%;
+ height : 100px;
+}
+
"<div class='digest-check'>" +
mark_part +
publ_part +
+ "<img title='" + __("Share on Twitter") + "' onclick=\"tweet_article("+article.id+", true)\" src='images/art-tweet.png'>" +
"<img title='" + __("Mark as read") + "' onclick=\"view("+article.id+", true)\" src='images/digest_checkbox.png'>" +
"</div>" +
"<a target=\"_blank\" href=\""+article.link+"\""+
var feeds = transport.responseXML.getElementsByTagName('feeds')[0];
if (feeds) {
- feeds = eval("(" + feeds.firstChild.nodeValue + ")");
+ feeds = JSON.parse(feeds.firstChild.nodeValue);
feeds.sort( function (a,b)
{
var headlines_title = transport.responseXML.getElementsByTagName('headlines-title')[0];
if (headlines && headlines_title) {
- headlines = eval("(" + headlines.firstChild.nodeValue + ")");
+ headlines = JSON.parse(headlines.firstChild.nodeValue);
var title = headlines_title.firstChild.nodeValue;
if (ids.length > 0) {
if (pr) {
$('headlines-content').appendChild(pr);
- if (!no_effects) new Effect.ScrollTo(inserted);
+ if (!no_effects && inserted) new Effect.ScrollTo(inserted);
} else {
$('headlines-content').innerHTML += "<li id='H-MORE-PROMPT'>" +
"<div class='body'>" +
- "<a href=\"javascript:catchup_visible_articles()\">" +
+ "<a href=\"#\" onclick=\"catchup_visible_articles()\">" +
__("Mark as read") + "</a> | " +
- "<a href=\"javascript:load_more()\">" +
+ "<a href=\"#\" onclick=\"load_more()\">" +
__("Load more...") + "</a>" +
"<img style=\"display : none\" "+
"id=\"H-LOADING-IMG\" src='images/indicator_tiny.gif'>" +
function init() {
try {
+ dojo.require("dijit.Dialog");
new Ajax.Request("backend.php", {
parameters: "?op=rpc&subop=sanityCheck",
}
}
+function tweet_article(id) {
+ try {
+
+ var query = "?op=rpc&subop=getTweetInfo&id=" + param_escape(id);
+
+ console.log(query);
+
+ var d = new Date();
+ var ts = d.getTime();
+
+ var w = window.open('backend.php?op=loading', 'ttrss_tweet',
+ "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0");
+
+ new Ajax.Request("backend.php", {
+ parameters: query,
+ onComplete: function(transport) {
+ var ti = JSON.parse(transport.responseText);
+
+ var share_url = "http://twitter.com/share?_=" + ts +
+ "&text=" + param_escape(ti.title) +
+ "&url=" + param_escape(ti.link);
+
+ w.location.href = share_url;
+
+ } });
+
+ } catch (e) {
+ exception_error("tweet_article", e);
+ }
+}
<html>
<head>
<title>Tiny Tiny RSS</title>
+
+ <link rel="stylesheet" type="text/css" href="lib/dijit/themes/claro/claro.css"/>
<link rel="stylesheet" type="text/css" href="digest.css?<?php echo $dt_add ?>"/>
- <link rel="stylesheet" type="text/css" href="infobox.css?<?php echo $dt_add ?>"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="lib/prototype.js"></script>
<script type="text/javascript" src="lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"></script>
+ <script type="text/javascript" src="lib/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
<script type="text/javascript" charset="utf-8" src="localized_js.php?<?php echo $dt_add ?>"></script>
<script type="text/javascript" charset="utf-8" src="functions.js?<?php echo $dt_add ?>"></script>
});
</script>
</head>
-<body id="ttrssDigest">
+<body id="ttrssDigest" class="claro">
<div id="overlay" style="display : block">
<div id="overlay_inner">
<noscript>
</div>
</div>
- <div id="dialog_overlay" style="display : none"> </div>
-
- <div id="errorBoxShadow" style="display : none">
- <div id="errorBox">
- <div id="xebTitle"><?php echo __('Fatal Exception') ?></div><div id="xebContent"> </div>
- <div id="xebBtn" align='center'>
- <button onclick="closeErrorBox()"><?php echo __('Close this window') ?></button>
- </div>
- </div>
- </div>
-
<div id="header">
<div class="links">
print "<div id=\"PTITLE-$id\" style=\"display : none\">" .
truncate_string(strip_tags($line['title']), 15) . "</div>";
- $tweet_title = htmlspecialchars(
- truncate_string(strip_tags($line['title']), 100, '...'));
-
- $tweet_link = htmlspecialchars($line['link']);
-
- print "<span id=\"TWEETINFO-$id\" style=\"display : none\">";
- print json_encode(array("title" => $tweet_title, "link" => $tweet_link));
- print "</span>";
-
print "<div class=\"postReply\" id=\"POST-$id\">";
/* print "<div dojoType=\"dijit.Menu\" style=\"display: none;\"
print_article_enclosures($link, $id, $always_display_enclosures,
$article_content);
- $short_title = truncate_string(
- strip_tags($line['title']), 90);
-
- $tweet_title = htmlspecialchars(
- truncate_string(strip_tags($line['title']), 100, '...'));
-
- $tweet_link = htmlspecialchars($line['link']);
-
- print "<span id=\"TWEETINFO-$id\" style=\"display : none\">";
- print json_encode(array("title" => $tweet_title, "link" => $tweet_link));
- print "</span>";
-
print "</div>";
print "<div class=\"cdmFooter\">";
return;
}
+ if ($subop == "getTweetInfo") {
+ header("Content-Type: text/html");
+ $id = db_escape_string($_REQUEST['id']);
+
+ $result = db_query($link, "SELECT title, link
+ FROM ttrss_entries, ttrss_user_entries
+ WHERE id = '$id' AND ref_id = id AND owner_uid = " .$_SESSION['uid']);
+
+ if (db_num_rows($result) != 0) {
+ $title = truncate_string(strip_tags(db_fetch_result($result, 0, 'title')),
+ 100, '...');
+ $article_link = db_fetch_result($result, 0, 'link');
+ }
+
+ print json_encode(array("title" => $title, "link" => $article_link,
+ "id" => $id));
+
+ return;
+ }
+
print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>";
}
?>
function tweetArticle(id) {
try {
+ var query = "?op=rpc&subop=getTweetInfo&id=" + param_escape(id);
+
+ console.log(query);
+
var d = new Date();
var ts = d.getTime();
- var ti = JSON.parse($("TWEETINFO-" + id).innerHTML);
+ var w = window.open('backend.php?op=loading', 'ttrss_tweet',
+ "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0");
- var share_url = "http://twitter.com/share?_=" + ts +
- "&text=" + param_escape(ti.title) +
- "&url=" + param_escape(ti.link);
+ new Ajax.Request("backend.php", {
+ parameters: query,
+ onComplete: function(transport) {
+ var ti = JSON.parse(transport.responseText);
- window.open(share_url, 'ttrss_tweet',
- "status=0,toolbar=0,location=0,width=500,height=400,scrollbars=1,menubar=0");
+ var share_url = "http://twitter.com/share?_=" + ts +
+ "&text=" + param_escape(ti.title) +
+ "&url=" + param_escape(ti.link);
+
+ w.location.href = share_url;
+
+ } });
} catch (e) {