[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-content/themes/twentyeleven/inc/ -> theme-options.js (source)

   1  var farbtastic;
   2  
   3  (function($){
   4      var pickColor = function(a) {
   5          farbtastic.setColor(a);
   6          $('#link-color').val(a);
   7          $('#link-color-example').css('background-color', a);
   8      };
   9  
  10      $( function() {
  11          $('#default-color').wrapInner('<a href="#" />');
  12  
  13          farbtastic = $.farbtastic('#colorPickerDiv', pickColor);
  14  
  15          pickColor( $('#link-color').val() );
  16  
  17          $('.pickcolor').click( function(e) {
  18              $('#colorPickerDiv').show();
  19              e.preventDefault();
  20          });
  21  
  22          $('#link-color').keyup( function() {
  23              var a = $('#link-color').val(),
  24                  b = a;
  25  
  26              a = a.replace(/[^a-fA-F0-9]/, '');
  27              if ( '#' + a !== b )
  28                  $('#link-color').val(a);
  29              if ( a.length === 3 || a.length === 6 )
  30                  pickColor( '#' + a );
  31          });
  32  
  33          $(document).mousedown( function() {
  34              $('#colorPickerDiv').hide();
  35          });
  36  
  37          $('#default-color a').click( function(e) {
  38              pickColor( '#' + this.innerHTML.replace(/[^a-fA-F0-9]/, '') );
  39              e.preventDefault();
  40          });
  41  
  42          $('.image-radio-option.color-scheme input:radio').change( function() {
  43              var currentDefault = $('#default-color a'),
  44                  newDefault = $(this).next().val();
  45  
  46              if ( $('#link-color').val() == currentDefault.text() )
  47                  pickColor( newDefault );
  48  
  49              currentDefault.text( newDefault );
  50          });
  51      } );
  52  })(jQuery);


Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref