• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

common js文件,处理公共效果

OC/C/C++ 水墨上仙 2083次浏览

仿效百度图片首页效果依赖tuzhu_req.js

/*土著人开发的common组件 @土著人 (http://www.tuzhuren.com)*/
define("common:www/page/jquery/browser.js", function() {
    var jQuery = window.jQuery || {};
    jQuery.browser = function() {
        var userAgent = navigator.userAgent.toLowerCase();
        return {
            version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
            safari: /webkit/.test(userAgent),
            opera: /opera/.test(userAgent),
            msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
            mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
        };
    }();
    return jQuery;
});
define("common:www/page/controller/controller.js", function(require, obj, exp) {
    var controllerObj = {
        base: require("common:www/page/controller/base.js")
    };
    exp.exports = {
        get: function(key) {
            return key = key.toLowerCase(), !controllerObj[key], controllerObj[key];
        },
        set: function(key, val) {
            key = key.toLowerCase(), controllerObj[key] || (controllerObj[key] = val);
        }
    };
});
define("common:www/page/controller/base.js", function(require) {
    var jquery = require("jquery"),
        events = require("common:www/page/events/events.js"),
        utils = require("common:www/page/utils/utils.js"),
        base = jquery.extend({
            appendTo: function(n) {
                this.$el.appendTo(n);
            },
            append: function(n, e) {
                var i = e ? this.$el.find(e) : this.$el;
                utils.isArray(n) ? this._appendChildren(n, i) : this._appendChild(n, i);
            },
            _appendChildren: function(n, e) {
                for (var i, t = 0; i = n[t++];)
                    this._appendChild(i, e);
            },
            _appendChild: function(n, e) {
                n.appendTo(e[0]);
            }
        }, events);
    return base;
});
define("common:www/page/events/events.js", function(i) {
    var n = i("jquery"),
        e = i("common:www/page/arch/EventDispatcher/EventDispatcher.js"),
        t = "__bdimg__events",
        d = "__bdimg__",
        s = 1e6,
        o = function() {
            return "bdimg" + s++
        },
        r = function() {
            for (var i, n = 0, e = window[t].length; e > n; n++)
                i = window[t][n], window[d][i].dispose(), window[d][i] = null
        },
        w = n.extend({}, e.prototype);
    return w._addEventListener = w.addEventListener, w.addEventListener = function() {
        var i = Array.prototype.slice.call(arguments);
        this._addEventListener.apply(this, i), 
        this._guid || (this._guid = o(), window[d][this._guid] = this, window[t].push(this._guid))
    }, w.bindEvents = function(i, n) {
        var e, t;
        if (n)
            for (e in n)
                n.hasOwnProperty(e) && (t = n[e], this[t] && i.addEventListener(e, this[t]))
    }, n(window).unload(r), window[d] = {}, window[t] = [], w
});
define("common:www/page/utils/utils.js", function(e, t, n) {
    var o = Object.prototype.toString,
        c = {
            encodeJsonForQuery: function(e) {
                var t = e instanceof Array ? [] : {},
                    n = /^(?:string|boolean|number)/i;
                for (var r in e)
                    e.hasOwnProperty(r) && n.test(typeof e[r]) && (t[r] = encodeURIComponent(decodeURIComponent(e[r])));
                return t
            },
            decodeJsonForQuery: function(e) {
                var t = e instanceof Array ? [] : {};
                for (var n in e)
                    e.hasOwnProperty(n) && (t[n] = decodeURIComponent(e[n]));
                return t
            },
            jsonToQuery: function(e) {
                var t = [];
                e = e || {};
                var n = /^(?:string|boolean|number)/i;
                for (var r in e)
                    e.hasOwnProperty(r) && n.test(typeof e[r]) && t.push(r + "=" + e[r]);
                return t.join("&")
            },
            queryToJson: function(e) {
                for (var t, n, r, o, c = e.substr(e.lastIndexOf("?") + 1), i = c.split("&"), u = i.length, l = {}, a = 0; u > a; a++)
                    i[a] && (o = i[a].split("="), t = o[0], n = o[1], r = l[t], "undefined" == typeof r ? l[t] = n : this.isArray(r) ? r.push(n) : l[t] = [r, n]);
                return l
            },
            getQueryValue: function(e, t) {
                t = t || window.location.href;
                var n = new RegExp("(^|&|\\?|#)" + String(e).replace(new RegExp("([.*+?^=!:${}()|[\\]/\\\\])", "g"), "\\$1") + "=([^&#]*)(&|$|#)", ""),
                    r = t.match(n);
                return r ? r[2] : null
            },
            format: function(e, t) {
                e = String(e);
                var n = Array.prototype.slice.call(arguments, 1),
                    r = Object.prototype.toString;
                return n.length ? (n = 1 == n.length ? null !== t && /\[object Array\]|\[object Object\]/.test(r.call(t)) ? t : n : n, e.replace(/#\{(.+?)\}/g, function(e, t) {
                    var o = n[t];
                    return "[object Function]" == r.call(o) && (o = o(t)), "undefined" == typeof o ? "" : o
                })) : e
            },
            throttle: function(e, t) {
                var n = null;
                return function() {
                    var r = this,
                        o = arguments;
                    clearTimeout(n), n = setTimeout(function() {
                        e.apply(r, o)
                    }, t)
                }
            },
            isArray: function(e) {
                return "[object Array]" === o.call(e)
            }
        };
    c.getByteLength = function(e) {
        return String(e).replace(/[^\x00-\xff]/g, "ci").length
    }, c.encodeURL = function(e) {
        return String(e).replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "")
    }, c.encodeHTML = function(e) {
        return String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "")
    }, c.buffer = function(e, t, n) {
        function r() {
            r.stop(), o = c.delay(e, t, n || this, arguments)
        }
        if (t = t || 150, -1 === t)
            return function() {
                e.apply(n || this, arguments)
            };
        var o = null;
        return r.stop = function() {
            o && (o.cancel(), o = 0)
        }, r
    }, c.delay = function(e, t, n, o) {
        t = t || 0;
        var c = function() {
            e.apply(n, o || [])
        };
        return r = setTimeout(c, t), {
            cancel: function() {
                clearTimeout(r)
            }
        }
    }, c.getCookie = function(e) {
        var t = new RegExp("(^| )" + e + "=([^;]*)(;|$)"),
            n = t.exec(document.cookie);
        return n ? n[2] || null : void 0
    }, c.setCookie = function(e, t, n, r, o, c) {
        var i = new Date;
        i.setTime(i.getTime()), n && (n = 1e3 * n * 60 * 60 * 24);
        var u = new Date(i.getTime() + n);
        document.cookie = e + "=" + escape(String(encodeURIComponent(t))) + (n ? ";expires=" + u.toGMTString() : "") + (r ? ";path=" + r : "") + (o ? ";domain=" + o : "") + (c ? ";secure" : "")
    }, c.scroller = e("common:www/page/utils/scroller.js"), c.pageResizer = e("common:www/page/utils/pageresizer.js"), c.UI = {
        pageHeight: function() {
            var e = document;
            return Math.max(e.body.scrollHeight, e.documentElement.scrollHeight)
        },
        pageWidth: function() {
            var e = document;
            return Math.max(e.body.scrollWidth, e.documentElement.scrollWidth)
        },
        clientWidth: function() {
            var e = document,
                t = "BackCompat" == e.compatMode ? e.body : e.documentElement;
            return t.clientWidth
        },
        clientHeight: function() {
            var e = document,
                t = "BackCompat" == e.compatMode ? e.body : e.documentElement;
            return t.clientHeight
        },
        windowHeight: function() {
            var e = document.documentElement;
            return self.innerHeight || e && e.clientHeight || document.body.clientHeight
        },
        windowWidth: function() {
            var e = document.documentElement;
            return self.innerWidth || e && e.clientWidth || document.body.clientWidth
        },
        screenWidth: function() {
            return window.screen.width
        },
        screenHeight: function() {
            return window.screen.height
        },
        scrollY: function(e) {
            var t = document.documentElement;
            if (e) {
                var n = e.parentNode,
                    r = e.scrollTop || 0;
                return e == t && (r = UI.scrollY()), n ? r + UI.scrollY(n) : r
            }
            return self.pageYOffset || t && t.scrollTop || document.body.scrollTop
        }
    }, n.exports = c
});
define("common:www/page/arch/EventDispatcher/EventDispatcher.js", function() {
    var t = function() {
        this.__listeners = {}
    };
    t.prototype = {
        dispatchEvent: function(t, e) {
            e = e || {},
            e.type || (e.type = t),
            e.target || (e.target = this),
            this.__listeners || (this.__listeners = {});
            var n,
                i = this.__listeners[t],
                s = [];
            if (i) {
                for (var r = 0, h = i.length; h > r; r++)
                    n = i[r],
                    n ? (s = n.args.slice(0), s.unshift(e), n.fn.apply(n.owner, s)) : (i.splice(r--, 1), h--);
                return !0
            }
            return !1
        },
        addEventListeners: function(t, e, n) {
            if ("object" == typeof t)
                for (var i in t)
                    "function" == typeof t[i] && this.addEventListener(i, t[i], e, n);
            return this
        },
        addEventListener: function(t, e, n, i) {
            return n = n || this, i = i || [], this.__listeners || (this.__listeners = {}), this.__listeners[t] instanceof Array || (this.__listeners[t] = []), this.__listeners[t].push({
                fn: e,
                owner: n,
                args: i
            }), this
        },
        removeEventListener: function(t, e) {
            var n, i = this.__listeners[t] || [];
            if (!i || "function" != typeof e)
                return this.__listeners[t] = [], this;
            for (var s = 0; s < i.length; s++)
                n = i[s], n && n.fn === e && (i[s] = null);
            return this
        },
        removeEventListeners: function(t) {
            if (t && "object" == typeof t)
                for (var e in t)
                    this.removeEventListener(e, t[e]);
            else
                this.__listeners = {}
        },
        dispose: function() {
            var t;
            this.dispatchEvent("disposing");
            for (t in this)
                delete this[t] || (this.name = null)
        }
    };
    var e = new t;
    return t.eventCenter = e, t
});
define("common:www/page/model/model.js", function(e, o, t) {
    var n = {};
    t.exports = {
        get: function(e) {
            return e = e.toLowerCase(), !n[e], n[e]
        },
        set: function(e, o) {
            e = e.toLowerCase(), n[e] || (n[e] = o)
        }
    }
});
define("common:www/page/databind/databind.js", function(t, n, e) {
    function a(t) {
        for (var n, e, a, i = 0, r = []; n = t[i++];)
            n = n.split(":"), e = n[0], a = n[1], a && e && r.push({
                type: a,
                name: e
            });
        return r.length ? r : null
    }

    function i(t, n, e) {
        var i, r, d, o, u, l, c = 0;
        for (i = this.$el[0] == n ? this.$el : s(n), r = i.attr("data-bind"), d = a(r.split(";")); o = d[c++];)
            u = o.type, l = o.name, p[u] && p[u].bind(this, l, i, this.$el, e && e[l])
    }

    function r(t, n) {
        return function() {
            var e = Array.prototype.slice.call(arguments);
            e.push(n), i.apply(t, e)
        }
    }

    function d(t, n) {
        var e, a, i, d;
        return e = s(t), i = s.extend({
            $el: e,
            __prop: {},
            __preProp: {}
        }, c), a = e.find("[data-bind]"), d = r(i, n), a.each(d), e.attr("data-bind") && d(0, e[0]), i
    }

    function o(t) {
        s.extend(p, t)
    }
    var s = t("jquery"),
        u = t("common:www/page/events/events.js"),
        l = "databound" + (~new Date).toString(16).substr(0, 5),
        c = s.extend({
            set: function(t, n, e) {
                var a, i, r;
                if (n != this.__prop[t]) {
                    if ("object" == typeof n && "[object Array]" !== Object.prototype.toString.call(n)) {
                        i = this.__prop[t], r = !1;
                        for (a in n)
                            if (n.hasOwnProperty(a) && (!i || !i[a] || n[a] != i[a])) {
                                r = !0;
                                break
                            }
                        if (!r)
                            return
                    }
                    this.__preProp[t] = this.__prop[t], this.__prop[t] = n, e || this.dispatchEvent("set:" + t, {
                        data: n,
                        fromEle: e
                    })
                }
            },
            get: function(t) {
                return this.__prop[t]
            },
            appendTo: function(t) {
                this.$el.appendTo(t)
            }
        }, u),
        p = {
            style: {
                handler: function(t) {
                    return function(n) {
                        t.css(n.data)
                    }
                },
                bind: function(t, n, e, a, i) {
                    var r = this.handler(e);
                    i && (r.call(t, {
                        data: i
                    }), t.__prop[n] = i), t.addEventListener("set:" + n, r)
                }
            },
            src: {
                handler: function(t) {
                    return function(n) {
                        t[0].src = n.data
                    }
                },
                bind: function(t, n, e, a, i) {
                    var r = this.handler(e);
                    i && (r.call(t, {
                        data: i
                    }), t.__prop[n] = i), t.addEventListener("set:" + n, r)
                }
            },
            dualTxt: {
                getHandler: function(t) {
                    return function(n) {
                        n.fromEle || t.val(n.data)
                    }
                },
                setHandler: function(t, n) {
                    function e() {
                        t.set(n, t.__inputVal), t.__inputVal = "", t.__keyupTimer = null
                    }
                    return function(a) {
                        t.__keyupTimer ? clearTimeout(t.__keyupTimer) : t.dispatchEvent("typing:" + n), t.__keyupTimer = setTimeout(e, 200), t.__inputVal = a.target.value
                    }
                },
                bind: function(t, n, e, a, i) {
                    var r = this.getHandler(e);
                    t.addEventListener("set:" + n, r), e.bind("keyup", this.setHandler(t, n)), i && (r.call(t, {
                        data: i
                    }), t.__prop[n] = i)
                }
            },
            txt: {
                handler: function(t) {
                    return function(n) {
                        t.text(n.data)
                    }
                },
                bind: function(t, n, e, a, i) {
                    var r = this.handler(e);
                    t.addEventListener("set:" + n, r), i && (r.call(t, {
                        data: i
                    }), t.__prop[n] = i)
                }
            },
            cls: {
                handler: function(t, n) {
                    return function(e) {
                        this.__preProp[t] && n.removeClass(this.__preProp[t]), n.addClass(e.data)
                    }
                },
                bind: function(t, n, e, a, i) {
                    var r = this.handler(n, e);
                    t.addEventListener("set:" + n, r), i && (r.call(t, {
                        data: i
                    }), t.__prop[n] = i)
                }
            },
            click: {
                handler: function(t, n) {
                    return function(e) {
                        t.dispatchEvent("click:" + n, e)
                    }
                },
                bind: function(t, n, e, a) {
                    var i = this.handler(t, n);
                    e.addClass(l + "-" + n), e == a ? a.bind("click", i) : a.delegate("." + l + "-" + n, "click", i)
                }
            },
            mouseenter: {
                handler: function(t, n) {
                    return function(e) {
                        t.dispatchEvent("mouseenter:" + n, e)
                    }
                },
                bind: function(t, n, e, a) {
                    var i = this.handler(t, n);
                    e.addClass(l + "-" + n), e == a ? a.bind("mouseenter", i) : a.delegate("." + l + "-" + n, "mouseenter", i)
                }
            },
            mouseleave: {
                handler: function(t, n) {
                    return function(e) {
                        t.dispatchEvent("mouseleave:" + n, e)
                    }
                },
                bind: function(t, n, e, a) {
                    var i = this.handler(t, n);
                    e.addClass(l + "-" + n), e == a ? a.bind("mouseleave", i) : a.delegate("." + l + "-" + n, "mouseleave", i)
                }
            },
            link: {
                handler: function(t) {
                    return function(n) {
                        t[0].href = n.data
                    }
                },
                bind: function(t, n, e, a, i) {
                    var r = this.handler(e);
                    i && (r.call(t, {
                        data: i
                    }), t.__prop[n] = i), t.addEventListener("set:" + n, r)
                }
            },
            attr: {
                handler: function(t) {
                    return function(n) {
                        t.attr(n.data)
                    }
                },
                bind: function(t, n, e, a, i) {
                    var r = this.handler(e);
                    i && (r.call(t, {
                        data: i
                    }), t.__prop[n] = i), t.addEventListener("set:" + n, r)
                }
            }
        };
    e.exports = {
        bind: d,
        mixinBoundMap: o
    }
});
define("common:www/page/slider/slider.js", function(t, i, s) {
    function n(t, i, s, n) {
        var e = this;
        this.$el = t, this.$cnt, this.$slideCnt, this.duration = n.duration, this.isCycle = n.isCycle, 
        this.curIdx = 0, this.slideWidth = this.$el.width(), this.slidesNum = i.length, 
        this.autoAnimateInterval = n.autoAnimateInterval || 5e3, this.autoTurning = s, 
        this._leftBtnClickHandler = function(t) {
            t.preventDefault(), e.turnLeft()
        }, this._rightBtnClickHandler = function(t) {
            t.preventDefault(), e.turnRight()
        }, this._animationFinish = function() {
            e.isAnimating = !1
        }, this._autoTurning = function() {
            e._timer = null, e.turnRight(), e.startAutoAnimation()
        }, this._mouseEnterHandler = function() {
            e.stopAutoAnimation()
        }, this._mouseLeaveHandler = function() {
            e.startAutoAnimation()
        }, this._dotClikeHandler = function (t) {
            t.preventDefault(), e.dotMoveslide(this);
        }, 
        this.realIdx = 0, i.addClass("slide-show-ctn"), this._buildContainer(i), i = null, 
        s && this.startAutoAnimation()
    }
    var e = t("jquery"),
        h = t("common:www/page/events/events.js");
    e.extend(n.prototype, h, {
        _buildContainer: function(t) {
            this.$el.append('<div class="mod-slide-show"><div class="cnt"></div></div><div class="three_dot"><div class="dot_box"></div></div>'),
            this.$cnt = this.$el.find("div.cnt"), 
            this.$dot = this.$el.find("div.dot_box");
            this.$slideCnt = this.$el.find("div.mod-slide-show"), 
            this.$cnt.width(this.slideWidth * this.slidesNum), 
            this.autoTurning && (this.$el.bind("mouseenter", this._mouseEnterHandler), 
                this.$el.bind("mouseleave", this._mouseLeaveHandler)), t.appendTo(this.$cnt);
            this._buildDot();
        },
        _buildDot: function () {
            var i, cur = "cur", dotItem = "";
            for (i = 0; i < this.slidesNum; i++) {
                !~-i && (cur = "");
                dotItem += '<a class="' + cur + '" href="###"></a>';
            }
            this.$dot.append(dotItem);
            this.$dot.find("a").bind("click", this._dotClikeHandler);
        },
        dotMoveslide: function (cur) {
            var cliDot = $(cur).index(),
                oldDot = $(cur).filter(".cur").index();
            cliDot !== oldDot && (cliDot > oldDot ? this.turnRight() : this.turnLeft());
        },
        _moveSlide: function(t, i) {
            var s = {
                first: "prepend",
                last: "append"
            };
            this.$cnt[s[t]](i)
        },
        _moveFirstSlideToLast: function() {
            this._moveSlide("last", this.$cnt.children(":first")), 
            this.curIdx--, 
            this.$slideCnt[0].scrollLeft = this.slideWidth * this.curIdx
        },
        _moveLastSlideToFirst: function() {
            this._moveSlide("first", this.$cnt.children(":last")), 
            this.curIdx++, 
            this.$slideCnt[0].scrollLeft = this.slideWidth * this.curIdx
        },
        turnLeft: function() {
            if (this.isAnimating)
                return this;
            if (0 == this.curIdx) {
                if (!this.isCycle)
                    return;
                this._moveLastSlideToFirst()
            }
            return this._animate("left"), this.curIdx--, this.realIdx--,
            this.realIdx < 0 && (this.realIdx = this.slidesNum - 1), 
            this.$dot.find("a").removeClass("cur").eq(this.realIdx).addClass("cur"),
            this.dispatchEvent("slideMoved", {
                realIdx: this.realIdx
            }), this
        },
        turnRight: function() {
            var t;
            if (this.isAnimating)
                return this;
            if (this.curIdx == this.slidesNum - 1) {
                if (!this.isCycle)
                    return;
                this._moveFirstSlideToLast()
            }
            return t = this._animate("right"), this.curIdx++, this.realIdx++, 
            this.realIdx >= this.slidesNum && (this.realIdx = 0), 
            this.$dot.find("a").removeClass("cur").eq(this.realIdx).addClass("cur"),
            this.dispatchEvent("slideMoved", {
                realIdx: this.realIdx
            }), this
        },
        _animate: function(t) {
            var i = {
                left: "-=",
                right: "+="
            };
            return this.isAnimating = !0, this.stopAutoAnimation(), this.$slideCnt.animate({
                scrollLeft: i[t] + this.slideWidth
            }, this.duration, this._animationFinish)
        },
        setBtns: function(t, i) {
            t.bind("click", this._leftBtnClickHandler), i.bind("click", this._rightBtnClickHandler)
        },
        startAutoAnimation: function() {
            this.autoTurning && (this._timer || (this._timer = setTimeout(this._autoTurning, this.autoAnimateInterval)))
        },
        stopAutoAnimation: function() {
            this._timer && (clearTimeout(this._timer), this._timer = null)
        },
        updateContentWidth: function() {
            return this.stopAutoAnimation(), 
            this.isAnimating ? (setTimeout(this.updateContentWidth.bind(this), this.duration), void 0) : 
                (this.slideWidth = this.$el.width(), this.$cnt.width(this.slideWidth * this.slidesNum), this.$slideCnt[0].scrollLeft = this.curIdx * this.slideWidth, this.startAutoAnimation(), void 0)
        }
    }), s.exports = {
        init: function(t, i, s) {
            var h, d, l, r, o = e(t),
                a = e(i),
                u = {
                    leftBtnSel: ".slide-left-btn",
                    rightBtnSel: ".slide-right-btn",
                    autoAnimate: !0,
                    duration: 800,
                    isCycle: !0
                };
            return !o.length || a.length <= 1 ? (r = new Function, {
                updateContentWidth: r,
                stopAutoAnimation: r,
                startAutoAnimation: r,
                setBtns: r,
                turnRight: r,
                turnLeft: r,
                addEventListener: r,
                removeEventListener: r
            }) : (e.extend(u, s), h = e(u.leftBtnSel), d = e(u.rightBtnSel), 
                l = new n(o, a, u.autoAnimate, {
                    duration: u.duration,
                    isCycle: u.isCycle
                }), h.length && d.length && l.setBtns(h, d), l)
        }
    }
});
define("common:www/page/utils/scroller.js", function(i) {
    var t = i("jquery"),
        n = i("common:www/page/events/events.js"),
        s = {
            _timer: null,
            _isInit: !1,
            _lastNotifyTime: -1,
            _lastCheckTime: -1,
            _scrollTop: 0,
            _isRunning: !1,
            tick: 0,
            duration: 0,
            init: function(i) {
                var n = t.extend({
                    tick: 200,
                    duration: 400
                }, i);
                return this._isInit ? this : (this.tick = n.tick, this.duration = n.duration, this._isInit = !0, this)
            },
            isInited: function() {
                return this._isInit
            },
            start: function() {
                this._isRunning || (t(window).bind("scroll", this.scrolling), this._isRunning = !0)
            },
            stop: function() {
                t(window).unbind("scroll", this.scrolling), this._isRunning = !1
            },
            scrolling: function() {
                var i = new Date;
                s._timer ? (-1 != s._lastCheckTime && i - s._lastCheckTime >= s.tick / 2 && (clearTimeout(s._timer), s._timer = setTimeout(s.scrollFinished, s.tick), s._lastCheckTime = i), -1 != s._lastNotifyTime && i - s._lastNotifyTime >= s.duration && s.notifyScrolling(i)) : (s.dispatchEvent("scrollBegin"), s._timer = setTimeout(s.scrollFinished, s.tick), s._lastNotifyTime = i, s._lastCheckTime = i)
            },
            scrollFinished: function() {
                s.notifyScrolling(), s.emit("scrollEnd"), s._lastNotifyTime = -1, s._timer = null
            },
            notifyScrolling: function(i) {
                this.emit("scrolling"), this._lastNotifyTime = i
            },
            emit: function(i) {
                var n = t(window).scrollTop();
                this.dispatchEvent(i, {
                    scrollTop: n,
                    scrollingDown: n > this._scrollTop
                }), this._scrollTop = n
            }
        };
    return t.extend(s, n), s
});
define("common:www/page/utils/pageresizer.js", function(i) {
    var t = i("jquery"),
        n = i("common:www/page/events/events.js"),
        browser = i("common:www/page/jquery/browser.js"),
        e = {
            _timer: null,
            _isInit: !1,
            _isRunning: !1,
            _lastNotifyTime: -1,
            tick: 200,
            duration: 400,
            curWidth: -1,
            curHeight: -1,
            init: function(i) {
                var n = t.extend({
                    tick: 200,
                    duration: 400
                }, i);
                return this._isInit ? this : (browser.browser.msie && browser.browser.version < 8 && (this._resizeing = this.resizing, this.resizing = this.resizingIE7), this.tick = n.tick, this.duration = n.duration, this._isInit = !0, this)
            },
            isInited: function() {
                return this._isInit
            },
            start: function() {
                this._isRunning || (t(window).bind("resize", this.resizing), this._isRunning = !0)
            },
            stop: function() {
                t(window).unbind("resize", this.resizing), this._isRunning = !1
            },
            resizingIE7: function() {
                var i = t(window).width(),
                    n = t(window).height();
                (e.curWidth != i || e.curHeight != n) && (e.curWidth = i, e.curHeight = n, e._resizeing())
            },
            resizing: function() {
                var i = new Date;
                e._timer ? (clearTimeout(e._timer), e._timer = setTimeout(e.resizeFinished, e.tick), -1 != e._lastNotifyTime && i - e._lastNotifyTime >= e.duration && e.notifyReszing(i)) : (e.dispatchEvent("resizeBegin"), e._timer = setTimeout(e.resizeFinished, e.tick), e._lastNotifyTime = i)
            },
            resizeFinished: function() {
                e.notifyReszing(), e.dispatchEvent("resizeEnd"), e._lastNotifyTime = -1, e._timer = null
            },
            notifyReszing: function(i) {
                this._lastNotifyTime = i, this.dispatchEvent("resizing")
            }
        };
    return t.extend(e, n), e
});
define("common:www/page/zoomdetector/detector.js", function(b) {
    var a = b("jquery"), c = (b("common:www/page/events/events.js"), function() {
        var k = !0, h = function() {
            return Math.round(screen.deviceXDPI / screen.logicalXDPI * 100) / 100
        }, f = function() {
            return Math.round(document.documentElement.offsetHeight / window.innerHeight * 100) / 100
        }, g = function() {
            var d = window.top.outerWidth / window.top.innerWidth;
            return Math.round(100 * d) / 100
        }, j = function() {
            var d = null, i = null;
            return function(n) {
                var s = !1, e = [".-wzd-zoomdetect {", "text-decoration: none", "}", "@media only screen and (-o-min-device-pixel-ratio: ", n, "/1),", "only screen and (min--moz-device-pixel-ratio: ", n, "), ", "only screen and (-webkit-min-device-pixel-ratio: ", n, "), ", "only screen and (min-resolution: 240dpi), ", "only screen and (min-resolution: 2dppx) {", ".-wzd-zoomdetect {", "text-decoration: underline", "}", "}"].join("");
                if (i && d) {
                    d.text(e), s = "underline" == i.css("text-decoration")
                } else {
                    try {
                        i = a('<div style="display:none;">a</div>').hide().addClass("-wzd-zoomdetect").appendTo("body"), d = a('<style type="text/css">' + e + "</style>"), d.insertBefore(i), s = "underline" == i.css("text-decoration")
                    } catch (t) {
                    }
                }
                return s
            }
        }(), m = function() {
            var i = 0.01, d = function(u, e, s) {
                var t = (u + e) / 2;
                return 0 >= s || i > e - u ? t : j(t) ? d(t, e, s - 1) : d(u, t, s - 1)
            };
            return d(0, 5, 10)
        }, p = {detected: !1,retina: !1}, l = function() {
            return p.detected ? p.retina : (p = {detected: !0,retina: j(2)}, p.retina)
        }, q = function() {
            var e = 1, d = navigator.userAgent.toLowerCase();
            return isNaN(screen.logicalXDPI) || isNaN(screen.systemXDPI) ? window.navigator.msMaxTouchPoints ? function() {
                return e = f()
            } : /BIDUBrowser/i.test(d) ? function() {
                return k = !1, e
            } : /webkit/i.test(d) || /opera/i.test(d) ? function() {
                return e = g()
            } : /firefox/i.test(d) ? function() {
                return l() ? (e = 1, k = !1) : e = m(), e
            } : parseInt(window.top.outerWidth, 10) ? function() {
                return e = g()
            } : function() {
                return k = !1, e
            } : function() {
                return e = h()
            }
        }();
        return q(), {support: function() {
                return k
            },detect: q}
    }());
    return {detect: function() {
            var d = 1;
            return c.support() && (d = c.detect(), d > 0.95 && 1.05 > d && (d = 1)), d
        }}
});


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明common js文件,处理公共效果
喜欢 (0)
加载中……