          <html>
                        <head>
                            <title>Search_tickets</title><script type="text/javascript" src="/html_app/bower_components/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/static/dataiku/js/dataiku.client.js"></script>
<style id="dku_css" media="screen" type="text/css">
                                  
/* CUSTOM
// ------------------------- */
.hit .hit-content .time {
	color: #999;
}

.hit-content {
	margin-left: 20px;
}

.hit-content h2 {
	margin-left: -10px;
}

.hit-content img {
	max-width: 100%;
}

.remark-8k {
	color: #999;
    font-size:80%;
}

/* GENERAL
// ------------------------- */

* {
	font-family: 'Helvetica Neue', Helvetica, sans-serif;
}
html {
	overflow-y: scroll;
}
header, main, #no-results, footer {
	width: 1000px;
	margin: 0 auto;
}
main {
	min-height: 360px;
}
#left-column {
	float: left;
	width: 23%;
}
#right-column {
	width: 74%;
	margin-left: 26%;
}



/* SEARCH INPUT
// ------------------------- */

header {
	position: relative;
	height: 80px;
	margin-top: 40px;
}
header img {
	position: absolute;
	top: 9px;
	left: 0;
	float: left;
	max-width: 23%;
}
#search-input {
	font-size: 28px;
	font-weight: 100;
	width: 74%;
	margin-left: 26%;
	padding: 10px 0 6px;
	border: none;
	border-bottom: 5px solid #eee;
}
#search-input, #search-input:focus {
	transition: border-color .3s ease-in;
	outline: 0;
}
#search-input:focus {
	border-color: #ed5565;
}
#search-input::-webkit-input-placeholder, #search-input:-moz-placeholder, #search-input:-moz-placeholder, #search-input:-ms-input-placeholder {
	font-weight: 100;
	color: #999;
}
#search-input-icon {
	position: relative;
}
#search-input-icon:before {
	position: absolute;
	right: 0;
	bottom: 15px;
	width: 20px;
	height: 20px;
	content: '';
	cursor: default;
	background: url(/local/static/algolia/img/search_icon.png) no-repeat;
}
#search-input-icon.empty:before {
	cursor: pointer;
	background-image: url(/local/static/algolia/img/delete_icon.png);
}



/* HITS
// ------------------------- */

#hits {
	margin: 4px 0;
	padding: 10px 0;
	border-top: 2px solid #eee;
}
.hit {
	font-size: 0;
	padding: 8px 0;
	border-bottom: 1px solid #eee;
}
.hit-image {
	display: inline-block;
	width: 16%;
}
.hit-image img {
	max-width: 100%;
	max-height: 180px;
}
.hit-content {
	font-size: 13px;
	font-weight: 300;
	display: inline-block;
	width: 83%;
	margin-left: 1%;
	vertical-align: top;
}
.hit-content .hit-price {
	font-size: 20px;
	float: right;
	margin-left: 20px;
	color: #ed5565;
}
.hit-content .hit-price, .hit-content .hit-name {
	font-weight: normal;
	margin-top: 0;
}
.hit-content em {
	font-style: normal;
	background: #fbdde0;
}
.hit-content .hit-description {
	color: #999;
}

/* PAGINATION
// ------------------------- */

#pagination {
	margin-top: 60px;
}
#pagination ul {
	font-size: 0;
	list-style-type: none;
	text-align: center;
}
#pagination li {
	font-size: 14px;
	display: inline;
}
#pagination a {
	padding: 8px 12px;
	text-decoration: none;
	color: #000;
	border: 1px solid #eee;
	border-right: none;
}
#pagination a:hover {
	background: #f5f5f5;
}
#pagination li:first-child a {
	border-top-left-radius: 4px;
	border-bottom-left-radius: 4px;
}
#pagination li:last-child a {
	border-right: 1px solid #eee;
	border-top-right-radius: 4px;
	border-bottom-right-radius: 4px;
}
#pagination li.active a {
	color: white;
	border-color: #ed5565;
	background: #ed5565;
}
#pagination li.active a:hover {
	cursor: default;
}
#pagination li.disabled a {
	cursor: not-allowed;
}
#pagination li.disabled a:hover {
	background: none;
}



/* SORT-BY
// ------------------------- */

