1jQuery(document).ready(function ($) { 2 3 // Butonlara oy durumunu uygular 4 function butonDurumunuUygula(yorumID, aktifOy = null) { 5 const $yorum = $('.yorum[data-yorum-id="' + yorumID + '"]'); 6 const $begenLink = $yorum.find('.begen-link'); 7 const $begenmeLink = $yorum.find('.begenme-link'); 8 9 // Tüm classları sıfırla 10 $begenLink.removeClass('disabled secili'); 11 $begenmeLink.removeClass('disabled secili'); 12 13 const oy = aktifOy ?? yorumBegeni.oylar[yorumID]; 14 15 if (oy === 'begen') { 16 $begenLink.addClass('secili'); 17 } else if (oy === 'begenme') { 18 $begenmeLink.addClass('secili'); 19 } 20 21 // â Oy kullanan kullanıcı için her iki buton da disabled olmalı 22 if (oy === 'begen' || oy === 'begenme') { 23 $begenLink.addClass('disabled'); 24 $begenmeLink.addClass('disabled'); 25 } 26 } 27 28 29 // Sayfa yüklenince tüm yorumlara uygula 30 $('.yorum').each(function () { 31 const yorumID = String($(this).data('yorum-id')); 32 butonDurumunuUygula(yorumID); 33 }); 34 35 // Oy verme iÅlemi 36 $('.yorum-butonlari').on('click', 'a', function (e) { 37 e.preventDefault(); 38 39 const $this = $(this); 40 const $container = $this.closest('.yorum'); 41 const yorumID = String($container.data('yorum-id')); 42 const tur = $this.data('tur'); 43 44 // Zaten oy verilmiÅse tıklama 45 if ($this.hasClass('disabled')) return; 46 47 // Geçici olarak butonları pasif yap 48 $container.find('a').addClass('disabled'); 49 50 $.post(yorumBegeni.ajax_url, { 51 yorum_id: yorumID, 52 tur: tur, 53 nonce: yorumBegeni.nonce 54 }, function (cevap) { 55 56 console.log("AJAX cevap:", cevap); 57 58 if (cevap.success && cevap.data) { 59 const $begenLink = $container.find('.begen-link'); 60 const $begenmeLink = $container.find('.begenme-link'); 61 62 // Sayıları ve data-count'ı güncelle 63 $begenLink.find('.sayi').text(cevap.data.begen); 64 $begenmeLink.find('.sayi').text(cevap.data.begenme); 65 66 $begenLink.attr('data-count', cevap.data.begen); 67 $begenmeLink.attr('data-count', cevap.data.begenme); 68 69 // IP bazlı oyları JS'te güncelle 70 yorumBegeni.oylar[yorumID] = cevap.data.oy; 71 72 // Class güncelle 73 butonDurumunuUygula(yorumID, cevap.data.oy); 74 75 } else { 76 alert(cevap.data?.mesaj || 'Oy kullanırken hata oluÅtu.'); 77 $container.find('a').removeClass('disabled'); 78 } 79 80 }).fail(function () { 81 alert('Sunucu hatası oluÅtu.'); 82 $container.find('a').removeClass('disabled'); 83 }); 84 }); 85 86});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.