Skip to content

Commit

Permalink
Item11754: improved default template for tweets, required some change…
Browse files Browse the repository at this point in the history
…s to the orig jquery.tweet code

git-svn-id: http://svn.foswiki.org/trunk/JQTweetContrib@14605 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Apr 13, 2012
1 parent de2ed3b commit 819319c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
9 changes: 4 additions & 5 deletions data/System/JQTweetContrib.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1331060300" format="1.1" reprev="3" version="4"}%
%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1334314767" format="1.1" reprev="3" version="6"}%
---+!! %TOPIC%
%SHORTDESCRIPTION%

Expand Down Expand Up @@ -56,7 +56,7 @@ Put twitter on your website with tweet!, an unobtrusive javascript plugin for jq
| username | [string or array] required unless using the 'query' option; one or more twitter screen names (use 'list' option for multiple names, where possible) | null |
| list | [string] optional name of list belonging to username | null |
| favorites | [boolean] display the user's favorites instead of his tweets | false |
| query | [string] optional search query (see also: http://search.twitter.com/operators) | #foswiki |
| query | [string] optional search query (see also: http://search.twitter.com/operators) | null |
| avatar_size | [integer] height and width of avatar if displayed (48px max) | 48 |
| count | [integer] how many tweets to display? | 10 |
| fetch | [integer] how many tweets to fetch via the API (set this higher than 'count' if using the 'filter' option) | null |
Expand All @@ -75,7 +75,7 @@ Put twitter on your website with tweet!, an unobtrusive javascript plugin for jq
| twitter_url | [string] custom twitter url, if any (apigee, etc.) | "twitter.com" |
| twitter_api_url | [string] custom twitter api url, if any (apigee, etc.) | "api.twitter.com" |
| twitter_search_url | [string] custom twitter search url, if any (apigee, etc.) | "search.twitter.com" |
| template | [string or function] template used to construct each tweet <li> - see code for available vars | "{avatar}{time}{join}{text}" |
| template | [string or function] template used to construct each tweet <li> - see code for available vars | "{avatar} <b>{user_name}</b> {text} <div class='tweet_date foswikiGrayText'>{tweet_date}</div>" |
| comparator | [function] comparator used to sort tweets (see Array.sort) | <verbatim class="js"> function(tweet1, tweet2) { return tweet2["tweet_time"] - tweet1["tweet_time"]; }</verbatim> |
| filter | [function] whether or not to include a particular tweet (be sure to also set 'fetch') | <verbatim class="js">function(tweet) {return true; }</verbatim> |

Expand All @@ -94,8 +94,7 @@ Put twitter on your website with tweet!, an unobtrusive javascript plugin for jq
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 13 Apr 2012: | improved default template for tweets, required some changes to the orig jquery.tweet code |
| Dependencies: | %$DEPENDENCIES% |
| Home page: | Foswiki:Extensions/%TOPIC% |
| Support: | Foswiki:Support/%TOPIC% |

%META:PREFERENCE{name="NATSKIN_STYLE" title="NATSKIN_STYLE" type="Local" value="jazzynote"}%
2 changes: 1 addition & 1 deletion lib/Foswiki/Contrib/JQTweetContrib.pm
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;

our $VERSION = '$Rev$';
our $RELEASE = '57a715f380';
our $RELEASE = '1.0';
our $SHORTDESCRIPTION = 'Put twitter on your website';
our $NO_PREFS_IN_TOPIC = 1;

Expand Down
4 changes: 2 additions & 2 deletions pub/System/JQTweetContrib/jquery.tweet.init.uncompressed.js
Expand Up @@ -2,14 +2,14 @@ jQuery(function($) {

var defaults = {
join_text: "auto",
query: "#foswiki",
avatar_size: 48,
count: 10,
auto_join_text_default:'',
auto_join_text_url:'',
auto_join_text_reply:'',
auto_join_text_ed:'',
auto_join_text_ing:''
auto_join_text_ing:'',
template: "{avatar} <b>{user_name}</b> {text} <div class='tweet_date foswikiGrayText'>{tweet_date}</div>"
};

$(".jqTweet:not(.jqInitedTweet)").livequery(function() {
Expand Down
11 changes: 8 additions & 3 deletions pub/System/JQTweetContrib/jquery.tweet.uncompressed.css
Expand Up @@ -13,11 +13,13 @@
.tweet_list li {
overflow-y: auto;
overflow-x: hidden;
padding: 1.0em 0;
margin: 1.0em 0;
padding: 1.0em 0 0 60px;
border-top:1px solid #ddd;
list-style-type: none;
}
.tweet_list li.tweet_first {
padding-top:0px;
border-top:0px;
}

Expand All @@ -30,10 +32,13 @@
}

.tweet_list .tweet_avatar {
padding-right: .5em;
float: left;
margin-left:-60px;
padding-right: 1em;
background:transparent;
float:left;
}

.tweet_list .tweet_avatar img {
vertical-align: middle;
}

7 changes: 6 additions & 1 deletion pub/System/JQTweetContrib/jquery.tweet.uncompressed.js
Expand Up @@ -46,6 +46,7 @@

// Expand values inside simple string templates with {placeholders}
function t(template, info) {

if (typeof template === "string") {
var result = template;
for(var key in info) {
Expand Down Expand Up @@ -177,10 +178,14 @@
o.item = item;
o.source = item.source;
o.screen_name = item.from_user || item.user.screen_name;
o.user_name = item.from_user_name || item.user.name;
o.description = item.description;
o.avatar_size = s.avatar_size;
o.avatar_url = extract_avatar_url(item, (document.location.protocol === 'https:'));
o.retweet = typeof(item.retweeted_status) != 'undefined';
o.isodate = item.created_at;
o.tweet_time = parse_date(item.created_at);
o.tweet_date = (new Date(o.tweet_time)).toLocaleDateString();
o.join_text = s.join_text == "auto" ? build_auto_join_text(item.text) : s.join_text;
o.tweet_id = item.id_str;
o.twitter_base = "http://"+s.twitter_url+"/";
Expand All @@ -200,7 +205,7 @@
o.user = t('<a class="tweet_user" href="{user_url}">{screen_name}</a>', o);
o.join = s.join_text ? t(' <span class="tweet_join">{join_text}</span> ', o) : ' ';
o.avatar = o.avatar_size ?
t('<a class="tweet_avatar" href="{user_url}"><img src="{avatar_url}" height="{avatar_size}" width="{avatar_size}" alt="{screen_name}\'s avatar" title="{screen_name}\'s avatar" border="0"/></a>', o) : '';
t('<a class="tweet_avatar" href="{user_url}"><img src="{avatar_url}" height="{avatar_size}" width="{avatar_size}" alt="{screen_name}\'s avatar" border="0"/></a>', o) : '';
o.time = t('<span class="tweet_time"><a href="{tweet_url}" title="view tweet on twitter">{tweet_relative_time}</a></span>', o);
o.text = t('<span class="tweet_text">{tweet_text_fancy}</span>', o);
o.reply_action = t('<a class="tweet_action tweet_reply" href="{reply_url}">reply</a>', o);
Expand Down

0 comments on commit 819319c

Please sign in to comment.