#sort-by {
	font-weight: 300;
	position: relative;
	float: right;
	color: #999;
}
#sort-by select {
	font-size: 16px;
	padding-right: 14px;
	cursor: pointer;
	border: none;
	outline: none;
	background: none;
	-webkit-appearance: none;
	-moz-appearance: none;
}
#sort-by .caret {
	position: absolute;
	top: 8px;
	right: 0;
	display: inline-block;
	width: 0;
	height: 0;
	margin-left: 2px;
	vertical-align: middle;
	pointer-events: none;
	color: #000;
	border-top: 4px dashed;
	border-right: 4px solid transparent;
	border-left: 4px solid transparent;
}



/* STATS
// ------------------------- */

#stats {
	min-height: 18px;
}
#stats .found-in {
	font-size: 12px;
	color: #999;
}



/* FACETS
// ------------------------- */

.facet {
	margin-bottom: 24px;
}
.facet h5 {
	margin: 0 0 6px;
	padding: 0 0 6px;
	text-transform: uppercase;
	border-bottom: 2px solid #eee;
}
.facet ul {
	margin: 0;
	padding: 0;
	list-style-type: none;
}
.facet li {
	margin-bottom: 3px;
}
.facet-link {
	font-size: 13px;
	line-height: 1.2;
	text-decoration: none;
	color: #000;
}
.facet-link:hover, .facet-link.facet-refined {
	color: #ed5565;
}
.facet .facet-link.facet-refined:hover {
	text-decoration: line-through;
	color: #ed5565;
}
.facet-count {
	position: relative;
	top: 3px;
	float: right;
	color: #999;
}
/* Checkboxes */
.facet-disjunctive {
	font-weight: normal;
	position: relative;
	margin-left: 18px;
}
.facet-disjunctive:before {
	position: absolute;
	top: 1px;
	left: -18px;
	width: 16px;
	height: 16px;
	content: '';
	background: url(/local/static/algolia/img/checkbox_icons.png) 0 0 no-repeat;
}
.facet-disjunctive:hover:before {
	background-position: -24px 0;
}
.facet-disjunctive.facet-refined:before {
	background-position: -48px 0;
}
.facet-disjunctive.facet-refined:hover:before {
	background-position: -72px 0;
}



/* No-result
// ------------------------- */

.no-results #pagination, .no-results #sort-by, .no-results #stats, .no-results #facets {
	display: none;
}
#no-results-message {
	text-align: center;
}
#no-results-message p {
	font-size: 28px;
	font-weight: 100;
}
#no-results-message ul {
	list-style-type: none;
}
#no-results-message li {
	font-size: 12px;
	position: relative;
	display: inline-block;
	margin: 4px 2px;
	padding: 4px 28px 4px 8px;
	color: #999;
	border: 1px solid #ddd;
	border-radius: 12px;
}
#no-results-message li span.value {
	font-weight: bold;
	color: #000;
}
#no-results-message li a.remove img {
	position: absolute;
	top: 3px;
	right: 5px;
	float: right;
	width: 17px;
	height: 17px;
	opacity: .5;
}
#no-results-message li a.remove:hover img {
	opacity: 1;
}
a.clear-all {
	font-size: 12px;
	line-height: 1;
	display: inline-block;
	margin: 10px;
	padding: 8px 12px;
	text-decoration: none;
	color: black;
	border: 2px solid #ddd;
	border-radius: 4px;
}
a.clear-all:hover {
	transition: border-color .3s ease-in;
	border-color: #999;
}



/* FOOTER
// ------------------------- */

