vendor/assets/javascripts/jquery.imgareaselect.js in imgareaselect-rails-1.0.0 vs vendor/assets/javascripts/jquery.imgareaselect.js in imgareaselect-rails-1.0.1

- old
+ new

@@ -1,10 +1,10 @@ /* * imgAreaSelect jQuery plugin - * version 0.9.8 + * version 0.9.9 * - * Copyright (c) 2008-2011 Michal Wojciechowski (odyniec.net) + * Copyright (c) 2008-2012 Michal Wojciechowski (odyniec.net) * * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * http://odyniec.net/projects/imgareaselect/ @@ -119,11 +119,11 @@ selection.width = selection.x2 - selection.x1; selection.height = selection.y2 - selection.y1; } function adjust() { - if (!$img.width()) + if (!imgLoaded || !$img.width()) return; imgOfs = { left: round($img.offset().left), top: round($img.offset().top) }; imgWidth = $img.innerWidth(); @@ -192,11 +192,11 @@ $handles.slice(1,3).css({ left: w }); $handles.slice(2,4).css({ top: h }); } if (resetKeyPress !== false) { - if ($.imgAreaSelect.keyPress != docKeyPress) + if ($.imgAreaSelect.onKeyPress != docKeyPress) $(document).unbind($.imgAreaSelect.keyPress, $.imgAreaSelect.onKeyPress); if (options.keys) $(document)[$.imgAreaSelect.keyPress]( @@ -423,11 +423,11 @@ .unbind('mouseup', cancelSelection); hide($box.add($outer)); setSelection(selX(x1), selY(y1), selX(x1), selY(y1)); - if (!this instanceof $.imgAreaSelect) { + if (!(this instanceof $.imgAreaSelect)) { options.onSelectChange(img, getSelection()); options.onSelectEnd(img, getSelection()); } } @@ -533,11 +533,11 @@ return false; }; function styleOptions($elem, props) { - for (option in props) + for (var option in props) if (options[option] !== undefined) $elem.css(props[option], options[option]); } function setOptions(newOptions) { @@ -604,13 +604,13 @@ $($border[1]).css({ borderStyle: 'dashed', borderColor: o }); $box.append($area.add($border).add($areaOpera).add($handles)); if ($.browser.msie) { - if (o = $outer.css('filter').match(/opacity=(\d+)/)) + 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); } if (newOptions.hide) hide($box.add($outer)); @@ -689,10 +689,10 @@ $area.add($border).css({ position: 'absolute', fontSize: 0 }); img.complete || img.readyState == 'complete' || !$img.is('img') ? imgLoad() : $img.one('load', imgLoad); - if ($.browser.msie && $.browser.version >= 7) + if (!imgLoaded && $.browser.msie && $.browser.version >= 7) img.src = img.src; }; $.fn.imgAreaSelect = function (options) { options = options || {};