1$(function () { 2 window.onload = function () { 3 // ãã¡ã¼ã¹ããã¥ã¼ãå´©ããã®ã鲿¢ãããã(spç¨) 4 if ($("#isMobile").val()) { 5 $(".pet_hikaku_form_div").css("height", "auto"); 6 } 7 }; 8 9 /** ã¤ããã³å¤æ´æã«ç¨®é¡ã¨å¹´é½¢ãæªé¸æã«ãã */ 10 function resetSelect() { 11 $(".pet-type").val(""); 12 $(".pet-age").val(""); 13 $("#pet-submit-button").attr("disabled", true); 14 } 15 16 /** 17 * 種é¡å¤æ´æã®ããªãã¼ã·ã§ã³ 18 * - å¹´é½¢ãæªé¸æãªããã¿ã³éæ´»æ§ 19 */ 20 function validateChangedType() { 21 if ($('[name="data[PetHikaku][age]"]').val() !== "") { 22 $("#pet-submit-button").attr("disabled", false); 23 } else { 24 $("#pet-submit-button").attr("disabled", true); 25 } 26 } 27 28 /** ç«ã鏿ããã¦ãããã©ãã */ 29 function isSelectedCat() { 30 return $(".pet_breed_q_div_wrapper").hasClass("hidden") ? true : false; 31 } 32 33 /** ç¬ã鏿ããã¦ãããã©ãã */ 34 function isSelectedDog() { 35 return $(".pet_breed_q_div_wrapper").hasClass("hidden") ? false : true; 36 } 37 38 /** 39 * 年齢夿´æã®ããªãã¼ã·ã§ã³ 40 * - ç«ã®å ´åã¯ç¨®é¡ã¯ç¡è¦ 41 * - ç¬ã®å ´åã¯ç¨®é¡æªé¸æãªããã¿ã³éæ´»æ§ 42 */ 43 function validateChangedAge() { 44 const petInfoId = $('[name="data[PetHikaku][pet_info_id]"]').val(); 45 if (isSelectedCat()) { 46 $("#pet-submit-button").attr("disabled", false); 47 return; 48 } 49 if (petInfoId !== "") { 50 $("#pet-submit-button").attr("disabled", false); 51 } else { 52 $("#pet-submit-button").attr("disabled", true); 53 } 54 } 55 56 $("#PetHikakuDog").click(function () { 57 if (isSelectedDog()) { 58 return; 59 } 60 resetSelect(); 61 if ($(".dog-class").parent("span").length) { 62 $(".dog-class").unwrap(); 63 } 64 $(".pet_breed_q_div_wrapper").removeClass("hidden"); 65 if (!$("#isMobile").val()) { 66 $(".pet_age_q_div_wrapper").css("width", "19%"); 67 } 68 }); 69 70 $("#PetHikakuCat").click(function () { 71 if (isSelectedCat()) { 72 return; 73 } 74 resetSelect(); 75 if (!$("dog-class").parent("span").length) { 76 $(".dog-class").wrap('<span style="display: none;">'); 77 } 78 $(".pet_breed_q_div_wrapper").addClass("hidden"); 79 if (!$("#isMobile").val()) { 80 $(".pet_age_q_div_wrapper").css("width", "49%"); 81 } 82 }); 83 84 $(".pet-type").change(function () { 85 validateChangedType(); 86 }); 87 88 $(".pet-age").change(function () { 89 validateChangedAge(); 90 }); 91 92 /** ããããã©ã³ãã³ã°ãè¦ãæ¼ä¸ã§çµæãã¼ã¸ã«ã¢ã¯ã»ã¹ */ 93 $("#pet-submit-button").click(function () { 94 const petAge = $('[name="data[PetHikaku][age]"]').val(); 95 const petInfoId = $('[name="data[PetHikaku][pet_info_id]"]').val(); 96 97 window.location.href = isSelectedDog() 98 ? `/ranking/dog/${petInfoId}/${petAge}` 99 : `/ranking/cat/${petAge}`; 100 }); 101});
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.