diff --git a/Gemfile b/Gemfile index c5bd41a..a12dccd 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source 'https://rubygems.org' group :development do gem 'guard' gem 'guard-coffeescript' - gem 'json', '~> 1.7.7' + gem 'json' end # Platform specific gems (set `require: false`) diff --git a/Gemfile.lock b/Gemfile.lock index d987309..20587c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,31 +3,36 @@ GEM specs: celluloid (0.15.2) timers (~> 1.1.0) + celluloid-io (0.15.0) + celluloid (>= 0.15.0) + nio4r (>= 0.5.0) coderay (1.1.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.6.3) + coffee-script-source (1.7.0) execjs (2.0.2) ffi (1.9.3) formatador (0.2.4) growl (1.0.3) - guard (2.3.0) + guard (2.5.1) formatador (>= 0.2.4) - listen (~> 2.1) + listen (~> 2.6) lumberjack (~> 1.0) pry (>= 0.9.12) thor (>= 0.18.1) - guard-coffeescript (1.3.4) + guard-coffeescript (1.4.0) coffee-script (>= 2.2.0) guard (>= 1.1.0) - json (1.7.7) - listen (2.4.0) + json (1.8.1) + listen (2.7.1) celluloid (>= 0.15.2) + celluloid-io (>= 0.15.0) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) lumberjack (1.0.4) method_source (0.8.2) + nio4r (1.0.0) pry (0.9.12.6) coderay (~> 1.0) method_source (~> 0.8) @@ -35,7 +40,7 @@ GEM rb-fsevent (0.9.4) rb-inotify (0.9.3) ffi (>= 0.5.0) - slop (3.4.7) + slop (3.5.0) terminal-notifier-guard (1.5.3) thor (0.18.1) timers (1.1.0) @@ -47,6 +52,6 @@ DEPENDENCIES growl guard guard-coffeescript - json (~> 1.7.7) + json rb-fsevent terminal-notifier-guard diff --git a/lib/atrackt.js b/lib/atrackt.js index a897922..37c7a4e 100644 --- a/lib/atrackt.js +++ b/lib/atrackt.js @@ -1,7 +1,7 @@ /* Atrackt Tracking Library https://github.com/brewster1134/atrackt -@version 0.1.1 +@version 0.1.2 @author Ryan Brewster */ @@ -21,7 +21,6 @@ https://github.com/brewster1134/atrackt plugins: {}, registerPlugin: function(pluginName, attrs) { var _this = this; - if (typeof (attrs != null ? attrs.send : void 0) !== 'function') { return console.log('NO SEND METHOD DEFINED'); } @@ -32,7 +31,6 @@ https://github.com/brewster1134/atrackt attrs.excludeElements || (attrs.excludeElements = {}); attrs.bind = function(eventsObject) { var currentElements, currentSelectors, data, eventType, _results; - if (eventsObject == null) { return console.log('NOTHING TO BIND. YOU MUST PASS AN EVENT OBJECT CALLING BIND'); } @@ -52,7 +50,6 @@ https://github.com/brewster1134/atrackt }; attrs.unbind = function(eventsObject) { var currentElements, currentSelectors, data, eventType, _results; - if (eventsObject != null) { _results = []; for (eventType in eventsObject) { @@ -78,7 +75,6 @@ https://github.com/brewster1134/atrackt }; attrs.setOptions = function(options) { var pluginOptions; - pluginOptions = attrs.options || {}; return attrs.options = $.extend(true, pluginOptions, options); }; @@ -97,7 +93,6 @@ https://github.com/brewster1134/atrackt }, setGlobalData: function(object) { var pluginData, pluginName, _ref, _results; - _ref = this.plugins; _results = []; for (pluginName in _ref) { @@ -108,7 +103,6 @@ https://github.com/brewster1134/atrackt }, setCallback: function(name, callback) { var pluginData, pluginName, _ref, _results; - _ref = this.plugins; _results = []; for (pluginName in _ref) { @@ -119,7 +113,6 @@ https://github.com/brewster1134/atrackt }, bind: function(eventsObject) { var pluginData, pluginName, _ref, _results; - _ref = this.plugins; _results = []; for (pluginName in _ref) { @@ -130,7 +123,6 @@ https://github.com/brewster1134/atrackt }, unbind: function(eventsObject) { var pluginData, pluginName, _ref, _results; - _ref = this.plugins; _results = []; for (pluginName in _ref) { @@ -141,7 +133,6 @@ https://github.com/brewster1134/atrackt }, refresh: function() { var eventType, pluginData, pluginName, selectors, _ref, _ref1; - this._debugConsoleReset(); _ref = this.plugins; for (pluginName in _ref) { @@ -156,7 +147,6 @@ https://github.com/brewster1134/atrackt }, track: function(data, options, event) { var pluginData, pluginName, trackObject, trackingData, _ref, _ref1, _ref2; - if (options == null) { options = {}; } @@ -197,7 +187,6 @@ https://github.com/brewster1134/atrackt _cleanup: function() {}, _collectElements: function(pluginName, eventType) { var allElements, excludeElements, excludeSelectors, includeElements, includeSelectors, plugin, _ref, _ref1; - this._cleanup(pluginName, eventType); plugin = this.plugins[pluginName]; includeSelectors = $((_ref = plugin.includeSelectors[eventType]) != null ? _ref.join(',') : void 0); @@ -216,7 +205,6 @@ https://github.com/brewster1134/atrackt }, _bind: function(pluginName, eventType, data) { var selectors; - this._collectElements(pluginName, eventType); this._unbind(pluginName, eventType, data); selectors = $(this.plugins[pluginName].elements[eventType]); @@ -237,7 +225,6 @@ https://github.com/brewster1134/atrackt }, _unbind: function(pluginName, eventType, data) { var eventName, selectors; - eventName = '.atrackt'; selectors = $('*', 'body'); if (eventType != null) { @@ -259,8 +246,7 @@ https://github.com/brewster1134/atrackt }, _getTrackObject: function(data, event) { var $el, _base; - - if (data instanceof HTMLElement) { + if (data.nodeType === 1) { data = $(data); } if (data instanceof jQuery) { @@ -289,7 +275,6 @@ https://github.com/brewster1134/atrackt }, _getCategories: function($el) { var catArray; - catArray = []; if ($el.data('track-cat')) { catArray.unshift($el.data('track-cat')); @@ -304,7 +289,6 @@ https://github.com/brewster1134/atrackt }, _urlParams: function(key) { var paramString, params; - if (key == null) { key = null; } @@ -312,7 +296,6 @@ https://github.com/brewster1134/atrackt paramString = window.location.search.substring(1); $.each(paramString.split('&'), function(i, param) { var paramObject; - paramObject = param.split('='); return params[paramObject[0]] = paramObject[1]; }); diff --git a/src/README.md b/src/README.md index 53cb81d..6274f24 100644 --- a/src/README.md +++ b/src/README.md @@ -1,4 +1,7 @@ ### CHANGE LOG +###### 0.1.2 +* Improved compatibility with # Convert HTML element to a jquery object - data = $(data) if data instanceof HTMLElement + data = $(data) if data.nodeType == 1 if data instanceof jQuery $el = data