Project:Juitter - jQuery Twitter live search feeds
Version:6.x-1.3
Component:Code
Category:feature request
Priority:normal
Assigned:Mohammed J. Razem
Status:needs review

Issue Summary

I love your Juitter module -- great work.

Can you create a juitter block with it? If not, that would be a great feature.

Comments

#1

Version:6.x-1.0» 6.x-1.3
Assigned to:Anonymous» Mohammed J. Razem

Hey, ya I guess it will be possible!
Will work on it on the next release hopefully.

#2

Let me know if I can do anything to help -- maybe help with documentation. Or help raise a bounty.

Cheers,
Kevin

#3

AttachmentSize
1.jpg 32.12 KB

#4

subscribing

I'd love to see one as well.

#5

subscribe

#6

I would really like to see this included in a block also. Thanks.

#7

Ditto. Nice work.

#8

You can create a block with this chunk of code...

<?php
drupal_add_js
('sites/all/modules/juitter/js/jquery.juitter.js','module');
drupal_add_js('sites/all/modules/juitter/js/system.js','module');
drupal_add_css('sites/all/modules/juitter/css/juitter.css','module');
drupal_add_js('
$(document).ready(function() {
$.Juitter.start({
  searchType:"searchWord",
  searchObject:"seattle",
  live:"live-5",
  total:"5"
});
});
'
,'inline');
?>

<div id="juitterContainer"></div>

#9

Tried creating a block with this, but can't get it to work. Is there some trick I'm missing? Thanks.

#10

Make sure you have set the input field of the block to PHP Filter.
Also make sure you have juitter working as a page first

#11

I already have everything set up that way, but nothing shows up in the block.

#12

It seems to be working fine for me. Do you have the phpfilter module enabled?

#13

I got it to display after installing phpfilter. Thanks.

#14

I am noticing an error in my reports, and missing file inside the module: js/system.js

Did I miss something on the install?

#15

