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.

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