/* * NTES Gallery v3.0.1 * include: jquery.tinyscrollbar.js | spin.js | script.js(gallery main script) * Compressed by uglifyjs 2.2.1 * Author: YanWJ */ (function(a) { function b(b, c) { function r() { return d.update(), t(), d } function s() { var a = m.toLowerCase(); j.obj.css(l, n / h.ratio), g.obj.css(l, -n), p.start = j.obj.offset()[l], h.obj.css(a, i[c.axis]), i.obj.css(a, i[c.axis]), j.obj.css(a, j[c.axis]) } function t() { q ? f.obj[0].ontouchstart = function(a) { 1 === a.touches.length && (u(a.touches[0]), a.stopPropagation()) }: (j.obj.bind("mousedown", u), i.obj.bind("mouseup", w)), c.scroll && window.addEventListener ? (e[0].addEventListener("DOMMouseScroll", v, !1), e[0].addEventListener("mousewheel", v, !1)) : c.scroll && (e[0].onmousewheel = v) } function u(b) { a("body").addClass("noSelect"); var c = parseInt(j.obj.css(l), 10); p.start = k ? b.pageX: b.pageY, o.start = "auto" == c ? 0 : c, q ? (document.ontouchmove = function(a) { a.preventDefault(), w(a.touches[0]) }, document.ontouchend = x) : (a(document).bind("mousemove", w), a(document).bind("mouseup", x), j.obj.bind("mouseup", x)) } function v(b) { if (1 > g.ratio) { var d = b || window.event, e = d.wheelDelta ? d.wheelDelta / 120 : -d.detail / 3; n -= e * c.wheel, n = Math.min(g[c.axis] - f[c.axis], Math.max(0, n)), j.obj.css(l, n / h.ratio), g.obj.css(l, -n), (c.lockscroll || n !== g[c.axis] - f[c.axis] && 0 !== n) && (d = a.event.fix(d), d.preventDefault()) } } function w(a) { 1 > g.ratio && (o.now = c.invertscroll && q ? Math.min(i[c.axis] - j[c.axis], Math.max(0, o.start + (p.start - (k ? a.pageX: a.pageY)))) : Math.min(i[c.axis] - j[c.axis], Math.max(0, o.start + ((k ? a.pageX: a.pageY) - p.start))), n = o.now * h.ratio, g.obj.css(l, -n), j.obj.css(l, o.now)) } function x() { a("body").removeClass("noSelect"), a(document).unbind("mousemove", w), a(document).unbind("mouseup", x), j.obj.unbind("mouseup", x), document.ontouchmove = document.ontouchend = null } var d = this, e = b, f = { obj: a(".viewport", b) }, g = { obj: a(".overview", b) }, h = { obj: a(".scrollbar", b) }, i = { obj: a(".track", h.obj) }, j = { obj: a(".thumb", h.obj) }, k = "x" === c.axis, l = k ? "left": "top", m = k ? "Width": "Height", n = 0, o = { start: 0, now: 0 }, p = {}, q = "ontouchstart" in document.documentElement; return this.update = function(a) { f[c.axis] = f.obj[0]["offset" + m], g[c.axis] = g.obj[0]["scroll" + m], g.ratio = f[c.axis] / g[c.axis], h.obj.toggleClass("disable", g.ratio >= 1), i[c.axis] = "auto" === c.size ? f[c.axis] : c.size, j[c.axis] = Math.min(i[c.axis], Math.max(0, "auto" === c.sizethumb ? i[c.axis] * g.ratio: c.sizethumb)), h.ratio = "auto" === c.sizethumb ? g[c.axis] / i[c.axis] : (g[c.axis] - f[c.axis]) / (i[c.axis] - j[c.axis]), n = "relative" === a && 1 >= g.ratio ? Math.min(g[c.axis] - f[c.axis], Math.max(0, n)) : 0, n = "bottom" === a && 1 >= g.ratio ? g[c.axis] - f[c.axis] : isNaN(parseInt(a, 10)) ? n: parseInt(a, 10), s() }, r() } a.tiny = a.tiny || {}, a.tiny.scrollbar = { options: { axis: "y", wheel: 40, scroll: !0, lockscroll: !0, size: "auto", sizethumb: "auto", invertscroll: !1 } }, a.fn.tinyscrollbar = function(c) { var d = a.extend({}, a.tiny.scrollbar.options, c); return this.each(function() { a(this).data("tsb", new b(a(this), d)) }), this }, a.fn.tinyscrollbar_update = function(b) { return a(this).data("tsb").update(b) } })(jQuery); ! function(a, b, c) { function g(a, c) { var e, d = b.createElement(a || "div"); for (e in c) d[e] = c[e]; return d } function h(a) { for (var b = 1, c = arguments.length; c > b; b++) a.appendChild(arguments[b]); return a } function j(a, b, c, d) { var g = ["opacity", b, ~~ (100 * a), c, d].join("-"), h = .01 + 100 * (c / d), j = Math.max(1 - (1 - a) / b * (100 - h), a), k = f.substring(0, f.indexOf("Animation")).toLowerCase(), l = k && "-" + k + "-" || ""; return e[g] || (i.insertRule("@" + l + "keyframes " + g + "{" + "0%{opacity:" + j + "}" + h + "%{opacity:" + a + "}" + (h + .01) + "%{opacity:1}" + (h + b) % 100 + "%{opacity:" + a + "}" + "100%{opacity:" + j + "}" + "}", i.cssRules.length), e[g] = 1), g } function k(a, b) { var f, g, e = a.style; if (e[b] !== c) return b; for (b = b.charAt(0).toUpperCase() + b.slice(1), g = 0; d.length > g; g++) if (f = d[g] + b, e[f] !== c) return f } function l(a, b) { for (var c in b) a.style[k(a, c) || c] = b[c]; return a } function m(a) { for (var b = 1; arguments.length > b; b++) { var d = arguments[b]; for (var e in d) a[e] === c && (a[e] = d[e]) } return a } function n(a) { for (var b = { x: a.offsetLeft, y: a.offsetTop }; a = a.offsetParent;) b.x += a.offsetLeft, b.y += a.offsetTop; return b } var f, d = ["webkit", "Moz", "ms", "O"], e = {}, i = function() { var a = g("style", { type: "text/css" }); return h(b.getElementsByTagName("head")[0], a), a.sheet || a.styleSheet } (), o = { lines: 12, length: 7, width: 5, radius: 10, rotate: 0, corners: 1, color: "#000", speed: 1, trail: 100, opacity: .25, fps: 20, zIndex: 2e9, className: "spinner", top: "auto", left: "auto", position: "relative" }, p = function p(a) { return this.spin ? (this.opts = m(a || {}, p.defaults, o), c) : new p(a) }; p.defaults = {}, m(p.prototype, { spin: function(a) { this.stop(); var h, i, b = this, c = b.opts, d = b.el = l(g(0, { className: c.className }), { position: c.position, width: 0, zIndex: c.zIndex }), e = c.radius + c.length + c.width; if (a && (a.insertBefore(d, a.firstChild || null), i = n(a), h = n(d), l(d, { left: ("auto" == c.left ? i.x - h.x + (a.offsetWidth >> 1) : parseInt(c.left, 10) + e) + "px", top: ("auto" == c.top ? i.y - h.y + (a.offsetHeight >> 1) : parseInt(c.top, 10) + e) + "px" })), d.setAttribute("aria-role", "progressbar"), b.lines(d, b.opts), !f) { var j = 0, k = c.fps, m = k / c.speed, o = (1 - c.opacity) / (m * c.trail / 100), p = m / c.lines; (function q() { j++; for (var a = c.lines; a; a--) { var e = Math.max(1 - (j + a * p) % m * o, c.opacity); b.opacity(d, c.lines - a, e, c) } b.timeout = b.el && setTimeout(q, ~~ (1e3 / k)) })() } return b }, stop: function() { var a = this.el; return a && (clearTimeout(this.timeout), a.parentNode && a.parentNode.removeChild(a), this.el = c), this }, lines: function(a, b) { function e(a, d) { return l(g(), { position: "absolute", width: b.length + b.width + "px", height: b.width + "px", background: a, boxShadow: d, transformOrigin: "left", transform: "rotate(" + ~~ (360 / b.lines * c + b.rotate) + "deg) translate(" + b.radius + "px" + ",0)", borderRadius: (b.corners * b.width >> 1) + "px" }) } for (var d, c = 0; b.lines > c; c++) d = l(g(), { position: "absolute", top: 1 + ~ (b.width / 2) + "px", transform: b.hwaccel ? "translate3d(0,0,0)": "", opacity: b.opacity, animation: f && j(b.opacity, b.trail, c, b.lines) + " " + 1 / b.speed + "s linear infinite" }), b.shadow && h(d, l(e("#000", "0 0 4px #000"), { top: "2px" })), h(a, h(d, e(b.color, "0 0 1px rgba(0,0,0,.1)"))); return a }, opacity: function(a, b, c) { a.childNodes.length > b && (a.childNodes[b].style.opacity = c) } }), function() { function a(a, b) { return g("<" + a + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', b) } var b = l(g("group"), { behavior: "url(#default#VML)" }); ! k(b, "transform") && b.adj ? (i.addRule(".spin-vml", "behavior:url(#default#VML)"), p.prototype.lines = function(b, c) { function f() { return l(a("group", { coordsize: e + " " + e, coordorigin: -d + " " + -d }), { width: e, height: e }) } function k(b, e, g) { h(i, h(l(f(), { rotation: 360 / c.lines * b + "deg", left: ~~e }), h(l(a("roundrect", { arcsize: c.corners }), { width: d, height: c.width, left: c.radius, top: -c.width >> 1, filter: g }), a("fill", { color: c.color, opacity: c.opacity }), a("stroke", { opacity: 0 })))) } var j, d = c.length + c.width, e = 2 * d, g = 2 * -(c.width + c.length) + "px", i = l(f(), { position: "absolute", top: g, left: g }); if (c.shadow) for (j = 1; c.lines >= j; j++) k(j, -2, "progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)"); for (j = 1; c.lines >= j; j++) k(j); return h(b, i) }, p.prototype.opacity = function(a, b, c, d) { var e = a.firstChild; d = d.shadow && d.lines || 0, e && e.childNodes.length > b + d && (e = e.childNodes[b + d], e = e && e.firstChild, e = e && e.firstChild, e && (e.opacity = c)) }) : f = k(b, "animation") } (), "function" == typeof define && define.amd ? define(function() { return p }) : a.Spinner = p } (window, document); (function(a, b, c, d) { function g(a, b, c) { var a = parseInt(a, 10) || 0, b = parseInt(b, 10) || 0, d = parseInt(c, 10) || 8; if (1 > b || 1 > a || a > b) return ! 1; var e = [], f = "", g = d - 4, h = d - 2, i = Math.ceil(g / 2) - 1, j = g - (i + 1); if (d >= b) for (var k = 1; b >= k; k += 1) e.push(k); else if (g >= a) { for (var k = 1; h >= k; k += 1) e.push(k); e.push("...", b) } else if (a >= b - g) { e.push(1, "..."); for (var k = b - h + 1; b >= k; k += 1) e.push(k) } else { e.push(1, "..."); for (var k = a - i; a + j >= k; k += 1) e.push(k); e.push("...", b) } for (var k = 0; e.length > k; k += 1) f += "..." != e[k] ? e[k] == a ? '
'+$.ajax({url: "/cms/web/hdrl/praise.jsp?cmd=init&ID="+c.id, async: false }).responseText+'
'; f.el.$picinfoText.html(j), f._picinfoScrollUpdate(), f.el.$loader.hide(); var k = m.isMobileDevice ? 0 : 500; h.front.fadeOut(k, function() { a(this).css("zIndex", 8) }), h.behind.hide().fadeIn(k, function() { a(this).css("zIndex", 9) }), f._updateThumbPaging(c.index + 1), f._updateProgress(c.index + 1), f._setPhotoIdToHash(c.id), e || f._sendStatistics(), f.el.$top.find(".vieworigin").attr("href", c.oimg), f.smartPreload(c.index), f.cache.currPhoto = c }) }, f.prototype.smartPreload = function(b, c, e) { this.cache.preload === d && (this.cache.preload = []); for (var c = c || 0, e = e || 2, f = [], g = this.data.list, h = g.length, i = b - c; b + e >= i; i += 1) 0 > i || i > h - 1 || -1 != a.inArray(this._getPhotoUrl(i), this.cache.preload) || f.push(this._getPhotoUrl(i)); for (var i = 0; f.length > i; i += 1) n(f[i]), this.cache.preload.push(f[i]) }, f.prototype.resetViewSize = function(c) { var d = this.el.$main, e = 2, f = { width: a(b).width(), height: a(b).height() + this.el.$root.offset().top - d.offset().top - 10 }, g = parseInt(d.css("padding-right"), 10) + parseInt(d.css("padding-left"), 10), h = 1760, i = 1500, j = Math.floor(h / e), k = Math.floor(i / e), l = this._maxPicSize(), m = l.width + g + 20 < f.width ? l.width + g + 20 : f.width, n = l.height + 20 < f.height ? l.height + 20 : f.height; m = "wide" == this.el.$main.data("viewmode") ? f.width: m, m = i >= m ? i: m > h ? h: m, n = k >= n ? k: n > j ? j: n; var o = { width: m - g - 2, height: n }; d.animate(o, 253, function() { c && "function" == typeof c && c() }), this.el.$sidebar.css("height", o.height), this._resetPhotoWrapSize(null, o), this._picinfoScrollUpdate(o) }, f.prototype._resetPhotoWrapSize = function(b, c) { var d = b ? a(b) : this._getPhotoTurn().front, e = d.data("size"); if (!e) return ! 1; var k, l, f = e.width, g = e.height, h = (c ? c.width: this.el.$photoArea.width()) - 10, i = (c ? c.height: this.el.$photoArea.height()) - 10, j = { img: f / g, wrap: h / i }; h >= f && i >= g ? (k = f, l = g) : j.img >= j.wrap ? (k = h, l = Math.round(k / j.img)) : j.img < j.wrap && (l = i, k = Math.round(l * j.img)); var m = { width: k, height: l, top: "50%", marginTop: 0 - Math.round(l / 2), left: "50%", marginLeft: 0 - Math.round(k / 2) }; b ? d.css(m) : d.animate(m, 250) }, f.prototype._initEndpage = function() { var d = this.el.$endpage; if (d.data("initialized")) return ! 1; var e = this; if (6 == m.IEversion || 535 > m.webkitVersion) { var f = function() { d.height(e.el.$root.height()) }; f(), a(b).on("resize", function() { var a = 453; setTimeout(f, a) }) } d.find(".replay").click(function(a) { a.preventDefault(), e.closeEndpage(), e._getPhotoTurn().front.empty(), -1 == location.hash.indexOf("from=tj_review") && (location.hash += "&from=tj_review"), e.show(0) }); var g = c.getElementById("htpGG"); g && !m.isMobileDevice && (d.find(".endpage-btm").addClass("endpage-btm-ad"), d.find(".endpage-btm-right").empty().append(g).insertBefore(".endpage-btm-left"), g.style.display = "block"); for (var k, h = d.find(".endpage-related-tab"), i = d.find(".endpage-related"), j = [], l = i.parent().width(), n = Math.ceil(i.width() / l), o = 0, p = null, q = 5e3, r = function(b) { i.css("margin-left", 0 - l * b), o = b, a.each(j, function(a, c) { c.data("tabIndex") == b ? c.removeClass("bg-gray").addClass("bg-red") : c.removeClass("bg-red").addClass("bg-gray") }) }, s = 0; n > s; s += 1) k = 0 == s ? a('') : a(''), k.data("tabIndex", s), k.on("mouseenter click", function() { var b = a(this).data("tabIndex"); r(b) }), h.append(k), j.push(k); h.css("padding-left", (h.parent().width() - 16 * n) / 2); var t = function(a) { clearInterval(p), p = setInterval(function() { var a = o == n - 1 ? 0 : o + 1; r(a) }, a) }; t(q), i.parent().hover(function() { clearInterval(p) }, function() { t(q) }), d.data("initialized", !0) }, f.prototype.openEndpage = function() { this._initEndpage(); var c = this.el.$endpage; if (c.fadeIn("fast"), this.el.$main.css("visibility", "hidden"), 9 > m.IEversion) { var d = a(b).width(), e = c.find(".prevset .parea, .nextset .parea"); e && 1420 > d && e.remove(); var f = c.find(".prevset .tiptext, .nextset .tiptext"); f && 1050 > d && f.remove() } this.cache.endpageOpened = !0, this._toggleDuilianAd("hide") }, f.prototype.closeEndpage = function() { this.el.$endpage.hide(), this.el.$main.css("visibility", "visible"), this.cache.endpageOpened = !1, this._toggleDuilianAd("show") }; var m = function() { function a() { var b, e, a = c.createElement("div"), f = ["ms", "O", "Webkit", "Moz"]; for (b in f) if (a.style[f[b] + "Transition"] !== d) { e = f[b]; break } try { delete a } catch(g) { a = null } return e ? e.toLowerCase() : !1 } function e() { for (var a, b = 3, d = c.createElement("div"), e = d.getElementsByTagName("i"); d.innerHTML = "", e[0];); return b > 4 ? b: a } function f() { return ! - [1] && !b.XMLHttpRequest } function g() { var a = /AppleWebKit\/([\d.]+)/.exec(navigator.userAgent); return a ? parseFloat(a[1]) : 0 } function h() { return /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) } return { cssTransitions: a(), IEversion: e(), isIE6: f(), webkitVersion: g(), isMobileDevice: h() } } (), n = function() { var a = [], b = null, c = function() { for (var b = 0; a.length > b; b++) a[b].end ? a.splice(b--, 1) : a[b](); ! a.length && e() }, e = function() { clearInterval(b), b = null }; return function(e, f, g, h) { var i, j, k, l, m, n = new Image; return n.src = e, n.complete ? (f && f.call(n), g && g.call(n), d) : (j = n.width, k = n.height, n.onerror = function() { h && h.call(n), i.end = !0, n = n.onload = n.onerror = null }, i = function() { l = n.width, m = n.height, (l !== j || m !== k || l * m > 1024) && (f && f.call(n), i.end = !0) }, i(), n.onload = function() { ! i.end && i(), g && g.call(n), n = n.onload = n.onerror = null }, i.end || (a.push(i), null === b && (b = setInterval(c, 40))), d) } } (); jQuery.extend(jQuery.easing, { easeOutCubic: function(a, b, c, d, e) { return d * ((b = b / e - 1) * b * b + 1) + c } }); try { b.NTESgallery = new f } catch(o) { throw Error(o) } })(jQuery, window, document);