CaffGeek/MBACNationals

View on GitHub
Web.Admin/Content/galleria/galleria-1.4.2.js

Summary

Maintainability
F
11 mos
Test Coverage

File galleria-1.4.2.js has 4395 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Galleria v 1.4.2 2014-08-07
 * http://galleria.io
 *
 * Licensed under the MIT license
Severity: Major
Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 wk to fix

    Function Utils has 401 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        Utils = (function() {
    
            return {
    
                // legacy support for clearTimer
    Severity: Major
    Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 2 days to fix

      Function _init has 341 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _init: function() {
      
              var self = this,
                  options = this._options;
      
      Severity: Major
      Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 day to fix

        Function Finger has 195 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Galleria.Finger = (function() {
        
            var abs = M.abs;
        
            // test for translate3d support
        Severity: Major
        Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 7 hrs to fix

          Function _show has 182 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _show : function() {
          
                  // shortcuts
                  var self = this,
                      queue = this._queue[ 0 ],
          Severity: Major
          Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 7 hrs to fix

            Function _createThumbnails has 177 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _createThumbnails : function( push ) {
            
                    this.get( 'total' ).innerHTML = this.getDataLength();
            
                    var src,
            Severity: Major
            Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 7 hrs to fix

              Function scale has 152 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  scale: function( options ) {
              
                      var self = this;
              
                      // extend some defaults
              Severity: Major
              Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 6 hrs to fix

                Function init has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    init: function( target, options ) {
                
                        options = _legacyOptions( options );
                
                        // save the original ingredients
                Severity: Major
                Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 5 hrs to fix

                  Function _enter has 136 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          _enter: function( callback ) {
                  
                              fullscreen.active = true;
                  
                              if ( IFRAME ) {
                  Severity: Major
                  Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 5 hrs to fix

                    Function _transitions has 128 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _transitions = (function() {
                    
                            var _slide = function(params, complete, fade, door) {
                    
                                var easing = this.getOptions('easing'),
                    Severity: Major
                    Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 5 hrs to fix

                      Function animate has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  animate : (function() {
                      
                                      // detect transition
                                      var transition = (function( style ) {
                                          var props = 'transition WebkitTransition MozTransition OTransition'.split(' '),
                      Severity: Major
                      Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 4 hrs to fix

                        Function load has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            load: function(src, size, callback) {
                        
                                if ( typeof size == 'function' ) {
                                    callback = size;
                                    size = null;
                        Severity: Major
                        Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 4 hrs to fix

                          Function _run has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              _run : function() {
                          
                                  var self = this;
                          
                                  self._createThumbnails();
                          Severity: Major
                          Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 3 hrs to fix

                            Function init has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    init : function() {
                            
                                        if ( lightbox.initialized ) {
                                            return;
                                        }
                            Severity: Major
                            Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 3 hrs to fix

                              Function complete has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      var complete = (function( data, next, active, queue, thumb ) {
                              
                                          return function() {
                              
                                              var win;
                              Severity: Major
                              Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 3 hrs to fix

                                Function success has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                            success: function() {
                                
                                                // calculate some cropping
                                                var newWidth = ( width - options.margin * 2 ) / self.original.width,
                                                    newHeight = ( height - options.margin * 2 ) / self.original.height,
                                Severity: Major
                                Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 3 hrs to fix

                                  Function show has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          show: function(index) {
                                  
                                              lightbox.active = index = typeof index === 'number' ? index : self.getIndex() || 0;
                                  
                                              if ( !lightbox.initialized ) {
                                  Severity: Major
                                  Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 3 hrs to fix

                                    Function success has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                                success: function() {
                                    
                                                    // save the instance
                                                    _galleries.push( self );
                                    
                                    Severity: Major
                                    Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 3 hrs to fix

                                      Function show has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          show : function( index, rewind, _history ) {
                                      
                                              var swipe = this._options.swipe;
                                      
                                              // do nothing queue is long || index is false || queue is false and transition is in progress
                                      Severity: Major
                                      Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 3 hrs to fix

                                        Function load has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            load : function( source, selector, config ) {
                                        
                                                var self = this,
                                                    o = this._options;
                                        
                                        Severity: Major
                                        Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 2 hrs to fix

                                          Function _parseData has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              _parseData : function( callback ) {
                                          
                                                  var self = this,
                                                      current,
                                                      ready = false,
                                          Severity: Major
                                          Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 2 hrs to fix

                                            Function addPan has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                addPan : function( img ) {
                                            
                                                    if ( this._options.imageCrop === false ) {
                                                        return;
                                                    }
                                            Severity: Major
                                            Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 2 hrs to fix

                                              Function loadCSS has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                          loadCSS : function( href, id, callback ) {
                                              
                                                              var link,
                                                                  length;
                                              
                                              Severity: Major
                                              Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 2 hrs to fix

                                                Function add has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    add: function(handleObj) {
                                                
                                                        var getCoords = function(e) {
                                                            if ( e.touches && e.touches.length ) {
                                                                var touch = e.touches[0];
                                                Severity: Major
                                                Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 2 hrs to fix

                                                  Function Finger has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                      var Finger = function(elem, options) {
                                                  
                                                          // default options
                                                          this.config = {
                                                              start: 0,
                                                  Severity: Major
                                                  Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 2 hrs to fix

                                                    Function _exit has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                            _exit: function( callback ) {
                                                    
                                                                fullscreen.active = false;
                                                    
                                                                var inBrowser = !self._options.trueFullscreen || !_nativeFullscreen.support,
                                                    Severity: Minor
                                                    Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 2 hrs to fix

                                                      Function addTheme has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                      Galleria.addTheme = function( theme ) {
                                                      
                                                          // make sure we have a name
                                                          if ( !theme.name ) {
                                                              Galleria.raise('No theme name specified');
                                                      Severity: Minor
                                                      Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                        Function complete has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                                        complete: function( next ) {
                                                        
                                                                            // toggle low quality for IE
                                                                            if ( 'image' in active ) {
                                                                                Utils.toggleQuality( active.image, false );
                                                        Severity: Minor
                                                        Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                          Function _slide has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                                  var _slide = function(params, complete, fade, door) {
                                                          
                                                                      var easing = this.getOptions('easing'),
                                                                          distance = this.getStageWidth(),
                                                                          from = { left: distance * ( params.rewind ? -1 : 1 ) },
                                                          Severity: Minor
                                                          Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                            Function onThumbLoad has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                                            Open

                                                                        onThumbLoad = function( thumb, callback ) {
                                                            
                                                                            // scale when ready
                                                                            thumb.scale({
                                                                                width:    thumb.data.width,
                                                            Severity: Minor
                                                            Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                              Function onload has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                                              Open

                                                                          onload = (function( self, callback, src ) {
                                                              
                                                                              return function() {
                                                              
                                                                                  var complete = function() {
                                                              Severity: Minor
                                                              Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                Function bind has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                Open

                                                                        bind: function( elem, value ) {
                                                                
                                                                            // todo: revise if alternative tooltip is needed for mobile devices
                                                                            if (Galleria.TOUCH) {
                                                                                return;
                                                                Severity: Minor
                                                                Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                  Function raise has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                  Open

                                                                  Galleria.raise = function( msg, fatal ) {
                                                                  
                                                                      var type = fatal ? 'Fatal error' : 'Error',
                                                                  
                                                                          css = {
                                                                  Severity: Minor
                                                                  Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                    Function _scaleImage has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                    Open

                                                                        _scaleImage : function( image, options ) {
                                                                    
                                                                            image = image || this._controls.getActive();
                                                                    
                                                                            // janpub (JH) fix:
                                                                    Severity: Minor
                                                                    Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                      Function enter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                      Open

                                                                              enter: function( callback ) {
                                                                      
                                                                                  fullscreen.beforeEnter(function() {
                                                                      
                                                                                      callback = fullscreen.parseCallback( callback, true );
                                                                      Severity: Minor
                                                                      Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                        Function rescale has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                        Open

                                                                            rescale : function( width, height, complete ) {
                                                                        
                                                                                var self = this;
                                                                        
                                                                                // allow rescale(fn)
                                                                        Severity: Minor
                                                                        Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                          Function Video has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                          Open

                                                                              Video = function( type, id ) {
                                                                          
                                                                                  for( var i=0; i<_video._inst.length; i++ ) {
                                                                                      if ( _video._inst[i].id === id && _video._inst[i].type == type ) {
                                                                                          return _video._inst[i];
                                                                          Severity: Minor
                                                                          Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                            Function loop has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                            Open

                                                                                    loop: function() {
                                                                            
                                                                                        var distance = this.to - this.pos,
                                                                                            factor = 1;
                                                                            
                                                                            Severity: Minor
                                                                            Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                              Function complete has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                              Open

                                                                                                  complete: function( thumb ) {
                                                                              
                                                                                                      // shrink thumbnails to fit
                                                                                                      var top = ['left', 'top'],
                                                                                                          arr = ['Width', 'Height'],
                                                                              Severity: Minor
                                                                              Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                Function add has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                Open

                                                                                        add: function(elem, to, from, hide) {
                                                                                            if ( !elem || Galleria.TOUCH ) {
                                                                                                return;
                                                                                            }
                                                                                            if (!idle.bound) {
                                                                                Severity: Minor
                                                                                Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                  Function rescale has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                  Open

                                                                                          rescale: function(event) {
                                                                                  
                                                                                              // calculate
                                                                                               var width = M.min( $win.width()-40, lightbox.width ),
                                                                                                  height = M.min( $win.height()-60, lightbox.height ),
                                                                                  Severity: Minor
                                                                                  Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                    Function bindControls has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                    Open

                                                                                            bindControls: function() {
                                                                                    
                                                                                                var i;
                                                                                    
                                                                                                carousel.next.on( 'click:fast', function(e) {
                                                                                    Severity: Minor
                                                                                    Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                      Function show has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                      Open

                                                                                                  show : function( elem, speed, callback ) {
                                                                                      
                                                                                                      callback = callback || F;
                                                                                      
                                                                                                      var $elem = $(elem);
                                                                                      Severity: Minor
                                                                                      Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                        Function galleria has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                        Open

                                                                                        $.fn.galleria = function( options ) {
                                                                                        
                                                                                            var selector = this.selector;
                                                                                        
                                                                                            // try domReady if element not found
                                                                                        Severity: Minor
                                                                                        Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                          Function _getWH has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                          Open

                                                                                              _getWH : function() {
                                                                                          
                                                                                                  var $container = this.$( 'container' ),
                                                                                                      $target = this.$( 'target' ),
                                                                                                      self = this,
                                                                                          Severity: Minor
                                                                                          Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                            Function lazyLoadChunks has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                            Open

                                                                                                lazyLoadChunks: function( size, delay ) {
                                                                                            
                                                                                                    var len = this.getDataLength(),
                                                                                                        i = 0,
                                                                                                        n = 0,
                                                                                            Severity: Minor
                                                                                            Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                              Function flash has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                              Open

                                                                                                              flash: function(params, complete) {
                                                                                                                  $(params.next).css({
                                                                                                                      opacity: 0,
                                                                                                                      left: 0
                                                                                                                  });
                                                                                              Severity: Minor
                                                                                              Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                                Function hide has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                Open

                                                                                                            hide : function( elem, speed, callback ) {
                                                                                                
                                                                                                                callback = callback || F;
                                                                                                
                                                                                                                var $elem = $(elem);
                                                                                                Severity: Minor
                                                                                                Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                                  Function wait has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                              wait : function(options) {
                                                                                                  
                                                                                                                  Galleria._waiters = Galleria._waiters || [];
                                                                                                  
                                                                                                                  options = $.extend({
                                                                                                  Severity: Minor
                                                                                                  Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                                    Function scale has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                    Open

                                                                                                            var scale = function() {
                                                                                                    
                                                                                                                // set stagewidth
                                                                                                                self._stageWidth = width || self.$( 'stage' ).width();
                                                                                                                self._stageHeight = height || self.$( 'stage' ).height();
                                                                                                    Severity: Minor
                                                                                                    Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                                      Function _playCheck has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                                      Open

                                                                                                          _playCheck : function() {
                                                                                                              var self = this,
                                                                                                                  played = 0,
                                                                                                                  interval = 20,
                                                                                                                  now = Utils.timestamp(),
                                                                                                      Severity: Minor
                                                                                                      Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                                                                                                        Avoid deeply nested control flow statements.
                                                                                                        Open

                                                                                                                                                if ( type == 'image' && !current.big ) {
                                                                                                                                                    current.big = current.image;
                                                                                                                                                }
                                                                                                        Severity: Major
                                                                                                        Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 45 mins to fix

                                                                                                          Function galleriaOut has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                          Open

                                                                                                              galleriaOut: function (_, t, b, c, d) {
                                                                                                          Severity: Minor
                                                                                                          Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 35 mins to fix

                                                                                                            Function easing has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                            Open

                                                                                                                        easing: function(x,t,b,c,d) {
                                                                                                            Severity: Minor
                                                                                                            Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 35 mins to fix

                                                                                                              Function galleriaIn has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                              Open

                                                                                                                  galleriaIn: function (_, t, b, c, d) {
                                                                                                              Severity: Minor
                                                                                                              Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 35 mins to fix

                                                                                                                Function complete has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                Open

                                                                                                                        var complete = (function( data, next, active, queue, thumb ) {
                                                                                                                Severity: Minor
                                                                                                                Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 35 mins to fix

                                                                                                                  Function easeout has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                  Open

                                                                                                                          this.easeout = function (x, t, b, c, d) {
                                                                                                                  Severity: Minor
                                                                                                                  Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 35 mins to fix

                                                                                                                    Function galleria has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                    Open

                                                                                                                        galleria: function (_, t, b, c, d) {
                                                                                                                    Severity: Minor
                                                                                                                    Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 35 mins to fix

                                                                                                                      Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                      Open

                                                                                                                      (function( $, window, Galleria, undef ) {
                                                                                                                      
                                                                                                                      /*global jQuery, navigator, Image, module, define */
                                                                                                                      
                                                                                                                      // some references
                                                                                                                      Severity: Major
                                                                                                                      Found in Web.Admin/Content/galleria/galleria-1.4.2.js and 1 other location - About 10 mos to fix
                                                                                                                      Web.Admin/2015/js/galleria/galleria-1.4.2.js on lines 10..6919

                                                                                                                      Duplicated Code

                                                                                                                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                      Tuning

                                                                                                                      This issue has a mass of 47583.

                                                                                                                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                      Refactorings

                                                                                                                      Further Reading

                                                                                                                      There are no issues that match your filters.

                                                                                                                      Category
                                                                                                                      Status