tanghaolin
2023-01-10 4ca3a6152894f2deb4a04f6bd784ed692af08da5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
! function (t, e) {
    "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.seamscroll = e() : t.seamscroll = e()
}("undefined" != typeof self ? self : this, function () {
    return function (t) {
        function e(i) {
            if (n[i]) return n[i].exports;
            var o = n[i] = {
                i: i,
                l: !1,
                exports: {}
            };
            return t[i].call(o.exports, o, o.exports, e), o.l = !0, o.exports
        }
        var n = {};
        return e.m = t, e.c = n, e.d = function (t, n, i) {
            e.o(t, n) || Object.defineProperty(t, n, {
                configurable: !1,
                enumerable: !0,
                get: i
            })
        }, e.n = function (t) {
            var n = t && t.__esModule ? function () {
                return t["default"]
            } : function () {
                return t
            };
            return e.d(n, "a", n), n
        }, e.o = function (t, e) {
            return Object.prototype.hasOwnProperty.call(t, e)
        }, e.p = "", e(e.s = 0)
    }([function (t, e, n) {
        "use strict";
        Object.defineProperty(e, "__esModule", {
            value: !0
        });
        var i = n(1);
        n.d(e, "init", function () {
            return i.a
        })
    }, function (t, e, n) {
        "use strict";
        var i = n(2),
            o = function (t) {
                return new i.a(t)
            };
        e.a = o
    }, function (t, e, n) {
        "use strict";
        var i = n(5),
            o = n(6);
        n(3)();
        var r = n(4),
            s = {
                step: 1,
                hoverStop: !0,
                direction: 1,
                singleHeight: 0,
                singleWidth: 0,
                waitTime: 1e3
            },
            a = function (t) {
                this.options = r({}, s, t);
                var e = this.options.dom;
                if (!e) throw new Error("you must set a dom");
                if (e.style.position = "relative", e.style.overflow = "hidden", this.reqFrame = null, this.singleWaitTime = null, this._top = 0, this._left = 0, this.isHover = !1, e.innerHTML += e.innerHTML, this.options.direction > 1) {
                    var n = e.children,
                        i = n[0],
                        o = n.length;
                    this._width = (i.offsetWidth + this._getInt(i, "margin-left") + this._getInt(i, "margin-right")) * o, e.style.width = this._width + "px"
                }
                this._move(), this._bindEvent()
            };
        a.prototype = {
            _getInt: function (t, e) {
                return parseInt(Object(o.a)(t, e))
            },
            _cancle: function () {
                cancelAnimationFrame(this.reqFrame || "")
            },
            _bindEvent: function () {
                if (this.options.hoverStop) {
                    var t = this,
                        e = this.options.dom;
                    Object(i.a)(e, "mouseenter", function () {
                        t.isHover = !0, t.singleWaitTime && clearTimeout(t.singleWaitTime), t._cancle()
                    }), Object(i.a)(e, "mouseleave", function () {
                        t.isHover = !1, t._move()
                    })
                }
            },
            
            stopmove: function () {
                var e = this.options.dom;
                e.style.position = "unset";
            },
            clear: function () {
                var t = this;
                var e = this.options.dom;
                // e.style.position = "unset";
                e.style.top = "0px";
                e.innerHTML = "";
                t.singleWaitTime && clearTimeout(t.singleWaitTime), t._cancle()
            },
            startmove: function () {
                var e = this.options.dom;
                e.style.position = "relative";
                // this._move()
            },
            _move: function () {
                if (!this.isHover) {
                    this._cancle();
                    var t = this,
                        e = this.options.dom;
                    this.reqFrame = requestAnimationFrame(function () {
                        var n = e.offsetHeight / 2,
                            i = t.options.direction;
                        1 === i ? (Math.abs(t._top) >= n && (t._top = 0), t._top -= t.options.step, e.style.top = t._top + "px") : 0 === i ? (t._top >= 0 && (t._top = -1 * n), t._top += t.options.step, e.style.top = t._top + "px") : 2 === i ? (Math.abs(t._left) >= t._width / 2 && (t._left = 0), t._left -= t.options.step, e.style.left = t._left + "px") : 3 === i && (t._left >= 0 && (t._left = t._width / 2 * -1), t._left += t.options.step, e.style.left = t._left + "px"), t._judgeSingle()
                    })
                }
            },
            _judgeSingle: function () {
                var t = this,
                    e = this.options.singleHeight,
                    n = this.options.singleWidth;
                this.singleWaitTime && clearTimeout(this.singleWaitTime), e ? Math.abs(this._top) % e == 0 ? this.singleWaitTime = setTimeout(function () {
                    t._move()
                }, this.options.waitTime) : this._move() : n && Math.abs(this._left) % n == 0 ? this.singleWaitTime = setTimeout(function () {
                    t._move()
                }, this.options.waitTime) : this._move()
            }
        }, e.a = a
    }, function (t, e) {
        var n = function () {
            window.cancelAnimationFrame = function () {
                return window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.oCancelAnimationFrame || window.msCancelAnimationFrame || function (t) {
                    return window.clearTimeout(t)
                }
            }(), window.requestAnimationFrame = function () {
                return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (t) {
                    return window.setTimeout(t, 1e3 / 60)
                }
            }()
        };
        t.exports = n
    }, function (t, e) {
        function n() {
            Array.isArray || (Array.isArray = function (t) {
                return "[object Array]" === Object.prototype.toString.call(t)
            });
            var t = void 0,
                e = void 0,
                i = void 0,
                r = void 0,
                s = void 0,
                a = void 0,
                u = 1,
                c = arguments[0] || {},
                f = !1,
                l = arguments.length;
            if ("boolean" == typeof c && (f = c, c = arguments[1] || {}, u++), "object" !== (void 0 === c ? "undefined" : o(c)) && "function" != typeof c && (c = {}), u === l) return c;
            for (; u < l; u++)
                if (null != (e = arguments[u]))
                    for (t in e) i = c[t], r = e[t], s = Array.isArray(r), f && r && ("object" === (void 0 === r ? "undefined" : o(r)) || s) ? (s ? (s = !1, a = i && Array.isArray(i) ? i : []) : a = i && "object" === (void 0 === i ? "undefined" : o(i)) ? i : {}, c[t] = n(f, a, r)) : r !== undefined && (c[t] = r);
            return c
        }
        var i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) {
            return typeof t
        } : function (t) {
            return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
        },
            o = "function" == typeof Symbol && "symbol" === i(Symbol.iterator) ? function (t) {
                return void 0 === t ? "undefined" : i(t)
            } : function (t) {
                return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : void 0 === t ? "undefined" : i(t)
            };
        t.exports = n
    }, function (t, e, n) {
        "use strict";
        var i = function (t, e, n) {
            t.addEventListener ? t.addEventListener(e, n, !1) : t.attachEvent ? t.attachEvent("on" + e, n) : t["on" + e] = n
        };
        e.a = i
    }, function (t, e, n) {
        "use strict";
        var i = function (t, e) {
            return (t.currentStyle ? t.currentStyle : window.getComputedStyle(t, null))[e]
        };
        e.a = i
    }])
});