Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sajari-website

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sajari-website - npm Package Compare versions

Comparing version 0.5.4 to 0.5.5

2

package.json
{
"name": "sajari-website",
"version": "0.5.4",
"version": "0.5.5",
"description": "Website extensions for the Sajari API. Automatically index site content, add user profiles, render search and recommendations, etc.",

@@ -5,0 +5,0 @@ "author": {

@@ -36,5 +36,2 @@ require("./utils/polyfills");

// Initialize a blank api, we'll enable shortly
var api;
// Initialize DOM functionality

@@ -112,2 +109,58 @@ var dom = new(require("./utils/dom"))(opts);

/**
* Initialize a blank api queue, once initialized the queue will be cleared
*/
var apiStack = [];
var api = {
pixel: function(data, dest) {
apiStack.push(['pixel', data, dest]);
},
search: function(data, success, failure) {
apiStack.push(['search', data, success, failure]);
},
autocomplete: function(data, success, failure) {
apiStack.push(['autocomplete', data, success, failure]);
},
best: function(data, success, failure) {
apiStack.push(['best', data, success, failure]);
},
popular: function(data, success, failure) {
apiStack.push(['popular', data, success, failure]);
},
recent: function(data, success, failure) {
apiStack.push(['recent', data, success, failure]);
},
related: function(data, success, failure) {
apiStack.push(['related', data, success, failure]);
}
}
/**
* Initialize the API, clear the API stack and replace the stack with the API
*/
function apiInitialize(options) {
if (options.company === undefined || options.collection === undefined) {
log("company and collection cannot be undefined...");
return false;
}
// We have a company and a domain so we can install the API
// This replaces the stack shoving queue that was here previously
api = new API(opts.company, opts.collection, {
jsonp: true
});
log("API stack: ", api);
// Clear the API stack
var r;
while (r = apiStack.shift()) {
var fn = r.shift();
if (api[fn] !== undefined) {
api[fn].apply(api, r);
}
}
return true;
}
/**
* Render the results into the page

@@ -685,12 +738,4 @@ */

if (opts.company === undefined || opts.collection === undefined) {
log("company and collection cannot be undefined...");
return;
}
if (!apiInitialize(opts)) return;
// We have a company and a domain so we can install the API
api = new API(opts.company, opts.collection, {
jsonp: true
});
// Find and Install the Search Results DIV. If it does not exist, create an overlay block to handle results instead

@@ -742,3 +787,5 @@ if (!dom.hasNode('search-results')) {

if (!dom.hasNode('noindex')) {
stack.push(['index']);
setTimeout(function() {
stack.push(['index']);
}, 500);
}

@@ -922,2 +969,3 @@

(function() {
apiInitialize(opts);
loaded(window, function() {

@@ -924,0 +972,0 @@ if (opts.scanOnLoad) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc