https://www.advertimes.com/wp-content/themes/swell_advertimes/build/js/reaction.js?ver=2026093080244
1!(function () { 2 let post_id = post_data.post_id 3 // Cookieãããªã¢ã¯ã·ã§ã³ã®ãã¼ã¿ãåå¾ãã颿° 4 function getReactionsFromCookie() { 5 var cookieValue = getCookie("reactions_cookie") 6 if (cookieValue) { 7 return JSON.parse(cookieValue) 8 } else { 9 return {} 10 } 11 } 12 13 // Cookieã«ãªã¢ã¯ã·ã§ã³ã®ãã¼ã¿ãä¿åãã颿° 14 function setReactionToCookie(postId, reaction) { 15 var reactions = getReactionsFromCookie() 16 reactions[postId] = reaction 17 var cookieValue = JSON.stringify(reactions) 18 setCookie("reactions_cookie", cookieValue, 30) // 30æ¥éæå¹ãªCookieãè¨å® 19 } 20 21 // Cookieããç¹å®ã®post_idã®ãªã¢ã¯ã·ã§ã³ãåå¾ãã颿° 22 function getReactionForPostId(postId) { 23 var reactions = getReactionsFromCookie() 24 return reactions[postId] 25 } 26 27 // Cookieãè¨å®ãã颿° 28 function setCookie(name, value, days) { 29 var expires = "" 30 if (days) { 31 var date = new Date() 32 date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000) 33 expires = "; expires=" + date.toUTCString() 34 } 35 document.cookie = name + "=" + value + expires + "; path=/;" 36 } 37 38 // Cookieããå¤ãåå¾ãã颿° 39 function getCookie(name) { 40 var nameEQ = name + "=" 41 var cookies = document.cookie.split(";") 42 for (var i = 0; i < cookies.length; i++) { 43 var cookie = cookies[i] 44 while (cookie.charAt(0) === " ") { 45 cookie = cookie.substring(1, cookie.length) 46 } 47 if (cookie.indexOf(nameEQ) === 0) { 48 return cookie.substring(nameEQ.length, cookie.length) 49 } 50 } 51 return null 52 } 53 54 function reactionBtnActivate(reaction = null) { 55 let current_reaction = reaction ?? getReactionForPostId(post_id) 56 if (current_reaction) { 57 $( 58 '.count-button:not([data-reaction="' + current_reaction + '"])' 59 ).addClass("inactive") 60 $('[data-reaction="' + current_reaction + '"]').addClass("active") 61 } 62 } 63 64 jQuery(document).ready(function ($) { 65 $(".count-button").on("click", function () { 66 let _this = $(this) 67 if (_this.hasClass("active") || _this.hasClass("inactive")) { 68 console.log("already send reaction...") 69 return 70 } 71 72 let reaction = _this.data("reaction") 73 reactionBtnActivate(reaction) 74 $.ajax({ 75 type: "POST", 76 url: swellVars.ajaxUrl, 77 data: { 78 action: "update_count", // ãµã¼ãã¼å´ã§ã®å¦çãèå¥ããã¢ã¯ã·ã§ã³å 79 post_id: post_id, 80 reaction: reaction, 81 }, 82 success: function (response) { 83 console.log("reaction", post_id, reaction) 84 setReactionToCookie(post_id, reaction) 85 var countElement = _this.find(".p-reaction__count") 86 if (countElement.length > 0) { 87 countElement.text(response) // æ°ããå¤ãè¨å®ãã¦è¡¨ç¤ºãã 88 } 89 }, 90 }) 91 }) 92 reactionBtnActivate() 93 }) 94})()
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.