Make WordPress Core

Changeset 10846


Ignore:
Timestamp:
03/27/2009 04:45:55 PM (17 years ago)
Author:
ryan
Message:

Use Jcrop for cropping. see #9375

Location:
trunk
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/custom-header.php

    r10623 r10846  
    8080                        wp_enqueue_script('farbtastic');
    8181                elseif ( 2 == $step )
    82                         wp_enqueue_script('cropper');
     82                        wp_enqueue_script('jcrop');
    8383        }
    8484
     
    9191                $step = $this->step();
    9292
    93                 if ( 1 == $step ) {
     93                if ( 1 == $step )
    9494                        wp_enqueue_style('farbtastic');
    95                 }
     95                elseif ( 2 == $step )
     96                        wp_enqueue_style('jcrop');
    9697        }
    9798
     
    216217        function js_2() { ?>
    217218<script type="text/javascript">
    218         function onEndCrop( coords, dimensions ) {
    219                 jQuery( '#x1' ).val(coords.x1);
    220                 jQuery( '#y1' ).val(coords.y1);
     219        function onEndCrop( coords ) {
     220                jQuery( '#x1' ).val(coords.x);
     221                jQuery( '#y1' ).val(coords.y);
    221222                jQuery( '#x2' ).val(coords.x2);
    222223                jQuery( '#y2' ).val(coords.y2);
    223                 jQuery( '#width' ).val(dimensions.width);
    224                 jQuery( '#height' ).val(dimensions.height);
     224                jQuery( '#width' ).val(coords.w);
     225                jQuery( '#height' ).val(coords.h);
    225226        }
    226227
     
    241242                        }
    242243                }
    243                 new Cropper.Img(
    244                         'upload',
    245                         {
    246                                 ratioDim: { x: xinit, y: yinit },
    247                                 displayOnInit: true,
    248                                 onEndCrop: onEndCrop
    249                         }
    250                 )
     244
     245                $('#upload').Jcrop({
     246                        aspectRatio: ratio,
     247                        setSelect: [ 0, 0, xinit, yinit ],
     248                        onSelect: onEndCrop
     249                });
    251250        });
    252251</script>
  • trunk/wp-includes/script-loader.php

    r10845 r10846  
    168168        $scripts->add_data( 'thickbox', 'group', 1 );
    169169
    170 
     170        $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop$suffix.js", array('jquery'), '0.9.5');
     171       
    171172        if ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) {
    172173                $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.2.0-20081031');
     
    449450        $styles->add( 'theme-install', '/wp-admin/css/theme-install.css', array(), '20090319' );
    450451        $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
     452        $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.5' );
    451453
    452454        foreach ( $rtl_styles as $rtl_style )
Note: See TracChangeset for help on using the changeset viewer.