Last active
October 9, 2018 17:26
-
-
Save mish15/87ac346ce1e7572771d91f3098cdf6c5 to your computer and use it in GitHub Desktop.
hfma.org install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h3>Search Box in your nav</h3> | |
<p>Once installed on your site, searching from this search box will take you to your search page at /GSASearch.aspx.</p> | |
<!-- 1. Add to global navigation to create a global search box --> | |
<div id="nav-search-box"></div> | |
<!-- 1. Add to global navigation to create a global search box --> | |
<hr> | |
<h3>Results Page</h3> | |
<!-- 2. Add to /GSASearch.aspx search results page --> | |
<div id="results-search-box"></div> | |
<div id="results-search-response"></div> | |
<!-- 2. Add to /GSASearch.aspx search results page --> | |
<!-- 3. Add to global template, enables search UI --> | |
<script> | |
var getUrlParam = function(e){var t = new RegExp("[?&]" + e.replace(/[\[\]]/g, "\\$&") + "(=([^&#]*)|&|#|$)"),a = t.exec(window.location.href);return a && a[2] ? decodeURIComponent(a[2].replace(/\+/g, " ")) : ""}; | |
var setup = function(w,d,x,a,e,s,c,r){s = [];var b=function(){s.push(arguments);},q="ui";b.arr=s;w[a]=w[a]||[];w[a][q]=w[a][q]||[];w[a][q].push(b);c=d.createElement(x);c.async=1;c.src=e;c.charset="UTF-8";r=d.getElementsByTagName(x)[0];r.parentNode.insertBefore(c,r);return b;}; | |
var searchInterface = setup(window, document, "script", "sajari", "//cdn.sajari.net/js/integrations/website-search-1.4.js"); | |
searchInterface({ | |
mode: "inline", | |
project: "1538937118492159477", // Set this to your project. | |
collection: "test-hfma-org", // Set this to your collection. | |
pipeline: "website", // Set the search pipeline. | |
instantPipeline: "autocomplete", // Set the instant pipeline. | |
attachSearchBox: document.getElementById("results-search-box"), // DOM element to render search box. | |
attachSearchResponse: document.getElementById("results-search-response"), // DOM element to render search results. | |
inputPlaceholder: "Search", // Placeholder text for the search box. | |
inputAutoFocus: false, // Focus the input element on render. | |
maxSuggestions: 5, // Maximum number of suggestions to show. | |
results: {"showImages": false }, // Configure the results. | |
values: { | |
"q.override": true, | |
"resultsPerPage": "10", | |
"q": getUrlParam("q") | |
}, | |
tabFilters: null, // User selectable filters | |
styling: { theme: { colors: { brand: { primary: "#ff9900" }}}} | |
}); | |
var searchBox = setup(window, document, "script", "sajari", "//cdn.sajari.net/js/integrations/website-search-1.4.js"); | |
searchBox({ | |
mode: "search-box", | |
project: "1538937118492159477", // Set this to your project. | |
collection: "test-hfma-org", // Set this to your collection. | |
instantPipeline: "autocomplete", // Pipeline used as you type | |
inputPlaceholder: "Search", // Input element placeholder | |
maxSuggestions: 5, // Maximum number of suggestions to show | |
attachSearchBox: document.getElementById("nav-search-box") // DOM element to attach to | |
}); | |
searchBox("sub", "pipeline.search-sent", function (_, query) { | |
window.location = "/GSASearch.aspx?q=" + encodeURIComponent(query.q); | |
}); | |
</script> | |
<!-- 3. Add to global template, enables search UI --> | |
<!-- 4. Add to global template, enables instant indexing, popularity measurement --> | |
<script type="text/javascript"> | |
var _sj = _sj || []; | |
_sj.push(['project', '1538937118492159477']); | |
_sj.push(['collection', 'test-hfma-org']); | |
(function () { | |
var sj = document.createElement('script'); | |
sj.type = 'text/javascript'; | |
sj.async = true; | |
sj.src = '//cdn.sajari.com/js/sj.js'; | |
var s = document.getElementsByTagName('script')[0]; | |
s.parentNode.insertBefore(sj, s); | |
})(); | |
</script> | |
<!-- 4. Add to global template, enables instant indexing, popularity measurement --> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment