[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/js/ -> custom-background.dev.js (source)

   1  var farbtastic;
   2  
   3  function pickColor(color) {
   4      farbtastic.setColor(color);
   5      jQuery('#background-color').val(color);
   6      jQuery('#custom-background-image').css('background-color', color);
   7      if ( color && color !== '#' )
   8          jQuery('#clearcolor').show();
   9      else
  10          jQuery('#clearcolor').hide();
  11  }
  12  
  13  jQuery(document).ready(function() {
  14      jQuery('#pickcolor').click(function() {
  15          jQuery('#colorPickerDiv').show();
  16          return false;
  17      });
  18  
  19      jQuery('#clearcolor a').click( function(e) {
  20          pickColor('');
  21          e.preventDefault();
  22      });
  23  
  24      jQuery('#background-color').keyup(function() {
  25          var _hex = jQuery('#background-color').val(), hex = _hex;
  26          if ( hex.charAt(0) != '#' )
  27              hex = '#' + hex;
  28          hex = hex.replace(/[^#a-fA-F0-9]+/, '');
  29          if ( hex != _hex )
  30              jQuery('#background-color').val(hex);
  31          if ( hex.length == 4 || hex.length == 7 )
  32              pickColor( hex );
  33      });
  34  
  35      jQuery('input[name="background-position-x"]').change(function() {
  36          jQuery('#custom-background-image').css('background-position', jQuery(this).val() + ' top');
  37      });
  38  
  39      jQuery('input[name="background-repeat"]').change(function() {
  40          jQuery('#custom-background-image').css('background-repeat', jQuery(this).val());
  41      });
  42  
  43      farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) {
  44          pickColor(color);
  45      });
  46      pickColor(jQuery('#background-color').val());
  47  
  48      jQuery(document).mousedown(function(){
  49          jQuery('#colorPickerDiv').each(function(){
  50              var display = jQuery(this).css('display');
  51              if ( display == 'block' )
  52                  jQuery(this).fadeOut(2);
  53          });
  54      });
  55  });


Generated: Fri May 25 03:56:23 2012 Hosted by follow the white rabbit.