From: Vincent Vanwaelscappel Date: Tue, 3 Sep 2013 14:02:34 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=7ebbbed9310fec0547d57706ca884f0b2cf8f1e9;p=fluidbook-html5.git --- diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index e2be2c90..e7556442 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -825,20 +825,19 @@ Fluidbook.prototype = { $(".doubleThumb").each(function() { var pages = $(this).data('pages').toString().split(','); var hitsp = 0; - var pagesWithHits = 0; + var pagesWithHits = []; for (var i in pages) { var n = parseInt(pages[i]); if (hits[n] > 0) { hitsp += hits[n]; - pagesWithHits++; + pagesWithHits.push(pages[i]); } } - - if($(this)) - if ($(this).find('.hits').length > 0) { - return; - } + if ($(this)) + if ($(this).find('.hits').length > 0) { + return; + } if (hitsp == 0) { if (hideNoResults) { @@ -849,10 +848,14 @@ Fluidbook.prototype = { $(this).append('
' + $this.l10n.__('no result found') + '
'); } else { $(this).append('
' + hitsp + ' ' + $this.l10n.__('hit(s)') + '
'); - if (pagesWithHits <= 2) { - $(this).find('a').attr('href', '#/page/' + $(this).attr('page')); + if ($this.pad.enabled) { + if (pagesWithHits.length == 1) { + $(this).find('a').attr('href', '#/page/' + pagesWithHits[0]); + } else { + $(this).find('a').attr('href', '#/search/' + e + '/' + $(this).attr('page')); + } } else { - $(this).find('a').attr('href', '#/search/' + e + '/' + $(this).attr('page')); + $(this).find('a').attr('href', '#/page/' + $(this).attr('page')); } } });