Skip to content
Snippets Groups Projects
Commit 3f575730 authored by Arthur Suzuki's avatar Arthur Suzuki
Browse files

fix bug when page not a search result page

parent c7f33097
No related merge requests found
...@@ -3,21 +3,21 @@ ...@@ -3,21 +3,21 @@
try { try {
var _paq = _paq || []; var _paq = _paq || [];
var tracksearch = false; var tracksearch = false;
var search_keywords = decodeURI(document.URL.match('expressionRecherche/([^/]+)')[1]); var search_keywords = (keywords = document.URL.match('expressionRecherche/([^/]+)')) ? decodeUri(keywords[1]) : '';
var search_type = document.URL.match('recherche/([^/]+)')[1]; var search_type = (type = document.URL.match('recherche/([^/]+)')) ? type[1] : '';
var search_facets = ''; var search_facets = '';
var search_page = ''; var search_page = '';
var result_count = 0; var result_count = 0;
// compatibilité Magasin de thème // compatibilité Magasin de thème
if ( $('body').attr('data-template') && $('div.search_result') ) { if ( search_keywords && ('body').attr('data-template') && $('div.search_result') ) {
result_count = $('li.result_count_results').text().match('[0-9]+')[0]; result_count = $('li.result_count_results').text().match('[0-9]+')[0];
search_page = $('li.result_pager span').html().match(' ([0-9]+) /')[1]; search_page = $('li.result_pager span').html().match(' ([0-9]+) /')[1];
tracksearch = true; tracksearch = true;
} }
// compatibilité thème historique // compatibilité thème historique
if ( $('body').hasClass('template_HISTORIC') && $('div.resultats_page')) { if ( search_keywords && $('body').hasClass('template_HISTORIC') && $('div.resultats_page')) {
result_count = $('span.nombre-recherche').text().match('[0-9]+')[0]; result_count = $('span.nombre-recherche').text().match('[0-9]+')[0];
search_page = $('div.pager span.current a').html(); search_page = $('div.pager span.current a').html();
tracksearch = true; tracksearch = true;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment