5 elgg.provide(
'elgg.avatarCropper');
13 elgg.avatarCropper.init =
function() {
17 onSelectEnd:
elgg.avatarCropper.selectChange,
18 onSelectChange:
elgg.avatarCropper.preview
21 if ($(
'input[name=x2]').val()) {
22 params.x1 = $(
'input[name=x1]').val();
23 params.x2 = $(
'input[name=x2]').val();
24 params.y1 = $(
'input[name=y1]').val();
25 params.y2 = $(
'input[name=y2]').val();
30 if ($(
'input[name=x2]').val()) {
33 $(window).
on(
'load',
function () {
34 var ias = $(
'#user-avatar-cropper').
imgAreaSelect({instance:
true});
35 var selection = ias.getSelection();
36 elgg.avatarCropper.preview($(
'#user-avatar-cropper'), selection);
48 elgg.avatarCropper.preview =
function(
img, selection) {
50 if (selection.width === 0 || selection.height === 0) {
54 var origWidth = $(
"#user-avatar-cropper").
width();
55 var origHeight = $(
"#user-avatar-cropper").
height();
56 var scaleX = 100 / selection.width;
57 var scaleY = 100 / selection.height;
58 $(
'#user-avatar-preview > img').css({
59 width: Math.round(scaleX * origWidth) +
'px',
60 height: Math.round(scaleY * origHeight) +
'px',
61 marginLeft:
'-' + Math.round(scaleX * selection.x1) +
'px',
62 marginTop:
'-' + Math.round(scaleY * selection.y1) +
'px' 73 elgg.avatarCropper.selectChange =
function(
img, selection) {
74 $(
'input[name=x1]').val(selection.x1);
75 $(
'input[name=x2]').val(selection.x2);
76 $(
'input[name=y1]').val(selection.y1);
77 $(
'input[name=y2]').val(selection.y2);
80 elgg.register_hook_handler(
'init',
'system',
elgg.avatarCropper.init);
imgAreaSelect
imgAreaSelect initialization
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed on