$(document).ready(function() { $( "body" ).on( "click",'.flex-search-head-btns a', function(event){ $('.flex-search-head-btns a').removeClass('active'); $(this).addClass("active"); filterPosts($(this)); return false; event.preventDefault(); }); }); function filterPosts(thisElm){ var attrData = []; var $element = thisElm; // Replace with your element selector $.each($element[0].attributes, function(index, attr) { if (attr.name.startsWith('data-')) { attrData[attr.name.substring(5)]=attr.value; } }); var after = attrData.after; console.log("attrData",attrData); changeHash(attrData,after,thisElm); } function changeHash(data,after = "",thisElm){ console.log("after",after); $.get('get_new_hash.php?booksec='+data.booksec+'&book='+data.book+'&engine='+data.engine+'&q='+data.q+'&order='+data.order+'&tag='+data.tag+'&year='+data.year+'&title='+data.title+'&author='+data.author+'&user='+data.user+'&book_cat='+data.book_cat+'&dar='+data.dar+'', function(data) { var qUL = $("ul.timeline"); console.log("get_new_hash data",data); hash = data.hash; var tafa3alM3; if($("#results li.tafa3alM3").length){ tafa3alM3 = $("#results li.tafa3alM3").map(function() { return $(this).prop('outerHTML'); }).get().join(''); } if(after == "end"){ }else if(after == "afterLi"){ //thisElm.afterElm("li").remove(); var qLi = thisElm.parents("li.timelineLi"); qLi.nextAll('li.timelineLi').remove(); }else{ $("#results li").remove(); $("#results").append(tafa3alM3); } get_new_post(data.hash); qUL.find('end').remove(); }, 'json'); } $(document).ready(function() { $.fn.slideRight = function(duration, callback) { // تعيين max-width الحالي var maxWidth = this.outerWidth(); // تعيين max-width إلى العرض الكامل this.css('max-width', maxWidth); // تحريك العنصر بتغيير max-width إلى 0 this.animate({ 'max-width': 33 }, duration, function() { $(this).fadeOut("fast",function(){ if (callback) callback.call(this); $(this).css('max-width', "unset"); $(this).css('opacity', "unset"); }); }); return this; }; function handleHashChange(event) { const hash = window.location.hash; if (hash.startsWith('#tab')) { hashCle = hash.substring(1); // أو hash = hash.slice(1); if(hashCle){ const targetElement = $("[data-smarttab-target='" + hashCle + "']"); setTimeout(function() { if (!targetElement.hasClass("smartTabTab1Active")) { targetElement.trigger("click"); } }, 300); // 1500 ملي ثانية = 1.5 ثانية //$("[data-smarttab-target='"+hashCle+"'").trigger("click"); } // تنفيذ أمر معين إذا بدأ الهاشتاج بـ "tab" //console.log("Hash starts with 'tab':", hash); } else { console.log("Hash does not start with 'tab'"); } } window.addEventListener('popstate', handleHashChange); $( "body" ).on( "click",'.nav-search-btn', function(){ $('.fade-scale-modal .modal-header').hide(); $('.fade-scale-modal .modal-body').load('search_btn_dialog.php', function() { $('.fade-scale-modal .modal-body .qModal').focus(); }); $('.modal').addClass('modal-full-screen'); $('.fade-scale-modal').modal('show'); return false; }); $( "body" ).on( "click",'.nav-search-engine-btn', function(){ $('.fade-scale-modal .modal-header').hide(); $('.fade-scale-modal .modal-body').html('
'); $('.fade-scale-modal .modal-body .searchContentDiv').load('search_engine.php', function() { $('.searchContentLoder').slideUp(); $('.searchContentDiv').slideDown("fast",function(){ //$('.fade-scale-modal .allSearch').focus(); startSmartTabs("tabAll"); }); //$('.fade-scale-modal .smarttabAll').show(); /* $('.fade-scale-modal .clickToAllOpen').trigger("click", function(){ console.log("انتهى النقر وانتهى التأثير"); }); */ }); $('.modal').addClass('modal-full-screen'); $('.fade-scale-modal').modal('show'); $('.fade-scale-modal .modal-body').css("padding","1px"); $('.fade-scale-modal .modal-body').css("background","#7d7d7d"); $('.fade-scale-modal .modal-body').css("border-radius","3px"); $('.fade-scale-modal .modal-footer').attr("style","padding:0px!important;"); return false; }); $( "body" ).on( "click",'.iframeBtn', function() { var iframScr = $(this).attr('data-iframe-scr'); $('.fade-scale-modal .modal-header').hide(); $('.fade-scale-modal .modal-body').css("padding","0"); $('.fade-scale-modal .modal-body').html('
'+""); $('#ifrrameCS').on('load', function() {$('#loadingmodal').fadeOut();}); $(".fade-scale-modal .modal-body iframe").trigger("load"); $('.fade-scale-modal').modal('show'); return false; }); $( "body" ).on( "click",'.btn-add-quote', function() { var tfa3l = $('.tafa3alM3'); if (tfa3l.is(':hidden')) { tfa3l.slideDown(); }else{ tfa3l.slideUp(); } return false; }); }); $(document).on("mouseenter touchstart touchmove",".unFollow",function() { $(this).addClass("btn-danger"); $(this).removeClass("btn-light-scheme"); $(this).find(".fas").attr("class","fas fa-user-minus"); }); $(document).on("mouseleave",".unFollow",function() { $(this).addClass("btn-light-scheme"); $(this).removeClass("btn-danger"); $(this).find(".fas").attr("class","fas fa-user-check"); }); function trimText(text){ if(text){ text = text.replace(/[\r\n]/gm, ''); text = text.replace(/ +/g, ''); text = text.replace(/ +/g, ' '); text = text.trimStart(); text = text.trimEnd(); return text; }else{ return ''; } }