Using twitter.js with Cufon... HELP!

112 views
Skip to first unread message

Rovettidesign

unread,
Dec 3, 2009, 4:33:08 PM12/3/09
to cufón
I have a page that I'm trying to personalize, and am totally missing
the boat on how to use Cufon with Twitter.js .

Twitter.js simply loads your most recent tweet into your defined DIV.
For some reason (I guess because it's dynamically generated after the
page loads (there's a delay between Twitter and the page itself?)
Cufon misses it.

Twitter.js linki here http://remysharp.com/2007/05/18/add-twitter-to-your-blog-step-by-step/

I've been able to replace text in the <DIV>, but not the js generated
text.

Can anyone help me out there?

Code to follow....
What am I missing?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Rovetti Tweets</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/twitter.css" rel="stylesheet" type="text/css" />

<script src="cufon-yui.js" type="text/javascript"></script>
<script src="MY.font.js" type="text/javascript"></script>
<script type="text/javascript"> Cufon.now(); </script>
<script type="text/javascript">
Cufon.replace('#tweet_container')
Cufon.replace('#container')
Cufon.replace('#twitterStatus')
Cufon.replace('ul')
Cufon.replace('li')

</script>

<script src="js/twitter.js" type="text/javascript" charset="utf-8"></
script>
<script type="text/javascript" charset="utf-8">
getTwitters('MYTweets', {
id: 'MY TWITTERNAME',
prefix: '<a href="http://twitter.com/%screen_name%">%name%</a>
said: ',
clearContents: false, // leave the original message in place
count: 1,
withFriends: true,
ignoreReplies: false,
newwindow: true
});

</script>
</head>

<body>
<div id="wrapper">
<div id="top-buffer"></div>
<div id="container">
<div id="tweet_container"> <div class="twitters" id="MYTweets"></
div>
</div>

</div>
</div>
<script type="text/javascript">
Cufon.refresh('#twitterStatus')
Cufon.refresh('#container')


</script>
</body>
</html>

Simo Kinnunen

unread,
Dec 6, 2009, 1:27:26 PM12/6/09
to cu...@googlegroups.com
Hi,

Try adding callback: Cufon.refresh (note: no brackets) as an option to
the getTwitters call. Or something like this:

getTwitters('MYTweets', {
id: 'MY TWITTERNAME',
prefix: '<a href="http://twitter.com/%screen_name%">%name%</a>
said: ',
clearContents: false, // leave the original message in place
count: 1,
withFriends: true,
ignoreReplies: false,
newwindow: true,
callback: function() {
Cufon.replace('#tweet_container');
}
});

Simo
> --
>
> You received this message because you are subscribed to the Google
> Groups "cufón" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cufon+un...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/cufon?hl=en
> .
>
>

Rovettidesign

unread,
Dec 6, 2009, 5:24:02 PM12/6/09
to cufón
Simo,
I'll try it as soon as I can, and update you. Thanks for the
insight... I think that will probably work!
And btw, thanks for Cufon... it completely rocks the house!

S

On Dec 6, 1:27 pm, Simo Kinnunen <sor...@gmail.com> wrote:
> Hi,
>
> Try adding callback: Cufon.refresh (note: no brackets) as an option to  
> the getTwitters call. Or something like this:
>
>     getTwitters('MYTweets', {
>         id: 'MY TWITTERNAME',
>         prefix: '<a href="http://twitter.com/%screen_name%">%name%</a>
> said: ',
>         clearContents: false, // leave the original message in place
>         count: 1,
>         withFriends: true,
>         ignoreReplies: false,
>         newwindow: true,
>         callback: function() {
>           Cufon.replace('#tweet_container');
>         }
>     });
>
> Simo
>
> On Dec 3, 2009, at 11:33 PM, Rovettidesign wrote:
>
> > I have a page that I'm trying to personalize, and am totally missing
> > the boat on how to use Cufon with Twitter.js .
>
> > Twitter.js simply loads your most recent tweet into your defined DIV.
> > For some reason (I guess because it's dynamically generated after the
> > page loads (there's a delay between Twitter and the page itself?)
> > Cufon misses it.
>
> > Twitter.js linki herehttp://remysharp.com/2007/05/18/add-twitter-to-your-blog-step-by-step/

Rovettidesign

unread,
Dec 7, 2009, 11:29:51 AM12/7/09
to cufón
It worked perfectly... thanks a ton. I'll hook up a link to the
finished product when it's live.
Great deal! Thanks again.

David

unread,
Dec 20, 2009, 6:44:37 PM12/20/09
to cufón

I'm having the same issue as described above - the twitter.js script
pulls in my tweet, but isn't styled in the cufon replacement text.
However when I added the callback function, it broke my script; I see
no twitter feed, nor stylized text. Any help would be appreciated - my
script is below:

<script src="http://twitterjs.googlecode.com/svn/trunk/src/
twitter.min.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
getTwitters('twitters', {
  id: 'myusername',
  count: 1,
  enableLinks: false,
  ignoreReplies: true,
  clearContents: false,
template: '<span class="status">%text%</span><br><span
class="time">%time%</span>'
  callback: function() {
          Cufon.replace('#twitters');
  }
});

this is what I've got in my cufon.js script:

Cufon.replace('#twitters');
Cufon.replace('.status');
Cufon.replace('.time');

and this is from my style sheet:

#twitters {
border: 0px;
padding: 0px;
}
#twitters UL {
list-style: none;
padding: 0;
}
.time {
color: white;
font-size: 31px;
font-weight: normal;
line-height: 25px;
font-style:italic;
}
.status {
color: #00aeef;
font-size: 31px;
font-weight: normal;
line-height: 25px;
}

Any thoughts?

Thanks in advance,
david

Simo Kinnunen

unread,
Dec 20, 2009, 7:40:45 PM12/20/09
to cu...@googlegroups.com
Hi David,

It looks like you're missing a comma after the template option. Each
option *except the last one* (this is very important) should be
followed by a comma.

Simo

David

unread,
Dec 20, 2009, 9:16:17 PM12/20/09
to cufón

Simo,

That worked! Thanks!

david

Reply all
Reply to author
Forward
0 new messages