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.

811 lines
25 KiB

11 years ago
Merge branch 'css' of github.com:Semantic-Org/Semantic-UI into css Conflicts: build/less/elements/basic.icon.less build/less/elements/button.less build/less/elements/icon.less build/less/elements/segment.less build/less/themes/basic/elements/icon.overrides build/minified/collections/breadcrumb.min.css build/minified/collections/form.min.css build/minified/collections/grid.min.css build/minified/collections/menu.min.css build/minified/collections/message.min.css build/minified/collections/table.min.css build/minified/elements/basic.icon.min.css build/minified/elements/button.min.css build/minified/elements/divider.min.css build/minified/elements/header.min.css build/minified/elements/icon.min.css build/minified/elements/image.min.css build/minified/elements/input.min.css build/minified/elements/label.min.css build/minified/elements/loader.min.css build/minified/elements/progress.min.css build/minified/elements/reveal.min.css build/minified/elements/segment.min.css build/minified/elements/step.min.css build/minified/modules/accordion.min.css build/minified/modules/chatroom.min.css build/minified/modules/checkbox.min.css build/minified/modules/dimmer.min.css build/minified/modules/dropdown.min.css build/minified/modules/modal.min.css build/minified/modules/nag.min.css build/minified/modules/popup.min.css build/minified/modules/rating.min.css build/minified/modules/search.min.css build/minified/modules/shape.min.css build/minified/modules/sidebar.min.css build/minified/modules/tab.min.css build/minified/modules/transition.min.css build/minified/modules/video.min.css build/minified/views/comment.min.css build/minified/views/feed.min.css build/minified/views/item.min.css build/minified/views/list.min.css build/minified/views/statistic.min.css build/packaged/css/semantic.css build/packaged/css/semantic.min.css build/packaged/javascript/semantic.min.js build/uncompressed/elements/basic.icon.css build/uncompressed/elements/button.css build/uncompressed/elements/icon.css build/uncompressed/elements/segment.css rtl/less/elements/basic.icon.less rtl/less/elements/button.less rtl/less/elements/icon.less rtl/less/elements/segment.less rtl/minified/collections/breadcrumb.min.css rtl/minified/collections/form.min.css rtl/minified/collections/grid.min.css rtl/minified/collections/menu.min.css rtl/minified/collections/message.min.css rtl/minified/collections/table.min.css rtl/minified/elements/basic.icon.min.css rtl/minified/elements/button.min.css rtl/minified/elements/divider.min.css rtl/minified/elements/header.min.css rtl/minified/elements/icon.min.css rtl/minified/elements/image.min.css rtl/minified/elements/input.min.css rtl/minified/elements/label.min.css rtl/minified/elements/loader.min.css rtl/minified/elements/progress.min.css rtl/minified/elements/reveal.min.css rtl/minified/elements/segment.min.css rtl/minified/elements/step.min.css rtl/minified/modules/accordion.min.css rtl/minified/modules/chatroom.min.css rtl/minified/modules/checkbox.min.css rtl/minified/modules/dimmer.min.css rtl/minified/modules/dropdown.min.css rtl/minified/modules/modal.min.css rtl/minified/modules/nag.min.css rtl/minified/modules/popup.min.css rtl/minified/modules/rating.min.css rtl/minified/modules/search.min.css rtl/minified/modules/shape.min.css rtl/minified/modules/sidebar.min.css rtl/minified/modules/tab.min.css rtl/minified/modules/transition.min.css rtl/minified/modules/video.min.css rtl/minified/views/comment.min.css rtl/minified/views/feed.min.css rtl/minified/views/item.min.css rtl/minified/views/list.min.css rtl/minified/views/statistic.min.css rtl/packaged/css/semantic.css rtl/packaged/css/semantic.min.css rtl/packaged/javascript/semantic.min.js rtl/uncompressed/elements/basic.icon.css rtl/uncompressed/elements/button.css rtl/uncompressed/elements/icon.css rtl/uncompressed/elements/segment.css src/elements/icon.less
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
Merge branch 'css' of github.com:Semantic-Org/Semantic-UI into css Conflicts: build/less/elements/basic.icon.less build/less/elements/button.less build/less/elements/icon.less build/less/elements/segment.less build/less/themes/basic/elements/icon.overrides build/minified/collections/breadcrumb.min.css build/minified/collections/form.min.css build/minified/collections/grid.min.css build/minified/collections/menu.min.css build/minified/collections/message.min.css build/minified/collections/table.min.css build/minified/elements/basic.icon.min.css build/minified/elements/button.min.css build/minified/elements/divider.min.css build/minified/elements/header.min.css build/minified/elements/icon.min.css build/minified/elements/image.min.css build/minified/elements/input.min.css build/minified/elements/label.min.css build/minified/elements/loader.min.css build/minified/elements/progress.min.css build/minified/elements/reveal.min.css build/minified/elements/segment.min.css build/minified/elements/step.min.css build/minified/modules/accordion.min.css build/minified/modules/chatroom.min.css build/minified/modules/checkbox.min.css build/minified/modules/dimmer.min.css build/minified/modules/dropdown.min.css build/minified/modules/modal.min.css build/minified/modules/nag.min.css build/minified/modules/popup.min.css build/minified/modules/rating.min.css build/minified/modules/search.min.css build/minified/modules/shape.min.css build/minified/modules/sidebar.min.css build/minified/modules/tab.min.css build/minified/modules/transition.min.css build/minified/modules/video.min.css build/minified/views/comment.min.css build/minified/views/feed.min.css build/minified/views/item.min.css build/minified/views/list.min.css build/minified/views/statistic.min.css build/packaged/css/semantic.css build/packaged/css/semantic.min.css build/packaged/javascript/semantic.min.js build/uncompressed/elements/basic.icon.css build/uncompressed/elements/button.css build/uncompressed/elements/icon.css build/uncompressed/elements/segment.css rtl/less/elements/basic.icon.less rtl/less/elements/button.less rtl/less/elements/icon.less rtl/less/elements/segment.less rtl/minified/collections/breadcrumb.min.css rtl/minified/collections/form.min.css rtl/minified/collections/grid.min.css rtl/minified/collections/menu.min.css rtl/minified/collections/message.min.css rtl/minified/collections/table.min.css rtl/minified/elements/basic.icon.min.css rtl/minified/elements/button.min.css rtl/minified/elements/divider.min.css rtl/minified/elements/header.min.css rtl/minified/elements/icon.min.css rtl/minified/elements/image.min.css rtl/minified/elements/input.min.css rtl/minified/elements/label.min.css rtl/minified/elements/loader.min.css rtl/minified/elements/progress.min.css rtl/minified/elements/reveal.min.css rtl/minified/elements/segment.min.css rtl/minified/elements/step.min.css rtl/minified/modules/accordion.min.css rtl/minified/modules/chatroom.min.css rtl/minified/modules/checkbox.min.css rtl/minified/modules/dimmer.min.css rtl/minified/modules/dropdown.min.css rtl/minified/modules/modal.min.css rtl/minified/modules/nag.min.css rtl/minified/modules/popup.min.css rtl/minified/modules/rating.min.css rtl/minified/modules/search.min.css rtl/minified/modules/shape.min.css rtl/minified/modules/sidebar.min.css rtl/minified/modules/tab.min.css rtl/minified/modules/transition.min.css rtl/minified/modules/video.min.css rtl/minified/views/comment.min.css rtl/minified/views/feed.min.css rtl/minified/views/item.min.css rtl/minified/views/list.min.css rtl/minified/views/statistic.min.css rtl/packaged/css/semantic.css rtl/packaged/css/semantic.min.css rtl/packaged/javascript/semantic.min.js rtl/uncompressed/elements/basic.icon.css rtl/uncompressed/elements/button.css rtl/uncompressed/elements/icon.css rtl/uncompressed/elements/segment.css src/elements/icon.less
11 years ago
  1. /*
  2. * # Semantic - Transition
  3. * http://github.com/jlukic/semantic-ui/
  4. *
  5. *
  6. * Copyright 2013 Contributors
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. */
  11. ;(function ( $, window, document, undefined ) {
  12. $.fn.transition = function() {
  13. var
  14. $allModules = $(this),
  15. moduleSelector = $allModules.selector || '',
  16. time = new Date().getTime(),
  17. performance = [],
  18. moduleArguments = arguments,
  19. query = moduleArguments[0],
  20. queryArguments = [].slice.call(arguments, 1),
  21. methodInvoked = (typeof query === 'string'),
  22. requestAnimationFrame = window.requestAnimationFrame
  23. || window.mozRequestAnimationFrame
  24. || window.webkitRequestAnimationFrame
  25. || window.msRequestAnimationFrame
  26. || function(callback) { setTimeout(callback, 0); },
  27. returnedValue
  28. ;
  29. $allModules
  30. .each(function() {
  31. var
  32. $module = $(this),
  33. element = this,
  34. // set at run time
  35. settings,
  36. instance,
  37. error,
  38. className,
  39. metadata,
  40. animationEnd,
  41. animationName,
  42. namespace,
  43. moduleNamespace,
  44. module
  45. ;
  46. module = {
  47. initialize: function() {
  48. // get settings
  49. settings = module.get.settings.apply(element, moduleArguments);
  50. module.verbose('Converted arguments into settings object', settings);
  51. // set shortcuts
  52. error = settings.error;
  53. className = settings.className;
  54. namespace = settings.namespace;
  55. metadata = settings.metadata;
  56. moduleNamespace = 'module-' + namespace;
  57. animationEnd = module.get.animationEvent();
  58. animationName = module.get.animationName();
  59. instance = $module.data(moduleNamespace) || module;
  60. if(methodInvoked) {
  61. methodInvoked = module.invoke(query);
  62. }
  63. // no internal method was found matching query or query not made
  64. if(methodInvoked === false) {
  65. module.animate();
  66. }
  67. module.instantiate();
  68. },
  69. instantiate: function() {
  70. module.verbose('Storing instance of module', module);
  71. $module
  72. .data(moduleNamespace, instance)
  73. ;
  74. },
  75. destroy: function() {
  76. module.verbose('Destroying previous module for', element);
  77. $module
  78. .removeData(moduleNamespace)
  79. ;
  80. },
  81. refresh: function() {
  82. module.verbose('Refreshing display type on next animation');
  83. delete instance.displayType;
  84. },
  85. forceRepaint: function() {
  86. module.verbose('Forcing element repaint');
  87. var
  88. $parentElement = $module.parent(),
  89. $nextElement = $module.next()
  90. ;
  91. if($nextElement.size() === 0) {
  92. $module.detach().appendTo($parentElement);
  93. }
  94. else {
  95. $module.detach().insertBefore($nextElement);
  96. }
  97. },
  98. repaint: function() {
  99. module.verbose('Repainting element');
  100. var
  101. fakeAssignment = element.offsetWidth
  102. ;
  103. },
  104. animate: function(overrideSettings) {
  105. settings = overrideSettings || settings;
  106. if(!module.is.supported()) {
  107. module.error(error.support);
  108. return false;
  109. }
  110. module.debug('Preparing animation', settings.animation);
  111. if(module.is.animating() && settings.queue) {
  112. if(!settings.allowRepeats && module.has.direction() && module.is.occuring() && instance.queuing !== true) {
  113. module.error(error.repeated);
  114. }
  115. else {
  116. module.queue(settings.animation);
  117. }
  118. return false;
  119. }
  120. if(module.can.animate) {
  121. module.set.animating(settings.animation);
  122. }
  123. else {
  124. module.error(error.noAnimation, settings.animation);
  125. }
  126. },
  127. reset: function() {
  128. module.debug('Resetting animation to beginning conditions');
  129. module.restore.conditions();
  130. module.hide();
  131. module.remove.animating();
  132. },
  133. queue: function(animation) {
  134. module.debug('Queueing animation of', animation);
  135. instance.queuing = true;
  136. $module
  137. .one(animationEnd, function() {
  138. instance.queuing = false;
  139. module.repaint();
  140. module.animate.apply(this, settings);
  141. })
  142. ;
  143. },
  144. complete: function () {
  145. module.verbose('CSS animation complete', settings.animation);
  146. if(!module.is.looping()) {
  147. if( module.is.outward() ) {
  148. module.verbose('Animation is outward, hiding element');
  149. module.restore.conditions();
  150. module.remove.display();
  151. module.hide();
  152. $.proxy(settings.onHide, this)();
  153. }
  154. else if( module.is.inward() ) {
  155. module.verbose('Animation is outward, showing element');
  156. module.restore.conditions();
  157. module.show();
  158. $.proxy(settings.onShow, this)();
  159. }
  160. else {
  161. module.restore.conditions();
  162. }
  163. module.remove.duration();
  164. module.remove.animating();
  165. }
  166. $.proxy(settings.complete, this)();
  167. },
  168. has: {
  169. direction: function(animation) {
  170. animation = animation || settings.animation;
  171. if( animation.search(className.inward) !== -1 || animation.search(className.outward) !== -1) {
  172. module.debug('Direction already set in animation');
  173. return true;
  174. }
  175. return false;
  176. }
  177. },
  178. set: {
  179. animating: function(animation) {
  180. animation = animation || settings.animation;
  181. module.save.conditions();
  182. if(module.can.transition() && !module.has.direction()) {
  183. module.set.direction();
  184. }
  185. module.remove.hidden();
  186. module.set.display();
  187. $module
  188. .addClass(className.animating)
  189. .addClass(className.transition)
  190. .addClass(animation)
  191. .one(animationEnd, module.complete)
  192. ;
  193. module.set.duration(settings.duration);
  194. module.debug('Starting tween', settings.animation, $module.attr('class'));
  195. },
  196. display: function() {
  197. var
  198. displayType = module.get.displayType()
  199. ;
  200. if(displayType !== 'block') {
  201. module.verbose('Setting final visibility to', displayType);
  202. $module
  203. .css({
  204. display: displayType
  205. })
  206. ;
  207. }
  208. },
  209. direction: function() {
  210. if($module.is(':visible')) {
  211. module.debug('Automatically determining the direction of animation', 'Outward');
  212. $module
  213. .removeClass(className.inward)
  214. .addClass(className.outward)
  215. ;
  216. }
  217. else {
  218. module.debug('Automatically determining the direction of animation', 'Inward');
  219. $module
  220. .removeClass(className.outward)
  221. .addClass(className.inward)
  222. ;
  223. }
  224. },
  225. looping: function() {
  226. module.debug('Transition set to loop');
  227. $module
  228. .addClass(className.looping)
  229. ;
  230. },
  231. duration: function(duration) {
  232. duration = duration || settings.duration;
  233. duration = (typeof duration == 'number')
  234. ? duration + 'ms'
  235. : duration
  236. ;
  237. module.verbose('Setting animation duration', duration);
  238. $module
  239. .css({
  240. '-webkit-animation-duration': duration,
  241. '-moz-animation-duration': duration,
  242. '-ms-animation-duration': duration,
  243. '-o-animation-duration': duration,
  244. 'animation-duration': duration
  245. })
  246. ;
  247. },
  248. hidden: function() {
  249. $module
  250. .addClass(className.transition)
  251. .addClass(className.hidden)
  252. ;
  253. },
  254. visible: function() {
  255. $module
  256. .addClass(className.transition)
  257. .addClass(className.visible)
  258. ;
  259. }
  260. },
  261. save: {
  262. displayType: function(displayType) {
  263. instance.displayType = displayType;
  264. },
  265. transitionExists: function(animation, exists) {
  266. $.fn.transition.exists[animation] = exists;
  267. module.verbose('Saving existence of transition', animation, exists);
  268. },
  269. conditions: function() {
  270. instance.cache = {
  271. className : $module.attr('class'),
  272. style : $module.attr('style')
  273. };
  274. module.verbose('Saving original attributes', instance.cache);
  275. }
  276. },
  277. restore: {
  278. conditions: function() {
  279. if(instance.cache === undefined) {
  280. return false;
  281. }
  282. if(instance.cache.className) {
  283. $module.attr('class', instance.cache.className);
  284. }
  285. else {
  286. $module.removeAttr('class');
  287. }
  288. if(instance.cache.style) {
  289. $module.attr('style', instance.cache.style);
  290. }
  291. else {
  292. if(module.get.displayType() === 'block') {
  293. $module.removeAttr('style');
  294. }
  295. }
  296. if(module.is.looping()) {
  297. module.remove.looping();
  298. }
  299. module.verbose('Restoring original attributes', instance.cache);
  300. }
  301. },
  302. remove: {
  303. animating: function() {
  304. $module.removeClass(className.animating);
  305. },
  306. display: function() {
  307. if(instance.displayType !== undefined) {
  308. $module.css('display', '');
  309. }
  310. },
  311. duration: function() {
  312. $module
  313. .css({
  314. '-webkit-animation-duration' : '',
  315. '-moz-animation-duration' : '',
  316. '-ms-animation-duration' : '',
  317. '-o-animation-duration' : '',
  318. 'animation-duration' : ''
  319. })
  320. ;
  321. },
  322. hidden: function() {
  323. $module.removeClass(className.hidden);
  324. },
  325. visible: function() {
  326. $module.removeClass(className.visible);
  327. },
  328. looping: function() {
  329. module.debug('Transitions are no longer looping');
  330. $module
  331. .removeClass(className.looping)
  332. ;
  333. module.forceRepaint();
  334. }
  335. },
  336. get: {
  337. settings: function(animation, duration, complete) {
  338. // single settings object
  339. if(typeof animation == 'object') {
  340. return $.extend(true, {}, $.fn.transition.settings, animation);
  341. }
  342. // all arguments provided
  343. else if(typeof complete == 'function') {
  344. return $.extend({}, $.fn.transition.settings, {
  345. animation : animation,
  346. complete : complete,
  347. duration : duration
  348. });
  349. }
  350. // only duration provided
  351. else if(typeof duration == 'string' || typeof duration == 'number') {
  352. return $.extend({}, $.fn.transition.settings, {
  353. animation : animation,
  354. duration : duration
  355. });
  356. }
  357. // duration is actually settings object
  358. else if(typeof duration == 'object') {
  359. return $.extend({}, $.fn.transition.settings, duration, {
  360. animation : animation
  361. });
  362. }
  363. // duration is actually callback
  364. else if(typeof duration == 'function') {
  365. return $.extend({}, $.fn.transition.settings, {
  366. animation : animation,
  367. complete : duration
  368. });
  369. }
  370. // only animation provided
  371. else {
  372. return $.extend({}, $.fn.transition.settings, {
  373. animation : animation
  374. });
  375. }
  376. return $.fn.transition.settings;
  377. },
  378. displayType: function() {
  379. if(instance.displayType === undefined) {
  380. // create fake element to determine display state
  381. module.can.transition();
  382. }
  383. return instance.displayType;
  384. },
  385. transitionExists: function(animation) {
  386. return $.fn.transition.exists[animation];
  387. },
  388. animationName: function() {
  389. var
  390. element = document.createElement('div'),
  391. animations = {
  392. 'animation' :'animationName',
  393. 'OAnimation' :'oAnimationName',
  394. 'MozAnimation' :'mozAnimationName',
  395. 'WebkitAnimation' :'webkitAnimationName'
  396. },
  397. animation
  398. ;
  399. for(animation in animations){
  400. if( element.style[animation] !== undefined ){
  401. module.verbose('Determined animation vendor name property', animations[animation]);
  402. return animations[animation];
  403. }
  404. }
  405. return false;
  406. },
  407. animationEvent: function() {
  408. var
  409. element = document.createElement('div'),
  410. animations = {
  411. 'animation' :'animationend',
  412. 'OAnimation' :'oAnimationEnd',
  413. 'MozAnimation' :'mozAnimationEnd',
  414. 'WebkitAnimation' :'webkitAnimationEnd'
  415. },
  416. animation
  417. ;
  418. for(animation in animations){
  419. if( element.style[animation] !== undefined ){
  420. module.verbose('Determined animation vendor end event', animations[animation]);
  421. return animations[animation];
  422. }
  423. }
  424. return false;
  425. }
  426. },
  427. can: {
  428. animate: function() {
  429. if($module.css(settings.animation) !== 'none') {
  430. module.debug('CSS definition found', $module.css(settings.animation));
  431. return true;
  432. }
  433. else {
  434. module.debug('Unable to find css definition', $module.attr('class'));
  435. return false;
  436. }
  437. },
  438. transition: function() {
  439. var
  440. elementClass = $module.attr('class'),
  441. animation = settings.animation,
  442. transitionExists = module.get.transitionExists(settings.animation),
  443. $clone,
  444. currentAnimation,
  445. inAnimation,
  446. displayType
  447. ;
  448. if( transitionExists === undefined || instance.displayType === undefined) {
  449. module.verbose('Determining whether animation exists');
  450. $clone = $('<div>').addClass( elementClass ).appendTo($('body'));
  451. currentAnimation = $clone
  452. .removeClass(className.inward)
  453. .removeClass(className.outward)
  454. .addClass(className.animating)
  455. .addClass(className.transition)
  456. .addClass(animation)
  457. .css(animationName)
  458. ;
  459. inAnimation = $clone
  460. .addClass(className.inward)
  461. .css(animationName)
  462. ;
  463. displayType = $clone
  464. .attr('class', elementClass)
  465. .show()
  466. .css('display')
  467. ;
  468. module.verbose('Determining final display state', displayType);
  469. if(currentAnimation != inAnimation) {
  470. module.debug('Transition exists for animation', animation);
  471. transitionExists = true;
  472. }
  473. else {
  474. module.debug('Static animation found', animation, displayType);
  475. transitionExists = false;
  476. }
  477. $clone.remove();
  478. module.save.displayType(displayType);
  479. module.save.transitionExists(animation, transitionExists);
  480. }
  481. return transitionExists;
  482. }
  483. },
  484. is: {
  485. animating: function() {
  486. return $module.hasClass(className.animating);
  487. },
  488. inward: function() {
  489. return $module.hasClass(className.inward);
  490. },
  491. outward: function() {
  492. return $module.hasClass(className.outward);
  493. },
  494. looping: function() {
  495. return $module.hasClass(className.looping);
  496. },
  497. occuring: function(animation) {
  498. animation = animation || settings.animation;
  499. return ( $module.hasClass(animation) );
  500. },
  501. visible: function() {
  502. return $module.is(':visible');
  503. },
  504. supported: function() {
  505. return(animationName !== false && animationEnd !== false);
  506. }
  507. },
  508. hide: function() {
  509. module.verbose('Hiding element');
  510. module.remove.visible();
  511. module.set.hidden();
  512. module.repaint();
  513. },
  514. show: function(display) {
  515. module.verbose('Showing element', display);
  516. module.remove.hidden();
  517. module.set.visible();
  518. module.repaint();
  519. },
  520. start: function() {
  521. module.verbose('Starting animation');
  522. $module.removeClass(className.disabled);
  523. },
  524. stop: function() {
  525. module.debug('Stopping animation');
  526. $module.addClass(className.disabled);
  527. },
  528. toggle: function() {
  529. module.debug('Toggling play status');
  530. $module.toggleClass(className.disabled);
  531. },
  532. setting: function(name, value) {
  533. if( $.isPlainObject(name) ) {
  534. $.extend(true, settings, name);
  535. }
  536. else if(value !== undefined) {
  537. settings[name] = value;
  538. }
  539. else {
  540. return settings[name];
  541. }
  542. },
  543. internal: function(name, value) {
  544. if( $.isPlainObject(name) ) {
  545. $.extend(true, module, name);
  546. }
  547. else if(value !== undefined) {
  548. module[name] = value;
  549. }
  550. else {
  551. return module[name];
  552. }
  553. },
  554. debug: function() {
  555. if(settings.debug) {
  556. if(settings.performance) {
  557. module.performance.log(arguments);
  558. }
  559. else {
  560. module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
  561. module.debug.apply(console, arguments);
  562. }
  563. }
  564. },
  565. verbose: function() {
  566. if(settings.verbose && settings.debug) {
  567. if(settings.performance) {
  568. module.performance.log(arguments);
  569. }
  570. else {
  571. module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
  572. module.verbose.apply(console, arguments);
  573. }
  574. }
  575. },
  576. error: function() {
  577. module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
  578. module.error.apply(console, arguments);
  579. },
  580. performance: {
  581. log: function(message) {
  582. var
  583. currentTime,
  584. executionTime,
  585. previousTime
  586. ;
  587. if(settings.performance) {
  588. currentTime = new Date().getTime();
  589. previousTime = time || currentTime;
  590. executionTime = currentTime - previousTime;
  591. time = currentTime;
  592. performance.push({
  593. 'Element' : element,
  594. 'Name' : message[0],
  595. 'Arguments' : [].slice.call(message, 1) || '',
  596. 'Execution Time' : executionTime
  597. });
  598. }
  599. clearTimeout(module.performance.timer);
  600. module.performance.timer = setTimeout(module.performance.display, 100);
  601. },
  602. display: function() {
  603. var
  604. title = settings.name + ':',
  605. totalTime = 0
  606. ;
  607. time = false;
  608. clearTimeout(module.performance.timer);
  609. $.each(performance, function(index, data) {
  610. totalTime += data['Execution Time'];
  611. });
  612. title += ' ' + totalTime + 'ms';
  613. if(moduleSelector) {
  614. title += ' \'' + moduleSelector + '\'';
  615. }
  616. if($allModules.size() > 1) {
  617. title += ' ' + '(' + $allModules.size() + ')';
  618. }
  619. if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
  620. console.groupCollapsed(title);
  621. if(console.table) {
  622. console.table(performance);
  623. }
  624. else {
  625. $.each(performance, function(index, data) {
  626. console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
  627. });
  628. }
  629. console.groupEnd();
  630. }
  631. performance = [];
  632. }
  633. },
  634. invoke: function(query, passedArguments, context) {
  635. var
  636. object = instance,
  637. maxDepth,
  638. found,
  639. response
  640. ;
  641. passedArguments = passedArguments || queryArguments;
  642. context = element || context;
  643. if(typeof query == 'string' && object !== undefined) {
  644. query = query.split(/[\. ]/);
  645. maxDepth = query.length - 1;
  646. $.each(query, function(depth, value) {
  647. var camelCaseValue = (depth != maxDepth)
  648. ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
  649. : query
  650. ;
  651. if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
  652. object = object[camelCaseValue];
  653. }
  654. else if( object[camelCaseValue] !== undefined ) {
  655. found = object[camelCaseValue];
  656. return false;
  657. }
  658. else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
  659. object = object[value];
  660. }
  661. else if( object[value] !== undefined ) {
  662. found = object[value];
  663. return false;
  664. }
  665. else {
  666. return false;
  667. }
  668. });
  669. }
  670. if ( $.isFunction( found ) ) {
  671. response = found.apply(context, passedArguments);
  672. }
  673. else if(found !== undefined) {
  674. response = found;
  675. }
  676. if($.isArray(returnedValue)) {
  677. returnedValue.push(response);
  678. }
  679. else if(returnedValue !== undefined) {
  680. returnedValue = [returnedValue, response];
  681. }
  682. else if(response !== undefined) {
  683. returnedValue = response;
  684. }
  685. return found || false;
  686. }
  687. };
  688. module.initialize();
  689. })
  690. ;
  691. return (returnedValue !== undefined)
  692. ? returnedValue
  693. : this
  694. ;
  695. };
  696. $.fn.transition.exists = {};
  697. $.fn.transition.settings = {
  698. // module info
  699. name : 'Transition',
  700. // debug content outputted to console
  701. debug : true,
  702. // verbose debug output
  703. verbose : true,
  704. // performance data output
  705. performance : true,
  706. // event namespace
  707. namespace : 'transition',
  708. // animation complete event
  709. complete : function() {},
  710. onShow : function() {},
  711. onHide : function() {},
  712. // whether animation can occur twice in a row
  713. allowRepeats : false,
  714. // animation duration
  715. animation : 'fade',
  716. duration : '700ms',
  717. // new animations will occur after previous ones
  718. queue : true,
  719. className : {
  720. animating : 'animating',
  721. disabled : 'disabled',
  722. hidden : 'hidden',
  723. inward : 'in',
  724. loading : 'loading',
  725. looping : 'looping',
  726. outward : 'out',
  727. transition : 'ui transition',
  728. visible : 'visible'
  729. },
  730. // possible errors
  731. error: {
  732. noAnimation : 'There is no css animation matching the one you specified.',
  733. repeated : 'That animation is already occurring, cancelling repeated animation',
  734. method : 'The method you called is not defined',
  735. support : 'This browser does not support CSS animations'
  736. }
  737. };
  738. })( jQuery, window , document );