File "redux-typography.min.js"

Full Path: /home/elegucvf/public_html/video/wp-content/plugins/atlas-core/framework/redux-core/inc/fields/typography/redux-typography.min.js
File size: 16.39 KB
MIME-type: text/plain
Charset: utf-8

!function(P){"use strict";var D=[],W=!1;redux.field_objects=redux.field_objects||{},redux.field_objects.typography=redux.field_objects.typography||{},redux.field_objects.typography.init=function(e){e=P.redux.getSelector(e,"typography"),P(e).each(function(){var e=P(this),t=e;(t=e.hasClass("redux-field-container")?t:e.parents(".redux-field-container:first")).is(":hidden")||e.each(function(){P(this).find(".redux-typography-container").each(function(){var e,t,a,r=P(this),s=r,o=P(this).find(".redux-typography-family"),i=o.data("value"),p=P(this).find(".redux-typography-family").parents(".redux-container-typography:first").data("id"),d=P("#"+p+" .redux-typography-google").val(),n=[],y=[],l=P("#"+p+" .redux-typography-font-family").data("user-fonts");if(!(s=r.hasClass("redux-field-container")?s:r.parents(".redux-field-container:first")).is(":hidden")&&s.hasClass("redux-field-init")){if(s.removeClass("redux-field-init"),void 0===i?o=P(this):""!==i&&P(o).val(i),l=l?1:0,d=d?1:0,void 0!==redux.customfonts&&n.push(redux.customfonts),void 0!==redux.typekitfonts&&n.push(redux.typekitfonts),void 0!==redux.stdfonts&&0==l&&n.push(redux.stdfonts),1==l){for(e in redux.optName.typography[p])if(redux.optName.typography[p].hasOwnProperty(e))for(a in t=redux.optName.typography[p].std_font)t.hasOwnProperty(a)&&y.push({id:a,text:a,"data-google":"false"});n.push({text:"Standard Fonts",children:y})}(1==d||!0===d&&void 0!==redux.googlefonts)&&n.push(redux.googlefonts),i=n,l=P(this).find(".redux-typography-family").data("value"),P(this).find(".redux-typography-family").addClass("ignore-change"),P(this).find(".redux-typography-family").select2({data:i}),P(this).find(".redux-typography-family").val(l).trigger("change"),P(this).find(".redux-typography-family").removeClass("ignore-change"),r.find(".redux-typography-family").hasClass("redux-typography-family")||r.find(".redux-typography-style").select2(),P(this).find(".redux-typography-subsets").select2(),P(this).find(".redux-typography-align").select2(),P(this).find(".redux-typography-family-backup").select2(),P(this).find(".redux-typography-transform").select2(),P(this).find(".redux-typography-font-variant").select2(),P(this).find(".redux-typography-decoration").select2(),P(this).find(".redux-insights-data-we-collect-typography").on("click",function(e){e.preventDefault(),P(this).parent().find(".description").toggle()}),redux.field_objects.typography.select(o,!0,!1,null,!0),P(this).find(".redux-typography-family, .redux-typography-family-backup, .redux-typography-style, .redux-typography-subsets, .redux-typography-align").on("change",function(e){var t,a,r=P(this).attr("id"),r=P("#"+r);P(this).hasClass("redux-typography-family")?r.val()&&(a=(t=P(this).select2("data"))?t[0].text:null,r.data("value",a),D=t[0],W=!0,redux.field_objects.typography.select(r,!0,!1,a,!0)):(e=r.val(),r.data("value",e),(P(this).hasClass("redux-typography-align")||P(this).hasClass("redux-typography-subsets")||P(this).hasClass("redux-typography-family-backup")||P(this).hasClass("redux-typography-transform")||P(this).hasClass("redux-typography-font-variant")||P(this).hasClass("redux-typography-decoration"))&&(r.find('option[selected="selected"]').attr("selected",!1),r.find('option[value="'+e+'"]').attr("selected","selected")),P(this).hasClass("redux-typography-subsets")&&r.siblings(".typography-subsets").val(e),redux.field_objects.typography.select(P(this),!0,!1,null,!1))}),P(this).find(".redux-typography-size, .redux-typography-height, .redux-typography-word, .redux-typography-letter, .redux-typography-margin-top, .redux-typography-margin-bottom").on("keyup",function(){redux.field_objects.typography.select(P(this).parents(".redux-container-typography:first"))}),P(this).find(".redux-typography-color, .redux-typography-shadow-color").wpColorPicker({change:function(e,t){P(this).val(t.color.toString()),redux.field_objects.typography.select(P(this).parents(".redux-container-typography:first"))}}),P(this).find(".redux-typography-size").numeric({allowMinus:!1}),P(this).find(".redux-typography-height, .redux-typography-word, .redux-typography-letter").numeric({allowMinus:!0}),P(this).find(".redux-typography").on("select2:unselecting",function(){var e,t,a=P(this).data("select2").options;a.set("disabled",!0),setTimeout(function(){a.set("disabled",!1)},1),e=P(this).attr("id"),(t=P("#"+e)).data("value",""),P(this).hasClass("redux-typography-family")?(P(this).find(".redux-typography-family").addClass("ignore-change"),P(this).val(null).trigger("change"),P(this).find(".redux-typography-family").removeClass("ignore-change"),redux.field_objects.typography.select(t,!0,!1,null,!0)):((P(this).hasClass("redux-typography-align")||P(this).hasClass("redux-typography-subsets")||P(this).hasClass("redux-typography-family-backup")||P(this).hasClass("redux-typography-transform")||P(this).hasClass("redux-typography-font-variant")||P(this).hasClass("redux-typography-decoration"))&&P("#"+e+' option[selected="selected"]').removeAttr("selected"),P(this).hasClass("redux-typography-subsets")&&t.siblings(".typography-subsets").val(""),P(this).hasClass("redux-typography-family-backup")&&(P(this).find(".redux-typography-family-backup").addClass("ignore-change"),t.val(null).trigger("change"),P(this).find(".redux-typography-family-backup").removeClass("ignore-change")),redux.field_objects.typography.select(P(this),!0,!1,null,!1))}),redux.field_objects.typography.updates(P(this)),window.onbeforeunload=null,s.removeClass("redux-field-init"),redux.field_objects.typography.sliderInit(r)}})})})},redux.field_objects.typography.sliderInit=function(d){d.find(".redux-typography-slider").each(function(){var e=P(this).data("id"),t=P(this).data("min"),a=P(this).data("max"),r=P(this).data("step"),s=P(this).data("default"),o=P(this).data("label"),i=Boolean(P(this).data("rtl")),t=[t,a],p=P(this).reduxNoUiSlider({range:t,start:s,handles:1,step:r,connect:"lower",behaviour:"tap-drag",rtl:i,serialization:{resolution:1},slide:function(){P(this).next("#redux-slider-value-"+e).attr("value",p.val()),P(this).prev("label").html(o+":  <strong>"+p.val()+"px</strong>"),redux.field_objects.typography.select(d)}})})},redux.field_objects.typography.updates=function(s){s.find(".update-google-fonts").on("click",function(e){var t=P(this).data("action"),a=P(this).parent().parent(),r=a.attr("data-nonce");return a.find("p").text(redux_typography_ajax.update_google_fonts.updating),a.find("p").attr("aria-label",redux_typography_ajax.update_google_fonts.updating),a.removeClass("updating-message updated-message notice-success notice-warning notice-error").addClass("update-message notice-warning updating-message"),P.ajax({type:"post",dataType:"json",url:redux_typography_ajax.ajaxurl,data:{action:"redux_update_google_fonts",nonce:r,data:t},error:function(e){console.log(e),a.removeClass("notice-warning updating-message updated-message notice-success").addClass("notice-error"),e=(e=e.error)&&': "'+e+'"',a.find("p").html(redux_typography_ajax.update_google_fonts.error.replace("%s",t).replace("|msg",e)),a.find("p").attr("aria-label",redux_typography_ajax.update_google_fonts.error),redux.field_objects.typography.updates(s)},success:function(e){console.log(e),"success"===e.status?(a.find("p").html(redux_typography_ajax.update_google_fonts.success),a.find("p").attr("aria-label",redux_typography_ajax.update_google_fonts.success),a.removeClass("updating-message notice-warning").addClass("updated-message notice-success"),P(".redux-update-google-fonts").not(".notice-success").remove()):(a.removeClass("notice-warning updating-message updated-message notice-success").addClass("notice-error"),e=(e=e.error)&&': "'+e+'"',a.find("p").html(redux_typography_ajax.update_google_fonts.error.replace("%s",t).replace("|msg",e)),a.find("p").attr("aria-label",redux_typography_ajax.update_google_fonts.error),redux.field_objects.typography.updates(s))}}),e.preventDefault(),!1})},redux.field_objects.typography.size=function(e){var t,a=0;for(t in e)e.hasOwnProperty(t)&&(a+=1);return a},redux.field_objects.typography.makeBool=function(e){return"false"!==e&&"0"!==e&&!1!==e&&0!==e&&("true"===e||"1"===e||!0===e||1===e||void 0)},redux.field_objects.typography.contrastColour=function(e){var t="#444444";return""!==e&&(e=e.replace("#",""),t=128<=(299*parseInt(e.substring(0,2),16)+587*parseInt(e.substring(2,2),16)+114*parseInt(e.substring(4,2),16))/1e3?"#444444":"#ffffff"),t},redux.field_objects.typography.hexToInt=function(e){return 0===e.indexOf("#")&&(e=e.slice(1)),parseInt(e,16)},redux.field_objects.typography.select=function(e,t,a,r,s){var o,i,p,d,n,y,l,h,g,u,f,c,x,v,m,b,_,w,C,j,k,z,I,O,S=!1,T="",B='<option value=""></option>',N="",F=P(e).parents(".redux-container-typography:first").data("id");void 0===F&&(F=P(e).data("id")),o=P("#"+F),i=(i=P("#"+F+"-family").val())||null,r&&(i=r),r=o.find("select.redux-typography-family-backup").val(),d=o.find(".redux-typography-size").val(),n=o.find(".redux-typography-height").val(),y=o.find(".redux-typography-word").val(),l=o.find(".redux-typography-letter").val(),h=o.find("select.redux-typography-align").val(),g=o.find("select.redux-typography-transform").val(),u=o.find("select.redux-typography-font-variant").val(),f=o.find("select.redux-typography-decoration").val(),c=o.find("select.redux-typography-style").val(),x=o.find("select.redux-typography-subsets").val(),v=o.find(".redux-typography-color").val(),z=o.find(".redux-typography-margin-top").val(),I=o.find(".redux-typography-margin-bottom").val(),k=o.find(".typography-style"),j=o.data("units"),void 0===y&&(y="0"),void 0===l&&(l="0"),0<k.length&&(O=JSON.parse(decodeURIComponent(k.data("weights")))),!0===W?(p=redux.field_objects.typography.makeBool(D["data-google"]),o.find(".redux-typography-google-font").val(p)):p=redux.field_objects.typography.makeBool(o.find(".redux-typography-google-font").val()),s&&(o.hasClass("typography-initialized")||(c=o.find("select.redux-typography-style").data("value"),x=o.find("select.redux-typography-subsets").data("value"),""!==c&&(c=String(c)),x=String(x)),void 0===redux.fonts.google&&(p=!1),T=!0===p&&i in redux.fonts.google?redux.fonts.google[i]:void 0!==redux.fonts.typekit&&i in redux.fonts.typekit?(S=!0,redux.fonts.typekit[i]):O,P(e).hasClass("redux-typography-subsets")&&o.find("input.typography-subsets").val(x),P(e).hasClass("redux-typography-family")?(!0===p?(P.each(T.variants,function(e,t){t.id===c||1===redux.field_objects.typography.size(T.variants)?(N=' selected="selected"',c=t.id):N="",B+='<option value="'+t.id+'"'+N+">"+t.name.replace(/\+/g," ")+"</option>"}),a&&o.find(".redux-typography-style").select2("destroy"),o.find(".redux-typography-style").html(B).select2(),N="",B='<option value=""></option>',P.each(T.subsets,function(e,t){x===t.id||1===redux.field_objects.typography.size(T.subsets)?(N=' selected="selected"',x=t.id,o.find("input.typography-subsets").val(x)):N="",B+='<option value="'+t.id+'"'+N+">"+t.name.replace(/\+/g," ")+"</option>"}),a&&o.find(".redux-typography-subsets").select2("destroy"),o.find(".redux-typography-subsets").html(B).select2({width:"100%"}),o.find(".redux-typography-subsets").parent().fadeIn("fast"),o.find(".typography-family-backup").fadeIn("fast")):!0===S?(P.each(T.variants,function(e,t){c===t.id||1===redux.field_objects.typography.size(T.variants)?(N=' selected="selected"',c=t.id):N="",B+='<option value="'+t.id+'"'+N+">"+t.name.replace(/\+/g," ")+"</option>"}),o.find(".redux-typography-style").select2("destroy"),o.find(".redux-typography-style").html(B).select2(),o.find(".redux-typography-subsets").parent().fadeOut("fast"),o.find(".typography-family-backup").fadeOut("fast")):o.find(".redux-typography-style")&&(P.each(O,function(e,t){c===e||"normal"===e?(N=' selected="selected"',o.find(".typography-style select2-selection__rendered").text(t)):N="",B+='<option value="'+e+'"'+N+">"+t.replace("+"," ")+"</option>"}),a&&o.find(".redux-typography-style").select2("destroy"),o.find(".redux-typography-style").html(B).select2()),o.find(".redux-typography-font-family").val(i)):P(e).hasClass("redux-typography-family-backup")&&""!==r?o.find(".redux-typography-font-family-backup").val(r):(T=O)&&(P.each(T,function(e,t){c===e||"normal"===e?(N=' selected="selected"',o.find(".typography-style select2-selection__rendered").text(t)):N="",B+='<option value="'+e+'"'+N+">"+t.replace("+"," ")+"</option>"}),a&&o.find(".redux-typography-style").select2("destroy"),o.find(".redux-typography-style").html(B).select2(),o.find(".redux-typography-subsets").parent().fadeOut("fast"),o.find(".typography-family-backup").fadeOut("fast"))),s&&(o.find(".redux-typography-style").addClass("ignore-change"),0===o.find("select.redux-typography-style option[value='"+c+"']").length?(c="",o.find("select.redux-typography-style").val("").trigger("change")):"400"===c&&o.find("select.redux-typography-style").val(c).trigger("change"),o.find(".redux-typography-style").removeClass("ignore-change"),0===o.find("select.redux-typography-subsets option[value='"+x+"']").length)&&(x="",o.find(".redux-typography-style").addClass("ignore-change"),o.find("select.redux-typography-subsets").val("").trigger("change"),o.find("input.typography-subsets").val(x),o.find(".redux-typography-style").removeClass("ignore-change")),P("."+("style_link_"+F)).remove(),null!==i&&"inherit"!==i&&o.hasClass("typography-initialized")&&(k=i.replace(/\s+/g,"+"),!0===p?(S=k,c&&""!==c&&(S+=":"+c.replace(/\-/g," ")),x&&""!==x&&(S+="&subset="+x),!1===W&&"undefined"!=typeof WebFont&&WebFont&&WebFont.load({google:{families:[S]}}),o.find(".redux-typography-google").val(!0)):o.find(".redux-typography-google").val(!1)),c&&-1!==c.indexOf("italic")?(o.find(".typography-preview").css("font-style","italic"),o.find(".typography-font-style").val("italic"),c=c.replace("italic","")):(o.find(".typography-preview").css("font-style","normal"),o.find(".typography-font-style").val("")),o.find(".typography-font-weight").val(c),Boolean(o.find(".redux-typography-height").data("allow-empty"))||(n=n||d),""===d||void 0===d?o.find(".typography-font-size").val(""):(r=o.find(".redux-typography-size").data("unit"),o.find(".typography-font-size").val(d+r)),""===n||void 0===n?o.find(".typography-line-height").val(""):(_=o.find(".redux-typography-height").data("unit"),o.find(".typography-line-height").val(n+_)),""===y||void 0===y?o.find(".typography-word-spacing").val(""):(w=o.find(".redux-typography-word").data("unit"),o.find(".typography-word-spacing").val(y+w)),""===l||void 0===l?o.find(".typography-letter-spacing").val(""):(C=o.find(".redux-typography-letter").data("unit"),o.find(".typography-letter-spacing").val(l+C)),""===z||void 0===z?o.find(".typography-margin-top").val(""):(m=o.find(".redux-typography-margin-top").data("unit"),o.find(".typography-margin-top").val(z+m)),""===I||void 0===I?o.find(".typography-margin-bottom").val(""):(b=o.find(".redux-typography-margin-bottom").data("unit"),o.find(".typography-margin-bottom").val(I+b)),o.hasClass("typography-initialized")&&(0===o.find(".typography-preview").data("preview-size")&&o.find(".typography-preview").css("font-size",d+j),o.find(".typography-preview").css({"font-weight":c,"text-align":h,"font-family":i+", sans-serif","padding-top":z+m,"padding-bottom":I+b}),"none"===i&&""===i&&o.find(".typography-preview").css("font-family","inherit"),n&&o.find(".typography-preview").css("line-height",n+_),y&&o.find(".typography-preview").css("word-spacing",y+w),l&&o.find(".typography-preview").css("letter-spacing",l+C),v&&(o.find(".typography-preview").css("color",v),O=redux.field_objects.typography.hexToInt(v),a=redux.field_objects.typography.hexToInt("ffffff"),redux.field_objects.typography.hexToInt("dddddd")<=O&&O<=a?o.find(".typography-preview").css("background-color","black"):o.find(".typography-preview").css("background-color","")),redux.field_objects.typography.previewShadow(F),o.find(".typography-style select2-selection__rendered").text(o.find(".redux-typography-style option:selected").text()),o.find(".typography-script select2-selection__rendered").text(o.find(".redux-typography-subsets option:selected").text()),h&&o.find(".typography-preview").css("text-align",h),g&&o.find(".typography-preview").css("text-transform",g),u&&o.find(".typography-preview").css("font-variant",u),f&&o.find(".typography-preview").css("text-decoration",f),o.find(".typography-preview").slideDown()),o.hasClass("typography-initialized")||o.addClass("typography-initialized"),W=!1,t||redux_change(e)},redux.field_objects.typography.previewShadow=function(e){var t=P("#"+e+" .redux-typography-shadow-color").val(),a=P("#redux-slider-value-"+e+"-h").val(),r=P("#redux-slider-value-"+e+"-v").val(),s=P("#redux-slider-value-"+e+"-b").val();t&&P("#"+e+" .typography-preview").css("text-shadow",a+"px "+r+"px "+s+"px "+t)}}(jQuery);