PageSourceSearch

https://moffme.com/js/component/top/ranking/search.js

js moffme.com collected 2026-10-04 12:35:39 UTC 3,193 bytes, 101 lines download raw bytes

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.