diff --git a/src/core.js b/src/core.js index d2a77e9..7fbc530 100755 --- a/src/core.js +++ b/src/core.js @@ -24,6 +24,7 @@ if (_prev_gas._accounts_length >= 0) { } //Shortcuts, these speed up and compress the code +/*jshint -W079*/ var document = window.document, toString = Object.prototype.toString, hasOwn = Object.prototype.hasOwnProperty, @@ -33,7 +34,7 @@ var document = window.document, sindexOf = String.prototype.indexOf, url = document.location.href, documentElement = document.documentElement; - +/*jshint +W079*/ /** * GAS Sigleton * @constructor @@ -247,7 +248,9 @@ GAS.prototype.push = function () { * everything pushed to _gas is run through possible hooks and then pushed to * _gaq */ +/*global _gas:true*/ window['_gas'] = _gas = new GAS(); +/*global _gas:false*/ /** diff --git a/src/helpers.js b/src/helpers.js index 68dc28c..4f1308f 100755 --- a/src/helpers.js +++ b/src/helpers.js @@ -16,9 +16,11 @@ * * @constructor */ +/*jshint -W079*/ var GasHelper = function () { this._setDummyTracker(); }; +/*jshint +W079*/ GasHelper.prototype._setDummyTracker = function () { if (!this['tracker']) { @@ -47,31 +49,6 @@ GasHelper.prototype.inArray = function (obj, item) { return false; }; -/** - * Removes special characters and Lowercase String - * - * @param {string} str to be sanitized. - * @param {boolean} strict_opt If we should remove any non ascii char. - * @return {string} Sanitized string. - */ -GasHelper.prototype._sanitizeString = function (str, strict_opt) { - str = str.toLowerCase() - .replace(/^\ +/, '') - .replace(/\ +$/, '') - .replace(/\s+/g, '_') - .replace(/[áàâãåäæª]/g, 'a') - .replace(/[éèêëЄ€]/g, 'e') - .replace(/[íìîï]/g, 'i') - .replace(/[óòôõöøº]/g, 'o') - .replace(/[úùûü]/g, 'u') - .replace(/[碩]/g, 'c'); - - if (strict_opt) { - str = str.replace(/[^a-z0-9_\-]/g, '_'); - } - return str.replace(/_+/g, '_'); -}; - /** * Cross Browser helper to addEventListener. * diff --git a/src/plugins/mailto.js b/src/plugins/mailto.js index 8d8218e..3b274d7 100755 --- a/src/plugins/mailto.js +++ b/src/plugins/mailto.js @@ -17,7 +17,7 @@ var _gasTrackMailto = function (opts) { this._mailtoTracked = true; } else { //Oops double tracking detected. - return false;; + return false; } if (!opts) { diff --git a/src/plugins/max_scroll.js b/src/plugins/max_scroll.js index 11ba79d..cdfa2d1 100755 --- a/src/plugins/max_scroll.js +++ b/src/plugins/max_scroll.js @@ -101,7 +101,7 @@ function _trackMaxScroll(opts) { this._maxScrollTracked = true; } else { //Oops double tracking detected. - return false;; + return false; } _maxScrollOpts = opts || {}; _maxScrollOpts['category'] = _maxScrollOpts['category'] || 'Max Scroll'; diff --git a/test/test_core.js b/test/test_core.js index fa080c2..016ca20 100755 --- a/test/test_core.js +++ b/test/test_core.js @@ -39,24 +39,6 @@ test('multiple parameters passed to _gas.push', function() { _gas.push(['_popHook', '_trackPageview']); }); -test('_sanitizeString', function() { - var san = _gas.gh._sanitizeString; - expect(6); - equals(san(' /tééééá íóú '), '/teeeea_iou'); - equals(san(''), ''); - equals(san(' '), ''); - equals(san('ÇA ÄR'), 'ca_ar'); - - stop(); - _gas.push(function() { - equals(this._sanitizeString('Áéí óù '), 'aei_ou', - 'From within pushed function'); - start(); - }); - - equals(san('&$*()[]/\éa', true), '_ea', 'strict mode'); -}); - test('_addHook _trackPageview', function() { expect(1);