File "script.jshph"

Full Path: /home/cananyalcin/public_html/js/panel/smmgenie/script.jshph
File size: 19.66 KB
MIME-type: text/plain
Charset: utf-8

$(document).ready(function() {
    $("#searchService").on("keyup", function() {
        var value = $(this).val().toLowerCase();
        $(".service-item").filter(function() {
            $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
        });
    });
          $.post("ajax_data",
      {action:"favorite_kontrol"},
      function(e){
        if(e['field']!= 0){
      e['field'].forEach(favori_isaretle);
}
  });
});
function favori_isaretle(item, index) {
  console.log(item['services_id']);
  var id = item['services_id'];
  $('#favori_ekle_smmspot[data-id="'+id+'"]').children("i").toggleClass('far fas');
}

$(document).on('click','#favori_ekle_smmspot',function(){
      $.post("ajax_data",
      {action:"favorite_ekle",favori:$(this).data('id')},
      function(e){
          if(e['message'] == "Failed"){
              console.log('mert');
           $('#favori_ekle_smmspot[data-id="'+e['id']+'"]').children("i").toggleClass('fas far');  
           }else{
           $('#favori_ekle_smmspot[data-id="'+e['id']+'"]').children("i").toggleClass('far fas');  
             
          }
      console.log(e);
  });
});
function sortArray(array) {
    clearTimeout(delay);
    var delay = setTimeout(function(){
        var firstElem = array.shift();
        array.push(firstElem);
        return startAnim(array); 
    },5000)
}

const copyToClipboard = str => {
  const el = document.createElement('textarea');
  el.value = str;
  el.setAttribute('readonly', '');
  el.style.position = 'absolute';
  el.style.left = '-9999px';
  document.body.appendChild(el);
  el.select();
  document.execCommand('copy');
  document.body.removeChild(el);
  makeToast('Panoya kopyalandı')
};

var toastTime;

function makeToast(text = null, timeOut=4000) {
  $('.toast-text').html(text)
  $('.bs-toast').fadeIn(300);

  toastTime = setTimeout(() => {
    $('.bs-toast').fadeOut(300);
  }, timeOut);
}

function removeToast() {
  $('.bs-toast').fadeOut(300);
  clearTimeout(toastTime);
}

$('.orderToggle').click(function() {
  $(this).parents('.card-order').find('.co-hidden').slideToggle(200);
})

var docScrollTop = $(document).scrollTop()

$(document).scroll(function() {
  docScrollTop = $(document).scrollTop()
  headerScroll(docScrollTop)
})

function headerScroll(docScrollTop) {
  if(docScrollTop > 20) {
    $('#smmspot-na-header').addClass('sticky')
  } else {
    $('#smmspot-na-header').removeClass('sticky')
  }
}

$('.noAuthMenuBtn').click(function() {
  $('.col-menu').slideToggle(200);
})

function rightMenuToggle() {
  $('.app-rightbar').toggleClass('active')
}

function sidebarToggle() {
  $('.app-sidebar').toggleClass('active');
}
/*
var appHeader = document.getElementsByClassName('app-header');

const appHeaderScroll = (x) => {
  if(x > 10) {
    if( !appHeader.classList.contains('active') ) {
      appHeader.classList.add('active');
    }
  }  else {
    if( appHeader.classList.contains('active') ) {
      appHeader.classList.remove('active');
    }
  }
}

if(appHeader.length) {
  appHeader = appHeader[0];

  window.addEventListener('scroll', () => {
    appHeaderScroll(window.pageYOffset);
  })
}*/

$('.home-ss-tab').click(function() {
    if ($(this).hasClass('active')) {
        $(this).find('.ss-tab-content').slideToggle(200);
        $(this).toggleClass('active');
    } else {
        $('.home-ss-tab').removeClass('active');
        $('.home-ss-tab > .ss-tab-content').slideUp(200);
        $(this).find('.ss-tab-content').slideToggle(200);
        $(this).toggleClass('active');
    }
});

$("#orderform-service").change(function () {
    service_id = $(this).val();
    $("#s_id").text(service_id);

    description = window.modules.siteOrder.services[service_id].description
    $("#s_desc").html(description);

    name = window.modules.siteOrder.services[service_id].name
    $("#s_name").html(name);
})




