XoopsModules25x/smallworld

View on GitHub
assets/js/jquery.bookmark.js

Summary

Maintainability
F
5 days
Test Coverage

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

/* http://keith-wood.name/bookmark.html
    Sharing bookmarks for jQuery v1.4.0.
    Written by Keith Wood (kbwood{at}iinet.com.au) March 2008.
    Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and 
    MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
Severity: Minor
Found in assets/js/jquery.bookmark.js - About 7 hrs to fix

    Function uaMatch has 105 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function uaMatch( ua ) {
        // If an UA is not provided, default to the current browser UA.
        if ( ua === undefined ) {
          ua = window.navigator.userAgent;
        }
    Severity: Major
    Found in assets/js/jquery.bookmark.js - About 4 hrs to fix

      Function Bookmark has 94 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Bookmark() {
          this._defaults = {
              url: '',    // The URL to bookmark, leave blank for the current page
              sourceTag: '', // Extra tag to add to URL to indicate source when it returns
              title: '',    // The title to bookmark, leave blank for the current one
      Severity: Major
      Found in assets/js/jquery.bookmark.js - About 3 hrs to fix

        Function _updateBookmark has 75 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _updateBookmark: function(target, settings) {
                var oldSettings = $.data(target[0], PROP_NAME) || $.extend({}, this._defaults);
                settings = extendRemove(oldSettings, settings || {});
                $.data(target[0], PROP_NAME, settings);
                var sites = settings.sites;
        Severity: Major
        Found in assets/js/jquery.bookmark.js - About 3 hrs to fix

          Consider simplifying this complex logical expression.
          Open

              if ( browser.android || browser.bb || browser.blackberry || browser.ipad || browser.iphone ||
                browser.ipod || browser.kindle || browser.playbook || browser.silk || browser[ "windows phone" ]) {
                browser.mobile = true;
              }
          Severity: Critical
          Found in assets/js/jquery.bookmark.js - About 2 hrs to fix

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

                _addOneSite: function(settings, list, display, icon, url, onclick, hint) {
                    var hintFormat = settings.hint || '{s}';
                    var html = '<li><a href="' + url + '"' +
                        (settings.target ? ' target="' + settings.target + '"' : '') + '>';
                    if (icon !== null) {
            Severity: Minor
            Found in assets/js/jquery.bookmark.js - About 1 hr to fix

              Function _addOneSite has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  _addOneSite: function(settings, list, display, icon, url, onclick, hint) {
              Severity: Major
              Found in assets/js/jquery.bookmark.js - About 50 mins to fix

                Function addSite has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    addSite: function(id, display, icon, lang, category, url) {
                Severity: Minor
                Found in assets/js/jquery.bookmark.js - About 45 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                              if (typeof icon === 'number') {
                                  html += '<span title="' + title + '" ' +
                                      (settings.iconsStyle ? 'class="' + settings.iconsStyle + '" ' : '') +
                                      'style="' + (settings.iconsStyle ? 'background-position: ' :
                                      'background: transparent url(' + settings.icons + ') no-repeat ') + '-' +
                  Severity: Major
                  Found in assets/js/jquery.bookmark.js - About 40 mins to fix

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

                        var platform_match = /(ipad)/.exec( ua ) ||
                            /(ipod)/.exec( ua ) ||
                            /(windows phone)/.exec( ua ) ||
                            /(iphone)/.exec( ua ) ||
                            /(kindle)/.exec( ua ) ||
                    Severity: Major
                    Found in assets/js/jquery.bookmark.js and 1 other location - About 3 hrs to fix
                    assets/js/jquery.bookmark.js on lines 500..509

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

                    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

                        var match = /(edge)\/([\w.]+)/.exec( ua ) ||
                            /(opr)[\/]([\w.]+)/.exec( ua ) ||
                            /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
                            /(iemobile)[\/]([\w.]+)/.exec( ua ) ||
                            /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
                    Severity: Major
                    Found in assets/js/jquery.bookmark.js and 1 other location - About 3 hrs to fix
                    assets/js/jquery.bookmark.js on lines 513..522

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

                    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 (lang) {
                                        $.each($.bookmark._sites, function(id, site) {
                                            if (site.lang === lang[1] && $.inArray(id, sites) === -1) {
                                                sites.push(id);
                                            }
                    Severity: Major
                    Found in assets/js/jquery.bookmark.js and 1 other location - About 2 hrs to fix
                    assets/js/jquery.bookmark.js on lines 217..223

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

                    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 (category) {
                                        $.each($.bookmark._sites, function(id, site) {
                                            if (site.category === category[1] && $.inArray(id, sites) === -1) {
                                                sites.push(id);
                                            }
                    Severity: Major
                    Found in assets/js/jquery.bookmark.js and 1 other location - About 2 hrs to fix
                    assets/js/jquery.bookmark.js on lines 209..215

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

                    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 6 locations. Consider refactoring.
                    Open

                        if ( browser.safari && browser.silk ) {
                          var silk = "silk";
                    
                          matched.browser = silk;
                          browser[silk] = true;
                    Severity: Major
                    Found in assets/js/jquery.bookmark.js and 5 other locations - About 50 mins to fix
                    assets/js/jquery.bookmark.js on lines 564..569
                    assets/js/jquery.bookmark.js on lines 581..586
                    assets/js/jquery.bookmark.js on lines 589..594
                    assets/js/jquery.bookmark.js on lines 613..618
                    assets/js/jquery.bookmark.js on lines 621..626

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

                    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 6 locations. Consider refactoring.
                    Open

                        if ( browser.rv || browser.iemobile) {
                          var ie = "msie";
                    
                          matched.browser = ie;
                          browser[ie] = true;
                    Severity: Major
                    Found in assets/js/jquery.bookmark.js and 5 other locations - About 50 mins to fix
                    assets/js/jquery.bookmark.js on lines 581..586
                    assets/js/jquery.bookmark.js on lines 589..594
                    assets/js/jquery.bookmark.js on lines 613..618
                    assets/js/jquery.bookmark.js on lines 621..626
                    assets/js/jquery.bookmark.js on lines 629..634

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

                    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 6 locations. Consider refactoring.
                    Open

                        if ( browser.safari && browser.blackberry ) {
                          var blackberry = "blackberry";
                    
                          matched.browser = blackberry;
                          browser[blackberry] = true;
                    Severity: Major
                    Found in assets/js/jquery.bookmark.js and 5 other locations - About 50 mins to fix
                    assets/js/jquery.bookmark.js on lines 564..569
                    assets/js/jquery.bookmark.js on lines 589..594
                    assets/js/jquery.bookmark.js on lines 613..618
                    assets/js/jquery.bookmark.js on lines 621..626
                    assets/js/jquery.bookmark.js on lines 629..634

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

                    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 6 locations. Consider refactoring.
                    Open

                        if ( browser.safari && browser.kindle ) {
                          var kindle = "kindle";
                    
                          matched.browser = kindle;
                          browser[kindle] = true;
                    Severity: Major
                    Found in assets/js/jquery.bookmark.js and 5 other locations - About 50 mins to fix
                    assets/js/jquery.bookmark.js on lines 564..569
                    assets/js/jquery.bookmark.js on lines 581..586
                    assets/js/jquery.bookmark.js on lines 589..594
                    assets/js/jquery.bookmark.js on lines 613..618
                    assets/js/jquery.bookmark.js on lines 629..634

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

                    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 6 locations. Consider refactoring.
                    Open

                        if ( browser.safari && browser.android ) {
                          var android = "android";
                    
                          matched.browser = android;
                          browser[android] = true;
                    Severity: Major
                    Found in assets/js/jquery.bookmark.js and 5 other locations - About 50 mins to fix
                    assets/js/jquery.bookmark.js on lines 564..569
                    assets/js/jquery.bookmark.js on lines 581..586
                    assets/js/jquery.bookmark.js on lines 589..594
                    assets/js/jquery.bookmark.js on lines 621..626
                    assets/js/jquery.bookmark.js on lines 629..634

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

                    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 6 locations. Consider refactoring.
                    Open

                        if ( browser.safari && browser.playbook ) {
                          var playbook = "playbook";
                    
                          matched.browser = playbook;
                          browser[playbook] = true;
                    Severity: Major
                    Found in assets/js/jquery.bookmark.js and 5 other locations - About 50 mins to fix
                    assets/js/jquery.bookmark.js on lines 564..569
                    assets/js/jquery.bookmark.js on lines 581..586
                    assets/js/jquery.bookmark.js on lines 613..618
                    assets/js/jquery.bookmark.js on lines 621..626
                    assets/js/jquery.bookmark.js on lines 629..634

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

                    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