%PDF- %PDF-
Direktori : /var/www/html/friendstravel.al/wp-content/plugins/woocommerce-multilingual/res/js/ |
Current File : //var/www/html/friendstravel.al/wp-content/plugins/woocommerce-multilingual/res/js/dialogs.min.js |
var WCML_Dialog=WCML_Dialog||{};jQuery(function(a){var b;WCML_Dialog.dialog=function(c,d){var e=this;"undefined"==typeof c&&(c="generic"),e.overflow_y=a("body").css("overflow-y"),a("body").css("overflow-y","hidden"),b=a("#wcml-dialog-"+c);var f=a("#"+c).attr("title");if("undefined"==typeof f&&(f="undefined"!=d.title?d.title:""),"undefined"==typeof d["class"]&&(d["class"]=""),"undefined"==typeof d.draggable&&(d.draggable=!1),!b.length){a(document.body).append(a('<div class="wcml-dialog-container" title="'+f+'" id="wcml-dialog-'+c+'" />')),b=a("#wcml-dialog-"+c);var g=a(window).height(),h={title:"",autoOpen:!1,show:!0,dialogClass:"wcml-ui-dialog otgs-ui-dialog "+d["class"],position:{my:"center",at:"center",of:window},modal:!0,width:"90%",height:.7*g,resizable:!1,draggable:d.draggable,beforeOpen:function(a){},beforeClose:function(a){},close:function(b){a("body").css("overflow-y",e.overflow_y)},create:function(a){},focus:function(a){},open:function(b){a("body").css("overflow","hidden"),"wcml-cs-dialog"===d["class"]&&WCML_Dialog._attachDialogScrollEvent()},refresh:function(a){}};"undefined"!=typeof d.height&&"wcml-cs-dialog"!=d["class"]&&(h.height=Math.min(.7*g,d.height)),"undefined"!=typeof d.width&&"wcml-cs-dialog"!=d["class"]&&(h.width=d.width),WCML_Dialog.using_wpdialog?b.wpdialog(h):b.dialog(h).on("dialogopen",function(){WCML_Dialog._repositionDialog()})}var i=_.debounce(function(){WCML_Dialog._repositionDialog(),"wcml-cs-dialog"===d["class"]&&WCML_Dialog._attachDialogScrollEvent()},200);if(WCML_Dialog.using_wpdialog?b.wpdialog("open"):b.dialog("open"),d.action){var j=a('<div class="spinner"></div>');j.css({display:"inline-block",visibility:"visible","float":"none"}),b.html(j),a.ajax({url:ajaxurl,type:"post",dataType:"json",data:d,success:function(a){b.html(a.html)}})}return d.content&&a("#"+d.content).length&&b.html(a("#"+d.content).html()),"undefined"!=typeof WCML_Tooltip&&WCML_Tooltip.init(),a(window).resize(i),!1},WCML_Dialog._repositionDialog=function(){var c=a(window).height()-180;b.css("max-height",c),b.dialog("option","position",{my:"center",at:"center",of:window})},WCML_Dialog._attachDialogScrollEvent=function(){var a=b.find(".wcml-currency-preview-wrapper"),c=b.width()>900,d=a.height()+200<b.height();d=d||c&&a.height()<b.height(),d?b.on("scroll.preview",function(){b.find(".wcml-currency-preview-wrapper").css({position:"relative",top:b.scrollTop()})}):b.off("scroll.preview").find(".wcml-currency-preview-wrapper").css({position:"relative",top:0})},WCML_Dialog._register_open_handler=function(){a(document).on("click",".js-wcml-dialog-trigger",function(b){b.preventDefault();var c=!1;a(this).data("dialog")?c=a(this).data("dialog"):a(this).data("action")&&(c=a(this).data("action")),c&&(a(this).data("action")&&a(this).data("action",a(this).data("action").replace(/-/g,"_")),WCML_Dialog.dialog(c,a(this).data()))}),a(document).on("click",".js-wcml-cs-dialog-trigger",function(b){b.preventDefault();var c=!1;a(this).data("dialog")&&(c=a(this).data("dialog"));var d=a(this).data();d["class"]="wcml-cs-dialog",d.draggable=!0,c&&(WCML_Dialog.dialog(c,d),WCML_Currency_Switcher_Settings.initColorPicker(),WCML_Currency_Switcher_Settings.currency_switcher_preview(a("#wcml-dialog-"+c)))})},WCML_Dialog._register_close_handler=function(){a(document).on("click",".wcml-dialog-close-button",function(b){b.preventDefault(),"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave(),a(".wcml-dialog").find(".mce_editor textarea").each(function(){var b=a(this).attr("id"),c=a(this);if(b in tinyMCE.editors){var d=tinyMCE.get(b);d.isHidden()||c.val(d.getContent())}});var c=a(this).closest(".wcml-dialog-container"),d=a(this);d.attr("disabled","disabled");var e=a(this).data();if(e.action){var f=a('<div class="spinner"></div>');f.css({visibility:"visible","float":"right"}).prependTo(a(".wcml-dialog-footer .alignright")),a.ajax({url:ajaxurl,type:"post",dataType:"json",data:{action:e.action,fields:d.closest(".wcml-dialog-container").find("form").serialize(),icl_nonce:e.nonce},async:!1,success:function(a){e.stay&&(f.remove(),d.removeAttr("disabled"))}})}e.stay||(d.trigger("before_close_dialog"),WCML_Dialog.using_wpdialog?c.wpdialog("close"):c.dialog("close"))})},WCML_Dialog.init=function(){a(document).ready(function(){"undefined"!=typeof a.wp?WCML_Dialog.using_wpdialog="undefined"!=typeof a.wp.wpdialog:WCML_Dialog.using_wpdialog=!1,WCML_Dialog._register_open_handler(),WCML_Dialog._register_close_handler()})},WCML_Dialog.init()});