AJAX start help for an attempt to build a digg.com/reddit.com clone

frjo - February 21, 2006 - 16:51

My "Vote up/down" project http://drupal.org/node/48774 is an attempt to build a digg.com/reddit.com clone. (Project not approved yet so download from cvs.)

I have the voting +1/-1 working via Voting API. The actual voting is done by clicking the up or down arrow that is placed in a voting widget besides nodes. Look at screenshot.

I would like to use AJAX fo the voting so the page need not to reload. Now if you vote on a story on the bottom of the page the page reload and you end up at the top of the page.

Can anyone give som tips where to start?

I have very little experience with AJAX/JavaScript. I know Drupal 4.7 have som AJAX build in (drupal.js), if possible I would like to use that.

Here are some example voting url:s:

+1 vote http://example.com/vote/node/1/1?destination=node
-1
vote http://example.com/vote/node/1/0?destination=node

I've made a module which

budda - February 21, 2006 - 17:18

I've made a module which does the same as (current) Digg.com - where you can just place a vote against some content.

It uses ajax to cast the vote, and appears to work. However there is one little niggly error when voting in IE6.

I've since been busy with other work and not had chance to debug the problem with IE and JavaScript.

As for where to start - i cobbled along in the dark - took a look at misc/autocomplete.js and ajax spellchecker module.

--
More Drupal modules

I'll give it a

pamphile - February 21, 2006 - 19:04

mediumvote

jl79 - February 22, 2006 - 14:08

You could also check out the mediumvote module (from cvs), which also makes use of drupal's ajax functionality.

This look like a really good

frjo - February 22, 2006 - 15:03

This look like a really good place to start, thanks for this tips!

Check out Pligg

FatPitchFinancials - February 25, 2006 - 04:13

frjo, I am very interested in your module. You might want to check out Pligg for some ideas and maybe even some code, since it is an open source project.

I would love it if someone could create the features of Pligg for Drupal. I've been using Pligg for a project that I'm working on, but I'd much rather use Drupal if someone is able to recreate similar features for Drupal. It looks like you might be getting close to doing that.

I really like the up and down arrows feature that you have created. The layout and graphics are great!

Keep up the good work and keep us posted. I'd be more than happy to help you test this out.

I know about Pligg but have

frjo - February 25, 2006 - 08:54

I know about Pligg but have not looked at it closely, yet. If you have some specific features you want please make a feature request issue.

http://drupal.org/node/add/project_issue/voteupdown/feature

Concerning Pligg

Yankidank - March 7, 2006 - 20:37

I'm one of the lead developers of Pligg, and I thought you would like to know that we plan to eventually give users the ability to select if they have any existing CMS system that they would like to integrate Pligg with when installing Pligg fresh on their system. Unfortunately, this feature isn't at the very top of our list because we're trying to improve the Pligg code to a much more improved and stable release before expanding out. I have set up a list of CMSs that I would like to integrate w/ Pligg when we get around to it. Drupal is on the list as number 10 of 13. If you end up using the Pligg code let us know on the pligg forums pligg.com/forum/.

1. Vbulletin http://www.vbulletin.com/
2. Wordpress http://wordpress.org/
3. PHPbb http://www.phpbb.com/
4. Geeklog http://www.geeklog.net/
5. Vanilla http://getvanilla.com/
6. Joomla! http://www.joomla.org/
7. Mediawiki http://www.mediawiki.org/wiki/MediaWiki
8. Gallery http://gallery.menalto.com/
9. MODx http://modxcms.com/
10. Drupal http://drupal.org/
11. Postnuke http://www.postnuke.com
12. Punbb http://www.punbb.org/
13. Moodle http://moodle.org/

pligg integration

dodomeister - March 19, 2006 - 12:50

Drupal/pligg-integration would be great.

(currently I'm fighting with pligg's B7R46 and the Smarty error: unable to read resource: "../libs/lang.conf" ...; but anything that puts Drupal integration near Wordpress would be a lovely thing)

its been a while

mrgoltra - February 9, 2008 - 05:27

just wondering what the status on pligg/druapl integration? Has this been scratched.

I actually got it working!

frjo - March 17, 2006 - 11:18

I have managed to get the AJAX part working with the help of "Tutorial 3- Creating new widgets with AJAX" http://drupal.org/node/42562 and the "mediumvote" module http://drupal.org/node/49767.

The voting arrows change according to the vote and the voting points are updated.

Below are the JavaScript I have cobbled together. I would very much appreciate feedback on this code. Can it be made more efficient? Better solutions?

http://cvs.drupal.org/viewcvs/drupal/contributions/modules/vote_up_down/...

got a demo ?

pamphile - March 17, 2006 - 14:54

got a demo ?

Demo at vigillar.se

frjo - March 17, 2006 - 15:26

Demo at http://vigillar.se/. You need to get an account to be able to vote, accounts are free of course.

 
 

Drupal is a registered trademark of Dries Buytaert.