Browse Source

Combined jQuery plug-ins (no need to have two)

bmallred 12 years ago
parent
commit
c8d4677069
1 changed files with 14 additions and 16 deletions
  1. 14 16
      jquery-analytics.js

+ 14 - 16
jquery-analytics.js

38
    // Declared outside of scope to maintain an accurate count.
38
    // Declared outside of scope to maintain an accurate count.
39
    var uniqueId = 0;
39
    var uniqueId = 0;
40
40
41
    // Provide a unique identifier to an element if one has not already been assigned.
42
    // @return {Object} modified jQuery objects
43
    $.fn.analyticsUniqueId = function () {
44
        if (this.length == 0) {
45
            return;
46
        }
47
48
        return this.each(function () {
49
            if (!$(this).attr("id")) {
50
                $(this).attr("id", "analytics-id-" + ++uniqueId);
51
            }
52
        });
53
    };
54
})(jQuery);
55
56
(function ($) {
57
    // Default settings which may be extended upon.
41
    // Default settings which may be extended upon.
58
    var settings = {
42
    var settings = {
59
        attributes: [],
43
        attributes: [],
146
            });
130
            });
147
        }
131
        }
148
    };
132
    };
133
134
    // Provide a unique identifier to an element if one has not already been assigned.
135
    // @return {Object} modified jQuery objects
136
    $.fn.analyticsUniqueId = function () {
137
        if (this.length == 0) {
138
            return;
139
        }
140
141
        return this.each(function () {
142
            if (!$(this).attr("id")) {
143
                $(this).attr("id", "analytics-id-" + ++uniqueId);
144
            }
145
        });
146
    };
149
    
147
    
150
    // Plug-in function providing easy access to analytics.
148
    // Plug-in function providing easy access to analytics.
151
    // @param {Object} options
149
    // @param {Object} options