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

docsearch.js

Package Overview
Dependencies
Maintainers
5
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docsearch.js - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

<a name="1.3.0"></a>
# [1.3.0](https://github.com/algolia/docsearch/compare/1.2.0...v1.3.0) (2016-06-12)
<a name="1.2.0"></a>

@@ -2,0 +8,0 @@ # [1.2.0](https://github.com/algolia/docsearch/compare/v1.1.3...v1.2.0) (2016-06-10)

14

dist/npm/src/lib/DocSearch.js

@@ -65,2 +65,4 @@ 'use strict';

var appId = _ref$appId === undefined ? 'BH4D9OD16A' : _ref$appId;
var _ref$debug = _ref.debug;
var debug = _ref$debug === undefined ? false : _ref$debug;
var _ref$algoliaOptions = _ref.algoliaOptions;

@@ -77,3 +79,3 @@ var algoliaOptions = _ref$algoliaOptions === undefined ? {} : _ref$algoliaOptions;

DocSearch.checkArguments({ apiKey: apiKey, indexName: indexName, inputSelector: inputSelector, algoliaOptions: algoliaOptions, autocompleteOptions: autocompleteOptions });
DocSearch.checkArguments({ apiKey: apiKey, indexName: indexName, inputSelector: inputSelector, debug: debug, algoliaOptions: algoliaOptions, autocompleteOptions: autocompleteOptions });

@@ -85,2 +87,4 @@ this.apiKey = apiKey;

this.algoliaOptions = _extends({ hitsPerPage: 5 }, algoliaOptions);
var autocompleteOptionsDebug = autocompleteOptions && autocompleteOptions.debug ? autocompleteOptions.debug : false;
autocompleteOptions.debug = debug || autocompleteOptionsDebug;
this.autocompleteOptions = autocompleteOptions;

@@ -213,4 +217,7 @@

var subcategory = _utilsJs2['default'].getHighlightedValue(hit, 'lvl1') || category;
var displayTitle = _utilsJs2['default'].compact([_utilsJs2['default'].getHighlightedValue(hit, 'lvl2') || subcategory, _utilsJs2['default'].getHighlightedValue(hit, 'lvl3'), _utilsJs2['default'].getHighlightedValue(hit, 'lvl4'), _utilsJs2['default'].getHighlightedValue(hit, 'lvl5'), _utilsJs2['default'].getHighlightedValue(hit, 'lvl6')]).join(' › ');
var isSubcategoryDuplicate = subcategory == category;
var displayTitle = _utilsJs2['default'].compact([_utilsJs2['default'].getHighlightedValue(hit, 'lvl2') || subcategory, _utilsJs2['default'].getHighlightedValue(hit, 'lvl3'), _utilsJs2['default'].getHighlightedValue(hit, 'lvl4'), _utilsJs2['default'].getHighlightedValue(hit, 'lvl5'), _utilsJs2['default'].getHighlightedValue(hit, 'lvl6')]).join('<span class="aa-suggestion-title-separator"> › </span>');
var isDisplayTitleDuplicate = displayTitle == subcategory;
var text = _utilsJs2['default'].getSnippetedValue(hit, 'content');
var isTextOrSubcatoryNonEmpty = subcategory && subcategory != "" || displayTitle && displayTitle != "";

