| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 | 
							- $(document).ready(function() {
 
-     var is_init = false;
 
-     var jcrop_api;
 
-     
 
-     function getRandom() {
 
-         var dim = [jcrop_api.ui.stage.width,jcrop_api.ui.stage.height];
 
-         return [
 
-           Math.round(Math.random() * dim[0]),
 
-           Math.round(Math.random() * dim[1]),
 
-           Math.round(Math.random() * dim[0]),
 
-           Math.round(Math.random() * dim[1])
 
-         ];
 
-       };
 
-     $('#setSelectButton').click(function(event) {
 
-         event.preventDefault();
 
-         event.stopImmediatePropagation();
 
-         $('#cropButton').removeClass("hide");
 
-         $('#releaseButton').removeClass("hide");
 
-         $('#setSelectButton').addClass("hide");
 
-         $('.original-image').Jcrop({
 
-             boxWidth: "800",
 
-             onChange: function (c) {
 
-                 $('#crop-x').val(c.x);
 
-                 $('#crop-y').val(c.y);
 
-                 $('#crop-w').val(c.w);
 
-                 $('#crop-h').val(c.h);
 
-             }
 
-         }, function() {
 
-             jcrop_api = this;
 
-             var thumbnail = this.initComponent('Thumbnailer', {
 
-                 width: 130,
 
-                 height: 130
 
-             });
 
-             this.ui.preview = thumbnail;
 
-             jcrop_api.newSelection();
 
-             var bound = getRandom();
 
-             jcrop_api.setSelect(bound);
 
-             $('#crop-x').val(bound[0]);
 
-             $('#crop-y').val(bound[1]);
 
-             $('#crop-w').val(bound[2]);
 
-             $('#crop-h').val(bound[3]);
 
-             if (is_init == false) {
 
-                 is_init = true;
 
-                 jcrop_api.container.on('cropmove cropend', function(e, s, c) {
 
-                     $('#crop-x').val(c.x);
 
-                     $('#crop-y').val(c.y);
 
-                     $('#crop-w').val(c.w);
 
-                     $('#crop-h').val(c.h);
 
-                 });
 
-                 $('#text-inputs').on('change', 'input', function(e) {
 
-                     jcrop_api.animateTo([
 
-                         parseInt($('#crop-x').val()),
 
-                         parseInt($('#crop-y').val()),
 
-                         parseInt($('#crop-w').val()),
 
-                         parseInt($('#crop-h').val())
 
-                     ]);
 
-                 });
 
-             }
 
-         });
 
-         return false;
 
-     });
 
-     $('#releaseButton').click(function(event) {
 
-         event.preventDefault();
 
-         event.stopImmediatePropagation();
 
-         $('#cropButton').addClass("hide");
 
-         $('#releaseButton').addClass("hide");
 
-         $('#setSelectButton').removeClass("hide");
 
-         jcrop_api.destroy();
 
-         $(".original-image").attr("style", "");
 
-         return false;
 
-     });
 
-     $('#cropButton').click(function(event) {
 
-         event.preventDefault();
 
-         event.stopImmediatePropagation();
 
-         $.ajax({
 
-             type: "POST",
 
-             url: cropUrl,
 
-             data: {
 
-                 x: $('#crop-x').val(),
 
-                 y: $('#crop-y').val(),
 
-                 w: $('#crop-w').val(),
 
-                 h: $('#crop-h').val(),
 
-                 type: $("input[name='crop-apply-type']:checked").val()
 
-             },
 
-             success: function(msg) {
 
-                 if (msg.status == true) {
 
-                     location.reload();
 
-                 } else {
 
-                     console.log(msg);
 
-                     //alert(msg.error);
 
-                 }
 
-             }
 
-         });
 
-         return false;
 
-     });
 
- });
 
 
  |