I received that same error.. I just grabbed system.js from the actual juitter plugin (http://juitter.com/)

hope that helps

#16

I'm having an issue and am hoping that others may have had it as well and found a resolution. I've set up a block using the nice bit of code provided by doublejosh. In this block I'm doing a search on a specific term. When I load the page with that block in it I find around half the time it displays the proper search and half of the time it just displays an unfiltered twitter stream. I can reload the page over and over again and sometimes I get the search, and other times the unfiltered stream.

Has anyone else had this issue? Any thoughts on what's going on here? My gut reaction is that something is happening to override the search term that is set up in the php in the block.. but I don't know how to resolve that.

#17

add this to juitter.module perhaps?

function juitter_block($op='list', $delta=0) {

if ($op == "list") {
// Generate listing of blocks from this module, for the admin/block page
$block = array();
$block[0]["info"] = t('Juitter');
return $block;
}
else if ($op == 'configure' && $delta == 0) {

return $form;
}
else if ($op == 'view') {
juitter_add_files(true);
$trends = juitter_get_settings();
foreach ($trends as $trend) {
$key = 'trend_' . $trend['trend_id'];
$tabs[$key] = array(
'href' => '#' . $key,
'title' => $trend['title'],
'attributes' => array(
'id' => $key,
'class' => 'juitterTab'
),
);
}
$trends = theme('juitter_tabs', $tabs);
if (variable_get('juitter_search', 1) != 0) {
$search_phrase = t(variable_get('juitter_search_text', 'Search twitter:'));
$search = "\n
\n
";
$block['content'] = theme('juitter', $trends, $search);
}
else $block['content'] = theme('juitter', $trends);

return $block;
}

}

#18

Doublejosh' technique worked gr8 for me. However i want to ONLY show everything of a specific hashtag. How do i go about doing this from within the block?

Thanks in advance

#19

@8 Thanks for the code doublejosh. How would one go about using php variables in replacement of the searchobject. Say you wanted to print the result of a CCK text field (that a user inputs in a node form) to be the searchobject. My use case is to allow a user to display a live feed of related tweets to a blog post. This is better illustrated by the attached image I suppose.

I'm looking to print something like $node->field_twitter either in a node.tpl or block.

Thanks again everyone, particularly to doublethink for making such a superb module.

Thomas

AttachmentSize
Screen shot 2010-06-04 at 1.06.22 PM.png 231 KB

#20

If you want to start adding the value of a CCK field or other dynamic piece of content I'm assuming you are using this snippet in a node template?

This is the important line in terms of the search term: searchObject:"seattle",

Just make sure your javascript and PHP are all escaped properly and not mixing up quotes.

Also, keep in mind you can do more complex search queries with OR and AND and GEO with proximity in there too. Go play with search.twitter.com to find out the search syntax.

<?php
$keywords
= $node->field_juitter_search_string[0][value];

drupal_add_js('sites/all/modules/juitter/js/jquery.juitter.js','module');
drupal_add_js('sites/all/modules/juitter/js/system.js','module');
drupal_add_css('sites/all/modules/juitter/css/juitter.css','module');

drupal_add_js('
$(document).ready(function() {
$.Juitter.start({
  searchType:"'
. $keywords . '",
  searchObject:"seattle",
  live:"live-5",
  total:"5"
});
});
'
,'inline');
?>

Also, thanks doublethink.

I'm using all this stuff for the front page of http://iheartsea.com

#21

Hi guys, I stalled and set the module, but I didn't see anywhere I can display it on my site, should I create a node or block to make it work? thanks.

#22

There is a page with twitter updates http://www.mysite.com/juitter

Ideally, it would be great to have blocks "out-of-the-box"

#23

I agree that the Juitter module creating both a page and a block would be an excellent next update.

#24

doublejosh - thanks for the code to create a block from a search, it worked perfectly. Is there a way to create a block with all the content of the juitter page, showing all the Juitter trends (users, keyword search) and the search box rather than just one search item? Any suggestions? Thanks.

#25

jrb207 I haven't really even used the Juitter module much I just thought it would be right to use it's libraries for my block needs. I'm sure there are some functions in the module you could call to dump trends or whatever you're looking for into a block... probably.

Also, this is a good spot to re-paste the code since I made a super dumb swap of where the keyword code should go...

<?php
$keywords
= $node->field_juitter_search_string[0][value];

drupal_add_js('sites/all/modules/juitter/js/jquery.juitter.js','module');
drupal_add_js('sites/all/modules/juitter/js/system.js','module');
drupal_add_css('sites/all/modules/juitter/css/juitter.css','module');

drupal_add_js('
$(document).ready(function() {
$.Juitter.start({
  searchType:"searchWord",
  searchObject:"'
. $keywords . '",
  live:"live-5",
  total:"5"
});
});
'
,'inline');
?>

Someone want to show me how to do this with the jQuery.extend(Drupal.settings... way, rather than the inline technique?

#26

Hi

I finally found a fix for this double up stuff. System.js defines a set of default search terms based around iphones & ipods.

Remove this line from your block and it should be fine
drupal_add_js('sites/all/modules/juitter/js/system.js','module');

Seems to load in correctly every time for me now.

Hope that helps
Thanks
Gregg

#27

Hi all,

Just in case anyone else is trying to figure out how to limit their block feed to just English, after a bit of testing I think this works:

$.Juitter.start({
  searchType:"searchWord",
  searchObject:"searchterm",
  lang:"en",
  live:"live-20",
  total:"5"
});

(After reading the code I've changed my live: setting to "live-20". It determines how often, in seconds, your page checks back with Twitter for new feeds. I don't need it checking every 5 seconds.)

Hope this helps the next person trying to figure that out.

#28

Hello,
I created Juitter Page no problem, used the above code from doublejosh[Thank You Josh], the searchType = "fromUser" , not "searchWord", unfortunately nothing is showing in my block, not sure what the issue is, phpfilter is enabled, input php is checked. Thanks in advance your help.

code:

<?php
drupal_add_js
('sites/all/modules/juitter/js/jquery.juitter.js','module');
drupal_add_js('sites/all/modules/juitter/js/system.js','module');
drupal_add_css('sites/all/modules/juitter/css/juitter.css','module');
drupal_add_js('
$(document).ready(function() {
$.Juitter.start({
  searchType:"fromUser",
  searchObject:"twitterusr",
  live:"live-5",
  total:"5"
});
});
'
,'inline');
?>

#29

Search results on @username have less results (not all posts from the user) while a user timeline has all of it.

Believe this is because search is a different system that indexes on content keywords and only includes posts with certain amounts of some kind of karma, like views, retweets of something. Not 100% sure.

Pretty sure Juitter runs on search not on timelines, even for user results.

#30

Good Morning Josh

Thanks for responding so quickly! Even though I can see "tweeter username" search results, on mysite.com/juitter page, transferring this over to a block, won't show those results?

#31

I'm sorry. I don't know much about the actual working of the Juitter page, since I just installed the module to use the libraries and create a custom block.

Perhaps you could see how the juitter page implementation javascript differs from this thread's javascript?

#32

Josh,
I could kick myself, once you said compare code. I looked at your code (normal I do put 3rd party modules in "all), I put juitter in the site folder. Thank you so much for you patience. User-error... *warning* *warning*. Have a great evening!

#33

Josh,
That was the issue, made the correction to the file path and all is good. I haven't been able to figure out how to remove the pikes and dashes that display after after, readmore, date and time ..etc...

#34

That stuff is either in the system.js or jquery.juitter.js files. You have to dig a bit, but not too hard to control.
Bit of a bummer that you have to alter the juitter library itself, but you can't exactly hook_alter the js code that creates HTML on the fly.

I know I swapped a bunch of that out on my site: http://iheartsea.com

#35

Hello, a solution to this problem is to create a block either within the same module or to one that depends on this and contains the following code:

function juitter_block($op='list', $delta=0, $edit=array()){
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Juitter Block');
$blocks[0]['cache'] = BLOCK_NO_CACHE;
return $blocks;
case 'view':
$block['content'] = juitter_page();
return $block;
}
}

AttachmentSize
03-05-2011 09-00-08 a.m..png 74.98 KB

#36

Status:active» needs review

The following patch adds a block based on comment #35.

AttachmentSize
juitter-block-563784.patch 603 bytes