public function Field($properties = array()) { $image = $this->getImage(); if (!$image) { return false; } FormExtraJquery::include_jquery(); if (self::config()->use_hammer) { FormExtraJquery::include_hammer(); } if (self::config()->use_mousewheel) { FormExtraJquery::include_mousewheel(); } Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/cropbox/jquery.cropbox.js'); Requirements::css(FORM_EXTRAS_PATH . '/javascript/cropbox/jquery.cropbox.css'); Requirements::customScript("jQuery( '.cropbox-field' ).each( function () {\n\t\t\tvar t = jQuery(this),\n\t\t\timage = t.find('img'),\n cropwidth = image.data('cropwidth'),\n cropheight = image.data('cropheight'),\n\t\t\tx = jQuery('[name=CropX]', t),\n y = jQuery('[name=CropY]', t),\n w = jQuery('[name=CropWidth]', t),\n h = jQuery('[name=CropHeight]', t)\n\t\t;\n\n image.cropbox( {width: cropwidth, height: cropheight, result: {cropX:x.val(), cropY:y.val(), cropW:w.val(), cropH:h.val()} })\n .on('cropbox', function( event, results, img ) {\n\t\t\t\tx.val(results.cropX);\n\t\t\t\ty.val(results.cropY);\n\t\t\t\tw.val(results.cropW);\n\t\t\t\th.val(results.cropH);\n })\n\t\t\t;\n } );", 'cropboxFieldInit'); return parent::Field($properties); }