/*$(document).ready(function() {
    $("#serv-inp").on("keyup", function() {
        var value = $(this).val().toLowerCase();
        $(".pnd-mtable tr").filter(function() {
            $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
        });
    });

    $("#serv-cat").on("keyup", function(e) {
        var value = $(e.relatedTarget).data('data-filter-category-id');
        $(".pnd-mtable tr").filter(function() {
            $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
        });
    });
    
    $('select').select2();
    
});


function dashMenuToggle() {
    $('.app-sidebar').toggleClass('sidebar-inact');
    $('.app-header').toggleClass('sidebar-inact');
    $('.app-content').toggleClass('sidebar-inact');
    $('body').toggleClass('body-pause');
}

$(document).ready(function() {
    $('[data-toggle="tooltip"]').tooltip();
});

$('.services-list-filter').click(function(){

	var dataFilter=$(this).data("services-filter");
    console.log(dataFilter);
    var value = dataFilter;
    
    $(".pnd-mtable tr").filter(function() {
        $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
    });

});*/










function ikon(opt) {
      var ikon = "";
    if (opt.indexOf("Instagram") >= 0) {
        ikon = "<span class=\"fs-ig\"><i class=\"fab fa-instagram\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("YouTube") >= 0) {
        ikon = "<span class=\"fs-yt\"><i class=\"fab fa-youtube\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Facebook") >= 0) {
        ikon = "<span class=\"fs-fb\"><i class=\"fab fa-facebook-square\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Youtube") >= 0) {
        ikon = "<span class=\"fs-yt\"><i class=\"fab fa-youtube\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Twitter") >= 0) {
        ikon = "<span class=\"fs-tw\"><i class=\"fab fa-twitter\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Google") >= 0) {
        ikon = "<span class=\"fs-gp\"><i class=\"fab fa-google-plus\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Swarm") >= 0) {
        ikon = "<span class=\"fs-fsq\"><i class=\"fab fa-forumbee\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Dailymotion") >= 0) {
        ikon = "<span class=\"fs-dm\"><i class=\"fab fa-hospital-o\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Periscope") >= 0) {
        ikon = "<span class=\"fs-pc\"><i class=\"fab fa-map-marker\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Soundcloud") >= 0) {
        ikon = "<span class=\"fs-sc\"><i class=\"fab fa-soundcloud\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Vine") >= 0) {
        ikon = "<span class=\"fs-vn\"><i class=\"fab fa-vine\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Spotify") >= 0) {
        ikon = "<span class=\"fs-sp\"><i class=\"fab fa-spotify\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Snapchat") >= 0) {
        ikon = "<span class=\"fs-snap\"><i class=\"fab fa-snapchat-square\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Pinterest") >= 0) {
        ikon = "<span class=\"fs-pt\"><i class=\"fab fa-pinterest-p\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("iTunes") >= 0) {
        ikon = "<span class=\"fs-apple\"><i class=\"fab fa-apple\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Müzik") >= 0) {
        ikon = "<span class=\"fs-music\"><i class=\"fab fa-music\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Vimeo") >= 0) {
        ikon = "<span class=\"fs-videmo\"><i class=\"fab fa-vimeo\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("EkÅŸi") >= 0) {
        ikon = "<span class=\"fs-eksi\"><i class=\"fab fa-tint\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Telegram") >= 0) {
        ikon = "<span class=\"fs-telegram\"><i class=\"fab fa-telegram\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Twitch") >= 0) {
        ikon = "<span class=\"fs-twc\"><i class=\"fab fa-twitch\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Zomato") >= 0) {
        ikon = "<span class=\"fs-zom\"><i class=\"fab fa-cutlery\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Amazon") >= 0) {
        ikon = "<span class=\"fs-amaz\"><i class=\"fab fa-amazon\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Tumblr") >= 0) {
        ikon = "<span class=\"fs-tumb\"><i class=\"fab fa-tumblr-square\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Yandex") >= 0) {
        ikon = "<span class=\"fs-yndx\"><i class=\"fab fa-yoast\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Linkedin") >= 0) {
        ikon = "<span class=\"fs-lnk\"><i class=\"fab fa-linkedin\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Yahoo") >= 0) {
        ikon = "<span class=\"fs-yahoo\"><i class=\"fab fa-yahoo\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("TikTok") >= 0) {
        ikon = "<span class=\"fs-tiktok\"><i class=\"fa fa-music\" aria-hidden=\"true\"></i> </span>";
    } else {
        ikon = "<span class=\"\"><i class=\"far fa-star\" aria-hidden=\"true\"></i> </span>  ";
    }
    return ikon;
   }

