mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-06 16:53:34 +02:00
Variable to limit the number of results is set to 100. Added some translation lines to notice the user that he has ti refine the search. One translation line corrected because it was in french in the uk_UK file
This commit is contained in:
@@ -12,8 +12,12 @@ var data = {json_encode($data_cat)};
|
||||
// Numeric array of all categories
|
||||
var categories = Object.values(data);
|
||||
|
||||
const RESULT_LIMIT = 100;
|
||||
|
||||
var str_albums_found = '{"<b>%d</b> albums found"|translate}';
|
||||
var str_album_found = '{"<b>1</b> album found"|translate}';
|
||||
var str_result_limit = '{"<b>%d+</b> albums found, try to refine the search"|translate}';
|
||||
|
||||
{literal}
|
||||
var editLink = "admin.php?page=album-";
|
||||
var colors = ["icon-red", "icon-blue", "icon-yellow", "icon-purple", "icon-green"];
|
||||
@@ -39,14 +43,18 @@ function updateSearch () {
|
||||
|
||||
nbResult = 0;
|
||||
categories.forEach((c) => {
|
||||
if (c[0].toString().toLowerCase().search(string.toLowerCase()) != -1) {
|
||||
if (c[0].toString().toLowerCase().search(string.toLowerCase()) != -1 && nbResult < RESULT_LIMIT) {
|
||||
addAlbumResult(c);
|
||||
nbResult++;
|
||||
}
|
||||
})
|
||||
|
||||
if (nbResult != 1) {
|
||||
$('.search-album-num-result').html(str_albums_found.replace('%d', nbResult));
|
||||
if (nbResult >= RESULT_LIMIT) {
|
||||
$('.search-album-num-result').html(str_result_limit.replace('%d', nbResult));
|
||||
} else {
|
||||
$('.search-album-num-result').html(str_albums_found.replace('%d', nbResult));
|
||||
}
|
||||
} else {
|
||||
$('.search-album-num-result').html(str_album_found);
|
||||
}
|
||||
@@ -104,7 +112,7 @@ function getHtmlPath (cat) {
|
||||
return html
|
||||
}
|
||||
|
||||
// Make the results appear one after one
|
||||
// Make the results appear one after one [and limit results to 100]
|
||||
function resultAppear(result) {
|
||||
result.fadeIn();
|
||||
if (result.next().length != 0) {
|
||||
|
||||
@@ -1131,3 +1131,4 @@ $lang['Apply an automatic order'] = 'Apply an automatic order';
|
||||
$lang['Root'] = 'Root';
|
||||
$lang['Apply to direct sub-albums'] = 'Apply to direct sub-albums';
|
||||
$lang['Apply to the whole hierarchy'] = 'Apply to the whole hierarchy';
|
||||
$lang['<b>%d+</b> albums found, try to refine the search'] = '<b>%d+</b> albums found, try to refine the search';
|
||||
|
||||
@@ -1133,3 +1133,4 @@ $lang['Apply an automatic order'] = 'Appliquer un ordre automatique';
|
||||
$lang['Root'] = 'Racine';
|
||||
$lang['Apply to direct sub-albums'] = 'Appliquer aux sous-albums';
|
||||
$lang['Apply to the whole hierarchy'] = 'Appliquer à toute l\'arborescence';
|
||||
$lang['<b>%d+</b> albums found, try to refine the search'] = '<b>%d+</b> albums trouvé, essayez d affiner la recherche';
|
||||
|
||||
Reference in New Issue
Block a user