},
navigateResults: function (dir) {
- this.fluidbook.keyboard._navigate('#menuSearchResults .doubleThumb', dir);
+ this.fluidbook.keyboard._navigate('#menuSearchResults .menuSearchResult', dir);
},
closeResultsNav: function (keepSearch) {
hits[k] += v;
});
- // ToDo: check the purpose of the group variable? Also check tracking
- //$this.displayResults(r, group, cb);
- //console.log('Search results...');
- //console.log(results);
-
// Display results
// Use the index of all pages as a starting point to filter results thumbnails
- this.menuSearchResults.html(this.fluidbook.menu.index._getNormalView(true, 141)).hide();
+ this.menuSearchResults.html(this.fluidbook.menu.index._getSearchResultsView()).hide();
var spreadEnabled = 0;
// Process each spread of pages to collect the ones with results
}
} else {
spreadEnabled++;
- $(this).attr('data-enabled', '1');
- // Add the link to the main result page. Link around the hits div is for better usability (previously wasn't clickable)
- $(this).append('<a href="#/page/' + $(this).attr('page') + '"><div class="hits yes">' + totalHits + ' ' + $this.fluidbook.l10n.__('hit(s)') + '</div></a>');
+
+ var url = '#/page/' + $(this).attr('page');
if ($this.fluidbook.pad.enabled) {
if (pagesWithHits.length == 1) {
- $(this).find('a').attr('href', '#/page/' + pagesWithHits[0]);
+ url = '#/page/' + pagesWithHits[0];
} else {
- $(this).find('a').attr('href', '#/search/' + e + '/' + $(this).attr('page'));
+ url = '#/search/' + e + '/' + $(this).attr('page');
}
- } else {
- $(this).find('a').attr('href', '#/page/' + $(this).attr('page'));
}
+
+ $(this).wrap('<a class="menuSearchResult" href="' + url + '"></a>');
+ $(this).attr('data-enabled', '1');
+ // Add the link to the main result page. Link around the hits div is for better usability (previously wasn't clickable)
+ $(this).append('<div class="hits yes">' + totalHits + ' ' + $this.fluidbook.l10n.__('hit(s)') + '</div>');
+
}
});
return this.normalHTML;
},
- _getNormalView: function (forceNormal, height) {
+ _getSearchResultsView: function () {
+ return this._getNormalView(true, 141, false, false);
+ },
+
+ _getNormalView: function (forceNormal, height, bookmarks, pageLinks) {
var contentClass = 'content';
+ if (pageLinks === undefined) {
+ pageLinks = true;
+ }
+ if (bookmarks === undefined) {
+ bookmarks = true;
+ }
if (forceNormal === undefined) {
forceNormal = false;
}
}
if (i > 0) {
- ix1 += this._thumb(i, s1, height);
- if (this.fluidbook.bookmarks.enabled) {
+ ix1 += this._thumb(i, s1, height, undefined, pageLinks);
+ if (this.fluidbook.bookmarks.enabled && bookmarks) {
ix1 += this.fluidbook.bookmarks.getBookmarkForPage(i, mobileFirst, this.fluidbook.settings.bookmarkPermanentIcon);
}
pages.push(i);
}
if (!this.singleMode) {
if (j <= this.fluidbook.contentlock.getMaxPage()) {
- ix2 += this._thumb(j, s1, height);
- if (this.fluidbook.bookmarks.enabled) {
+ ix2 += this._thumb(j, s1, height, undefined, pageLinks);
+ if (this.fluidbook.bookmarks.enabled && bookmarks) {
ix2 += this.fluidbook.bookmarks.getBookmarkForPage(j, true);
}
ix2 += '</div>';
return res;
},
- _thumb: function (page, side, height, label) {
+ _thumb: function (page, side, height, label, link) {
+ if (link === undefined) {
+ link = true;
+ }
var dim = this.getThumbDimensions(page, height);
var virtual = this.fluidbook.physicalToVirtual(page);
if (label === undefined) {
label = virtual;
}
- return '<div class="thumb ' + side + '" ' + dim.thumb + '><a role="button" aria-label="' + sprintf(this.fluidbook.l10n.__('goto page %s'), label) + '" href="#/page/' + page + '">' + this.fluidbook.loader.getThumbImage(page, true, dim.thumb) + '</a><span aria-hidden="true" class="number" ' + dim.pagenumber + '>' + label + '</span>';
+ var res = '<div class="thumb ' + side + '" ' + dim.thumb + '>';
+ if (link) {
+ res += '<a role="button" aria-label="' + sprintf(this.fluidbook.l10n.__('goto page %s'), label) + '" href="#/page/' + page + '">';
+ }
+ res += this.fluidbook.loader.getThumbImage(page, true, dim.thumb);
+ if (link) {
+ res += '</a>';
+ }
+ res += '<span aria-hidden="true" class="number" ' + dim.pagenumber + '>' + label + '</span>';
+ return res;
},
getThumbDimensions: function (page, height) {