(function() { var activate, open_image_editing_dialog, open_image_editing_dialog_options, save_edited_image, setup_edit_btn, setup_image_kit, setup_image_kit_container; activate = function(element) { return setup_edit_btn($(element)); }; setup_edit_btn = function(element) { scrivito.editors._setup_binary_button_container(element, 'scrivito-editor-image-button-container'); if (element.scrivito('content')) { return $(" ").insertBefore(element).click(function(event) { event.preventDefault(); return open_image_editing_dialog(element); }); } }; open_image_editing_dialog = function(element) { var content, dialog; content = $("
"); dialog = scrivito.dialog(content, open_image_editing_dialog_options()); return setup_image_kit_container(element, dialog); }; open_image_editing_dialog_options = function() { var dialog_options; return dialog_options = { color: "dark", confirm: { title: "Confirm", color: "green" }, cancel: { title: "Cancel", color: "lightgrey" } }; }; setup_image_kit = function(image, container) { return new ImglyKit({ renderer: "canvas", assetsUrl: "imgly_sdk", image: image, versionCheck: false, container: container[0], ui: { enabled: true, assetPathResolver: scrivito.editors._imgly_asset_path_resolver } }); }; setup_image_kit_container = function(element, dialog) { var container, fallbackUrl, image, url; container = $(".image_kit_start"); image = new Image(); url = element.scrivito("content").url; image.crossOrigin = "Anonymous"; image.src = url; fallbackUrl = url; if (url.indexOf("?") < 0) { fallbackUrl = url + "?=" + new Date().getTime(); } else { fallbackUrl = url + "&=" + new Date().getTime(); } image.onerror = function() { if (image.src === fallbackUrl) { return $("Scrivito can't edit this image in your browser. What now?
\n