{$TITLE} › {'Edit photo'|@translate} {$TABSHEET_TITLE}
{if $IN_CROP}
{combine_css path="themes/default/js/plugins/jquery.Jcrop.css"}
{combine_script id='jquery.jcrop' load='footer' require='jquery' path='themes/default/js/plugins/jquery.Jcrop.min.js'}
{footer_script require="jquery"}
var jcrop_api;
jQuery("#jcrop").Jcrop({ldelim}
//boxWidth: {$crop.display_width},
//boxHeight: {$crop.display_height},
boxWidth: 500, boxHeight: 400,
onChange: jOnChange,
onRelease: jOnRelease
},
function(){ldelim}
jcrop_api = this;
});
$("input[name='ratio']").change(function(e) {ldelim}
if ($("input[name='ratio']:checked").val() == '1/1')
{ldelim}
jcrop_api.setOptions({ldelim} aspectRatio: 1/1 });
document.getElementById('ratioC').disabled = true;
document.getElementById('ratioC').value = '';
}
else if ($("input[name='ratio']:checked").val() == '4/5')
{ldelim}
jcrop_api.setOptions({ldelim} aspectRatio: 4/5 });
document.getElementById('ratioC').disabled = true;
document.getElementById('ratioC').value = '';
}
else if ($("input[name='ratio']:checked").val() == '4/3')
{ldelim}
jcrop_api.setOptions({ldelim} aspectRatio: 4/3 });
document.getElementById('ratioC').disabled = true;
document.getElementById('ratioC').value = '';
}
else if ($("input[name='ratio']:checked").val() == '5/7')
{ldelim}
jcrop_api.setOptions({ldelim} aspectRatio: 5/7 });
document.getElementById('ratioC').disabled = true;
document.getElementById('ratioC').value = '';
}
else if ($("input[name='ratio']:checked").val() == '16/9')
{ldelim}
jcrop_api.setOptions({ldelim} aspectRatio: 16/9 });
document.getElementById('ratioC').disabled = true;
document.getElementById('ratioC').value = '';
}
else if ($("input[name='ratio']:checked").val() == '2.35/1')
{ldelim}
jcrop_api.setOptions({ldelim} aspectRatio: 2.35/1 });
document.getElementById('ratioC').disabled = true;
document.getElementById('ratioC').value = '';
}
else if ($("input[name='ratio']:checked").val() == 'original')
{ldelim}
jcrop_api.setOptions({ldelim} aspectRatio: eval($('#image_ratio').val()) });
document.getElementById('ratioC').disabled = true;
document.getElementById('ratioC').value = '';
}
else if ($("input[name='ratio']:checked").val() == 'C')
{ldelim}
document.getElementById('ratioC').disabled = false;
if ( eval($('#ratioC').val()) > 0 )
jcrop_api.setOptions({ldelim} aspectRatio: eval($('#ratioC').val()) });
}
else
{ldelim}
jcrop_api.setOptions({ldelim} aspectRatio: 0 });
document.getElementById('ratioC').disabled = true;
document.getElementById('ratioC').value = '';
}
jcrop_api.focus();
});
$("input[name='ratioC']").change(function(e) {ldelim}
if (($("input[name='ratio']:checked").val() == 'C') && eval($('#ratioC').val()) > 0)
jcrop_api.setOptions({ldelim} aspectRatio: eval($('#ratioC').val()) });
jcrop_api.focus();
});
function jOnChange(sel) {ldelim}
jQuery("input[name='x']").val(sel.x);
jQuery("input[name='y']").val(sel.y);
jQuery("input[name='x2']").val(sel.x2);
jQuery("input[name='y2']").val(sel.y2);
jQuery("input[name='w']").val(sel.w);
jQuery("input[name='h']").val(sel.h);
jQuery("#width").html(Math.round(sel.x2-sel.x).toFixed(0));
jQuery("#height").html(Math.round(sel.y2-sel.y).toFixed(0));
}
function jOnRelease() {ldelim}
}
{/footer_script}
{/if}