From ba7e88e5a59295ac3eed38ea627e9fa2a414b989 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 25 Nov 2010 12:58:29 +0300 Subject: [PATCH] add tweet button to digest, misc digest fixes; rework article tweeting to use ajax loading of needed info --- backend.php | 5 +++++ digest.css | 14 ++++++++++++-- digest.js | 42 ++++++++++++++++++++++++++++++++++++----- digest.php | 17 ++++------------- functions.php | 21 --------------------- modules/backend-rpc.php | 20 ++++++++++++++++++++ viewfeed.js | 25 +++++++++++++++++------- 7 files changed, 96 insertions(+), 48 deletions(-) diff --git a/backend.php b/backend.php index c64ceaa9..410f8986 100644 --- a/backend.php +++ b/backend.php @@ -526,6 +526,10 @@ $print_exec_time = false; break; // digestSend + case "loading": + print __("Loading, please wait...") . " " . + ""; + case "getProfiles": $login = db_escape_string($_REQUEST["login"]); $password = db_escape_string($_REQUEST["password"]); @@ -553,6 +557,7 @@ } // Select action according to $op value. + // We close the connection to database. db_close($link); ?> diff --git a/digest.css b/digest.css index 2ed6aae9..a3168032 100644 --- a/digest.css +++ b/digest.css @@ -1,7 +1,7 @@ -body { +body#ttrssDigest { background : #f0f0f0; color : black; - font-family : sans-serif; + font-family : "Lucida Grande", Arial, sans-serif; font-size : 12px; } @@ -298,3 +298,13 @@ a:hover { #overlay img { vertical-align : middle; } + +div.fatalError button { + margin-top : 5px; +} + +div.fatalError textarea { + width : 100%; + height : 100px; +} + diff --git a/digest.js b/digest.js index d282f4ee..520c3d61 100644 --- a/digest.js +++ b/digest.js @@ -429,6 +429,7 @@ function add_headline_entry(article, feed, no_effects) { "
" + mark_part + publ_part + + "" + "" + "
" + " 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 += "
  • " + "
    " + - "" + + "" + __("Mark as read") + " | " + - "" + + "" + __("Load more...") + "" + "" + @@ -622,6 +623,7 @@ function init_second_stage() { function init() { try { + dojo.require("dijit.Dialog"); new Ajax.Request("backend.php", { parameters: "?op=rpc&subop=sanityCheck", @@ -793,3 +795,33 @@ function update_title(unread) { } } +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); + } +} diff --git a/digest.php b/digest.php index 184e2b36..913cd10a 100644 --- a/digest.php +++ b/digest.php @@ -23,8 +23,9 @@ Tiny Tiny RSS + + - @@ -37,6 +38,7 @@ + @@ -48,7 +50,7 @@ }); - +
    - - - -