function setList(val) {
    /* orders */
    if (val == 0) {
        $("#orders-drop").empty();
        $("#neworder_services option").each(function () {
            var ico = ikon($(this).text());
            $("#orders-drop").append('<button id="serviceItem" class="dropdown-item" type="button" onclick="selectOrder(' + $(this).val() + ')">' + ico + $(this).text() + "</button>");
        });
        /*if(this.selected) {*/
        var e = document.getElementById("neworder_services");
        var selected = $( "#neworder_services option:selected" ).text();
        var ico = ikon(selected);
        $("#serviceTitle").html(ico + selected);
        /*}else {
       var ico = ikon($("#neworder_services option:nth-child(1)").text());              
        $("#serviceTitle").html(ico + $("#neworder_services option:nth-child(1)").text());         
                  }            */
    } else if (val == 1) {
        /* SERVICES */
        
        $("#category-drop").empty();
        $("#neworder_category option").each(function () {
            var ico = ikon($(this).text());
            $("#category-drop").append('<button id="categoryItem" class="dropdown-item" type="button" onclick="selectCategory(' + $(this).val() + ')">' + ico + $(this).text() + "</button>");
        });

        /* if(this.selected) {*/
        var e = document.getElementById("neworder_category");
        var selected = e.options[e.selectedIndex].text;
        var ico = ikon(selected);
        $("#categoryTitle").html(ico + selected);
        /*}else {      
        var ico = ikon($("#neworder_category option:nth-child(1)").text());              
        $("#categoryTitle").html(ico + $("#neworder_category option:nth-child(1)").text());
                 } */
    }
}
$(function (ready) {
    $("#neworder_services").change(function () {
        setList(0);
    });
    $("#neworder_category").change(function () {
        setList(1);
    });
});

function selectOrder(val) {
    $("#neworder_services").val(val);
    $("#neworder_services").trigger("change");
    var ico = ikon($("#neworder_services option[value='" + val + "']").text());
    $("#serviceTitle").html(ico + $("#neworder_services option[value='" + val + "']").text());
}
$("#serviceItem").click(function () {
    $("#serviceTitle").html($(this).html());
});

function selectCategory(val) {
    $("#neworder_category").val(val);
    $("#neworder_category").trigger("change");
    var ico = ikon($("#neworder_category option[value='" + val + "']").text());
    $("#categoryTitle").html(ico + $("#neworder_category option[value='" + val + "']").text());
}

function fAqactive() {
        $(".ms-steps .card").on("click", function () {
            $(".ms-steps .card").removeClass("active");
            $(this).addClass("active");
        });
}
fAqactive();

$(".pnd-notify").click(function () {
  console.log("toggling sidebar");
    $(".pnd-notify-box").toggleClass('active');
});

$(window).scroll(function() {
    $(".pnd-notify-box").removeClass("active");
});


























function ikon(opt) {
      var ikon = "";
    if (opt.indexOf("Instagram") >= 0) {
        ikon = "<span class=\"fs-ig\"><i class=\"fab fa-instagram\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("YouTube") >= 0) {
        ikon = "<span class=\"fs-yt\"><i class=\"fab fa-youtube\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Facebook") >= 0) {
        ikon = "<span class=\"fs-fb\"><i class=\"fab fa-facebook-square\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Youtube") >= 0) {
        ikon = "<span class=\"fs-yt\"><i class=\"fab fa-youtube\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Twitter") >= 0) {
        ikon = "<span class=\"fs-tw\"><i class=\"fab fa-twitter\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Google") >= 0) {
        ikon = "<span class=\"fs-gp\"><i class=\"fab fa-google-plus\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Swarm") >= 0) {
        ikon = "<span class=\"fs-fsq\"><i class=\"fab fa-forumbee\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Dailymotion") >= 0) {
        ikon = "<span class=\"fs-dm\"><i class=\"fab fa-hospital-o\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Periscope") >= 0) {
        ikon = "<span class=\"fs-pc\"><i class=\"fab fa-map-marker\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Soundcloud") >= 0) {
        ikon = "<span class=\"fs-sc\"><i class=\"fab fa-soundcloud\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Vine") >= 0) {
        ikon = "<span class=\"fs-vn\"><i class=\"fab fa-vine\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Spotify") >= 0) {
        ikon = "<span class=\"fs-sp\"><i class=\"fab fa-spotify\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Snapchat") >= 0) {
        ikon = "<span class=\"fs-snap\"><i class=\"fab fa-snapchat-square\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Pinterest") >= 0) {
        ikon = "<span class=\"fs-pt\"><i class=\"fab fa-pinterest-p\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("iTunes") >= 0) {
        ikon = "<span class=\"fs-apple\"><i class=\"fab fa-apple\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Müzik") >= 0) {
        ikon = "<span class=\"fs-music\"><i class=\"fab fa-music\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Vimeo") >= 0) {
        ikon = "<span class=\"fs-videmo\"><i class=\"fab fa-vimeo\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("EkÅŸi") >= 0) {
        ikon = "<span class=\"fs-eksi\"><i class=\"fab fa-tint\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Telegram") >= 0) {
        ikon = "<span class=\"fs-telegram\"><i class=\"fab fa-telegram\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Twitch") >= 0) {
        ikon = "<span class=\"fs-twc\"><i class=\"fab fa-twitch\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Zomato") >= 0) {
        ikon = "<span class=\"fs-zom\"><i class=\"fab fa-cutlery\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Amazon") >= 0) {
        ikon = "<span class=\"fs-amaz\"><i class=\"fab fa-amazon\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Tumblr") >= 0) {
        ikon = "<span class=\"fs-tumb\"><i class=\"fab fa-tumblr-square\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Yandex") >= 0) {
        ikon = "<span class=\"fs-yndx\"><i class=\"fab fa-yoast\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Linkedin") >= 0) {
        ikon = "<span class=\"fs-lnk\"><i class=\"fab fa-linkedin\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("Yahoo") >= 0) {
        ikon = "<span class=\"fs-yahoo\"><i class=\"fab fa-yahoo\" aria-hidden=\"true\"></i> </span>";
    } else if (opt.indexOf("TikTok") >= 0) {
        ikon = "<span class=\"fs-tiktok\"><i class=\"fa fa-music\" aria-hidden=\"true\"></i> </span>";
    } else {
        ikon = "<span class=\"\"><i class=\"far fa-star\" aria-hidden=\"true\"></i> </span>  ";
    }
    return ikon;
   }

