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

Diff of /contributions/modules/signit/signit.js

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

revision 1.2.2.1, Wed Sep 12 12:12:45 2007 UTC revision 1.2.2.2, Wed Nov 28 01:45:46 2007 UTC
# Line 1  Line 1 
1  // $Id: signit.js,v 1.2 2007/06/22 14:38:07 douggreen Exp $  ; $Id: $
2    
3  if (Drupal.jsEnabled) {  //SignIt Admin Settings page functions
   /**  
    * Lots of help from:  
    * http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/  
    */  
   jQuery.fn.hide_and_seek = function() { return this.each(function() {  
     var label = jQuery(this).prev('label').hide();  
     jQuery(this).next('.description').hide();  
   
     // get jQuery version of 'this'  
     // NOTE: since jQuery() returns a cached value that gets destroyed  
     // this can't be done until after the hide's above.  
     var t = jQuery(this);  
   
     // set the default value based on the label  
     var labelvalue = label[0].innerHTML;  
     if (labelvalue) {  
       var pos = labelvalue.indexOf(':');  
       if (pos >= 0) {  
         var required = labelvalue.indexOf(': <') >= 0 ? ' (*)' : '';  
         labelvalue = labelvalue.substr(0, pos) + required;  
       }  
       t.defaultvalue = labelvalue;  
     }  
     // @TODO: if there isn't a label, take the default from the description  
4    
5      if (t.defaultvalue) {  $(document).ready(function() {
       // on blur, set value to title attr if text is blank  
       t.blur(function(){  
         if (t.val() == '') {  
           t.val(t.defaultvalue);  
           t.addClass('blur');  
         }  
       });  
   
       // on focus, set value to blank if current value matches defaultvalue  
       t.focus(function(){  
         if (t.val() == t.defaultvalue) {  
           t.val('');  
           t.removeClass('blur');  
         }  
       });  
6    
7        // now change all inputs to title    // DATES
8        t.blur();    // on page open show or hide fields
9      if (! $('#edit-signit-use-dates:checked').val()) {
10        $('#signit_dates').hide();
11      }
12    
13      // on page open show or hide fields
14      $('#edit-signit-use-dates').click(function () {
15        if (this.checked) {
16          $('#signit_dates').show('slow');
17        }
18        else {
19          $('#signit_dates').hide('slow');
20      }      }
21    });}    });
22    
23    $(document).ready(    // STATISTICS
24      function() {    // on page open show or hide fields
25        $('.block-signit input').hide_and_seek();    if (! $('#edit-signit-statistics:checked').val()) {
26        $('.block-signit form').submit(function() {      $('#signit_stats').hide();
27          $('.block-signit input').focus();    }
28        });  
29      // on page open show or hide fields
30      $('#edit-signit-statistics').click(function () {
31        if (this.checked) {
32          $('#signit_stats').show('slow');
33        }
34        else {
35          $('#signit_stats').hide('slow');
36      }      }
37    );    });
38  }  
39    
40    });

Legend:
Removed from v.1.2.2.1  
changed lines
  Added in v.1.2.2.2

  ViewVC Help
Powered by ViewVC 1.1.2