FB._https = (window.location.protocol == "https:"); FB.init({ appId: '2511208999168874', status: true, cookie: true, xfbml: true, channelUrl: 'https://'+window.location.hostname+'/channel.html', oauth: true, version: 'v3.0' }); FB.AppEvents.logPageView(); function FBresize() { FB.Canvas.setSize({width: 640, height: 810}); FB.Canvas.setAutoGrow(); } function fwl() { var time = new Date().getTime(); top.location.href = 'https://'+window.location.hostname+'/main'; } function FB_login() { FB.login(function (response) { if (response.authResponse) { setTimeout(fwl(), 1000); } else { setTimeout(fwl(), 1000); } }, {scope: 'email,pages_manage_posts,pages_show_list,pages_read_engagement,business_management,ads_management,read_insights,public_profile,pages_manage_ads,instagram_content_publish,instagram_basic,publish_to_groups,leads_retrieval,pages_manage_metadata,ads_read,pages_read_user_content,publish_video,read_insights,instagram_manage_insights'}); }; function auto_grow(element) { element.style.height = "5px"; if (element.scrollHeight < 100) { element.style.height = "99px"; } else { element.style.height = element.scrollHeight + "px"; } } function count_letters_textarea(){ var htags=$("#link_text").val().split('#').length-1; var conunt_l=$("#link_text").val().length; var insta=$("#chk_instagram").val(); if(insta==1){ if(htags>=30){ if(localStorage.getItem('htags_status')!=1){ Toastify({text: "Przekroczono limit 30 hashtagów.",className: "bg-danger",duration: 6000}).showToast(); localStorage.setItem('htags_status', '1'); } htags=""+htags+""; }else{ localStorage.setItem('htags_status', '0'); } if(conunt_l>=2200){ if(localStorage.getItem('conunt_l_status')!=1){ Toastify({text: "Przekroczono limit 2200 znaków.",className: "bg-danger",duration: 6000}).showToast(); localStorage.setItem('conunt_l_status', '1'); }else{ localStorage.setItem('conunt_l_status', '0'); } conunt_l=""+conunt_l+""; } } $("#count-text").html(conunt_l+" #"+htags); //Toastify({text: html[1],className: "bg-danger",duration: 6000}).showToast(); } $(document).ready(function () { FB.getLoginStatus(function (response) { if (response.status === 'connected') { } else if (response.status === 'not_authorized') { } else { } }); }); setTimeout(function () { var ap = 1; $('.ap').hover(function () { $(this).css('animation-name', 'pulse'); }).mouseleave(function () { if (ap == 1) { ap = 0; setTimeout(function () { $('.ap').css('animation-name', 'none'); ap = 1; }, 2500); } }); }, 4000); //menu_post //onmousein=\"$('.promo-item2').toggle(300);\" $('.ti-menu').click(function () { $('.promo-item2').toggle(300); }) //formularz dodawania posta $(document).ready(function () { $('#link_form').submit(function (event) { //$('#post_add_title').html('Trwa dodawanie Twojego posta'); $('#ModalPost').modal('show'); $('#modal_send').html(''); event.preventDefault(); var options = { xhrFields: {withCredentials: true}, error: function() { // $('#modal_send').html("Bład sieci"); $('#modal_send').html("

Błąd sieci

"); }, success: function (html) { event.preventDefault(); var html = html.split('||'); $('#modal_send').html(html[1]+'
'+html[0]); //$('#post_add_title').html(html[0]+'
'+html[1]); } }; $('#link_form').ajaxSubmit(options); }) $('.settings_click').click(function (event) { event.preventDefault(); var data = 'bt=1'; $.ajax({ url: "/settings-modal", type: "POST", data: data, processData: false, cache: false, // async: false, dataType: "html", success: function (html) { $("#modal_uni").html(html); $("#title_uni").html("Ustawienia"); $("#ModalUni").modal("show"); $('.js-example-basic-singles').select2(); } }); }) $("#ai-eddy-write").click(function(){ //$('#ModalAI').modal('show'); //$('#modal_send').html(''); event.preventDefault(); var aieddywhat=$("#ai-eddy-what").val(); var aieddyabout=$("#ai-eddy-about").val(); $("#ai-eddy-locading").show(); var mode=$('html').attr('data-layout-mode'); var data = 'bt=1&command='+aieddywhat+" \n\n"+aieddyabout; $.ajax({ url: "/ai-eddy", type: "POST", data: data, processData: false, cache: false, // async: false, dataType: "html", success: function (html) { var html = html.split('||'); if(html[1]==''){ $("#ai-eddy-test").val(html[0]); }else{ Toastify({text: html[1],className: "bg-danger",duration: 6000}).showToast(); } $("#ai-eddy-locading").hide(); } }); }) $("#ai-eddy-hash").click(function(){ $("#ai-eddy-hash-locading").show(); $("#ai-eddy-hash").hide(); var text_ai=$('#link_text').val(); var data = 'bt=1&command=Generate hashtags for text. Text: '+text_ai; $.ajax({ url: "/ai-eddy", type: "POST", data: data, processData: false, cache: false, // async: false, dataType: "html", success: function (html) { var html = html.split('||'); if(html[1]==''){ $("#link_text").val(text_ai+"\n"+html[0]); $('#prev_text').html(text_ai+"\n"+html[0]); $("#prev_text").html(function(_, html) { return html.replace(/#([^ ]+)/g, '#$1'); }); }else{ Toastify({text: html[1],className: "bg-danger",duration: 6000}).showToast(); } // auto_grow($("#ai-eddy-test");); var element = document.getElementById('link_text'); element.style.height = element.scrollHeight + "px"; count_letters_textarea() $("#ai-eddy-hash-locading").hide(); $("#ai-eddy-hash").show(); } }); }) $('#ai-eddy-go').click(function(){ event.preventDefault(); $('#ModalAI').modal('show'); }) $('#ai-eddy-copy').click(function(){ event.preventDefault(); var t=$("#ai-eddy-test").val(); $("#link_text").val(t); $('#prev_text').html(t); $("#prev_text").html(function(_, html) { return html.replace(/#([^ ]+)/g, '#$1'); }); count_letters_textarea() var element = document.getElementById('link_text'); element.style.height = element.scrollHeight + "px"; $('#ModalAI').modal('hide'); // auto_grow($("#link_text");); }) //light-dark-mode $(".light-dark-mode").click(function () { var mode=$('html').attr('data-layout-mode'); $('html').attr('data-sidebar', mode); var data = 'theme='+mode; $.ajax({ url: "/theme-save", type: "POST", data: data, processData: false, cache: false, // async: false, dataType: "html", success: function (html) { } }); console.log('Theme '+mode); }) const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; console.log("Timezone: "+timezone); // Asia/Karachi $("#timezone").val(timezone); })