function setList(val) {
    /* orders */
    if (val == 0) {
        $("#orders-drop").empty();
        $("#neworder_services option").each(function () {
            var ico = ikon($(this).text());
            $("#orders-drop").append('<button id="serviceItem" class="dropdown-item" type="button" onclick="selectOrder(' + $(this).val() + ')">' + ico + $(this).text() + "</button>");
        });
        /*if(this.selected) {*/
        var e = document.getElementById("neworder_services");
        var selected = $( "#neworder_services option:selected" ).text();
        var ico = ikon(selected);
        $("#serviceTitle").html(ico + selected);
        /*}else {
       var ico = ikon($("#neworder_services option:nth-child(1)").text());              
        $("#serviceTitle").html(ico + $("#neworder_services option:nth-child(1)").text());         
                  }            */
    } else if (val == 1) {
        /* SERVICES */
        
        $("#category-drop").empty();
        $("#neworder_category option").each(function () {
            var ico = ikon($(this).text());
            $("#category-drop").append('<button id="categoryItem" class="dropdown-item" type="button" onclick="selectCategory(' + $(this).val() + ')">' + ico + $(this).text() + "</button>");
        });

        /* if(this.selected) {*/
        var e = document.getElementById("neworder_category");
        var selected = e.options[e.selectedIndex].text;
        var ico = ikon(selected);
        $("#categoryTitle").html(ico + selected);
        /*}else {      
        var ico = ikon($("#neworder_category option:nth-child(1)").text());              
        $("#categoryTitle").html(ico + $("#neworder_category option:nth-child(1)").text());
                 } */
    }
}
$(function (ready) {
    $("#neworder_services").change(function () {
        setList(0);
    });
    $("#neworder_category").change(function () {
        setList(1);
    });
});

function selectOrder(val) {
    $("#neworder_services").val(val);
    $("#neworder_services").trigger("change");
    var ico = ikon($("#neworder_services option[value='" + val + "']").text());
    $("#serviceTitle").html(ico + $("#neworder_services option[value='" + val + "']").text());
}
$("#serviceItem").click(function () {
    $("#serviceTitle").html($(this).html());
});

function selectCategory(val) {
    $("#neworder_category").val(val);
    $("#neworder_category").trigger("change");
    var ico = ikon($("#neworder_category option[value='" + val + "']").text());
    $("#categoryTitle").html(ico + $("#neworder_category option[value='" + val + "']").text());
}

function fAqactive() {
        $(".ms-steps .card").on("click", function () {
            $(".ms-steps .card").removeClass("active");
            $(this).addClass("active");
        });
}
fAqactive();

$(".pnd-notify").click(function () {
  console.log("toggling sidebar");
    $(".pnd-notify-box").toggleClass('active');
});

$(window).scroll(function() {
    $(".pnd-notify-box").removeClass("active");
});