c4a00aef3453592ec25349416129d3522c8bcfaf.svn-base 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. "use strict";
  2. var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  3. var _typeof = "function" == typeof Symbol && "symbol" == _typeof2(Symbol.iterator) ? function (t) {
  4. return typeof t === "undefined" ? "undefined" : _typeof2(t);
  5. } : function (t) {
  6. return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t === "undefined" ? "undefined" : _typeof2(t);
  7. };!function (t, n, e) {
  8. n.yunu = { init: function init() {
  9. return (arguments[0] ? arguments[0] : {}).imgAuto && t("img").each(function () {
  10. var n = t(this);n.attr("img-Auto") && ("cover" == n.attr("img-Auto") ? n.imgAuto("cover") : n.imgAuto());
  11. }), t("body").fadeTo("fast", 1), this;
  12. }, rem: function rem(e) {
  13. return e = e || 640, t(n).width() > 1024 ? t("html").css("font-size", 320) : t("html").css("font-size", t(n).width() / e * 100), this;
  14. }, nav: function nav() {
  15. var n = t("#nav"),
  16. e = t("#nav>ul>li>a");return t("#menu").click(function () {
  17. n.addClass("in");
  18. }), n.click(function () {
  19. n.removeClass("in");
  20. }), t("#nav>ul").click(function (t) {
  21. t.stopPropagation();
  22. }), e.each(function () {
  23. var n = t(this);n.next("ul").children().length && n.prop("href", "javascript:;").append('<i class="fa fa-angle-down"></i>');
  24. }).click(function (n) {
  25. var i = t(this),
  26. o = e.filter(function (n) {
  27. return t(this).hasClass("in");
  28. }),
  29. a = function a(t, n) {
  30. "down" == n ? t.addClass("in").next("ul").slideDown("fast") : t.removeClass("in").next("ul").slideUp("fast");
  31. };o === i ? a(i, "up") : (a(i, "down"), a(o, "up"));
  32. }), this;
  33. }, letter: function letter(t) {
  34. if ("function" == typeof arguments[0]) {
  35. t();var n = "number" != typeof arguments[1] ? 300 : arguments[1],
  36. e = null,
  37. i = new Date().getTime();return function () {
  38. var o = new Date().getTime();o - i < n ? (clearTimeout(e), e = setTimeout(function () {
  39. t();
  40. }, n)) : (clearTimeout(e), i = o, t());
  41. };
  42. }
  43. }, css3: function () {
  44. var t = document.createElement("div"),
  45. n = "Ms O Moz Webkit".split(" ");return function (e) {
  46. var i = n.length;if ("string" != typeof e) return !1;if (e in t.style) return !0;for (e = e.replace(/^[a-z]/, function (t) {
  47. return t.toUpperCase();
  48. }); i--;) {
  49. if (n[i] + e in t.style) return !0;
  50. }return !1;
  51. };
  52. }(), css3_3d: function css3_3d() {
  53. var t = document.documentElement,
  54. n = yunu.css3("perspective"),
  55. e = document.body;if (n && "webkitPerspective" in t.style) {
  56. var i = document.createElement("style");i.type = "text/css", i.innerHTML = "@media (transform-3d),(-webkit-transform-3d){#css3_3d_test{left:9px;position:absolute;height:3px;}}", e.appendChild(i);var o = document.createElement("div");o.id = "css3_3d_test", e.appendChild(o), n = 9 === o.offsetLeft && 3 === o.offsetHeight;
  57. }return yunu.css3_3d = function () {
  58. return n;
  59. }, n;
  60. }, lazyLoad: function lazyLoad(e, i) {
  61. return e.each(function (o) {
  62. var a = t(this);return void 0 === a.attr("data-src") && void 0 === i ? (yunu.lazyLoad(e.not(a)), !1) : (a.show = function () {
  63. if (!(t(n).height() + t(n).scrollTop() > a.offset().top - (parseInt(a.css("top")) || 0))) return !1;"function" == typeof i ? i.call(a) : i ? a.animate({ top: 0, left: 0 }, parseInt(a.attr("timer")) || 2e3, function () {}) : a.attr("src", a.attr("data-src")).removeAttr("data-src"), t(n).unbind("scroll", a.show);
  64. }, !1 !== a.show() ? (setTimeout(function () {
  65. yunu.lazyLoad(e.not(a));
  66. }), !1) : void t(n).bind("scroll", a.show));
  67. }), this;
  68. }, loadMore: function loadMore() {
  69. var n = arguments.length > 0 && arguments[0] !== e ? arguments[0] : {},
  70. i = function i() {
  71. t.ajax({ url: n.url, type: n.type, data: n.data, dataType: "jsonp", beforeSend: function beforeSend(t) {
  72. n.beforeSend(t), n.btn.attr("disabled", !0);
  73. } }).done(function (t, e, i) {
  74. n.done(t, e, i), t.data.length < n.data.limit && n.btn.replaceWith(n.load_more_none);
  75. }).fail(function (t, e, i) {
  76. n.fail(t, e, i);
  77. }).always(function (t, e, i) {
  78. n.always(t, e, i), n.key = !0, n.btn.attr("disabled", !1);
  79. });
  80. };(n = t.extend(!0, { key: !0, url: "", type: "POST", btn: t("#load_more_btn"), box: t("#list>ul"), data: { pages: 1, limit: 5 }, beforeSend: function beforeSend() {}, done: function done() {}, fail: function fail() {}, always: function always() {}, load_icon: !0, load_icon_class: "", loading: t('<div class="la-ball-fall"><div></div><div></div><div></div><div></div></div>'), load_more_none: t('<p class="load_more_none tac c_red mt20">没有了</p>') }, n)).load_icon && (t(n.loading).addClass(n.load_icon_class), n.btn.after(n.loading)), n.btn.click(function () {
  81. n.key && (n.key = !1, n.data.pages++, i());
  82. });
  83. }, tab: function tab(n, e, i) {
  84. var n = t(n),
  85. e = t(e),
  86. o = function o(_o) {
  87. var a = t(_o).data("i");n.removeClass("active").eq(a).addClass("active"), e.hide().eq(a).stop(!0, !0).fadeTo(0, .5).fadeTo("fast", 1), i && i(_o);
  88. };return n.each(function (t) {
  89. n.eq(t).data("i", t);
  90. }).click(function () {
  91. o(this);
  92. }), o(n.first()), this;
  93. }, scrollTop: function scrollTop() {
  94. var e, i, o, a, s, r, c;return i = "number" != typeof arguments[1] ? 150 : arguments[1], "object" == _typeof(arguments[0]) ? "box" == arguments[2] ? (o = a = arguments[0], s = e = t("a[href='#top']"), r = yunu.letter(function () {
  95. a.scrollTop() > i ? e.fadeIn() : e.fadeOut("fast");
  96. })) : (o = t("html,body"), a = t(n), s = arguments[0], e = s.find("a[href='#top']"), r = yunu.letter(function () {
  97. c = (a.height() - s.height()) / 2, s.animate({ top: c + a.scrollTop() }), a.scrollTop() + c > i && s.is(":hidden") && s.stop(!0, !0).fadeIn(), a.scrollTop() + c < i && !s.is(":hidden") && s.stop(!0).fadeOut("fast");
  98. })) : (o = t("html,body"), a = t(n), s = e = t("a[href='#top']"), r = yunu.letter(function () {
  99. a.scrollTop() > i ? e.fadeIn() : e.fadeOut("fast");
  100. })), e.click(function () {
  101. event.stopPropagation(), event.preventDefault(), o.animate({ scrollTop: 0 }), s.fadeOut();
  102. }), a.scroll(r), this;
  103. } }, t.fn.roll = function () {
  104. var e = this,
  105. i = arguments[0] ? arguments[0] : {};"number" != typeof i.num && (i.num = 1), "number" != typeof i.timer && (i.timer = 6e3), "number" != typeof i.speed && (i.speed = 400), "string" != typeof i.easing && (i.easing = "swing"), "string" != typeof i.timing && (i.timing = "ease-out"), void 0 === i.adaptive && (i.adaptive = !0), void 0 === i.center && (i.center = !0);var o,
  106. a,
  107. s,
  108. r,
  109. c,
  110. l,
  111. u,
  112. d,
  113. f = e.find("ul"),
  114. h = f.find("li"),
  115. p = h.length,
  116. m = h.outerWidth(!0),
  117. v = i.lbtn || e.find(".btn_l"),
  118. g = i.rbtn || e.find(".btn_r"),
  119. y = e.find(".banner_btn").find("a"),
  120. b = -p,
  121. w = null,
  122. _ = !1,
  123. T = !1,
  124. x = 0,
  125. k = 0,
  126. C = 0,
  127. A = 0,
  128. z = yunu.css3_3d(),
  129. I = function I() {
  130. return "translate3d(" + m * b + "px, 0px, 0px)";
  131. },
  132. S = function S() {
  133. return m * b;
  134. };if (e.roll_stop = function () {
  135. clearInterval(w);
  136. }, e.roll_start = function (t) {
  137. t && (_ = !1), clearInterval(w), w = setInterval(function () {
  138. o("-");
  139. }, i.timer);
  140. }, f.html(f.html() + f.html() + f.html()), h = f.find("li"), p = h.length, e.css({ position: "relative", overflow: "hidden", margin: "0 auto", width: i.width ? i.width : i.banner ? "100%" : i.num * m }), h.css({ width: i.banner ? m : h.width(), height: "auto", float: "left", position: "relative", overflow: "hidden" }), f.css({ width: p * m, height: "auto" }), i.height && e.height(i.height), i.btn) {
  141. a = t('<div class="banner_btn"></div>'), s = t("<span></span>");for (var D = 0; D < p / 3; D++) {
  142. s.append('<a href="javascript:;"></a>');
  143. }(y = s.find("a")).first().addClass("in"), a.append(s), e.append(a), "all" == i.btn && (e.append('<div class="banner_l"></div><div class="banner_r"></div>'), v = e.find(".banner_l"), g = e.find(".banner_r"));
  144. }return r = y.add(v).add(g), i.banner ? (u = t("div.center:first"), (d = function d() {
  145. c = e.width(), l = u.width(), m = i.adaptive ? c : c > l ? c : l, h.width(m), f.width(p * m), z ? f.css({ transform: I(), transition: "transform 0ms" }) : f.css({ left: S() });
  146. })(), t(n).resize(function () {
  147. d();
  148. })) : r.add(h), z ? f.css({ transform: I() }).on("webkitTransitionEnd", function () {
  149. _ && (b >= 0 && (b = -p / 3, f.css({ transform: I(), transition: "transform 0ms" })), b <= -(p - i.num) && (b = -(2 * p / 3 - i.num), f.css({ transform: I(), transition: "transform 0ms" })), _ = !1);
  150. }) : f.css({ position: "absolute", top: 0, left: S() }), o = function o(t) {
  151. _ || (_ = !0, void 0 !== t && ("+" == t ? b++ : b--), y.removeClass("in").eq(-b % (p / 3)).addClass("in"), z ? f.css({ transform: I(), transition: "transform " + i.speed + "ms " + i.timing }) : f.stop(!0, !0).animate({ left: S() }, i.speed, i.easing, function () {
  152. b >= 0 && (b = -p / 3, f.css("left", S())), b <= -(p - i.num) && (b = -(2 * p / 3 - i.num), f.css("left", S())), _ = !1;
  153. }));
  154. }, v.click(function () {
  155. o("+");
  156. }), g.click(function () {
  157. o("-");
  158. }), y.click(function (n) {
  159. n.stopPropagation(), _ = !1, b = -p / 3 - t(this).index(), o();
  160. }), e.on("touchstart", function (t) {
  161. _ = !1, f.css("transition", "transform 0ms"), e.roll_stop(), x = t.originalEvent.changedTouches[0].clientX, C = Date.now(), A = f.position().left, c = e.width() / i.num;
  162. }), e.on("touchmove", function (t) {
  163. t.preventDefault(), (k = t.originalEvent.changedTouches[0].clientX - x) > c / 3 ? f.css("transform", "translate3d(" + (A + c / 3 + 2 * c / 3 * (1 - c / 3 / k)) + "px, 0px, 0px)") : k < -c / 3 ? f.css("transform", "translate3d(" + (A - c / 3 - 2 * c / 3 * (1 - -c / 3 / k)) + "px, 0px, 0px)") : f.css("transform", "translate3d(" + (A + k) + "px, 0px, 0px)");
  164. }), e.on("touchend", function (t) {
  165. T = !1, b >= 0 && k > 0 && (b = -1, T = 1), b <= -(p - i.num) && k < 0 && (b = 1 - (p - i.num), T = 2), (k = t.originalEvent.changedTouches[0].clientX - x) >= c / 3 || Date.now() - C < 300 && k > 30 || 1 == T ? o("+") : k < -c / 3 || Date.now() - C < 300 && k < -30 || 2 == T ? o("-") : o(), e.roll_start();
  166. }), w = setInterval(function () {
  167. o("-");
  168. }, i.timer), r.hover(function () {
  169. e.roll_stop();
  170. }, function () {
  171. e.roll_start();
  172. }), e.fadeTo("slow", 1), this;
  173. }, t.fn.imgAuto = function (e, i) {
  174. i = arguments[1] ? arguments[1] : {};var o = function o(t, n) {
  175. "function" == typeof i[t] && i[t](n);
  176. };return t(this).each(function () {
  177. function i() {
  178. s.width > 0 || s.height > 0 ? (o("imgAutoStart", s), a.css({ display: "block", margin: 0 }).parent().css("overflow", "hidden"), c = s.width, l = s.height, u = r.width(), d = r.height(), f = d / l * c, h = u / c * l, c / l < u / d ? p ? a.css({ width: "100%", height: "auto" }).css("margin-top", -(h - d) / 2) : a.css({ width: "auto", height: "100%" }).css("margin-left", (u - f) / 2) : p ? a.css({ width: "auto", height: "100%" }).css("margin-left", -(f - u) / 2) : a.css({ width: "100%", height: "auto" }).css("margin-top", (d - h) / 2)) : setTimeout(i), o("callback", s);
  179. }var a = t(this);a.css("opacity", 0);var s = new Image();s.src = a.attr("src");var r,
  180. c,
  181. l,
  182. u,
  183. d,
  184. f,
  185. h,
  186. p = !("cover" != a.attr("img-Auto") && !e),
  187. m = a.attr("width"),
  188. v = a.attr("height");m && v ? ((r = t('<div class="imgAuto_box"></div>')).css({ width: m, height: v, "text-align": "left", overflow: "hidden" }), a.wrapAll(r)) : r = a.parent(), i(), a.fadeTo(2e3, 1);var g = yunu.letter(i);t(n).resize(g);
  189. }), this;
  190. };
  191. }(jQuery, window, document), yunu.rem(320), $(window).resize(function () {
  192. yunu.rem(320);
  193. });
  194. //# sourceMappingURL=yunu.js.map
  195. //# sourceMappingURL=yunu.js.map