sajari-website
Advanced tools
Comparing version 0.5.3 to 0.5.4
{ | ||
"name": "sajari-website", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "Website extensions for the Sajari API. Automatically index site content, add user profiles, render search and recommendations, etc.", | ||
@@ -5,0 +5,0 @@ "author": { |
(function(){function result(it | ||
/**/) { | ||
var out='<div class="sj-result-item">';if(it.showThumb){if(res.meta.image){out+='<div class="sj-thumb-wrapper"><div class="sj-result-thumb" style="background-image:url('+(res.meta.image)+'"></div></div>';}else if(true){}}out+='<div class="sj-result-wrapper"><div class="sj-result-title" data-docid="'+(res.docId)+'"> <a class="sj-result-link" href="'+(res.meta.url)+'" data-query-id="'+(it.queryID)+'" data-slot="'+(index+1)+'" data-injected="'+(res.meta.injected)+'">'+(res.meta.title)+'</a></div>';if(it.showDesc){out+='<p class="sj-result-meta"><span class="sj-result-meta-desc">'+(res.meta.description)+'</span></p>';}if(it.showMeta.length){var arr1=it.showMeta;if(arr1){var m,i1=-1,l1=arr1.length-1;while(i1<l1){m=arr1[i1+=1];out+='<p class="sj-result-meta"><span class="sj-result-meta-wrapper" data-sj-meta-key="'+(m)+'"><span class="sj-result-meta-name">'+(m)+'</span> <span class="sj-result-meta-value">'+(res.meta[m])+'</span></span></p>';} } }if(it.showUrl){out+='<p class="sj-result-meta"><span class="sj-result-meta-url">'+(res.meta.url)+'</span></p>';}out+='</div></div>';return out; | ||
var out='<div class="sj-result-item">';if(it.showThumb){if(res.meta.image){out+='<div class="sj-thumb-wrapper"><div class="sj-result-thumb" style="background-image:url('+(res.meta.image)+'"></div></div>';}else if(true){}}out+='<div class="sj-result-wrapper"><div class="sj-result-title" data-docid="'+(res.docId)+'"> <a class="sj-result-link" href="'+(res.meta.url)+'" data-query-id="'+(it.queryID)+'" data-slot="'+(index+1)+'" ';if(res.meta.injected){out+='data-injected="'+(res.meta.injected)+'"';}out+=' ';if(res.meta._token){out+=' onmousedown="this.href=\''+(it.tokenEndpoint)+'/token/'+(res.meta._token)+'\';"';}out+='>'+(res.meta.title)+'</a></div>';if(it.showDesc){out+='<p class="sj-result-meta"><span class="sj-result-meta-desc">'+(res.meta.description)+'</span></p>';}if(it.showMeta.length){var arr1=it.showMeta;if(arr1){var m,i1=-1,l1=arr1.length-1;while(i1<l1){m=arr1[i1+=1];out+='<p class="sj-result-meta"><span class="sj-result-meta-wrapper" data-sj-meta-key="'+(m)+'"><span class="sj-result-meta-name">'+(m)+'</span> <span class="sj-result-meta-value">'+(res.meta[m])+'</span></span></p>';} } }if(it.showUrl){out+='<p class="sj-result-meta"><span class="sj-result-meta-url">'+(res.meta.url)+'</span></p>';}out+='</div></div>';return out; | ||
}function results(it | ||
/**/) { | ||
var out='';if(it.results.length){if(it.renderType == "search"){out+='<p class="sj-search-info">Showing 1-'+(it.results.length)+' of '+(it.totalmatches)+' results ('+(it.formattedMsecs)+' seconds)</p>';if(it.fuzzyStr){out+='<p class="sj-search-info sj-search-fuzzy">Showing results for <strong>'+(it.fuzzyStr)+'</strong></p>';}else if(true){}}var arr1=it.results;if(arr1){var res,index=-1,l1=arr1.length-1;while(index<l1){res=arr1[index+=1];out+='<div class="sj-result-item">';if(it.showThumb){if(res.meta.image){out+='<div class="sj-thumb-wrapper"><div class="sj-result-thumb" style="background-image:url('+(res.meta.image)+'"></div></div>';}else if(true){}}out+='<div class="sj-result-wrapper"><div class="sj-result-title" data-docid="'+(res.docId)+'"> <a class="sj-result-link" href="'+(res.meta.url)+'" data-query-id="'+(it.queryID)+'" data-slot="'+(index+1)+'" data-injected="'+(res.meta.injected)+'">'+(res.meta.title)+'</a></div>';if(it.showDesc){out+='<p class="sj-result-meta"><span class="sj-result-meta-desc">'+(res.meta.description)+'</span></p>';}if(it.showMeta.length){var arr2=it.showMeta;if(arr2){var m,i2=-1,l2=arr2.length-1;while(i2<l2){m=arr2[i2+=1];out+='<p class="sj-result-meta"><span class="sj-result-meta-wrapper" data-sj-meta-key="'+(m)+'"><span class="sj-result-meta-name">'+(m)+'</span> <span class="sj-result-meta-value">'+(res.meta[m])+'</span></span></p>';} } }if(it.showUrl){out+='<p class="sj-result-meta"><span class="sj-result-meta-url">'+(res.meta.url)+'</span></p>';}out+='</div></div>';} } }else if(true){if(it.renderType == "search"){out+='<p class="sj-noresults">No results found.</p>';}if(it.errors){out+='<p class="sj-error">Oops! An error occured while searching. Please try again.</p>';}}return out; | ||
var out='';if(it.results.length){if(it.renderType == "search"){out+='<p class="sj-search-info">Showing 1-'+(it.results.length)+' of '+(it.totalmatches)+' results ('+(it.formattedMsecs)+' seconds)</p>';if(it.fuzzyStr){out+='<p class="sj-search-info sj-search-fuzzy">Showing results for <strong>'+(it.fuzzyStr)+'</strong></p>';}else if(true){}}var arr1=it.results;if(arr1){var res,index=-1,l1=arr1.length-1;while(index<l1){res=arr1[index+=1];out+='<div class="sj-result-item">';if(it.showThumb){if(res.meta.image){out+='<div class="sj-thumb-wrapper"><div class="sj-result-thumb" style="background-image:url('+(res.meta.image)+'"></div></div>';}else if(true){}}out+='<div class="sj-result-wrapper"><div class="sj-result-title" data-docid="'+(res.docId)+'"> <a class="sj-result-link" href="'+(res.meta.url)+'" data-query-id="'+(it.queryID)+'" data-slot="'+(index+1)+'" ';if(res.meta.injected){out+='data-injected="'+(res.meta.injected)+'"';}out+=' ';if(res.meta._token){out+=' onmousedown="this.href=\''+(it.tokenEndpoint)+'/token/'+(res.meta._token)+'\';"';}out+='>'+(res.meta.title)+'</a></div>';if(it.showDesc){out+='<p class="sj-result-meta"><span class="sj-result-meta-desc">'+(res.meta.description)+'</span></p>';}if(it.showMeta.length){var arr2=it.showMeta;if(arr2){var m,i2=-1,l2=arr2.length-1;while(i2<l2){m=arr2[i2+=1];out+='<p class="sj-result-meta"><span class="sj-result-meta-wrapper" data-sj-meta-key="'+(m)+'"><span class="sj-result-meta-name">'+(m)+'</span> <span class="sj-result-meta-value">'+(res.meta[m])+'</span></span></p>';} } }if(it.showUrl){out+='<p class="sj-result-meta"><span class="sj-result-meta-url">'+(res.meta.url)+'</span></p>';}out+='</div></div>';} } }else if(true){if(it.renderType == "search"){out+='<p class="sj-noresults">No results found.</p>';}if(it.errors){out+='<p class="sj-error">Oops! An error occured while searching. Please try again.</p>';}}return out; | ||
}var itself=results;itself.result=result;if(typeof module!=='undefined' && module.exports) module.exports=itself;else if(typeof define==='function')define(function(){return itself;});else {window.render=window.render||{};window.render['results']=itself;}}()); |
@@ -13,2 +13,3 @@ require("./utils/polyfills"); | ||
cssUrl: 'https://www.sajari.com/css/sj.css', // Default styling if desired | ||
tokenEndpoint: 'https://www.sajari.com', | ||
prefix: 'data-sj-', // Elements with Sajari data parameters all use this as a prefix | ||
@@ -129,2 +130,3 @@ autoFlush: 100, // Flush the stack array queue automatically X msecs. 0 is no auto-flush | ||
res.showMeta = []; | ||
res.tokenEndpoint = opts.tokenEndpoint; | ||
@@ -168,16 +170,4 @@ // Handle formatting options | ||
// Add tracking information to each result so clicks are handled: | ||
// TODO | ||
// this.href='https://www.sajari.com/????/redir?p=???? web token | ||
// Render it | ||
renderNode.innerHTML = renderResults(res); | ||
// Bind onclick events to the new result nodes | ||
var nodes = document.getElementsByClassName('sj-result-link'); | ||
for (var j = 0; j < nodes.length; j++) { | ||
dom.bind(nodes[j], 'mousedown', function() { | ||
SJ.SendClick(this.getAttribute('data-query-id'), this.getAttribute('data-slot'), this.getAttribute('data-injected'), this); | ||
}); | ||
} | ||
} | ||
@@ -760,9 +750,2 @@ | ||
// Send click throughs. We push onto the stack as the API is still initializing | ||
// TODO - Remove once click through URL tracking is added. | ||
var qid = url.getURLParameter("q.id"); | ||
if (qid) { | ||
stack.push(['click', qid, url.getURLParameter("q.sl"), url.getURLParameter("q.in")]); | ||
} | ||
// Flush our stack in case settings impact the install of components | ||
@@ -865,2 +848,5 @@ flush(); | ||
/** | ||
* Sends a click tracking event. DEPRECATED - Will be removed at some point. Use token tracking instead. | ||
*/ | ||
SendClick: function(qid, slot, injected, node) { | ||
@@ -867,0 +853,0 @@ var u = ""; |
Sorry, the diff of this file is not supported yet
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
63181
1652