@@ -220,2 +227,5 @@ return {

isSubCategoryHeader: hit.isSubCategoryHeader,
isSubcategoryDuplicate: isSubcategoryDuplicate,
isDisplayTitleDuplicate: isDisplayTitleDuplicate,
isTextOrSubcatoryNonEmpty: isTextOrSubcatoryNonEmpty,
category: category,

@@ -222,0 +232,0 @@ subcategory: subcategory,

2

dist/npm/src/lib/templates.js

@@ -11,3 +11,3 @@ 'use strict';

var templates = {
suggestion: '\n <div class="' + suggestionPrefix + '\n {{#isCategoryHeader}}' + suggestionPrefix + '__main{{/isCategoryHeader}}\n {{#isSubCategoryHeader}}' + suggestionPrefix + '__secondary{{/isSubCategoryHeader}}\n ">\n <div class="' + suggestionPrefix + '--category-header">{{{category}}}</div>\n <div class="' + suggestionPrefix + '--wrapper">\n <div class="' + suggestionPrefix + '--subcategory-column">\n <span class="' + suggestionPrefix + '--subcategory-column-text">{{{subcategory}}}</span>\n </div>\n <div class="' + suggestionPrefix + '--content">\n <div class="' + suggestionPrefix + '--subcategory-inline">{{{subcategory}}}</div>\n <div class="' + suggestionPrefix + '--title">{{{title}}}</div>\n <div class="' + suggestionPrefix + '--text">{{{text}}}</div>\n </div>\n </div>\n </div>\n ',
suggestion: '\n <div class="' + suggestionPrefix + '\n {{#isCategoryHeader}}' + suggestionPrefix + '__main{{/isCategoryHeader}}\n {{#isSubCategoryHeader}}' + suggestionPrefix + '__secondary{{/isSubCategoryHeader}}\n ">\n <div class="' + suggestionPrefix + '--category-header">{{{category}}}</div>\n <div class="' + suggestionPrefix + '--wrapper">\n <div class="' + suggestionPrefix + '--subcategory-column {{#isSubcategoryDuplicate}}' + suggestionPrefix + '--duplicate-content{{/isSubcategoryDuplicate}}">\n <span class="' + suggestionPrefix + '--subcategory-column-text">{{{subcategory}}}</span>\n </div>\n {{#isTextOrSubcatoryNonEmpty}}\n <div class="' + suggestionPrefix + '--content">\n <div class="' + suggestionPrefix + '--subcategory-inline {{#isSubcategoryDuplicate}}' + suggestionPrefix + '--duplicate-content{{/isSubcategoryDuplicate}}">{{{subcategory}}}</div>\n <div class="' + suggestionPrefix + '--title {{#isDisplayTitleDuplicate}}' + suggestionPrefix + '--duplicate-content{{/isDisplayTitleDuplicate}}">{{{title}}}</div>\n {{#text}}<div class="' + suggestionPrefix + '--text">{{{text}}}</div>{{/text}}\n </div>\n {{/isTextOrSubcatoryNonEmpty}}\n </div>\n </div>\n ',
footer: '\n <div class="' + footerPrefix + '">\n Search by <a class="' + footerPrefix + '--logo" href="https://www.algolia.com/docsearch">Algolia</a>\n </div>\n '

@@ -14,0 +14,0 @@ };

@@ -6,3 +6,3 @@ 'use strict';

});
exports['default'] = '1.2.0';
exports['default'] = '1.3.0';
module.exports = exports['default'];

@@ -126,6 +126,6 @@ ---

inputSelector: '<YOUR_INPUT_DOM_SELECTOR>',
debug: true,
autocompleteOptions: {
// See https://github.com/algolia/autocomplete.js#options
// For full list of options
debug: true
}

@@ -132,0 +132,0 @@ });

{
"name": "docsearch.js",
"version": "1.2.0",
"version": "1.3.0",
"description": "Add an autocomplete dropdown to your documentation",

@@ -5,0 +5,0 @@ "main": "dist/npm/index.js",

@@ -164,6 +164,6 @@ ![DocSearch](docs/img/docsearch-logo.png)

inputSelector: '<YOUR_INPUT_DOM_SELECTOR>',
debug: true,
autocompleteOptions: {
// See https://github.com/algolia/autocomplete.js#options
// For full list of options
debug: true
}

@@ -170,0 +170,0 @@ });

@@ -37,2 +37,3 @@ import Hogan from 'hogan.js';

appId = 'BH4D9OD16A',
debug = false,
algoliaOptions = {},

@@ -45,3 +46,3 @@ autocompleteOptions = {

}) {
DocSearch.checkArguments({apiKey, indexName, inputSelector, algoliaOptions, autocompleteOptions});
DocSearch.checkArguments({apiKey, indexName, inputSelector, debug, algoliaOptions, autocompleteOptions});

@@ -53,2 +54,4 @@ this.apiKey = apiKey;

this.algoliaOptions = {hitsPerPage: 5, ...algoliaOptions};
let autocompleteOptionsDebug = autocompleteOptions && autocompleteOptions.debug ? autocompleteOptions.debug: false;
autocompleteOptions.debug = debug || autocompleteOptionsDebug;
this.autocompleteOptions = autocompleteOptions;

@@ -148,2 +151,3 @@

let subcategory = utils.getHighlightedValue(hit, 'lvl1') || category;
let isSubcategoryDuplicate = subcategory == category;
let displayTitle = utils.compact([

@@ -155,4 +159,6 @@ utils.getHighlightedValue(hit, 'lvl2') || subcategory,

utils.getHighlightedValue(hit, 'lvl6')
]).join(' › ');
]).join('<span class="aa-suggestion-title-separator"> › </span>');
let isDisplayTitleDuplicate = displayTitle == subcategory;
let text = utils.getSnippetedValue(hit, 'content');
let isTextOrSubcatoryNonEmpty = (subcategory && subcategory != "") || (displayTitle && displayTitle != "");

