Sha256: 8a1d722fd91880db613b3b77b62ace74aaf1c7f43b2e1b0fc4eca66a02024ceb
Contents?: true
Size: 1.51 KB
Versions: 15
Compression:
Stored size: 1.51 KB
Contents
if (typeof(Alchemy) === 'undefined') { var Alchemy = {}; } (function($) { var ImageCropper = {}; ImageCropper.initialized = false; $.extend(Alchemy, ImageCropper); Alchemy.ImageCropper = { init : function (box, size_x, size_y, default_box, ratio) { var crop_from_field = $('#essence_picture_crop_from'); var crop_size_field = $('#essence_picture_crop_size'); var options = { onSelect: function(coords) { crop_from_field.val(coords.x + "x" + coords.y); crop_size_field.val(coords.w + "x" + coords.h); }, setSelect: box, aspectRatio: ratio ? ratio : undefined, minSize: [size_x, size_y] }; Alchemy.ImageCropper.box = box; Alchemy.ImageCropper.default_box = default_box; Alchemy.ImageCropper.crop_from_field = crop_from_field; Alchemy.ImageCropper.crop_size_field = crop_size_field; if (!Alchemy.ImageCropper.initialized) { Alchemy.ImageCropper.api = $.Jcrop('#imageToCrop', options); Alchemy.ImageCropper.initialized = true; } $('.ui-dialog-titlebar-close').click(Alchemy.ImageCropper.destroy); }, undo : function() { Alchemy.ImageCropper.api.setSelect(Alchemy.ImageCropper.box); }, reset : function() { Alchemy.ImageCropper.api.setSelect(Alchemy.ImageCropper.default_box); Alchemy.ImageCropper.crop_from_field.val(''); Alchemy.ImageCropper.crop_size_field.val(''); }, destroy : function() { try { Alchemy.ImageCropper.api.destroy(); } catch(e) {} finally { Alchemy.ImageCropper.initialized = false; } } } })(jQuery);
Version data entries
15 entries across 15 versions & 1 rubygems