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.

1001 lines
32 KiB

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