Skip to content

Commit

Permalink
Item11613: nother twitter integration
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/JQTweetContrib@14223 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Mar 6, 2012
0 parents commit 14cc5ca
Show file tree
Hide file tree
Showing 11 changed files with 507 additions and 0 deletions.
101 changes: 101 additions & 0 deletions data/System/JQTweetContrib.txt
@@ -0,0 +1,101 @@
%META:TOPICINFO{author="micha" comment="reprev" date="1331060300" format="1.1" reprev="3" version="4"}%
---+!! %TOPIC%
%SHORTDESCRIPTION%

%TOC%

%JQPLUGINS{"tweet"
format="
Homepage: $homepage <br />
Author(s): $author <br />
Version: $version
"
}%
---++ Summary
%STARTSECTION{"summary"}%
Put twitter on your website with tweet!, an unobtrusive javascript plugin for jquery.
%ENDSECTION{"summary"}%

---++ Features
* small size and fast download time
* will not slow down or pause your page while tweets are loading
* display up to 100 tweets, as permitted by the twitter search api
* display tweets from a twitter search, or from your own feed
* optional verb tense matching, for human readable tweets
* optionally display your avatar
* optionally display tweets from multiple accounts!
* automatic linking of @replies to users’ twitter page
* automatic linking of URLs
* automatic linking of #hashtags, to a twitter search of all your tags
* converts <3 to a css styleable ♥ (we ♥ hearts)
* customize the style with your own stylesheet or with other jquery plugins
* customize the layout with a user-defined template function

---++ Demo

%JQREQUIRE{"tweet" warn="off"}%

<div id="foswikiTweets" class="jqTweet {query:'foswiki', count:10, refresh_interval:60}"></div>

%BUTTON{"%MAKETEXT{"Refresh"}%" icon="arrow_refresh" onclick="jQuery('#foswikiTweets').trigger('tweet:load'); return false;"}%
%CLEAR%

---++ Usage

<verbatim class="tml">
%JQREQUIRE{"tweet"}%

<div class="jqTweet {username:'foswiki'}"></div>

<div class="jqTweet {query:'#foswiki'}"></div>
</verbatim>

---++ Parameters

| *Name* | *Description* | *Default* |
| 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 |
| 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 |
| page | [integer] which page of results to fetch (if count != fetch, you'll get unexpected results) | 1 |
| retweets | [boolean] whether to fetch (official) retweets (not supported in all display modes) | true |
| intro_text | [string] do you want text BEFORE your your tweets? | null |
| outro_text | [string] do you want text AFTER your tweets? | null |
| join_text | [string] optional text in between date and tweet | "auto" |
| auto_join_text_default | [string] auto text for non verb: "i said" bullocks | null |
| auto_join_text_ed | [string] auto text for past tense: "i" surfed | null |
| auto_join_text_ing | [string] auto tense for present tense: "i was" surfing | null |
| auto_join_text_reply | [string] auto tense for replies: "i replied to" @someone "with" | null |
| auto_join_text_url | [string] auto tense for urls: "i was looking at" http:... | null |
| loading_text | [string] optional loading text, displayed while tweets load | null |
| refresh_interval | [integer] optional number of seconds after which to reload tweets | null |
| 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}" |
| 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> |

---++ Installation Instructions

%$INSTALL_INSTRUCTIONS%

---++ Info
<!--
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
-->

| Author(s): | Todd Matthews & Steve Purcell (jquery.tweet); Michael Daum (foswiki package) |
| Copyright: | &copy; Copyright (c) 2008-2011 Todd Matthews & Steve Purcell |
| License: | http://www.opensource.org/licenses/mit-license.php |
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| Dependencies: | %$DEPENDENCIES% |
| Home page: | Foswiki:Extensions/%TOPIC% |
| Support: | Foswiki:Support/%TOPIC% |

%META:PREFERENCE{name="NATSKIN_STYLE" title="NATSKIN_STYLE" type="Local" value="jazzynote"}%
16 changes: 16 additions & 0 deletions lib/Foswiki/Contrib/JQTweetContrib.pm
@@ -0,0 +1,16 @@
package Foswiki::Contrib::JQTweetContrib;

use strict;
use warnings;

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

sub init {
require Foswiki::Plugins::JQueryPlugin ();
Foswiki::Plugins::JQueryPlugin::registerPlugin("tweet", "Foswiki::Contrib::JQTweetContrib::Core");
}

1;
8 changes: 8 additions & 0 deletions lib/Foswiki/Contrib/JQTweetContrib/Config.spec
@@ -0,0 +1,8 @@
# ---+ Extensions
# ---++ JQueryPlugin
# ---+++ Extra plugins
# **STRING**
$Foswiki::cfg{JQueryPlugin}{Plugins}{Tweet}{Module} = 'Foswiki::Contrib::JQTweetContrib::Core';
# **BOOLEAN**
$Foswiki::cfg{JQueryPlugin}{Plugins}{Tweet}{Enabled} = 1;
1;
30 changes: 30 additions & 0 deletions lib/Foswiki/Contrib/JQTweetContrib/Core.pm
@@ -0,0 +1,30 @@
package Foswiki::Contrib::JQTweetContrib::Core;

