SHARE
TWEET

Untitled

a guest Jan 24th, 2020 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $('#imageModal').on('shown.bs.modal', function(e) {
  2.   var item = $('#menuImage');
  3.   var itemId = item.data('itemid');
  4.   var url = item.data('url');
  5.  
  6.   function initCropper(forcePush) {
  7.     var cropper = new Slim(document.getElementById('menuImage'), {
  8.       ratio: item.data('ratio'),
  9.       service: '/settings/edit/images',
  10.       label: 'Click, or drag image here',
  11.       labelLoading: 'Image loading...',
  12.       buttonConfirmLabel: 'Upload',
  13.       buttonConfirmTitle: 'Upload',
  14.       maxFileSize: '20',
  15.       willTransform: addImageWatermark,
  16.       minSize: item.data('minsize'),
  17.       forceSize: item.data('forcesize'),
  18.       push: true,
  19.       instantEdit: !forcePush && (url != '') ? false : true,
  20.       didRemove: function imageRemoved(data) {
  21.         $.post('/settings/edit/images', {'deleteImage' : 'menuItem', 'itemId' : itemId}, function (data) {
  22.             $('.img_menuItem').removeClass('imgExists').addClass('imgPlaceholder');
  23.             $('#menuImg' + itemId).removeClass('glyphicon-camera text-primary').addClass('glyphicon-plus text-muted small');
  24.         });
  25.       },
  26.       didUpload: function(error, data, response) {
  27.         $('.img_menuItem').removeClass('imgPlaceholder').addClass('imgExists');
  28.         $('#menuImg' + itemId).removeClass('glyphicon-plus text-muted small').addClass('glyphicon-camera text-primary');
  29.       },
  30.       willCropInitial: function () {
  31.         cropper.edit();
  32.       },
  33.    
  34.       meta: {
  35.         imageType: 'menuItem',
  36.         itemId: itemId,
  37.       }
  38.     });
  39.  
  40.     if (url != '') {
  41.       cropper.load(url, { blockPush:true });
  42.     }
  43.  
  44.     console.log(cropper);
  45.   }
  46.  
  47.   initCropper();
  48. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top