mambax7/extgallery

View on GitHub
assets/js/magnific_popup/jquery.magnific-popup.js

Summary

Maintainability
F
1 wk
Test Coverage

File jquery.magnific-popup.js has 1391 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! Magnific Popup - v0.9.9 - 2013-12-27
* http://dimsemenov.com/plugins/magnific-popup/
* Copyright (c) 2013 Dmitry Semenov; */
;(function($) {

Severity: Major
Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 3 days to fix

    Function open has 160 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        open: function(data) {
    
            if(!_body) {
                _body = $(document.body);
            }
    Severity: Major
    Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 6 hrs to fix

      Function initZoom has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              initZoom: function() {
                  var zoomSt = mfp.st.zoom,
                      ns = '.zoom',
                      image;
      
      
      Severity: Major
      Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 3 hrs to fix

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

                getImage: function(item, template) {
        
                    var guard = 0,
        
                        // image load complete handler
        Severity: Major
        Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 3 hrs to fix

          Function initGallery has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  initGallery: function() {
          
                      var gSt = mfp.st.gallery,
                          ns = '.mfp-gallery',
                          supportsFastClick = Boolean($.fn.mfpFastClick);
          Severity: Major
          Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 2 hrs to fix

            Function mfpFastClick has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                $.fn.mfpFastClick = function(callback) {
            
                    return $(this).each(function() {
            
                        var elem = $(this),
            Severity: Minor
            Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 1 hr to fix

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

                  _close: function() {
                      _mfpTrigger(CLOSE_EVENT);
              
                      var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' ';
              
              
              Severity: Minor
              Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 1 hr to fix

                Function _parseMarkup has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _parseMarkup: function(template, values, item) {
                        var arr;
                        if(item.data) {
                            values = $.extend(item.data, values);
                        }
                Severity: Minor
                Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 1 hr to fix

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

                  $.fn.magnificPopup = function(options) {
                      _checkInstance();
                  
                      var jqEl = $(this);
                  
                  
                  Severity: Minor
                  Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 1 hr to fix

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

                            getAjax: function(item) {
                    
                                if(_ajaxCur)
                                    _body.addClass(_ajaxCur);
                    
                    
                    Severity: Minor
                    Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 1 hr to fix

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

                          updateItemHTML: function() {
                              var item = mfp.items[mfp.index];
                      
                              // Detach and perform modifications
                              mfp.contentContainer.detach();
                      Severity: Minor
                      Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 1 hr to fix

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

                            _openClick: function(e, el, options) {
                                var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick;
                        
                        
                                if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey ) ) {
                        Severity: Minor
                        Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 1 hr to fix

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

                              parseEl: function(index) {
                                  var item = mfp.items[index],
                                      type;
                          
                                  if(item.tagName) {
                          Severity: Minor
                          Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 1 hr to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if(el.is('img')) {
                                                        el.attr('src', value);
                                                    } else {
                                                        el.replaceWith( '<img src="'+value+'" class="' + el.attr('class') + '" />' );
                                                    }
                            Severity: Major
                            Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 45 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                              return true;
                              Severity: Major
                              Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return false;
                                Severity: Major
                                Found in assets/js/magnific_popup/jquery.magnific-popup.js - About 30 mins to fix

                                  TODO found
                                  Open

                                                  // TODO: find a way to avoid such cloning

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

                                          next: function() {
                                              mfp.direction = true;
                                              mfp.index = _getLoopedId(mfp.index + 1);
                                              mfp.updateItemHTML();
                                          },
                                  Severity: Minor
                                  Found in assets/js/magnific_popup/jquery.magnific-popup.js and 1 other location - About 55 mins to fix
                                  assets/js/magnific_popup/jquery.magnific-popup.js on lines 1807..1811

                                  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 54.

                                  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

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

                                          prev: function() {
                                              mfp.direction = false;
                                              mfp.index = _getLoopedId(mfp.index - 1);
                                              mfp.updateItemHTML();
                                          },
                                  Severity: Minor
                                  Found in assets/js/magnific_popup/jquery.magnific-popup.js and 1 other location - About 55 mins to fix
                                  assets/js/magnific_popup/jquery.magnific-popup.js on lines 1802..1806

                                  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 54.

                                  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

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

                                              for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) {
                                                  mfp._preloadItem(mfp.index-i);
                                              }
                                  Severity: Minor
                                  Found in assets/js/magnific_popup/jquery.magnific-popup.js and 1 other location - About 45 mins to fix
                                  assets/js/magnific_popup/jquery.magnific-popup.js on lines 1823..1825

                                  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 50.

                                  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

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

                                              for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) {
                                                  mfp._preloadItem(mfp.index+i);
                                              }
                                  Severity: Minor
                                  Found in assets/js/magnific_popup/jquery.magnific-popup.js and 1 other location - About 45 mins to fix
                                  assets/js/magnific_popup/jquery.magnific-popup.js on lines 1826..1828

                                  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 50.

                                  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

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

                                                          arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS);
                                  Severity: Minor
                                  Found in assets/js/magnific_popup/jquery.magnific-popup.js and 1 other location - About 35 mins to fix
                                  assets/js/magnific_popup/jquery.magnific-popup.js on lines 1758..1758

                                  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 47.

                                  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

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

                                                          arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS),
                                  Severity: Minor
                                  Found in assets/js/magnific_popup/jquery.magnific-popup.js and 1 other location - About 35 mins to fix
                                  assets/js/magnific_popup/jquery.magnific-popup.js on lines 1759..1759

                                  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 47.

                                  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