function updateThemeWithAppSkinInfo(a){var b=a.panelBackgroundColor.color;document.body.bgColor=toHex(b);var c=(new CSInterface).hostEnvironment.appName;"PHXS"==c&&addRule("ppstyle","button, select, input[type=button], input[type=submit]","border-radius:3px;");if("PHXS"==c||"PPRO"==c||"PRLD"==c){var c="background-image: -webkit-linear-gradient(top, "+toHex(b,40)+" , "+toHex(b,10)+");",e="background-image: -webkit-linear-gradient(top, "+toHex(b,15)+" , "+toHex(b,5)+");",d,g,h,f,k;127<b.red?(d="#000000;",
g="color:"+toHex(b,-70)+";",h="border-color: "+toHex(b,-90)+";",f=toHex(b,54)+";",k="background-image: -webkit-linear-gradient(top, "+toHex(b,-40)+" , "+toHex(b,-50)+");"):(d="#ffffff;",g="color:"+toHex(b,100)+";",h="border-color: "+toHex(b,-45)+";",f=toHex(b,-20)+";",k="background-image: -webkit-linear-gradient(top, "+toHex(b,-20)+" , "+toHex(b,-30)+");");addRule("ppstyle",".default","font-size:"+a.baseFontSize+"px; color:"+d+"; background-color:"+toHex(b)+";");addRule("ppstyle","button, select, input[type=text], input[type=button], input[type=submit]",
h);addRule("ppstyle","button.default, select, input[type=button], input[type=submit]",c);addRule("ppstyle","button, select, input[type=button], input[type=submit]","-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);");addRule("ppstyle","button:enabled:active, input[type=button]:enabled:active, input[type=submit]:enabled:active",k);addRule("ppstyle","button:enabled:active, input[type=button]:enabled:active, input[type=submit]:enabled:active","-webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);");
addRule("ppstyle","[disabled]",e);addRule("ppstyle","[disabled]",g);addRule("ppstyle","input[type=text]","padding:1px 3px;");addRule("ppstyle","input[type=text]","background-color: "+f+";");addRule("ppstyle","input[type=text]:focus","background-color: #ffffff;");addRule("ppstyle","input[type=text]:focus","color: #000000;");addRule("ppstyle","select","color: "+d+";");addRule("ppstyle","select","background: "+f+";");addRule("ppstyle",".settings-modal-content","color: "+d+";");addRule("ppstyle",".settings-modal-content",
"background-color: "+f+";");addRule("ppstyle",".text-color","color: "+d+";");addRule("ppstyle",".section-color","color: "+d+";");addRule("ppstyle",".section-color","background-color: "+toHex(b)+";");addRule("ppstyle","hr","border-color: "+d+";")}else addRule("ppstyle",".default","font-size:"+a.baseFontSize+"px; color:"+reverseColor(b)+"; background-color:"+toHex(b,20)),addRule("ppstyle","button","border-color: "+toHex(panelBgColor,-50))}
function addRule(a,b,c){if(a=document.getElementById(a))a=a.sheet,a.addRule?a.addRule(b,c):a.insertRule&&a.insertRule(b+" { "+c+" }",a.cssRules.length)}function reverseColor(a,b){return toHex({red:Math.abs(255-a.red),green:Math.abs(255-a.green),blue:Math.abs(255-a.blue)},b)}function toHex(a,b){function c(a,b){var c=!isNaN(b)?a+b:a;0>c?c=0:255<c&&(c=255);c=c.toString(16);return 1==c.length?"0"+c:c}var e="";if(a)with(a)e=c(red,b)+c(green,b)+c(blue,b);return"#"+e}
function onAppThemeColorChanged(a){a=JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo;updateThemeWithAppSkinInfo(a)}function loadJSX(){var a=new CSInterface,b=a.getSystemPath(SystemPath.EXTENSION)+"/jsx/";a.evalScript('$._ext.evalFiles("'+b+'")')}function evalScript(a,b){(new CSInterface).evalScript(a,b)}
function onClickButton(a){"FLPR"==a?evalScript('fl.createDocument(); fl.getDocumentDOM().addNewText({left:100, top:100, right:300, bottom:300} , "Hello Flash!"); '):evalScript("$._ext_"+a+".run()")}
function onLoaded(){var a=new CSInterface;"FLPR"!=a.hostEnvironment.appName&&loadJSX();(new PSActionSetLoader(a,!1)).loadAction("actionsets/","TK-V5-Actions.atn","Copyright 2016 Tony Kuyper");updateThemeWithAppSkinInfo(a.hostEnvironment.appSkinInfo);a.addEventListener(CSInterface.THEME_COLOR_CHANGED_EVENT,onAppThemeColorChanged)}
$(document).ready(function(){var a=null===localStorage.getItem("sliderValueActions")||void 0===localStorage.getItem("sliderValueActions")?1:localStorage.getItem("sliderValueActions"),b=null===localStorage.getItem("dimensionValue")||void 0===localStorage.getItem("dimensionValue")||""===localStorage.getItem("dimensionValue")?800:localStorage.getItem("dimensionValue"),c=null===localStorage.getItem("opacityValue")||void 0===localStorage.getItem("opacityValue")||""===localStorage.getItem("opacityValue")?
50:localStorage.getItem("opacityValue"),e=null===localStorage.getItem("extraSharpValue")||void 0===localStorage.getItem("extraSharpValue")?!1:localStorage.getItem("extraSharpValue"),e="true"===e||!0===e?!0:!1,d=null===localStorage.getItem("convertValue")||void 0===localStorage.getItem("convertValue")?!1:localStorage.getItem("convertValue"),d="true"===d||!0===d?!0:!1,g=null===localStorage.getItem("actionValue")||void 0===localStorage.getItem("actionValue")?!1:localStorage.getItem("actionValue"),g=
"true"===g||!0===g?!0:!1,h=null===localStorage.getItem("tkLANGDEFAULT")||void 0===localStorage.getItem("tkLANGDEFAULT")?"EN":localStorage.getItem("tkLANGDEFAULT"),f=null===localStorage.getItem("currentImageOnlyValue")||void 0===localStorage.getItem("currentImageOnlyValue")?!1:localStorage.getItem("currentImageOnlyValue"),f="true"===f||!0===f?!0:!1,k=null===localStorage.getItem("inputFolderValue")||void 0===localStorage.getItem("inputFolderValue")?"":localStorage.getItem("inputFolderValue"),v=null===
localStorage.getItem("outputFolderValue")||void 0===localStorage.getItem("outputFolderValue")?"":localStorage.getItem("outputFolderValue"),l=null===localStorage.getItem("jpgOutputValue")||void 0===localStorage.getItem("jpgOutputValue")?!0:localStorage.getItem("jpgOutputValue"),l="true"===l||!0===l?!0:!1,m=null===localStorage.getItem("psdOutputValue")||void 0===localStorage.getItem("psdOutputValue")?!1:localStorage.getItem("psdOutputValue"),m="true"===m||!0===m?!0:!1,n=null===localStorage.getItem("tifOutputValue")||
void 0===localStorage.getItem("tifOutputValue")?!1:localStorage.getItem("tifOutputValue"),n="true"===n||!0===n?!0:!1,p=null===localStorage.getItem("pngOutputValue")||void 0===localStorage.getItem("pngOutputValue")?!1:localStorage.getItem("pngOutputValue"),p="true"===p||!0===p?!0:!1,z=null===localStorage.getItem("jpgQualityValue")||void 0===localStorage.getItem("jpgQualityValue")?10:localStorage.getItem("jpgQualityValue"),q=null===localStorage.getItem("BatchConvertValue")||void 0===localStorage.getItem("BatchConvertValue")?
!0:localStorage.getItem("BatchConvertValue"),q="true"===q||!0===q?!0:!1,r=null===localStorage.getItem("embedColorProfileValue")||void 0===localStorage.getItem("embedColorProfileValue")?!0:localStorage.getItem("embedColorProfileValue"),r="true"===r||!0===r?!0:!1,s=null===localStorage.getItem("playActionValue")||void 0===localStorage.getItem("playActionValue")?!1:localStorage.getItem("playActionValue"),s="true"===s||!0===s?!0:!1,w=null===localStorage.getItem("BatchDimensionValue")||void 0===localStorage.getItem("BatchDimensionValue")||
""===localStorage.getItem("BatchDimensionValue")?800:localStorage.getItem("BatchDimensionValue"),A=null===localStorage.getItem("BatchOpacityValue")||void 0===localStorage.getItem("BatchOpacityValue")||""===localStorage.getItem("BatchOpacityValue")?50:localStorage.getItem("BatchOpacityValue"),x=null===localStorage.getItem("BatchExtraSharpValue")||void 0===localStorage.getItem("BatchExtraSharpValue")?!1:localStorage.getItem("BatchExtraSharpValue"),x="true"===x||!0===x?!0:!1,t=null===localStorage.getItem("prefixValue")||
void 0===localStorage.getItem("prefixValue")?!1:localStorage.getItem("prefixValue"),t="true"===t||!0===t?!0:!1,u=null===localStorage.getItem("suffixValue")||void 0===localStorage.getItem("suffixValue")?!1:localStorage.getItem("suffixValue"),u="true"===u||!0===u?!0:!1,y=null===localStorage.getItem("selectionIndicatorSetting")||void 0===localStorage.getItem("selectionIndicatorSetting")?"fixed":localStorage.getItem("selectionIndicatorSetting");$("#checkboxCURRENTIMAGEONLY").prop("checked",f);!0===f&&
($("#buttonINPUTFOLDER, #buttonCLEARINPUTFOLDER").prop("disabled",!0),$("#buttonINPUTFOLDER, #buttonCLEARINPUTFOLDER").css("box-shadow","none"));$("#inputINPUTFOLDER").val(k);$("#inputOUTPUTFOLDER").val(v);$("#checkboxJPG").prop("checked",l);$("#checkboxPSD").prop("checked",m);$("#checkboxTIF").prop("checked",n);$("#checkboxPNG").prop("checked",p);$("#inputJPGQUALITY").val(z);!1===l&&$("#inputJPGQUALITY").prop("disabled",!0);$("#checkboxBatchCONVERTTOSRGB").prop("checked",q);$("#checkboxEMBEDCOLORPROFILE").prop("checked",
r);$("#checkboxPLAYACTION").prop("checked",s);$("#inputBatchDIMENSION").val(w);$("#inputBatchOPACITY").val(A);$("#checkboxBatchEXTRASHARP").prop("checked",x);$("#checkboxPREFIX").prop("checked",t);$("#checkboxSUFFIX").prop("checked",u);!1===t&&$("#inputPREFIX").prop("disabled",!0);!1===u&&$("#inputSUFFIX").prop("disabled",!0);$("#Dimension").val(b);$("#Opacity").val(c);$("#ExtraSharp").prop("checked",e);$("#Convert").prop("checked",d);$("#Action").prop("checked",g);$("#Slider").val(a);updateSlider(a);
TKResetLang(h);$("#selectSELECTIONINDICATOR").val(y);("fixed"===y||"animated"===y)&&startActiveSelectionIndicator(y)});
$("#Horizontal, #Vertical, #Fit").click(function(){var a=$("#Dimension").val(),b=$("#Opacity").val(),c=$("#ExtraSharp").is(":checked"),e=$("#Convert").is(":checked"),d=$("#Action").is(":checked");evalScript("$._ext_runWebSharpening('"+a+"','"+b+"','"+c+"','"+e+"','"+d+"', '"+this.id+"')");localStorage.setItem("dimensionValue",a);localStorage.setItem("opacityValue",b);localStorage.setItem("extraSharpValue",c);localStorage.setItem("convertValue",e);localStorage.setItem("actionValue",d)});
function updateSlider(a){var b=document.getElementsByClassName("panelColor");for(i=0;i<b.length;i++)document.getElementsByClassName("panelColor")[i].style.opacity=a;document.getElementById("tktips").style.border="1px solid rgba(255, 204, 51, "+a+")";localStorage.setItem("sliderValueActions",a)}
$("#English, #Italian, #German, #Spanish, #Chinese").click(function(){var a=this.value;localStorage.setItem("tkLANGDEFAULT",a);localStorage.setItem("prefixTextValue","");localStorage.setItem("suffixTextValue","");TKResetLang(a)});
function TKResetLang(a){"object"===typeof lang_IT&&"object"===typeof lang_DE&&"object"===typeof lang_ES&&"object"===typeof lang_EN?$(".default").css("display","block"):$(".default").css("display","none");tkLANG="IT"==a?lang_IT:"DE"==a?lang_DE:"ES"==a?lang_ES:lang_EN;TKTT("tipCLEAR");$("#spanACTIONS").html(tkLANG.spanACTIONS);$("#spanCOLOR").html(tkLANG.spanCOLOR);$("#spanWEBSHARPENING").html(tkLANG.spanWEBSHARPENING);$("#spanDIMENSION").html(tkLANG.spanDIMENSION);$("#spanPIXELS").html(tkLANG.spanPIXELS);
$("#spanOPACITY").html(tkLANG.spanOPACITY);$("#spanPERCENT").html(tkLANG.spanPERCENT);$("#spanEXTRASHARP").html(tkLANG.spanEXTRASHARP);$("#spanACTION").html(tkLANG.spanACTION);$("#spanCOLORSETTINGS").html(tkLANG.spanCOLORSETTINGS);$("#spanSELECTIONINDICATOR").html(tkLANG.spanSELECTIONINDICATOR);$("#optionFIXED").html(tkLANG.optionFIXED);$("#optionANIMATED").html(tkLANG.optionANIMATED);$("#optionOFF").html(tkLANG.optionOFF);a=null===localStorage.getItem("prefixTextValue")||void 0===localStorage.getItem("prefixTextValue")||
""===localStorage.getItem("prefixTextValue")?tkLANG.inputPREFIX:localStorage.getItem("prefixTextValue");var b=null===localStorage.getItem("suffixTextValue")||void 0===localStorage.getItem("suffixTextValue")||""===localStorage.getItem("suffixTextValue")?tkLANG.inputSUFFIX:localStorage.getItem("suffixTextValue");$("#inputPREFIX").val(a);$("#inputSUFFIX").val(b);$("#buttonVIGNETTE").html(tkLANG.buttonVIGNETTE);$("#buttonCLARITY").html(tkLANG.buttonCLARITY);$("#buttonPMDUST").html(tkLANG.buttonPMDUST);
$("#buttonFREQUENCYSEPARATION").html(tkLANG.buttonFREQUENCYSEPARATION);$("#buttonNUMBER1").html(tkLANG.buttonNUMBER1);$("#buttonNUMBER2").html(tkLANG.buttonNUMBER2);$("#buttonNUMBER3").html(tkLANG.buttonNUMBER3);$("#buttonLIGHTSTP").html(tkLANG.buttonLIGHTSTP);$("#buttonDARKSTP").html(tkLANG.buttonDARKSTP);$("#buttonNUMBER4").html(tkLANG.buttonNUMBER4);$("#buttonNUMBER5").html(tkLANG.buttonNUMBER5);$("#buttonNUMBER6").html(tkLANG.buttonNUMBER6);$("#buttonORTONEFFECT").html(tkLANG.buttonORTONEFFECT);
$("#buttonRESTOREDORTON").html(tkLANG.buttonRESTOREDORTON);$("#buttonCOLORLUM").html(tkLANG.buttonCOLORLUM);$("#buttonCORRECTCA").html(tkLANG.buttonCORRECTCA);$("#buttonNEUTRALIZECAST").html(tkLANG.buttonNEUTRALIZECAST);$("#buttonADDCOLOR").html(tkLANG.buttonADDCOLOR);$("#buttonCOLORCLONE").html(tkLANG.buttonCOLORCLONE);$("#buttonMAKEITGLOW").html(tkLANG.buttonMAKEITGLOW);$("#buttonBATCH").html(tkLANG.buttonBATCH);$("#Vertical").html(tkLANG.buttonVERTICAL);$("#Horizontal").html(tkLANG.buttonHORIZONTAL);
$("#Fit").html(tkLANG.buttonFIT);$("#buttonSAVEFORWEB").html(tkLANG.buttonSAVEFORWEB);$("#spanBATCHSHARPENING").html(tkLANG.spanBATCHSHARPENING);$("#spanINPUT").html(tkLANG.spanINPUT);$("#spanCURRENTIMAGEONLY").html(tkLANG.spanCURRENTIMAGEONLY);$("#spanOUTPUT").html(tkLANG.spanOUTPUT);$("#spanBatchCONVERTTOSRGB").html(tkLANG.spanBatchCONVERTTOSRGB);$("#spanEMBEDCOLORPROFILE").html(tkLANG.spanEMBEDCOLORPROFILE);$("#spanPLAYACTION").html(tkLANG.spanPLAYACTION);$("#spanIMAGESETTINGS").html(tkLANG.spanIMAGESETTINGS);
$("#spanBatchDIMENSION").html(tkLANG.spanBatchDIMENSION);$("#spanBatchPIXELS").html(tkLANG.spanBatchPIXELS);$("#spanBatchOPACITY").html(tkLANG.spanBatchOPACITY);$("#spanBatchEXTRASHARP").html(tkLANG.spanBatchEXTRASHARP);$("#buttonALLACTIONS").html(tkLANG.buttonALLACTIONS);$("#buttonINPUTFOLDER").html(tkLANG.buttonINPUTFOLDER);$("#buttonOUTPUTFOLDER").html(tkLANG.buttonOUTPUTFOLDER);$("#buttonBATCHVERTICAL").html(tkLANG.buttonBATCHVERTICAL);$("#buttonBATCHHORIZONTAL").html(tkLANG.buttonBATCHHORIZONTAL);
$("#buttonBATCHFIT").html(tkLANG.buttonBATCHFIT)}function TKTT(a){"tipCLEAR"===a?$("#tktips").css({"font-size":"18px","font-family":"Verdana","text-align":"center","line-height":"49px",color:"#ffffff"}):$("#tktips, #Batchtktips").css({"font-size":"11px","font-family":"Arial","text-align":"left","line-height":"92%",color:"#000000"});$("#tktips, #Batchtktips").html(tkLANG[a])}
function openSettings(){var a=document.getElementById("settingsModal"),b=document.getElementById("spanCLOSESETTINGS");a.style.display="block";b.onclick=function(){a.style.display="none"};window.onclick=function(b){b.target==a&&(a.style.display="none")}}$("#buttonBATCH").click(function(){$("#AllActions").hide();$("#BatchSharpening").show()});$("#buttonALLACTIONS").click(function(){$("#BatchSharpening").css("display","none");$("#AllActions").css("display","block")});
$("#checkboxCURRENTIMAGEONLY").click(function(){!0===$("#checkboxCURRENTIMAGEONLY").is(":checked")?($("#buttonINPUTFOLDER, #buttonCLEARINPUTFOLDER").prop("disabled",!0),$("#buttonINPUTFOLDER, #buttonCLEARINPUTFOLDER").css("box-shadow","none")):($("#buttonINPUTFOLDER, #buttonCLEARINPUTFOLDER").prop("disabled",!1),$("#buttonINPUTFOLDER, #buttonCLEARINPUTFOLDER").mouseover(function(){$(this).css("box-shadow","0px 22px #8a8a8a inset")}),$("#buttonINPUTFOLDER, #buttonCLEARINPUTFOLDER").mouseout(function(){$(this).css("box-shadow",
"none")}))});$("#checkboxJPG").click(function(){!1===$("#checkboxJPG").is(":checked")?$("#inputJPGQUALITY").prop("disabled",!0):$("#inputJPGQUALITY").prop("disabled",!1)});$("#buttonINPUTFOLDER").click(function(){var a="$._ext_runGetInputFolder('"+$("#inputINPUTFOLDER").val()+"')";evalScript(a,function(a){"null"!==a&&$("#inputINPUTFOLDER").val(a)})});$("#buttonCLEARINPUTFOLDER").click(function(){$("#inputINPUTFOLDER").val("")});
$("#buttonOUTPUTFOLDER").click(function(){var a="$._ext_runGetOutputFolder('"+$("#inputOUTPUTFOLDER").val()+"')";evalScript(a,function(a){"null"!==a&&$("#inputOUTPUTFOLDER").val(a)})});$("#buttonCLEAROUTPUTFOLDER").click(function(){$("#inputOUTPUTFOLDER").val("")});$("#checkboxPREFIX").click(function(){!0===$("#checkboxPREFIX").is(":checked")?$("#inputPREFIX").prop("disabled",!1):($("#inputPREFIX").prop("disabled",!0),""===$("#inputPREFIX").val()&&$("#inputPREFIX").val(tkLANG.inputPREFIX))});
$("#inputPREFIX").mousedown(function(){$("#inputPREFIX").val()===tkLANG.inputPREFIX&&$("#inputPREFIX").val("")});$("#buttonCLEARPREFIX").click(function(){$("#inputPREFIX").val(tkLANG.inputPREFIX)});$("#checkboxSUFFIX").click(function(){!0===$("#checkboxSUFFIX").is(":checked")?$("#inputSUFFIX").prop("disabled",!1):($("#inputSUFFIX").prop("disabled",!0),""===$("#inputSUFFIX").val()&&$("#inputSUFFIX").val(tkLANG.inputSUFFIX))});
$("#inputSUFFIX").mousedown(function(){$("#inputSUFFIX").val()===tkLANG.inputSUFFIX&&$("#inputSUFFIX").val("")});$("#buttonCLEARSUFFIX").click(function(){$("#inputSUFFIX").val(tkLANG.inputSUFFIX)});$("#selectSELECTIONINDICATOR").change(function(){var a=$("#selectSELECTIONINDICATOR").val();localStorage.setItem("selectionIndicatorSetting",a)});
function startActiveSelectionIndicator(a){var b;"fixed"===a&&(b="activeSelectionImg");"animated"===a&&(b="activeSelectionGIF");(new PSSelectEvent).start(function(){document.getElementById(b).style.visibility="visible"},function(){document.getElementById(b).style.visibility="hidden"})}
$("#buttonBATCHVERTICAL, #buttonBATCHHORIZONTAL, #buttonBATCHFIT").click(function(){var a=$("#checkboxCURRENTIMAGEONLY").is(":checked");$("#inputPREFIXSUFFIX").val();var b=$("#inputINPUTFOLDER").val(),c=$("#inputOUTPUTFOLDER").val(),e=$("#checkboxJPG").is(":checked"),d=$("#checkboxPSD").is(":checked"),g=$("#checkboxTIF").is(":checked"),h=$("#checkboxPNG").is(":checked"),f=$("#inputJPGQUALITY").val(),k=$("#checkboxBatchCONVERTTOSRGB").is(":checked"),v=$("#checkboxEMBEDCOLORPROFILE").is(":checked"),
l=$("#checkboxPLAYACTION").is(":checked"),m=$("#inputBatchDIMENSION").val(),n=$("#inputBatchOPACITY").val(),p=$("#checkboxBatchEXTRASHARP").is(":checked"),z=this.value,q=$("#checkboxPREFIX").is(":checked"),r=$("#checkboxSUFFIX").is(":checked"),s=$("#inputPREFIX").val(),w=$("#inputSUFFIX").val();evalScript("$._ext_runBatchSharpen('"+a+"','"+b+"','"+c+"','"+e+"','"+d+"','"+g+"','"+h+"','"+f+"','"+k+"','"+v+"','"+l+"','"+m+"','"+n+"','"+p+"','"+z+"','"+q+"','"+s+"','"+r+"','"+w+"')");localStorage.setItem("currentImageOnlyValue",
a);localStorage.setItem("inputFolderValue",b);localStorage.setItem("outputFolderValue",c);localStorage.setItem("jpgOutputValue",e);localStorage.setItem("psdOutputValue",d);localStorage.setItem("tifOutputValue",g);localStorage.setItem("pngOutputValue",h);localStorage.setItem("jpgQualityValue",f);localStorage.setItem("BatchConvertValue",k);localStorage.setItem("embedColorProfileValue",v);localStorage.setItem("playActionValue",l);localStorage.setItem("BatchDimensionValue",m);localStorage.setItem("BatchOpacityValue",
n);localStorage.setItem("BatchExtraSharpValue",p);localStorage.setItem("prefixValue",q);localStorage.setItem("suffixValue",r);localStorage.setItem("prefixTextValue",s);localStorage.setItem("suffixTextValue",w)});
