1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
|
function enablePWImageDialogButtons(){var $buttonPane=parent.jQuery(".ui-dialog-buttonpane");$buttonPane.find("button").button("enable");return}function disablePWImageDialogButtons(){var $buttonPane=parent.jQuery(".ui-dialog-buttonpane");$buttonPane.find("button").button("disable");return}function closePWImageDialog(){parent.jQuery("iframe.ui-dialog-content").dialog("close")}function setupProcessSaveReloaded(fileID,isNew){if(isNew){var offsetTop=parent.jQuery("#"+fileID).offset().top-20;parent.jQuery("html, body").animate({scrollTop:offsetTop},1e3,"swing");parent.jQuery("#"+fileID).hide();setTimeout(function(){parent.jQuery("#"+fileID).slideDown()},900)}else{parent.jQuery("#"+fileID).find("img").hide();setTimeout(function(){parent.jQuery("#"+fileID).find("img").fadeIn("normal",function(){parent.jQuery("#"+fileID).find(".gridImage__edit").trigger("click")})},500)}closePWImageDialog()}function setupProcessSave(fieldName,fileID,isNew){var finished=false;var $inputfield=parent.jQuery("#wrap_Inputfield_"+fieldName);if(!$inputfield.length){$inputfield=parent.jQuery("#"+fileID).closest(".InputfieldImage")}$inputfield.trigger("reload");parent.jQuery(".Inputfield").on("reloaded",function(){if(finished)return;finished=true;if(fileID.length>0){setTimeout(function(){setupProcessSaveReloaded(fileID,isNew)},250)}})}function refreshPageEditField(fieldName){parent.jQuery("#wrap_Inputfield_"+fieldName).trigger("reload")}function setupExecuteVariations(){$(document).on("click","input#delete_all",function(event){if($(this).is(":checked")){$("input.delete").prop("checked",true)}else{$("input.delete").prop("checked",false)}event.stopPropagation()});var magnificOptions={type:"image",closeOnContentClick:true,closeBtnInside:true};$("a.preview").magnificPopup(magnificOptions);var $varcnt=$("#varcnt_id");var varcntID=$varcnt.val();var varcnt=$varcnt.attr("data-cnt");window.parent.jQuery("#"+varcntID).text(varcnt)}function setupSelectedImage(){var croppingActive=false;var inputPixelsActive=false;var $form=$("#selected_image_settings");var $container=$("#selected_image_container");var $img=$("#selected_image");var $hidpi=$("#selected_image_hidpi");var fullWidth;var minWidth=0;var minHeight=0;function setupImage($img){var originalWidth=$img.width();var maxWidth=9999;var maxHeight=9999;function updateHidpiCheckbox(w){if(w<fullWidth-fullWidth*.2){if(!$hidpi.is(":visible"))$hidpi.closest("label").fadeIn();$hidpi.prop("disabled",false)}else{$hidpi.prop("disabled",true);if($hidpi.is(":visible"))$hidpi.closest("label").fadeOut()}}function populateResizeDimensions(){var w=Math.round($img.width());var h=Math.round($img.height());var $link=$("#wrap_link_original");if((h>=maxHeight||w>=maxWidth)&&$form.hasClass("croppable")){w=maxWidth;h=maxHeight;$("#selected_image_link").prop("checked",false);$link.hide()}else{if(!$link.is(":visible")){$link.fadeIn();if($link.attr("data-was-checked")==1){$link.prop("checked",true)}}}$("#input_width").val(w);$("#input_height").val(h);$img.attr("width",w);$img.attr("height",h);updateHidpiCheckbox(w);var $latin=$("#latin");if($latin.is(":visible"))$latin.height(h);if(!$form.hasClass("rte")){var $useResize=$("#selected_image_resize");if(originalWidth<=w){$useResize.hide()}else{if(!$useResize.is(":visible"))$useResize.fadeIn()}}}function setupImageResizable(){$img.resizable({aspectRatio:true,handles:"n, ne, e, se, s, sw, w",alsoResize:"#selected_image_container",maxWidth:maxWidth,maxHeight:maxHeight,minWidth:10,minHeight:10,start:function(){$form.addClass("resizing_active")},stop:function(){$img.attr("width",$img.width()).attr("height",$img.height());if(originalWidth!=$img.width()){$img.addClass("resized");if(!$form.hasClass("rte")){var $resizeYes=$("#selected_image_resize_yes");if(!$resizeYes.is(":checked")){$resizeYes.prop("checked",true);$("#selected_image_resize_no").prop("checked",false)}}}$form.removeClass("resizing_active");if($("#resize_action").hasClass("on"))$("#resize_action").trigger("click").mouseout()},resize:populateResizeDimensions});$img.addClass("resizable_setup")}var cropData=null;function setupImageCroppable
|