use strict;
use warnings;

use Foswiki::Plugins::JQueryPlugin::Plugin ();
our @ISA = qw( Foswiki::Plugins::JQueryPlugin::Plugin );

sub new {
my $class = shift;

my $this = bless(
$class->SUPER::new(
name => 'Tweet',
version => '95445312de',
author => 'Todd Matthews & Steve Purcell',
homepage => 'http://tweet.seaofclouds.com/',
css => ['jquery.tweet.css'],
javascript => ['jquery.tweet.js', 'jquery.tweet.init.js'],
documentation => 'JQTweetContrib',
puburl => '%PUBURLPATH%/%SYSTEMWEB%/JQTweetContrib',
dependencies => ['metadata'],
),
$class
);

return $this;
}

1;
1 change: 1 addition & 0 deletions lib/Foswiki/Contrib/JQTweetContrib/DEPENDENCIES
@@ -0,0 +1 @@
Foswiki::Plugins::JQueryPlugin,>=4.10,perl,Required
14 changes: 14 additions & 0 deletions lib/Foswiki/Contrib/JQTweetContrib/MANIFEST
@@ -0,0 +1,14 @@
data/System/JQTweetContrib.txt 0644
lib/Foswiki/Contrib/JQTweetContrib/Config.spec 0644
lib/Foswiki/Contrib/JQTweetContrib/Core.pm 0644
lib/Foswiki/Contrib/JQTweetContrib.pm 0644
pub/System/JQTweetContrib/jquery.tweet.css 0644
pub/System/JQTweetContrib/jquery.tweet.css.gz 0644
pub/System/JQTweetContrib/jquery.tweet.init.js 0644
pub/System/JQTweetContrib/jquery.tweet.init.js.gz 0644
pub/System/JQTweetContrib/jquery.tweet.init.uncompressed.js 0644
pub/System/JQTweetContrib/jquery.tweet.js 0644
pub/System/JQTweetContrib/jquery.tweet.js.gz 0644
pub/System/JQTweetContrib/jquery.tweet.uncompressed.css 0644
pub/System/JQTweetContrib/jquery.tweet.uncompressed.js 0644
pub/System/JQTweetContrib/Makefile 0644
24 changes: 24 additions & 0 deletions lib/Foswiki/Contrib/JQTweetContrib/build.pl
@@ -0,0 +1,24 @@
#!/usr/bin/perl -w
BEGIN { unshift @INC, split( /:/, $ENV{FOSWIKI_LIBS} ); }
use Foswiki::Contrib::Build;

# Create the build object
$build = new Foswiki::Contrib::Build('JQTweetContrib');

# (Optional) Set the details of the repository for uploads.
# This can be any web on any accessible Foswiki installation.
# These defaults will be used when expanding tokens in .txt
# files, but be warned, they can be overridden at upload time!

# name of web to upload to
$build->{UPLOADTARGETWEB} = 'Extensions';
# Full URL of pub directory
$build->{UPLOADTARGETPUB} = 'http://foswiki.org/pub';
# Full URL of bin directory
$build->{UPLOADTARGETSCRIPT} = 'http://foswiki.org/bin';
# Script extension
$build->{UPLOADTARGETSUFFIX} = '';

# Build the target on the command line, or the default target
$build->build($build->{target});

9 changes: 9 additions & 0 deletions pub/System/JQTweetContrib/Makefile
@@ -0,0 +1,9 @@
FOSWIKI_ROOT?=~/foswiki/trunk/core
TARGET=jquery.tweet.js jquery.tweet.css jquery.tweet.init.js
CP=cp

-include $(FOSWIKI_ROOT)/pub/System/JQueryPlugin/Makefile.include

jquery.tweet.uncompressed.js: git/tweet/jquery.tweet.js
@echo copying $< to $@
@$(CP) $< $@
20 changes: 20 additions & 0 deletions pub/System/JQTweetContrib/jquery.tweet.init.uncompressed.js
@@ -0,0 +1,20 @@
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:''
};

$(".jqTweet:not(.jqInitedTweet)").livequery(function() {
var $this = $(this), opts = $.extend({}, defaults, $this.metadata());

$this.addClass("jqInitedTweet").tweet(opts);
});
});
39 changes: 39 additions & 0 deletions pub/System/JQTweetContrib/jquery.tweet.uncompressed.css
@@ -0,0 +1,39 @@
.tweet_list {
list-style: none;
margin: 0;
padding: 0;
overflow-y: hidden;
}

.tweet_list .awesome,
.tweet_list .epic {
text-transform: uppercase;
}

.tweet_list li {
overflow-y: auto;
overflow-x: hidden;
padding: 1.0em 0;
border-top:1px solid #ddd;
list-style-type: none;
}
.tweet_list li.tweet_first {
border-top:0px;
}

.tweet_list li a {
/*color: #0C717A;*/
}

.tweet_list .tweet_even {
/*background-color: #91E5E7;*/
}

.tweet_list .tweet_avatar {
padding-right: .5em;
float: left;
}

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

0 comments on commit 14cc5ca

Please sign in to comment.