1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Contacts: More inline js in photo editor :-/

This commit is contained in:
Thomas Tanghus 2013-01-25 16:48:14 +01:00
parent 79628fef58
commit a2359a00b5
2 changed files with 29 additions and 35 deletions

28
js/cropphoto.js Normal file
View File

@ -0,0 +1,28 @@
jQuery(function($) {
$('#cropbox').Jcrop({
onChange: showCoords,
onSelect: showCoords,
onRelease: clearCoords,
maxSize: [399, 399],
bgColor: 'black',
bgOpacity: .4,
boxWidth: 400,
boxHeight: 400,
setSelect: [ 100, 130, 50, 50 ]//,
//aspectRatio: 0.8
});
});
// Simple event handler, called from onChange and onSelect
// event handlers, as per the Jcrop invocation above
function showCoords(c) {
$('#x1').val(c.x);
$('#y1').val(c.y);
$('#x2').val(c.x2);
$('#y2').val(c.y2);
$('#w').val(c.w);
$('#h').val(c.h);
};
function clearCoords() {
$('#coords input').val('');
};

View File

@ -3,41 +3,6 @@ $id = $_['id'];
$tmpkey = $_['tmpkey'];
$requesttoken = $_['requesttoken'];
?>
<script type="text/javascript">
jQuery(function($) {
$('#cropbox').Jcrop({
onChange: showCoords,
onSelect: showCoords,
onRelease: clearCoords,
maxSize: [399, 399],
bgColor: 'black',
bgOpacity: .4,
boxWidth: 400,
boxHeight: 400,
setSelect: [ 100, 130, 50, 50 ]//,
//aspectRatio: 0.8
});
});
// Simple event handler, called from onChange and onSelect
// event handlers, as per the Jcrop invocation above
function showCoords(c) {
$('#x1').val(c.x);
$('#y1').val(c.y);
$('#x2').val(c.x2);
$('#y2').val(c.y2);
$('#w').val(c.w);
$('#h').val(c.h);
};
function clearCoords() {
$('#coords input').val('');
};
/*
$('#coords').submit(function() {
alert('Handler for .submit() called.');
return true;
});*/
</script>
<?php if(OC_Cache::hasKey($tmpkey)) { ?>
<img id="cropbox" src="<?php echo OCP\Util::linkToAbsolute('contacts', 'tmpphoto.php'); ?>?tmpkey=<?php echo $tmpkey; ?>" />
<form id="cropform"
@ -60,6 +25,7 @@ $requesttoken = $_['requesttoken'];
</fieldset>
<iframe name="crop_target" id='crop_target' src=""></iframe>
</form>
<script type="text/javascript" src="<?php echo OC_Helper::linkTo('contacts/js', 'jcrop.js');?>"></script>
<?php
} else {
echo $l->t('The temporary image has been removed from cache.');