app/assets/libs/jcrop/js/jquery.Jcrop.js in spud_media-0.9.5 vs app/assets/libs/jcrop/js/jquery.Jcrop.js in spud_media-0.9.6

- old
+ new

@@ -1,8 +1,8 @@ /** * jquery.Jcrop.js v0.9.10 - * jQuery Image Cropping Plugin - released under MIT License + * jQuery Image Cropping Plugin - released under MIT License * Author: Kelly Hallman <khallman@gmail.com> * http://github.com/tapmodo/Jcrop * Copyright (c) 2008-2012 Tapmodo Interactive LLC {{{ * * Permission is hereby granted, free of charge, to any person @@ -166,11 +166,11 @@ return false; } if ((ord === 'move') && !options.allowMove) { return false; } - + // Fix position of crop area when dragged the very first time. // Necessary when crop image is in a hidden element when page is loaded. docOffset = getPos($img); btndown = true; @@ -252,11 +252,11 @@ } //}}} function newTracker() //{{{ { var trk = $('<div></div>').addClass(cssClass('tracker')); - if ($.browser.msie) { + if (navigator.userAgent.match(/msie/i)) { trk.css({ opacity: 0, backgroundColor: 'white' }); } @@ -265,13 +265,13 @@ //}}} // }}} // Initialization {{{ // Sanitize some options {{{ - if ($.browser.msie && ($.browser.version.split('.')[0] === '6')) { - ie6mode = true; - } + ie6mode = ( navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/6/) ); + + if (typeof(obj) !== 'object') { obj = $(obj)[0]; } if (typeof(opt) !== 'object') { opt = {}; @@ -302,16 +302,16 @@ if ($origimg[0].width != 0 && $origimg[0].height != 0) { // Obtain dimensions from contained img element. $origimg.width($origimg[0].width); $origimg.height($origimg[0].height); } else { - // Obtain dimensions from temporary image in case the original is not loaded yet (e.g. IE 7.0). + // Obtain dimensions from temporary image in case the original is not loaded yet (e.g. IE 7.0). var tempImage = new Image(); tempImage.src = $origimg[0].src; $origimg.width(tempImage.width); $origimg.height(tempImage.height); - } + } var $img = $origimg.clone().removeAttr('id').css(img_css).show(); $img.width($origimg.width()); $img.height($origimg.height()); @@ -325,12 +325,12 @@ presize($img, options.boxWidth, options.boxHeight); var boundx = $img.width(), boundy = $img.height(), - - + + $div = $('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({ position: 'relative', backgroundColor: options.bgColor }).insertAfter($origimg).append($img); @@ -338,28 +338,28 @@ $div.addClass(options.addClass); } var $img2 = $('<div />'), - $img_holder = $('<div />') + $img_holder = $('<div />') .width('100%').height('100%').css({ zIndex: 310, position: 'absolute', overflow: 'hidden' }), - $hdl_holder = $('<div />') - .width('100%').height('100%').css('zIndex', 320), + $hdl_holder = $('<div />') + .width('100%').height('100%').css('zIndex', 320), - $sel = $('<div />') + $sel = $('<div />') .css({ position: 'absolute', zIndex: 600 }).dblclick(function(){ var c = Coords.getFixed(); options.onDblClick.call(api,c); - }).insertBefore($img).append($img_holder, $hdl_holder); + }).insertBefore($img).append($img_holder, $hdl_holder); if (img_mode) { $img2 = $('<img />') .attr('src', $img.attr('src')).css(img_css).width(boundx).height(boundy), @@ -391,11 +391,11 @@ docOffset = getPos($img); // }}} // }}} // Internal Modules {{{ - // Touch Module {{{ + // Touch Module {{{ var Touch = (function () { // Touch support detection function adapted (under MIT License) // from code by Jeffrey Sambells - http://github.com/iamamused/ function hasTouchSupport() { var support = {}, @@ -527,12 +527,12 @@ return getRect(); } // This function could use some optimization I think... var aspect = options.aspectRatio, min_x = options.minSize[0] / xscale, - - + + //min_y = options.minSize[1]/yscale, max_x = options.maxSize[0] / xscale, max_y = options.maxSize[1] / yscale, rw = x2 - x1, rh = y2 - y1, @@ -1047,26 +1047,26 @@ //}}} function disableHandles() //{{{ { seehandles = false; $hdl_holder.hide(); - } + } //}}} function animMode(v) //{{{ { if (animating === v) { disableHandles(); } else { enableHandles(); } - } + } //}}} function done() //{{{ { animMode(false); refresh(); - } + } //}}} // Insert draggable elements {{{ // Insert border divs for outline if (options.dragEdges && $.isArray(options.createDragbars)) @@ -1118,11 +1118,11 @@ animMode: animMode, setBgOpacity: setBgOpacity, done: done }; }()); - + //}}} // Tracker Module {{{ var Tracker = (function () { var onMove = function () {}, onDone = function () {}, @@ -1141,25 +1141,25 @@ if (trackDoc) { $(document) .bind('mousemove.jcrop',trackMove) .bind('mouseup.jcrop',trackUp); } - } + } //}}} function toBack() //{{{ { $trk.css({ zIndex: 290 }); $(document).unbind('.jcrop'); - } + } //}}} function trackMove(e) //{{{ { onMove(mouseAbs(e)); return false; - } + } //}}} function trackUp(e) //{{{ { e.preventDefault(); e.stopPropagation(); @@ -1574,10 +1574,10 @@ holder: $div, selection: $sel } }; - if ($.browser.msie) + if (navigator.userAgent.match(/msie/i)) $div.bind('selectstart', function () { return false; }); $origimg.data('Jcrop', api); return api; };