You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

850 lines
26 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. /*
  2. * # Semantic - Sidebar
  3. * http://github.com/semantic-org/semantic-ui/
  4. *
  5. *
  6. * Copyright 2014 Contributor
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. */
  11. ;(function ( $, window, document, undefined ) {
  12. "use strict";
  13. $.fn.sidebar = function(parameters) {
  14. var
  15. $allModules = $(this),
  16. $head = $('head'),
  17. moduleSelector = $allModules.selector || '',
  18. time = new Date().getTime(),
  19. performance = [],
  20. query = arguments[0],
  21. methodInvoked = (typeof query == 'string'),
  22. queryArguments = [].slice.call(arguments, 1),
  23. requestAnimationFrame = window.requestAnimationFrame
  24. || window.mozRequestAnimationFrame
  25. || window.webkitRequestAnimationFrame
  26. || window.msRequestAnimationFrame
  27. || function(callback) { setTimeout(callback, 0); },
  28. returnedValue
  29. ;
  30. $allModules
  31. .each(function() {
  32. var
  33. settings = ( $.isPlainObject(parameters) )
  34. ? $.extend(true, {}, $.fn.sidebar.settings, parameters)
  35. : $.extend({}, $.fn.sidebar.settings),
  36. selector = settings.selector,
  37. className = settings.className,
  38. namespace = settings.namespace,
  39. error = settings.error,
  40. eventNamespace = '.' + namespace,
  41. moduleNamespace = 'module-' + namespace,
  42. $module = $(this),
  43. $context = $(settings.context),
  44. $style = $('style[title=' + namespace + ']'),
  45. $sidebars = $context.children(selector.sidebar),
  46. $pusher = $context.children(selector.pusher),
  47. $page = $pusher.children(selector.page),
  48. $fixed = $pusher.find(selector.fixed),
  49. element = this,
  50. instance = $module.data(moduleNamespace),
  51. currentScroll,
  52. transitionEnd,
  53. module
  54. ;
  55. module = {
  56. initialize: function() {
  57. module.debug('Initializing sidebar', $module);
  58. transitionEnd = module.get.transitionEvent();
  59. // cache on initialize
  60. if( module.is.legacy() ) {
  61. settings.useLegacy = true;
  62. }
  63. module.setup.context();
  64. // avoid locking rendering to change layout if included in onReady
  65. requestAnimationFrame(module.setup.layout);
  66. module.instantiate();
  67. },
  68. instantiate: function() {
  69. module.verbose('Storing instance of module', module);
  70. instance = module;
  71. $module
  72. .data(moduleNamespace, module)
  73. ;
  74. },
  75. destroy: function() {
  76. module.verbose('Destroying previous module for', $module);
  77. $module
  78. .off(eventNamespace)
  79. .removeData(moduleNamespace)
  80. ;
  81. },
  82. event: {
  83. clickaway: function(event) {
  84. if( $module.find(event.target).size() === 0 && $(event.target).filter($module).size() === 0 ) {
  85. module.verbose('User clicked on dimmed page');
  86. module.hide();
  87. }
  88. },
  89. scroll: function(event) {
  90. if( $module.find(event.target).size() === 0 && $(event.target).filter($module).size() === 0 ) {
  91. event.preventDefault();
  92. }
  93. }
  94. },
  95. bind: {
  96. clickaway: function() {
  97. if(settings.scrollLock) {
  98. $(window)
  99. .on('DOMMouseScroll' + eventNamespace, module.event.scroll)
  100. ;
  101. }
  102. $context
  103. .on('click' + eventNamespace, module.event.clickaway)
  104. .on('touchend' + eventNamespace, module.event.clickaway)
  105. ;
  106. }
  107. },
  108. unbind: {
  109. clickaway: function() {
  110. $context
  111. .off(eventNamespace)
  112. ;
  113. if(settings.scrollLock) {
  114. $(window).off('DOMMouseScroll' + eventNamespace);
  115. }
  116. }
  117. },
  118. refresh: function() {
  119. module.verbose('Refreshing selector cache');
  120. $context = $(settings.context);
  121. $style = $('style[title=' + namespace + ']');
  122. $sidebars = $context.children(selector.sidebar);
  123. $pusher = $context.children(selector.pusher);
  124. $page = $pusher.children(selector.page);
  125. $fixed = $pusher.find(selector.fixed);
  126. },
  127. repaint: function() {
  128. module.verbose('Forcing repaint event');
  129. var fakeAssignment = $context[0].offsetWidth;
  130. },
  131. setup: {
  132. layout: function() {
  133. if( $context.find(selector.pusher).size() === 0 ) {
  134. module.debug('Adding wrapper element for sidebar');
  135. $pusher = $('<div class="pusher" />');
  136. $page = $('<div class="page" />');
  137. $pusher.append($page);
  138. $context
  139. .children()
  140. .not(selector.omitted)
  141. .not($sidebars)
  142. .wrapAll($pusher)
  143. ;
  144. }
  145. if($module.prevAll($page)[0] !== $page[0]) {
  146. module.debug('Moved sidebar to correct parent element');
  147. $module.detach().prependTo($context);
  148. }
  149. module.refresh();
  150. },
  151. context: function() {
  152. module.verbose('Adding pusshable class to wrapper');
  153. $context.addClass(className.pushable);
  154. }
  155. },
  156. attachEvents: function(selector, event) {
  157. var
  158. $toggle = $(selector)
  159. ;
  160. event = $.isFunction(module[event])
  161. ? module[event]
  162. : module.toggle
  163. ;
  164. if($toggle.size() > 0) {
  165. module.debug('Attaching sidebar events to element', selector, event);
  166. $toggle
  167. .off(eventNamespace)
  168. .on('click' + eventNamespace, event)
  169. ;
  170. }
  171. else {
  172. module.error(error.notFound);
  173. }
  174. },
  175. show: function(callback) {
  176. var
  177. animateMethod = (settings.useLegacy)
  178. ? module.legacyPushPage
  179. : module.pushPage
  180. ;
  181. callback = $.isFunction(callback)
  182. ? callback
  183. : function(){}
  184. ;
  185. if(module.is.closed()) {
  186. if(settings.overlay) {
  187. module.error(error.overlay);
  188. settings.transition = 'overlay';
  189. }
  190. if(settings.transition !== 'overlay') {
  191. module.hideAll();
  192. }
  193. animateMethod(function() {
  194. $.proxy(callback, element)();
  195. $.proxy(settings.onShow, element)();
  196. });
  197. $.proxy(settings.onChange, element)();
  198. $.proxy(settings.onVisible, element)();
  199. }
  200. else {
  201. module.debug('Sidebar is already visible');
  202. }
  203. },
  204. hide: function(callback) {
  205. var
  206. animateMethod = (settings.useLegacy)
  207. ? module.legacyPullPage
  208. : module.pullPage
  209. ;
  210. callback = $.isFunction(callback)
  211. ? callback
  212. : function(){}
  213. ;
  214. if(module.is.visible()) {
  215. module.debug('Hiding sidebar', callback);
  216. animateMethod(function() {
  217. $.proxy(callback, element)();
  218. $.proxy(settings.onHidden, element)();
  219. });
  220. $.proxy(settings.onChange, element)();
  221. $.proxy(settings.onHide, element)();
  222. }
  223. },
  224. hideAll: function() {
  225. var
  226. $visibleSidebars = $sidebars.find('.' + className.visible)
  227. ;
  228. $visibleSidebars
  229. .sidebar('hide')
  230. ;
  231. },
  232. toggle: function() {
  233. module.verbose('Determining toggled direction');
  234. if(module.is.closed()) {
  235. module.show();
  236. }
  237. else {
  238. module.hide();
  239. }
  240. },
  241. pushPage: function(callback) {
  242. var
  243. transition = module.get.transition(),
  244. $transition = (transition == 'safe')
  245. ? $context
  246. : (transition == 'overlay')
  247. ? $module
  248. : $pusher,
  249. animate
  250. ;
  251. callback = $.isFunction(callback)
  252. ? callback
  253. : function(){}
  254. ;
  255. animate = function() {
  256. module.set.visible();
  257. module.set.transition();
  258. module.set.direction();
  259. requestAnimationFrame(function() {
  260. module.set.inward();
  261. module.set.pushed();
  262. });
  263. };
  264. $transition
  265. .on(transitionEnd, function(event) {
  266. if( event.target == $transition[0] ) {
  267. $transition.off(transitionEnd);
  268. module.remove.inward();
  269. module.bind.clickaway();
  270. module.set.active();
  271. $.proxy(callback, element)();
  272. }
  273. })
  274. ;
  275. module.verbose('Adding context push state', $context);
  276. if(transition === 'overlay') {
  277. requestAnimationFrame(animate);
  278. }
  279. else {
  280. if(module.is.mobile()) {
  281. $module.scrollTop(0);
  282. currentScroll = $(window).scrollTop();
  283. window.scrollTo(0, 0);
  284. }
  285. module.remove.allVisible();
  286. requestAnimationFrame(animate);
  287. }
  288. },
  289. pullPage: function(callback) {
  290. var
  291. transition = module.get.transition(),
  292. $transition = (transition == 'safe')
  293. ? $context
  294. : (transition == 'overlay')
  295. ? $module
  296. : $pusher
  297. ;
  298. callback = $.isFunction(callback)
  299. ? callback
  300. : function(){}
  301. ;
  302. module.verbose('Removing context push state', module.get.direction());
  303. module.unbind.clickaway();
  304. $transition
  305. .on(transitionEnd, function(event) {
  306. if( event.target == $transition[0] ) {
  307. $transition.off(transitionEnd);
  308. module.remove.transition();
  309. module.remove.direction();
  310. module.remove.outward();
  311. module.remove.visible();
  312. if(module.is.mobile() && settings.returnScroll) {
  313. window.scrollTo(0, currentScroll);
  314. }
  315. $.proxy(callback, element)();
  316. }
  317. })
  318. ;
  319. requestAnimationFrame(function() {
  320. module.set.outward();
  321. module.remove.active();
  322. module.remove.pushed();
  323. });
  324. },
  325. legacyPushPage: function(callback) {
  326. var
  327. distance = $module.width(),
  328. direction = module.get.direction(),
  329. properties = {}
  330. ;
  331. distance = distance || $module.width();
  332. callback = $.isFunction(callback)
  333. ? callback
  334. : function(){}
  335. ;
  336. properties[direction] = distance;
  337. module.debug('Using javascript to push context', properties);
  338. module.set.visible();
  339. module.set.transition();
  340. module.set.direction();
  341. module.set.inward();
  342. module.set.pushed();
  343. $context
  344. .animate(properties, settings.duration, settings.easing, function() {
  345. module.remove.inward();
  346. module.bind.clickaway();
  347. module.set.active();
  348. $.proxy(callback, module)();
  349. })
  350. ;
  351. },
  352. legacyPullPage: function(callback) {
  353. var
  354. distance = 0,
  355. direction = module.get.direction(),
  356. properties = {}
  357. ;
  358. distance = distance || $module.width();
  359. callback = $.isFunction(callback)
  360. ? callback
  361. : function(){}
  362. ;
  363. properties[direction] = '0px';
  364. module.debug('Using javascript to pull context', properties);
  365. module.unbind.clickaway();
  366. module.set.outward();
  367. module.remove.active();
  368. module.remove.pushed();
  369. $context
  370. .animate(properties, settings.duration, settings.easing, function() {
  371. module.remove.transition();
  372. module.remove.direction();
  373. module.remove.outward();
  374. module.remove.visible();
  375. $.proxy(callback, module)();
  376. })
  377. ;
  378. },
  379. set: {
  380. active: function() {
  381. $context.addClass(className.active);
  382. },
  383. direction: function(direction) {
  384. direction = direction || module.get.direction();
  385. $context.addClass(className[direction]);
  386. },
  387. visible: function() {
  388. $module.addClass(className.visible);
  389. },
  390. transition: function(transition) {
  391. transition = transition || module.get.transition();
  392. $context.addClass(transition);
  393. },
  394. inward: function() {
  395. $context.addClass(className.inward);
  396. },
  397. outward: function() {
  398. $context.addClass(className.outward);
  399. },
  400. pushed: function() {
  401. if(settings.dimPage) {
  402. $page.addClass(className.dimmed);
  403. }
  404. $context.addClass(className.pushed);
  405. }
  406. },
  407. remove: {
  408. active: function() {
  409. $context.removeClass(className.active);
  410. },
  411. visible: function() {
  412. $module.removeClass(className.visible);
  413. },
  414. allVisible: function() {
  415. if($sidebars.hasClass(className.visible)) {
  416. module.debug('Other sidebars visible, hiding');
  417. $sidebars.removeClass(className.visible);
  418. }
  419. },
  420. transition: function(transition) {
  421. transition = transition || module.get.transition();
  422. $context.removeClass(transition);
  423. },
  424. pushed: function() {
  425. if(settings.dimPage) {
  426. $page.removeClass(className.dimmed);
  427. }
  428. $context.removeClass(className.pushed);
  429. },
  430. inward: function() {
  431. $context.removeClass(className.inward);
  432. },
  433. outward: function() {
  434. $context.removeClass(className.outward);
  435. },
  436. direction: function(direction) {
  437. direction = direction || module.get.direction();
  438. $context.removeClass(className[direction]);
  439. }
  440. },
  441. get: {
  442. direction: function() {
  443. if($module.hasClass(className.top)) {
  444. return className.top;
  445. }
  446. else if($module.hasClass(className.right)) {
  447. return className.right;
  448. }
  449. else if($module.hasClass(className.bottom)) {
  450. return className.bottom;
  451. }
  452. return className.left;
  453. },
  454. transition: function() {
  455. var
  456. direction = module.get.direction(),
  457. transition
  458. ;
  459. return ( module.is.mobile() )
  460. ? (settings.mobileTransition == 'auto')
  461. ? settings.defaultTransition.mobile[direction]
  462. : settings.mobileTransition
  463. : (settings.transition == 'auto')
  464. ? settings.defaultTransition.computer[direction]
  465. : settings.transition
  466. ;
  467. },
  468. transitionEvent: function() {
  469. var
  470. element = document.createElement('element'),
  471. transitions = {
  472. 'transition' :'transitionend',
  473. 'OTransition' :'oTransitionEnd',
  474. 'MozTransition' :'transitionend',
  475. 'WebkitTransition' :'webkitTransitionEnd'
  476. },
  477. transition
  478. ;
  479. for(transition in transitions){
  480. if( element.style[transition] !== undefined ){
  481. return transitions[transition];
  482. }
  483. }
  484. }
  485. },
  486. is: {
  487. legacy: function() {
  488. var
  489. element = document.createElement('div'),
  490. transforms = {
  491. 'webkitTransform' :'-webkit-transform',
  492. 'OTransform' :'-o-transform',
  493. 'msTransform' :'-ms-transform',
  494. 'MozTransform' :'-moz-transform',
  495. 'transform' :'transform'
  496. },
  497. has3D
  498. ;
  499. // Add it to the body to get the computed style.
  500. document.body.insertBefore(element, null);
  501. for (var transform in transforms) {
  502. if (element.style[transform] !== undefined) {
  503. element.style[transform] = "translate3d(1px,1px,1px)";
  504. has3D = window.getComputedStyle(element).getPropertyValue(transforms[transform]);
  505. }
  506. }
  507. document.body.removeChild(element);
  508. return !(has3D !== undefined && has3D.length > 0 && has3D !== 'none');
  509. },
  510. mobile: function() {
  511. var
  512. userAgent = navigator.userAgent,
  513. mobileRegExp = /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/,
  514. isMobile = mobileRegExp.test(userAgent)
  515. ;
  516. if(isMobile) {
  517. module.verbose('Browser was found to be mobile', userAgent);
  518. return true;
  519. }
  520. else {
  521. module.verbose('Browser is not mobile, using regular transition', userAgent);
  522. return false;
  523. }
  524. },
  525. closed: function() {
  526. return !module.is.visible();
  527. },
  528. visible: function() {
  529. return $module.hasClass(className.visible);
  530. },
  531. vertical: function() {
  532. return $module.hasClass(className.top);
  533. },
  534. inward: function() {
  535. return $context.hasClass(className.inward);
  536. },
  537. outward: function() {
  538. return $context.hasClass(className.outward);
  539. },
  540. animating: function() {
  541. return module.is.inward() || module.is.outward();
  542. }
  543. },
  544. setting: function(name, value) {
  545. module.debug('Changing setting', name, value);
  546. if( $.isPlainObject(name) ) {
  547. $.extend(true, settings, name);
  548. }
  549. else if(value !== undefined) {
  550. settings[name] = value;
  551. }
  552. else {
  553. return settings[name];
  554. }
  555. },
  556. internal: function(name, value) {
  557. if( $.isPlainObject(name) ) {
  558. $.extend(true, module, name);
  559. }
  560. else if(value !== undefined) {
  561. module[name] = value;
  562. }
  563. else {
  564. return module[name];
  565. }
  566. },
  567. debug: function() {
  568. if(settings.debug) {
  569. if(settings.performance) {
  570. module.performance.log(arguments);
  571. }
  572. else {
  573. module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
  574. module.debug.apply(console, arguments);
  575. }
  576. }
  577. },
  578. verbose: function() {
  579. if(settings.verbose && settings.debug) {
  580. if(settings.performance) {
  581. module.performance.log(arguments);
  582. }
  583. else {
  584. module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
  585. module.verbose.apply(console, arguments);
  586. }
  587. }
  588. },
  589. error: function() {
  590. module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
  591. module.error.apply(console, arguments);
  592. },
  593. performance: {
  594. log: function(message) {
  595. var
  596. currentTime,
  597. executionTime,
  598. previousTime
  599. ;
  600. if(settings.performance) {
  601. currentTime = new Date().getTime();
  602. previousTime = time || currentTime;
  603. executionTime = currentTime - previousTime;
  604. time = currentTime;
  605. performance.push({
  606. 'Element' : element,
  607. 'Name' : message[0],
  608. 'Arguments' : [].slice.call(message, 1) || '',
  609. 'Execution Time' : executionTime
  610. });
  611. }
  612. clearTimeout(module.performance.timer);
  613. module.performance.timer = setTimeout(module.performance.display, 100);
  614. },
  615. display: function() {
  616. var
  617. title = settings.name + ':',
  618. totalTime = 0
  619. ;
  620. time = false;
  621. clearTimeout(module.performance.timer);
  622. $.each(performance, function(index, data) {
  623. totalTime += data['Execution Time'];
  624. });
  625. title += ' ' + totalTime + 'ms';
  626. if(moduleSelector) {
  627. title += ' \'' + moduleSelector + '\'';
  628. }
  629. if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
  630. console.groupCollapsed(title);
  631. if(console.table) {
  632. console.table(performance);
  633. }
  634. else {
  635. $.each(performance, function(index, data) {
  636. console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
  637. });
  638. }
  639. console.groupEnd();
  640. }
  641. performance = [];
  642. }
  643. },
  644. invoke: function(query, passedArguments, context) {
  645. var
  646. object = instance,
  647. maxDepth,
  648. found,
  649. response
  650. ;
  651. passedArguments = passedArguments || queryArguments;
  652. context = element || context;
  653. if(typeof query == 'string' && object !== undefined) {
  654. query = query.split(/[\. ]/);
  655. maxDepth = query.length - 1;
  656. $.each(query, function(depth, value) {
  657. var camelCaseValue = (depth != maxDepth)
  658. ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
  659. : query
  660. ;
  661. if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
  662. object = object[camelCaseValue];
  663. }
  664. else if( object[camelCaseValue] !== undefined ) {
  665. found = object[camelCaseValue];
  666. return false;
  667. }
  668. else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
  669. object = object[value];
  670. }
  671. else if( object[value] !== undefined ) {
  672. found = object[value];
  673. return false;
  674. }
  675. else {
  676. module.error(error.method, query);
  677. return false;
  678. }
  679. });
  680. }
  681. if ( $.isFunction( found ) ) {
  682. response = found.apply(context, passedArguments);
  683. }
  684. else if(found !== undefined) {
  685. response = found;
  686. }
  687. if($.isArray(returnedValue)) {
  688. returnedValue.push(response);
  689. }
  690. else if(returnedValue !== undefined) {
  691. returnedValue = [returnedValue, response];
  692. }
  693. else if(response !== undefined) {
  694. returnedValue = response;
  695. }
  696. return found;
  697. }
  698. }
  699. ;
  700. if(methodInvoked) {
  701. if(instance === undefined) {
  702. module.initialize();
  703. }
  704. module.invoke(query);
  705. }
  706. else {
  707. if(instance !== undefined) {
  708. module.destroy();
  709. }
  710. module.initialize();
  711. }
  712. });
  713. return (returnedValue !== undefined)
  714. ? returnedValue
  715. : this
  716. ;
  717. };
  718. $.fn.sidebar.settings = {
  719. name : 'Sidebar',
  720. namespace : 'sidebar',
  721. debug : false,
  722. verbose : false,
  723. performance : false,
  724. workaround : false,
  725. transition : 'auto',
  726. mobileTransition : 'auto',
  727. defaultTransition : {
  728. computer: {
  729. left : 'uncover',
  730. right : 'uncover',
  731. top : 'overlay',
  732. bottom : 'overlay'
  733. },
  734. mobile: {
  735. left : 'uncover',
  736. right : 'uncover',
  737. top : 'overlay',
  738. bottom : 'overlay'
  739. }
  740. },
  741. context : 'body',
  742. exclusive : true,
  743. dimPage : true,
  744. scrollLock : false,
  745. returnScroll : false,
  746. useLegacy : false,
  747. duration : 500,
  748. easing : 'easeInOutQuint',
  749. onChange : function(){},
  750. onShow : function(){},
  751. onHide : function(){},
  752. onHidden : function(){},
  753. onVisible : function(){},
  754. className : {
  755. active : 'active',
  756. bottom : 'bottom',
  757. dimmed : 'dimmed',
  758. inward : 'show',
  759. left : 'left',
  760. outward : 'hide',
  761. pushable : 'pushable',
  762. pushed : 'pushed',
  763. right : 'right',
  764. top : 'top',
  765. visible : 'visible'
  766. },
  767. selector: {
  768. fixed : '.ui.fixed',
  769. omitted : 'script, link, style, .ui.modal, .ui.nag, .ui.fixed',
  770. page : '.page',
  771. pusher : '.pusher',
  772. sidebar : '.ui.sidebar'
  773. },
  774. error : {
  775. method : 'The method you called is not defined.',
  776. overlay : 'The overlay setting is no longer supported, use animation: overlay',
  777. notFound : 'There were no elements that matched the specified selector'
  778. }
  779. };
  780. // Adds easing
  781. $.extend( $.easing, {
  782. easeInOutQuint: function (x, t, b, c, d) {
  783. if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
  784. return c/2*((t-=2)*t*t*t*t + 2) + b;
  785. }
  786. });
  787. })( jQuery, window , document );