aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojciech Polak <polak@gnu.org>2010-05-10 19:31:08 +0200
committerWojciech Polak <polak@gnu.org>2010-05-10 19:31:08 +0200
commit75bd0fc97f3ad52b903383417ad0617b03eec07d (patch)
treee2bdfee8f93a2030ca8c1f224dc8c4daefbe51f0
parent62b55a6c9297e842591ef2e1a154deaba2bb88a7 (diff)
downloadcheetah-75bd0fc97f3ad52b903383417ad0617b03eec07d.tar.gz
cheetah-75bd0fc97f3ad52b903383417ad0617b03eec07d.tar.bz2
Add Facebook's News Feed.
-rw-r--r--css/v2/style1.css91
-rw-r--r--frontend/images/play.pngbin0 -> 1138 bytes
-rw-r--r--frontend/lib/d-files.php1
-rw-r--r--frontend/reader.php1
-rw-r--r--js/v2/boot.js7
-rw-r--r--js/v2/core.js115
-rw-r--r--js/v2/gui.js7
-rw-r--r--js/v2/login.js1
-rw-r--r--js/v2/social.js219
-rw-r--r--po/POTFILES.in1
-rw-r--r--xslt/v2/feed.xsl14
11 files changed, 402 insertions, 55 deletions
diff --git a/css/v2/style1.css b/css/v2/style1.css
index 054263b..47a71bc 100644
--- a/css/v2/style1.css
+++ b/css/v2/style1.css
@@ -992,11 +992,12 @@ span.outlink:hover {
.mapembedded {
margin: 4px 0 7px 0;
}
-.entryTwitter {
+.entry.social {
+ margin-top: 0.5em;
padding-bottom: 0.5em;
border-bottom: 1px dashed #d2dada;
}
-.entryTitleTwitter {
+.social .entryTitle {
font-family: "Lucida Grande", sans-serif;
font-size: 100%;
clear: both;
@@ -1004,27 +1005,70 @@ span.outlink:hover {
border-bottom: none;
margin-top: 0.5em;
margin-bottom: 1em;
- width: 38em;
+ width: 34em;
+}
+.social .entryTop {
+ clear: both;
+ padding-top: 0.5em;
+ border-bottom: none;
+ width: 34em;
}
-.entryDateTwitter {
+.social .entryDate {
font-family: georgia;
font-style: italic;
- margin-top: 2px;
+ margin: 2px 0 2px 0;
color: #999999;
font-size: 95%;
}
-.entryBodyTwitter {
+.social .entryBody {
+ font-family: "Lucida Grande", sans-serif;
+ font-size: 100%;
margin-left: 58px;
+ width: 34em;
}
-.entryMetaTwitter {
+.social .entryMeta {
clear: both;
}
-.twitterPhoto {
+.social .photo {
float: left;
padding-right: 0.8em;
padding-bottom: 0.5em;
}
-.twitterMore {
+.social .likes {
+ font-size: 95%;
+ font-style: italic;
+ padding: 5px 0 4px 0;
+}
+.social .comments {
+ margin-top: 10px;
+}
+.social .comment {
+ background-color: #eceff5;
+ border-bottom: 1px solid #e5eaf1;
+ margin-bottom: 2px;
+ padding: 5px 0 4px 5px;
+ clear: left;
+ font-size: 95%;
+}
+.social .comment img {
+ display: block;
+ float: left;
+ width: 32px;
+ height: 32px;
+ margin-right: 8px;
+ border: none;
+}
+.social .comment a {
+ color: #3b5998;
+ text-decoration: none;
+ font-weight: bold;
+}
+.social .comment a:hover {
+ text-decoration: underline;
+}
+.social .comment .message { display: inline; }
+.social .morecomments { font-size: 85%; }
+.social .more {
font-size: 110%;
text-align: center;
background: url(images/external1.png) center right no-repeat;
@@ -1065,6 +1109,34 @@ span.outlink:hover {
color: white;
}
+.fb-description,
+.fb-caption {
+ font-size: 90%;
+}
+
+table.vc { border-spacing: 0; }
+table.vc td { padding: 0; }
+
+.play-video {
+ position: relative;
+ overflow: hidden; /* IE and Opera */
+}
+.play-video img {
+ display: block;
+ padding: 1px;
+ border: 1px solid #dddddd;
+}
+.playbutton {
+ background: transparent url(images/play.png) no-repeat top left;
+ width: 29px;
+ height: 29px;
+ position: absolute;
+ cursor: pointer;
+ top: 50%;
+ left: 50%;
+ margin: -12px 0 0 -12px;
+}
+
/* CSS Sprites */
.img-10-down {background: transparent url(images/master-icons.png?v=0) no-repeat 0px 0px; }
.img-10-remove {background: transparent url(images/master-icons.png?v=0) no-repeat -10px 0px;}
@@ -1082,6 +1154,7 @@ span.outlink:hover {
.img-elink {background: transparent url(images/master-icons.png?v=0) no-repeat -80px 0px; width: 27px; height: 12px;}
#menuOpenSWindow img {background: transparent url(images/master-icons.png?v=0) no-repeat -251px 0px;} /* mstuff */
+#menuOpenFacebook img {background: transparent url(images/master-share.png?v=1) no-repeat -64px 0px;}
#menuOpenNotes img {background: transparent url(images/master-icons.png?v=0) no-repeat -235px 0px;} /* mnotes */
#menuOpenWeather img {background: transparent url(images/master-icons.png?v=0) no-repeat -283px 0px;} /* mweather */
#menuOpenFanbox img {background: transparent url(images/master-icons.png?v=0) no-repeat -203px 0px;} /* fanbox */
diff --git a/frontend/images/play.png b/frontend/images/play.png
new file mode 100644
index 0000000..e8e7fc1
--- /dev/null
+++ b/frontend/images/play.png
Binary files differ
diff --git a/frontend/lib/d-files.php b/frontend/lib/d-files.php
index d351aee..4b215c2 100644
--- a/frontend/lib/d-files.php
+++ b/frontend/lib/d-files.php
@@ -30,6 +30,7 @@ $files = array ('bt' => array ('js', array ('js/v2/i18n.js',
'js/v2/marker.js',
'js/v2/share.js',
'js/v2/translate.js',
+ 'js/v2/social.js',
'js/v2/notes.js',
'js/v2/weather.js',
'js/v2/niftycube.js')),
diff --git a/frontend/reader.php b/frontend/reader.php
index 37a2dea..ea9c488 100644
--- a/frontend/reader.php
+++ b/frontend/reader.php
@@ -345,6 +345,7 @@ var SIGS = {'js':'".$SIGS["js"]."', 'tr':'".$SIGS["tr"]."', 'wt':'".
<div id="menu">
<span id="menuOpenSWindow" class="ilinkCM">&nbsp;<img src="images/t.gif" width="16" height="16" alt="" /></span>
+ <span id="menuOpenFacebook" class="ilinkCM">&nbsp;<img src="images/t.gif" width="16" height="16" alt="" /></span>
<span id="menuOpenNotes" class="linkCM">&nbsp;<img src="images/t.gif" width="16" height="16" alt="" /></span>
<span id="menuOpenWeather" class="linkCM">&nbsp;<img src="images/t.gif" width="16" height="16" alt="" /></span>
<span id="menuOpenFanbox" class="linkCM">&nbsp;<img src="images/t.gif" width="16" height="16" alt="" /></span><hr />
diff --git a/js/v2/boot.js b/js/v2/boot.js
index a2d80b8..aae46d4 100644
--- a/js/v2/boot.js
+++ b/js/v2/boot.js
@@ -80,11 +80,4 @@ function dsp (res, p) {
return d;
}
-function load_fb () {
- $.getScript ('http://connect.facebook.net/en_US/all.js', function () {
- FB.init ({appId: CONF.fb_app_id, status: true});
- });
-}
-
-setTimeout (load_fb, 2500);
window.onload = reader;
diff --git a/js/v2/core.js b/js/v2/core.js
index 827d98f..e3c40e3 100644
--- a/js/v2/core.js
+++ b/js/v2/core.js
@@ -225,7 +225,8 @@ function kShortcutsHandler (e) {
collapseFolders ();
else if (fCursor !== null) {
var bw = GID ('bWindowContent_' + fCursor);
- if (bw) traverseDOM (bw, ecEntries, false);
+ if (bw && fCursor != 'fb')
+ traverseDOM (bw, ecEntries, false);
scrollToElement (GID ('bWindow_' + fCursor));
}
break;
@@ -558,6 +559,7 @@ function transformFeed (xmlDocument, feedid, latest, expand) {
if (feedid != 0)
GID ('aps_' + feedid).className = 'feedLoaded';
traverseDOM (bWindowContent, prepareEntry, feedid);
+ convertMediaLinks (bWindowContent);
if (feedid == 0) {
var subd = false;
@@ -1003,6 +1005,7 @@ function loadSWindow () {
function loadFeeds () {
loadSWindow ();
+ createBWindow ('fb', _('Facebook News Feed'));
createBWindow (0, _('Feed Preview'));
for (var foi = 0; foi < cheetahData.feedOrder.length; foi++) {
var feedid = cheetahData.feedOrder[foi];
@@ -1105,6 +1108,10 @@ function refreshVisible () {
function reloadFeed () {
if (!checkOnline ()) return;
var feedid = this.id.split ('_')[1];
+ if (feedid == 'fb') {
+ Modules.Social.openFBStream ();
+ return;
+ }
var fw = GID ('feedWaiting_' + feedid);
if (fw && fw.style.display == 'none')
feedCnt--;
@@ -1209,7 +1216,7 @@ function prepareFeed (n, feedid) {
n.onclick = reloadFeed;
else if (id == 'bWindowClose_' + feedid) {
prepareWindowClose (n, function (obj) {
- closeFeed (parseInt (obj.id.split ('_')[1]));
+ closeFeed (obj.id.split ('_')[1]);
});
}
}
@@ -1405,7 +1412,7 @@ function prepareEntry (n, feedid) {
if (flash) {
n.title = _('See enclosed multimedia');
n.onclick = function () {
- Greybox.open ({src: n.href, width:480, height:295, type:'swf'});
+ Greybox.open ({src: n.href, width:560, height:340, type:'swf'});
this.blur ();
return false;
};
@@ -1627,8 +1634,10 @@ function openFeed (feedid, append) {
fCursor = feedid;
bWindow.style.display = 'block';
var open = GID ('open_' + feedid);
- open.className = 'linkb';
- open.setAttribute ('pclassName', 'linkb');
+ if (open) {
+ open.className = 'linkb';
+ open.setAttribute ('pclassName', 'linkb');
+ }
highlightFCursor (bWindow);
if (append)
scrollToElement (bWindow);
@@ -1646,8 +1655,10 @@ function closeFeed (feedid) {
fCursorForward ();
if (feedid !== 0) {
var open = GID ('open_' + feedid);
- open.className = 'link';
- open.setAttribute ('pclassName', 'link');
+ if (open) {
+ open.className = 'link';
+ open.setAttribute ('pclassName', 'link');
+ }
for (var foi = 0; foi < cheetahData.feedOrder.length; foi++) {
var feedid = cheetahData.feedOrder[foi];
if (GID ('bWindow_' + feedid).style.display == 'block')
@@ -1836,6 +1847,7 @@ function hideAll () {
fCursor = null;
cursor = 0;
allToggle = false;
+ Modules.Social.hideAll ();
GID ('bWindow_0').style.display = 'none'; /* preview */
if (cheetahData != null) {
for (var feedid in cheetahData.feeds) {
@@ -2126,8 +2138,8 @@ function highlightFCursor (win) {
}
function findBWindowEntries (node) {
- var children = node.getElementsByTagName ('*');
- var elems = new Array ();
+ var children = node.getElementsByTagName ('span');
+ var elems = [];
for (var i = 0; i < children.length; i++) {
if (children[i].className == 'entryLink' &&
children[i].parentNode.parentNode.style.display != 'none') {
@@ -2406,7 +2418,7 @@ var Greybox = new function () {
var content = opts.content || undefined;
if (!type) {
- if (src.match (/(\.jpg$|\.png$|\.gif$)/i))
+ if (src.match (/(\.jpg$|\.jpeg$|\.png$|\.gif$)/i))
type = 'img';
else if (src.indexOf ('.swf') > 0)
type = 'swf';
@@ -2448,30 +2460,21 @@ var Greybox = new function () {
else
img.onload = showImage;
}
+ else if (type == 'embed') {
+ gb.innerHTML = content;
+ }
else if (type == 'swf') {
- gb.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
- + ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"'
- + ' align="middle" width="'+ width +'" height="'+ height +'">'
- + '<param name="movie" value="'+ src +'">'
- + '<param name="quality" value="best">'
- + '<param name="allowScriptAccess" value="never">'
- + '<param name="scale" value="noScale">'
- + '<param name="wmode" value="window">'
- + '<param name="salign" value="tl">'
- + '<param name="bgcolor" value="#222">'
- + '<embed type="application/x-shockwave-flash"'
- + ' src="'+ src +'" quality="best" allowscriptaccess="never"'
- + ' scale="noScale" wmode="window" salign="tl" bgcolor="#222"'
- + ' flashvars="playerMode=embedded"'
- + ' pluginspage="http://www.macromedia.com/go/getflashplayer"'
- + ' width="'+ width +'" height="'+ height +'">'
- + '</embed></object>';
+ gb.innerHTML = '<object type="application/x-shockwave-flash" '
+ + 'width="'+ width +'" height="'+ height +'" data="'+ src +'">'
+ + '<param name="movie" value="'+ src +'"/>'
+ + '<param name="allowFullScreen" value="true"/>'
+ + '<param name="allowScriptAccess" value="never"/>'
+ + '<param name="quality" value="best"/>'
+ + '</object>';
}
else if (type == 'inline') {
var c = GID (content);
- if (c) {
- gb.innerHTML = c.innerHTML;
- }
+ if (c) gb.innerHTML = c.innerHTML;
}
}
@@ -2506,6 +2509,58 @@ var Greybox = new function () {
}
}
+function play_video () {
+ var p = this.id.indexOf ('-');
+ if (p == -1)
+ var a = [this.id];
+ else
+ var a = [this.id.substring (0, p), this.id.substr (p + 1)];
+ var type = a[0];
+ var id = a[1];
+
+ if (type in video_embeds)
+ var embed = video_embeds[type];
+ else
+ return true;
+
+ $('a', this).blur ();
+ Greybox.open ({type: 'embed', content: embed.code.replace (/{ID}/g, id),
+ width: embed.width, height: embed.height});
+ return false;
+}
+
+function convertMediaLinks (ctx) {
+ $('.entryBody > span a:has(img)', ctx)
+ .each (function (i) {
+ if (this.parentNode.className == 'play-video')
+ return;
+ var id = false;
+ try {
+ if (this.href.indexOf ('http://www.youtube.com/watch') === 0)
+ id = 'youtube-' + this.href.substr (31);
+ else if (this.href.indexOf ('http://vimeo.com/') === 0)
+ id = 'vimeo-' + this.href.substr (17);
+ else if (this.href.indexOf ('http://www.collegehumor.com/video:') === 0)
+ id = 'chtv-' + this.href.substr (34);
+ else if (this.href.indexOf ('http://www.facebook.com/video/video.php?v=') === 0)
+ id = 'facebook-' + this.href.substr (42);
+ if (id) {
+ $(this).wrap ('<table class="vc"><tr><td><div id="'+ id +'" class="play-video"></div></td></tr></table>');
+ $(this).after ('<div class="playbutton"></div>');
+ }
+ } catch (e) {}
+ });
+}
+
+var video_embeds = {
+ 'youtube': {code: '<object type="application/x-shockwave-flash" width="560" height="340" data="http://www.youtube.com/v/{ID}&autoplay=1&showsearch=0&fs=1"><param name="movie" value="http://www.youtube.com/v/{ID}&autoplay=1&showsearch=0&fs=1"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/></object>', width: 560, height: 340},
+ 'vimeo': {code: '<object type="application/x-shockwave-flash" width="560" height="315" data="http://vimeo.com/moogaloop.swf?clip_id={ID}&server=vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=1&color=&autoplay=1"><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id={ID}&server=vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=1&color=&autoplay=1"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="quality" value="best"/><param name="scale" value="showAll"/></object>', width: 560, height: 315},
+ 'chtv': {code: '<object type="application/x-shockwave-flash" width="560" height="315" data="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id={ID}&fullscreen=1&autoplay=1"><param name="movie" value="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id={ID}&fullscreen=1&autoplay=1"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="wmode" value="transparent"/></object>', width: 560, height: 315},
+ 'dailymotion': {code: '<object type="application/x-shockwave-flash" width="480" height="381" data="http://www.dailymotion.com/swf/{ID}?autoplay=1"><param name="movie" value="http://www.dailymotion.com/swf/{ID}?autoplay=1"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/></object>', width: 480, height: 381},
+ 'metacafe': {code: '<object type="application/x-shockwave-flash" width="498" height="423" data="http://www.metacafe.com/fplayer/{ID}/video.swf"><param name="movie" value="http://www.metacafe.com/fplayer/{ID}/video.swf"/><param name="name" value="Metacafe_{ID}"/><param name="flashvars" value="playerVars=showStats=no|autoPlay=yes"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/></object>', width: 498, height: 423},
+ 'facebook': {code: '<object type="application/x-shockwave-flash" width="560" height="315" data="http://www.facebook.com/v/{ID}"><param name="movie" value="http://www.facebook.com/v/{ID}"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/></object>', width: 560, height: 315}
+}
+
function registerCheetahHandler () {
if (typeof navigator.registerContentHandler == 'function' &&
window.location.href.indexOf ('http://www.cheetah-news.com') === 0)
diff --git a/js/v2/gui.js b/js/v2/gui.js
index bcab5ce..f334e70 100644
--- a/js/v2/gui.js
+++ b/js/v2/gui.js
@@ -115,6 +115,7 @@ function initGui () {
'menuOpenCWindow2' : '&nbsp;' + _('Manage Subscriptions') + '&nbsp;',
'menuOpenCWindow3' : '&nbsp;' + _('Manage Folders') + '&nbsp;',
'menuOpenCWindow4' : '&nbsp;' + _('User Settings') + '&nbsp;',
+ 'menuOpenFacebook': '&nbsp;' + _('Facebook News Feed') + '&nbsp;',
'menuOpenFanbox': '&nbsp;' + _('Facebook Fanbox') + '&nbsp;',
'logout' : '&nbsp;' + _('Logout') + '&nbsp;'}, true);
@@ -136,6 +137,7 @@ function initGui () {
};
}
+ $(reader).delegate ('div.play-video', 'click', play_video);
try { window.focus (); } catch (E) {}
}
@@ -345,7 +347,8 @@ function initMenu () {
}
setCmhLink (GID ('logout'), function () {
- if (cheetahData.fbUID && typeof FB != 'undefined') {
+ if (cheetahData.fbUID && typeof FB != 'undefined' &&
+ readCookie ('cheetahFBL')) {
if (confirm (_('Log out also from Facebook?'))) {
FB.getLoginStatus (function (res) {
if (res.session)
@@ -358,7 +361,7 @@ function initMenu () {
}
window.location = 'logout';
});
- setCmhLink (GID ('menuOpenFanbox'),function () { this.className = 'linkCM'; openFanbox (); });
+ setCmhLink (GID ('menuOpenFanbox'), function () { this.className = 'linkCM'; openFanbox (); });
setCmhLink (GID ('menuOpenCWindow1'), function () { this.className = 'linkCM'; openCWindow (1); });
setCmhLink (GID ('menuOpenCWindow2'), function () { this.className = 'linkCM'; openCWindow (2); });
setCmhLink (GID ('menuOpenCWindow3'), function () { this.className = 'linkCM'; openCWindow (3); });
diff --git a/js/v2/login.js b/js/v2/login.js
index f7ec64d..17d0e05 100644
--- a/js/v2/login.js
+++ b/js/v2/login.js
@@ -206,5 +206,6 @@ function fb_login () {
var pc = GID ('PersistentCookie');
var r = 'login?fbConnect=1';
if (pc && pc.checked) r += '&PersistentCookie=yes';
+ writeCookie ('cheetahFBL', 1);
window.location.replace (r);
}
diff --git a/js/v2/social.js b/js/v2/social.js
new file mode 100644
index 0000000..d29aa86
--- /dev/null
+++ b/js/v2/social.js
@@ -0,0 +1,219 @@
+/*
+ Cheetah News JS/v2 Social
+ Copyright (C) 2010 Wojciech Polak.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+Modules.Social = new function () {
+ var self = this;
+ var initiated = false;
+ var lastRefresh = null;
+ var fbSessionExpires = null;
+
+ this.init = function () {
+ setTimeout (function () {
+ $.getScript ('http://connect.facebook.net/en_US/all.js', function () {
+ FB.init ({appId: CONF.fb_app_id, status: true});
+ setup ();
+ });
+ }, 2000);
+ return true;
+ };
+
+ function setup () {
+ if (initiated) return;
+ var m = GID ('menuOpenFacebook');
+ if (m) {
+ m.className = 'linkCM';
+ setCmhLink (m, function () { this.className = 'linkCM';
+ self.openFBStream (); });
+ }
+ initiated = true;
+ }
+
+ this.hideAll = function () {
+ GID ('bWindow_fb').style.display = 'none';
+ };
+
+ this.openFBStream = function (args) {
+ hideMenu ();
+ if (!checkOnline ()) return;
+ if (typeof FB == undefined) return;
+
+ hideAll ();
+ unhighlightSCursor (sWindowCursor);
+
+ var bWindow = GID ('bWindow_fb');
+ bWindow.style.display = 'block';
+ fCursor = 0;
+ highlightFCursor (bWindow);
+ scrollToElement (bWindow);
+ cursor = 1;
+
+ FB.getLoginStatus (function (res1) {
+ var expired = true;
+ if (!fbSessionExpires && res1.session && 'expires' in res1.session) {
+ fbSessionExpires = res1.session['expires'];
+ if (fbSessionExpires === 0)
+ expired = false;
+ }
+ if (fbSessionExpires) {
+ var now = new Date ().getTime () / 1000;
+ if (fbSessionExpires - now > 1)
+ expired = false;
+ }
+ if (res1.session && !expired) {
+ fetchFBStream (args);
+ if ('expires' in res1.session)
+ fbSessionExpires = res1.session['expires'];
+ }
+ else {
+ FB.login (function (res2) {
+ if (res2.session && res2.perms) {
+ writeCookie ('cheetahFBL', 1);
+ if (res2.perms.indexOf ('read_stream') != -1) {
+ if ('expires' in res2.session)
+ fbSessionExpires = res2.session['expires'];
+ fetchFBStream (args);
+ }
+ }
+ }, {perms: 'read_stream'});
+ }
+ });
+ }
+
+ function fetchFBStream (args) {
+ var opts = $.extend ({}, {
+ clear: true,
+ limit: 25}, args);
+
+ if (lastRefresh) {
+ var ct = new Date ().getTime ();
+ if ((ct - lastRefresh) < 500000)
+ return;
+ }
+ var content = GID ('bWindowContent_fb');
+ feedWaiting ('fb');
+
+ FB.api ('/me/home', {limit: opts.limit}, function (res) {
+ if (res.data) {
+ if (opts.clear) {
+ content.innerHTML = '<div class="channelOptions">'
+ + '<a id="cl_fb" class="channelLink" href="http://www.facebook.com/" target="_blank">'
+ + '<img src="images/t.gif" class="img-elink" style="vertical-align:top"/>'
+ + '</a></div>';
+ }
+ for (var i = 0; i < res.data.length; i++) {
+ appendFBEntry (content, res.data[i]);
+ }
+ convertMediaLinks (content);
+ $('a.morecomments', content).click (showMoreComments);
+ }
+ GID ('feedWaiting_fb').style.display = 'none';
+ lastRefresh = new Date ().getTime ();
+ if (typeof tracker != 'undefined')
+ tracker._trackEvent ('Facebook', 'ReadStream');
+ });
+ }
+
+ function appendFBEntry (dst, e) {
+ var body = '';
+ var name = null;
+
+ if ('message' in e)
+ body += '<div>'+ e.message.createLinks () +'</div>';
+ if ('name' in e) {
+ name = e.name;
+ body += '<p>'+ e.name +'</p>';
+ }
+ if ('picture' in e && 'link' in e) {
+ body += '<p class="thumbnails">';
+ body += '<a href="'+ e.link +'" rel="nofollow" target="_blank">'
+ + '<img src="'+ e.picture +'" alt="thumbnail"/></a> ';
+ if ('description' in e)
+ body += '<div class="fb-description">'+ e.description +'</div>';
+ else if ('caption' in e && name != e.caption)
+ body += '<div class="fb-caption">'+ e.caption +'</div>';
+ body += '</p>';
+ }
+ else {
+ if ('description' in e)
+ body += '<div class="fb-description">'+ e.description +'</div>';
+ else if ('caption' in e && name != e.caption)
+ body += '<div class="fb-caption">'+ e.caption +'</div>';
+ }
+
+ var picture = '<a href="http://www.facebook.com/profile.php?id='
+ + e.from.id + '" target="_blank"><img height="50" width="50" src="http://graph.facebook.com/'
+ + e.from.id + '/picture" class="photo" alt="[img]" title="'
+ + e.from.name +'"/></a>';
+
+
+ var likes = '';
+ if ('likes' in e) {
+ likes = '<div class="likes">'
+ + sprintf (ngettext ('%d person like this', '%d people like this',
+ e.likes), e.likes) + '</div>';
+ }
+
+ var comments = '';
+ if ('comments' in e) {
+ comments += '<div class="comments">';
+ var no = e.comments.data.length > 2 ? 2 : e.comments.data.length;
+ for (var i = 0; i < e.comments.data.length; i++) {
+ var c = e.comments.data[i];
+ var v = i < no ? '' : ' style="display:none"';
+ comments += '<div class="comment"'+ v +'><a href="http://www.facebook.com/profile.php?id='
+ + c.from.id +'" target="_blank"><img '+ (i < no ? '' : 'o') +'src="http://graph.facebook.com/'
+ + c.from.id +'/picture" title="'+ c.from.name +'" alt="[img]"/></a>'
+ + '<div class="content"><a href="http://www.facebook.com/profile.php?id='
+ + c.from.id +'" target="_blank">'+ c.from.name + '</a>: <div class="message">'
+ + c.message +'</div></div><div style="clear:both;"></div></div>';
+ }
+ if (e.comments.data.length > 2) {
+ var id = e.id.split ('_');
+ comments += '<div class="comment"><a href="http://www.facebook.com/profile.php?id='
+ + e.from.id +'&v=wall&story_fbid='+ id[1] +'" target="_blank" class="morecomments">'
+ + _('more') +'</a></div>';
+ }
+ comments += '</div>';
+ }
+
+ entry = '<div class="entryTop"><span class="entryLink">'
+ + picture +'</span></div><div class="entryBody"><span>'
+ + body +'</span><div class="entryDate">'
+ + parseFBDate (e.updated_time) +'</div>'
+ + likes + comments + '</div><div style="clear:both;"></div>';
+
+ dst.appendChild (DCE ('div', {id: 'entry_fb' + e.id,
+ className: 'entry social'}, [entry]));
+ }
+
+ function showMoreComments () {
+ $('div.comment', this.parentNode.parentNode)
+ .each (function (i) {
+ var img = $('img', this);
+ if (img.length)
+ img.attr ('src', img.attr ('osrc'));
+ $(this).show ();
+ });
+ $(this.parentNode).remove ();
+ return false;
+ };
+
+ function parseFBDate (d) {
+ return d.substr (0, 10) +' '+ d.substr (11, 5);
+ }
+};
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 74f7d0d..822a68f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -27,5 +27,6 @@ js/v2/marker.js
js/v2/notes.js
js/v2/opml.js
js/v2/share.js
+js/v2/social.js
js/v2/translate.js
js/v2/weather.js
diff --git a/xslt/v2/feed.xsl b/xslt/v2/feed.xsl
index 69a546d..06d2c71 100644
--- a/xslt/v2/feed.xsl
+++ b/xslt/v2/feed.xsl
@@ -132,7 +132,7 @@
<xsl:sort order="{$ORDERBY}" data-type="number" select="position()"/>
</xsl:apply-templates>
<br />
- <a class="twitterMore">
+ <a class="more">
<xsl:attribute name="href">
<xsl:value-of select="atomW3:link[@rel='alternate']/@href"/>
<xsl:choose>
@@ -799,7 +799,7 @@
<xsl:template match="atomW3:entry" mode="twitter">
<xsl:variable name="eid" select="concat($FEEDID, generate-id())"/>
- <div id="entry_{$eid}" class="entryTwitter">
+ <div id="entry_{$eid}" class="entry social">
<xsl:if test="atomW3:content/@xml:lang|
/atomW3:feed/@xml:lang">
<xsl:attribute name="entrylang">
@@ -807,12 +807,12 @@
/atomW3:feed/@xml:lang"/>
</xsl:attribute>
</xsl:if>
- <div class="entryTitle entryTitleTwitter">
+ <div class="entryTitle">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('http://twitter.com/', substring-before(atomW3:title, ':'))"/>
</xsl:attribute>
- <img src="{atomW3:link[@rel = 'image']/@href}" class="twitterPhoto" width="48" height="48" />
+ <img src="{atomW3:link[@rel = 'image']/@href}" class="photo" width="48" height="48" alt="[img]"/>
</a>
<span id="el_{$eid}" class="entryLink">
<xsl:choose>
@@ -825,20 +825,20 @@
</xsl:choose>
</span>
<xsl:if test="atomW3:updated">
- <div class="entryDate entryDateTwitter">
+ <div class="entryDate">
<xsl:call-template name="formatAtomDate">
<xsl:with-param name="node" select="atomW3:updated"/>
</xsl:call-template>
</div>
</xsl:if>
</div>
- <div id="eb_{$eid}" class="entryBody entryBodyTwitter">
+ <div id="eb_{$eid}" class="entryBody">
<xsl:if test="position() &gt; $EXPAND">
<xsl:attribute name="style">display:none</xsl:attribute>
</xsl:if>
<span id="ebi_{$eid}"></span>
<xsl:comment>/span_ebi</xsl:comment>
- <div class="entryMeta entryMetaTwitter">
+ <div class="entryMeta">
<xsl:if test="atomW3:link">
<span class="entryMore">
<xsl:text> </xsl:text>

Return to:

Send suggestions and report system problems to the System administrator.