1jQuery(document).ready(function($){ 2 3 $(document).on('click', 'button.like-post', function() { 4 5 const id = $(this).attr('data-id') 6 const button = $(ajax_data.is_single ? '.like-post' : this); 7 const dislikeButton = $(`.dislike-post[data-id="${id}"]`); 8 9 button.css({ 10 'transform': 'scale(0.9)', 11 'opacity': '0.7', 12 'transition': '0.2s', 13 'pointer-events': 'none' 14 }); 15 dislikeButton.css({ 16 'pointer-events': 'none' 17 }); 18 19 let action = 'post_single_like' 20 21 $.ajax({ 22 url: ajax_data.ajax_url, 23 type: 'POST', 24 data: { 25 action: action, 26 post_id: id, 27 _wpnonce: ajax_data._wpnonce 28 }, 29 success: function(response) { 30 if (response.success ) { 31 $(`.like-counter[_i="${id}"]`).text(response.count) 32 if (!response.status) { 33 button.find('.icon-wrapper').html(` 34 <svg width="24" height="24" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 35 <path fill-rule="evenodd" clip-rule="evenodd" d="M5.78683 15.8332H4.2135C3.72766 15.8332 3.3335 15.439 3.3335 14.9532V8.7965C3.3335 8.31067 3.72766 7.9165 4.2135 7.9165H5.78683C6.27266 7.9165 6.66683 8.31067 6.66683 8.7965V14.9532C6.66683 15.439 6.27266 15.8332 5.78683 15.8332V15.8332Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 36 <path d="M6.6665 8.80981L9.70734 4.85064C10.2732 4.11314 11.3782 4.09481 11.969 4.81231V4.81231C12.1898 5.07981 12.3098 5.41648 12.3098 5.76314V8.48898H14.8898C15.3907 8.48898 15.8582 8.73898 16.1365 9.15481L16.4107 9.56398C16.6565 9.93148 16.7282 10.389 16.6057 10.8131L15.4732 14.7481C15.2882 15.3906 14.7007 15.8331 14.0323 15.8331H8.7915C8.37484 15.8331 7.9765 15.6598 7.69317 15.3548L6.6665 14.2498" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 37 </svg> 38 `); 39 } else { 40 button.find('.icon-wrapper').html(` 41 <svg width="24" height="24" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 42 <path fill-rule="evenodd" clip-rule="evenodd" d="M3.5835 8.3335C4.13578 8.3335 4.5835 8.78121 4.5835 9.3335V14.0002C4.5835 14.5524 4.13578 15.0002 3.5835 15.0002H3.0835C2.53121 15.0002 2.0835 14.5524 2.0835 14.0002V9.3335C2.0835 8.78121 2.53121 8.3335 3.0835 8.3335H3.5835Z" fill="currentColor"/> 43 <path fill-rule="evenodd" clip-rule="evenodd" d="M9.21166 4.46994C10.0225 3.41339 11.605 3.3876 12.4511 4.41461C12.7651 4.79498 12.9348 5.27253 12.9348 5.76314V7.86398H14.8898C15.5993 7.86398 16.2616 8.21833 16.6559 8.80716L16.9302 9.21647C17.278 9.73641 17.3798 10.3848 17.2061 10.9866L16.0738 14.9211C15.8118 15.831 14.9795 16.4581 14.0323 16.4581H8.7915C8.20151 16.4581 7.63713 16.2128 7.23526 15.7802L6.20863 14.6752C6.10121 14.5596 6.0415 14.4076 6.0415 14.2498V8.80981C6.0415 8.67213 6.08697 8.5383 6.17083 8.42911L9.21166 4.46994Z" fill="currentColor"/> 44 </svg> 45 `); 46 } 47 dislikeButton.find('.icon-wrapper').html(` 48 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 49 <path fill-rule="evenodd" clip-rule="evenodd" d="M6.944 5H5.056C4.473 5 4 5.473 4 6.056V13.444C4 14.027 4.473 14.5 5.056 14.5H6.944C7.527 14.5 8 14.027 8 13.444V6.056C8 5.473 7.527 5 6.944 5V5Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 50 <path d="M8 13.4284L11.649 18.1794C12.328 19.0644 13.654 19.0864 14.363 18.2254V18.2254C14.628 17.9044 14.772 17.5004 14.772 17.0844V13.8134H17.868C18.469 13.8134 19.03 13.5134 19.364 13.0144L19.693 12.5234C19.988 12.0824 20.074 11.5334 19.927 11.0244L18.568 6.30242C18.346 5.53142 17.641 5.00042 16.839 5.00042H10.55C10.05 5.00042 9.572 5.20842 9.232 5.57442L8 6.90042" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 51 </svg> 52 `); 53 } else { 54 console.error('Error: No valid HTML received in response.', response); 55 } 56 57 button.css({ 58 'transform': '', 59 'opacity': '', 60 'pointer-events': 'auto' 61 }); 62 dislikeButton.css({ 63 'pointer-events': 'auto' 64 }); 65 }, 66 error: function(error) { 67 console.error('AJAX error:', error); 68 button.css({ 69 'transform': '', 70 'opacity': '', 71 'pointer-events': 'auto' 72 }); 73 dislikeButton.css({ 74 'pointer-events': 'auto' 75 }); 76 } 77 }); 78 }); 79 80 $(document).on('click', 'button.dislike-post', function() { 81 const id = $(this).attr('data-id'); 82 const button = $(this); 83 const likeButton = $(`.like-post[data-id="${id}"]`); 84 85 button.css({ 86 'transform': 'scale(0.9)', 87 'opacity': '0.7', 88 'transition': '0.2s', 89 'pointer-events': 'none' 90 }); 91 92 likeButton.css({ 93 'pointer-events': 'none' 94 }); 95 96 let action = 'post_single_dislike'; 97 98 $.ajax({ 99 url: ajax_data.ajax_url, 100 type: 'POST', 101 data: { 102 action: action, 103 post_id: id, 104 _wpnonce: ajax_data._wpnonce 105 }, 106 success: function(response) { 107 if (response.success) { 108 $(`.like-counter[_i="${id}"]`).text(response.count); 109 110 if (!response.status) { 111 button.attr('aria-checked', 'false'); 112 button.find('.icon-wrapper svg').html(` 113 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 114 <path fill-rule="evenodd" clip-rule="evenodd" d="M6.944 5H5.056C4.473 5 4 5.473 4 6.056V13.444C4 14.027 4.473 14.5 5.056 14.5H6.944C7.527 14.5 8 14.027 8 13.444V6.056C8 5.473 7.527 5 6.944 5V5Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 115 <path d="M8 13.4284L11.649 18.1794C12.328 19.0644 13.654 19.0864 14.363 18.2254V18.2254C14.628 17.9044 14.772 17.5004 14.772 17.0844V13.8134H17.868C18.469 13.8134
11519.03 13.5134 19.364 13.0144L19.693 12.5234C19.988 12.0824 20.074 11.5334 19.927 11.0244L18.568 6.30242C18.346 5.53142 17.641 5.00042 16.839 5.00042H10.55C10.05 5.00042 9.572 5.20842 9.232 5.57442L8 6.90042" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 116 </svg> 117 `); 118 } else { 119 button.attr('aria-checked', 'true'); 120 button.find('.icon-wrapper').html(` 121 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 122 <path fill-rule="evenodd" clip-rule="evenodd" d="M4.5 6C5.05228 6 5.5 6.44772 5.5 7V13C5.5 13.5523 5.05228 14 4.5 14H3.5C2.94772 14 2.5 13.5523 2.5 13V7C2.5 6.44772 2.94772 6 3.5 6H4.5Z" class="fill-i-primary"/> 123 <path fill-rule="evenodd" clip-rule="evenodd" d="M11.0542 18.6363C12.0272 19.9041 13.9262 19.9351 14.9416 18.7027C15.3183 18.2462 15.522 17.6732 15.522 17.0844V14.5634H17.868C18.7194 14.5634 19.5142 14.1382 19.9873 13.4316L20.3164 12.9404C20.7338 12.3165 20.8559 11.5385 20.6476 10.8163L19.2887 6.0949C18.9743 5.00296 17.9756 4.25042 16.839 4.25042H10.55C9.84201 4.25042 9.16475 4.54489 8.68251 5.06397L7.45055 6.38993C7.32165 6.52867 7.25 6.71104 7.25 6.90042V13.4284C7.25 13.5936 7.30455 13.7542 7.40519 13.8853L11.0542 18.6363Z" class="fill-i-primary"/> 124 </svg> 125 `); 126 } 127 likeButton.find('.icon-wrapper').html(` 128 <svg width="24" height="24" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 129 <path fill-rule="evenodd" clip-rule="evenodd" d="M5.78683 15.8332H4.2135C3.72766 15.8332 3.3335 15.439 3.3335 14.9532V8.7965C3.3335 8.31067 3.72766 7.9165 4.2135 7.9165H5.78683C6.27266 7.9165 6.66683 8.31067 6.66683 8.7965V14.9532C6.66683 15.439 6.27266 15.8332 5.78683 15.8332V15.8332Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 130 <path d="M6.6665 8.80981L9.70734 4.85064C10.2732 4.11314 11.3782 4.09481 11.969 4.81231V4.81231C12.1898 5.07981 12.3098 5.41648 12.3098 5.76314V8.48898H14.8898C15.3907 8.48898 15.8582 8.73898 16.1365 9.15481L16.4107 9.56398C16.6565 9.93148 16.7282 10.389 16.6057 10.8131L15.4732 14.7481C15.2882 15.3906 14.7007 15.8331 14.0323 15.8331H8.7915C8.37484 15.8331 7.9765 15.6598 7.69317 15.3548L6.6665 14.2498" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 131 </svg> 132 `); 133 } else { 134 console.error('Error: No valid HTML received in response.', response); 135 } 136 137 button.css({ 138 'transform': '', 139 'opacity': '', 140 'pointer-events': 'auto' 141 }); 142 likeButton.css({ 143 'pointer-events': 'auto' 144 }); 145 }, 146 error: function(error) { 147 console.error('AJAX error:', error); 148 button.css({ 149 'transform': '', 150 'opacity': '', 151 'pointer-events': 'auto' 152 }); 153 likeButton.css({ 154 'pointer-events': 'auto' 155 }); 156 } 157 }); 158 }); 159 160 $(document).on('click', '.like-news', async function(event) { 161 event.preventDefault(); 162 const id = $(this).attr('data-id') 163 const button = $(this); 164 const dislikeButton = $(`.dislike-news[data-id="${id}"]`); 165 button.css({ 166 'transform': 'scale(0.9)', 167 'opacity': '0.7', 168 'transition': '0.2s' 169 }); 170 try { 171 const response = await $.makeAjaxCall('set_day_news_like', {id: id}); 172 if (response.success ) { 173 $(`.news-like-counter[_i="${id}"]`).text(response.count); 174 $(`.news-dislike-counter[_i="${id}"]`).text(response.dislike_count || 0); 175 if (!response.status) { 176 button.find('.icon-wrapper').html(` 177 <svg width="24" height="24" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 178 <path fill-rule="evenodd" clip-rule="evenodd" d="M5.78683 15.8332H4.2135C3.72766 15.8332 3.3335 15.439 3.3335 14.9532V8.7965C3.3335 8.31067 3.72766 7.9165 4.2135 7.9165H5.78683C6.27266 7.9165 6.66683 8.31067 6.66683 8.7965V14.9532C6.66683 15.439 6.27266 15.8332 5.78683 15.8332V15.8332Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 179 <path d="M6.6665 8.80981L9.70734 4.85064C10.2732 4.11314 11.3782 4.09481 11.969 4.81231V4.81231C12.1898 5.07981 12.3098 5.41648 12.3098 5.76314V8.48898H14.8898C15.3907 8.48898 15.8582 8.73898 16.1365 9.15481L16.4107 9.56398C16.6565 9.93148 16.7282 10.389 16.6057 10.8131L15.4732 14.7481C15.2882 15.3906 14.7007 15.8331 14.0323 15.8331H8.7915C8.37484 15.8331 7.9765 15.6598 7.69317 15.3548L6.6665 14.2498" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 180 </svg> 181 `); 182 } else { 183 button.find('.icon-wrapper').html(` 184 <svg width="24" height="24" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 185 <path fill-rule="evenodd" clip-rule="evenodd" d="M3.5835 8.3335C4.13578 8.3335 4.5835 8.78121 4.5835 9.3335V14.0002C4.5835 14.5524 4.13578 15.0002 3.5835 15.0002H3.0835C2.53121 15.0002 2.0835 14.5524 2.0835 14.0002V9.3335C2.0835 8.78121 2.53121 8.3335 3.0835 8.3335H3.5835Z" fill="currentColor"/> 186 <path fill-rule="evenodd" clip-rule="evenodd" d="M9.21166 4.46994C10.0225 3.41339 11.605 3.3876 12.4511 4.41461C12.7651 4.79498 12.9348 5.27253 12.9348 5.76314V7.86398H14.8898C15.5993 7.86398 16.2616 8.21833 16.6559 8.80716L16.9302 9.21647C17.278 9.73641 17.3798 10.3848 17.2061 10.9866L16.0738 14.9211C15.8118 15.831 14.9795 16.4581 14.0323 16.4581H8.7915C8.20151 16.4581 7.63713 16.2128 7.23526 15.7802L6.20863 14.6752C6.10121 14.5596 6.0415 14.4076 6.0415 14.2498V8.80981C6.0415 8.67213 6.08697 8.5383 6.17083 8.42911L9.21166 4.46994Z" fill="currentColor"/> 187 </svg> 188 `); 189 } 190 button.css({ 191 'transform': '', 192 'opacity': '' 193 }); 194 dislikeButton.find('.icon-wrapper').html(` 195 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 196 <path fill-rule="evenodd" clip-rule="evenodd" d="M6.944 5H5.056C4.473 5 4 5.473 4 6.056V13.444C4 14.027 4.473 14.5 5.056 14.5H6.944C7.527 14.5 8 14.027 8 13.444V6.056C8 5.473 7.527 5 6.944 5V5Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 197 <path d="M8 13.4284L11.649 18.1794C12.328 19.0644 13.654 19.0864 14.363 18.2254V18.2254C14.628 17.9044 14.772 17.5004 14.772 17.0844V13.8134H17.868C18.469 13.8134
19719.03 13.5134 19.364 13.0144L19.693 12.5234C19.988 12.0824 20.074 11.5334 19.927 11.0244L18.568 6.30242C18.346 5.53142 17.641 5.00042 16.839 5.00042H10.55C10.05 5.00042 9.572 5.20842 9.232 5.57442L8 6.90042" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 198 </svg> 199 `); 200 } else { 201 console.error('Error: No valid HTML received in response.', response); 202 } 203 } catch (error) { 204 console.error('Recent listed coins error:', error); 205 } 206 }) 207 208 $(document).on('click', '.dislike-news', async function(event) { 209 event.preventDefault(); 210 const id = $(this).attr('data-id'); 211 const button = $(this); 212 const likeButton = $(`.like-news[data-id="${id}"]`); 213 button.css({ 214 'transform': 'scale(0.9)', 215 'opacity': '0.7', 216 'transition': '0.2s' 217 }); 218 try { 219 const response = await $.makeAjaxCall('set_day_news_dislike', { 220 id: id 221 }); 222 223 if (response.success) { 224 $(`.news-like-counter[_i="${id}"]`).text(response.count); 225 $(`.news-dislike-counter[_i="${id}"]`).text(response.dislike_count || 0); 226 227 if (!response.status) { 228 button.find('.icon-wrapper').html(` 229 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 230 <path fill-rule="evenodd" clip-rule="evenodd" d="M6.944 5H5.056C4.473 5 4 5.473 4 6.056V13.444C4 14.027 4.473 14.5 5.056 14.5H6.944C7.527 14.5 8 14.027 8 13.444V6.056C8 5.473 7.527 5 6.944 5V5Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 231 <path d="M8 13.4284L11.649 18.1794C12.328 19.0644 13.654 19.0864 14.363 18.2254V18.2254C14.628 17.9044 14.772 17.5004 14.772 17.0844V13.8134H17.868C18.469 13.8134 19.03 13.5134 19.364 13.0144L19.693 12.5234C19.988 12.0824 20.074 11.5334 19.927 11.0244L18.568 6.30242C18.346 5.53142 17.641 5.00042 16.839 5.00042H10.55C10.05 5.00042 9.572 5.20842 9.232 5.57442L8 6.90042" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 232 </svg> 233 `); 234 } else { 235 button.find('.icon-wrapper').html(` 236 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 237 <path fill-rule="evenodd" clip-rule="evenodd" d="M4.5 6C5.05228 6 5.5 6.44772 5.5 7V13C5.5 13.5523 5.05228 14 4.5 14H3.5C2.94772 14 2.5 13.5523 2.5 13V7C2.5 6.44772 2.94772 6 3.5 6H4.5Z" class="fill-i-primary"/> 238 <path fill-rule="evenodd" clip-rule="evenodd" d="M11.0542 18.6363C12.0272 19.9041 13.9262 19.9351 14.9416 18.7027C15.3183 18.2462 15.522 17.6732 15.522 17.0844V14.5634H17.868C18.7194 14.5634 19.5142 14.1382 19.9873 13.4316L20.3164 12.9404C20.7338 12.3165 20.8559 11.5385 20.6476 10.8163L19.2887 6.0949C18.9743 5.00296 17.9756 4.25042 16.839 4.25042H10.55C9.84201 4.25042 9.16475 4.54489 8.68251 5.06397L7.45055 6.38993C7.32165 6.52867 7.25 6.71104 7.25 6.90042V13.4284C7.25 13.5936 7.30455 13.7542 7.40519 13.8853L11.0542 18.6363Z" class="fill-i-primary"/> 239 </svg> 240 `); 241 } 242 button.css({ 243 'transform': '', 244 'opacity': '' 245 }); 246 likeButton.find('.icon-wrapper').html(` 247 <svg width="24" height="24" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 248 <path fill-rule="evenodd" clip-rule="evenodd" d="M5.78683 15.8332H4.2135C3.72766 15.8332 3.3335 15.439 3.3335 14.9532V8.7965C3.3335 8.31067 3.72766 7.9165 4.2135 7.9165H5.78683C6.27266 7.9165 6.66683 8.31067 6.66683 8.7965V14.9532C6.66683 15.439 6.27266 15.8332 5.78683 15.8332V15.8332Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 249 <path d="M6.6665 8.80981L9.70734 4.85064C10.2732 4.11314 11.3782 4.09481 11.969 4.81231V4.81231C12.1898 5.07981 12.3098 5.41648 12.3098 5.76314V8.48898H14.8898C15.3907 8.48898 15.8582 8.73898 16.1365 9.15481L16.4107 9.56398C16.6565 9.93148 16.7282 10.389 16.6057 10.8131L15.4732 14.7481C15.2882 15.3906 14.7007 15.8331 14.0323 15.8331H8.7915C8.37484 15.8331 7.9765 15.6598 7.69317 15.3548L6.6665 14.2498" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 250 </svg> 251 `); 252 } else { 253 console.error('Error: No valid HTML received in response.', response); 254 } 255 } catch (error) { 256 console.error('Recent listed coins error:', error); 257 button.css({ 258 'transform': '', 259 'opacity': '' 260 }); 261 } 262 }); 263 264})
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.