sajari-website
Advanced tools
Comparing version 0.6.2 to 0.7.0
{ | ||
"name": "sajari-website", | ||
"version": "0.6.2", | ||
"version": "0.7.0", | ||
"description": "Website extensions for the Sajari API. Automatically index site content, add user profiles, render search and recommendations, etc.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -185,3 +185,3 @@ /* | ||
data['mimetype'] = 'text/plain+weighted'; | ||
return data; | ||
@@ -188,0 +188,0 @@ }, |
@@ -15,3 +15,2 @@ require("./utils/polyfills"); | ||
prefix: 'data-sj-', // Elements with Sajari data parameters all use this as a prefix | ||
autoFlush: 100, // Flush the stack array queue automatically X msecs. 0 is no auto-flush | ||
debug: false, // If true, debug information will be logged to the console | ||
@@ -80,3 +79,2 @@ company: undefined, | ||
} | ||
flush(); | ||
} | ||
@@ -97,12 +95,19 @@ | ||
function flush() { | ||
var r; | ||
while (r = stack.shift()) { | ||
var fn = r.shift(); | ||
if (methods[fn] !== undefined) { | ||
methods[fn].apply(undefined, r); | ||
} | ||
stack.push = function() { | ||
for (var i = 0; i < arguments.length; i++) try { | ||
if (typeof arguments[i] === "function") arguments[i](); | ||
else { | ||
var fn = arguments[i][0]; | ||
var args = arguments[i].slice(1); | ||
if (methods[fn] !== undefined) { | ||
methods[fn].apply(stack, args); | ||
} | ||
} | ||
} catch (e) {} | ||
}; | ||
// Clear the stack | ||
for (var i = 0; i < stack.length; i++) { | ||
stack.push(stack[i]); | ||
} | ||
if (opts.autoFlush > 0) { | ||
setTimeout(flush, opts.autoFlush); | ||
} | ||
} | ||
@@ -744,2 +749,15 @@ | ||
// Grab page meta and add it to the page object | ||
dom.dynamicMeta(document, page.meta); | ||
// Send page for indexing | ||
if (!dom.hasNode('noindex')) { | ||
stack.push(['index']); | ||
} | ||
// Profile user automatically unless we specify not to | ||
if (dom.hasNode('noprofile')) { | ||
profile.send = false; | ||
} | ||
// Remove old overlay | ||
@@ -752,2 +770,5 @@ dom.eachNode('overlay', function(el) { | ||
// Flush the queue | ||
flush(); | ||
// DOM elements can be used to specify a company and collection | ||
@@ -767,13 +788,2 @@ opts.company = dom.firstNodeVal('company', opts.company); | ||
// Store click throughs locally for filtering | ||
var qid = url.getURLParameter("q.id"); | ||
if (qid) { | ||
stack.push(['click', qid, url.getURLParameter("q.sl"), url.getURLParameter("q.in")]); | ||
} | ||
// Profile user automatically unless we specify not to | ||
if (dom.hasNode('noprofile')) { | ||
profile.send = false; | ||
} | ||
// Set up the profiling functions if allowed | ||
@@ -787,3 +797,2 @@ if (profile.send) { | ||
stack.push(['profile', document.title]); | ||
flush(); | ||
profile.sent = true; | ||
@@ -802,3 +811,2 @@ }, dom.firstNodeVal('profile-delay', profile.delay)); | ||
stack.push(['profile', (this.innerText === undefined ? this.textContent : this.innerText)]); | ||
flush(); | ||
}); | ||
@@ -809,10 +817,2 @@ } | ||
// Grab page meta and add it to the page object | ||
dom.dynamicMeta(document, page.meta); | ||
// Send page for indexing | ||
if (!dom.hasNode('noindex')) { | ||
stack.push(['index']); | ||
} | ||
// Send conversions. We push onto the stack as the API is still initializing | ||
@@ -823,5 +823,2 @@ dom.eachNode('conv-type', function(node, attr) { | ||
// Flush our stack in case settings impact the install of components | ||
flush(); | ||
// If required, we need to include Sajari CSS into the DOM | ||
@@ -991,3 +988,2 @@ if (!opts.cssIncluded) { | ||
} | ||
flush(); | ||
}); | ||
@@ -994,0 +990,0 @@ })(); |
@@ -14,3 +14,2 @@ | ||
var uArr = unique(arr); | ||
console.log(uArr); | ||
@@ -17,0 +16,0 @@ t.equal(uArr[0], "two"); |
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
67710
1855