WordPress.org

Make WordPress Core

Ticket #19881: 19881.2.patch

File 19881.2.patch, 6.0 KB (added by ocean90, 6 years ago)

Updated CSS file too

  • wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js

     
    11/*
    22 * imgAreaSelect jQuery plugin
    3  * version 0.9.6
     3 * version 0.9.8
    44 *
    55 * Copyright (c) 2008-2011 Michal Wojciechowski (odyniec.net)
    66 *
     
    5555
    5656        scaleX, scaleY,
    5757
    58         resizeMargin = 10,
    59 
    6058        resize,
    6159
    6260        minWidth, minHeight, maxWidth, maxHeight,
     
    134132        imgOfs.top += ($img.outerHeight() - imgHeight) >> 1;
    135133        imgOfs.left += ($img.outerWidth() - imgWidth) >> 1;
    136134
    137         minWidth = options.minWidth || 0;
    138         minHeight = options.minHeight || 0;
    139         maxWidth = min(options.maxWidth || 1<<24, imgWidth);
    140         maxHeight = min(options.maxHeight || 1<<24, imgHeight);
     135        minWidth = round(options.minWidth / scaleX) || 0;
     136        minHeight = round(options.minHeight / scaleY) || 0;
     137        maxWidth = round(min(options.maxWidth / scaleX || 1<<24, imgWidth));
     138        maxHeight = round(min(options.maxHeight / scaleY || 1<<24, imgHeight));
    141139
    142140        if ($().jquery == '1.3.2' && position == 'fixed' &&
    143141            !docElem['getBoundingClientRect'])
     
    146144            imgOfs.left += max(document.body.scrollLeft, docElem.scrollLeft);
    147145        }
    148146
    149         parOfs = $.inArray($parent.css('position'), ['absolute', 'relative']) + 1 ?
     147        parOfs = /absolute|relative/.test($parent.css('position')) ?
    150148            { left: round($parent.offset().left) - $parent.scrollLeft(),
    151149                top: round($parent.offset().top) - $parent.scrollTop() } :
    152150            position == 'fixed' ?
     
    365363    }
    366364
    367365    function selectingMouseMove(event) {
    368         x2 = resize == '' || /w|e/.test(resize) || aspectRatio ? evX(event) : viewX(selection.x2);
    369         y2 = resize == '' || /n|s/.test(resize) || aspectRatio ? evY(event) : viewY(selection.y2);
     366        x2 = /w|e|^$/.test(resize) || aspectRatio ? evX(event) : viewX(selection.x2);
     367        y2 = /n|s|^$/.test(resize) || aspectRatio ? evY(event) : viewY(selection.y2);
    370368
    371369        doResize();
    372370
     
    408406
    409407        resize = '';
    410408
    411         if ($outer.is(':not(:visible)'))
     409        if (!$outer.is(':visible'))
    412410            $box.add($outer).hide().fadeIn(options.fadeSpeed||0);
    413411
    414412        shown = true;
     
    427425
    428426        setSelection(selX(x1), selY(y1), selX(x1), selY(y1));
    429427
    430         options.onSelectChange(img, getSelection());
    431         options.onSelectEnd(img, getSelection());
     428        if (!this instanceof $.imgAreaSelect) {
     429            options.onSelectChange(img, getSelection());
     430            options.onSelectEnd(img, getSelection());
     431        }
    432432    }
    433433
    434434    function imgMouseDown(event) {
     
    606606        $box.append($area.add($border).add($areaOpera).add($handles));
    607607
    608608        if ($.browser.msie) {
    609             if (o = $outer.css('filter').match(/opacity=([0-9]+)/))
     609            if (o = $outer.css('filter').match(/opacity=(\d+)/))
    610610                $outer.css('opacity', o[1]/100);
    611             if (o = $border.css('filter').match(/opacity=([0-9]+)/))
     611            if (o = $border.css('filter').match(/opacity=(\d+)/))
    612612                $border.css('opacity', o[1]/100);
    613613        }
    614614
     
    656656
    657657    this.setSelection = setSelection;
    658658
     659    this.cancelSelection = cancelSelection;
     660
    659661    this.update = doUpdate;
    660662
    661663    $p = $img;
     
    689691    img.complete || img.readyState == 'complete' || !$img.is('img') ?
    690692        imgLoad() : $img.one('load', imgLoad);
    691693
    692     if ($.browser.msie && $.browser.version >= 9)
     694   if ($.browser.msie && $.browser.version >= 7)
    693695        img.src = img.src;
    694696};
    695697
  • wp-includes/js/imgareaselect/imgareaselect.css

     
    2020
    2121.imgareaselect-border1, .imgareaselect-border2,
    2222.imgareaselect-border3, .imgareaselect-border4 {
     23    filter: alpha(opacity=50);
    2324        opacity: 0.5;
    24     filter: alpha(opacity=50);
    2525}
    2626
    2727.imgareaselect-handle {
    2828    background-color: #fff;
    2929        border: solid 1px #000;
    30         opacity: 0.4;
    31         filter: alpha(opacity=40);
     30    filter: alpha(opacity=50);
     31        opacity: 0.5;
    3232}
    3333
    3434.imgareaselect-outer {
    3535        background-color: #000;
    36         opacity: 0.4;
    37     filter: alpha(opacity=40);
     36    filter: alpha(opacity=50);
     37        opacity: 0.5;
    3838}
    3939
    4040.imgareaselect-selection {
  • wp-includes/script-loader.php

     
    253253
    254254        $scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2011-02-23');
    255255
    256         $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.6-20110515', 1 );
     256        $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.8', 1 );
    257257
    258258        $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), false, 1 );
    259259        $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
     
    475475        $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css' );
    476476        $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u1' );
    477477        $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
    478         $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' );
     478        $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
    479479        $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css" );
    480480        $styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css" );
    481481        $styles->add( 'editor-buttons', "/wp-includes/css/editor$suffix.css" );