github.com/fanux/shipyard@v0.0.0-20161009071005-6515ce223235/controller/static/semantic/dist/components/transition.js (about)

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