1 2// ãæ°ã«å ¥ãã¢ã¤ã³ã³ã§ã®ãªã³ã¯ãç¡å¹å 3document.querySelectorAll('.p_relative span').forEach(function(span) { 4 span.addEventListener('click', function(event) { 5 event.preventDefault(); // <a>ã¿ã°ãªã©ã®ããã©ã«ãåä½ãææ¢ 6 return false; // å³å¯ã«ã¯ä¸è¦ã ããæç¤ºçã«falseãè¿ãããå ´å 7 }); 8}); 9 10// ãæ°ã«å ¥ãã®ç»é²/è§£é¤ãã 11async function favorite_icon(element, user, id, category) { 12 const isFavorite = element.textContent.trim() === 'favorite'; 13 14 // ãæ°ã«å ¥ããã¦ããâè§£é¤ 15 const favorite_url = isFavorite 16 ? `${base_url}favorite_delete_catalog?user_id=${user}&data_id=${id}&category=${category}` 17 : null; // ç»é²æã¯URLãæ¸¡ããªãï¼sendFavoriteApiå´ã§çæï¼ 18 19 const data = await sendFavoriteApi(user, id, category, isFavorite) 20 21 if (!data[0]) { 22 // ä½ãããã®å¶éã«å¼ã£ããã 23 alert(data ? data[1] : 'ã¨ã©ã¼ãçºçãã¾ãã'); 24 return; 25 } 26 // 表示ã®åãæ¿ã 27 if (isFavorite) { 28 element.textContent = 'favorite_border'; 29 element.style.color = '#000'; 30 } else { 31 element.textContent = 'favorite'; 32 element.style.color = 'red'; 33 } 34} 35 36window.sendFavoriteApi = async function sendFavoriteApi(user, id, category , isFavorite){ 37 //ãæ°ã«å ¥ãç»é²æ¸ãªãè§£é¤ãæªç»é²ãªãæ°è¦ç»é² 38 const favorite_url = isFavorite 39 ? `${base_url}favorite_delete_catalog?user_id=${user}&data_id=${id}&category=${category}` 40 : `${base_url}favorite_regist_catalog?user_id=${user}&data_id=${id}&category=${category}`; 41 42 try { 43 const response = await fetch(favorite_url, { method: 'POST' }); 44 const text = await response.text(); 45 return JSON.parse(text); 46 } catch (error) { 47 console.error('Fetch error:', error); 48 return null; 49 } 50}
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.