[JavaScript] common js文件,处理公共效果 →→→→→进入此内容的聊天室

来自 , 2021-02-25, 写在 JavaScript, 查看 152 次.
URL http://www.code666.cn/view/7dd2ae7d
  1. /*土著人开发的common组件 @土著人 (http://www.tuzhuren.com)*/
  2. define("common:www/page/jquery/browser.js", function() {
  3.     var jQuery = window.jQuery || {};
  4.     jQuery.browser = function() {
  5.         var userAgent = navigator.userAgent.toLowerCase();
  6.         return {
  7.             version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
  8.             safari: /webkit/.test(userAgent),
  9.             opera: /opera/.test(userAgent),
  10.             msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
  11.             mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
  12.         };
  13.     }();
  14.     return jQuery;
  15. });
  16. define("common:www/page/controller/controller.js", function(require, obj, exp) {
  17.     var controllerObj = {
  18.         base: require("common:www/page/controller/base.js")
  19.     };
  20.     exp.exports = {
  21.         get: function(key) {
  22.             return key = key.toLowerCase(), !controllerObj[key], controllerObj[key];
  23.         },
  24.         set: function(key, val) {
  25.             key = key.toLowerCase(), controllerObj[key] || (controllerObj[key] = val);
  26.         }
  27.     };
  28. });
  29. define("common:www/page/controller/base.js", function(require) {
  30.     var jquery = require("jquery"),
  31.         events = require("common:www/page/events/events.js"),
  32.         utils = require("common:www/page/utils/utils.js"),
  33.         base = jquery.extend({
  34.             appendTo: function(n) {
  35.                 this.$el.appendTo(n);
  36.             },
  37.             append: function(n, e) {
  38.                 var i = e ? this.$el.find(e) : this.$el;
  39.                 utils.isArray(n) ? this._appendChildren(n, i) : this._appendChild(n, i);
  40.             },
  41.             _appendChildren: function(n, e) {
  42.                 for (var i, t = 0; i = n[t++];)
  43.                     this._appendChild(i, e);
  44.             },
  45.             _appendChild: function(n, e) {
  46.                 n.appendTo(e[0]);
  47.             }
  48.         }, events);
  49.     return base;
  50. });
  51. define("common:www/page/events/events.js", function(i) {
  52.     var n = i("jquery"),
  53.         e = i("common:www/page/arch/EventDispatcher/EventDispatcher.js"),
  54.         t = "__bdimg__events",
  55.         d = "__bdimg__",
  56.         s = 1e6,
  57.         o = function() {
  58.             return "bdimg" + s++
  59.         },
  60.         r = function() {
  61.             for (var i, n = 0, e = window[t].length; e > n; n++)
  62.                 i = window[t][n], window[d][i].dispose(), window[d][i] = null
  63.         },
  64.         w = n.extend({}, e.prototype);
  65.     return w._addEventListener = w.addEventListener, w.addEventListener = function() {
  66.         var i = Array.prototype.slice.call(arguments);
  67.         this._addEventListener.apply(this, i),
  68.         this._guid || (this._guid = o(), window[d][this._guid] = this, window[t].push(this._guid))
  69.     }, w.bindEvents = function(i, n) {
  70.         var e, t;
  71.         if (n)
  72.             for (e in n)
  73.                 n.hasOwnProperty(e) && (t = n[e], this[t] && i.addEventListener(e, this[t]))
  74.     }, n(window).unload(r), window[d] = {}, window[t] = [], w
  75. });
  76. define("common:www/page/utils/utils.js", function(e, t, n) {
  77.     var o = Object.prototype.toString,
  78.         c = {
  79.             encodeJsonForQuery: function(e) {
  80.                 var t = e instanceof Array ? [] : {},
  81.                     n = /^(?:string|boolean|number)/i;
  82.                 for (var r in e)
  83.                     e.hasOwnProperty(r) && n.test(typeof e[r]) && (t[r] = encodeURIComponent(decodeURIComponent(e[r])));
  84.                 return t
  85.             },
  86.             decodeJsonForQuery: function(e) {
  87.                 var t = e instanceof Array ? [] : {};
  88.                 for (var n in e)
  89.                     e.hasOwnProperty(n) && (t[n] = decodeURIComponent(e[n]));
  90.                 return t
  91.             },
  92.             jsonToQuery: function(e) {
  93.                 var t = [];
  94.                 e = e || {};
  95.                 var n = /^(?:string|boolean|number)/i;
  96.                 for (var r in e)
  97.                     e.hasOwnProperty(r) && n.test(typeof e[r]) && t.push(r + "=" + e[r]);
  98.                 return t.join("&")
  99.             },
  100.             queryToJson: function(e) {
  101.                 for (var t, n, r, o, c = e.substr(e.lastIndexOf("?") + 1), i = c.split("&"), u = i.length, l = {}, a = 0; u > a; a++)
  102.                     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]);
  103.                 return l
  104.             },
  105.             getQueryValue: function(e, t) {
  106.                 t = t || window.location.href;
  107.                 var n = new RegExp("(^|&|\\?|#)" + String(e).replace(new RegExp("([.*+?^=!:${}()|[\\]/\\\\])", "g"), "\\$1") + "=([^&#]*)(&|$|#)", ""),
  108.                     r = t.match(n);
  109.                 return r ? r[2] : null
  110.             },
  111.             format: function(e, t) {
  112.                 e = String(e);
  113.                 var n = Array.prototype.slice.call(arguments, 1),
  114.                     r = Object.prototype.toString;
  115.                 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) {
  116.                     var o = n[t];
  117.                     return "[object Function]" == r.call(o) && (o = o(t)), "undefined" == typeof o ? "" : o
  118.                 })) : e
  119.             },
  120.             throttle: function(e, t) {
  121.                 var n = null;
  122.                 return function() {
  123.                     var r = this,
  124.                         o = arguments;
  125.                     clearTimeout(n), n = setTimeout(function() {
  126.                         e.apply(r, o)
  127.                     }, t)
  128.                 }
  129.             },
  130.             isArray: function(e) {
  131.                 return "[object Array]" === o.call(e)
  132.             }
  133.         };
  134.     c.getByteLength = function(e) {
  135.         return String(e).replace(/[^\x00-\xff]/g, "ci").length
  136.     }, c.encodeURL = function(e) {
  137.         return String(e).replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "&#39;")
  138.    }, c.encodeHTML = function(e) {
  139.        return String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "&#39;")
  140.    }, c.buffer = function(e, t, n) {
  141.        function r() {
  142.            r.stop(), o = c.delay(e, t, n || this, arguments)
  143.        }
  144.        if (t = t || 150, -1 === t)
  145.            return function() {
  146.                e.apply(n || this, arguments)
  147.            };
  148.        var o = null;
  149.        return r.stop = function() {
  150.            o && (o.cancel(), o = 0)
  151.        }, r
  152.    }, c.delay = function(e, t, n, o) {
  153.        t = t || 0;
  154.        var c = function() {
  155.            e.apply(n, o || [])
  156.        };
  157.        return r = setTimeout(c, t), {
  158.            cancel: function() {
  159.                clearTimeout(r)
  160.            }
  161.        }
  162.    }, c.getCookie = function(e) {
  163.        var t = new RegExp("(^| )" + e + "=([^;]*)(;|$)"),
  164.            n = t.exec(document.cookie);
  165.        return n ? n[2] || null : void 0
  166.    }, c.setCookie = function(e, t, n, r, o, c) {
  167.        var i = new Date;
  168.        i.setTime(i.getTime()), n && (n = 1e3 * n * 60 * 60 * 24);
  169.        var u = new Date(i.getTime() + n);
  170.        document.cookie = e + "=" + escape(String(encodeURIComponent(t))) + (n ? ";expires=" + u.toGMTString() : "") + (r ? ";path=" + r : "") + (o ? ";domain=" + o : "") + (c ? ";secure" : "")
  171.    }, c.scroller = e("common:www/page/utils/scroller.js"), c.pageResizer = e("common:www/page/utils/pageresizer.js"), c.UI = {
  172.        pageHeight: function() {
  173.            var e = document;
  174.            return Math.max(e.body.scrollHeight, e.documentElement.scrollHeight)
  175.        },
  176.        pageWidth: function() {
  177.            var e = document;
  178.            return Math.max(e.body.scrollWidth, e.documentElement.scrollWidth)
  179.        },
  180.        clientWidth: function() {
  181.            var e = document,
  182.                t = "BackCompat" == e.compatMode ? e.body : e.documentElement;
  183.            return t.clientWidth
  184.        },
  185.        clientHeight: function() {
  186.            var e = document,
  187.                t = "BackCompat" == e.compatMode ? e.body : e.documentElement;
  188.            return t.clientHeight
  189.        },
  190.        windowHeight: function() {
  191.            var e = document.documentElement;
  192.            return self.innerHeight || e && e.clientHeight || document.body.clientHeight
  193.        },
  194.        windowWidth: function() {
  195.            var e = document.documentElement;
  196.            return self.innerWidth || e && e.clientWidth || document.body.clientWidth
  197.        },
  198.        screenWidth: function() {
  199.            return window.screen.width
  200.        },
  201.        screenHeight: function() {
  202.            return window.screen.height
  203.        },
  204.        scrollY: function(e) {
  205.            var t = document.documentElement;
  206.            if (e) {
  207.                var n = e.parentNode,
  208.                    r = e.scrollTop || 0;
  209.                return e == t && (r = UI.scrollY()), n ? r + UI.scrollY(n) : r
  210.            }
  211.            return self.pageYOffset || t && t.scrollTop || document.body.scrollTop
  212.        }
  213.    }, n.exports = c
  214. });
  215. define("common:www/page/arch/EventDispatcher/EventDispatcher.js", function() {
  216.    var t = function() {
  217.        this.__listeners = {}
  218.    };
  219.    t.prototype = {
  220.        dispatchEvent: function(t, e) {
  221.            e = e || {},
  222.            e.type || (e.type = t),
  223.            e.target || (e.target = this),
  224.            this.__listeners || (this.__listeners = {});
  225.            var n,
  226.                i = this.__listeners[t],
  227.                s = [];
  228.            if (i) {
  229.                for (var r = 0, h = i.length; h > r; r++)
  230.                    n = i[r],
  231.                    n ? (s = n.args.slice(0), s.unshift(e), n.fn.apply(n.owner, s)) : (i.splice(r--, 1), h--);
  232.                return !0
  233.            }
  234.            return !1
  235.        },
  236.        addEventListeners: function(t, e, n) {
  237.            if ("object" == typeof t)
  238.                for (var i in t)
  239.                    "function" == typeof t[i] && this.addEventListener(i, t[i], e, n);
  240.            return this
  241.        },
  242.        addEventListener: function(t, e, n, i) {
  243.            return n = n || this, i = i || [], this.__listeners || (this.__listeners = {}), this.__listeners[t] instanceof Array || (this.__listeners[t] = []), this.__listeners[t].push({
  244.                fn: e,
  245.                owner: n,
  246.                args: i
  247.            }), this
  248.        },
  249.        removeEventListener: function(t, e) {
  250.            var n, i = this.__listeners[t] || [];
  251.            if (!i || "function" != typeof e)
  252.                return this.__listeners[t] = [], this;
  253.            for (var s = 0; s < i.length; s++)
  254.                n = i[s], n && n.fn === e && (i[s] = null);
  255.            return this
  256.        },
  257.        removeEventListeners: function(t) {
  258.            if (t && "object" == typeof t)
  259.                for (var e in t)
  260.                    this.removeEventListener(e, t[e]);
  261.            else
  262.                this.__listeners = {}
  263.        },
  264.        dispose: function() {
  265.            var t;
  266.            this.dispatchEvent("disposing");
  267.            for (t in this)
  268.                delete this[t] || (this.name = null)
  269.        }
  270.    };
  271.    var e = new t;
  272.    return t.eventCenter = e, t
  273. });
  274. define("common:www/page/model/model.js", function(e, o, t) {
  275.    var n = {};
  276.    t.exports = {
  277.        get: function(e) {
  278.            return e = e.toLowerCase(), !n[e], n[e]
  279.        },
  280.        set: function(e, o) {
  281.            e = e.toLowerCase(), n[e] || (n[e] = o)
  282.        }
  283.    }
  284. });
  285. define("common:www/page/databind/databind.js", function(t, n, e) {
  286.    function a(t) {
  287.        for (var n, e, a, i = 0, r = []; n = t[i++];)
  288.            n = n.split(":"), e = n[0], a = n[1], a && e && r.push({
  289.                type: a,
  290.                name: e
  291.            });
  292.        return r.length ? r : null
  293.    }
  294.  
  295.    function i(t, n, e) {
  296.        var i, r, d, o, u, l, c = 0;
  297.        for (i = this.$el[0] == n ? this.$el : s(n), r = i.attr("data-bind"), d = a(r.split(";")); o = d[c++];)
  298.            u = o.type, l = o.name, p[u] && p[u].bind(this, l, i, this.$el, e && e[l])
  299.    }
  300.  
  301.    function r(t, n) {
  302.        return function() {
  303.            var e = Array.prototype.slice.call(arguments);
  304.            e.push(n), i.apply(t, e)
  305.        }
  306.    }
  307.  
  308.    function d(t, n) {
  309.        var e, a, i, d;
  310.        return e = s(t), i = s.extend({
  311.            $el: e,
  312.            __prop: {},
  313.            __preProp: {}
  314.        }, c), a = e.find("[data-bind]"), d = r(i, n), a.each(d), e.attr("data-bind") && d(0, e[0]), i
  315.    }
  316.  
  317.    function o(t) {
  318.        s.extend(p, t)
  319.    }
  320.    var s = t("jquery"),
  321.        u = t("common:www/page/events/events.js"),
  322.        l = "databound" + (~new Date).toString(16).substr(0, 5),
  323.        c = s.extend({
  324.            set: function(t, n, e) {
  325.                var a, i, r;
  326.                if (n != this.__prop[t]) {
  327.                    if ("object" == typeof n && "[object Array]" !== Object.prototype.toString.call(n)) {
  328.                        i = this.__prop[t], r = !1;
  329.                        for (a in n)
  330.                            if (n.hasOwnProperty(a) && (!i || !i[a] || n[a] != i[a])) {
  331.                                r = !0;
  332.                                break
  333.                            }
  334.                        if (!r)
  335.                            return
  336.                    }
  337.                    this.__preProp[t] = this.__prop[t], this.__prop[t] = n, e || this.dispatchEvent("set:" + t, {
  338.                        data: n,
  339.                        fromEle: e
  340.                    })
  341.                }
  342.            },
  343.            get: function(t) {
  344.                return this.__prop[t]
  345.            },
  346.            appendTo: function(t) {
  347.                this.$el.appendTo(t)
  348.            }
  349.        }, u),
  350.        p = {
  351.            style: {
  352.                handler: function(t) {
  353.                    return function(n) {
  354.                        t.css(n.data)
  355.                    }
  356.                },
  357.                bind: function(t, n, e, a, i) {
  358.                    var r = this.handler(e);
  359.                    i && (r.call(t, {
  360.                        data: i
  361.                    }), t.__prop[n] = i), t.addEventListener("set:" + n, r)
  362.                }
  363.            },
  364.            src: {
  365.                handler: function(t) {
  366.                    return function(n) {
  367.                        t[0].src = n.data
  368.                    }
  369.                },
  370.                bind: function(t, n, e, a, i) {
  371.                    var r = this.handler(e);
  372.                    i && (r.call(t, {
  373.                        data: i
  374.                    }), t.__prop[n] = i), t.addEventListener("set:" + n, r)
  375.                }
  376.            },
  377.            dualTxt: {
  378.                getHandler: function(t) {
  379.                    return function(n) {
  380.                        n.fromEle || t.val(n.data)
  381.                    }
  382.                },
  383.                setHandler: function(t, n) {
  384.                    function e() {
  385.                        t.set(n, t.__inputVal), t.__inputVal = "", t.__keyupTimer = null
  386.                    }
  387.                    return function(a) {
  388.                        t.__keyupTimer ? clearTimeout(t.__keyupTimer) : t.dispatchEvent("typing:" + n), t.__keyupTimer = setTimeout(e, 200), t.__inputVal = a.target.value
  389.                    }
  390.                },
  391.                bind: function(t, n, e, a, i) {
  392.                    var r = this.getHandler(e);
  393.                    t.addEventListener("set:" + n, r), e.bind("keyup", this.setHandler(t, n)), i && (r.call(t, {
  394.                        data: i
  395.                    }), t.__prop[n] = i)
  396.                }
  397.            },
  398.            txt: {
  399.                handler: function(t) {
  400.                    return function(n) {
  401.                        t.text(n.data)
  402.                    }
  403.                },
  404.                bind: function(t, n, e, a, i) {
  405.                    var r = this.handler(e);
  406.                    t.addEventListener("set:" + n, r), i && (r.call(t, {
  407.                        data: i
  408.                    }), t.__prop[n] = i)
  409.                }
  410.            },
  411.            cls: {
  412.                handler: function(t, n) {
  413.                    return function(e) {
  414.                        this.__preProp[t] && n.removeClass(this.__preProp[t]), n.addClass(e.data)
  415.                    }
  416.                },
  417.                bind: function(t, n, e, a, i) {
  418.                    var r = this.handler(n, e);
  419.                    t.addEventListener("set:" + n, r), i && (r.call(t, {
  420.                        data: i
  421.                    }), t.__prop[n] = i)
  422.                }
  423.            },
  424.            click: {
  425.                handler: function(t, n) {
  426.                    return function(e) {
  427.                        t.dispatchEvent("click:" + n, e)
  428.                    }
  429.                },
  430.                bind: function(t, n, e, a) {
  431.                    var i = this.handler(t, n);
  432.                    e.addClass(l + "-" + n), e == a ? a.bind("click", i) : a.delegate("." + l + "-" + n, "click", i)
  433.                }
  434.            },
  435.            mouseenter: {
  436.                handler: function(t, n) {
  437.                    return function(e) {
  438.                        t.dispatchEvent("mouseenter:" + n, e)
  439.                    }
  440.                },
  441.                bind: function(t, n, e, a) {
  442.                    var i = this.handler(t, n);
  443.                    e.addClass(l + "-" + n), e == a ? a.bind("mouseenter", i) : a.delegate("." + l + "-" + n, "mouseenter", i)
  444.                }
  445.            },
  446.            mouseleave: {
  447.                handler: function(t, n) {
  448.                    return function(e) {
  449.                        t.dispatchEvent("mouseleave:" + n, e)
  450.                    }
  451.                },
  452.                bind: function(t, n, e, a) {
  453.                    var i = this.handler(t, n);
  454.                    e.addClass(l + "-" + n), e == a ? a.bind("mouseleave", i) : a.delegate("." + l + "-" + n, "mouseleave", i)
  455.                }
  456.            },
  457.            link: {
  458.                handler: function(t) {
  459.                    return function(n) {
  460.                        t[0].href = n.data
  461.                    }
  462.                },
  463.                bind: function(t, n, e, a, i) {
  464.                    var r = this.handler(e);
  465.                    i && (r.call(t, {
  466.                        data: i
  467.                    }), t.__prop[n] = i), t.addEventListener("set:" + n, r)
  468.                }
  469.            },
  470.            attr: {
  471.                handler: function(t) {
  472.                    return function(n) {
  473.                        t.attr(n.data)
  474.                    }
  475.                },
  476.                bind: function(t, n, e, a, i) {
  477.                    var r = this.handler(e);
  478.                    i && (r.call(t, {
  479.                        data: i
  480.                    }), t.__prop[n] = i), t.addEventListener("set:" + n, r)
  481.                }
  482.            }
  483.        };
  484.    e.exports = {
  485.        bind: d,
  486.        mixinBoundMap: o
  487.    }
  488. });
  489. define("common:www/page/slider/slider.js", function(t, i, s) {
  490.    function n(t, i, s, n) {
  491.        var e = this;
  492.        this.$el = t, this.$cnt, this.$slideCnt, this.duration = n.duration, this.isCycle = n.isCycle,
  493.        this.curIdx = 0, this.slideWidth = this.$el.width(), this.slidesNum = i.length,
  494.        this.autoAnimateInterval = n.autoAnimateInterval || 5e3, this.autoTurning = s,
  495.        this._leftBtnClickHandler = function(t) {
  496.            t.preventDefault(), e.turnLeft()
  497.        }, this._rightBtnClickHandler = function(t) {
  498.            t.preventDefault(), e.turnRight()
  499.        }, this._animationFinish = function() {
  500.            e.isAnimating = !1
  501.        }, this._autoTurning = function() {
  502.            e._timer = null, e.turnRight(), e.startAutoAnimation()
  503.        }, this._mouseEnterHandler = function() {
  504.            e.stopAutoAnimation()
  505.        }, this._mouseLeaveHandler = function() {
  506.            e.startAutoAnimation()
  507.        }, this._dotClikeHandler = function (t) {
  508.            t.preventDefault(), e.dotMoveslide(this);
  509.        },
  510.        this.realIdx = 0, i.addClass("slide-show-ctn"), this._buildContainer(i), i = null,
  511.        s && this.startAutoAnimation()
  512.    }
  513.    var e = t("jquery"),
  514.        h = t("common:www/page/events/events.js");
  515.    e.extend(n.prototype, h, {
  516.        _buildContainer: function(t) {
  517.            this.$el.append('<div class="mod-slide-show"><div class="cnt"></div></div><div class="three_dot"><div class="dot_box"></div></div>'),
  518.            this.$cnt = this.$el.find("div.cnt"),
  519.            this.$dot = this.$el.find("div.dot_box");
  520.            this.$slideCnt = this.$el.find("div.mod-slide-show"),
  521.            this.$cnt.width(this.slideWidth * this.slidesNum),
  522.            this.autoTurning && (this.$el.bind("mouseenter", this._mouseEnterHandler),
  523.                this.$el.bind("mouseleave", this._mouseLeaveHandler)), t.appendTo(this.$cnt);
  524.            this._buildDot();
  525.        },
  526.        _buildDot: function () {
  527.            var i, cur = "cur", dotItem = "";
  528.            for (i = 0; i < this.slidesNum; i++) {
  529.                !~-i && (cur = "");
  530.                dotItem += '<a class="' + cur + '" href="###"></a>';
  531.            }
  532.            this.$dot.append(dotItem);
  533.            this.$dot.find("a").bind("click", this._dotClikeHandler);
  534.        },
  535.        dotMoveslide: function (cur) {
  536.            var cliDot = $(cur).index(),
  537.                oldDot = $(cur).filter(".cur").index();
  538.            cliDot !== oldDot && (cliDot > oldDot ? this.turnRight() : this.turnLeft());
  539.        },
  540.        _moveSlide: function(t, i) {
  541.            var s = {
  542.                first: "prepend",
  543.                last: "append"
  544.            };
  545.            this.$cnt[s[t]](i)
  546.        },
  547.        _moveFirstSlideToLast: function() {
  548.            this._moveSlide("last", this.$cnt.children(":first")),
  549.            this.curIdx--,
  550.            this.$slideCnt[0].scrollLeft = this.slideWidth * this.curIdx
  551.        },
  552.        _moveLastSlideToFirst: function() {
  553.            this._moveSlide("first", this.$cnt.children(":last")),
  554.            this.curIdx++,
  555.            this.$slideCnt[0].scrollLeft = this.slideWidth * this.curIdx
  556.        },
  557.        turnLeft: function() {
  558.            if (this.isAnimating)
  559.                return this;
  560.            if (0 == this.curIdx) {
  561.                if (!this.isCycle)
  562.                    return;
  563.                this._moveLastSlideToFirst()
  564.            }
  565.            return this._animate("left"), this.curIdx--, this.realIdx--,
  566.            this.realIdx < 0 && (this.realIdx = this.slidesNum - 1),
  567.            this.$dot.find("a").removeClass("cur").eq(this.realIdx).addClass("cur"),
  568.            this.dispatchEvent("slideMoved", {
  569.                realIdx: this.realIdx
  570.            }), this
  571.        },
  572.        turnRight: function() {
  573.            var t;
  574.            if (this.isAnimating)
  575.                return this;
  576.            if (this.curIdx == this.slidesNum - 1) {
  577.                if (!this.isCycle)
  578.                    return;
  579.                this._moveFirstSlideToLast()
  580.            }
  581.            return t = this._animate("right"), this.curIdx++, this.realIdx++,
  582.            this.realIdx >= this.slidesNum && (this.realIdx = 0),
  583.            this.$dot.find("a").removeClass("cur").eq(this.realIdx).addClass("cur"),
  584.            this.dispatchEvent("slideMoved", {
  585.                realIdx: this.realIdx
  586.            }), this
  587.        },
  588.        _animate: function(t) {
  589.            var i = {
  590.                left: "-=",
  591.                right: "+="
  592.            };
  593.            return this.isAnimating = !0, this.stopAutoAnimation(), this.$slideCnt.animate({
  594.                scrollLeft: i[t] + this.slideWidth
  595.            }, this.duration, this._animationFinish)
  596.        },
  597.        setBtns: function(t, i) {
  598.            t.bind("click", this._leftBtnClickHandler), i.bind("click", this._rightBtnClickHandler)
  599.        },
  600.        startAutoAnimation: function() {
  601.            this.autoTurning && (this._timer || (this._timer = setTimeout(this._autoTurning, this.autoAnimateInterval)))
  602.        },
  603.        stopAutoAnimation: function() {
  604.            this._timer && (clearTimeout(this._timer), this._timer = null)
  605.        },
  606.        updateContentWidth: function() {
  607.            return this.stopAutoAnimation(),
  608.            this.isAnimating ? (setTimeout(this.updateContentWidth.bind(this), this.duration), void 0) :
  609.                (this.slideWidth = this.$el.width(), this.$cnt.width(this.slideWidth * this.slidesNum), this.$slideCnt[0].scrollLeft = this.curIdx * this.slideWidth, this.startAutoAnimation(), void 0)
  610.        }
  611.    }), s.exports = {
  612.        init: function(t, i, s) {
  613.            var h, d, l, r, o = e(t),
  614.                a = e(i),
  615.                u = {
  616.                    leftBtnSel: ".slide-left-btn",
  617.                    rightBtnSel: ".slide-right-btn",
  618.                    autoAnimate: !0,
  619.                    duration: 800,
  620.                    isCycle: !0
  621.                };
  622.            return !o.length || a.length <= 1 ? (r = new Function, {
  623.                updateContentWidth: r,
  624.                stopAutoAnimation: r,
  625.                startAutoAnimation: r,
  626.                setBtns: r,
  627.                turnRight: r,
  628.                turnLeft: r,
  629.                addEventListener: r,
  630.                removeEventListener: r
  631.            }) : (e.extend(u, s), h = e(u.leftBtnSel), d = e(u.rightBtnSel),
  632.                l = new n(o, a, u.autoAnimate, {
  633.                    duration: u.duration,
  634.                    isCycle: u.isCycle
  635.                }), h.length && d.length && l.setBtns(h, d), l)
  636.        }
  637.    }
  638. });
  639. define("common:www/page/utils/scroller.js", function(i) {
  640.    var t = i("jquery"),
  641.        n = i("common:www/page/events/events.js"),
  642.        s = {
  643.            _timer: null,
  644.            _isInit: !1,
  645.            _lastNotifyTime: -1,
  646.            _lastCheckTime: -1,
  647.            _scrollTop: 0,
  648.            _isRunning: !1,
  649.            tick: 0,
  650.            duration: 0,
  651.            init: function(i) {
  652.                var n = t.extend({
  653.                    tick: 200,
  654.                    duration: 400
  655.                }, i);
  656.                return this._isInit ? this : (this.tick = n.tick, this.duration = n.duration, this._isInit = !0, this)
  657.            },
  658.            isInited: function() {
  659.                return this._isInit
  660.            },
  661.            start: function() {
  662.                this._isRunning || (t(window).bind("scroll", this.scrolling), this._isRunning = !0)
  663.            },
  664.            stop: function() {
  665.                t(window).unbind("scroll", this.scrolling), this._isRunning = !1
  666.            },
  667.            scrolling: function() {
  668.                var i = new Date;
  669.                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)
  670.            },
  671.            scrollFinished: function() {
  672.                s.notifyScrolling(), s.emit("scrollEnd"), s._lastNotifyTime = -1, s._timer = null
  673.            },
  674.            notifyScrolling: function(i) {
  675.                this.emit("scrolling"), this._lastNotifyTime = i
  676.            },
  677.            emit: function(i) {
  678.                var n = t(window).scrollTop();
  679.                this.dispatchEvent(i, {
  680.                    scrollTop: n,
  681.                    scrollingDown: n > this._scrollTop
  682.                }), this._scrollTop = n
  683.            }
  684.        };
  685.    return t.extend(s, n), s
  686. });
  687. define("common:www/page/utils/pageresizer.js", function(i) {
  688.    var t = i("jquery"),
  689.        n = i("common:www/page/events/events.js"),
  690.        browser = i("common:www/page/jquery/browser.js"),
  691.        e = {
  692.            _timer: null,
  693.            _isInit: !1,
  694.            _isRunning: !1,
  695.            _lastNotifyTime: -1,
  696.            tick: 200,
  697.            duration: 400,
  698.            curWidth: -1,
  699.            curHeight: -1,
  700.            init: function(i) {
  701.                var n = t.extend({
  702.                    tick: 200,
  703.                    duration: 400
  704.                }, i);
  705.                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)
  706.            },
  707.            isInited: function() {
  708.                return this._isInit
  709.            },
  710.            start: function() {
  711.                this._isRunning || (t(window).bind("resize", this.resizing), this._isRunning = !0)
  712.            },
  713.            stop: function() {
  714.                t(window).unbind("resize", this.resizing), this._isRunning = !1
  715.            },
  716.            resizingIE7: function() {
  717.                var i = t(window).width(),
  718.                    n = t(window).height();
  719.                (e.curWidth != i || e.curHeight != n) && (e.curWidth = i, e.curHeight = n, e._resizeing())
  720.            },
  721.            resizing: function() {
  722.                var i = new Date;
  723.                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)
  724.            },
  725.            resizeFinished: function() {
  726.                e.notifyReszing(), e.dispatchEvent("resizeEnd"), e._lastNotifyTime = -1, e._timer = null
  727.            },
  728.            notifyReszing: function(i) {
  729.                this._lastNotifyTime = i, this.dispatchEvent("resizing")
  730.            }
  731.        };
  732.    return t.extend(e, n), e
  733. });
  734. define("common:www/page/zoomdetector/detector.js", function(b) {
  735.    var a = b("jquery"), c = (b("common:www/page/events/events.js"), function() {
  736.        var k = !0, h = function() {
  737.            return Math.round(screen.deviceXDPI / screen.logicalXDPI * 100) / 100
  738.        }, f = function() {
  739.            return Math.round(document.documentElement.offsetHeight / window.innerHeight * 100) / 100
  740.        }, g = function() {
  741.            var d = window.top.outerWidth / window.top.innerWidth;
  742.            return Math.round(100 * d) / 100
  743.        }, j = function() {
  744.            var d = null, i = null;
  745.            return function(n) {
  746.                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("");
  747.                if (i && d) {
  748.                    d.text(e), s = "underline" == i.css("text-decoration")
  749.                } else {
  750.                    try {
  751.                        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")
  752.                    } catch (t) {
  753.                    }
  754.                }
  755.                return s
  756.            }
  757.        }(), m = function() {
  758.            var i = 0.01, d = function(u, e, s) {
  759.                var t = (u + e) / 2;
  760.                return 0 >= s || i > e - u ? t : j(t) ? d(t, e, s - 1) : d(u, t, s - 1)
  761.            };
  762.            return d(0, 5, 10)
  763.        }, p = {detected: !1,retina: !1}, l = function() {
  764.            return p.detected ? p.retina : (p = {detected: !0,retina: j(2)}, p.retina)
  765.        }, q = function() {
  766.            var e = 1, d = navigator.userAgent.toLowerCase();
  767.            return isNaN(screen.logicalXDPI) || isNaN(screen.systemXDPI) ? window.navigator.msMaxTouchPoints ? function() {
  768.                return e = f()
  769.            } : /BIDUBrowser/i.test(d) ? function() {
  770.                return k = !1, e
  771.            } : /webkit/i.test(d) || /opera/i.test(d) ? function() {
  772.                return e = g()
  773.            } : /firefox/i.test(d) ? function() {
  774.                return l() ? (e = 1, k = !1) : e = m(), e
  775.            } : parseInt(window.top.outerWidth, 10) ? function() {
  776.                return e = g()
  777.            } : function() {
  778.                return k = !1, e
  779.            } : function() {
  780.                return e = h()
  781.            }
  782.        }();
  783.        return q(), {support: function() {
  784.                return k
  785.            },detect: q}
  786.    }());
  787.    return {detect: function() {
  788.            var d = 1;
  789.            return c.support() && (d = c.detect(), d > 0.95 && 1.05 > d && (d = 1)), d
  790.        }}
  791. });
  792. //javascript/9026

回复 "common js文件,处理公共效果"

这儿你可以回复上面这条便签

captcha