PageSourceSearch

https://www.harley-davidson.cn/.resources/hd-cn-template/webresour…ke-cards-carousel_manual.js?v=1791372231442

js harley-davidson.cn collected 2026-10-07 11:23:57 UTC 8,104 bytes, 184 lines download raw bytes

1"use strict";
2(self.webpackChunkaem_maven_archetype = self.webpackChunkaem_maven_archetype || []).push([[7801], {
3    8006: function (e, t, s) {
4        var i = s(2985), a = s.n(i), l = s(2163), o = s(3895), n = s(1096), r = s(77);
5        class d extends l.Z {
6            constructor(e) {
7                super(), this.props(e), this.initCarousel()
8            }
9            props(e) {
10                this.el = $(e), this.checkCount = 0, this.usePagination = !0
11            }
12            initCarousel() {
13                this.$carousel = $(".slick-carousel-three-panel", this.el), this.$carousel.on("lazyLoaded", ((e, t, s, i) => {
14                    s.addClass("loaded")
15                })), this.$carousel.on("lazyLoadError", ((e, t, s, i) => {
16                    s.attr("src", o.HS + "/global/bike-placeholder.jpg?impolicy=myresize&rw=500"), s.addClass("loaded")
17                })), this.$carousel.slick({
18                    slide: ".slick-item",
19                    lazyLoad: "ondemand",
20                    rows: 0,
21                    slidesToShow: 3,
22                    slidesToScroll: 3,
23                    infinite: !1,
24                    nextArrow: this.el.find(".slick-next"),
25                    prevArrow: this.el.find(".slick-prev"),
26                    responsive: [{breakpoint: o.GI, settings: {slidesToShow: 2, slidesToScroll: 1}}, {
27                        breakpoint: o.y$,
28                        settings: {slidesToShow: 1, slidesToScroll: 1}
29                    }],
30                    dots: this.usePagination,
31                    appendDots: $(".carousel__dots", this.el)
32                }), this.$slides = $(".slick-item", this.$carousel), this.$dots = $(".carousel__dots", this.el), this.usePagination && (this.$dots.removeClass("d-none"), this.setupCarouselDots())
33            }
34        }
35
36        $((() => {
37            // debugger
38            $(".cmp-bikes-carousel").each(((e, t) => {
39                const s = $(t);
40                try {
41                    return new d(s, null)
42                } catch (e) {
43                    console.log(e)
44                }
45            }))
46            $('.zjllspan').on('mouseenter', function() {
47                // 获取当前的属性值
48                const src = $(this).attr('data-image-src');
49                const name = $(this).attr('data-name');
50                const colorname = $(this).attr('data-color-name');
51
52                // 移除所有相同 name 的元素的 default 和 selected 类
53                $(`.${name}label`).removeClass('default selected');
54
55                // 为当前悬浮的元素添加 default 和 selected 类
56                $(this).addClass('default selected');
57
58                // 更新相关的 img 标签的 src 属性
59                $(`.${name}img`).each(function() {
60                    if ($(this).attr('data-name') === name) {
61                        $(this).attr('src', src);
62                    }
63                });
64
65                // 修改与当前 name 相关的 colorname 的文本和属性
66                $(`.${name}colorname`).text(colorname);
67                $(`.${name}colorname`).attr('data-color-name', colorname);
68            }).on('mouseleave', function() {
69                // 移除当前悬浮元素的类
70                $(this).removeClass('default selected');
71
72                const name = $(this).attr('data-name');
73
74                // 重新为默认元素添加 default 和 selected 类
75                $(`.${name}colordefault`).addClass('default selected');
76
77                // 获取默认颜色的信息
78                const defaultColorName = $(`.${name}colordefault`).attr('data-color-name');
79                const defaultSrc = $(`.${name}colordefault`).attr('data-image-src');
80
81                // 更新相关的 img 标签的 src 属性为默认值
82                $(`.${name}img`).each(function() {
83                    if ($(this).attr('data-name') === name) {
84                        $(this).attr('src', defaultSrc);
85                    }
86                });
87
88                // 修改与当前 name 相关的 colorname 的文本和属性为默认值
89                $(`.${name}colorname`).text(defaultColorName);
90                $(`.${name}colorname`).attr('data-color-name', defaultColorName);
91            });
92
93
94
95            // $('.zjllspan').click(function() {
96            //     //获取到当前的data-image-src属性的值
97            //     var src = $(this).attr('data-image-src');
98            //     var name = $(this).attr('data-name');
99            //     var colorname = $(this).attr('data-color-name');
100            //     //移除两个class属性【default selected】
101            //     $(`.${name}label`).removeClass('default selected');
102            //     $(this).addClass('zjllspan color-selector__label default selected')
103            //     //查询出所有class为【zjllimg】的img标签,如果data-name=name,那么修改src属性为src
104            //     $(`.${name}img`).each(function() {
105            //         if ($(this).attr('data-name') == name) {
106            //             $(this).attr('src', src);
107            //         }
108            //     });
109            //     $(`.${name}colorname`).text(colorname);
110            //     $(`.${name}colorname`).attr('data-color-name', colorname);
111            // })
112
113        }))
114    }, 77: function (e, t, s) {
115        var i = s(4621);
116        s(147);
117        t.Z = new class {
118            constructor() {
119            }
120            async getJson(e, t) {
121                return await i.Z.get(e, t)
122            }
123        }
124    }, 2163: function (e, t, s) {
125        s.d(t, {
126            Z: function () {
127                return a
128            }
129        });
130        var i = s(1096);
131        class a {
132            setupCarouselDots() {
133                const e = this.$carousel.slick("getSlick");
134                this.updateCarouselDots(null, e), this.$carousel.on("afterChange", ((e, t) => {
135                    setTimeout((() => {
136                        this.updateCarouselDots(e, t)
137                    }), 100)
138                })), (0, i.Jd)()
139            }
140            updateCarouselDots(e, t) {
141                t.$slides.each(((e, s) => {
142                    const i = ("" + $(s).data("dot-aria-label")).trim();
143                    i.length && t.$dots && t.$dots.children().eq(e).find("button").attr("aria-label", i)
144                }))
145            }
146
147            setupCarouselOffset(e, t) {
148                void 0 === e && (e = $(".carousel-offset-ref", this.$el)), void 0 === t && (t = $(".slick-list", this.$el)), this.updateCarouselOffset(e, t), window.addEventListener("resize", this.updateCarouselOffset.bind(this, e, t))
149            }
150
151            updateCarouselOffset(e, t) {
152                t.css("paddingLeft", e.offset().left + parseInt(e.css("paddingLeft"), 10))
153            }
154
155            setupSlideDimensions(e, t) {
156                void 0 === t && (t = $(".carousel-ghost-slide-ref", this.$el)), this.updateSlideDimensions(e, t), window.addEventListener("resize", this.updateSlideDimensions.bind(this, e, t))
157            }
158
159            updateSlideDimensions(e, t) {
160                e.css("width", t.width())
161            }
162
163            setupSlideInfo(e = ".carousel__slide__info", t = ".carousel__slide__info-ref") {
164                this.slideInfoCtxSel = e, this.infoRefSel = t;
165                const s = this.$carousel.slick("getSlick"), i = this.$carousel.slick("slickCurrentSlide");
166                this.updateSlideInfo(null, s, null, i), this.$carousel.on("beforeChange", this.updateSlideInfo.bind(this))
167            }
168
169            updateSlideInfo(e, t, s, i) {
170                const a = $(this.slideInfoCtxSel, t.$slides[i]).clone();
171                a.find("a").attr("tabindex", 0), $(this.infoRefSel, this.$el).empty().append(a)
172            }
173
174            static removeHiddenSlides(e, t = ".carousel-slide") {
175                $(t, e).filter((function () {
176                    return !String.prototype.trim.apply($(this).text())
177                })).remove()
178            }
179        }
180    }
181}, function (e) {
182    var t;
183    t = 8006, e(e.s = t)
184}]);

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.