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.

924 lines
29 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
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. /*
  2. * # Semantic - Transition
  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.transition = function() {
  14. var
  15. $allModules = $(this),
  16. moduleSelector = $allModules.selector || '',
  17. time = new Date().getTime(),
  18. performance = [],
  19. moduleArguments = arguments,
  20. query = moduleArguments[0],
  21. queryArguments = [].slice.call(arguments, 1),
  22. methodInvoked = (typeof query === 'string'),
  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. $module = $(this),
  34. element = this,
  35. // set at run time
  36. settings,
  37. instance,
  38. error,
  39. className,
  40. metadata,
  41. animationStart,
  42. animationEnd,
  43. animationName,
  44. namespace,
  45. moduleNamespace,
  46. eventNamespace,
  47. module
  48. ;
  49. module = {
  50. initialize: function() {
  51. // get full settings
  52. moduleNamespace = 'module-' + namespace;
  53. settings = module.get.settings.apply(element, moduleArguments);
  54. className = settings.className;
  55. metadata = settings.metadata;
  56. animationStart = module.get.animationStartEvent();
  57. animationEnd = module.get.animationEndEvent();
  58. animationName = module.get.animationName();
  59. error = settings.error;
  60. namespace = settings.namespace;
  61. eventNamespace = '.' + settings.namespace;
  62. instance = $module.data(moduleNamespace) || module;
  63. if(methodInvoked) {
  64. methodInvoked = module.invoke(query);
  65. }
  66. // no internal method was found matching query or query not made
  67. if(methodInvoked === false) {
  68. module.verbose('Converted arguments into settings object', settings);
  69. module.animate();
  70. module.instantiate();
  71. }
  72. },
  73. instantiate: function() {
  74. module.verbose('Storing instance of module', module);
  75. $module
  76. .data(moduleNamespace, instance)
  77. ;
  78. },
  79. destroy: function() {
  80. module.verbose('Destroying previous module for', element);
  81. $module
  82. .removeData(moduleNamespace)
  83. ;
  84. },
  85. refresh: function() {
  86. module.verbose('Refreshing display type on next animation');
  87. delete module.displayType;
  88. },
  89. forceRepaint: function() {
  90. module.verbose('Forcing element repaint');
  91. var
  92. $parentElement = $module.parent(),
  93. $nextElement = $module.next()
  94. ;
  95. if($nextElement.size() === 0) {
  96. $module.detach().appendTo($parentElement);
  97. }
  98. else {
  99. $module.detach().insertBefore($nextElement);
  100. }
  101. },
  102. repaint: function() {
  103. module.verbose('Repainting element');
  104. var
  105. fakeAssignment = element.offsetWidth
  106. ;
  107. },
  108. animate: function(overrideSettings) {
  109. settings = overrideSettings || settings;
  110. if(!module.is.supported()) {
  111. module.error(error.support);
  112. return false;
  113. }
  114. module.debug('Preparing animation', settings.animation);
  115. if(module.is.animating()) {
  116. if(settings.queue) {
  117. if(!settings.allowRepeats && module.has.direction() && module.is.occuring() && module.queuing !== true) {
  118. module.error(error.repeated, settings.animation, $module);
  119. }
  120. else {
  121. module.queue(settings.animation);
  122. }
  123. return false;
  124. }
  125. else {
  126. }
  127. }
  128. if( module.can.animate() ) {
  129. module.set.animating(settings.animation);
  130. }
  131. else {
  132. module.error(error.noAnimation, settings.animation);
  133. }
  134. },
  135. reset: function() {
  136. module.debug('Resetting animation to beginning conditions');
  137. module.remove.animationEndCallback();
  138. module.restore.conditions();
  139. module.remove.animating();
  140. },
  141. queue: function(animation) {
  142. module.debug('Queueing animation of', animation);
  143. module.queuing = true;
  144. $module
  145. .one(animationEnd + eventNamespace, function() {
  146. module.queuing = false;
  147. module.repaint();
  148. module.animate.apply(this, settings);
  149. })
  150. ;
  151. },
  152. complete: function () {
  153. module.verbose('CSS animation complete', settings.animation);
  154. module.remove.animationEndCallback();
  155. module.remove.failSafe();
  156. if(!module.is.looping()) {
  157. if( module.is.outward() ) {
  158. module.verbose('Animation is outward, hiding element');
  159. module.restore.conditions();
  160. module.hide();
  161. $.proxy(settings.onHide, this)();
  162. }
  163. else if( module.is.inward() ) {
  164. module.verbose('Animation is outward, showing element');
  165. module.restore.conditions();
  166. module.show();
  167. module.set.display();
  168. $.proxy(settings.onShow, this)();
  169. }
  170. else {
  171. module.restore.conditions();
  172. }
  173. module.remove.animation();
  174. module.remove.animating();
  175. }
  176. $.proxy(settings.onComplete, this)();
  177. },
  178. has: {
  179. direction: function(animation) {
  180. animation = animation || settings.animation;
  181. if( animation.search(className.inward) !== -1 || animation.search(className.outward) !== -1) {
  182. module.debug('Direction already set in animation');
  183. return true;
  184. }
  185. return false;
  186. },
  187. inlineDisplay: function() {
  188. var
  189. style = $module.attr('style') || ''
  190. ;
  191. return $.isArray(style.match(/display.*?;/, ''));
  192. }
  193. },
  194. set: {
  195. animating: function(animation) {
  196. animation = animation || settings.animation;
  197. if(!module.is.animating()) {
  198. module.save.conditions();
  199. }
  200. module.remove.direction();
  201. module.remove.animationEndCallback();
  202. if(module.can.transition() && !module.has.direction()) {
  203. module.set.direction();
  204. }
  205. module.remove.hidden();
  206. module.set.display();
  207. $module
  208. .addClass(className.animating)
  209. .addClass(className.transition)
  210. .addClass(animation)
  211. .one(animationEnd + '.complete' + eventNamespace, module.complete)
  212. ;
  213. if(settings.useFailSafe) {
  214. module.add.failSafe();
  215. }
  216. module.set.duration(settings.duration);
  217. $.proxy(settings.onStart, this)();
  218. module.debug('Starting tween', animation, $module.attr('class'));
  219. },
  220. duration: function(animationName, duration) {
  221. duration = duration || settings.duration;
  222. duration = (typeof duration == 'number')
  223. ? duration + 'ms'
  224. : duration
  225. ;
  226. module.verbose('Setting animation duration', duration);
  227. $module
  228. .css({
  229. '-webkit-animation-duration': duration,
  230. '-moz-animation-duration': duration,
  231. '-ms-animation-duration': duration,
  232. '-o-animation-duration': duration,
  233. 'animation-duration': duration
  234. })
  235. ;
  236. },
  237. display: function() {
  238. var
  239. style = module.get.style(),
  240. displayType = module.get.displayType(),
  241. overrideStyle = style + 'display: ' + displayType + ' !important;'
  242. ;
  243. $module.css('display', '');
  244. module.refresh();
  245. if( $module.css('display') !== displayType ) {
  246. module.verbose('Setting inline visibility to', displayType);
  247. $module
  248. .attr('style', overrideStyle)
  249. ;
  250. }
  251. },
  252. direction: function() {
  253. if($module.is(':visible') && !module.is.hidden()) {
  254. module.debug('Automatically determining the direction of animation', 'Outward');
  255. $module
  256. .removeClass(className.inward)
  257. .addClass(className.outward)
  258. ;
  259. }
  260. else {
  261. module.debug('Automatically determining the direction of animation', 'Inward');
  262. $module
  263. .removeClass(className.outward)
  264. .addClass(className.inward)
  265. ;
  266. }
  267. },
  268. looping: function() {
  269. module.debug('Transition set to loop');
  270. $module
  271. .addClass(className.looping)
  272. ;
  273. },
  274. hidden: function() {
  275. if(!module.is.hidden()) {
  276. $module
  277. .addClass(className.transition)
  278. .addClass(className.hidden)
  279. ;
  280. if($module.css('display') !== 'none') {
  281. module.verbose('Overriding default display to hide element');
  282. $module
  283. .css('display', 'none')
  284. ;
  285. }
  286. }
  287. },
  288. visible: function() {
  289. $module
  290. .addClass(className.transition)
  291. .addClass(className.visible)
  292. ;
  293. }
  294. },
  295. save: {
  296. displayType: function(displayType) {
  297. $module.data(metadata.displayType, displayType);
  298. },
  299. transitionExists: function(animation, exists) {
  300. $.fn.transition.exists[animation] = exists;
  301. module.verbose('Saving existence of transition', animation, exists);
  302. },
  303. conditions: function() {
  304. var
  305. clasName = $module.attr('class') || false,
  306. style = $module.attr('style') || ''
  307. ;
  308. $module.removeClass(settings.animation);
  309. module.remove.direction();
  310. module.cache = {
  311. className : $module.attr('class'),
  312. style : module.get.style()
  313. };
  314. module.verbose('Saving original attributes', module.cache);
  315. }
  316. },
  317. restore: {
  318. conditions: function() {
  319. if(module.cache === undefined) {
  320. return false;
  321. }
  322. if(module.cache.className) {
  323. $module.attr('class', module.cache.className);
  324. }
  325. else {
  326. $module.removeAttr('class');
  327. }
  328. if(module.cache.style) {
  329. module.verbose('Restoring original style attribute', module.cache.style);
  330. $module.attr('style', module.cache.style);
  331. }
  332. if(module.is.looping()) {
  333. module.remove.looping();
  334. }
  335. module.verbose('Restoring original attributes', module.cache);
  336. }
  337. },
  338. add: {
  339. failSafe: function() {
  340. var
  341. duration = module.get.duration()
  342. ;
  343. module.timer = setTimeout(module.complete, duration + 100);
  344. module.verbose('Adding fail safe timer', module.timer);
  345. }
  346. },
  347. remove: {
  348. animating: function() {
  349. $module.removeClass(className.animating);
  350. },
  351. animation: function() {
  352. $module
  353. .css({
  354. '-webkit-animation' : '',
  355. '-moz-animation' : '',
  356. '-ms-animation' : '',
  357. '-o-animation' : '',
  358. 'animation' : ''
  359. })
  360. ;
  361. },
  362. animationEndCallback: function() {
  363. $module.off('.complete');
  364. },
  365. display: function() {
  366. $module.css('display', '');
  367. },
  368. direction: function() {
  369. $module
  370. .removeClass(className.inward)
  371. .removeClass(className.outward)
  372. ;
  373. },
  374. failSafe: function() {
  375. module.verbose('Removing fail safe timer', module.timer);
  376. if(module.timer) {
  377. clearTimeout(module.timer);
  378. }
  379. },
  380. hidden: function() {
  381. $module.removeClass(className.hidden);
  382. },
  383. visible: function() {
  384. $module.removeClass(className.visible);
  385. },
  386. looping: function() {
  387. module.debug('Transitions are no longer looping');
  388. $module
  389. .removeClass(className.looping)
  390. ;
  391. module.forceRepaint();
  392. },
  393. transition: function() {
  394. $module
  395. .removeClass(className.visible)
  396. .removeClass(className.hidden)
  397. ;
  398. }
  399. },
  400. get: {
  401. settings: function(animation, duration, onComplete) {
  402. // single settings object
  403. if(typeof animation == 'object') {
  404. return $.extend(true, {}, $.fn.transition.settings, animation);
  405. }
  406. // all arguments provided
  407. else if(typeof onComplete == 'function') {
  408. return $.extend({}, $.fn.transition.settings, {
  409. animation : animation,
  410. onComplete : onComplete,
  411. duration : duration
  412. });
  413. }
  414. // only duration provided
  415. else if(typeof duration == 'string' || typeof duration == 'number') {
  416. return $.extend({}, $.fn.transition.settings, {
  417. animation : animation,
  418. duration : duration
  419. });
  420. }
  421. // duration is actually settings object
  422. else if(typeof duration == 'object') {
  423. return $.extend({}, $.fn.transition.settings, duration, {
  424. animation : animation
  425. });
  426. }
  427. // duration is actually callback
  428. else if(typeof duration == 'function') {
  429. return $.extend({}, $.fn.transition.settings, {
  430. animation : animation,
  431. onComplete : duration
  432. });
  433. }
  434. // only animation provided
  435. else {
  436. return $.extend({}, $.fn.transition.settings, {
  437. animation : animation
  438. });
  439. }
  440. return $.fn.transition.settings;
  441. },
  442. duration: function(duration) {
  443. duration = duration || settings.duration;
  444. return (typeof settings.duration === 'string')
  445. ? (duration.indexOf('ms') > -1)
  446. ? parseFloat(duration)
  447. : parseFloat(duration) * 1000
  448. : duration
  449. ;
  450. },
  451. displayType: function() {
  452. if(settings.displayType) {
  453. return settings.displayType;
  454. }
  455. if($module.data(metadata.displayType) === undefined) {
  456. // create fake element to determine display state
  457. module.can.transition(true);
  458. }
  459. return $module.data(metadata.displayType);
  460. },
  461. style: function() {
  462. var
  463. style = $module.attr('style') || ''
  464. ;
  465. return style.replace(/display.*?;/, '');
  466. },
  467. transitionExists: function(animation) {
  468. return $.fn.transition.exists[animation];
  469. },
  470. animationName: function() {
  471. var
  472. element = document.createElement('div'),
  473. animations = {
  474. 'animation' :'animationName',
  475. 'OAnimation' :'oAnimationName',
  476. 'MozAnimation' :'mozAnimationName',
  477. 'WebkitAnimation' :'webkitAnimationName'
  478. },
  479. animation
  480. ;
  481. for(animation in animations){
  482. if( element.style[animation] !== undefined ){
  483. return animations[animation];
  484. }
  485. }
  486. return false;
  487. },
  488. animationStartEvent: function() {
  489. var
  490. element = document.createElement('div'),
  491. animations = {
  492. 'animation' :'animationstart',
  493. 'OAnimation' :'oAnimationStart',
  494. 'MozAnimation' :'mozAnimationStart',
  495. 'WebkitAnimation' :'webkitAnimationStart'
  496. },
  497. animation
  498. ;
  499. for(animation in animations){
  500. if( element.style[animation] !== undefined ){
  501. return animations[animation];
  502. }
  503. }
  504. return false;
  505. },
  506. animationEndEvent: function() {
  507. var
  508. element = document.createElement('div'),
  509. animations = {
  510. 'animation' :'animationend',
  511. 'OAnimation' :'oAnimationEnd',
  512. 'MozAnimation' :'mozAnimationEnd',
  513. 'WebkitAnimation' :'webkitAnimationEnd'
  514. },
  515. animation
  516. ;
  517. for(animation in animations){
  518. if( element.style[animation] !== undefined ){
  519. return animations[animation];
  520. }
  521. }
  522. return false;
  523. }
  524. },
  525. can: {
  526. transition: function(forced) {
  527. var
  528. elementClass = $module.attr('class'),
  529. tagName = $module.prop('tagName'),
  530. animation = settings.animation,
  531. transitionExists = module.get.transitionExists(animation),
  532. $clone,
  533. currentAnimation,
  534. inAnimation,
  535. directionExists,
  536. displayType
  537. ;
  538. if( transitionExists === undefined || forced) {
  539. module.verbose('Determining whether animation exists');
  540. $clone = $('<' + tagName + ' />').addClass( elementClass ).insertAfter($module);
  541. currentAnimation = $clone
  542. .addClass(animation)
  543. .removeClass(className.inward)
  544. .removeClass(className.outward)
  545. .addClass(className.animating)
  546. .addClass(className.transition)
  547. .css(animationName)
  548. ;
  549. inAnimation = $clone
  550. .addClass(className.inward)
  551. .css(animationName)
  552. ;
  553. displayType = $clone
  554. .attr('class', elementClass)
  555. .removeAttr('style')
  556. .removeClass(className.hidden)
  557. .removeClass(className.visible)
  558. .show()
  559. .css('display')
  560. ;
  561. module.verbose('Determining final display state', displayType);
  562. $clone.remove();
  563. if(currentAnimation != inAnimation) {
  564. module.debug('Direction exists for animation', animation);
  565. directionExists = true;
  566. }
  567. else if(currentAnimation == 'none' || !currentAnimation) {
  568. module.debug('No animation defined in css', animation);
  569. return;
  570. }
  571. else {
  572. module.debug('Static animation found', animation, displayType);
  573. directionExists = false;
  574. }
  575. module.save.displayType(displayType);
  576. module.save.transitionExists(animation, directionExists);
  577. }
  578. return (transitionExists !== undefined)
  579. ? transitionExists
  580. : directionExists
  581. ;
  582. },
  583. animate: function() {
  584. // can transition does not return a value if animation does not exist
  585. return (module.can.transition() !== undefined);
  586. }
  587. },
  588. is: {
  589. animating: function() {
  590. return $module.hasClass(className.animating);
  591. },
  592. inward: function() {
  593. return $module.hasClass(className.inward);
  594. },
  595. outward: function() {
  596. return $module.hasClass(className.outward);
  597. },
  598. looping: function() {
  599. return $module.hasClass(className.looping);
  600. },
  601. occuring: function(animation) {
  602. animation = animation || settings.animation;
  603. animation = animation.replace(' ', '.');
  604. return ( $module.filter(animation).size() > 0 );
  605. },
  606. visible: function() {
  607. return $module.is(':visible');
  608. },
  609. hidden: function() {
  610. return $module.css('visibility') === 'hidden';
  611. },
  612. supported: function() {
  613. return(animationName !== false && animationEnd !== false);
  614. }
  615. },
  616. hide: function() {
  617. module.verbose('Hiding element');
  618. if( module.is.animating() ) {
  619. module.reset();
  620. }
  621. module.remove.display();
  622. module.remove.visible();
  623. module.set.hidden();
  624. module.repaint();
  625. },
  626. show: function(display) {
  627. module.verbose('Showing element', display);
  628. module.remove.hidden();
  629. module.set.visible();
  630. module.repaint();
  631. },
  632. start: function() {
  633. module.verbose('Starting animation');
  634. $module.removeClass(className.disabled);
  635. },
  636. stop: function() {
  637. module.debug('Stopping animation');
  638. $module.addClass(className.disabled);
  639. },
  640. toggle: function() {
  641. module.debug('Toggling play status');
  642. $module.toggleClass(className.disabled);
  643. },
  644. setting: function(name, value) {
  645. module.debug('Changing setting', name, value);
  646. if( $.isPlainObject(name) ) {
  647. $.extend(true, settings, name);
  648. }
  649. else if(value !== undefined) {
  650. settings[name] = value;
  651. }
  652. else {
  653. return settings[name];
  654. }
  655. },
  656. internal: function(name, value) {
  657. if( $.isPlainObject(name) ) {
  658. $.extend(true, module, name);
  659. }
  660. else if(value !== undefined) {
  661. module[name] = value;
  662. }
  663. else {
  664. return module[name];
  665. }
  666. },
  667. debug: function() {
  668. if(settings.debug) {
  669. if(settings.performance) {
  670. module.performance.log(arguments);
  671. }
  672. else {
  673. module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
  674. module.debug.apply(console, arguments);
  675. }
  676. }
  677. },
  678. verbose: function() {
  679. if(settings.verbose && settings.debug) {
  680. if(settings.performance) {
  681. module.performance.log(arguments);
  682. }
  683. else {
  684. module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
  685. module.verbose.apply(console, arguments);
  686. }
  687. }
  688. },
  689. error: function() {
  690. module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
  691. module.error.apply(console, arguments);
  692. },
  693. performance: {
  694. log: function(message) {
  695. var
  696. currentTime,
  697. executionTime,
  698. previousTime
  699. ;
  700. if(settings.performance) {
  701. currentTime = new Date().getTime();
  702. previousTime = time || currentTime;
  703. executionTime = currentTime - previousTime;
  704. time = currentTime;
  705. performance.push({
  706. 'Name' : message[0],
  707. 'Arguments' : [].slice.call(message, 1) || '',
  708. 'Element' : element,
  709. 'Execution Time' : executionTime
  710. });
  711. }
  712. clearTimeout(module.performance.timer);
  713. module.performance.timer = setTimeout(module.performance.display, 600);
  714. },
  715. display: function() {
  716. var
  717. title = settings.name + ':',
  718. totalTime = 0
  719. ;
  720. time = false;
  721. clearTimeout(module.performance.timer);
  722. $.each(performance, function(index, data) {
  723. totalTime += data['Execution Time'];
  724. });
  725. title += ' ' + totalTime + 'ms';
  726. if(moduleSelector) {
  727. title += ' \'' + moduleSelector + '\'';
  728. }
  729. if($allModules.size() > 1) {
  730. title += ' ' + '(' + $allModules.size() + ')';
  731. }
  732. if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
  733. console.groupCollapsed(title);
  734. if(console.table) {
  735. console.table(performance);
  736. }
  737. else {
  738. $.each(performance, function(index, data) {
  739. console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
  740. });
  741. }
  742. console.groupEnd();
  743. }
  744. performance = [];
  745. }
  746. },
  747. // modified for transition to return invoke success
  748. invoke: function(query, passedArguments, context) {
  749. var
  750. object = instance,
  751. maxDepth,
  752. found,
  753. response
  754. ;
  755. passedArguments = passedArguments || queryArguments;
  756. context = element || context;
  757. if(typeof query == 'string' && object !== undefined) {
  758. query = query.split(/[\. ]/);
  759. maxDepth = query.length - 1;
  760. $.each(query, function(depth, value) {
  761. var camelCaseValue = (depth != maxDepth)
  762. ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
  763. : query
  764. ;
  765. if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
  766. object = object[camelCaseValue];
  767. }
  768. else if( object[camelCaseValue] !== undefined ) {
  769. found = object[camelCaseValue];
  770. return false;
  771. }
  772. else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
  773. object = object[value];
  774. }
  775. else if( object[value] !== undefined ) {
  776. found = object[value];
  777. return false;
  778. }
  779. else {
  780. return false;
  781. }
  782. });
  783. }
  784. if ( $.isFunction( found ) ) {
  785. response = found.apply(context, passedArguments);
  786. }
  787. else if(found !== undefined) {
  788. response = found;
  789. }
  790. if($.isArray(returnedValue)) {
  791. returnedValue.push(response);
  792. }
  793. else if(returnedValue !== undefined) {
  794. returnedValue = [returnedValue, response];
  795. }
  796. else if(response !== undefined) {
  797. returnedValue = response;
  798. }
  799. return (found !== undefined)
  800. ? found
  801. : false
  802. ;
  803. }
  804. };
  805. module.initialize();
  806. })
  807. ;
  808. return (returnedValue !== undefined)
  809. ? returnedValue
  810. : this
  811. ;
  812. };
  813. // Records if CSS transition is available
  814. $.fn.transition.exists = {};
  815. $.fn.transition.settings = {
  816. // module info
  817. name : 'Transition',
  818. // debug content outputted to console
  819. debug : false,
  820. // verbose debug output
  821. verbose : true,
  822. // performance data output
  823. performance : true,
  824. // event namespace
  825. namespace : 'transition',
  826. // animation complete event
  827. onStart : function() {},
  828. onComplete : function() {},
  829. onShow : function() {},
  830. onHide : function() {},
  831. // whether timeout should be used to ensure callback fires in cases animationend does not
  832. useFailSafe : false,
  833. // whether EXACT animation can occur twice in a row
  834. allowRepeats : false,
  835. // Override final display type on visible
  836. displayType : false,
  837. // animation duration
  838. animation : 'fade',
  839. duration : '500ms',
  840. // new animations will occur after previous ones
  841. queue : true,
  842. metadata : {
  843. displayType: 'display'
  844. },
  845. className : {
  846. animating : 'animating',
  847. disabled : 'disabled',
  848. hidden : 'hidden',
  849. inward : 'in',
  850. loading : 'loading',
  851. looping : 'looping',
  852. outward : 'out',
  853. transition : 'transition',
  854. visible : 'visible'
  855. },
  856. // possible errors
  857. error: {
  858. noAnimation : 'There is no css animation matching the one you specified.',
  859. repeated : 'That animation is already occurring, cancelling repeated animation',
  860. method : 'The method you called is not defined',
  861. support : 'This browser does not support CSS animations'
  862. }
  863. };
  864. })( jQuery, window , document );