Fix an IE8 bug with the avatarcropper.
1. Crop an avatar 2. Crop another avatar without reloading -> Second cropper is 28px x 30px big
This commit is contained in:
parent
6db96603a0
commit
15ab798353
|
@ -56,6 +56,7 @@ function updateAvatar () {
|
||||||
|
|
||||||
function showAvatarCropper() {
|
function showAvatarCropper() {
|
||||||
$cropper = $('#cropper');
|
$cropper = $('#cropper');
|
||||||
|
$cropper.prepend("<img>");
|
||||||
$cropperImage = $('#cropper img');
|
$cropperImage = $('#cropper img');
|
||||||
|
|
||||||
$cropperImage.attr('src', OC.Router.generate('core_avatar_get_tmp')+'?requesttoken='+oc_requesttoken+'#'+Math.floor(Math.random()*1000));
|
$cropperImage.attr('src', OC.Router.generate('core_avatar_get_tmp')+'?requesttoken='+oc_requesttoken+'#'+Math.floor(Math.random()*1000));
|
||||||
|
@ -77,11 +78,7 @@ function showAvatarCropper() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendCropData() {
|
function sendCropData() {
|
||||||
$cropper = $('#cropper');
|
cleanCropper();
|
||||||
$('#displayavatar').show();
|
|
||||||
$cropper.hide();
|
|
||||||
$('.jcrop-holder').remove();
|
|
||||||
$('#cropper img').removeData('Jcrop').removeAttr('style').removeAttr('src');
|
|
||||||
|
|
||||||
var cropperdata = $('#cropper').data();
|
var cropperdata = $('#cropper').data();
|
||||||
var data = {
|
var data = {
|
||||||
|
@ -97,6 +94,15 @@ function saveCoords(c) {
|
||||||
$('#cropper').data(c);
|
$('#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) {
|
function avatarResponseHandler(data) {
|
||||||
$warning = $('#avatar .warning');
|
$warning = $('#avatar .warning');
|
||||||
$warning.hide();
|
$warning.hide();
|
||||||
|
@ -228,10 +234,7 @@ $(document).ready(function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#abortcropperbutton').click(function(){
|
$('#abortcropperbutton').click(function(){
|
||||||
$('#displayavatar').show();
|
cleanCropper();
|
||||||
$('#cropper').hide();
|
|
||||||
$('.jcrop-holder').remove();
|
|
||||||
$('#cropper img').removeData('Jcrop').removeAttr('style').removeAttr('src');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#sendcropperbutton').click(function(){
|
$('#sendcropperbutton').click(function(){
|
||||||
|
|
|
@ -94,7 +94,6 @@ if($_['passwordChangeSupported']) {
|
||||||
<?php p($l->t('Either png or jpg. Ideally square but you will be able to crop it.')); ?>
|
<?php p($l->t('Either png or jpg. Ideally square but you will be able to crop it.')); ?>
|
||||||
</div>
|
</div>
|
||||||
<div id="cropper" class="hidden">
|
<div id="cropper" class="hidden">
|
||||||
<img>
|
|
||||||
<div class="inlineblock button" id="abortcropperbutton"><?php p($l->t('Abort')); ?></div>
|
<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 class="inlineblock button primary" id="sendcropperbutton"><?php p($l->t('Choose as profile image')); ?></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue