Skip to content

Commit 33e0831

Browse files
committed
fix:Hunger games button outside list barcodes
1 parent 4c65e4a commit 33e0831

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

OpenFoodFactsPower.user.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,7 @@ ul#products_match_all > li > a > span { display: table-cell; width: 70%; vert
11561156

11571157
// detect product codes and add them as attributes
11581158
addCodesToProductList();
1159+
showListButtons();
11591160
loadAlwaysShowBarcodesFromStorage();
11601161

11611162
// Show an easier to read number of products
@@ -1955,12 +1956,18 @@ ul#products_match_all > li > a > span { display: table-cell; width: 70%; vert
19551956
});
19561957
}
19571958

1958-
19591959
function hideListBarcodes() {
19601960
$("svg.list_barcode").remove();
19611961
$('ul[id^="products_"].search_results .with_barcode').removeClass('with_barcode');
19621962
}
19631963

1964+
function showListButtons(){
1965+
$("ul[id^='products_'].search_results li[data-code]").each(function(index, element) {
1966+
let code = $(this).attr('data-code');
1967+
$(this).append('<a class="list_hunger_games_logo_search" alt="Hunger games logo search" title="Hunger games logo search" href="https://hunger.openfoodfacts.org/logos/search?barcode='+code+'"><span class="material-icons">image_search</span></a>');
1968+
1969+
});
1970+
}
19641971

19651972
/**
19661973
* The product list view has no easy way to get the barcode for each entry,

0 commit comments

Comments
 (0)