/[drupal]/contributions/modules/twitter/twitter.js
ViewVC logotype

Contents of /contributions/modules/twitter/twitter.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Wed Jun 18 03:34:33 2008 UTC (17 months, 1 week ago) by eaton
Branch: MAIN
CVS Tags: DRUPAL-6--2-6, DRUPAL-6--2-5, DRUPAL-6--2-4, DRUPAL-6--2-3, DRUPAL-6--2-2, DRUPAL-6--2-1, DRUPAL-6--2-0, HEAD
Branch point for: DRUPAL-6--2, DRUPAL-6--3
Changes since 1.1: +8 -8 lines
File MIME type: text/javascript
Some additional changes to the API before a real 6.x release is rolled, including more extensive PHPDoc for all the public functions. Full Views2 integration, with a handy default view that shows latest tweets by the author of the current node. Freakin Twitter, man.
1 // $Id: twitter.js,v 1.1 2008/06/08 04:48:33 walkah Exp $
2
3 /**
4 * Attach handlers to count the number of words in a given textfield, in its
5 * description.
6 */
7 $(document).ready(function() {
8 $("#twitter-textfield").keyup(function() {
9 var charsLeft = (140 - $(this).val().length);
10 var descDiv = $(this).parent().parent().parent().children(".description");
11 $(descDiv).html("<strong>" + charsLeft + "</strong> characters remaining");
12 if (charsLeft < 0) {
13 $(descDiv).addClass("negative");
14 $("#twitter-post-button").attr('disabled', 'true');
15 } else {
16 $(descDiv).removeClass("negative");
17 $("#twitter-post-button").removeAttr('disabled');
18 }
19 });
20
21 if (!$("#twitter-toggle").attr("checked")) {
22 $("#twitter-textfield-wrapper").hide();
23 $("#twitter-account-wrapper").hide();
24 }
25
26 $("#twitter-toggle").bind("click", function() {
27 if ($("#twitter-toggle").attr("checked")) {
28 $("#twitter-textfield-wrapper").show();
29 $("#twitter-account-wrapper").show();
30 }
31 else {
32 $("#twitter-textfield-wrapper").hide();
33 $("#twitter-account-wrapper").hide();
34 }
35 });
36 });

  ViewVC Help
Powered by ViewVC 1.1.2