trAvis - MANAGER
Edit File: plus-editor.min.js
jQuery(window).on("elementor:init",function(){var a=elementor.modules.controls.Select2.extend({cache:null,isTitlesReceived:!1,getSelect2Placeholder:function(){var a=this;return{id:"",text:a.model.get("placeholder")||"All"}},getSelect2DefaultOptions:function(){var a=this;return jQuery.extend(elementor.modules.controls.Select2.prototype.getSelect2DefaultOptions.apply(this,arguments),{ajax:{transport:function(b,c,d){var e={q:b.data.q,query_type:a.model.get("query_type"),object_type:a.model.get("object_type"),query_options:a.model.get("query_options")};return elementorCommon.ajax.addRequest("plus_query_control_filter_autocomplete",{data:e,success:c,error:d})},data:function(a){return{q:a.term,page:a.page}},cache:!0},escapeMarkup:function(a){return a},minimumInputLength:2})},get_value_titles:function(){var a=this,b=this.getControlValue(),c=this.model.get("query_type"),d=this.model.get("object_type"),e=this.model.get("query_options");b&&c&&(!_.isArray(b)&&(b=[b]),elementorCommon.ajax.loadObjects({action:"plus_query_control_value_titles",ids:b,data:{query_type:c,object_type:d,query_options:e,unique_id:""+a.cid+c},success:function(b){a.isTitlesReceived=!0,a.model.set("options",b),a.render()},before:function(){a.add_spinner()}}))},add_spinner:function(){this.ui.select.prop("disabled",!0),this.$el.find(".elementor-control-title").after("<span class=\"elementor-control-spinner\"> <i class=\"fas fa-spinner fa-spin\"></i> </span>")},onReady:function(){setTimeout(elementor.modules.controls.Select2.prototype.onReady.bind(this)),this.isTitlesReceived||this.get_value_titles()},onBeforeDestroy:function(){this.ui.select.data("select2")&&this.ui.select.select2("destroy"),this.$el.remove()}});elementor.addControlView("plus-query",a)}),jQuery(document).on("click",".tp-beach-fb-button",function(){function a(){f&&!1==f.closed?setTimeout(a,100):jQuery.ajax({type:"POST",url:PlusEditor_localize.ajax,dataType:"JSON",data:{action:"theplus_socialreview_Gettoken",security:PlusEditor_localize.ajax,GetNonce:PlusEditor_localize.SocialReview_nonce},success:function(a){console.log(a),a.success?(jQuery(c).val(a.SocialReview.data[0].access_token).trigger("input"),jQuery(FillPageId).val(a.SocialReview.data[0].id).trigger("input")):alert("something wrong")},error:function(a){console.log(a)}})}let b=this.closest("#elementor-controls"),c=jQuery(b).find(".elementor-control-BToken textarea");FillPageId=jQuery(b).find(".elementor-control-BPPId input");var d=screen.height/2-260,e=screen.width/2-335,f=window.open("https://theplusaddons.com/social-app-reviews/","","location=1,status=1,resizable=yes,width=670,height=520,top="+d+",left="+e);setTimeout(a,100)}),jQuery(document).on("click",".tp-review-fb-button",function(){function a(){f&&!1==f.closed?setTimeout(a,100):jQuery.ajax({type:"POST",url:PlusEditor_localize.ajax,dataType:"JSON",data:{action:"theplus_socialreview_Gettoken",security:PlusEditor_localize.ajax,GetNonce:PlusEditor_localize.SocialReview_nonce},success:function(a){console.log(a),a.success?(jQuery(c).val(a.SocialReview.data[0].access_token).trigger("input"),jQuery(FillPageId).val(a.SocialReview.data[0].id).trigger("input")):alert("something wrong")},error:function(a){console.log(a)}})}var b=this.closest(".elementor-repeater-row-controls.editable"),c=jQuery(b).find(".elementor-control-Token textarea");FillPageId=jQuery(b).find(".elementor-control-FbPageId input");var d=screen.height/2-260,e=screen.width/2-335,f=window.open("https://theplusaddons.com/social-app-reviews/","","location=1,status=1,resizable=yes,width=670,height=520,top="+d+",left="+e);setTimeout(a,100)}),jQuery(document).on("click",".tp-feed-fb-button",function(){var a=this.closest(".elementor-repeater-row-controls.editable"),b=jQuery(a).find(".elementor-control-SFFbAppId input").val();return""===b?(alert("Enter APP ID"),!1):void Facebook_key_generat("SocialFeed",this)}),jQuery(document).on("click",".tp-feed-IG-button",function(){var a=this.closest(".elementor-repeater-row-controls.editable"),b=jQuery(a).find(".elementor-control-SFFbAppId input").val();return""===b?(alert("Enter APP ID"),!1):void Facebook_key_generat("IG_SocialFeed",this)});function Facebook_key_generat(a,b){(function(a,b,c){var d,e=a.getElementsByTagName(b)[0];a.getElementById(c)||(d=a.createElement(b),d.id=c,d.src="https://connect.facebook.net/en_US/sdk.js",e.parentNode.insertBefore(d,e))})(document,"script","facebook-jssdk");var c=b.closest(".elementor-repeater-row-controls.editable"),d="",e="",f="",g="",h="",i=jQuery;"SocialFeed"==a?(d=i(c).find(".elementor-control-SFFbAppId input").val(),GetAppSecret=i(c).find(".elementor-control-SFFbAppSecretId input").val(),e=i(c).find(".elementor-control-ProfileType select :selected").val(),f=i(c).find(".elementor-control-RAToken textarea"),"page"==e?(h=i(c).find(".elementor-control-Pageid input"),g="pages_read_engagement,pages_read_user_content,user_photos,pages_show_list"):"post"==e&&(g="user_posts,user_photos,user_videos,user_likes,user_link")):"IG_SocialFeed"==a&&(d=i(c).find(".elementor-control-SFFbAppId input").val(),GetAppSecret=i(c).find(".elementor-control-SFFbAppSecretId input").val(),f=i(c).find(".elementor-control-RAToken textarea"),h=i(c).find(".elementor-control-IGPageId input"),g="pages_show_list,pages_read_engagement,instagram_basic,ads_management,business_management,instagram_content_publish,instagram_manage_comments,instagram_manage_insights"),window.fbAsyncInit=function(){FB.init({appId:d,status:!0,cookie:!0,oauth:!0,xfbml:!0,version:"v11.0"}),FB.login(function(b){if("connected"===b.status){var c=b.authResponse.userID,g=b.authResponse.accessToken;b&&"SocialFeed"==a?"page"==e?Generate_longlived_token(f,h,d,GetAppSecret,c,g):"post"==e&&Generate_longlived_token(f,h,d,GetAppSecret,c,g):b&&"IG_SocialFeed"==a&&Generate_longlived_token(f,h,d,GetAppSecret,c,g)}else"not_authorized"===b.status?console.log("not_authorized"):console.log("login status fail")},{scope:g,auth_type:"rerequest"})}}function Generate_longlived_token(a,b,c,d,e,f){var g=jQuery;fetch("https://graph.facebook.com/v11.0/oauth/access_token?grant_type=fb_exchange_token&client_id="+c+"&client_secret="+d+"&fb_exchange_token="+f).then(a=>a.json()).then(function(c){console.log(c),c&&(g(a).val(c.access_token).trigger("input"),fetch("https://graph.facebook.com/"+e+"/accounts?access_token="+c.access_token).then(a=>a.json()).then(function(a){a&&g(b).val(a.data[0].id).trigger("input")}))})}jQuery(document).on("click",".tp-feed-delete-transient, .tp-SReview-delete-transient",function(){let a=this;ClassName=jQuery(this).attr("class"),BlockName="","tp-feed-delete-transient"==ClassName?BlockName="SocialFeed":"tp-SReview-delete-transient"==ClassName&&(BlockName="SocialReviews");let b=a.textContent;a.innerHTML="<svg version=\"1.1\" id=\"L9\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 100 100\" enable-background=\"new 0 0 0 0\" xml:space=\"preserve\" ><path fill=\"#fff\" d=\"M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50\"><animateTransform attributeName=\"transform\" attributeType=\"XML\" type=\"rotate\" dur=\"1s\" from=\"0 50 50\" to=\"360 50 50\" repeatCount=\"indefinite\" /></path></svg>",a.style.cssText="padding: 0px; margin-right: 10px; pointer-events:none";let c={action:"Tp_delete_transient",blockName:BlockName,delete_transient_nonce:PlusEditor_localize.delete_transient_nonce};jQuery.ajax({url:PlusEditor_localize.ajax,type:"POST",data:c,dataType:"json",async:!1,beforeSend:function(){},success:function(){var c=new Date(Date.now()+300000),d=setInterval(function(){let e=new Date().getTime(),f=c-e,g=Math.floor(f%3600000/60000),h=Math.floor(f%60000/1e3);a.innerHTML=g+"m "+h+"s ",0>f&&(clearInterval(d),a.innerHTML=b,a.style.cssText="padding: 10px; margin-right: 0px; pointer-events:inherit")},1e3);setTimeout(function(){a.style.cssText="padding: 10px; margin-right: 0px; pointer-events:none"},1e3)}})});