esmartzoom.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. function transitionEnd() {
  2. var e = document.createElement("bootstrap");
  3. var t = {
  4. WebkitTransition: "webkitTransitionEnd",
  5. MozTransition: "transitionend",
  6. OTransition: "oTransitionEnd otransitionend",
  7. transition: "transitionend"
  8. };
  9. for (var n in t) {
  10. if (e.style[n] !== undefined) {
  11. return {
  12. end: t[n]
  13. }
  14. }
  15. }
  16. return false
  17. }(function(e) {
  18. e.fn.smartZoom = function(t) {
  19. function r(e) {}
  20. function s(e, t) {
  21. var r = n.data("smartZoomData");
  22. if (r.currentWheelDelta * t < 0) r.currentWheelDelta = 0;
  23. r.currentWheelDelta += t;
  24. i.zoom(r.mouseWheelDeltaFactor * r.currentWheelDelta, {
  25. x: e.pageX,
  26. y: e.pageY
  27. })
  28. }
  29. function o(e) {
  30. e.preventDefault()
  31. }
  32. function u() {
  33. var e = n.data("smartZoomData");
  34. if (e.settings.mouseMoveEnabled != true || e.settings.moveCursorEnabled != true) return;
  35. var t = S();
  36. var r = t.width / e.originalSize.width;
  37. if (parseInt(r * 100) > parseInt(e.adjustedPosInfos.scale * 100)) n.css({
  38. cursor: "move"
  39. });
  40. else n.css({
  41. cursor: "default"
  42. })
  43. }
  44. function a(e) {
  45. m(e.pageX, e.pageY)
  46. }
  47. function f(t) {
  48. t.preventDefault();
  49. e(document).on("mousemove.smartZoom", l);
  50. e(document).bind("mouseup.smartZoom", c);
  51. var r = n.data("smartZoomData");
  52. r.moveCurrentPosition = new A(t.pageX, t.pageY);
  53. r.moveLastPosition = new A(t.pageX, t.pageY)
  54. }
  55. function l(e) {
  56. var t = n.data("smartZoomData");
  57. if (t.mouseMoveForPan || !t.mouseMoveForPan && t.moveCurrentPosition.x != e.pageX && t.moveCurrentPosition.y != e.pageY) {
  58. t.mouseMoveForPan = true;
  59. v(e.pageX, e.pageY, 0, false)
  60. }
  61. }
  62. function c(t) {
  63. var r = n.data("smartZoomData");
  64. if (r.mouseMoveForPan) {
  65. r.mouseMoveForPan = false;
  66. if (r.moveLastPosition.distance(r.moveCurrentPosition) > 4) {
  67. var i = r.moveLastPosition.interpolate(r.moveCurrentPosition, -4);
  68. v(i.x, i.y, 500, true)
  69. } else {
  70. v(r.moveLastPosition.x, r.moveLastPosition.y, 0, true)
  71. }
  72. } else if (r.settings.zoomOnSimpleClick) {
  73. m(t.pageX, t.pageY)
  74. }
  75. e(document).unbind("mousemove.smartZoom");
  76. e(document).unbind("mouseup.smartZoom")
  77. }
  78. function h(t) {
  79. t.preventDefault();
  80. e(document).unbind("touchmove.smartZoom");
  81. e(document).unbind("touchend.smartZoom");
  82. e(document).bind("touchmove.smartZoom", p);
  83. e(document).bind("touchend.smartZoom", d);
  84. var r = t.originalEvent.touches;
  85. var i = r[0];
  86. var s = n.data("smartZoomData");
  87. s.touch.touchMove = false;
  88. s.touch.touchPinch = false;
  89. s.moveCurrentPosition = new A(i.pageX, i.pageY);
  90. s.moveLastPosition = new A(i.pageX, i.pageY);
  91. s.touch.lastTouchPositionArr = new Array;
  92. var o;
  93. var u = r.length;
  94. for (var a = 0; a < u; ++a) {
  95. o = r[a];
  96. s.touch.lastTouchPositionArr.push(new A(o.pageX, o.pageY))
  97. }
  98. }
  99. function p(e) {
  100. e.preventDefault();
  101. var t = n.data("smartZoomData");
  102. var r = e.originalEvent.touches;
  103. var s = r.length;
  104. var o = r[0];
  105. if (s == 1 && !t.touch.touchPinch && t.settings.touchMoveEnabled == true) {
  106. if (!t.touch.touchMove) {
  107. var u = t.touch.lastTouchPositionArr[0];
  108. if (u.distance(new A(o.pageX, o.pageY)) < 3) {
  109. return
  110. } else t.touch.touchMove = true
  111. }
  112. v(o.pageX, o.pageY, 0, false)
  113. } else if (s == 2 && !t.touch.touchMove && t.settings.pinchEnabled == true) {
  114. t.touch.touchPinch = true;
  115. var a = r[1];
  116. var f = t.touch.lastTouchPositionArr[0];
  117. var l = t.touch.lastTouchPositionArr[1];
  118. var c = new A(o.pageX, o.pageY);
  119. var h = new A(a.pageX, a.pageY);
  120. var p = c.distance(h);
  121. var d = f.distance(l);
  122. var m = p - d;
  123. if (Math.abs(m) < 3) return;
  124. var g = new A((c.x + h.x) / 2, (c.y + h.y) / 2);
  125. var y = S();
  126. var b = t.originalSize;
  127. var w = y.width / b.width;
  128. var E = p / d;
  129. var x = y.width * E / b.width;
  130. i.zoom(x - w, g, 0);
  131. t.touch.lastTouchPositionArr[0] = c;
  132. t.touch.lastTouchPositionArr[1] = h
  133. }
  134. }
  135. function d(t) {
  136. t.preventDefault();
  137. var r = t.originalEvent.touches.length;
  138. if (r == 0) {
  139. e(document).unbind("touchmove.smartZoom");
  140. e(document).unbind("touchend.smartZoom")
  141. }
  142. var i = n.data("smartZoomData");
  143. if (i.touch.touchPinch) return;
  144. if (i.touch.touchMove) {
  145. if (i.moveLastPosition.distance(i.moveCurrentPosition) > 2) {
  146. var s = i.moveLastPosition.interpolate(i.moveCurrentPosition, -4);
  147. v(s.x, s.y, 500, true)
  148. }
  149. } else {
  150. if (i.settings.dblTapEnabled == true && i.touch.lastTouchEndTime != 0 && (new Date).getTime() - i.touch.lastTouchEndTime < 400) {
  151. var o = i.touch.lastTouchPositionArr[0];
  152. m(o.x, o.y)
  153. }
  154. i.touch.lastTouchEndTime = (new Date).getTime()
  155. }
  156. }
  157. function v(e, t, i, s) {
  158. g(r.PAN);
  159. var o = n.data("smartZoomData");
  160. o.moveLastPosition.x = o.moveCurrentPosition.x;
  161. o.moveLastPosition.y = o.moveCurrentPosition.y;
  162. var u = n.offset();
  163. var a = S();
  164. var f = u.left + (e - o.moveCurrentPosition.x);
  165. var l = u.top + (t - o.moveCurrentPosition.y);
  166. var c = y(f, l, a.width, a.height);
  167. x(r.PAN, r.START, false);
  168. E(n, c.x, c.y, a.width, a.height, i, s == true ?
  169. function() {
  170. x(r.PAN, r.END, false)
  171. } : null);
  172. o.moveCurrentPosition.x = e;
  173. o.moveCurrentPosition.y = t
  174. }
  175. function m(e, t) {
  176. var r = n.data("smartZoomData");
  177. var s = r.originalSize;
  178. var o = S();
  179. var u = o.width / s.width;
  180. var a = r.adjustedPosInfos.scale;
  181. var f = parseFloat(r.settings.dblClickMaxScale);
  182. var l;
  183. if (u.toFixed(2) > f.toFixed(2) || Math.abs(f - u) > Math.abs(u - a)) {
  184. l = f - u
  185. } else {
  186. l = a - u
  187. }
  188. i.zoom(l, {
  189. x: e,
  190. y: t
  191. })
  192. }
  193. function g(t) {
  194. var r = n.data("smartZoomData");
  195. if (r.transitionObject) {
  196. if (r.transitionObject.cssAnimHandler) n.off(e.support.transition, r.transitionObject.cssAnimTimer);
  197. var i = r.originalSize;
  198. var s = S();
  199. var o = new Object;
  200. o[r.transitionObject.transition] = "all 0s";
  201. if (r.transitionObject.css3dSupported) {
  202. o[r.transitionObject.transform] = "translate3d(" + s.x + "px, " + s.y + "px, 0) scale3d(" + s.width / i.width + "," + s.height / i.height + ", 1)"
  203. } else {
  204. o[r.transitionObject.transform] = "translateX(" + s.x + "px) translateY(" + s.y + "px) scale(" + s.width / i.width + "," + s.height / i.height + ")"
  205. }
  206. n.css(o)
  207. } else {
  208. n.stop()
  209. }
  210. u();
  211. if (t != null) x(t, "", true)
  212. }
  213. function y(e, t, r, i) {
  214. var s = n.data("smartZoomData");
  215. var o = Math.min(s.adjustedPosInfos.top, t);
  216. o += Math.max(0, s.adjustedPosInfos.top + s.adjustedPosInfos.height - (o + i));
  217. var u = Math.min(s.adjustedPosInfos.left, e);
  218. u += Math.max(0, s.adjustedPosInfos.left + s.adjustedPosInfos.width - (u + r));
  219. return new A(u.toFixed(2), o.toFixed(2))
  220. }
  221. function b(e) {
  222. n.unbind("load.smartZoom");
  223. i.init.apply(n, [e.data.arguments])
  224. }
  225. function w() {
  226. var e = n.data("smartZoomData");
  227. var t = e.containerDiv;
  228. var r = e.originalSize;
  229. var i = t.parent().offset();
  230. var s = C(e.settings.left, i.left, t.parent().width());
  231. var o = C(e.settings.top, i.top, t.parent().height());
  232. t.offset({
  233. left: s,
  234. top: o
  235. });
  236. t.width(N(e.settings.width, t.parent().width(), s - i.left));
  237. t.height(N(e.settings.height, t.parent().height(), o - i.top));
  238. var a = L(t);
  239. var f = Math.min(Math.min(a.width / r.width, a.height / r.height), 1).toFixed(2);
  240. var l = r.width * f;
  241. var c = r.height * f;
  242. e.adjustedPosInfos = {
  243. left: (a.width - l) / 2 + i.left,
  244. top: (a.height - c) / 2 + i.top,
  245. width: l,
  246. height: c,
  247. scale: f
  248. };
  249. g();
  250. E(n, e.adjustedPosInfos.left, e.adjustedPosInfos.top, l, c, 0, function() {
  251. n.css("visibility", "visible")
  252. });
  253. u();
  254. }
  255. function E(t, r, i, s, o, u, a) {
  256. var f = n.data("smartZoomData");
  257. var l = f.containerDiv.offset();
  258. var c = r - l.left;
  259. var h = i - l.top;
  260. if (f.transitionObject != null) {
  261. var p = f.originalSize;
  262. var d = new Object;
  263. d[f.transitionObject.transform + "-origin"] = "0 0";
  264. d[f.transitionObject.transition] = "all " + u / 1e3 + "s ease-out";
  265. if (f.transitionObject.css3dSupported) d[f.transitionObject.transform] = "translate3d(" + c + "px, " + h + "px, 0) scale3d(" + s / p.width + "," + o / p.height + ", 1)";
  266. else d[f.transitionObject.transform] = "translateX(" + c + "px) translateY(" + h + "px) scale(" + s / p.width + "," + o / p.height + ")";
  267. if (a != null) {
  268. f.transitionObject.cssAnimHandler = a;
  269. t.one(e.support.transition.end, f.transitionObject.cssAnimHandler)
  270. }
  271. t.css(d)
  272. } else {
  273. t.animate({
  274. "margin-left": c,
  275. "margin-top": h,
  276. width: s,
  277. height: o
  278. }, {
  279. duration: u,
  280. easing: f.settings.easing,
  281. complete: function() {
  282. if (a != null) a()
  283. }
  284. })
  285. }
  286. }
  287. function S(e) {
  288. var t = n.data("smartZoomData");
  289. var r = n.width();
  290. var i = n.height();
  291. var s = n.offset();
  292. var o = parseInt(s.left);
  293. var u = parseInt(s.top);
  294. var a = t.containerDiv.offset();
  295. if (e != true) {
  296. o = parseInt(o) - a.left;
  297. u = parseInt(u) - a.top
  298. }
  299. if (t.transitionObject != null) {
  300. var f = n.css(t.transitionObject.transform);
  301. if (f && f != "" && f.search("matrix") != -1) {
  302. var l;
  303. var c;
  304. if (f.search("matrix3d") != -1) {
  305. c = f.replace("matrix3d(", "").replace(")", "").split(",");
  306. l = c[0]
  307. } else {
  308. c = f.replace("matrix(", "").replace(")", "").split(",");
  309. l = c[3];
  310. o = parseFloat(c[4]);
  311. u = parseFloat(c[5]);
  312. if (e) {
  313. o = parseFloat(o) + a.left;
  314. u = parseFloat(u) + a.top
  315. }
  316. }
  317. r = l * r;
  318. i = l * i
  319. }
  320. }
  321. return {
  322. x: o,
  323. y: u,
  324. width: r,
  325. height: i
  326. }
  327. }
  328. function x(e, t, i) {
  329. var s = n.data("smartZoomData");
  330. var o = "";
  331. if (i == true && s.currentActionType != e) {
  332. o = s.currentActionType + "_" + r.END;
  333. s.currentActionType = "";
  334. s.currentActionStep = ""
  335. } else {
  336. if (s.currentActionType != e || s.currentActionStep == r.END) {
  337. s.currentActionType = e;
  338. s.currentActionStep = r.START;
  339. o = s.currentActionType + "_" + s.currentActionStep
  340. } else if (s.currentActionType == e && t == r.END) {
  341. s.currentActionStep = r.END;
  342. o = s.currentActionType + "_" + s.currentActionStep;
  343. s.currentActionType = "";
  344. s.currentActionStep = ""
  345. }
  346. }
  347. if (o != "") {
  348. var u = jQuery.Event(o);
  349. u.targetRect = S(true);
  350. u.scale = u.targetRect.width / s.originalSize.width;
  351. n.trigger(u)
  352. }
  353. }
  354. function T() {
  355. var t = document.body || document.documentElement;
  356. var n = t.style;
  357. var r = ["transition", "WebkitTransition", "MozTransition", "MsTransition", "OTransition"];
  358. var i = ["transition", "-webkit-transition", "-moz-transition", "-ms-transition", "-o-transition"];
  359. var s = ["transform", "-webkit-transform", "-moz-transform", "-ms-transform", "-o-transform"];
  360. var o = r.length;
  361. var u;
  362. for (var a = 0; a < o; a++) {
  363. if (n[r[a]] != null) {
  364. transformStr = s[a];
  365. var f = e('<div style="position:absolute;">Translate3d Test</div>');
  366. e("body").append(f);
  367. u = new Object;
  368. u[s[a]] = "translate3d(20px,0,0)";
  369. f.css(u);
  370. css3dSupported = f.offset().left - e("body").offset().left == 20;
  371. f.empty().remove();
  372. if (css3dSupported) {
  373. return {
  374. transition: i[a],
  375. transform: s[a],
  376. css3dSupported: css3dSupported
  377. }
  378. }
  379. }
  380. }
  381. return null
  382. }
  383. function N(e, t, n) {
  384. if (e.search && e.search("%") != -1) return (t - n) * (parseInt(e) / 100);
  385. else return parseInt(e)
  386. }
  387. function C(e, t, n) {
  388. if (e.search && e.search("%") != -1) return t + n * (parseInt(e) / 100);
  389. else return t + parseInt(e)
  390. }
  391. function k() {
  392. w()
  393. }
  394. function L(e) {
  395. var t = e.offset();
  396. if (!t) return null;
  397. var n = t.left;
  398. var r = t.top;
  399. return {
  400. x: n,
  401. y: r,
  402. width: e.outerWidth(),
  403. height: e.outerHeight()
  404. }
  405. }
  406. function A(e, t) {
  407. this.x = e;
  408. this.y = t;
  409. this.toString = function() {
  410. return "(x=" + this.x + ", y=" + this.y + ")"
  411. };
  412. this.interpolate = function(e, t) {
  413. var n = t * this.x + (1 - t) * e.x;
  414. var r = t * this.y + (1 - t) * e.y;
  415. return new A(n, r)
  416. };
  417. this.distance = function(e) {
  418. return Math.sqrt(Math.pow(e.y - this.y, 2) + Math.pow(e.x - this.x, 2))
  419. }
  420. }
  421. var n = this;
  422. r.ZOOM = "SmartZoom_ZOOM";
  423. r.PAN = "SmartZoom_PAN";
  424. r.START = "START";
  425. r.END = "END";
  426. r.DESTROYED = "SmartZoom_DESTROYED";
  427. var i = {
  428. init: function(t) {
  429. if (n.data("smartZoomData")) return;
  430. settings = e.extend({
  431. top: "0",
  432. left: "0",
  433. width: "100%",
  434. height: "100%",
  435. easing: "smartZoomEasing",
  436. initCallback: null,
  437. maxScale: 3,
  438. dblClickMaxScale: 1.8,
  439. mouseEnabled: true,
  440. scrollEnabled: true,
  441. dblClickEnabled: true,
  442. mouseMoveEnabled: true,
  443. moveCursorEnabled: true,
  444. adjustOnResize: true,
  445. touchEnabled: true,
  446. dblTapEnabled: true,
  447. zoomOnSimpleClick: true,
  448. pinchEnabled: true,
  449. touchMoveEnabled: true,
  450. containerBackground: "#FFFFFF",
  451. containerClass: ""
  452. }, t);
  453. var r = n.attr("style");
  454. var i = "smartZoomContainer" + (new Date).getTime();
  455. var u = e('<div id="' + i + '" class="' + settings.containerClass + '"></div>');
  456. n.before(u);
  457. n.remove();
  458. u = e("#" + i);
  459. u.css({
  460. overflow: "hidden"
  461. });
  462. if (settings.containerClass == "") u.css({
  463. "background-color": settings.containerBackground
  464. });
  465. u.append(n);
  466. var l = new Object;
  467. l.lastTouchEndTime = 0;
  468. l.lastTouchPositionArr = null;
  469. l.touchMove = false;
  470. l.touchPinch = false;
  471. n.data("smartZoomData", {
  472. settings: settings,
  473. containerDiv: u,
  474. originalSize: {
  475. width: n.width(),
  476. height: n.height()
  477. },
  478. originalPosition: n.offset(),
  479. transitionObject: T(),
  480. touch: l,
  481. mouseWheelDeltaFactor: .15,
  482. currentWheelDelta: 0,
  483. adjustedPosInfos: null,
  484. moveCurrentPosition: null,
  485. moveLastPosition: null,
  486. mouseMoveForPan: false,
  487. currentActionType: "",
  488. initialStyles: r,
  489. currentActionStep: ""
  490. });
  491. w();
  492. if (settings.touchEnabled == true) n.bind("touchstart.smartZoom", h);
  493. if (settings.mouseEnabled == true) {
  494. if (settings.mouseMoveEnabled == true) n.bind("mousedown.smartZoom", f);
  495. if (settings.scrollEnabled == true) {
  496. u.bind("mousewheel.smartZoom", s);
  497. u.bind("mousewheel.smartZoom DOMMouseScroll.smartZoom", o)
  498. }
  499. if (settings.dblClickEnabled == true && settings.zoomOnSimpleClick == false) u.bind("dblclick.smartZoom", a)
  500. }
  501. document.ondragstart = function() {
  502. return false
  503. };
  504. if (settings.adjustOnResize == true) e(window).bind("resize.smartZoom", k);
  505. if (settings.initCallback != null) settings.initCallback.apply(this, n)
  506. },
  507. zoom: function(e, t, i) {
  508. var s = n.data("smartZoomData");
  509. var o;
  510. var a;
  511. if (!t) {
  512. var f = L(s.containerDiv);
  513. o = f.x + f.width / 2;
  514. a = f.y + f.height / 2
  515. } else {
  516. o = t.x;
  517. a = t.y
  518. }
  519. g(r.ZOOM);
  520. var l = S(true);
  521. var c = s.originalSize;
  522. var h = l.width / c.width + e;
  523. h = Math.max(s.adjustedPosInfos.scale, h);
  524. h = Math.min(s.settings.maxScale, h);
  525. var p = c.width * h;
  526. var d = c.height * h;
  527. var v = o - l.x;
  528. var m = a - l.y;
  529. var b = p / l.width;
  530. var w = l.x - (v * b - v);
  531. var T = l.y - (m * b - m);
  532. var N = y(w, T, p, d);
  533. if (i == null) i = 700;
  534. x(r.ZOOM, r.START, false);
  535. E(n, N.x, N.y, p, d, i, function() {
  536. s.currentWheelDelta = 0;
  537. u();
  538. x(r.ZOOM, r.END, false)
  539. })
  540. },
  541. pan: function(e, t, i) {
  542. if (e == null || t == null) return;
  543. if (i == null) i = 700;
  544. var s = n.offset();
  545. var o = S();
  546. var u = y(s.left + e, s.top + t, o.width, o.height);
  547. if (u.x != s.left || u.y != s.top) {
  548. g(r.PAN);
  549. x(r.PAN, r.START, false);
  550. E(n, u.x, u.y, o.width, o.height, i, function() {
  551. x(r.PAN, r.END, false)
  552. })
  553. }
  554. },
  555. destroy: function() {
  556. var t = n.data("smartZoomData");
  557. if (!t) return;
  558. g();
  559. var i = t.containerDiv;
  560. n.unbind("mousedown.smartZoom");
  561. n.bind("touchstart.smartZoom");
  562. i.unbind("mousewheel.smartZoom");
  563. i.unbind("dblclick.smartZoom");
  564. i.unbind("mousewheel.smartZoom DOMMouseScroll.smartZoom");
  565. e(window).unbind("resize.smartZoom");
  566. e(document).unbind("mousemove.smartZoom");
  567. e(document).unbind("mouseup.smartZoom");
  568. e(document).unbind("touchmove.smartZoom");
  569. e(document).unbind("touchend.smartZoom");
  570. n.css({
  571. cursor: "default"
  572. });
  573. i.before(n);
  574. E(n, t.originalPosition.left, t.originalPosition.top, t.originalSize.width, t.originalSize.height, 5);
  575. n.removeData("smartZoomData");
  576. i.remove();
  577. n.attr("style", t.initialStyles);
  578. n.trigger(r.DESTROYED)
  579. },
  580. isPluginActive: function() {
  581. return n.data("smartZoomData") != undefined
  582. }
  583. };
  584. if (i[t]) {
  585. return i[t].apply(this, Array.prototype.slice.call(arguments, 1))
  586. } else if (typeof t === "object" || !t) {
  587. if (n[0].tagName.toLowerCase() == "img" && !n[0].complete) {
  588. n.bind("load.smartZoom", {
  589. arguments: arguments[0]
  590. }, b)
  591. } else {
  592. i.init.apply(n, [arguments[0]])
  593. }
  594. } else {
  595. e.error("Method " + t + " does not exist on e-smartzoom jquery plugin")
  596. }
  597. }
  598. })(jQuery);
  599. (function(e) {
  600. e.extend(e.easing, {
  601. smartZoomEasing: function(t, n, r, i, s) {
  602. return e.easing["smartZoomOutQuad"](t, n, r, i, s)
  603. },
  604. smartZoomOutQuad: function(e, t, n, r, i) {
  605. return -r * (t /= i) * (t - 2) + n
  606. }
  607. })
  608. })(jQuery);
  609. (function(e) {
  610. function t(t) {
  611. var n = t || window.event,
  612. r = [].slice.call(arguments, 1),
  613. i = 0,
  614. s = true,
  615. o = 0,
  616. u = 0;
  617. t = e.event.fix(n);
  618. t.type = "mousewheel";
  619. if (n.wheelDelta) {
  620. i = n.wheelDelta / 120
  621. }
  622. if (n.detail) {
  623. i = -n.detail / 3
  624. }
  625. u = i;
  626. if (n.axis !== undefined && n.axis === n.HORIZONTAL_AXIS) {
  627. u = 0;
  628. o = -1 * i
  629. }
  630. if (n.wheelDeltaY !== undefined) {
  631. u = n.wheelDeltaY / 120
  632. }
  633. if (n.wheelDeltaX !== undefined) {
  634. o = -1 * n.wheelDeltaX / 120
  635. }
  636. r.unshift(t, i, o, u);
  637. return (e.event.dispatch || e.event.handle).apply(this, r)
  638. }
  639. var n = ["DOMMouseScroll", "mousewheel"];
  640. if (e.event.fixHooks) {
  641. for (var r = n.length; r;) {
  642. e.event.fixHooks[n[--r]] = e.event.mouseHooks
  643. }
  644. }
  645. e.event.special.mousewheel = {
  646. setup: function() {
  647. if (this.addEventListener) {
  648. for (var e = n.length; e;) {
  649. this.addEventListener(n[--e], t, false)
  650. }
  651. } else {
  652. this.onmousewheel = t
  653. }
  654. },
  655. teardown: function() {
  656. if (this.removeEventListener) {
  657. for (var e = n.length; e;) {
  658. this.removeEventListener(n[--e], t, false)
  659. }
  660. } else {
  661. this.onmousewheel = null
  662. }
  663. }
  664. };
  665. e.fn.extend({
  666. mousewheel: function(e) {
  667. return e ? this.bind("mousewheel", e) : this.trigger("mousewheel")
  668. },
  669. unmousewheel: function(e) {
  670. return this.unbind("mousewheel", e)
  671. }
  672. })
  673. })(jQuery);
  674. $.fn.emulateTransitionEnd = function(e) {
  675. var t = false,
  676. n = this;
  677. $(this).one($.support.transition.end, function() {
  678. t = true
  679. });
  680. var r = function() {
  681. if (!t) $(n).trigger($.support.transition.end)
  682. };
  683. setTimeout(r, e);
  684. return this;
  685. };
  686. $(function() {
  687. $.support.transition = transitionEnd()
  688. })