function showAvatarCropper() {
$cropper = $('#cropper');
+ $cropper.prepend("<img>");
$cropperImage = $('#cropper img');
$cropperImage.attr('src', OC.Router.generate('core_avatar_get_tmp')+'?requesttoken='+oc_requesttoken+'#'+Math.floor(Math.random()*1000));
}
function sendCropData() {
- $cropper = $('#cropper');
- $('#displayavatar').show();
- $cropper.hide();
- $('.jcrop-holder').remove();
- $('#cropper img').removeData('Jcrop').removeAttr('style').removeAttr('src');
+ cleanCropper();
var cropperdata = $('#cropper').data();
var data = {
$('#cropper').data(c);
}
+function cleanCropper() {
+ $cropper = $('#cropper');
+ $('#displayavatar').show();
+ $cropper.hide();
+ $('.jcrop-holder').remove();
+ $('#cropper img').removeData('Jcrop').removeAttr('style').removeAttr('src');
+ $('#cropper img').remove();
+}
+
function avatarResponseHandler(data) {
$warning = $('#avatar .warning');
$warning.hide();
});
$('#abortcropperbutton').click(function(){
- $('#displayavatar').show();
- $('#cropper').hide();
- $('.jcrop-holder').remove();
- $('#cropper img').removeData('Jcrop').removeAttr('style').removeAttr('src');
+ cleanCropper();
});
$('#sendcropperbutton').click(function(){
<?php p($l->t('Either png or jpg. Ideally square but you will be able to crop it.')); ?>
</div>
<div id="cropper" class="hidden">
- <img>
<div class="inlineblock button" id="abortcropperbutton"><?php p($l->t('Abort')); ?></div>
<div class="inlineblock button primary" id="sendcropperbutton"><?php p($l->t('Choose as profile image')); ?></div>
</div>