@@ -162,2 +168,5 @@ return {

isSubCategoryHeader: hit.isSubCategoryHeader,
isSubcategoryDuplicate: isSubcategoryDuplicate,
isDisplayTitleDuplicate: isDisplayTitleDuplicate,
isTextOrSubcatoryNonEmpty: isTextOrSubcatoryNonEmpty,
category: category,

@@ -164,0 +173,0 @@ subcategory: subcategory,

@@ -13,10 +13,12 @@ let prefix = 'algolia-docsearch';

<div class="${suggestionPrefix}--wrapper">
<div class="${suggestionPrefix}--subcategory-column">
<div class="${suggestionPrefix}--subcategory-column {{#isSubcategoryDuplicate}}${suggestionPrefix}--duplicate-content{{/isSubcategoryDuplicate}}">
<span class="${suggestionPrefix}--subcategory-column-text">{{{subcategory}}}</span>
</div>
{{#isTextOrSubcatoryNonEmpty}}
<div class="${suggestionPrefix}--content">
<div class="${suggestionPrefix}--subcategory-inline">{{{subcategory}}}</div>
<div class="${suggestionPrefix}--title">{{{title}}}</div>
<div class="${suggestionPrefix}--text">{{{text}}}</div>
<div class="${suggestionPrefix}--subcategory-inline {{#isSubcategoryDuplicate}}${suggestionPrefix}--duplicate-content{{/isSubcategoryDuplicate}}">{{{subcategory}}}</div>
<div class="${suggestionPrefix}--title {{#isDisplayTitleDuplicate}}${suggestionPrefix}--duplicate-content{{/isDisplayTitleDuplicate}}">{{{title}}}</div>
{{#text}}<div class="${suggestionPrefix}--text">{{{text}}}</div>{{/text}}
</div>
{{/isTextOrSubcatoryNonEmpty}}
</div>

@@ -23,0 +25,0 @@ </div>

@@ -1,1 +0,1 @@

export default '1.2.0';
export default '1.3.0';

@@ -162,3 +162,3 @@ /* eslint-env mocha */

algoliaOptions: {anOption: 42},
autocompleteOptions: 'autocompleteOptions'
autocompleteOptions: {anOption: 44}
};

@@ -172,3 +172,3 @@

expect(actual.algoliaOptions.anOption).toEqual(42);
expect(actual.autocompleteOptions).toEqual('autocompleteOptions');
expect(actual.autocompleteOptions).toEqual({debug: false, anOption: 44});
});

@@ -200,3 +200,3 @@ it('should instantiate algoliasearch with the correct values', () => {

...defaultOptions,
autocompleteOptions: 'bar'
autocompleteOptions: {anOption: '44'}
};

@@ -211,3 +211,3 @@ let $input = $('<input name="foo" />');

expect(AutoComplete.calledOnce).toBe(true);
expect(AutoComplete.calledWith($input, 'bar')).toBe(true);
expect(AutoComplete.calledWith($input, {anOption: '44', debug: false})).toBe(true);
});

@@ -702,4 +702,5 @@ it('should listen to the selected and shown event of autocomplete', () => {

let separator = '<span class="aa-suggestion-title-separator"> › </span>';
// Then
expect(actual[0].title).toEqual('Geo-search › Foo › Bar › Baz');
expect(actual[0].title).toEqual('Geo-search' + separator + 'Foo' + separator + 'Bar' + separator + 'Baz');
});

@@ -744,7 +745,6 @@ it('should concatenate highlighted elements', () => {

let separator = '<span class="aa-suggestion-title-separator"> › </span>';
// Then
let expected = '<mark>Geo-search</mark>' +
' › <mark>Foo</mark>' +
' › <mark>Bar</mark>' +
' › <mark>Baz</mark>';
let expected = '<mark>Geo-search</mark>' + separator + '<mark>Foo</mark>' + separator +
'<mark>Bar</mark>' + separator + '<mark>Baz</mark>';
expect(actual[0].title).toEqual(expected);

@@ -751,0 +751,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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