Update imgAreaSelect to 0.9.10. fixes #25370.

git-svn-id: https://develop.svn.wordpress.org/trunk@25545 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2013-09-21 10:42:55 +00:00
parent 24294b97e4
commit 4423693048
2 changed files with 25 additions and 18 deletions

View File

@ -1,8 +1,8 @@
/*
* imgAreaSelect jQuery plugin
* version 0.9.9
* version 0.9.10
*
* Copyright (c) 2008-2011 Michal Wojciechowski (odyniec.net)
* Copyright (c) 2008-2013 Michal Wojciechowski (odyniec.net)
*
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
@ -117,6 +117,9 @@ $.imgAreaSelect = function (img, options) {
/* Document element */
docElem = document.documentElement,
/* User agent */
ua = navigator.userAgent,
/* Various helper variables used throughout the code */
$p, d, i, o, w, h, adjusted;
@ -253,11 +256,11 @@ $.imgAreaSelect = function (img, options) {
*/
function adjust() {
/*
* Do not adjust if image width is not a positive number. This might
* happen when imgAreaSelect is put on a parent element which is then
* hidden.
* Do not adjust if image has not yet loaded or if width is not a
* positive number. The latter might happen when imgAreaSelect is put
* on a parent element which is then hidden.
*/
if (!$img.width())
if (!imgLoaded || !$img.width())
return;
/*
@ -368,7 +371,7 @@ $.imgAreaSelect = function (img, options) {
* Need to reset the document keypress event handler -- unbind the
* current handler
*/
if ($.imgAreaSelect.keyPress != docKeyPress)
if ($.imgAreaSelect.onKeyPress != docKeyPress)
$(document).unbind($.imgAreaSelect.keyPress,
$.imgAreaSelect.onKeyPress);
@ -393,7 +396,7 @@ $.imgAreaSelect = function (img, options) {
* borderOpacity, borderColor1, and borderColor2 options (which are now
* deprecated). Borders created with GIF background images are fine.
*/
if ($.browser.msie && $border.outerWidth() - $border.innerWidth() == 2) {
if (msie && $border.outerWidth() - $border.innerWidth() == 2) {
$border.css('margin', 0);
setTimeout(function () { $border.css('margin', 'auto'); }, 0);
}
@ -962,12 +965,12 @@ $.imgAreaSelect = function (img, options) {
$($border[1]).css({ borderStyle: 'dashed', borderColor: o });
/* Append all the selection area elements to the container box */
$box.append($area.add($border).add($areaOpera).add($handles));
$box.append($area.add($border).add($areaOpera)).append($handles);
if ($.browser.msie) {
if (o = $outer.css('filter').match(/opacity=(\d+)/))
if (msie) {
if (o = ($outer.css('filter')||'').match(/opacity=(\d+)/))
$outer.css('opacity', o[1]/100);
if (o = $border.css('filter').match(/opacity=(\d+)/))
if (o = ($border.css('filter')||'').match(/opacity=(\d+)/))
$border.css('opacity', o[1]/100);
}
@ -1076,6 +1079,11 @@ $.imgAreaSelect = function (img, options) {
*/
this.update = doUpdate;
/* Do the dreaded browser detection */
var msie = (/msie ([\w.]+)/i.exec(ua)||[])[1],
opera = /opera/i.test(ua),
safari = /webkit/i.test(ua) && !/chrome/i.test(ua);
/*
* Traverse the image's parent elements (up to <body>) and find the
* highest z-index
@ -1098,14 +1106,13 @@ $.imgAreaSelect = function (img, options) {
*/
zIndex = options.zIndex || zIndex;
if ($.browser.msie)
if (msie)
$img.attr('unselectable', 'on');
/*
* In MSIE and WebKit, we need to use the keydown event instead of keypress
*/
$.imgAreaSelect.keyPress = $.browser.msie ||
$.browser.safari ? 'keydown' : 'keypress';
$.imgAreaSelect.keyPress = msie || safari ? 'keydown' : 'keypress';
/*
* There is a bug affecting the CSS cursor property in Opera (observed in
@ -1114,7 +1121,7 @@ $.imgAreaSelect = function (img, options) {
* event, we're adding an additional div to $box and we're going to toggle
* it when mouse moves inside the selection area.
*/
if ($.browser.opera)
if (opera)
$areaOpera = div().css({ width: '100%', height: '100%',
position: 'absolute', zIndex: zIndex + 2 || 2 });
@ -1143,7 +1150,7 @@ $.imgAreaSelect = function (img, options) {
* attribute seems to trigger it. The check is for version 7 and above to
* accommodate for MSIE 9 running in compatibility mode.
*/
if (!imgLoaded && $.browser.msie && $.browser.version >= 7)
if (!imgLoaded && msie && msie >= 7)
img.src = img.src;
};

File diff suppressed because one or more lines are too long