travi/php-framework

View on GitHub
client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js

Summary

Maintainability
F
6 days
Test Coverage

Function lightBox has 309 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.lightBox = function(settings) {
        // Settings to configure the jQuery lightBox plugin how you like
        settings = jQuery.extend({
            // Configuration related to overlay
            overlayBgColor:         '#000',        // (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color.
Severity: Major
Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js - About 1 day to fix

    File jquery.lightbox.js has 313 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * jQuery lightBox plugin
     * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
     * and adapted to me for use like a plugin from jQuery.
     * @name jquery-lightbox-0.5.js
    Severity: Minor
    Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js - About 3 hrs to fix

      Function _set_navigation has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function _set_navigation() {
                  $('#lightbox-nav').show();
      
                  // Instead to define this configuration in CSS file, we define here. And it�s need to IE. Just.
                  $('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
      Severity: Minor
      Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js - About 1 hr to fix

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

                function ___getPageSize() {
                    var xScroll, yScroll;
                    if (window.innerHeight && window.scrollMaxY) {
                        xScroll = window.innerWidth + window.scrollMaxX;
                        yScroll = window.innerHeight + window.scrollMaxY;
        Severity: Minor
        Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js - About 1 hr to fix

          Function _resize_container_image_box has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function _resize_container_image_box(intImageWidth,intImageHeight) {
                      // Get current width and height
                      var intCurrentWidth = $('#lightbox-container-image-box').width();
                      var intCurrentHeight = $('#lightbox-container-image-box').height();
                      //Adjust the image size to fit within the viewport
          Severity: Minor
          Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js - About 1 hr to fix

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

                    function _set_interface() {
                        // Apply the HTML markup into body tag
                        $('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="' + settings.imageLoading + '"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="' + settings.imageBtnClose + '"></a></div></div></div></div>');
                        // Get page sizes
                        var arrPageSizes = ___getPageSize();
            Severity: Minor
            Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js - About 1 hr to fix

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

                      function _keyboard_action(objEvent) {
                          // To ie
                          if ( objEvent == null ) {
                              escapeKey = 27;
                              keycode = event.keyCode;
              Severity: Minor
              Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js - About 1 hr to fix

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

                            if ( settings.activeImage != 0 ) {
                                if ( settings.fixedNavigation ) {
                                    $('#lightbox-nav-btnPrev').css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' })
                                        .unbind()
                                        .bind('click',function() {
                Severity: Major
                Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js and 1 other location - About 1 day to fix
                client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js on lines 308..329

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

                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

                            if ( settings.activeImage != ( settings.imageArray.length -1 ) ) {
                                if ( settings.fixedNavigation ) {
                                    $('#lightbox-nav-btnNext').css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' })
                                        .unbind()
                                        .bind('click',function() {
                Severity: Major
                Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js and 1 other location - About 1 day to fix
                client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js on lines 284..305

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

                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

                            if (self.pageYOffset) {
                                yScroll = self.pageYOffset;
                                xScroll = self.pageXOffset;
                            } else if (document.documentElement && document.documentElement.scrollTop) {     // Explorer 6 Strict
                                yScroll = document.documentElement.scrollTop;
                Severity: Major
                Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js and 1 other location - About 3 hrs to fix
                client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js on lines 434..447

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

                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

                            if (self.innerHeight) {    // all except Explorer
                                if(document.documentElement.clientWidth){
                                    windowWidth = document.documentElement.clientWidth;
                                } else {
                                    windowWidth = self.innerWidth;
                Severity: Major
                Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js and 1 other location - About 3 hrs to fix
                client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js on lines 471..480

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

                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

                            if (intImageWidth > x) {
                                intAdjustedHeight = intAdjustedHeight * (x / intAdjustedWidth);
                                intAdjustedWidth = x;
                                if (intAdjustedHeight > y) {
                                    intAdjustedWidth = intAdjustedWidth * (y / intAdjustedHeight);
                client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js on lines 220..227

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

                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

                            else if (intImageHeight > y) {
                                intAdjustedWidth = intAdjustedWidth * (y / intAdjustedHeight);
                                intAdjustedHeight = y;
                                if (intAdjustedWidth > x) {
                                    intAdjustedHeight = intAdjustedHeight * (x / intAdjustedWidth);
                client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js on lines 212..227

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

                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

                            if ( (settings.imageArray.length -1) > settings.activeImage ) {
                                objNext = new Image();
                                objNext.src = settings.imageArray[settings.activeImage + 1][0];
                            }
                Severity: Minor
                Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js and 1 other location - About 30 mins to fix
                client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js on lines 400..403

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

                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

                            if ( settings.activeImage > 0 ) {
                                objPrev = new Image();
                                objPrev.src = settings.imageArray[settings.activeImage -1][0];
                            }
                Severity: Minor
                Found in client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js and 1 other location - About 30 mins to fix
                client/thirdparty/jquery/plugins/lightbox/jquery.lightbox.js on lines 396..399

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

                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