doofinder
Advanced tools
Comparing version 1.0.6 to 1.0.7
{ | ||
"name": "doofinder", | ||
"description": "Javascript Library for Doofinder Search API", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"main": "dist/doofinder.js", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -33,7 +33,5 @@ | ||
*/ | ||
function Controller(client, widgets, searchParams) { | ||
function Controller(client, widgets, searchParams1) { | ||
var i, len, widget; | ||
if (searchParams == null) { | ||
searchParams = {}; | ||
} | ||
this.searchParams = searchParams1 != null ? searchParams1 : {}; | ||
this.client = client; | ||
@@ -50,4 +48,4 @@ this.hashid = client.hashid; | ||
} | ||
this.searchParams = $.extend(true, searchParams, { | ||
query_counter: 0 | ||
this.status = $.extend(true, {}, { | ||
params: this.searchParams | ||
}); | ||
@@ -76,3 +74,3 @@ this.reset(); | ||
this.status.params.query_counter++; | ||
params = this.status.params; | ||
params = $.extend(true, {}, this.status.params || {}); | ||
params.page = this.status.currentPage; | ||
@@ -122,3 +120,3 @@ _this = this; | ||
Controller.prototype.search = function(query, params) { | ||
var searchParams; | ||
var queryCounter, searchParams; | ||
if (params == null) { | ||
@@ -129,5 +127,8 @@ params = {}; | ||
searchParams = $.extend(true, {}, this.searchParams); | ||
queryCounter = this.status.params.query_counter; | ||
this.status.params = $.extend(true, {}, params); | ||
this.status.params = $.extend(true, searchParams, params); | ||
this.status.params.query = query; | ||
this.status.params.filters = $.extend(true, {}, this.searchParams.filters || {}); | ||
this.status.params.query_counter = queryCounter; | ||
if (!this.searchParams.query_name) { | ||
@@ -272,2 +273,4 @@ delete this.status.params.query_name; | ||
Controller.prototype.reset = function() { | ||
var queryCounter; | ||
queryCounter = this.status.params.query_counter || 1; | ||
this.status = { | ||
@@ -279,2 +282,3 @@ params: this.searchParams, | ||
}; | ||
this.status.params.query_counter = queryCounter; | ||
if (this.searchParams.query) { | ||
@@ -385,33 +389,2 @@ return this.status.params.query = ''; | ||
/* | ||
sendToGA | ||
Send the a command to Google Analytics | ||
@param {Object} gaCommand: the command for GA | ||
eventCategory: "xxx" | ||
eventLabel: "xxx" | ||
eventAction: "xxx" | ||
*/ | ||
Controller.prototype.sendToGA = function(gaCommand) { | ||
var ga, trackerName; | ||
if (window._gaq && window._gaq.push) { | ||
window._gaq.push(['_trackEvent', gaCommand['eventCategory'], gaCommand['eventAction'], gaCommand['eventLabel']]); | ||
if (gaCommand['eventAction'].indexOf('search') === 0) { | ||
return window._gaq.push(['_trackPageview', '/doofinder/search/' + this.hashid + '?query=' + gaCommand['eventLabel']]); | ||
} | ||
} else { | ||
ga = window[window.GoogleAnalyticsObject] || window.ga; | ||
if (ga && ga.getAll) { | ||
trackerName = ga.getAll()[0].get('name'); | ||
ga(trackerName + '.send', 'event', gaCommand); | ||
if (gaCommand['eventAction'].indexOf('search') === 0) { | ||
return ga(trackerName + '.send', 'pageview', '/doofinder/search/' + this.hashid + '?query=' + gaCommand['eventLabel']); | ||
} | ||
} | ||
} | ||
}; | ||
/* | ||
bind | ||
@@ -418,0 +391,0 @@ |
(function() { | ||
module.exports = { | ||
version: "1.0.6", | ||
version: "1.0.7", | ||
Client: require("./client"), | ||
@@ -5,0 +5,0 @@ Handlebars: require("handlebars"), |
{ | ||
"name": "doofinder", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Javascript Library for Doofinder Search API", | ||
@@ -5,0 +5,0 @@ "main": "lib/doofinder.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25
88358
1925