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

Contents of /contributions/modules/whatcounts/whatcounts.js

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


Revision 1.1 - (show annotations) (download) (as text)
Fri Oct 17 00:35:34 2008 UTC (13 months, 1 week ago) by spiderman
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5
File MIME type: text/javascript
Initial commit of whatcounts module. Provides blocks to allow users to subscribe to WhatCounts mailing list service
1 // $Id$
2
3 // Global killswitch: only run if we are in a supported browser.
4 if (Drupal.jsEnabled) {
5 $(document).ready(function(){
6
7 // this is where the selector goes, and then attach a behaviour like on p.218 of learning jQuery
8 var emailLabel = $('#whatcounts-block-form-1 label').remove().text().replace(/: $/,"");
9
10 var emailDefault = $('#edit-email').val();
11 var emailField = $('#edit-email');
12 if (emailDefault == '') {
13 $('#edit-email').addClass('placeholder').val(emailLabel);
14 }
15 $('#edit-email') .focus(function() {
16 if (this.value == emailLabel) {
17 $(this).removeClass('placeholder').val('');
18 };
19 }).blur(function() {
20 if (this.value == '') {
21 $(this).addClass('placeholder').val(emailLabel);
22 }
23 });
24
25 // Empty the placeholder value if it's still there on submit
26 $('#whatcounts-block-form-1').submit(function() {
27 if ($('#edit-email').val() == emailLabel) {
28 $('#edit-email').val('');
29 }
30 });
31 });
32 }

  ViewVC Help
Powered by ViewVC 1.1.2