footer {
	font-size: 14px;
	margin-top: 200px;
	margin-bottom: 24px;
	text-align: center;
}
footer a {
	text-decoration: none;
	color: #ed5565;
}
footer a:hover {
	text-decoration: underline;
	color: #ed5565;
}

                            </style>
                        </head>
                        <body>
                            <div id="dku_html">
                                  <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/jquery.ion.rangeslider/2.0.12/css/ion.rangeSlider.css">
  <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/jquery.ion.rangeslider/2.0.12/css/ion.rangeSlider.skinFlat.css">

  <!-- Header -->
  <header>
    <img src="https://assets-cdn.github.com/images/modules/logos_page/Octocat.png"/ height="50em">
    <input id="search-input" type="text" autocomplete="off" spellcheck="false" autocorrect="off" placeholder="Search by word, author, tag..."/>
    <div id="search-input-icon"></div>
  </header>
  <!-- /Header -->


  <!-- Main -->
  <main>
    <!-- Left Column -->
    <div id="left-column">
      <div id="facets"></div>
    </div>

    <!-- Right Column -->
    <div id="right-column">
      <div id="sort-by">
				<!-- Sort by: -->
        <!-- <select dir="rtl" id="sort-by-select"> -->
        <!--   <option value="" selected>Most recent ID</option> -->
        <!--   <option value="_updated_desc">Most recent update</option> -->
        <!-- </select> -->
        <!-- <span class="caret"></span> -->
      </div>
      <div id="stats"></div>
      <div id="hits"></div>
      <div id="pagination"></div>
    </div>
  </main>
  <!-- /Main -->


  <!-- Footer -->
  <footer>
    Powered by <a href="http://algolia.com"><img height="14em" src="/local/static/algolia/img/Algolia_logo_bg-white.jpg"></a>
  </footer>
  <!-- /Footer -->



  <!-- Hit template -->
  <script type="text/template" id="hit-template">
    {{#hits}}
    <div class="hit">
      <!-- <div class="hit-image"> <img src="{{ image }}" alt="{{ name }}"> </div> -->
      <div class="hit-content">
				<h2><a href="https://github.com/dataiku/dip/issues/{{ objectID }}">{{ objectID }}
				{{{ _highlightResult.title.value }}}</a></h2>
				<!-- <h3 class="hit-name"></h3> -->
			  <div class="hit-description">
					<p> {{#milestone}}{{{ _highlightResult.milestone.value }}}, {{/milestone}}{{{ _highlightResult.state.value }}}</p>
					<p>Created {{{ created_at_html }}},
					   updated {{{ updated_at_html }}}{{#closed_at_html}}, closed {{/closed_at_html}}{{{ closed_at_html }}}.</p>
					<p>{{#tags_mustache}}{{data}}&nbsp;{{/tags_mustache}}</p>
					<p>By {{{ _highlightResult.user.value }}}{{#assignee}}, assigned to {{{ assignee }}}{{/assignee}}</p>
				</div>
				<p>{{{ _highlightResult.texts.value }}}</p>
      </div>
    </div>
    {{/hits}}
  </script>

  <!-- Stats template -->
  <script type="text/template" id="stats-template">
    {{ nbHits }} Result{{#nbHits_plural}}s{{/nbHits_plural}} <!-- <span class="found-in">Found in {{ processingTimeMS }}ms</span> -->
  </script>

  <!-- Facet template -->
  <script type="text/template" id="facet-template">
    <div class="facet">
      <h5>{{ title }}</h5>
      <ul>
        {{#values}}
        <li>
          <a href="" class="facet-link toggle-refine {{#disjunctive}}facet-disjunctive{{/disjunctive}} {{#isRefined}}facet-refined{{/isRefined}}" data-facet="{{ facet }}" data-value="{{ name }}">
            {{ name }}<span class="facet-count">{{ count }}</span>
          </a>
        </li>
        {{/values}}
      </ul>
    </div>
  </script>

  <!-- Slider template -->
  <script type="text/template" id="slider-template">
    <div class="facet">
      <h5>{{ title }}</h5>
      <input type="text" id="{{ facet }}-slider" data-min="{{ min }}" data-max="{{ max }}" data-from="{{ from }}" data-to="{{ to }}"/>
    </div>
  </script>

  <!-- Pagination template -->
  <script type="text/template" id="pagination-template">
    <ul>
      <li {{^prev_page}}class="disabled"{{/prev_page}}><a href="#" {{#prev_page}}class="go-to-page" data-page="{{ prev_page }}"{{/prev_page}}>&#60;</a></li>
      {{#pages}}
      <li class="{{#current}}active{{/current}} {{#disabled}}disabled{{/disabled}}"><a href="#" {{^disabled}} class="go-to-page" data-page="{{ number }}" {{/disabled}}>{{ number }}</a></li>
      {{/pages}}
      <li {{^next_page}}class="disabled"{{/next_page}}><a href="#" {{#next_page}}class="go-to-page" data-page="{{ next_page }}"{{/next_page}}>&#62;</a></li>
    </ul>
  </script>

  <!-- No-Results template -->
  <script type="text/template" id="no-results-template">
    <div id="no-results-message">
      <p>We didn't find any results for the search <em>"{{ query }}"</em>.</p>
      <ul>
        {{#filters}}
        <li class="{{ class }}" data-facet="{{ facet }}" data-value="{{ facet_value }}">
          {{ label }}<span class="value">{{ label_value }}</span><a class="remove"><img src="/local/static/algolia/img/remove.svg"/></a>
        </li>
        {{/filters}}
        <br>
        <a href="" class='clear-all'>Clear all</a>
      </ul>
    </div>
  </script>



  <!-- Javascript -->
  <script src="https://cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js"></script>
  <script src="https://cdn.jsdelivr.net/algoliasearch/3/algoliasearch.min.js"></script>
  <script src="https://cdn.jsdelivr.net/algoliasearch.helper/2/algoliasearch.helper.min.js"></script>
  <script src="https://cdn.jsdelivr.net/hogan.js/3.0.2/hogan.min.common.js"></script>
  <script src="https://cdn.jsdelivr.net/jquery.ion.rangeslider/2.0.12/js/ion.rangeSlider.min.js"></script>
  <script src="js/app.js"></script>
  <!-- /Javascript -->
                            </div>
                            <script id="dku_js">
                                //dataiku.setAPIKey('dYh6TqWzMHm4feb92gHgw8ipqpdVpj3Y');
//dataiku.setDefaultProjectKey('GITHUB');
/* global $, Hogan, algoliasearch, algoliasearchHelper */

$(document).ready(function () {
  // INITIALIZATION
  // ==============

  // Replace with your own values
  var APPLICATION_ID = 'DVUQIK7FZJ';
  var SEARCH_ONLY_API_KEY = '14f9db84a0597619039fb30c5cbec37e';
  var INDEX_NAME = 'issues';
  var PARAMS = {
    hitsPerPage: 20,
    maxValuesPerFacet: 100,
    facets: ['created_at_ts', 'updated_at_ts'],
    disjunctiveFacets: ['_tags', 'assignee', 'milestone', 'state', 'user']
  };
  var FACETS_SLIDER = ['updated_at_ts', 'created_at_ts'];
  var FACETS_ORDER_OF_DISPLAY = [ 'state', 'user', '_tags', 'milestone', 'created_at_ts', 'updated_at_ts', 'assignee'];
  var FACETS_LABELS = {'state':'State', 'user':'Author', '_tags':'Tags', 'milestone':'Milestone',
											 'created_at_ts':'Created', 'updated_at_ts':'Updated', 'assignee':'Assignee'};

  // Client + Helper initialization
  var algolia = algoliasearch(APPLICATION_ID, SEARCH_ONLY_API_KEY);
  var algoliaHelper = algoliasearchHelper(algolia, INDEX_NAME, PARAMS);

  // DOM BINDING
  var $searchInput = $('#search-input');
  var $searchInputIcon = $('#search-input-icon');
  var $main = $('main');
  var $sortBySelect = $('#sort-by-select');
  var $hits = $('#hits');
  var $stats = $('#stats');
  var $facets = $('#facets');
  var $pagination = $('#pagination');

  // Hogan templates binding
  var hitTemplate = Hogan.compile($('#hit-template').text());
  var statsTemplate = Hogan.compile($('#stats-template').text());
  var facetTemplate = Hogan.compile($('#facet-template').text());
  var sliderTemplate = Hogan.compile($('#slider-template').text());
  var paginationTemplate = Hogan.compile($('#pagination-template').text());
  var noResultsTemplate = Hogan.compile($('#no-results-template').text());

  // SEARCH BINDING
  // ==============

  // Input binding
  $searchInput
  .on('input propertychange', function (e) {
    var query = e.currentTarget.value;

    toggleIconEmptyInput(query);
    algoliaHelper.setQuery(query).search();
  })
  .focus();

  // Search errors
  algoliaHelper.on('error', function (error) {
    /* eslint-disable no-console */
    console.log(error);
    /* eslint-enable no-console */
  });

  // Update URL
  algoliaHelper.on('change', function () {
    // setURLParams();
  });

  // Search results
  algoliaHelper.on('result', function (content, state) {
    renderStats(content);
    renderHits(content);
    renderFacets(content, state);
    bindSearchObjects(state);
    renderPagination(content);
    handleNoResults(content);
  });

  // Initial search
  initFromURLParams();
  algoliaHelper.search();

  // RENDER SEARCH COMPONENTS
  // ========================

  function renderStats(content) {
    var stats = {
      nbHits: content.nbHits,
      nbHits_plural: content.nbHits !== 1,
      processingTimeMS: content.processingTimeMS
    };
    $stats.html(statsTemplate.render(stats));
  }

  function renderHits(content) {
    $hits.html(hitTemplate.render(content));
  }

  function renderFacets(content, state) {
    var facetsHtml = '';
    for (var facetIndex = 0; facetIndex < FACETS_ORDER_OF_DISPLAY.length; ++facetIndex) {
      var facetName = FACETS_ORDER_OF_DISPLAY[facetIndex];
      var facetResult = content.getFacetByName(facetName);
      if (!facetResult) continue;
      var facetContent = {};

      // Slider facets
      if ($.inArray(facetName, FACETS_SLIDER) !== -1) {
        facetContent = {
          facet: facetName,
          title: FACETS_LABELS[facetName]
        };
        facetContent.min = facetResult.stats.min;
        facetContent.max = facetResult.stats.max;
        var from = state.getNumericRefinement(facetName, '>=') || facetContent.min;
        var to = state.getNumericRefinement(facetName, '<=') || facetContent.max;
        facetContent.from = Math.min(facetContent.max, Math.max(facetContent.min, from));
        facetContent.to = Math.min(facetContent.max, Math.max(facetContent.min, to));
        facetsHtml += sliderTemplate.render(facetContent);
      } else {
        // Conjunctive + Disjunctive facets
        facetContent = {
          facet: facetName,
          title: FACETS_LABELS[facetName],
          values: content.getFacetValues(facetName, {sortBy: ['isRefined:desc', 'count:desc']}),
          disjunctive: $.inArray(facetName, PARAMS.disjunctiveFacets) !== -1
        };
        facetsHtml += facetTemplate.render(facetContent);
      }
    }
    $facets.html(facetsHtml);
  }

  function bindSearchObjects(state) {
    // Bind Sliders
    function prettify(timestamp) {
				var d = new Date(timestamp * 1000);
				return d.toISOString().slice(0, 10);
    }

    function onFinish(facetName) {
      return function (data) {
        var lowerBound = state.getNumericRefinement(facetName, '>=');
        lowerBound = lowerBound && lowerBound[0] || data.min;
        if (data.from !== lowerBound) {
          algoliaHelper.removeNumericRefinement(facetName, '>=');
          algoliaHelper.addNumericRefinement(facetName, '>=', data.from).search();
        }
        var upperBound = state.getNumericRefinement(facetName, '<=');
        upperBound = upperBound && upperBound[0] || data.max;
        if (data.to !== upperBound) {
          algoliaHelper.removeNumericRefinement(facetName, '<=');
          algoliaHelper.addNumericRefinement(facetName, '<=', data.to).search();
        }
      };
    }

    for (var facetIndex = 0; facetIndex < FACETS_SLIDER.length; ++facetIndex) {
      var facetName = FACETS_SLIDER[facetIndex];
      var slider = $('#' + facetName + '-slider');
      var sliderOptions = {
        type: 'double',
        grid: true,
        min: slider.data('min'),
        max: slider.data('max'),
        from: slider.data('from'),
        to: slider.data('to'),
        prettify: prettify,
        onFinish: onFinish(facetName)
      };
      slider.ionRangeSlider(sliderOptions);
    }
  }

  function renderPagination(content) {
    var pages = [];
    if (content.page > 3) {
      pages.push({current: false, number: 1});
      pages.push({current: false, number: '...', disabled: true});
    }
    for (var p = content.page - 3; p < content.page + 3; ++p) {
      if (p < 0 || p >= content.nbPages) continue;
      pages.push({current: content.page === p, number: p + 1});
    }
    if (content.page + 3 < content.nbPages) {
      pages.push({current: false, number: '...', disabled: true});
      pages.push({current: false, number: content.nbPages});
    }
    var pagination = {
      pages: pages,
      prev_page: content.page > 0 ? content.page : false,
      next_page: content.page + 1 < content.nbPages ? content.page + 2 : false
    };
    $pagination.html(paginationTemplate.render(pagination));
  }

  // NO RESULTS
  // ==========

  function handleNoResults(content) {
    if (content.nbHits > 0) {
      $main.removeClass('no-results');
      return;
    }
    $main.addClass('no-results');

    var filters = [];
    var i;
    var j;
    for (i in algoliaHelper.state.facetsRefinements) {
      if ({}.hasOwnProperty(algoliaHelper.state.facetsRefinements, i)) {
        filters.push({
          class: 'toggle-refine',
          facet: i, facet_value: algoliaHelper.state.facetsRefinements[i],
          label: FACETS_LABELS[i] + ': ',
          label_value: algoliaHelper.state.facetsRefinements[i]
        });
      }
    }
    for (i in algoliaHelper.state.disjunctiveFacetsRefinements) {
      if ({}.hasOwnProperty(algoliaHelper.state.disjunctiveFacetsRefinements, i)) {
        for (j in algoliaHelper.state.disjunctiveFacetsRefinements[i]) {
          if ({}.hasOwnProperty(algoliaHelper.state.disjunctiveFacetsRefinements[i], j)) {
            filters.push({
              class: 'toggle-refine',
              facet: i,
              facet_value: algoliaHelper.state.disjunctiveFacetsRefinements[i][j],
              label: FACETS_LABELS[i] + ': ',
              label_value: algoliaHelper.state.disjunctiveFacetsRefinements[i][j]
            });
          }
        }
      }
    }
    for (i in algoliaHelper.state.numericRefinements) {
      if ({}.hasOwnProperty(algoliaHelper.state.numericRefinements, i)) {
        for (j in algoliaHelper.state.numericRefinements[i]) {
          if ({}.hasOwnProperty(algoliaHelper.state.numericRefinements[i], j)) {
            filters.push({
              class: 'remove-numeric-refine',
              facet: i,
              facet_value: j,
              label: FACETS_LABELS[i] + ' ',
              label_value: j + ' ' + algoliaHelper.state.numericRefinements[i][j]
            });
          }
        }
      }
    }
    $hits.html(noResultsTemplate.render({query: content.query, filters: filters}));
  }

  // EVENTS BINDING
  // ==============

  $(document).on('click', '.toggle-refine', function (e) {
    e.preventDefault();
    algoliaHelper.toggleRefine($(this).data('facet'), $(this).data('value')).search();
  });
  $(document).on('click', '.go-to-page', function (e) {
    e.preventDefault();
    $('html, body').animate({scrollTop: 0}, '500', 'swing');
    algoliaHelper.setCurrentPage(+$(this).data('page') - 1).search();
  });
  $sortBySelect.on('change', function (e) {
    e.preventDefault();
    algoliaHelper.setIndex(INDEX_NAME + $(this).val()).search();
  });
  $searchInputIcon.on('click', function (e) {
    e.preventDefault();
    $searchInput.val('').keyup().focus();
  });
  $(document).on('click', '.remove-numeric-refine', function (e) {
    e.preventDefault();
    algoliaHelper.removeNumericRefinement($(this).data('facet'), $(this).data('value')).search();
  });
  $(document).on('click', '.clear-all', function (e) {
    e.preventDefault();
    $searchInput.val('').focus();
    algoliaHelper.setQuery('').clearRefinements().search();
  });

  // URL MANAGEMENT
  // ==============

  function initFromURLParams() {
    var URLString = window.location.search.slice(1);
    var URLParams = algoliasearchHelper.url.getStateFromQueryString(URLString);
    if (URLParams.query) $searchInput.val(URLParams.query);
    if (URLParams.index) $sortBySelect.val(URLParams.index.replace(INDEX_NAME, ''));
    algoliaHelper.overrideStateWithoutTriggeringChangeEvent(algoliaHelper.state.setQueryParameters(URLParams));
  }

  var URLHistoryTimer = Date.now();
  var URLHistoryThreshold = 700;
  function setURLParams() {
    var trackedParameters = ['attribute:*'];
    if (algoliaHelper.state.query.trim() !== '') trackedParameters.push('query');
    if (algoliaHelper.state.page !== 0) trackedParameters.push('page');
    if (algoliaHelper.state.index !== INDEX_NAME) trackedParameters.push('index');

    var URLParams = window.location.search.slice(1);
    var nonAlgoliaURLParams = algoliasearchHelper.url.getUnrecognizedParametersInQueryString(URLParams);
    var nonAlgoliaURLHash = window.location.hash;
    var helperParams = algoliaHelper.getStateAsQueryString({filters: trackedParameters, moreAttributes: nonAlgoliaURLParams});
    if (URLParams === helperParams) return;

    var now = Date.now();
		try {
				if (URLHistoryTimer > now) {
						window.history.replaceState(null, '', '?' + helperParams + nonAlgoliaURLHash);
				} else {
						window.history.pushState(null, '', '?' + helperParams + nonAlgoliaURLHash);
				}
		} catch(e) {console.log("history.{push,replace}State failed, url updating might not work.");}
    URLHistoryTimer = now + URLHistoryThreshold;
  }

  window.addEventListener('popstate', function () {
    initFromURLParams();
    algoliaHelper.search();
  });

  // HELPER METHODS
  // ==============

  function toggleIconEmptyInput(query) {
    $searchInputIcon.toggleClass('empty', query.trim() !== '');
  }
});

                            </script>
                        </body>
                    </html>